I was trying to figure out how some of the keystrokes can be generated and noticed some very small and subtle discrepancies in the keytable:

Somewhere in the copts and robbers code it was checking for a keycode of 0x9e and 0x9d which can only be generated by ctrl+shift+M = 0x9d and ctrl+shift+N = 0x9e

[Linked Image from i.imgur.com]

so according the manual m will generate

and the manual has the columns in different order of ctrl shift so to match the key_remap table
it would be:
cd dd 8d 9d -> (removing the high bit)
4d 5d 0d 1d

{ 0x4d,0x4d,0x0d,0x0d }, /* m M 24 */

N is
CE 8E dE 9E
and reordering
ce de 8e 9e ->
4e 5e 0e 1e

I don't have real hardware to test against, so ymmv. This is from the apple ii reference manual, is the 2 plus any different?

static const uint8_t a2_key_remap[0x32][4] =
/* norm shft ctrl both */
{ 0x33,0x23,0x33,0x23 }, /* 3 # 00 */
{ 0x34,0x24,0x34,0x24 }, /* 4 $ 01 */
{ 0x08,0x08,0x08,0x08 }, /* Left 1c */
{ 0x15,0x15,0x15,0x15 }, /* Right 1d */
{ 0x5a,0x5a,0x1a,0x1a }, /* z Z 1e */
{ 0x58,0x58,0x18,0x18 }, /* x X 1f */
{ 0x43,0x43,0x03,0x03 }, /* c C 20 */
{ 0x56,0x56,0x16,0x16 }, /* v V 21 */
{ 0x42,0x42,0x02,0x02 }, /* b B 22 */
{ 0x4e,0x5e,0x0e,0x5e }, /* n N 23 */
{ 0x4d,0x4d,0x0d,0x0d }, /* m M 24 */

Interestingly they didn't do that with CTRL+SHIFT+L and CTRL+SHIFT+O to generate the unique codes of 9C and 9F, just with CTRL+M and CTRL+N.

Looking at the this, I wonder why they just didn't add some small modifications to this table so the apple 2 could type backslashes, both brackets and underscores directly from the keyboard with a CTRL+SHIFT. That would've been really useful as a bunch of codes can't be typed. $DB,DC, and DF are missing. CTRL+SHIFT could've given codes from E0 to FF. (I suppose they fixed all this with the 2e)

Just as an experiment I modified the table so I could type underscore with a CTRL+SHIFT+L and backslash with CTRL+SHIFT+O and it seemed to work fine with PRINT "_\".

Last edited by Golden Child; 09/07/19 03:33 PM.