|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
assume cs:code, ss:stack
stack segment
db 128 dup(0)
stack ends
code segment
start: call init
call display
mov ax,4c00h
int 21h
display: push ax
push es
mov ax,0b800h
mov es,ax
mov ah,'a'
s0: mov es:[160*12+40*2],ah
call delay
inc ah
cmp ah,'z'
jna s0
return: pop es
pop ax
ret
delay: push ax
push bx
mov bx,1000h
mov ax,0
s1: sub ax,1
sbb bx,0
cmp ax,0
jne s1
cmp bx,0
jne s1
pop bx
pop ax
ret
init: mov ax,stack ;起初设置栈段地址
mov ss,ax
mov sp,128 ;设置栈顶指针
mov ax,0 ;设置目标地址的段地址
mov es,ax
mov di,0204h ;设置目的偏移地址
push cs ;设置源操作数段地址
pop ds
mov si,offset int9
mov cx,offset endint9 - offset int9
cld ;设置偏移地址往前递增DF=0
rep movsb
push es:[9*4] ;将中断向量标中的地址存放在200h和202h四个字节中
pop es:[200h] ;存放的偏移地址
push es:[9*4+2]
pop es:[202h] ;段地址
cli ;下面将对中断向量表的地址进行设置在这个过程中如果相应了中断,进入了错误的地址执行程序会出问题的
mov word ptr es:[9*4],204H
mov word ptr es:[9*4+2],0
sti ;开中断允许位
ret
int9: push ax
push es
pushf ;进入中断9以后已经将IF和TF置0了
in al,60h
call dword ptr cs:[200h]
cmp al,1
jne s3
mov ax,0b800h
mov es,ax
inc byte ptr es:[160*12+40*2+1]
s3: pop es
pop ax
iret
endint9: nop
code ends
end start
总是在mov word ptr es:[9*4],204H被系统提出来是怎么回事啊!我搞了好久了啊!
|
|