From 61a9871c21b0c859d5afd5ffd8167297d07ebef5 Mon Sep 17 00:00:00 2001 From: IrgendwerA8 Date: Thu, 8 Nov 2018 08:29:56 +0100 Subject: [PATCH] Adaptations due to code review. --- asminc/atari.inc | 98 +++++++++++++++++++++++++++++++++++++++++ asminc/atari_pokey.inc | 99 ------------------------------------------ doc/atari.sgml | 2 +- include/_pokey.h | 99 ------------------------------------------ include/atari.h | 97 +++++++++++++++++++++++++++++++++++++++++ 5 files changed, 196 insertions(+), 199 deletions(-) diff --git a/asminc/atari.inc b/asminc/atari.inc index 98c721296..7c46b3252 100644 --- a/asminc/atari.inc +++ b/asminc/atari.inc @@ -831,6 +831,104 @@ PDVS = $D1FF ;##rev2## parallel device select POKEY = $D200 ;POKEY area .include "atari_pokey.inc" +; POKEY KBCODE Values + +KEY_NONE = $FF + +KEY_0 = $32 +KEY_1 = $1F +KEY_2 = $1E +KEY_3 = $1A +KEY_4 = $18 +KEY_5 = $1D +KEY_6 = $1B +KEY_7 = $33 +KEY_8 = $35 +KEY_9 = $30 + +KEY_A = $3F +KEY_B = $15 +KEY_C = $12 +KEY_D = $3A +KEY_E = $2A +KEY_F = $38 +KEY_G = $3D +KEY_H = $39 +KEY_I = $0D +KEY_J = $01 +KEY_K = $05 +KEY_L = $00 +KEY_M = $25 +KEY_N = $23 +KEY_O = $08 +KEY_P = $0A +KEY_Q = $2F +KEY_R = $28 +KEY_S = $3E +KEY_T = $2D +KEY_U = $0B +KEY_V = $10 +KEY_W = $2E +KEY_X = $16 +KEY_Y = $2B +KEY_Z = $17 + +KEY_COMMA = $20 +KEY_PERIOD = $22 +KEY_SLASH = $26 +KEY_SEMICOLON = $02 +KEY_PLUS = $06 +KEY_ASTERISK = $07 +KEY_DASH = $0E +KEY_EQUALS = $0F +KEY_LESSTHAN = $36 +KEY_GREATERTHAN = $37 + +KEY_ESC = $1C +KEY_TAB = $2C +KEY_SPACE = $21 +KEY_RETURN = $0C +KEY_DELETE = $34 +KEY_CAPS = $3C +KEY_INVERSE = $27 +KEY_HELP = $11 + +KEY_F1 = $03 +KEY_F2 = $04 +KEY_F3 = $13 +KEY_F4 = $14 + +KEY_SHIFT = $40 +KEY_CTRL = $80 + +; Composed keys + +KEY_EXCLAMATIONMARK = KEY_1 | KEY_SHIFT +KEY_QUOTE = KEY_2 | KEY_SHIFT +KEY_HASH = KEY_3 | KEY_SHIFT +KEY_DOLLAR = KEY_4 | KEY_SHIFT +KEY_PERCENT = KEY_5 | KEY_SHIFT +KEY_AMPERSAND = KEY_6 | KEY_SHIFT +KEY_APOSTROPHE = KEY_7 | KEY_SHIFT +KEY_AT = KEY_8 | KEY_SHIFT +KEY_OPENINGPARAN = KEY_9 | KEY_SHIFT +KEY_CLOSINGPARAN = KEY_0 | KEY_SHIFT +KEY_UNDERLINE = KEY_DASH | KEY_SHIFT +KEY_BAR = KEY_EQUALS | KEY_SHIFT +KEY_COLON = KEY_SEMICOLON | KEY_SHIFT +KEY_BACKSLASH = KEY_PLUS | KEY_SHIFT +KEY_CIRCUMFLEX = KEY_ASTERISK | KEY_SHIFT +KEY_OPENINGBRACKET = KEY_COMMA | KEY_SHIFT +KEY_CLOSINGBRACKET = KEY_PERIOD | KEY_SHIFT +KEY_QUESTIONMARK = KEY_SLASH | KEY_SHIFT +KEY_CLEAR = KEY_LESSTHAN | KEY_SHIFT +KEY_INSERT = KEY_GREATERTHAN | KEY_SHIFT + +KEY_UP = KEY_UNDERLINE | KEY_CTRL +KEY_DOWN = KEY_EQUALS | KEY_CTRL +KEY_LEFT = KEY_PLUS | KEY_CTRL +KEY_RIGHT = KEY_ASTERISK | KEY_CTRL + ;------------------------------------------------------------------------- ; ANTIC Address Equates ;------------------------------------------------------------------------- diff --git a/asminc/atari_pokey.inc b/asminc/atari_pokey.inc index 07e9c00ef..4174865d5 100644 --- a/asminc/atari_pokey.inc +++ b/asminc/atari_pokey.inc @@ -41,102 +41,3 @@ POTGO = POKEY + $0B ;start potentiometer scan sequence SEROUT = POKEY + $0D ;serial port output IRQEN = POKEY + $0E ;IRQ interrupt enable SKCTL = POKEY + $0F ;serial port and keyboard control - - -; KBCODE Values - -KEY_NONE = $FF - -KEY_0 = $32 -KEY_1 = $1F -KEY_2 = $1E -KEY_3 = $1A -KEY_4 = $18 -KEY_5 = $1D -KEY_6 = $1B -KEY_7 = $33 -KEY_8 = $35 -KEY_9 = $30 - -KEY_A = $3F -KEY_B = $15 -KEY_C = $12 -KEY_D = $3A -KEY_E = $2A -KEY_F = $38 -KEY_G = $3D -KEY_H = $39 -KEY_I = $0D -KEY_J = $01 -KEY_K = $05 -KEY_L = $00 -KEY_M = $25 -KEY_N = $23 -KEY_O = $08 -KEY_P = $0A -KEY_Q = $2F -KEY_R = $28 -KEY_S = $3E -KEY_T = $2D -KEY_U = $0B -KEY_V = $10 -KEY_W = $2E -KEY_X = $16 -KEY_Y = $2B -KEY_Z = $17 - -KEY_COMMA = $20 -KEY_PERIOD = $22 -KEY_SLASH = $26 -KEY_SEMICOLON = $02 -KEY_PLUS = $06 -KEY_ASTERISK = $07 -KEY_DASH = $0E -KEY_EQUALS = $0F -KEY_LESSTHAN = $36 -KEY_GREATERTHAN = $37 - -KEY_ESC = $1C -KEY_TAB = $2C -KEY_SPACE = $21 -KEY_RETURN = $0C -KEY_DELETE = $34 -KEY_CAPS = $3C -KEY_INVERSE = $27 -KEY_HELP = $11 - -KEY_F1 = $03 -KEY_F2 = $04 -KEY_F3 = $13 -KEY_F4 = $14 - -KEY_SHIFT = $40 -KEY_CTRL = $80 - -; Composed keys - -KEY_EXCLAMATIONMARK = KEY_1 | KEY_SHIFT -KEY_QUOTE = KEY_2 | KEY_SHIFT -KEY_HASH = KEY_3 | KEY_SHIFT -KEY_DOLLAR = KEY_4 | KEY_SHIFT -KEY_PERCENT = KEY_5 | KEY_SHIFT -KEY_AMPERSAND = KEY_6 | KEY_SHIFT -KEY_APOSTROPHE = KEY_7 | KEY_SHIFT -KEY_AT = KEY_8 | KEY_SHIFT -KEY_OPENINGPARAN = KEY_9 | KEY_SHIFT -KEY_CLOSINGPARAN = KEY_0 | KEY_SHIFT -KEY_UNDERLINE = KEY_DASH | KEY_SHIFT -KEY_BAR = KEY_EQUALS | KEY_SHIFT -KEY_COLON = KEY_SEMICOLON | KEY_SHIFT -KEY_BACKSLASH = KEY_PLUS | KEY_SHIFT -KEY_CIRCUMFLEX = KEY_ASTERISK | KEY_SHIFT -KEY_OPENINGBRACKET = KEY_COMMA | KEY_SHIFT -KEY_CLOSINGBRACKET = KEY_PERIOD | KEY_SHIFT -KEY_QUESTIONMARK = KEY_SLASH | KEY_SHIFT -KEY_CLEAR = KEY_LESSTHAN | KEY_SHIFT -KEY_INSERT = KEY_GREATERTHAN | KEY_SHIFT - -KEY_UP = KEY_UNDERLINE | KEY_CTRL -KEY_DOWN = KEY_EQUALS | KEY_CTRL -KEY_LEFT = KEY_PLUS | KEY_CTRL -KEY_RIGHT = KEY_ASTERISK | KEY_CTRL diff --git a/doc/atari.sgml b/doc/atari.sgml index db76c6736..a0efab9be 100644 --- a/doc/atari.sgml +++ b/doc/atari.sgml @@ -432,7 +432,7 @@ Example: ... -You can find the C defines in the file "Loadable drivers

diff --git a/include/_pokey.h b/include/_pokey.h index 2c2f7167e..fed8628b6 100644 --- a/include/_pokey.h +++ b/include/_pokey.h @@ -7,7 +7,6 @@ /* */ /* */ /* (C) 2000 Freddy Offenga */ -/* 06-Nov-2018: Christian Krueger: Added defines for keyboard codes */ /* */ /* */ /* This software is provided 'as-is', without any expressed or implied */ @@ -75,104 +74,6 @@ struct __pokey_read { }; -/* Keyboard values returned by kbcode */ - -#define KEY_NONE (unsigned char) 0xFF - -#define KEY_0 (unsigned char) 0x32 -#define KEY_1 (unsigned char) 0x1F -#define KEY_2 (unsigned char) 0x1E -#define KEY_3 (unsigned char) 0x1A -#define KEY_4 (unsigned char) 0x18 -#define KEY_5 (unsigned char) 0x1D -#define KEY_6 (unsigned char) 0x1B -#define KEY_7 (unsigned char) 0x33 -#define KEY_8 (unsigned char) 0x35 -#define KEY_9 (unsigned char) 0x30 - -#define KEY_A (unsigned char) 0x3F -#define KEY_B (unsigned char) 0x15 -#define KEY_C (unsigned char) 0x12 -#define KEY_D (unsigned char) 0x3A -#define KEY_E (unsigned char) 0x2A -#define KEY_F (unsigned char) 0x38 -#define KEY_G (unsigned char) 0x3D -#define KEY_H (unsigned char) 0x39 -#define KEY_I (unsigned char) 0x0D -#define KEY_J (unsigned char) 0x01 -#define KEY_K (unsigned char) 0x05 -#define KEY_L (unsigned char) 0x00 -#define KEY_M (unsigned char) 0x25 -#define KEY_N (unsigned char) 0x23 -#define KEY_O (unsigned char) 0x08 -#define KEY_P (unsigned char) 0x0A -#define KEY_Q (unsigned char) 0x2F -#define KEY_R (unsigned char) 0x28 -#define KEY_S (unsigned char) 0x3E -#define KEY_T (unsigned char) 0x2D -#define KEY_U (unsigned char) 0x0B -#define KEY_V (unsigned char) 0x10 -#define KEY_W (unsigned char) 0x2E -#define KEY_X (unsigned char) 0x16 -#define KEY_Y (unsigned char) 0x2B -#define KEY_Z (unsigned char) 0x17 - -#define KEY_COMMA (unsigned char) 0x20 -#define KEY_PERIOD (unsigned char) 0x22 -#define KEY_SLASH (unsigned char) 0x26 -#define KEY_SEMICOLON (unsigned char) 0x02 -#define KEY_PLUS (unsigned char) 0x06 -#define KEY_ASTERISK (unsigned char) 0x07 -#define KEY_DASH (unsigned char) 0x0E -#define KEY_EQUALS (unsigned char) 0x0F -#define KEY_LESSTHAN (unsigned char) 0x36 -#define KEY_GREATERTHAN (unsigned char) 0x37 - -#define KEY_ESC (unsigned char) 0x1C -#define KEY_TAB (unsigned char) 0x2C -#define KEY_SPACE (unsigned char) 0x21 -#define KEY_RETURN (unsigned char) 0x0C -#define KEY_DELETE (unsigned char) 0x34 -#define KEY_CAPS (unsigned char) 0x3C -#define KEY_INVERSE (unsigned char) 0x27 -#define KEY_HELP (unsigned char) 0x11 - -#define KEY_F1 (unsigned char) 0x03 -#define KEY_F2 (unsigned char) 0x04 -#define KEY_F3 (unsigned char) 0x13 -#define KEY_F4 (unsigned char) 0x14 - -#define KEY_CTRL (unsigned char) 0x80 -#define KEY_SHIFT (unsigned char) 0x40 - -/* Composed keys */ - -#define KEY_EXCLAMATIONMARK (KEY_1 | KEY_SHIFT) -#define KEY_QUOTE (KEY_2 | KEY_SHIFT) -#define KEY_HASH (KEY_3 | KEY_SHIFT) -#define KEY_DOLLAR (KEY_4 | KEY_SHIFT) -#define KEY_PERCENT (KEY_5 | KEY_SHIFT) -#define KEY_AMPERSAND (KEY_6 | KEY_SHIFT) -#define KEY_APOSTROPHE (KEY_7 | KEY_SHIFT) -#define KEY_AT (KEY_8 | KEY_SHIFT) -#define KEY_OPENINGPARAN (KEY_9 | KEY_SHIFT) -#define KEY_CLOSINGPARAN (KEY_0 | KEY_SHIFT) -#define KEY_UNDERLINE (KEY_DASH | KEY_SHIFT) -#define KEY_BAR (KEY_EQUALS | KEY_SHIFT) -#define KEY_COLON (KEY_SEMICOLON | KEY_SHIFT) -#define KEY_BACKSLASH (KEY_PLUS | KEY_SHIFT) -#define KEY_CIRCUMFLEX (KEY_ASTERISK | KEY_SHIFT) -#define KEY_OPENINGBRACKET (KEY_COMMA | KEY_SHIFT) -#define KEY_CLOSINGBRACKET (KEY_PERIOD | KEY_SHIFT) -#define KEY_QUESTIONMARK (KEY_SLASH | KEY_SHIFT) -#define KEY_CLEAR (KEY_LESSTHAN | KEY_SHIFT) -#define KEY_INSERT (KEY_GREATERTHAN | KEY_SHIFT) - -#define KEY_UP (KEY_UNDERLINE | KEY_CTRL) -#define KEY_DOWN (KEY_EQUALS | KEY_CTRL) -#define KEY_LEFT (KEY_PLUS | KEY_CTRL) -#define KEY_RIGHT (KEY_ASTERISK | KEY_CTRL) - /* End of _pokey.h */ #endif /* #ifndef __POKEY_H */ diff --git a/include/atari.h b/include/atari.h index ca6bd424c..ca12a493a 100644 --- a/include/atari.h +++ b/include/atari.h @@ -159,6 +159,103 @@ #define JOY_FIRE_MASK JOY_BTN_1_MASK #define JOY_FIRE(v) ((v) & JOY_FIRE_MASK) +/* Keyboard values returned by kbcode / CH */ +#define KEY_NONE (unsigned char) 0xFF + +#define KEY_0 (unsigned char) 0x32 +#define KEY_1 (unsigned char) 0x1F +#define KEY_2 (unsigned char) 0x1E +#define KEY_3 (unsigned char) 0x1A +#define KEY_4 (unsigned char) 0x18 +#define KEY_5 (unsigned char) 0x1D +#define KEY_6 (unsigned char) 0x1B +#define KEY_7 (unsigned char) 0x33 +#define KEY_8 (unsigned char) 0x35 +#define KEY_9 (unsigned char) 0x30 + +#define KEY_A (unsigned char) 0x3F +#define KEY_B (unsigned char) 0x15 +#define KEY_C (unsigned char) 0x12 +#define KEY_D (unsigned char) 0x3A +#define KEY_E (unsigned char) 0x2A +#define KEY_F (unsigned char) 0x38 +#define KEY_G (unsigned char) 0x3D +#define KEY_H (unsigned char) 0x39 +#define KEY_I (unsigned char) 0x0D +#define KEY_J (unsigned char) 0x01 +#define KEY_K (unsigned char) 0x05 +#define KEY_L (unsigned char) 0x00 +#define KEY_M (unsigned char) 0x25 +#define KEY_N (unsigned char) 0x23 +#define KEY_O (unsigned char) 0x08 +#define KEY_P (unsigned char) 0x0A +#define KEY_Q (unsigned char) 0x2F +#define KEY_R (unsigned char) 0x28 +#define KEY_S (unsigned char) 0x3E +#define KEY_T (unsigned char) 0x2D +#define KEY_U (unsigned char) 0x0B +#define KEY_V (unsigned char) 0x10 +#define KEY_W (unsigned char) 0x2E +#define KEY_X (unsigned char) 0x16 +#define KEY_Y (unsigned char) 0x2B +#define KEY_Z (unsigned char) 0x17 + +#define KEY_COMMA (unsigned char) 0x20 +#define KEY_PERIOD (unsigned char) 0x22 +#define KEY_SLASH (unsigned char) 0x26 +#define KEY_SEMICOLON (unsigned char) 0x02 +#define KEY_PLUS (unsigned char) 0x06 +#define KEY_ASTERISK (unsigned char) 0x07 +#define KEY_DASH (unsigned char) 0x0E +#define KEY_EQUALS (unsigned char) 0x0F +#define KEY_LESSTHAN (unsigned char) 0x36 +#define KEY_GREATERTHAN (unsigned char) 0x37 + +#define KEY_ESC (unsigned char) 0x1C +#define KEY_TAB (unsigned char) 0x2C +#define KEY_SPACE (unsigned char) 0x21 +#define KEY_RETURN (unsigned char) 0x0C +#define KEY_DELETE (unsigned char) 0x34 +#define KEY_CAPS (unsigned char) 0x3C +#define KEY_INVERSE (unsigned char) 0x27 +#define KEY_HELP (unsigned char) 0x11 + +#define KEY_F1 (unsigned char) 0x03 +#define KEY_F2 (unsigned char) 0x04 +#define KEY_F3 (unsigned char) 0x13 +#define KEY_F4 (unsigned char) 0x14 + +#define KEY_CTRL (unsigned char) 0x80 +#define KEY_SHIFT (unsigned char) 0x40 + +/* Composed keys */ + +#define KEY_EXCLAMATIONMARK (KEY_1 | KEY_SHIFT) +#define KEY_QUOTE (KEY_2 | KEY_SHIFT) +#define KEY_HASH (KEY_3 | KEY_SHIFT) +#define KEY_DOLLAR (KEY_4 | KEY_SHIFT) +#define KEY_PERCENT (KEY_5 | KEY_SHIFT) +#define KEY_AMPERSAND (KEY_6 | KEY_SHIFT) +#define KEY_APOSTROPHE (KEY_7 | KEY_SHIFT) +#define KEY_AT (KEY_8 | KEY_SHIFT) +#define KEY_OPENINGPARAN (KEY_9 | KEY_SHIFT) +#define KEY_CLOSINGPARAN (KEY_0 | KEY_SHIFT) +#define KEY_UNDERLINE (KEY_DASH | KEY_SHIFT) +#define KEY_BAR (KEY_EQUALS | KEY_SHIFT) +#define KEY_COLON (KEY_SEMICOLON | KEY_SHIFT) +#define KEY_BACKSLASH (KEY_PLUS | KEY_SHIFT) +#define KEY_CIRCUMFLEX (KEY_ASTERISK | KEY_SHIFT) +#define KEY_OPENINGBRACKET (KEY_COMMA | KEY_SHIFT) +#define KEY_CLOSINGBRACKET (KEY_PERIOD | KEY_SHIFT) +#define KEY_QUESTIONMARK (KEY_SLASH | KEY_SHIFT) +#define KEY_CLEAR (KEY_LESSTHAN | KEY_SHIFT) +#define KEY_INSERT (KEY_GREATERTHAN | KEY_SHIFT) + +#define KEY_UP (KEY_UNDERLINE | KEY_CTRL) +#define KEY_DOWN (KEY_EQUALS | KEY_CTRL) +#define KEY_LEFT (KEY_PLUS | KEY_CTRL) +#define KEY_RIGHT (KEY_ASTERISK | KEY_CTRL) + /* color register functions */ extern void __fastcall__ _setcolor (unsigned char color_reg, unsigned char hue, unsigned char luminace); extern void __fastcall__ _setcolor_low (unsigned char color_reg, unsigned char color_value); -- 2.39.5