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 si,offset int7ch
mov ax,0
mov es,ax
mov di,200h
mov cx,offset int7chEnd - offset int7ch
cld
rep movsb
cli
mov word ptr es:[7ch*4],200h
mov word ptr es:[7ch*4+2],0
sti
mov ah,0
int 7ch
mov ax,4c00h
int 21h
int7ch:
jmp short set
table dw do0,do1,do2,do3 ;主要是这里有问题,找不到正确的入口
set:
push bx
cmp ah,3
ja int7chret
mov bl,ah
mov bh,0
add bx,bx
call word ptr table[bx]
int7chret:
pop bx
iret
do0: push ax
push bx
push cx
push es
push si
push di
mov ax,0b800h
mov es,ax
mov bx,0
mov cx,2000
s1: mov byte ptr es:[bx],' '
mov byte ptr es:[bx+1],00000111b
add bx,2
loop s1
pop di
pop si
pop es
pop cx
pop bx
pop ax
ret
do1:
push ax
push bx
push cx
push es
push si
push di
mov bx,0b800h
mov es,bx
mov bx,1
mov cx,2000
s2:
and byte ptr es:[bx],11111000b
or es:[bx],al
add bx,2
loop s2
pop di
pop si
pop es
pop cx
pop bx
pop ax
ret
do2:
push ax
push bx
push cx
push es
push si
push di
mov cl,4
shl al,cl
mov bx,0b800h
mov es,bx
mov bx,1
mov cx,2000
s3:
and byte ptr es:[bx],10001111b
or es:[bx],al
add bx,2
loop s3
pop di
pop si
pop es
pop cx
pop bx
pop ax
ret
do3:
push ax
push bx
push cx
push es
push si
push di
mov ax,0b800h
mov ds,ax
mov es,ax
mov si,160
mov di,0
mov cx,2000
cld
rep movsb
mov bx,0
mov cx,80
s4: mov byte ptr es:[160*24+bx],' '
add bx,2
loop s4
pop di
pop si
pop es
pop cx
pop bx
pop ax
ret
int7chEnd:
nop
code ends
end start
===========================