Originally forked from tomctomc/coco_roms, all non-coco3 code has been stripped and the sources modified to be compatible with LWASM.
This repo is more of an 8-bit assembly playground for me. I doubt these mods will be generally useful, but feel free to give it a try if you're interested. I've tried to keep existing code intact as much as possible to hopefully avoid breaking compatibility with other software that mucks around in the standard ROMs, but I make no guarantees.
Modifications so far:
You can switch between QWERTY and Dvorak by poking a 0 (QWERTY) or a 2 (DVORAK) to address 0xA201
. For example:
POKE &HA201,2 ' switch to Dvorak
POKE &HA201,0 ' switch to QWERTY
Each key is assigned an index based on its position in the keyboard matrix:
index = 8 × row + column
PB0 | PB1 | PB2 | PB3 | PB4 | PB5 | PB6 | PB7 | |
---|---|---|---|---|---|---|---|---|
PA0 | @ | A | B | C | D | E | F | G |
PA1 | H | I | J | K | L | M | N | O |
PA2 | P | Q | R | S | T | U | V | W |
PA3 | X | Y | Z | ↑ | ↓ | ← | → | ␣ |
PA4 | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
PA5 | 8 | 9 | : | ; | , | - | . | / |
PA6 | ENT | CLR | BRK | ALT | CTL | F1 | F2 | SHF |
PA7 | --- | --- | --- | --- | --- | --- | --- | --- |
Here's the keyboard with each key labeled with its index:
And here are the two default keyboard layouts:
Finally, here's the complete keymap:
QWERTY | Dvorak | |||||||||
---|---|---|---|---|---|---|---|---|---|---|
key | index | hex | base | shf | base | shift | base | shf | base | shift |
@ | 0 | 0x00 | @ | DC3 | 0x40 | 0x13 | @ | DC3 | 0x40 | 0x13 |
A | 1 | 0x01 | A | a | 0x41 | 0x61 | A | a | 0x41 | 0x61 |
B | 2 | 0x02 | B | b | 0x42 | 0x62 | X | x | 0x58 | 0x78 |
C | 3 | 0x03 | C | c | 0x43 | 0x63 | J | j | 0x4A | 0x6A |
D | 4 | 0x04 | D | d | 0x44 | 0x64 | E | e | 0x45 | 0x65 |
E | 5 | 0x05 | E | e | 0x45 | 0x65 | . | > | 0x2E | 0x3E |
F | 6 | 0x06 | F | f | 0x46 | 0x66 | U | u | 0x55 | 0x75 |
G | 7 | 0x07 | G | g | 0x47 | 0x67 | I | i | 0x49 | 0x69 |
H | 8 | 0x08 | H | h | 0x48 | 0x68 | D | d | 0x44 | 0x64 |
I | 9 | 0x09 | I | i | 0x49 | 0x69 | C | c | 0x43 | 0x63 |
J | 10 | 0x0A | J | j | 0x4A | 0x6A | H | h | 0x48 | 0x68 |
K | 11 | 0x0B | K | k | 0x4B | 0x6B | T | t | 0x54 | 0x74 |
L | 12 | 0x0C | L | l | 0x4C | 0x6C | N | n | 0x4E | 0x6E |
M | 13 | 0x0D | M | m | 0x4D | 0x6D | M | m | 0x4D | 0x6D |
N | 14 | 0x0E | N | n | 0x4E | 0x6E | B | b | 0x42 | 0x62 |
O | 15 | 0x0F | O | o | 0x4F | 0x6F | R | r | 0x52 | 0x72 |
P | 16 | 0x10 | P | p | 0x50 | 0x70 | L | l | 0x4C | 0x6C |
Q | 17 | 0x11 | Q | q | 0x51 | 0x71 | / | ? | 0x2F | 0x3F |
R | 18 | 0x12 | R | r | 0x52 | 0x72 | P | p | 0x50 | 0x70 |
S | 19 | 0x13 | S | s | 0x53 | 0x73 | O | o | 0x4F | 0x6F |
T | 20 | 0x14 | T | t | 0x54 | 0x74 | Y | y | 0x59 | 0x79 |
U | 21 | 0x15 | U | u | 0x55 | 0x75 | G | g | 0x47 | 0x67 |
V | 22 | 0x16 | V | v | 0x56 | 0x76 | K | k | 0x4B | 0x6B |
W | 23 | 0x17 | W | w | 0x57 | 0x77 | , | < | 0x2C | 0x3C |
X | 24 | 0x18 | X | x | 0x58 | 0x78 | Q | q | 0x51 | 0x71 |
Y | 25 | 0x19 | Y | y | 0x59 | 0x79 | F | f | 0x46 | 0x66 |
Z | 26 | 0x1A | Z | z | 0x5A | 0x7A | ; | + | 0x3B | 0x2B |
↑ | 27 | 0x1B | ↑ | ↑ | 0x5E | 0x5F | ↑ | ↑ | 0x5E | 0x5F |
↓ | 28 | 0x1C | ↓ | ↓ | 0x0A | 0x5B | ↓ | ↓ | 0x0A | 0x5B |
← | 29 | 0x1D | ← | ← | 0x08 | 0x15 | ← | ← | 0x08 | 0x15 |
→ | 30 | 0x1E | → | → | 0x09 | 0x5D | → | → | 0x09 | 0x5D |
␣ | 31 | 0x1F | ␣ | ␣ | 0x20 | 0x20 | ␣ | ␣ | 0x20 | 0x20 |
0 | 32 | 0x20 | 0 | DC2 | 0x30 | 0x12 | 0 | DC2 | 0x30 | 0x12 |
1 | 33 | 0x21 | 1 | ! | 0x31 | 0x21 | 1 | ! | 0x31 | 0x21 |
2 | 34 | 0x22 | 2 | " | 0x32 | 0x22 | 2 | " | 0x32 | 0x22 |
3 | 35 | 0x23 | 3 | # | 0x33 | 0x23 | 3 | # | 0x33 | 0x23 |
4 | 36 | 0x24 | 4 | $ | 0x34 | 0x24 | 4 | $ | 0x34 | 0x24 |
5 | 37 | 0x25 | 5 | % | 0x35 | 0x25 | 5 | % | 0x35 | 0x25 |
6 | 38 | 0x26 | 6 | & | 0x36 | 0x26 | 6 | & | 0x36 | 0x26 |
7 | 39 | 0x27 | 7 | ' | 0x37 | 0x27 | 7 | ' | 0x37 | 0x27 |
8 | 40 | 0x28 | 8 | ( | 0x38 | 0x28 | 8 | ( | 0x38 | 0x28 |
9 | 41 | 0x29 | 9 | ) | 0x39 | 0x29 | 9 | ) | 0x39 | 0x29 |
: | 42 | 0x2A | : | * | 0x3A | 0x2A | : | * | 0x3A | 0x2A |
; | 43 | 0x2B | ; | + | 0x3B | 0x2B | S | s | 0x53 | 0x73 |
, | 44 | 0x2C | , | < | 0x2C | 0x3C | W | w | 0x57 | 0x77 |
- | 45 | 0x2D | - | = | 0x2D | 0x3D | - | = | 0x2D | 0x3D |
. | 46 | 0x2E | . | > | 0x2E | 0x3E | V | v | 0x56 | 0x76 |
/ | 47 | 0x2F | / | ? | 0x2F | 0x3F | Z | z | 0x5A | 0x7A |
ENT | 48 | 0x30 | CR | CR | 0x0D | 0x0D | CR | CR | 0x0D | 0x0D |
CLR | 49 | 0x31 | FF | \ | 0x0C | 0x5C | FF | \ | 0x0C | 0x5C |
BRK | 50 | 0x32 | ETX | ESC | 0x03 | 0x1B | ETX | ESC | 0x03 | 0x1B |
ALT | 51 | 0x33 | NUL | NUL | 0x00 | 0x00 | NUL | NUL | 0x00 | 0x00 |
CTL | 52 | 0x34 | NUL | NUL | 0x00 | 0x00 | NUL | NUL | 0x00 | 0x00 |
F1 | 53 | 0x35 | EOT | ACK | 0x04 | 0x06 | EOT | ACK | 0x04 | 0x06 |
F2 | 54 | 0x36 | ENQ | BEL | 0x05 | 0x07 | ENQ | BEL | 0x05 | 0x07 |
You can also apply any arbitrary keymap from BASIC. See colmak.bas for an example.
By default, the control key in BASIC does nothing. Sure you can read its state by peeking the KEYBUF
at $0156
, but wouldn't it be nice if you could use it directly?
This mod does just that. It will return to BASIC the appropriate ASCII code when Control is pressed along with any key from @
to Z
1. For example, pressing CTRL-M
will return $0D
, the same code as pressing ENTER
directly.
Footnotes
-
Really any key up to
_
(ASCII$5F
), but the coco doesn't have any keys past ASCIIZ
. ↩