I never owned an ST family computer, which might have been a tactical error on my part. It would have been close to an unadorned 68000-based machine in the way that the Radio Shack/Tandy Color Computer was an unadorned 6809-based machine.
I have been using the Atari ST emulator (simulator) Hatari as a platform for converting the fig Forth model for the 6800 to the 68000.
The keyboard on this Japanese Panasonic Let's Note does not map well to Atari ST keyboard. The default mapping leaves important keys like equal (=) unavailable. (Some keys are available by using the FN key to select the ten-key pad that starts on the 7 key.)
For comparison, the Atari ST (US) keyboard is laid out like this:
!@#$%^&*() _+~
1234567890 -=`
QWERTYUIOP{}
qwertyuiop[] del
ASDFGHJKL:" |
asdfghjkl;' \
ZXCVBNM<>?
zxcvbnm,./
And it's precisely around where the equals key is, that the keyboard mapping goes wonky.
I've been doing almost all the source code editing in Gedit, under Ubuntu, just using Hatari for assembling and test runs. But I'm now into some really difficult debugging sessions, and the mapping of the keyboard is getting in the way.
So today I dug into Hatari's keyboard remapping, invoked something like:
hatari -k keymap.text
on the command line.
In the source code for Hatari, there are some utilities in the tests/keymap directory for looking at what SDL sees the keyboard generating (if I got this right) -- listkeys.c and checkkeys.c. I downloaded the source code from the git repository and changed to the tests/keymap directory, and ran make, and got the executables there. Don't need them in the general path, you can execute them in place with
./listkeys
and
./checkkeys
They gave me some clues and not much more. Taking a look at the example keymap file in the source was also not very enlightening. And neither was the man page from SDL:
man SDLKey
But after working through those, and after some reading in forums and playing around with Hatari's remapping a bit. I figured out what to put in the keymap file:
Each line consists of the key you want to remap, a comma, and the SDL (?) scancode.
Sort of.
Figuring out the scancodes was a bit tricky. First, I tried the codes I learned from the checkkeys and listkeys utilities to see how they would work:
-,45
^,94
@,64
[,91
],93
;,59
:,58
/,47
\,92
The results weren't even close to what I wanted.
So I used a little trick involve perverse keyboard mappings. What I did was line up the alphabet keys and just arbitrarily mapped almost all of them to sequential codes:
-,45
a,1
b,2
c,3
d,4
f,5
g,6
h,7
j,8
k,9
l,10
m,11
n,12
o,13
p,14
q,15
r,16
s,17
u,18
v,19
w,20
y,21
z,22
(The mapping for hyphen was the one I was able to make sense of from the utilities, but it turned out not to be one I am using.)
This is better than random guessing because it allows testing a bunch of the scan codes at once, and it helps you remember which ones you've tried. You can add the ones that look like they work at the top, like I did with hyphen, so you can test them -- and so you don't forget them.
I think I gleaned one scancode from the sequence 1 to 22, then similarly gleaned a few more from the next set, starting at scancode 23 to about 43 temporarily and perversely mapped to key a through y.
(I left e, i, t, and x undefined to allow typing the exit command, and, after the first set, I left z un-assigned so I could use ctrl-Z to invoke the debugger.)
But I couldn't figure out how to map individual scancodes. Each remapping seems to be done as a pair, which is kind of awkward.
Ultimately, I used this file:
-,12
[,26
],27
^,13
and, while it makes the equals key available, it maps it to the caret/tilde key -- which leaves caret and tilde unavailable.
It's not a good fit. It matches neither the keycaps on the PC keyboard nor the layout of the Atari ST keyboard.
But I think it will allow me to proceed with debugging.
So I'll leave this post here for my own notes and post a link here to a Hatari forum for the developers, if I can figure out the appropriate forum.