标签:
与原实验稍有不同,实现的功能为按下1键清屏
按下2键设置前景色为蓝色
按下3键设置背景色为白色
按下4键向上滚动一行
assume cs:code stack segment db 128 dup (0) stack ends code segment start: mov ax,stack mov ss,ax mov sp,128 mov ax,cs mov ds,ax mov ax,0 mov es,ax mov di,204h mov si,offset int9 mov cx,offset int9end-offset int9 cld rep movsb push es:[9*4] pop es:[200h] push es:[9*4+2] pop es:[202h] cli mov word ptr es:[9*4],204h mov word ptr es:[9*4+2],0 sti mov ax,4c00h int 21h int9: push ax push bx push cx push es in al,60h pushf call dword ptr cs:[200h] cmp al,02 je do1 cmp al,03 je do2 cmp al,04 je do3 cmp al,05 je do4 jmp short int9ret do1: call sub1 jmp short int9ret do2: call sub2 jmp short int9ret do3: call sub3 jmp short int9ret do4: call sub4 jmp short int9ret int9ret:pop es pop cx pop bx pop ax iret sub1: push bx push cx push es mov bx,0b800h mov es,bx mov bx,0 mov cx,2000 sub1s: mov byte ptr es:[bx],‘ ‘ add bx,2 loop sub1s pop es pop cx pop bx ret sub2: push ax push bx push cx push es mov bx,0b800h mov es,bx mov bx,1 mov cx,2000 mov al,00000001b sub2s: and byte ptr es:[bx],11111000b or es:[bx],al add bx,2 loop sub2s pop es pop cx pop bx pop ax ret sub3: push ax push bx push cx push es mov bx,0b800h mov es,bx mov bx,1 mov cx,2000 mov al,01110000b sub3s: and byte ptr es:[bx],10001111b or es:[bx],al add bx,2 loop sub3s pop es pop cx pop bx pop ax ret sub4: push cx push si push di push es push ds mov si,0b800h mov es,si mov ds,si mov si,160 mov di,0 cld mov cx,24 sub4s: push cx mov cx,160 rep movsb pop cx loop sub4s mov cx,80 mov si,0 sub4s1: mov byte ptr [160*24+si],‘ ‘ add si,2 loop sub4s1 pop ds pop es pop di pop si pop cx ret int9end:nop code ends end start
标签:
原文地址:http://www.cnblogs.com/monster-prince/p/5543535.html