汇编程序33:问题10.2
1 assume cs:code,ds:data,ss:stack 2 //模块化程序初步,使用call与ret建立子程序 3 data segment 4 db 'word',0 5 db 'unix',0 6 db 'wind',0 7 db 'good',0 8 data ends 9 10 stack segment 11 dw 8 dup(0) 12 stack ends 13 14 code segment 15 start: 16 mov ax,data 17 mov ds,ax 18 mov bx,0 19 mov cx,4 20 s: 21 mov si,bx 22 call capital //下一条指令第一字节作为IP压栈,随后跳到标号处 23 add bx,5 24 loop s 25 mov ax,4c00h 26 int 21h 27 capital: 28 push cx 29 mov cl,[si] 30 mov ch,0 31 jcxz ok 32 and byte ptr [si],11011111b 33 inc si 34 pop cx 35 jmp short capital 36 ok: 37 pop cx 38 ret //取出之前压入的IP,随后跳到新IP处执行指令 39 code ends 40 41 end start
··