汇编程序:按键按钮,查看绘画

时间:2014-03-02 21:04:38

标签: assembly char compare

当按下't'键时,我的程序应该从显示开到闭眼。有坐标。

我尝试用

做到这一点
mov ah,01   ;waiting for the button
int 16h
cmp al, 116 ;compares if t char is pressed

但它不起作用。

我的代码:

.model  tiny
.code
org 100h
start:

mov ax, 0003h       
int 10h


jmp ekranas

ivestis:

mov ah,01   ;waits for button
int 16h
cmp al, 116     ;compares if t is pressed
je atmerkta
jmp uzmerkta


 ekranas:
push    ax          



mov ax, 0013h   
int 10h
pop ax
mov si, 0           
mov bx, offset kord
vaizdas:
mov cx,[bx+si] 
mov dx,[bx+si+2]
mov ah, 0Ch         
int 10h         
add si,4            
cmp si, 272     
jne vaizdas

    mov ah, 08h         
int 21h
cmp al, 84          
jne viskas
Jmp uzmerkta            

viskas: mov ax, 0003h       
int 10h
ret



atmerkta:
kord    
dw 100,100,102,99,104,98,106,97,106,100,124,100,125,102,125,104,125,106,125,108,125,110,125,112,125,114,124,116,105,102,104,104,103,106,114,106,103,108,103,110,103,112,103,114,108,96,110,95,112,95,114,95,116,95,118,95,120,95,122,96,124,97,126,98,128,99,130,100
dw 98,102,132,102
dw 96,104,134,104
dw 94,106,136,106
dw 92,108,138,108
dw 90,110,140,110
    dw 92,111,94,112,96,113,98,114,100,115,102,116,104,117,106,118,108,119,110,120,112,120,114,120,116,120,118,120,120,120,122,120,124,119,126,118,128,117,130,116,132,115,134,114,136,113,138,112





uzmerkta:
kord2   dw 100,100,102,99,104,98,106,97,108,96,110,95,112,95,114,95,116,95,118,95,120,95,122,96,124,97,126,98,128,99,130,100
dw 98,102,132,102
dw 96,104,134,104
dw 94,106,136,106
dw 92,108,138,108
dw 90,110,140,110
dw 92,111,94,112,96,113,98,114,100,115,102,116,104,117,106,118,108,119,110,120,112,120,114,120,116,120,118,120,120,120,122,120,124,119,126,118,128,117,130,116,132,115,134,114,136,113,138,112
end start

1 个答案:

答案 0 :(得分:0)

你正在跳过你的关键例程:

jmp ekranas

此外:

mov ah,01;waits for button

应该是:

mov ah,0

值为1 =获取键盘状态,0 =等待按键。