本帖最后由 jackz007 于 2023-1-13 16:51 编辑
你根据什么说程序死循环了?代码里有循环吗?assume cs:code , ds:data
stack segment para stack 'STACK'
dw 400h dup(0)
stack ends
data segment para public 'DATA'
dd 100001
dw 100
buff01 db 20h dup(00)
data ends
code segment para public 'CODE'
show_dec proc near
push bp
mov bp,sp
push ax
push cx
push dx
push si
push di
push ds
mov dx,[bp+4]
mov ax,[bp+6]
mov si,offset buff01
push si
mov cx,10
dec01: div cx
add dl,'0'
mov byte ptr ds:[si],dl
inc si
xor dx,dx
or ax,ax
jnz dec01
mov byte ptr ds:[si],al
lea di,[si-1]
pop si
push si
dec02: cmp si,di
jae dec03
mov al,byte ptr[si]
xchg byte ptr[di],al
mov byte ptr ds:[si],al
inc si
dec di
jmp short dec02
dec03: pop si
mov ah,2
dec04: mov dl,ds:byte ptr[si]
or dl,dl
jz dec05
int 21h
inc si
jmp short dec04
dec05: pop ds
pop di
pop si
pop dx
pop cx
pop ax
mov sp,bp
pop bp
ret 04
show_dec endp
main proc far
mov ax,data
mov ds,ax
mov ax, word ptr ds:[0]
mov dx, word ptr ds:[2]
div word ptr ds:[4]
xor dx,dx
push ax
push dx
call show_dec
mov ax,4c00h
int 21h
main endp
code ends
end main
|