On Fri, Apr 06, 2012 at 04:41:47PM -0300, Alexandre Souza - Listas wrote:
For a
"modern" keyboard, I'd recommend something like Jim Brain's
adapter that has a silicon crossbar switch. We've been over that sort
of thing on the list before, but the design constraints are that the
scan routine runs every clock 'tick' (16.67ms on any C= NTSC machine)
and strobes the matrix in a few uS, plus in the case of the C-64, the
keyboard shares lines with the joysticks, so any keyboard adapter
should play nice with those lines in particular. I don't think many
people did in-the-box hacks with the keyboard scan lines, so as long
as the IRQ scan routine works and the joysticks work, that would be a
successful emulator. There are several techniques to do it; a silicon
crossbar switch is a low-effort one.
I still believe I can do that with a fast microcontroller. As
soon as I can put my dirty hands into one I'll jack it up to the
logic analyser and play with that.
I tried that about 2 years ago using an ATmega644. It nearly worked, but
when the C64 switched from one keyboard row to the next the ATmega644
generated several pin change interrupts. This took too long to process
and the C64 got the wrong answer. Maybe one day I will look into faster
processors but the ones I know about are quite slow at I/O. The timing
of the NMI routine (for checking RUN/STOP when RESTORE is pressed) is
even tighter than the normal IRQ.
S?ren