- [mywiil] 我没用书上的入栈出栈写,就是先看看不用书上的方法能做出来否? ============== 不错 09/19 09:24
- [njutyangxiao] 谢谢你的指导 09/18 17:00
- [younggay] 嗯,应该说理解的没问题。 09/18 15:41
- [njutyangxiao] 检测点16.1的题目是中是这样定义的: a dw 1,2,3,4,5,6,7,8 b dd 09/16 11:23
- [njutyangxiao] 嗯,谢谢指导 09/16 11:22
- [wsrf] assume伪指令指定了段中标号与相应段寄存器的联系。 09/16 09:46
- [wsrf] 没有问题,不过源代码中 a db 1,2,3,4,5,6,7,8 b dw 0 怎么 09/16 09:43
- [njutyangxiao] 谢谢,keep moving! 09/16 09:06
- [njutyangxiao] 谢谢你的指导 09/16 09:05
- [njutyangxiao] 谢谢你的指导 09/16 09:05
[2009-09-17 19:19] 第十七章第二节题
题目:编程,接受用户的键盘输入,输入‘r’,将屏幕上的字符设置为红色;输入‘g’,将屏幕上的字符设置为绿色;输入‘b’时,将屏幕上的字符设置为蓝色。
源代码:
assume cs:codesg
codesg segment
start:
mov ax,0
int 16h;调用int 16h的0号功能读取键盘输入的字符,输入的字符的ascii码放在了al中,ah中放的是扫面码
cmp al,72h;如果是字母‘r’,则跳转到show_red处
je show_red
cmp al,67h;如果是字母‘g’,则跳转到show_green处
je show_green
cmp al,62h;如果是字母‘b’,则跳转到show_blue处
je show_blue
print:
mov ax,0b800h
mov es,ax
mov di,1
mov cx,2000
lp_changecol:
and byte ptr es:[di],11111000b
or byte ptr es:[di],bl
add di,2
loop lp_changecol
mov ax,4c00h
int 21h
show_red:
mov bl,4h;用书上左移一位的的那种方法更加好吧
jmp short print
show_green:
mov bl,2h
jmp short print
show_blue:
mov bl,1h
jmp short print
codesg ends
end start
源代码:
assume cs:codesg
codesg segment
start:
mov ax,0
int 16h;调用int 16h的0号功能读取键盘输入的字符,输入的字符的ascii码放在了al中,ah中放的是扫面码
cmp al,72h;如果是字母‘r’,则跳转到show_red处
je show_red
cmp al,67h;如果是字母‘g’,则跳转到show_green处
je show_green
cmp al,62h;如果是字母‘b’,则跳转到show_blue处
je show_blue
print:
mov ax,0b800h
mov es,ax
mov di,1
mov cx,2000
lp_changecol:
and byte ptr es:[di],11111000b
or byte ptr es:[di],bl
add di,2
loop lp_changecol
mov ax,4c00h
int 21h
show_red:
mov bl,4h;用书上左移一位的的那种方法更加好吧
jmp short print
show_green:
mov bl,2h
jmp short print
show_blue:
mov bl,1h
jmp short print
codesg ends
end start
评论次数(0) |
浏览次数(664) |
类型(Assembly's Road) |
收藏此文 |