From 7cd8ce63a8a2985e0edd8cfec45d675fe6ff9335 Mon Sep 17 00:00:00 2001 From: Ian C Date: Fri, 20 Mar 2020 22:22:20 +0000 Subject: Added extra keys. --- src/czx81.c | 95 +++++++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 86 insertions(+), 9 deletions(-) (limited to 'src/czx81.c') diff --git a/src/czx81.c b/src/czx81.c index 6d2f60f..14bc25b 100644 --- a/src/czx81.c +++ b/src/czx81.c @@ -162,11 +162,83 @@ static struct {'c', 1, {0}, {0x08}}, {'v', 1, {0}, {0x10}}, - {'b', 1, {6}, {0x10}}, - {'n', 1, {6}, {0x08}}, - {'m', 1, {6}, {0x04}}, - {'.', 1, {6}, {0x02}}, - {' ', 1, {6}, {0x01}}, + {'b', 1, {7}, {0x10}}, + {'n', 1, {7}, {0x08}}, + {'m', 1, {7}, {0x04}}, + {'.', 1, {7}, {0x02}}, + {' ', 1, {7}, {0x01}}, + + /* Shifted alpha + */ + {'Q', 2, {0, 2}, {0x01, 0x01}}, + {'W', 2, {0, 2}, {0x01, 0x02}}, + {'E', 2, {0, 2}, {0x01, 0x04}}, + {'R', 2, {0, 2}, {0x01, 0x08}}, + {'T', 2, {0, 2}, {0x01, 0x10}}, + {'Y', 2, {0, 5}, {0x01, 0x10}}, + {'U', 2, {0, 5}, {0x01, 0x08}}, + {'I', 2, {0, 5}, {0x01, 0x04}}, + {'O', 2, {0, 5}, {0x01, 0x02}}, + {'P', 2, {0, 5}, {0x01, 0x01}}, + {'A', 2, {0, 1}, {0x01, 0x01}}, + {'S', 2, {0, 1}, {0x01, 0x02}}, + {'D', 2, {0, 1}, {0x01, 0x04}}, + {'F', 2, {0, 1}, {0x01, 0x08}}, + {'G', 2, {0, 1}, {0x01, 0x10}}, + {'H', 2, {0, 6}, {0x01, 0x10}}, + {'J', 2, {0, 6}, {0x01, 0x08}}, + {'K', 2, {0, 6}, {0x01, 0x04}}, + {'L', 2, {0, 6}, {0x01, 0x02}}, + {'Z', 2, {0, 0}, {0x01, 0x02}}, + {'X', 2, {0, 0}, {0x01, 0x04}}, + {'C', 2, {0, 0}, {0x01, 0x08}}, + {'V', 2, {0, 0}, {0x01, 0x10}}, + {'B', 2, {0, 6}, {0x01, 0x10}}, + {'N', 2, {0, 6}, {0x01, 0x08}}, + {'M', 2, {0, 6}, {0x01, 0x04}}, + + /* Shifted alpha shortcuts + */ + {'\'', 2, {0, 2}, {0x01, 0x01}}, + {'$', 2, {0, 5}, {0x01, 0x08}}, + {'(', 2, {0, 5}, {0x01, 0x04}}, + {')', 2, {0, 5}, {0x01, 0x02}}, + {'"', 2, {0, 5}, {0x01, 0x01}}, + {'^', 2, {0, 6}, {0x01, 0x10}}, + {'-', 2, {0, 6}, {0x01, 0x08}}, + {'+', 2, {0, 6}, {0x01, 0x04}}, + {'=', 2, {0, 6}, {0x01, 0x02}}, + {':', 2, {0, 0}, {0x01, 0x02}}, + {';', 2, {0, 0}, {0x01, 0x04}}, + {'?', 2, {0, 0}, {0x01, 0x08}}, + {'/', 2, {0, 0}, {0x01, 0x10}}, + {'*', 2, {0, 6}, {0x01, 0x10}}, + {'<', 2, {0, 6}, {0x01, 0x08}}, + {'>', 2, {0, 6}, {0x01, 0x04}}, + {',', 2, {0, 7}, {0x01, 0x02}}, + + /* Cursor keys + */ + {KEY_LEFT, 2, {0, 3}, {0x01, 0x10}}, + {KEY_DOWN, 2, {0, 4}, {0x01, 0x10}}, + {KEY_UP, 2, {0, 4}, {0x01, 0x08}}, + {KEY_RIGHT, 2, {0, 4}, {0x01, 0x04}}, + + /* Function keys + */ + {KEY_F(1), 2, {0, 3}, {0x01, 0x01}}, + {KEY_F(2), 2, {0, 3}, {0x01, 0x02}}, + {KEY_F(3), 2, {0, 3}, {0x01, 0x04}}, + {KEY_F(4), 2, {0, 3}, {0x01, 0x08}}, + {KEY_F(5), 2, {0, 4}, {0x01, 0x02}}, + {KEY_F(6), 2, {0, 6}, {0x01, 0x01}}, + {KEY_F(7), 2, {0, 7}, {0x01, 0x01}}, + + /* Backspace/delete + */ + {KEY_BACKSPACE,2, {0, 4}, {0x01, 0x01}}, + {KEY_DC, 2, {0, 4}, {0x01, 0x01}}, + {127, 2, {0, 4}, {0x01, 0x01}}, {ERR, 0, {0}, {0}} }; @@ -551,8 +623,6 @@ static Z80Byte ZX81ReadPort(Z80 *z80, Z80Word port) { Z80Byte b = 0; - sprintf(message,"IN() called with %4.4x MARGIN=%d", port, mem[MARGIN]); - switch(port & 0xff) { case 0xfe: @@ -611,6 +681,8 @@ static void ZX81Reset(void) Z80Reset(z80); + FRAME_TSTATES = FAST_TSTATES; + /* 16K of memory */ RAMBOT = 0x4000; @@ -719,8 +791,9 @@ static void Menu() mvprintw(0, 0, "F1 .. Tracing %s", trace ? "ON ":"OFF"); mvprintw(2, 0, "F2 .. Frames per key press: %2d", key_press_frames); - mvprintw(4, 0, "F3 .. Quit"); - mvprintw(6, 0, "Press ESCAPE to resume"); + mvprintw(4, 0, "F3 .. Reset ZX81"); + mvprintw(6, 0, "F4 .. Quit"); + mvprintw(8, 0, "Press ESCAPE to resume"); refresh(); @@ -740,6 +813,10 @@ static void Menu() break; case KEY_F(3): + ZX81Reset(); + break; + + case KEY_F(4): quit = TRUE; done = TRUE; break; -- cgit v1.2.3