Working C64 to RC2014 serial Keyboard adapter

266 views
Skip to first unread message

Alex K

unread,
Dec 12, 2022, 12:43:45 PM12/12/22
to RC2014-Z80
Hello all,

I am using a C64 keyboard on my RC2014 very successfully and wanted to share the project. Full information on the project including the working source code is here: https://github.com/Alex-Kw/c64-rc2014-Keyboard

Some backstory:

Recently I was working with a P-LAB device, building their keyboard adapter for C64 keyboards to Apple 1 [replica] / Apple II using Arduino NANO and a simple PCB. I also helped the device support C16 keyboards now but that is a story for another day, and this RC2014 project is C64 keyboard only.

The NANO outputs the key information to serial, not just the ASCII/TTL and DIP ports on the PCB by way of digital outputs. By matching the baud rate in the source code, you can make the NANO a serial keyboard for the RC2014. Several special keys have been adjusted in source, and can be remapped, but RESTORE is not movable due to it being on it's own matrix position.

To build this, one would build version 1.0 of the P-LAB adapter, add a serial header, and flash the above firmware to an Arduino NANO. At that point a C64 keyboard can be connected to the adapter, and the adapter connected to a serial bus on your RC2014. The Serial bus should provide 5V for the Arduino. 

Questions and comments welcome. More technical info is in the Git readme as well. Thanks for reading.

Cheers,
Alex

(No commodore computers were harmed in the making of this project, keyboards were salvaged or donated by a member of the VCF). 
58rus7l.jpeg

Alex K

unread,
Dec 14, 2022, 12:41:09 PM12/14/22
to RC2014-Z80
I'm trying to map a functional clear screen key for MBASIC. If I run PRINT CHR$(12); it will clear the screen and the semicolon clears up the top line. So in code I remapped CLEAR/HOME to chr 12. 

However in code when I send CHR12 over serial nothing seems to happen in MBASIC. I did write an if statement to send a semicolon after the clear screen key, and that works. BASIC just shows the semicolon though. In CPM, pressing the new clear button yields:

^L;

So I know I'm doing something right. The code I used for CTRL-C works fine, and I double checked that in my code I'm using '59' for semicolon. I ran PRINT CHR$(59) and it does indeed print a semicolon. So I'm trying to sort the mismatch/function of CHR$(12).

Any ideas of how to issue a proper clear screen to the RC2014/MBASIC over Serial?

Alex K

unread,
Dec 14, 2022, 4:57:56 PM12/14/22
to RC2014-Z80
I solved this by making F7 type out the BASIC command that does work. Functionally it's just fine. Code change: https://github.com/Alex-Kw/c64-rc2014-Keyboard/commit/893f108f22e82b0f6d8a82d578d9d9ef273740d9?diff=split

Also since the ^L / Value 12 clears the screen on CP/M after a carriage return, I have mapped CLR/HOME to a CPM clear screen function. F7 is a MBASIC specific clear screen macro (noted above). RUN/STOP remains a CTRL-C to break out of BASIC loops.

Another improvement is F1/F2 toggle a soft caps lock mode for alpha chars, so the latching caps lock key on these keyboards which affects the number row doesn't have to be used for caps lock. This is really useful programming in BASIC in caps and anywhere else you don't want lowercase and still need to type numbers and symbols normally. 

kurt....@web.de

unread,
Dec 15, 2022, 8:28:03 AM12/15/22
to RC2014-Z80
Hi,
That's a good idea.

The keyboard is connected to the rc2014 board via a NANO.
Is the C64 needed for this or only the keyboard of the C64 is needed.

Not everyone has a C64 keyboard lying around, I guess.

Kurt Carl

Alex K

unread,
Dec 15, 2022, 8:36:55 AM12/15/22
to rc201...@googlegroups.com
Kurt,

Thanks for asking. To clarify, no C64 is needed, only the keyboard. The PCB with the Nano attaches right to the keyboard cable. 

Cheers,
Alex

--
You received this message because you are subscribed to a topic in the Google Groups "RC2014-Z80" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/rc2014-z80/ORfn_Q_Z_W8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to rc2014-z80+...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/rc2014-z80/19679d8a-fe23-4a4f-95e7-d06a354006c1n%40googlegroups.com.

kurt....@web.de

unread,
Dec 15, 2022, 3:07:35 PM12/15/22
to RC2014-Z80
Hi, the power is supplied by the NANO.
RC2014 has the connection to the interface. Power comes from the rc2014!


I have now looked at the software.

Only the C64 keyboard is in the housing of the C64.

So far so good.

Please take pictures of the inside of the C64. If I want to replicate it, I usually create a path on my Linux computer and store all the information about the replica there.
Small drawing by hand, photos, software and description for the replica.

Thanks for the information.

Kurt

Alex K

unread,
Dec 15, 2022, 4:21:14 PM12/15/22
to rc201...@googlegroups.com
Kurt,

Correct, the RC2014 is powering the NANO. On the Pi serial module, 5V is present at the serial header pins by default, on the dual SIO I believe a jumper has to be placed [to enable 5V].

I could take more photos, but there is quite literally nothing in the breadbin case but the Keyboard (And power LED, I suppose). The connector at the end of the C64 Keyboard cable reaches just long enough to protrude from the back of the case and plug into the PCB. It's seen well in this photo:
https://i.imgur.com/v1NcN3i.jpg

The full photo album also shows how I modified the 'Appledore' PCB to be an easy to use PCB for this project. It is already set up for the Nano, C64 Keyboard header, and a reset signal circuit. It just needs a serial header; For serial output, I adhered a section of female pin headers to the bottom of the PCB and carefully attached them to the necessary signals. 
https://imgur.com/a/SZrAeKl

The backstory of this is I was building these adapters to use Commodore keyboards on my Apple 1 clone/Replica 1 Plus computer. Original or even replica datanetics ASCII keyboards are magnitudes more expensive than C64 keyboards. I initially only had a C16 keyboard on hand which has the same connector but a totally different matrix wiring. To debug the digital outputs and identify individual key numeric IDs, I used a serial console. It would echo the characters being pressed on the C64 or C16 matrix, or their values, to the serial output. Setting this to echo the characters to the serial output was already the default. Matching the baud rate in code between the NANO code and the RC2014, and attaching the serial headers, led me very quickly to a working proof of concept. 

If anything is not clear still please don't hesitate to ask.

Cheers,
Alex

kurt....@web.de

unread,
Dec 18, 2022, 1:09:46 PM12/18/22
to RC2014-Z80
Hi,

too bad I don't have a C64 keyboard anymore.

Some time ago I sold the case and the keyboard cheaply in a forum. That was a mistake.
Anyway, the link to the description is on my computer
saved.

Kurt

Alex K

unread,
Dec 22, 2022, 5:36:15 PM12/22/22
to RC2014-Z80
For anyone looking to assemble this adapter, P-LAB has published an updated PCB including the schematic and gerber files to their website:

https://p-l4b.github.io/appledore/

Version 1.1a of the PCB has a serial header, which I requested to be modeled after the pin layout of RC2014 serial headers. It should be trivial to assemble and get hooked up. The reset pin on the adapter would need to reach pin 20 (reset) of the Z80 bus (at least on my RC2014 Pro) if you wish to use it; on my system, I bridged that pin up to an unused pin on the serial header. It is a luxury but a nice one to be able to reboot from the keyboard, without touching the reset module or button on the RC2014 itself. 

Alex K

unread,
Jan 10, 2023, 11:11:50 AM1/10/23
to RC2014-Z80
I've had a chance to build 1.1a of the Appledore PCB with the serial header added for RC2014. As expected it works fine. I've updated the documentation on the github link for this project:

https://github.com/Alex-Kw/c64-rc2014-Keyboard

I've now moved to a standalone keyboard (no breadbin case), and mounted my setup to a single piece of wood. I still need to affix the power input receptacle with a switch and fuse, but otherwise I'm pretty happy. lFYkycD.jpeg

Alex K

unread,
Feb 22, 2023, 12:59:49 AM2/22/23
to RC2014-Z80
I made an update to the code to better support RomWBW and alternate OS, by creating code so that CTRL-[a-z] now work. The commodore key is acting as CTRL because it's more mechanically natural for people used to modern keyboards, but it can be moved to CTRL itself too rather easily in code.

Cheers,
Alex 

Reply all
Reply to author
Forward
0 new messages