标题:INT 16调用的问题
只看楼主
stcrs
Rank: 1
等 级:新手上路
帖 子:30
专家分:0
注 册:2006-6-29
 问题点数:0 回复次数:1 
INT 16调用的问题

assume cs:code
code segment
start : 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 sret
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
sret: mov ax.4c00h
int 21h
code ends
end start

请问画线处的程序是用什么比较技巧?

搜索更多相关主题的帖子: INT 
2006-11-14 12:24
wchx215
Rank: 1
等 级:新手上路
帖 子:70
专家分:0
注 册:2006-9-4
得分:0 

因为显示字符的属性11111111b中后三位分别代表红,绿,蓝
and byte ptr es:[bx],11111000b
or es:[bx],ah
就是想显示你要的颜色,很明显兰色是or es:[bx],00000001b
绿色是or es:[bx],00000010b
红色是or es:[bx],00000100b
就是对ah进行移位操作,而画线的功能是使其移位具有连续性,使程序简洁。


2006-11-15 17:25



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-102865-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.425374 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved