I'm going to use this thread as a build thread for my Vic 20 project. Previous recount of the pitfalls of the project can be found
here.
I've had a little bit of time recently, so I decided to take another crack at getting the Vic-20 working again. In that time I've acquired a Teensy2.0++. My goal is to get the Teensy to (oh ****, we just had a decent sized earthquake, it's still going - I saw a flash outside... transformer damage?...just aftershock tremors now, carrying on) work on the Commodore keyboard interface. I soldered some crap together to wire the input into a DIP socket.
The real challenge is getting some programming to work with it. I started out using the
C64Key project by Mikkel Holm Olsen. The programming was honestly a bit daunting for me, since I have never taken a good stab at C and my programming skill is lackluster. I decided to take a stab at adapting the
TRS-80 Model 100 Project by Karl Lunt to the Commodore. I had a little bit more luck with this, but I still had trouble figuring out how to assign pins to the columns and rows of the matrix. I decided to look at
Soarer's controller, which is very popular here. Unfortunately I only found hex files with modification macros. This would be great if I wanted something standard and I wanted it to work without thinking. My plan for this is a bit farther reaching with well meaning intentions to use it to teach myself coding. I decided to look at
Hasu/TMK's firmware. This was what I was looking for. The code is modular, with examples. The code had enough commenting that I finally understood how pins are assigned to rows and columns. So all this afternoon I plugged and modified and got a working first try at some code.
The layout I designed is this:
static const uint8_t PROGMEM keymaps[][MATRIX_ROWS][MATRIX_COLS] = {
/* Layer 0: Default Layer
* ,---------------------------------------------------------------. ,-----,
* |ESC| 1| 2| 3| 4| 5| 6| 7| 8| 9| 0| +| -| £|Hom|Del| | F 1 |
* |---------------------------------------------------------------| |-----|
* |Ctrl | Q| W| E| R| T| Y| U| I| O| P| @| *|Fn2|Back | | F 3 |
* ,----------------------------------------------------------------' |-----|
* |Fn1|CpL| A| S| D| F| G| H| J| K| L| :| ;| =| Rtrn| | F 5 |
* |---------------------------------------------------------------| |-----|
* | C=|Shft | Z| X| C| V| B| N| M| ,| .| /|Shft |UP |LFT| | F 7 |
* `---------------------------------------------------------------' `-----'
* | Space |
* `----------------------------------'
*/
KEYMAP(ESC, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, PPLS, MINS, CURRENCY_UNIT, HOME, DEL, F1, \
LCTL, Q, W, E, R, T, Y, U, I, O, P, KP_ATMARK,KP_ASTERISK,FN2,BSPC, F3, \
FN1,CLCK,A, S, D, F, G, H, J, K, L, KP_COLON, SCOLON,KP_EQUAL_AS400,ENT, F5, \
LGUI,LSFT,Z, X, C, V, B, N, M, COMM,DOT, SLSH, RSFT,UP,LEFT, F7, \
SPACE),
A few things on this should be noted. As per the Vic-20 native layout, several keys are denoted with some exotic commands. A simple example is the use of KC_KP_ASTERISK (the asterisk found on the keypad) is used on the mainboard instead of relying on shift keys. Three keys were pulled from a list of unused keys in the TMK code: KC_CURRENCY_UNIT, KC_ATMARK, and KC_EQUAL_AS400. I'm not sure what the reaction will be when I try using these keys. Windows programs may not always support these character codes. And the currency unit may default to dollars. Also note that two keys were marked as Fn keys to use for advanced overlays later on.
This code is based on the code for the
Macway keyboard (now defunct). For things that weren't explained, I cross referenced with the Phantom keyboard code within the same set of files.
(pause while I submit a Did You Feel It? report to the GIS for the previously mentioned earthquake)
So I loaded everything up and strapped the Teensy to the poorly soldered converter and typed. The keys were not registering correctly. I decided to make a table of the keys expected vs. the keys that were actually input to the computer.
1 3 5 7 9 + £ Del
←(esc) W R Y I P * Rtrn
(return) Uarr
Lctrl a d G J L ; Larr
W S
run (fn1) Lsft X V N , / uarr
R F X
Spc Z C B M . Rsft F1
Y H V
Lgui S F H K : = F3
i K N
Q E T U O @ ↑(fn2) F5
P ,
2 4 6 8 0 - Home F7
* /
Restore(backspace) no input
The layout you see is based on the Commodore matrix, examples of which can be found
here and
here. As you can plainly see. What you type is not what you get (WYTINWYG - you'd think I typed it all in LaTeX). I think there are some serious problems with the matrix or the diodes that I have not diagnosed yet. More will come in the future, but this is what is currently completed.