T
T
Type Programmer2017-11-12 14:24:37
assembler
Type Programmer, 2017-11-12 14:24:37

How to make a delay, and so that the keyboard remembers pressing?

I’m doing a mini game
, something is already working, somehow ...
But here such a problem in the emulator lags, but when the program starts, it flies so I don’t have time to understand what and how,
I found such a delay
mov ah, 86h
mov cx,0FFFFh
mov dx,0FFFFh
int 15h
Accumulated and pasted it and put the delay into the loop, it turned out to be what you need :)
But now after the delay it doesn’t react that I pressed something only the first time ...

mov ah,01h
int 16h       
mov si,0000h
ga1:   
mov ah,01h
int 16h   
push ax
mov ah,86h
mov cx,0FFFFh
mov dx,0FFFFh
int 15h  
mov ah,01h
int 16h    
pop ax
push ax
mov ah,86h
mov cx,0FFFFh
mov dx,0FFFFh
int 15h   
mov ah,01h
int 16h   
pop ax
push ax
mov ah,86h
mov cx,0FFFFh
mov dx,0FFFFh
int 15h   
mov ah,01h
int 16h   
pop ax
push ax
mov ah,86h
mov cx,0FFFFh
mov dx,0FFFFh
int 15h
mov ah,01h
int 16h   
pop ax
push ax
mov ah,86h
mov cx,0FFFFh
mov dx,0FFFFh
int 15h
mov ah,01h
int 16h   
pop ax
push ax
mov ah,86h
mov cx,0FFFFh
mov dx,0FFFFh
int 15h
mov ah,01h
int 16h   
pop ax
push ax
mov ah,86h
mov cx,0FFFFh
mov dx,0FFFFh
int 15h
mov ah,01h
int 16h   
pop ax
push ax
mov ah,86h
mov cx,0FFFFh
mov dx,0FFFFh
int 15h   
pop ax 
mov ah,01h
int 16h   
inc si
cmp si,0FFFFh
jnz ga1
tp1:      
mov ah,01h
int 16h
call ball_set    
cmp al,'a'
jz wood_left
cmp al,'d'
jz wood_right
mov si,0000h
ga2:    
push ax
mov ah,86h
mov cx,0FFFFh
mov dx,0FFFFh
int 15h   
pop ax
push ax
mov ah,86h
mov cx,0FFFFh
mov dx,0FFFFh
int 15h 
pop ax
push ax
mov ah,86h
mov cx,0FFFFh
mov dx,0FFFFh
int 15h
pop ax
push ax
mov ah,86h
mov cx,0FFFFh
mov dx,0FFFFh
int 15h
pop ax
push ax
mov ah,86h
mov cx,0FFFFh
mov dx,0FFFFh
int 15h
pop ax
push ax
mov ah,86h
mov cx,0FFFFh
mov dx,0FFFFh
int 15h
pop ax
push ax
mov ah,86h
mov cx,0FFFFh
mov dx,0FFFFh
int 15h
pop ax
push ax
mov ah,86h
mov cx,0FFFFh
mov dx,0FFFFh
int 15h
pop ax 
inc si
cmp si,0FFFFh
jnz ga2
jmp ga0

Here is such a great two big pieces to skip (Where copy-paste) is not enough to succeed. And it no longer reacts to pressing the key, and the ball in the game is more accurate than the @ symbol Lelit itself further calmly, and the board sticks to the edge in the direction in which the
PS key was pressed for the first time: The task is difficult because I'm stupid, the code is great, and my Russian, calligraphy, etc. is lame

Answer the question

In order to leave comments, you need to log in

1 answer(s)
R
Rsa97, 2017-11-12
@Rsa97

CX - timeout in microseconds (highest part)
DX - timeout in microseconds (lower part)

Thus you give the command to wait
0xFFFFFFFF = 4294967295 µsec ≈ 4295 sec = 1 hour 11 minutes 35 seconds.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question