COMMODORE PLUS/4 WORLD
  Home  Search  Games  Tapes  Covers  Cheats  Maps  Software  New Stuff 
 Hall Of Fame  HVTC  Game Endings  Solutions  Remakes  Publications  Magazines  Effects  Top List 
 Members  Groups  Features  Plus/4 Encyclopedia  Hardware  Tools  Options  Forum 
Login
Back to forumReply To This TopicGo to last reply

Posted By

KiCHY
on 2010-03-18
05:29:25
 Keyboard scan function in the needs!

Hi,

Does anyone have a readymade keyboard scanning function? I'd need the functionality of the builtin ROM function ($DB11). Scanning all keys, checking shift, does the repeating with the same characteristics (key down - longer pause - start repeating). And I'd need an ASCII code in return

Thx in advance!

Posted By

Luca
on 2010-03-18
07:47:46
 Re: Keyboard scan function in the needs!

Didn't completely understand. I guessed SCNKEY kernel function would give you exactly the ASCII to be output with the CHROUT one...
Otherwise, Mike Dailly published years ago a little table in order to use the classic $FD30/$FF08...

PS: I'll put my hands on that tune very soon, don't panic, have faith

Posted By

KiCHY
on 2010-03-18
09:04:14
 Re: Keyboard scan function in the needs!

Ok, this is the situation:
I'm trying to write a program with CC65. In defaults the CC65 init routine disables ROM, redirects $FFFE-F vector to its custom IRQ which with other things does a JMP ($314) with a carefully prepared stack to be able to return the PC exactly after the JMP($314). CC65 gives standard ways to scan keyboard (i use kbhit() and cgetc()), which compiles into a
SEI
STA $FF3E
JSR $FFxx
STA $FF3F
CLI
sequence of commands. I redirected $FFFE-F to my own IRQ routine which fires at two specified rasterlines and skips the JMP($314) becouse it eats more rastertimes I have. When I want to use the kernal keyboard routines from C, I have to do that SEI...CLI sequence but calling the JSR $FF.. function take too much time and the IRQ routine can't run flawlessly.

So my plan is to do the raster-thing with IRQ and handle the keyboard with a custom function which doesn't SEI/CLI. I wanna keep those luxury functions (key repeat after a delay) it gives, and the keyboard buffer if possible.

Naturally I could translate the FD30/FF08 keymatrix into ascii tables but this is only the easier part of keyboard scan function (implement the delay, the repeat, the buffer) and I didn't want to develop it if someone else did the job earlier.

Posted By

Csabo
on 2010-03-18
09:16:28
 Re: Keyboard scan function in the needs!

I sent you an input routine that I developed for my upcoming game. It does pretty much this, should be easy to modify it if you need to.

Posted By

KiCHY
on 2010-03-18
12:57:11
 Re: Keyboard scan function in the needs!

Thx Csabo, it gave me some inspiration and laziness flew away. I'll do it easily now

Posted By

SVS
on 2010-03-18
13:08:09
 Re: Keyboard scan function in the needs!

You can try to read TED registers too.

Posted By

Luca
on 2010-03-19
03:32:12
 Re: Keyboard scan function in the needs!

OMG laziness fly away fromme toooooo!



Back to topReply To This Topic


Copyright © Plus/4 World Team, 2001-2017