NOTE: This information requires XRoar 1.3.1 or later, as earlier versions had an issue remapping the Control key on Mac.
The XRoar emulator added support for the CoCo 3, but by default, the new CoCo 3 keys (alt, ctrl, f1 and f2) do not work for me — at least on the Mac. The author, Ciaran, pointed me to the “kbd-bind” configuration option. This allows remapping a host computer key and passing it through to the emulated machine. In my case, I want to do the following:
- F1 key – F1 key on CoCo 3
- F2 key – F2 key on CoCo 3
- Left Control – CTRL key on CoCo 3
- Left Option – ALT key on CoCo 3
The XRoar manual has the following information about kdb-bind:
-kbd-bind hkey=[pre:]dkey … Bind host key hkey to emulated key dkey.
When binding keys with -kbd-bind, if the emulated key dkey is prefixed with ‘preempt:’ or ‘pre:’, this binding preempts translation; useful for modifier keys. Interpretation of hkey depends on which user-interface toolkit is in use, and it might be useful to run with -debug-ui 1 to see what the toolkit calls your host keys.
Special values for dkey are: ‘colon’, ‘semicolon’, ‘comma’, ‘minus’, ‘fullstop’, ‘period’, ‘dot’, ‘slash’, ‘at’, ‘up’, ‘down’, ‘left’, ‘right’, ‘space’, ‘enter’, ‘clear’, ‘break’, ‘escape’, ‘shift’, ‘alt’, ‘ctrl’, ‘control’, ‘f1’, ‘f2’.
– XRoar manual
The “hkey” is the name of the key you are trying to remap, and I think it may be different between Mac and PC. By running xroar from the command line with the “-debug-ui 1” option, the terminal will print out keys as you type inside the emulator. I did this, and press the keys I wanted to remap.
% xroar -debug-ui 1 (...stuff omitted...) sdl.key press scan=224 sym=400000e0 mod=0040 unicode=0000 name=Left Ctrl sdl.key release scan=224 sym=400000e0 mod=0000 unicode=0000 name=Left Ctrl sdl.key press scan=226 sym=400000e2 mod=0100 unicode=0000 name=Left Option sdl.key release scan=226 sym=400000e2 mod=0000 unicode=0000 name=Left Option sdl.key press scan= 58 sym=4000003a mod=0000 unicode=0010 name=F1 sdl.key release scan= 58 sym=4000003a mod=0000 unicode=0000 name=F1 sdl.key press scan= 59 sym=4000003b mod=0000 unicode=0010 name=F2 sdl.key release scan= 59 sym=4000003b mod=0000 unicode=0000 name=F2
Above, I can see that the “hkey” for pressing my Mac’s left control is “Left Ctrl“. My left option key is “Left Option” (spelled out, and not abbreviated like Ctrl was). F1 and F2 were simply “F1” and “F2“.
I went with Control and Option on the left side, since I have duplicates of those keys on the right side of my keyboard. I can remap just the left ones for CoCo 3 use, and still have the right ones for XRoar interface use.
NOTE: You could remap any key — like make F5 turn in to the CoCo 3’s F1, or whatever.
To remap those keys, I can pass the option in from the command line like this:
xroar -kbd-bind "Left Ctrl"=pre:ctrl -kbd-bind "Left Option"=pre:alt -kbd-bind F1=pre:f1 -kbd-bind F2=pre:f2
Or, I can place the following entries in the xroar.conf file:
kbd-bind "Left Ctrl"=pre:ctrl kbd-bind "Left Option"=pre:alt kbd-bind F1=pre:f1 kbd-bind F2=pre:f2
I actually made a special xroar.conf entry so I could get a customized CoCo 3 with RGB monitor:
machine coco3rgb machine-desc CoCo 3 RGB machine-arch coco3 tv-input rgb kbd-bind "Left Ctrl"=pre:ctrl kbd-bind "Left Option"=pre:alt kbd-bind F1=pre:f1 kbd-bind F2=pre:f2
If I run XRoar using the command line, or with those entries in the xroar.conf file, I can now boot in to the CoCo 3, and hold down my Left Control+Left Option then go to Hardware->Soft Reset and get the hidden CoCo 3 easter egg photo:

Though, the border color does not match that of a real CoCo 3, I don’t think.
I hope this helps someone else trying to use the XRoar in CoCo 3 mode with those four special CoCo 3 keys.
Until next time…
You are correct – the border of the 3 Amigos should be white, not green. Older versions of VCC had this problem too when performing soft RESET.
(I think it is fixed in current versions of VCC).
I’ll talk to Cairan about this. In CoCo 3 mode, there is no border on the XROAR emulator, so maybe that has something to do with it.
I finally got Xroar going to the current NitrOS9 Ease of Use hard drive image, and I tested this. The screen is fully white now, as expected.