r:红色
g:绿色
b:蓝色
assume cs:code
code segment
start:
;调用16号中断0号功能
mov ah,0
int 16h
;识别按键
mov ah,1
cmp al,'r'
je red
cmp al,'g'
je green
cmp al,'b'
je blue
jmp short ret1
;设置屏幕颜色
red:shl ah,1
green:shl ah,1
blue:mov bx,0b800h
mov es,bx
mov bx,1
mov cx,2000
s:and byte ptr es:[bx],11111000b
or es:[bx],ah
add bx,2
loop s
ret1:mov ax,4c00h
int 21h
code ends
end start