assume cs:code
code segment
start:
mov ax,cs
mov ds,ax
mov si,setscreen
xor ax,ax
mov es,ax
mov di,200h
mov cx,endscreen-setscreen
cld
rep movsb
mov word ptr es:[7ch*4],200h
mov word ptr es:[7ch*4+2],0
mov ah,2 ;测试int 7ch中断
mov al,4 ;测试int 7ch中断
int 7ch ;测试int 7ch中断
mov ax,4c00h
int 21h
org 200h
setscreen:
jmp begin
table dw sub0,sub1, sub2, sub3
begin:
push bx
cmp ah,3
ja sret
mov bl,ah
xor bh,bh
add bx,bx
call table[bx]
sret:
pop bx
iret
sub0:
push bx
push cx
push es
mov bx,0b800h
mov es,bx
xor bx,bx
mov cx,2000
s0:
mov byte ptr es:[bx],' '
add bx,2
loop s0
pop es
pop cx
pop bx
ret
sub1:
push bx
push cx
push dx
push es
mov bx,0b800h
mov es,bx
mov bx,1
and byte ptr es:[bx],11111000b
or es:[bx],al
mov dl,es:[bx]
mov cx,2000
s1:
mov es:[bx],dl
add bx,2
loop s1
pop es
pop dx
pop cx
pop bx
ret
sub2:
push bx
push cx
push dx
push es
mov cl,4
shl al,cl
mov bx,0b800h
mov es,bx
mov bx,1
and byte ptr es:[bx],10001111b
or es:[bx],al
mov dl,es:[bx]
mov cx,2000
s2:
mov es:[bx],dl
add bx,2
loop s2
pop es
pop dx
pop cx
pop bx
ret
sub3:
push cx
push si
push di
push es
push ds
mov si,0b800h
mov es,si
xor di,di
mov ds,si
mov si,160
mov cx,24*80
cld
rep movsw
mov cx,80
s3:
mov byte ptr es:[di],' '
add di,2
loop s3
pop ds
pop es
pop di
pop si
pop cx
ret
endscreen:
nop
code ends
end start