您的位置:首页 > 其它

汇编语言 王爽(第三版)实验十六

2016-11-30 22:48 344 查看
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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  汇编语言