x86汇编中 为何debug单步调试结果和直接运行不相同 10
Main:org100hmovax,csmovds,axmoves,axmovax,1234callprintIntprintInt:movcx,0xorbp,bpmov...
Main:
org 100h
mov ax,cs
mov ds,ax
mov es,ax
mov ax, 1234
call printInt
printInt:
mov cx,0
xor bp,bp
mov cx, 0
mov si, 0
mov bx, 10
@start:
xor dx,dx
cmp ax, 0
je @return
div bx
add dx, '0'
mov [tmp + si], dx
add si, 1
add cx, 1
jmp @start
@return:
mov bp, tmp
mov ah, 13h
mov al,1
mov dh,1
mov dl,0
mov bl,0fh
mov bh,0
int 10h
ret
tmp:
db 16
单步调试出来是正确的4321,直接运行却是5684 展开
org 100h
mov ax,cs
mov ds,ax
mov es,ax
mov ax, 1234
call printInt
printInt:
mov cx,0
xor bp,bp
mov cx, 0
mov si, 0
mov bx, 10
@start:
xor dx,dx
cmp ax, 0
je @return
div bx
add dx, '0'
mov [tmp + si], dx
add si, 1
add cx, 1
jmp @start
@return:
mov bp, tmp
mov ah, 13h
mov al,1
mov dh,1
mov dl,0
mov bl,0fh
mov bh,0
int 10h
ret
tmp:
db 16
单步调试出来是正确的4321,直接运行却是5684 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询