| |
stunt Account closed
Registered: Jul 2006 Posts: 48 |
Scan the keyboard
Guys,
Right now i'm still using kernal routine $ffe4 to scan the keyboard, but ofcourse I'd rather avoid using kernal routines. So Scout suggested me inastead to scan the keyboard matrix ($dc00 and $dc01) directly.
Now i have:
keyscanloop
lda $dc00 ; row
and #%00100000
bne continu
lda $dc01 ; collumn
and #%00000001
bne continu
jmp keyispressed
continu
jmp keyscanloop
keyispressed
...
But this doesnt seem to be working.
What am i doin wrong?
Stunt |
|
... 10 posts hidden. Click here to view all posts.... |
| |
stunt Account closed
Registered: Jul 2006 Posts: 48 |
What about scanning for both left and right shift?
U experts tell me what is the fastest option?
Maybe the fastest option is not to use shift/key combinations at all?
The thing is that i have to be careful, i have so many things to do per frame and yet so little rastertime:
Lots of sidparamters are updated realtime (at least 4 times per frame but if possible some parameters have to be updated like 8 or more times per frame), midi implementation still has to fit in (but i will probably rely on hardware a lot for the midipart) and also more than 1 sidchips are going to be adressed and updated in the future (right now pimping c64 by adding extrasidchip for 3+ voice polyphony) so i have to be very efficient with time. |
| |
enthusi
Registered: May 2004 Posts: 677 |
$028d is set (only) by kernal. Actually by the very same code more or less you want to avoid. And since Im in destructive mode I deliver no solution ;)
But no magic needed. Same concept. Only some combinations are tough or if you want to check shift OR shift-lock. A mere 2-keys at once can be sone the same way as you do it now. Just AND the values or check this forum in coding. I recall at least one thread about detecting 3 keys etc...
good luck |
| |
tlr
Registered: Sep 2003 Posts: 1790 |
How about this?
scan:
lda #$ff
sta $dc02
lda #$00
sta $dc03
ldy #0
lda #$fe
sc_lp1:
pha
sta $dc00
lda $dc01
sta tab,y
iny
pla
sec
rol
bcs sc_lp1
sta $dc00 ; =$ff
rts
tab:
ds.b 8
It will test each row, and store the result in tab.
Now you will have one '0' bit for each key in tab (row 0 -> 7).
Due to how the matrix works, not all combinations of keys can be detected properly.
Complete scanner program for the C64 (and DTV):
http://www.kahlin.net/daniel/dtv/keyjoy.php
|
| |
Soren
Registered: Dec 2001 Posts: 547 |
using tables is a good idea. There must be several ways to do
that, depending on your needs.
But just thought about the F8-thing.. you could do a check for right shift+f7
and a check for left shift+f7....
just to be sure.
;)
|
| |
enthusi
Registered: May 2004 Posts: 677 |
and if you need a table, dont generate it :)
copy it:
http://www.tkk.fi/Misc/cbm/docs/c64-diss.html#EB79 |
| |
stunt Account closed
Registered: Jul 2006 Posts: 48 |
Quote: and if you need a table, dont generate it :)
copy it:
http://www.tkk.fi/Misc/cbm/docs/c64-diss.html#EB79
Hey guys all this help is great.
I wish one of you coders would show the same dedication to the question that is formulated in the last post of in my other recent thread here about modulation: --> How to players and trackers usually deal with these modulation issues? --> Bit-scaling? (sid related, but not nescesarily, not a question related to the battlestar galactica music btw;-)
(scroll down to the last post)
Stunt |
Previous - 1 | 2 - Next |