请教,call ret 不能返回到call的下一句,帮看一下小程序
assume cs:code,ds:data,ss:stackdata segment
db 10h dup(0)
data ends
stack segment
db 20h dup(0)
stack ends
code segment
start: mov ax,0ffffh
mov dx,000fh
mov cx,10
mov bx,data
mov ds,bx
mov bx,stack
mov ss,bx
mov sp,20h
mov si,0
call far ptr dtoc ;算出十进制数
call1: mov dh,8 ;行
mov dl,3 ;列
mov cl,2 ;颜色
mov si,0 ;串首址
call far ptr show_str ;显示
mov ax,4c00h
int 21h
dtoc: ;把数字计算为十进制数存于内存
push di
push bp
dtoc_s1:
push cx
call far ptr divdw ;双字不溢出除法
add cl,30h
mov [si],cl
mov cx,ax
jcxz dtoc_ok
inc si
pop cx
jmp short dtoc_s1
dtoc_ok:
push ax ;排序
mov ax,si
mov bx,2
div bx
mov cx,ax
mov di,0
dtoc_s2:
mov al,[di]
xchg al,[si]
xchg al,[di]
inc di
dec si
loop dtoc_s2
pop ax
pop bp
pop di
;jmp far ptr call1;这个返回正常
retf;这个返回错误,为什么?
divdw: ;双字不溢出除法
push si
push di
mov si,ax
mov ax,dx
sub dx,dx
div cx
mov di,ax
mov ax,si
div cx
mov cx,dx
mov dx,di
pop di
pop si
retf
show_str: ;显示串,以0结尾
mov ax,0b800h
mov es,ax
mov al,0a0h
dec dh
mul dh
mov bx,ax
mov al,2h
mul dl
add ax,bx
mov di,ax
mov al,cl
showstr_s1:
mov cl,[si]
mov ch,0
jcxz showstr_ok
mov ch,al
mov es:[di][bx],cx
inc si
add bx,2
jmp short showstr_s1
showstr_ok:
retf
code ends
end start