后知淡然 发表于 2011-10-11 22:04:22

实验15,照书上小改动完成的

本帖最后由 Sabo 于 2011-10-11 22:06 编辑


;实验15
assume cs:code
stack segment
db 128 dup (0)
stack ends

code segment
start:
mov ax,stack
mov ss,ax
mov sp,128

push cs
pop ds

mov ax,0
mov es,ax

mov si,offset int9   ;安装新的int9
mov di,204h
mov cx,offset int9end - offset int9
cld
rep movsb

push es:   ;保存原int9
pop es:
push es:
pop es:

cli

mov WORD ptr es:,204h ;将新的int9送入中断向量表
mov WORD ptr es:,0

sti

;为了看到效果,加入以下代码
;begin
mov dx,0ffffh
mov ax,0ffffh
kkk:
sub ax,1
sbb dx,0
cmp dx,0
jne kkk
cmp ax,0
jne kkk
mov ah,1
int 21h

mov ax,4c00h
int 21h
;end

int9:
push ax
push bx
push cx
push es

in al,60h

pushf
call DWORD ptr cs:

cmp al,9eh;判断al是否为A的断码,既松开按键所产生的扫描码
jne int9ret

mov ax,0b800h
mov es,ax
mov bx,2
mov cx,2000
s:
mov BYTE ptr es:,'A'
add bx,2
loop s

int9ret:
pop es
pop cx
pop bx
pop ax
iret
int9end:
nop

code ends
end start
:P

后知淡然 发表于 2011-10-11 22:07:50

为何第十五章最后的指令系统总结里有些代码王爽老师没有在书中讲过?
页: [1]
查看完整版本: 实验15,照书上小改动完成的