代码解释如下:
;从键盘缓冲区中读取字节,根据读取的不同内容改变屏幕颜色assume cs:codecode segmentstart: mov ah,0 ;ah去控制颜色 int 16h ;从键盘缓冲区读取出数据 , ah存字符的通码,al为字符的ASCII码 mov ah,1 cmp al,'r' ;若按下r je red cmp al,'g' ;按下g je green cmp al,'b' ;按下b je blue jmp short startRet ;否则就结束red: shl ah,1green: shl ah,1blue: mov bx,0b800h mov es,bx mov cx,2000 mov bx,1s: and byte ptr es:[bx],11111000B ;循环修改字符的颜色,每个字符2个字节,奇数位字节控制颜色,一页是2000个字符 or es:[bx],ah add bx,2 loop sstartRet: mov ax,4c00h int 21h;========================================================= code endsend start
新闻热点
疑难解答