程序编好后,我试运行了一下,我的DOS窗口一下子消失了,于是我进行debug单步跟踪。
当程序运行到mov word ptr es:[9*4],204h时,出现如下错误提示:
An internal stack overflow has caused this session to be halted.
Change the STACKS setting in your CONFIG.SYS file, and then try again.
我翻译一下:
一个内部栈出现了溢出,这次的运行中断了。
在你的CONFIG.SYS文件中改变栈设置,然后再试一遍。
也不知道翻译的对不对。我把截图放到了我的学习博客里了,请前辈们指点一下,谢谢。
我的程序贴出来供大家参考。
assume cs:code
stack segment
db 128 dup (0)
stack ends
code segment
start:
mov ax,stack
mov ss,ax
mov sp,128
mov ax,cs
mov ds,ax
mov si,offset int9
mov ax,0
mov es,ax
mov di,204h
mov cx,offset int9end-offset int9
cld
rep movsb
push es:[9*4]
pop es:[200h]
push es:[9*4+2]
pop es:[202h]
mov word ptr es:[9*4],204h
mov word ptr es:[9*4+2],0
mov ax,4c00h
int 21h
int9:
push ax
push bx
push cx
push es
in al,60h
pushf
call word ptr cs:[200h]
cmp al,9eh
jne int9ret
mov ax,0B800h
mov es,ax
mov bx,0
mov cx,2000
s: inc byte ptr es:[bx]
add bx,2
loop s
int9ret:
pop es
pop cx
pop bx
pop ax
iret
int9end:
nop
code ends
end start |