Disable keyboard temporarily?

Basic and Machine Language

Moderator: Moderators

Post Reply
User avatar
AndyH
Vic 20 Afficionado
Posts: 366
Joined: Thu Jun 17, 2004 5:51 am
Website: https://www.hewco.uk
Location: UK
Occupation: Developer

Disable keyboard temporarily?

Post by AndyH »

Perhaps a silly question, but I've noticed that if I hold a key down on the keyboard I see a slight slowdown in my game. I assume some code in the kernel is processing the key presses as it needs to which is all fine, but as I am only using the joystick while the game is being played I'm wondering if I can temporarily disable the keyboard routines?

For example, I have some debugging code to change the screen border colour while I check how long a routine is taking to complete.

inc $900F
; my routine
dec $900F

In this case the screen changes from black to white someway down the screen (inc $900f), before going back to black as expected. While holding a key on the keyboard the position where this first occurs moves down a centimetre or two - I guess some code has run to process the keyboard delaying my code above.

It's not really a problem, as the player will not normally be pressing keys in my game but can it be temporarily be disabled so I can keep the game running as fast as possible? I'd only need to read the keyboard on the title screen.
--
AndyH
HEWCO | Vic 20 blog
User avatar
beamrider
Vic 20 Scientist
Posts: 1452
Joined: Sun Oct 17, 2010 2:28 pm
Location: UK

Re: Disable keyboard temporarily?

Post by beamrider »

If you install an interrupt handler but don't chain to the KERNAL that will do it . You could also just jmp to $EB15 to omit the keyscan routine instead of the usual jmp to $EABF at the end of your handler
User avatar
AndyH
Vic 20 Afficionado
Posts: 366
Joined: Thu Jun 17, 2004 5:51 am
Website: https://www.hewco.uk
Location: UK
Occupation: Developer

Re: Disable keyboard temporarily?

Post by AndyH »

That does the trick nicely. Many thanks!
--
AndyH
HEWCO | Vic 20 blog
Post Reply