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 int7cstart
mov ax,0
mov es,ax
mov di,200h
mov cx, offset int7cend - offset int7cstart
cld
rep movsb
mov word ptr es:[4*7ch],200h
mov word ptr es:[4*7ch+2],0
mov ax,4c00h
int 21h
int7cstart:
jmp short codestart
table dw offset sh0 - offset int7cstart + 200h,
offset sh1 - offset int7cstart + 200h,
offset sh2 - offset int7cstart + 200h,
offset sh3 - offset int7cstart + 200h
codestart:
cmp ah,3
ja ok
push bx
push si
mov bl,ah
mov bh,0
add bx,bx
mov si,offset start - offset int7cstart
call word ptr table[bx+si+200h]
pop si
pop bx
jmp ok
sh0:
push cx
push es
push di
mov cx,0b800h
mov es,cx
mov di,0
mov cx,2000
sclear:
mov byte ptr es:[di],' '
add di,2
loop sclear
pop di
pop es
pop cx
ret
sh1:
push cx
push es
push di
mov cx,0b800h
mov es,cx
mov di,1
mov cx,2000
sfrontcolor:
and byte ptr es:[di],11111000b
or es:[di],al
add di,2
loop sfrontcolor
pop di
pop es
pop cx
ret
sh2:
push cx
push es
push di
mov cx,0b800h
mov es,cx
mov di,1
mov cx,2000
sbackcolor:
and byte ptr es:[di],10001111b
or es:[di],al
add di,2
loop sbackcolor
pop di
pop es
pop cx
ret
sh3:
push cx
push es
push di
push ds
push si
mov cx,0b800h
mov es,cx
mov ds,cx
mov di,0
mov si,160
cld
mov cx,24
sremove:
push cx
mov cx,160
rep movsb
pop cx
loop sremove
mov cx,80
sclearlast:
mov byte ptr es:[di],' '
add di,2
loop sclearlast
pop si
pop ds
pop di
pop es
pop cx
ret
ok:
iret
int7cend:
nop
code ends
end start
汇编语言 王爽(第三版)实验十六
最新推荐文章于 2024-08-12 04:14:15 发布