王爽15章例题的调试错误
关于15章程序单步调试出错assume cs:code
stack segment
db 128 dup (0)
stack ends
data segment
dw 0,0
data ends
code segment
start: mov ax,stack
mov ss,ax
mov sp,128
mov ax,data
mov ds,ax
mov ax,0
mov es,ax
push es:
pop ds:
push es:
pop ds:
cli
mov word ptr es:,offset int9 ;调试到这一步就出现调试错误
mov es:,cs
sti
mov ax,0b800h
mov es,ax
mov ah,'a'
s: mov es:,ah
call delay
inc ah
cmp ah,'z'
jna s
mov ax,0
mov es,ax
push ds:
pop es:
push ds:
pop es:
mov ax,4c00h
int 21h
delay: push ax
push dx
mov dx,1000h
mov ax,0
s1: sub ax,1
sbb dx,0
cmp ax,0
jne s1
cmp dx,0
jne s1
pop dx
pop ax
ret
int9: push ax
push bx
push es
in al,60h
pushf
pushf
pop bx
and bh,11111100b
push bx
popf
call dword ptr ds:
cmp al,3bh
jne int9ret
mov ax,0b800h
mov es,ax
inc byte ptr es:
int9ret:pop es
pop bx
pop ax
iret
code ends
end start
你的代码没错,但
mov word ptr es:,offset int9
这涉及到了修改DOS的中断例程
由于有操作系统保护,所以你修改不了
解决方法:纯DOS下运行调试
页:
[1]