Getting a keypress without waiting for the key to be released

Joined
Jan 1, 2025
Messages
11
Reaction score
0
I'm writing a game clone (pac man) and everything runs fine until the user holds down one of the arrow keys. My code is

if keypressed then ch := readkey; (readkey gets the character from the buffer)

I'm not sure if its the keypressed call or the readkey that freezes things until the key is released. Is there an interrupt than can be used (in line assembly) to get the keypressed character without waiting for the key to be released?
 
Joined
Jan 1, 2025
Messages
11
Reaction score
0
I found this, but it still delays things

mov ah, 00
int 16h

this returns the key code in AL
 
Joined
Sep 21, 2022
Messages
216
Reaction score
32
I used to have a book called DOS programming: the complete reference by Kris Jamsa. Your answer is in there.

Threw it away many years ago, along with all my other manuals. I figured that if I needed some esoteric fact, I could look it up online.

That was a different internet. Few adverts and no subscriptions.

The modern world wide web is a big *&%!!$ disappointment to me.

Oh well, live and learn.
 
Joined
Jan 1, 2025
Messages
11
Reaction score
0
I used to have a book called DOS programming: the complete reference by Kris Jamsa. Your answer is in there.

Threw it away many years ago, along with all my other manuals. I figured that if I needed some esoteric fact, I could look it up online.

That was a different internet. Few adverts and no subscriptions.

The modern world wide web is a big *&%!!$ disappointment to me.

Oh well, live and learn.
Ok, thanks. Here's some videos of the clones I've been working on. None are finished yet.

Space invaders:

Pacman


Centipeed:

 
Joined
Sep 21, 2022
Messages
216
Reaction score
32
I was a big fan of line graphics. The only game I wrote was a 2d space game with very minimal shapes, but the movement was smooth.

The game started out as a simple "my ship versus the program's fleet" game.

The game went through many versions over time. When I won, I gave it better smarter ships. When it won, I found its weakness, or gave myself better equipment. Around and around I went.

In a way I was playing both sides. Modifying the game was more fun than playing it.
 
Joined
Jan 1, 2025
Messages
11
Reaction score
0
Here's an update to the PacMan clone. My keyboard "problem" has been solved. It wasn't the keyboard routine holding things up. Just one of another stupid human tricks I do from time to time.
 
Joined
Sep 21, 2022
Messages
216
Reaction score
32
I don't normally watch videos, because I'm on a budget, but that was ... different.

From the sound of it, you're hitting a key for every movement. Every version I've played only required a key press for a change of direction.

The strangest version I've played was called Spider's Web, on the Fountain home video game system. They went to an extreme to get around any copyright issue.
 
Joined
Jan 1, 2025
Messages
11
Reaction score
0
I don't normally watch videos, because I'm on a budget, but that was ... different.

From the sound of it, you're hitting a key for every movement. Every version I've played only required a key press for a change of direction.

The strangest version I've played was called Spider's Web, on the Fountain home video game system. They went to an extreme to get around any copyright issue.
Thanks I'll look at that.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,170
Messages
2,570,925
Members
47,466
Latest member
DrusillaYa

Latest Threads

Top