1
\$\begingroup\$

I am writing pong in assembly x86 with TASM and I have a problem.

The program is waiting to get input from the user to move the paddle (int 16h ah=0h) and while it is waiting the ball and the other paddle doesn't move.

What should I do?

\$\endgroup\$
5
\$\begingroup\$

Most of the keyboard interrupts that return data from the keyboard buffer (that is, most of the interrupt 16h family) block if there is not actually in the keyboard buffer.

What you need to do instead is first check if there's anything in the keyboard buffer. If there is, you can issue int 16h / AH = 0. Otherwise just continue with your regular game loop.

int 16h / AH = 1 can be used to check if there's anything in the buffer. It will set ZF to 0 if there's a key available for you to read.

|improve this answer|||||
\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.