书上有句“然后返回到DOS”这里说的是纯DOS模式么?我看了这个实验的程序都是 mov ax, 4c00h int 21h 结尾的,这个语句直接关闭MS-DOS了,iret可以显示字符串,但是也返回不到DOS,好像是死循环 -_-#,这里面用IRET返回,控制权(CS:IP)是交给DOS了还是系统内部了。。。
附上代码:
assume cs:codesg
codesg segment
start:
mov cx, offset _int0end - offset int0
mov ax, cs
mov ds, ax
mov si, offset int0
mov ax, 0
mov es, ax
mov di, 200h
cld
rep movsb
mov word ptr es:[0], 200h
mov word ptr es:[2], 0
mov ax, 1000h
mov bl, 1
div bl
mov ah, 1
int 21h
mov ax, 4c00h
int 21h
int0:
jmp short _int0start
db 'divide error!',0
_int0start:
mov cx, 0b800h
mov es, cx
mov di, 0
mov si, 202h
xor cx, cx
_int0show:
mov cl, cs:[si]
jcxz _int0showend
mov es:[di], cl
inc si
add di, 2
jmp short _int0show
_int0showend:
iret
_int0end:
nop
codesg ends
end start |