汇编子程序ret不到正确的地址
assume cs:code,ds:data,ss:stackdata segment
x dw 1234
y dw 100 dup(?) ;存放数字的ASCII码
data ends
stack segment
dw 16 dup(?)
stack ends
code segment
start:
mov ax,stack
mov ss,ax
mov ax,data
mov ds,ax
mov dx,0
mov ax,x
mov si,0
call s
mov ax,4c00h
int 21h
s proc near
res:mov cx,10
push ax
mov ax,dx
mov dx,0
div cx
mov bx,ax
pop ax
div cx
mov cx,dx
mov dx,bx
push dx
add cl,30h
mov ds:[si+4],cl
pop dx
push ax
push dx
add ax,dx
jz goOut
pop dx
pop ax
inc si
jmp res
goOut:
pop dx
pop ax
mov dl,ds:[si+4]
mov ah,2
int 21h
cmp si,0
jz ok
dec si
jmp goOut
ok:
ret //这个地方使用ret回不到原来的地方,因为程序并未返回dos
;mov ax,4c00h //把ret直接改成返回dos就可以正常运行,请问是怎么一回事
;int 21h
s endp
code ends
end start