From ce80624f627ba887cf01d01d3f7c9dc02538a536 Mon Sep 17 00:00:00 2001
From: IrgendwerA8 <c.krueger.b@web.de>
Date: Thu, 2 Jan 2020 18:57:03 +0100
Subject: [PATCH 148/170] ctype size optimization
---
asminc/ctype.inc | 16 +-
asminc/ctype_common.inc | 91 ++++++
asminc/ctype_console.inc | 92 +++++++
asminc/ctypetable.inc | 48 ++++
doc/cc65.sgml | 5 +-
doc/funcref.sgml | 67 -----
include/ctype.h | 101 +------
libsrc/apple2/ctype.s | 160 +----------
libsrc/atari/ctype.s | 425 ++++++++++------------------
libsrc/atari2600/ctype.s | 161 +----------
libsrc/atmos/ctype.s | 426 ++++++++++-------------------
libsrc/cbm/ctype.s | 417 ++++++++++------------------
libsrc/common/atoi.s | 22 +-
libsrc/common/ctype_preprocessor.s | 50 ++++
libsrc/common/isalnum.s | 24 +-
libsrc/common/isalpha.s | 24 +-
libsrc/common/isascii.s | 27 ++
libsrc/common/isblank.s | 24 +-
libsrc/common/iscntrl.s | 24 +-
libsrc/common/isdigit.s | 24 +-
libsrc/common/isgraph.s | 28 +-
libsrc/common/islower.s | 22 +-
libsrc/common/isprint.s | 26 +-
libsrc/common/ispunct.s | 29 +-
libsrc/common/isspace.s | 24 +-
libsrc/common/isupper.s | 24 +-
libsrc/common/isxdigit.s | 24 +-
libsrc/common/stricmp.s | 43 +--
libsrc/common/strlower.s | 9 +-
libsrc/common/strnicmp.s | 38 +--
libsrc/common/strupper.s | 8 +-
libsrc/creativision/ctype.s | 171 +-----------
libsrc/gamate/ctype.s | 160 +----------
libsrc/geos-common/system/ctype.s | 422 ++++++++++------------------
libsrc/lynx/ctype.s | 171 +-----------
libsrc/nes/ctype.s | 171 +-----------
libsrc/none/ctype.s | 158 +----------
libsrc/osic1p/ctype.s | 158 +----------
libsrc/pce/ctype.s | 157 +----------
libsrc/sim6502/ctype.s | 158 +----------
libsrc/supervision/ctype.s | 161 +----------
libsrc/telestrat/ctype.s | 298 +-------------------
test/val/lib_common_ctype.c | 368 +++++++++++++++++++++++++
43 files changed, 1492 insertions(+), 3564 deletions(-)
create mode 100644 asminc/ctype_common.inc
create mode 100644 asminc/ctype_console.inc
create mode 100644 asminc/ctypetable.inc
create mode 100644 libsrc/common/ctype_preprocessor.s
create mode 100644 libsrc/common/isascii.s
create mode 100644 test/val/lib_common_ctype.c
diff --git a/asminc/ctype.inc b/asminc/ctype.inc
index d6b0ccf4..401e772a 100644
--- a/asminc/ctype.inc
+++ b/asminc/ctype.inc
@@ -1,12 +1,14 @@
+; ctype.inc
;
-; Definitions for the character type tables
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
;
-; Ullrich von Bassewitz, 08.09.2001
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
+;
+; Definitions for the character type tables
;
-
-; Make the __ctype table an exported/imported symbol
-
- .global __ctype
; Define bitmapped constants for the table entries
@@ -25,5 +27,3 @@ CT_ALNUM = (CT_LOWER | CT_UPPER | CT_DIGIT)
CT_ALPHA = (CT_LOWER | CT_UPPER)
CT_CTRL_SPACE = (CT_CTRL | CT_SPACE)
CT_NOT_PUNCT = (CT_SPACE | CT_CTRL | CT_DIGIT | CT_UPPER | CT_LOWER)
-
-
diff --git a/asminc/ctype_common.inc b/asminc/ctype_common.inc
new file mode 100644
index 00000000..ffd8dfe0
--- /dev/null
+++ b/asminc/ctype_common.inc
@@ -0,0 +1,91 @@
+; ctype_common.inc
+;
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
+;
+; Character specification table for some common targets.
+;
+
+ .include "ctypetable.inc"
+ .export __ctypeIdx
+
+; The tables are readonly, put them into the rodata segment
+
+.rodata
+
+__ctypeIdx:
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 0/00 ___ctrl_@___, 1/01 ___ctrl_A___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 2/02 ___ctrl_B___, 3/03 ___ctrl_C___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 4/04 ___ctrl_D___, 5/05 ___ctrl_E___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 6/06 ___ctrl_F___, 7/07 ___ctrl_G___
+ ct_mix CT_CTRL_IDX, CT_CTRL_WS_SPACETAB_IDX ; 8/08 ___ctrl_H___, 9/09 ___ctrl_I___
+ ct_mix CT_CTRL_WS_IDX, CT_CTRL_WS_IDX ; 10/0a ___ctrl_J___, 11/0b ___ctrl_K___
+ ct_mix CT_CTRL_WS_IDX, CT_CTRL_WS_IDX ; 12/0c ___ctrl_L___, 13/0d ___ctrl_M___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 14/0e ___ctrl_N___, 15/0f ___ctrl_O___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 16/10 ___ctrl_P___, 17/11 ___ctrl_Q___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 18/12 ___ctrl_R___, 19/13 ___ctrl_S___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 20/14 ___ctrl_T___, 21/15 ___ctrl_U___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 22/16 ___ctrl_V___, 23/17 ___ctrl_W___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 24/18 ___ctrl_X___, 25/19 ___ctrl_Y___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 26/1a ___ctrl_Z___, 27/1b ___ctrl_[___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 28/1c ___ctrl_\___, 29/1d ___ctrl_]___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 30/1e ___ctrl_^___, 31/1f ___ctrl_____
+
+ ct_mix CT_SPACE_SPACETAB_IDX, CT_NONE_IDX ; 32/20 ___SPACE___, 33/21 _____!_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 34/22 _____"_____, 35/23 _____#_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 36/24 _____$_____, 37/25 _____%_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 38/26 _____&_____, 39/27 _____'_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 40/28 _____(_____, 41/29 _____)_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 42/2a _____*_____, 43/2b _____+_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 44/2c _____,_____, 45/2d _____-_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 46/2e _____._____, 47/2f _____/_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 48/30 _____0_____, 49/31 _____1_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 50/32 _____2_____, 51/33 _____3_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 52/34 _____4_____, 53/35 _____5_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 54/36 _____6_____, 55/37 _____7_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 56/38 _____8_____, 57/39 _____9_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 58/3a _____:_____, 59/3b _____;_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 60/3c _____<_____, 61/3d _____=_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 62/3e _____>_____, 63/3f _____?_____
+
+ ct_mix CT_NONE_IDX, CT_UPPER_XDIGIT_IDX ; 64/40 _____@_____, 65/41 _____A_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_XDIGIT_IDX ; 66/42 _____B_____, 67/43 _____C_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_XDIGIT_IDX ; 68/44 _____D_____, 69/45 _____E_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_IDX ; 70/46 _____F_____, 71/47 _____G_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 72/48 _____H_____, 73/49 _____I_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 74/4a _____J_____, 75/4b _____K_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 76/4c _____L_____, 77/4d _____M_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 78/4e _____N_____, 79/4f _____O_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 80/50 _____P_____, 81/51 _____Q_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 82/52 _____R_____, 83/53 _____S_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 84/54 _____T_____, 85/55 _____U_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 86/56 _____V_____, 87/57 _____W_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 88/58 _____X_____, 89/59 _____Y_____
+ ct_mix CT_UPPER_IDX, CT_NONE_IDX ; 90/5a _____Z_____, 91/5b _____[_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 92/5c _____\_____, 93/5d _____]_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 94/5e _____^_____, 95/5f _UNDERLINE_
+
+ ct_mix CT_NONE_IDX, CT_LOWER_XDIGIT_IDX ; 96/60 ___grave___, 97/61 _____a_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_XDIGIT_IDX ; 98/62 _____b_____, 99/63 _____c_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_XDIGIT_IDX ; 100/64 _____d_____, 101/65 _____e_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_IDX ; 102/66 _____f_____, 103/67 _____g_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 104/68 _____h_____, 105/69 _____i_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 106/6a _____j_____, 107/6b _____k_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 108/6c _____l_____, 109/6d _____m_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 110/6e _____n_____, 111/6f _____o_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 112/70 _____p_____, 113/71 _____q_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 114/72 _____r_____, 115/73 _____s_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 116/74 _____t_____, 117/75 _____u_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 118/76 _____v_____, 119/77 _____w_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 120/78 _____x_____, 121/79 _____y_____
+ ct_mix CT_LOWER_IDX, CT_NONE_IDX ; 122/7a _____z_____, 123/7b _____{_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 124/7c _____|_____, 125/7d _____}_____
+ ct_mix CT_NONE_IDX, CT_WS_IDX ; 126/7e _____~_____, 127/7f ____DEL____
+
+.repeat 64
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 128-255
+.endrepeat
diff --git a/asminc/ctype_console.inc b/asminc/ctype_console.inc
new file mode 100644
index 00000000..55db8e61
--- /dev/null
+++ b/asminc/ctype_console.inc
@@ -0,0 +1,92 @@
+; ctype_console.inc
+;
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
+;
+; Character specification table, matching serveral consoles.
+;
+
+ .include "ctypetable.inc"
+ .export __ctypeIdx
+
+; The tables are readonly, put them into the rodata segment
+
+.rodata
+
+__ctypeIdx:
+
+.repeat 2 ; 2 times for normal and inverted
+
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 0/00 ___ctrl_@___, 1/01 ___ctrl_A___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 2/02 ___ctrl_B___, 3/03 ___ctrl_C___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 4/04 ___ctrl_D___, 5/05 ___ctrl_E___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 6/06 ___ctrl_F___, 7/07 ___ctrl_G___
+ ct_mix CT_CTRL_IDX, CT_CTRL_WS_SPACETAB_IDX ; 8/08 ___ctrl_H___, 9/09 ___ctrl_I___
+ ct_mix CT_CTRL_WS_IDX, CT_CTRL_WS_IDX ; 10/0a ___ctrl_J___, 11/0b ___ctrl_K___
+ ct_mix CT_CTRL_WS_IDX, CT_CTRL_WS_IDX ; 12/0c ___ctrl_L___, 13/0d ___ctrl_M___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 14/0e ___ctrl_N___, 15/0f ___ctrl_O___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 16/10 ___ctrl_P___, 17/11 ___ctrl_Q___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 18/12 ___ctrl_R___, 19/13 ___ctrl_S___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 20/14 ___ctrl_T___, 21/15 ___ctrl_U___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 22/16 ___ctrl_V___, 23/17 ___ctrl_W___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 24/18 ___ctrl_X___, 25/19 ___ctrl_Y___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 26/1a ___ctrl_Z___, 27/1b ___ctrl_[___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 28/1c ___ctrl_\___, 29/1d ___ctrl_]___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 30/1e ___ctrl_^___, 31/1f ___ctrl_____
+
+ ct_mix CT_SPACE_SPACETAB_IDX, CT_NONE_IDX ; 32/20 ___SPACE___, 33/21 _____!_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 34/22 _____"_____, 35/23 _____#_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 36/24 _____$_____, 37/25 _____%_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 38/26 _____&_____, 39/27 _____'_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 40/28 _____(_____, 41/29 _____)_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 42/2a _____*_____, 43/2b _____+_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 44/2c _____,_____, 45/2d _____-_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 46/2e _____._____, 47/2f _____/_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 48/30 _____0_____, 49/31 _____1_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 50/32 _____2_____, 51/33 _____3_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 52/34 _____4_____, 53/35 _____5_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 54/36 _____6_____, 55/37 _____7_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 56/38 _____8_____, 57/39 _____9_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 58/3a _____:_____, 59/3b _____;_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 60/3c _____<_____, 61/3d _____=_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 62/3e _____>_____, 63/3f _____?_____
+
+ ct_mix CT_NONE_IDX, CT_UPPER_XDIGIT_IDX ; 64/40 _____@_____, 65/41 _____A_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_XDIGIT_IDX ; 66/42 _____B_____, 67/43 _____C_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_XDIGIT_IDX ; 68/44 _____D_____, 69/45 _____E_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_IDX ; 70/46 _____F_____, 71/47 _____G_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 72/48 _____H_____, 73/49 _____I_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 74/4a _____J_____, 75/4b _____K_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 76/4c _____L_____, 77/4d _____M_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 78/4e _____N_____, 79/4f _____O_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 80/50 _____P_____, 81/51 _____Q_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 82/52 _____R_____, 83/53 _____S_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 84/54 _____T_____, 85/55 _____U_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 86/56 _____V_____, 87/57 _____W_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 88/58 _____X_____, 89/59 _____Y_____
+ ct_mix CT_UPPER_IDX, CT_NONE_IDX ; 90/5a _____Z_____, 91/5b _____[_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 92/5c _____\_____, 93/5d _____]_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 94/5e _____^_____, 95/5f _UNDERLINE_
+
+ ct_mix CT_NONE_IDX, CT_LOWER_XDIGIT_IDX ; 96/60 ___grave___, 97/61 _____a_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_XDIGIT_IDX ; 98/62 _____b_____, 99/63 _____c_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_XDIGIT_IDX ; 100/64 _____d_____, 101/65 _____e_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_IDX ; 102/66 _____f_____, 103/67 _____g_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 104/68 _____h_____, 105/69 _____i_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 106/6a _____j_____, 107/6b _____k_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 108/6c _____l_____, 109/6d _____m_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 110/6e _____n_____, 111/6f _____o_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 112/70 _____p_____, 113/71 _____q_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 114/72 _____r_____, 115/73 _____s_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 116/74 _____t_____, 117/75 _____u_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 118/76 _____v_____, 119/77 _____w_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 120/78 _____x_____, 121/79 _____y_____
+ ct_mix CT_LOWER_IDX, CT_NONE_IDX ; 122/7a _____z_____, 123/7b _____{_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 124/7c _____|_____, 125/7d _____}_____
+ ct_mix CT_NONE_IDX, CT_WS_IDX ; 126/7e _____~_____, 127/7f ____DEL____
+
+.endrepeat
diff --git a/asminc/ctypetable.inc b/asminc/ctypetable.inc
new file mode 100644
index 00000000..e0a8bdcd
--- /dev/null
+++ b/asminc/ctypetable.inc
@@ -0,0 +1,48 @@
+; ctypetable.inc
+;
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
+;
+; Data covering all possible combinations of character flags for target specific definition
+;
+
+.include "ctype.inc"
+.export __ctype
+
+; This data is a table of possible ctype combinations, possible during
+
+.rodata
+__ctype:
+ct_none: .byte CT_NONE
+ct_lower: .byte CT_LOWER
+ct_upper: .byte CT_UPPER
+ct_digit_xdigit: .byte CT_DIGIT | CT_XDIGIT
+ct_lower_xdigit: .byte CT_LOWER | CT_XDIGIT
+ct_upper_xdigit: .byte CT_UPPER | CT_XDIGIT
+ct_ctrl: .byte CT_CTRL
+ct_ws: .byte CT_OTHER_WS
+ct_ctrl_ws: .byte CT_CTRL | CT_OTHER_WS
+ct_space_spacetab: .byte CT_SPACE | CT_SPACE_TAB
+ct_ctrl_ws_spacetab: .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB
+
+; build indices out of the table above:
+
+CT_NONE_IDX = ct_none - __ctype
+CT_LOWER_IDX = ct_lower - __ctype
+CT_UPPER_IDX = ct_upper - __ctype
+CT_DIGIT_XDIGIT_IDX = ct_digit_xdigit - __ctype
+CT_LOWER_XDIGIT_IDX = ct_lower_xdigit - __ctype
+CT_UPPER_XDIGIT_IDX = ct_upper_xdigit - __ctype
+CT_CTRL_IDX = ct_ctrl - __ctype
+CT_WS_IDX = ct_ws - __ctype
+CT_CTRL_WS_IDX = ct_ctrl_ws - __ctype
+CT_SPACE_SPACETAB_IDX = ct_space_spacetab - __ctype
+CT_CTRL_WS_SPACETAB_IDX = ct_ctrl_ws_spacetab - __ctype
+
+.macro ct_mix lower, upper
+ .byte ((lower) & $0F) | ((upper) << 4)
+.endmacro
diff --git a/doc/cc65.sgml b/doc/cc65.sgml
index 8691f947..dba0a028 100644
--- a/doc/cc65.sgml
+++ b/doc/cc65.sgml
@@ -249,7 +249,6 @@ Here is a description of all the command line options:
<item><tt/strcmp()/
<item><tt/strcpy()/
<item><tt/strlen()/
- <item>most of the functions declared in <tt/<ctype.h>/
</itemize>
Note: This has two consequences:
@@ -259,9 +258,7 @@ Here is a description of all the command line options:
using <tt/--eagerly-inline-funcs/ actually will break things.
<p>
<item>The inlined string and memory functions will not handle strings or
- memory areas larger than 255 bytes. Similarly, the inlined <tt/is..()/
- functions will not work with values outside the char. range (such as
- <tt/EOF/).
+ memory areas larger than 255 bytes.
<p>
</itemize>
diff --git a/doc/funcref.sgml b/doc/funcref.sgml
index b6171a0e..94e85009 100644
--- a/doc/funcref.sgml
+++ b/doc/funcref.sgml
@@ -4232,11 +4232,6 @@ to undefined behaviour.
is a letter or digit. The return value is zero if the character is anything
else.
<tag/Notes/<itemize>
-<item>When compiling with <tt/-Os/ the function is actually a macro. The
-inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
-this range. The non inline function may be accessed by <tt/#undef/'ing
-the macro.
<item>When compiling without <tt/-Os/, the function is only available as
fastcall function, so it may only be used in presence of a prototype.
</itemize>
@@ -4269,11 +4264,6 @@ fastcall function, so it may only be used in presence of a prototype.
<tag/Description/The function returns a non zero value if the given argument
is a letter. The return value is zero if the character is anything else.
<tag/Notes/<itemize>
-<item>When compiling with <tt/-Os/ the function is actually a macro. The
-inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
-this range. The non inline function may be accessed by <tt/#undef/'ing the
-macro.
<item>When compiling without <tt/-Os/, the function is only available as
fastcall function, so it may only be used in presence of a prototype.
</itemize>
@@ -4305,12 +4295,6 @@ fastcall function, so it may only be used in presence of a prototype.
<tag/Declaration/<tt/int __fastcall__ isascii (int c);/
<tag/Description/The function returns a non zero value if the given argument
is in the range 0..127 (the range of valid ASCII characters) and zero if not.
-<tag/Notes/<itemize>
-<item>When compiling with <tt/-Os/ the function is actually a macro. The
-inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
-this range. The non inline function may be accessed by <tt/#undef/'ing the
-macro.
<item>When compiling without <tt/-Os/, the function is only available as
fastcall function, so it may only be used in presence of a prototype.
</itemize>
@@ -4344,11 +4328,6 @@ fastcall function, so it may only be used in presence of a prototype.
is a space or tab character. The return value is zero if the character is
anything else.
<tag/Notes/<itemize>
-<item>When compiling with <tt/-Os/ the function is actually a macro. The
-inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
-this range. The non inline function may be accessed by <tt/#undef/'ing the
-macro.
<item>When compiling without <tt/-Os/, the function is only available as
fastcall function, so it may only be used in presence of a prototype.
</itemize>
@@ -4382,11 +4361,6 @@ fastcall function, so it may only be used in presence of a prototype.
is a control character. The return value is zero if the character is anything
else.
<tag/Notes/<itemize>
-<item>When compiling with <tt/-Os/ the function is actually a macro. The
-inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
-this range. The non inline function may be accessed by <tt/#undef/'ing the
-macro.
<item>When compiling without <tt/-Os/, the function is only available as
fastcall function, so it may only be used in presence of a prototype.
</itemize>
@@ -4418,12 +4392,6 @@ fastcall function, so it may only be used in presence of a prototype.
<tag/Declaration/<tt/int __fastcall__ isdigit (int c);/
<tag/Description/The function returns a non zero value if the given argument
is a digit. The return value is zero if the character is anything else.
-<tag/Notes/<itemize>
-<item>When compiling with <tt/-Os/ the function is actually a macro. The
-inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
-this range. The non inline function may be accessed by <tt/#undef/'ing the
-macro.
<item>When compiling without <tt/-Os/, the function is only available as
fastcall function, so it may only be used in presence of a prototype.
</itemize>
@@ -4479,11 +4447,6 @@ space).
is a printable character with the exception of space. The return value is zero
if the character is anything else.
<tag/Notes/<itemize>
-<item>When compiling with <tt/-Os/ the function is actually a macro. The
-inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
-this range. The non inline function may be accessed by <tt/#undef/'ing the
-macro.
<item>When compiling without <tt/-Os/, the function is only available as
fastcall function, so it may only be used in presence of a prototype.
</itemize>
@@ -4517,11 +4480,6 @@ fastcall function, so it may only be used in presence of a prototype.
is a lower case letter. The return value is zero if the character is anything
else.
<tag/Notes/<itemize>
-<item>When compiling with <tt/-Os/ the function is actually a macro. The
-inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
-this range. The non inline function may be accessed by <tt/#undef/'ing the
-macro.
<item>When compiling without <tt/-Os/, the function is only available as
fastcall function, so it may only be used in presence of a prototype.
</itemize>
@@ -4555,11 +4513,6 @@ fastcall function, so it may only be used in presence of a prototype.
is a printable character (this includes the space character). The return value
is zero if the character is anything else.
<tag/Notes/<itemize>
-<item>When compiling with <tt/-Os/ the function is actually a macro. The
-inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
-this range. The non inline function may be accessed by <tt/#undef/'ing the
-macro.
<item>When compiling without <tt/-Os/, the function is only available as
fastcall function, so it may only be used in presence of a prototype.
</itemize>
@@ -4594,11 +4547,6 @@ space or an alphanumeric character.
is a printable character, but not a space or anything alphanumeric. The return
value is zero if the character is anything else.
<tag/Notes/<itemize>
-<item>When compiling with <tt/-Os/ the function is actually a macro. The
-inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
-this range. The non inline function may be accessed by <tt/#undef/'ing the
-macro.
<item>When compiling without <tt/-Os/, the function is only available as
fastcall function, so it may only be used in presence of a prototype.
</itemize>
@@ -4634,11 +4582,6 @@ anything else. The standard white space characters are: space, formfeed ('\f'),
newline ('\n'), carriage return ('\r'), horizontal tab ('\t'), and vertical tab
('\v').
<tag/Notes/<itemize>
-<item>When compiling with <tt/-Os/ the function is actually a macro. The
-inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
-this range. The non inline function may be accessed by <tt/#undef/'ing the
-macro.
<item>When compiling without <tt/-Os/, the function is only available as
fastcall function, so it may only be used in presence of a prototype.
</itemize>
@@ -4672,11 +4615,6 @@ fastcall function, so it may only be used in presence of a prototype.
is an upper case letter. The return value is zero if the character is anything
else.
<tag/Notes/<itemize>
-<item>When compiling with <tt/-Os/ the function is actually a macro. The
-inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
-this range. The non inline function may be accessed by <tt/#undef/'ing the
-macro.
<item>When compiling without <tt/-Os/, the function is only available as
fastcall function, so it may only be used in presence of a prototype.
</itemize>
@@ -4710,11 +4648,6 @@ fastcall function, so it may only be used in presence of a prototype.
is a hexadecimal digit (0..9, a..f and A..F). The return value is zero if the
character is anything else.
<tag/Notes/<itemize>
-<item>When compiling with <tt/-Os/ the function is actually a macro. The
-inline sequence generated by the macro will not work correctly for values
-outside the range 0..255. <em/Note:/ The constant <tt/EOF/ is not part of
-this range. The non inline function may be accessed by <tt/#undef/'ing the
-macro.
<item>When compiling without <tt/-Os/, the function is only available as
fastcall function, so it may only be used in presence of a prototype.
</itemize>
diff --git a/include/ctype.h b/include/ctype.h
index 103f6cc2..d842228e 100644
--- a/include/ctype.h
+++ b/include/ctype.h
@@ -36,10 +36,6 @@
#ifndef _CTYPE_H
#define _CTYPE_H
-
-/* The array containing character classification data */
-extern unsigned char _ctype[256];
-
/* Bits used to specify character classes */
#define _CT_LOWER 0x01 /* 0 - Lower case char */
#define _CT_UPPER 0x02 /* 1 - Upper case char */
@@ -61,6 +57,7 @@ extern unsigned char _ctype[256];
/* Character classification functions */
int __fastcall__ isalnum (int c);
int __fastcall__ isalpha (int c);
+int __fastcall__ isascii (int c);
int __fastcall__ iscntrl (int c);
int __fastcall__ isdigit (int c);
int __fastcall__ isgraph (int c);
@@ -82,102 +79,6 @@ unsigned char __fastcall__ toascii (unsigned char c);
/* Convert a target-specific character to ASCII. */
#endif
-
-
-/* When --eagerly-inline-funcs is enabled, overload most of the above
-** functions by macroes. The function prototypes are available again after
-** #undef'ing the macroes.
-** Please note that the following macroes do NOT handle EOF correctly, as
-** stated in the manual. If you need correct behaviour for EOF, don't
-** use --eagerly-inline-funcs, or #undefine the following macroes.
-*/
-#ifdef __EAGERLY_INLINE_FUNCS__
-
-#define isalnum(c) (__AX__ = (c), \
- __asm__ ("tay"), \
- __asm__ ("lda %v,y", _ctype), \
- __asm__ ("and #%b", _CT_ALNUM), \
- __AX__)
-
-#define isalpha(c) (__AX__ = (c), \
- __asm__ ("tay"), \
- __asm__ ("lda %v,y", _ctype), \
- __asm__ ("and #%b", _CT_ALPHA), \
- __AX__)
-
-#if __CC65_STD__ >= __CC65_STD_C99__
-#define isblank(c) (__AX__ = (c), \
- __asm__ ("tay"), \
- __asm__ ("lda %v,y", _ctype), \
- __asm__ ("and #%b", _CT_SPACE_TAB), \
- __AX__)
-#endif
-
-#define iscntrl(c) (__AX__ = (c), \
- __asm__ ("tay"), \
- __asm__ ("lda %v,y", _ctype), \
- __asm__ ("and #%b", _CT_CNTRL), \
- __AX__)
-
-#define isdigit(c) (__AX__ = (c), \
- __asm__ ("tay"), \
- __asm__ ("lda %v,y", _ctype), \
- __asm__ ("and #%b", _CT_DIGIT), \
- __AX__)
-
-#define isgraph(c) (__AX__ = (c), \
- __asm__ ("tay"), \
- __asm__ ("lda %v,y", _ctype), \
- __asm__ ("and #%b", _CT_NOT_GRAPH), \
- __asm__ ("cmp #1"), \
- __asm__ ("lda #1"), \
- __asm__ ("sbc #1"), \
- __AX__)
-
-#define islower(c) (__AX__ = (c), \
- __asm__ ("tay"), \
- __asm__ ("lda %v,y", _ctype), \
- __asm__ ("and #%b", _CT_LOWER), \
- __AX__)
-
-#define isprint(c) (__AX__ = (c), \
- __asm__ ("tay"), \
- __asm__ ("lda %v,y", _ctype), \
- __asm__ ("and #%b", _CT_NOT_PRINT), \
- __asm__ ("eor #%b", _CT_NOT_PRINT), \
- __AX__)
-
-#define ispunct(c) (__AX__ = (c), \
- __asm__ ("tay"), \
- __asm__ ("lda %v,y", _ctype), \
- __asm__ ("and #%b", _CT_NOT_PUNCT), \
- __asm__ ("cmp #1"), \
- __asm__ ("lda #1"), \
- __asm__ ("sbc #1"), \
- __AX__)
-
-#define isspace(c) (__AX__ = (c), \
- __asm__ ("tay"), \
- __asm__ ("lda %v,y", _ctype), \
- __asm__ ("and #%b", _CT_WS), \
- __AX__)
-
-#define isupper(c) (__AX__ = (c), \
- __asm__ ("tay"), \
- __asm__ ("lda %v,y", _ctype), \
- __asm__ ("and #%b", _CT_UPPER), \
- __AX__)
-
-#define isxdigit(c) (__AX__ = (c), \
- __asm__ ("tay"), \
- __asm__ ("lda %v,y", _ctype), \
- __asm__ ("and #%b", _CT_XDIGIT), \
- __AX__)
-
-#endif
-
-
-
/* End of ctype.h */
#endif
diff --git a/libsrc/apple2/ctype.s b/libsrc/apple2/ctype.s
index fa9a65c8..da4d3847 100644
--- a/libsrc/apple2/ctype.s
+++ b/libsrc/apple2/ctype.s
@@ -1,161 +1,5 @@
-;
-; Stefan Haubenthal with minor changes from Ullrich von Bassewitz, 2003-05-02
-;
; Character specification table.
;
+; uses the "console" definition
- .include "ctype.inc"
-
-; The tables are readonly, put them into the rodata segment
-
-.rodata
-
-; The following 256 byte wide table specifies attributes for the isxxx type
-; of functions. Doing it by a table means some overhead in space, but it
-; has major advantages:
-;
-; * It is fast. If it were'nt for the slow parameter passing of cc65, one
-; could even define macros for the isxxx functions (this is usually
-; done on other platforms).
-;
-; * It is highly portable. The only unportable part is the table itself,
-; all real code goes into the common library.
-;
-; * We save some code in the isxxx functions.
-
-
-__ctype:
- .repeat 2
- .byte CT_CTRL ; 0/00 ___ctrl_@___
- .byte CT_CTRL ; 1/01 ___ctrl_A___
- .byte CT_CTRL ; 2/02 ___ctrl_B___
- .byte CT_CTRL ; 3/03 ___ctrl_C___
- .byte CT_CTRL ; 4/04 ___ctrl_D___
- .byte CT_CTRL ; 5/05 ___ctrl_E___
- .byte CT_CTRL ; 6/06 ___ctrl_F___
- .byte CT_CTRL ; 7/07 ___ctrl_G___
- .byte CT_CTRL ; 8/08 ___ctrl_H___
- .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB
- ; 9/09 ___ctrl_I___
- .byte CT_CTRL | CT_OTHER_WS ; 10/0a ___ctrl_J___
- .byte CT_CTRL | CT_OTHER_WS ; 11/0b ___ctrl_K___
- .byte CT_CTRL | CT_OTHER_WS ; 12/0c ___ctrl_L___
- .byte CT_CTRL | CT_OTHER_WS ; 13/0d ___ctrl_M___
- .byte CT_CTRL ; 14/0e ___ctrl_N___
- .byte CT_CTRL ; 15/0f ___ctrl_O___
- .byte CT_CTRL ; 16/10 ___ctrl_P___
- .byte CT_CTRL ; 17/11 ___ctrl_Q___
- .byte CT_CTRL ; 18/12 ___ctrl_R___
- .byte CT_CTRL ; 19/13 ___ctrl_S___
- .byte CT_CTRL ; 20/14 ___ctrl_T___
- .byte CT_CTRL ; 21/15 ___ctrl_U___
- .byte CT_CTRL ; 22/16 ___ctrl_V___
- .byte CT_CTRL ; 23/17 ___ctrl_W___
- .byte CT_CTRL ; 24/18 ___ctrl_X___
- .byte CT_CTRL ; 25/19 ___ctrl_Y___
- .byte CT_CTRL ; 26/1a ___ctrl_Z___
- .byte CT_CTRL ; 27/1b ___ctrl_[___
- .byte CT_CTRL ; 28/1c ___ctrl_\___
- .byte CT_CTRL ; 29/1d ___ctrl_]___
- .byte CT_CTRL ; 30/1e ___ctrl_^___
- .byte CT_CTRL ; 31/1f ___ctrl_____
- .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___
- .byte CT_NONE ; 33/21 _____!_____
- .byte CT_NONE ; 34/22 _____"_____
- .byte CT_NONE ; 35/23 _____#_____
- .byte CT_NONE ; 36/24 _____$_____
- .byte CT_NONE ; 37/25 _____%_____
- .byte CT_NONE ; 38/26 _____&_____
- .byte CT_NONE ; 39/27 _____'_____
- .byte CT_NONE ; 40/28 _____(_____
- .byte CT_NONE ; 41/29 _____)_____
- .byte CT_NONE ; 42/2a _____*_____
- .byte CT_NONE ; 43/2b _____+_____
- .byte CT_NONE ; 44/2c _____,_____
- .byte CT_NONE ; 45/2d _____-_____
- .byte CT_NONE ; 46/2e _____._____
- .byte CT_NONE ; 47/2f _____/_____
- .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____
- .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____
- .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____
- .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____
- .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____
- .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____
- .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____
- .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____
- .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____
- .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____
- .byte CT_NONE ; 58/3a _____:_____
- .byte CT_NONE ; 59/3b _____;_____
- .byte CT_NONE ; 60/3c _____<_____
- .byte CT_NONE ; 61/3d _____=_____
- .byte CT_NONE ; 62/3e _____>_____
- .byte CT_NONE ; 63/3f _____?_____
-
- .byte CT_NONE ; 64/40 _____@_____
- .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____
- .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____
- .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____
- .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____
- .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____
- .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____
- .byte CT_UPPER ; 71/47 _____G_____
- .byte CT_UPPER ; 72/48 _____H_____
- .byte CT_UPPER ; 73/49 _____I_____
- .byte CT_UPPER ; 74/4a _____J_____
- .byte CT_UPPER ; 75/4b _____K_____
- .byte CT_UPPER ; 76/4c _____L_____
- .byte CT_UPPER ; 77/4d _____M_____
- .byte CT_UPPER ; 78/4e _____N_____
- .byte CT_UPPER ; 79/4f _____O_____
- .byte CT_UPPER ; 80/50 _____P_____
- .byte CT_UPPER ; 81/51 _____Q_____
- .byte CT_UPPER ; 82/52 _____R_____
- .byte CT_UPPER ; 83/53 _____S_____
- .byte CT_UPPER ; 84/54 _____T_____
- .byte CT_UPPER ; 85/55 _____U_____
- .byte CT_UPPER ; 86/56 _____V_____
- .byte CT_UPPER ; 87/57 _____W_____
- .byte CT_UPPER ; 88/58 _____X_____
- .byte CT_UPPER ; 89/59 _____Y_____
- .byte CT_UPPER ; 90/5a _____Z_____
- .byte CT_NONE ; 91/5b _____[_____
- .byte CT_NONE ; 92/5c _____\_____
- .byte CT_NONE ; 93/5d _____]_____
- .byte CT_NONE ; 94/5e _____^_____
- .byte CT_NONE ; 95/5f _UNDERLINE_
- .byte CT_NONE ; 96/60 ___grave___
- .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____
- .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____
- .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____
- .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____
- .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____
- .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____
- .byte CT_LOWER ; 103/67 _____g_____
- .byte CT_LOWER ; 104/68 _____h_____
- .byte CT_LOWER ; 105/69 _____i_____
- .byte CT_LOWER ; 106/6a _____j_____
- .byte CT_LOWER ; 107/6b _____k_____
- .byte CT_LOWER ; 108/6c _____l_____
- .byte CT_LOWER ; 109/6d _____m_____
- .byte CT_LOWER ; 110/6e _____n_____
- .byte CT_LOWER ; 111/6f _____o_____
- .byte CT_LOWER ; 112/70 _____p_____
- .byte CT_LOWER ; 113/71 _____q_____
- .byte CT_LOWER ; 114/72 _____r_____
- .byte CT_LOWER ; 115/73 _____s_____
- .byte CT_LOWER ; 116/74 _____t_____
- .byte CT_LOWER ; 117/75 _____u_____
- .byte CT_LOWER ; 118/76 _____v_____
- .byte CT_LOWER ; 119/77 _____w_____
- .byte CT_LOWER ; 120/78 _____x_____
- .byte CT_LOWER ; 121/79 _____y_____
- .byte CT_LOWER ; 122/7a _____z_____
- .byte CT_NONE ; 123/7b _____{_____
- .byte CT_NONE ; 124/7c _____|_____
- .byte CT_NONE ; 125/7d _____}_____
- .byte CT_NONE ; 126/7e _____~_____
- .byte CT_OTHER_WS ; 127/7f ____DEL____
- .endrepeat
-
-
+ .include "ctype_console.inc"
diff --git a/libsrc/atari/ctype.s b/libsrc/atari/ctype.s
index 73553dc1..8173b2ea 100644
--- a/libsrc/atari/ctype.s
+++ b/libsrc/atari/ctype.s
@@ -1,301 +1,156 @@
+; ctype.s
;
-; Ullrich von Bassewitz, 02.06.1998
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
;
-; Character specification table.
+; https://github.com/cc65/cc65
;
-; adapted to Atari by Christian Groessler, June 2000
+; See "LICENSE" file for legal information.
+;
+; Atari character specification table.
;
+ .include "ctypetable.inc"
+ .export __ctypeIdx
+
; The tables are readonly, put them into the rodata segment
.rodata
-; The following 256 byte wide table specifies attributes for the isxxx type
-; of functions. Doing it by a table means some overhead in space, but it
-; has major advantages:
-;
-; * It is fast. If it were'nt for the slow parameter passing of cc65, one
-; could even define macros for the isxxx functions (this is usually
-; done on other platforms).
-;
-; * It is highly portable. The only unportable part is the table itself,
-; all real code goes into the common library.
-;
-; * We save some code in the isxxx functions.
-;
-;
-; Bit assignments:
-;
-; 0 - Lower case char
-; 1 - Upper case char
-; 2 - Numeric digit
-; 3 - Hex digit (both, lower and upper)
-; 4 - Control character
-; 5 - The space character itself
-; 6 - Other whitespace (that is: '\f', '\n', '\r', '\t' and '\v')
-; 7 - Space or tab character
+__ctypeIdx:
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 0/00 ___heart____, 1/01 ___l_tee____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 2/02 ___ctrl_B___, 3/03 ___ctrl_C___
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 4/04 ___r_tee____, 5/05 ___ctrl_E___
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 6/06 ___ctrl_F___, 7/07 ___ctrl_G___
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 8/08 ___ctrl_H___, 9/09 ___ctrl_I___
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 10/0a ___ctrl_J___, 11/0b ___ctrl_K___
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 12/0c ___ctrl_L___, 13/0d ___ctrl_M___
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 14/0e ___ctrl_N___, 15/0f ___ctrl_O___
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 16/10 ____club____, 17/11 ___ctrl_Q___
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 18/12 ___h_line___, 19/13 ___ctrl_S___
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 20/14 ____ball____, 21/15 ___ctrl_U___
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 22/16 ___ctrl_V___, 23/17 ___t_tee____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 24/18 ___b_tee____, 25/19 ___ctrl_Y___
+ ct_mix CT_NONE_IDX, CT_CTRL_IDX ; 26/1a ___ctrl_Z___, 27/1b ____ESC_____
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 28/1c ___crsr_up__, 29/1d ___crsr_dn__
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 30/1e ___crsr_lf__, 31/1f ___crsr_rg__
- .export __ctype
+ ct_mix CT_SPACE_SPACETAB_IDX, CT_NONE_IDX ; 32/20 ___SPACE___, 33/21 _____!_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 34/22 _____"_____, 35/23 _____#_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 36/24 _____$_____, 37/25 _____%_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 38/26 _____&_____, 39/27 _____'_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 40/28 _____(_____, 41/29 _____)_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 42/2a _____*_____, 43/2b _____+_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 44/2c _____,_____, 45/2d _____-_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 46/2e _____._____, 47/2f _____/_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 48/30 _____0_____, 49/31 _____1_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 50/32 _____2_____, 51/33 _____3_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 52/34 _____4_____, 53/35 _____5_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 54/36 _____6_____, 55/37 _____7_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 56/38 _____8_____, 57/39 _____9_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 58/3a _____:_____, 59/3b _____;_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 60/3c _____<_____, 61/3d _____=_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 62/3e _____>_____, 63/3f _____?_____
-__ctype:
- .byte $00 ; 0/00 ___heart____
- .byte $00 ; 1/01 ___l_tee____
- .byte $00 ; 2/02 ___ctrl_B___
- .byte $00 ; 3/03 ___ctrl_C___
- .byte $00 ; 4/04 ___r_tee____
- .byte $00 ; 5/05 ___ctrl_E___
- .byte $00 ; 6/06 ___ctrl_F___
- .byte $00 ; 7/07 ___ctrl_G___
- .byte $00 ; 8/08 ___ctrl_H___
- .byte $00 ; 9/09 ___ctrl_I___
- .byte $00 ; 10/0a ___ctrl_J___
- .byte $00 ; 11/0b ___ctrl_K___
- .byte $00 ; 12/0c ___ctrl_L___
- .byte $00 ; 13/0d ___ctrl_M___
- .byte $00 ; 14/0e ___ctrl_N___
- .byte $00 ; 15/0f ___ctrl_O___
- .byte $00 ; 16/10 ____club____
- .byte $00 ; 17/11 ___ctrl_Q___
- .byte $00 ; 18/12 ___h_line___
- .byte $00 ; 19/13 ___ctrl_S___
- .byte $00 ; 20/14 ____ball____
- .byte $00 ; 21/15 ___ctrl_U___
- .byte $00 ; 22/16 ___ctrl_V___
- .byte $00 ; 23/17 ___t_tee____
- .byte $00 ; 24/18 ___b_tee____
- .byte $00 ; 25/19 ___ctrl_Y___
- .byte $00 ; 26/1a ___ctrl_Z___
- .byte $10 ; 27/1b ____ESC_____
- .byte $10 ; 28/1c ___crsr_up__
- .byte $10 ; 29/1d ___crsr_dn__
- .byte $10 ; 30/1e ___crsr_lf__
- .byte $10 ; 31/1f ___crsr_rg__
- .byte $A0 ; 32/20 ___SPACE___
- .byte $00 ; 33/21 _____!_____
- .byte $00 ; 34/22 _____"_____
- .byte $00 ; 35/23 _____#_____
- .byte $00 ; 36/24 _____$_____
- .byte $00 ; 37/25 _____%_____
- .byte $00 ; 38/26 _____&_____
- .byte $00 ; 39/27 _____'_____
- .byte $00 ; 40/28 _____(_____
- .byte $00 ; 41/29 _____)_____
- .byte $00 ; 42/2a _____*_____
- .byte $00 ; 43/2b _____+_____
- .byte $00 ; 44/2c _____,_____
- .byte $00 ; 45/2d _____-_____
- .byte $00 ; 46/2e _____._____
- .byte $00 ; 47/2f _____/_____
- .byte $0C ; 48/30 _____0_____
- .byte $0C ; 49/31 _____1_____
- .byte $0C ; 50/32 _____2_____
- .byte $0C ; 51/33 _____3_____
- .byte $0C ; 52/34 _____4_____
- .byte $0C ; 53/35 _____5_____
- .byte $0C ; 54/36 _____6_____
- .byte $0C ; 55/37 _____7_____
- .byte $0C ; 56/38 _____8_____
- .byte $0C ; 57/39 _____9_____
- .byte $00 ; 58/3a _____:_____
- .byte $00 ; 59/3b _____;_____
- .byte $00 ; 60/3c _____<_____
- .byte $00 ; 61/3d _____=_____
- .byte $00 ; 62/3e _____>_____
- .byte $00 ; 63/3f _____?_____
+ ct_mix CT_NONE_IDX, CT_UPPER_XDIGIT_IDX ; 64/40 _____@_____, 65/41 _____A_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_XDIGIT_IDX ; 66/42 _____B_____, 67/43 _____C_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_XDIGIT_IDX ; 68/44 _____D_____, 69/45 _____E_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_IDX ; 70/46 _____F_____, 71/47 _____G_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 72/48 _____H_____, 73/49 _____I_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 74/4a _____J_____, 75/4b _____K_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 76/4c _____L_____, 77/4d _____M_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 78/4e _____N_____, 79/4f _____O_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 80/50 _____P_____, 81/51 _____Q_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 82/52 _____R_____, 83/53 _____S_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 84/54 _____T_____, 85/55 _____U_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 86/56 _____V_____, 87/57 _____W_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 88/58 _____X_____, 89/59 _____Y_____
+ ct_mix CT_UPPER_IDX, CT_NONE_IDX ; 90/5a _____Z_____, 91/5b _____[_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 92/5c _____\_____, 93/5d _____]_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 94/5e _____^_____, 95/5f _UNDERLINE_
- .byte $00 ; 64/40 _____@_____
- .byte $0A ; 65/41 _____A_____
- .byte $0A ; 66/42 _____B_____
- .byte $0A ; 67/43 _____C_____
- .byte $0A ; 68/44 _____D_____
- .byte $0A ; 69/45 _____E_____
- .byte $0A ; 70/46 _____F_____
- .byte $02 ; 71/47 _____G_____
- .byte $02 ; 72/48 _____H_____
- .byte $02 ; 73/49 _____I_____
- .byte $02 ; 74/4a _____J_____
- .byte $02 ; 75/4b _____K_____
- .byte $02 ; 76/4c _____L_____
- .byte $02 ; 77/4d _____M_____
- .byte $02 ; 78/4e _____N_____
- .byte $02 ; 79/4f _____O_____
- .byte $02 ; 80/50 _____P_____
- .byte $02 ; 81/51 _____Q_____
- .byte $02 ; 82/52 _____R_____
- .byte $02 ; 83/53 _____S_____
- .byte $02 ; 84/54 _____T_____
- .byte $02 ; 85/55 _____U_____
- .byte $02 ; 86/56 _____V_____
- .byte $02 ; 87/57 _____W_____
- .byte $02 ; 88/58 _____X_____
- .byte $02 ; 89/59 _____Y_____
- .byte $02 ; 90/5a _____Z_____
- .byte $00 ; 91/5b _____[_____
- .byte $00 ; 92/5c _____\_____
- .byte $00 ; 93/5d _____]_____
- .byte $00 ; 94/5e _____^_____
- .byte $00 ; 95/5f _UNDERLINE_
- .byte $00 ; 96/60 __diamond__
- .byte $09 ; 97/61 _____a_____
- .byte $09 ; 98/62 _____b_____
- .byte $09 ; 99/63 _____c_____
- .byte $09 ; 100/64 _____d_____
- .byte $09 ; 101/65 _____e_____
- .byte $09 ; 102/66 _____f_____
- .byte $01 ; 103/67 _____g_____
- .byte $01 ; 104/68 _____h_____
- .byte $01 ; 105/69 _____i_____
- .byte $01 ; 106/6a _____j_____
- .byte $01 ; 107/6b _____k_____
- .byte $01 ; 108/6c _____l_____
- .byte $01 ; 109/6d _____m_____
- .byte $01 ; 110/6e _____n_____
- .byte $01 ; 111/6f _____o_____
- .byte $01 ; 112/70 _____p_____
- .byte $01 ; 113/71 _____q_____
- .byte $01 ; 114/72 _____r_____
- .byte $01 ; 115/73 _____s_____
- .byte $01 ; 116/74 _____t_____
- .byte $01 ; 117/75 _____u_____
- .byte $01 ; 118/76 _____v_____
- .byte $01 ; 119/77 _____w_____
- .byte $01 ; 120/78 _____x_____
- .byte $01 ; 121/79 _____y_____
- .byte $01 ; 122/7a _____z_____
- .byte $00 ; 123/7b ___spade___
- .byte $00 ; 124/7c __v_line___
- .byte $10 ; 125/7d __CLRSCR___
- .byte $D0 ; 126/7e __backtab__
- .byte $D0 ; 127/7f ____tab____
+ ct_mix CT_NONE_IDX, CT_LOWER_XDIGIT_IDX ; 96/60 __diamond__, 97/61 _____a_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_XDIGIT_IDX ; 98/62 _____b_____, 99/63 _____c_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_XDIGIT_IDX ; 100/64 _____d_____, 101/65 _____e_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_IDX ; 102/66 _____f_____, 103/67 _____g_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 104/68 _____h_____, 105/69 _____i_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 106/6a _____j_____, 107/6b _____k_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 108/6c _____l_____, 109/6d _____m_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 110/6e _____n_____, 111/6f _____o_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 112/70 _____p_____, 113/71 _____q_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 114/72 _____r_____, 115/73 _____s_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 116/74 _____t_____, 117/75 _____u_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 118/76 _____v_____, 119/77 _____w_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 120/78 _____x_____, 121/79 _____y_____
+ ct_mix CT_LOWER_IDX, CT_NONE_IDX ; 122/7a _____z_____, 123/7b ___spade___
+ ct_mix CT_NONE_IDX, CT_CTRL_IDX ; 124/7c __v_line___, 125/7d __CLRSCR___
+ ct_mix CT_CTRL_WS_SPACETAB_IDX, CT_CTRL_WS_SPACETAB_IDX
+ ; 126/7e __backtab__, 127/7f ____tab____
- .byte $00 ; 128/80 _inv_heart___
- .byte $00 ; 129/81 _inv_l_tee___
- .byte $00 ; 130/82 _inv_ctrl_B__
- .byte $00 ; 131/83 _inv_ctrl_C__
- .byte $00 ; 132/84 _inv_r_tee___
- .byte $00 ; 133/85 _inv_ctrl_E__
- .byte $00 ; 134/86 _inv_ctrl_F__
- .byte $00 ; 135/87 _inv_ctrl_G__
- .byte $00 ; 136/88 _inv_ctrl_H__
- .byte $00 ; 137/89 _inv_ctrl_I__
- .byte $00 ; 138/8a _inv_ctrl_J__
- .byte $00 ; 139/8b _inv_ctrl_K__
- .byte $00 ; 140/8c _inv_ctrl_L__
- .byte $00 ; 141/8d _inv_ctrl_M__
- .byte $00 ; 142/8e _inv_ctrl_N__
- .byte $00 ; 143/8f _inv_ctrl_O__
- .byte $00 ; 144/90 __inv__club__
- .byte $00 ; 145/91 _inv_ctrl_Q__
- .byte $00 ; 146/92 _inv_h_line__
- .byte $00 ; 147/93 _inv_ctrl_S__
- .byte $00 ; 148/94 __inv__ball__
- .byte $00 ; 149/95 _inv_ctrl_U__
- .byte $00 ; 150/96 _inv_ctrl_V__
- .byte $00 ; 151/97 __inv_t_tee__
- .byte $00 ; 152/98 __inv_b_tee__
- .byte $00 ; 153/99 _inv_ctrl_Y__
- .byte $00 ; 154/9a _inv_ctrl_Z__
- .byte $50 ; 155/9b _____EOL_____
- .byte $10 ; 156/9c ___CLRLINE___
- .byte $10 ; 157/9d ___INSLINE___
- .byte $10 ; 158/9e ____CLRTAB___
- .byte $10 ; 159/9f ____INSTAB___
- .byte $A0 ; 160/a0 __inv_SPACE__
- .byte $00 ; 161/a1 ___inv_!_____
- .byte $00 ; 162/a2 ___inv_"_____
- .byte $00 ; 163/a3 ___inv_#_____
- .byte $00 ; 164/a4 ___inv_$_____
- .byte $00 ; 165/a5 ___inv_%_____
- .byte $00 ; 166/a6 ___inv_&_____
- .byte $00 ; 167/a7 ___inv_'_____
- .byte $00 ; 168/a8 ___inv_(_____
- .byte $00 ; 169/a9 ___inv_)_____
- .byte $00 ; 170/aa ___inv_*_____
- .byte $00 ; 171/ab ___inv_+_____
- .byte $00 ; 172/ac ___inv_,_____
- .byte $00 ; 173/ad ___inv_-_____
- .byte $00 ; 174/ae ___inv_._____
- .byte $00 ; 175/af ___inv_/_____
- .byte $0C ; 176/b0 ___inv_0_____
- .byte $0C ; 177/b1 ___inv_1_____
- .byte $0C ; 178/b2 ___inv_2_____
- .byte $0C ; 179/b3 ___inv_3_____
- .byte $0C ; 180/b4 ___inv_4_____
- .byte $0C ; 181/b5 ___inv_5_____
- .byte $0C ; 182/b6 ___inv_6_____
- .byte $0C ; 183/b7 ___inv_7_____
- .byte $0C ; 184/b8 ___inv_8_____
- .byte $0C ; 185/b9 ___inv_9_____
- .byte $00 ; 186/ba ___inv_:_____
- .byte $00 ; 187/bb ___inv_;_____
- .byte $00 ; 188/bc ___inv_<_____
- .byte $00 ; 189/bd ___inv_=_____
- .byte $00 ; 190/be ___inv_>_____
- .byte $00 ; 191/bf ___inv_?_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 128/80 _inv_heart___, 129/81 _inv_l_tee___
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 130/82 _inv_ctrl_B__, 131/83 _inv_ctrl_C__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 132/84 _inv_r_tee___, 133/85 _inv_ctrl_E__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 134/86 _inv_ctrl_F__, 135/87 _inv_ctrl_G__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 136/88 _inv_ctrl_H__, 137/89 _inv_ctrl_I__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 138/8a _inv_ctrl_J__, 139/8b _inv_ctrl_K__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 140/8c _inv_ctrl_L__, 141/8d _inv_ctrl_M__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 142/8e _inv_ctrl_N__, 143/8f _inv_ctrl_O__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 144/90 __inv__club__, 145/91 _inv_ctrl_Q__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 146/92 _inv_h_line__, 147/93 _inv_ctrl_S__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 148/94 __inv__ball__, 149/95 _inv_ctrl_U__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 150/96 _inv_ctrl_V__, 151/97 __inv_t_tee__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 152/98 __inv_b_tee__, 153/99 _inv_ctrl_Y__
+ ct_mix CT_NONE_IDX, CT_CTRL_WS_IDX ; 154/9a _inv_ctrl_Z__, 155/9b _____EOL_____
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 156/9c ___CLRLINE___, 157/9d ___INSLINE___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 158/9e ____CLRTAB___, 159/9f ____INSTAB___
- .byte $00 ; 192/c0 ___inv_@_____
- .byte $0A ; 193/c1 ___inv_A_____
- .byte $0A ; 194/c2 ___inv_B_____
- .byte $0A ; 195/c3 ___inv_C_____
- .byte $0A ; 196/c4 ___inv_D_____
- .byte $0A ; 197/c5 ___inv_E_____
- .byte $0A ; 198/c6 ___inv_F_____
- .byte $02 ; 199/c7 ___inv_G_____
- .byte $02 ; 200/c8 ___inv_H_____
- .byte $02 ; 201/c9 ___inv_I_____
- .byte $02 ; 202/ca ___inv_J_____
- .byte $02 ; 203/cb ___inv_K_____
- .byte $02 ; 204/cc ___inv_L_____
- .byte $02 ; 205/cd ___inv_M_____
- .byte $02 ; 206/ce ___inv_N_____
- .byte $02 ; 207/cf ___inv_O_____
- .byte $02 ; 208/d0 ___inv_P_____
- .byte $02 ; 209/d1 ___inv_Q_____
- .byte $02 ; 210/d2 ___inv_R_____
- .byte $02 ; 211/d3 ___inv_S_____
- .byte $02 ; 212/d4 ___inv_T_____
- .byte $02 ; 213/d5 ___inv_U_____
- .byte $02 ; 214/d6 ___inv_V_____
- .byte $02 ; 215/d7 ___inv_W_____
- .byte $02 ; 216/d8 ___inv_X_____
- .byte $02 ; 217/d9 ___inv_Y_____
- .byte $02 ; 218/da ___inv_Z_____
- .byte $00 ; 219/db ___inv_[_____
- .byte $00 ; 220/dc ___inv_\_____
- .byte $00 ; 221/dd ___inv_]_____
- .byte $00 ; 222/de ___inv_^_____
- .byte $00 ; 223/df _inv_UNDRLIN_
- .byte $00 ; 224/e0 _inv_diamond_
- .byte $09 ; 225/e1 ___inv_a_____
- .byte $09 ; 226/e2 ___inv_b_____
- .byte $09 ; 227/e3 ___inv_c_____
- .byte $09 ; 228/e4 ___inv_d_____
- .byte $09 ; 229/e5 ___inv_e_____
- .byte $09 ; 230/e6 ___inv_f_____
- .byte $01 ; 231/e7 ___inv_g_____
- .byte $01 ; 232/e8 ___inv_h_____
- .byte $01 ; 233/e9 ___inv_i_____
- .byte $01 ; 234/ea ___inv_j_____
- .byte $01 ; 235/eb ___inv_k_____
- .byte $01 ; 236/ec ___inv_l_____
- .byte $01 ; 237/ed ___inv_m_____
- .byte $01 ; 238/ee ___inv_n_____
- .byte $01 ; 239/ef ___inv_o_____
- .byte $01 ; 240/f0 ___inv_p_____
- .byte $01 ; 241/f1 ___inv_q_____
- .byte $01 ; 242/f2 ___inv_r_____
- .byte $01 ; 243/f3 ___inv_s_____
- .byte $01 ; 244/f4 ___inv_t_____
- .byte $01 ; 245/f5 ___inv_u_____
- .byte $01 ; 246/f6 ___inv_v_____
- .byte $01 ; 247/f7 ___inv_w_____
- .byte $01 ; 248/f8 ___inv_x_____
- .byte $01 ; 249/f9 ___inv_y_____
- .byte $01 ; 250/fa ___inv_z_____
- .byte $00 ; 251/fb __inv_spade__
- .byte $00 ; 252/fc __inv_v_line_
- .byte $10 ; 253/fd ____BEEP_____
- .byte $10 ; 254/fe ____DELBS____
- .byte $10 ; 255/ff ___INSERT____
+ ct_mix CT_SPACE_SPACETAB_IDX, CT_NONE_IDX ; 160/a0 __inv_SPACE__, 161/a1 ___inv_!_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 162/a2 ___inv_"_____, 163/a3 ___inv_#_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 164/a4 ___inv_$_____, 165/a5 ___inv_%_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 166/a6 ___inv_&_____, 167/a7 ___inv_'_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 168/a8 ___inv_(_____, 169/a9 ___inv_)_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 170/aa ___inv_*_____, 171/ab ___inv_+_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 172/ac ___inv_,_____, 173/ad ___inv_-_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 174/ae ___inv_._____, 175/af ___inv_/_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 176/b0 ___inv_0_____, 177/b1 ___inv_1_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 178/b2 ___inv_2_____, 179/b3 ___inv_3_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 180/b4 ___inv_4_____, 181/b5 ___inv_5_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 182/b6 ___inv_6_____, 183/b7 ___inv_7_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 184/b8 ___inv_8_____, 185/b9 ___inv_9_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 186/ba ___inv_:_____, 187/bb ___inv_;_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 188/bc ___inv_<_____, 189/bd ___inv_=_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 190/be ___inv_>_____, 191/bf ___inv_?_____
+ ct_mix CT_NONE_IDX, CT_UPPER_XDIGIT_IDX ; 192/c0 ___inv_@_____, 193/c1 ___inv_A_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_XDIGIT_IDX ; 194/c2 ___inv_B_____, 195/c3 ___inv_C_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_XDIGIT_IDX ; 196/c4 ___inv_D_____, 197/c5 ___inv_E_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_IDX ; 198/c6 ___inv_F_____,199/c7 ___inv_G_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 200/c8 ___inv_H_____, 201/c9 ___inv_I_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 202/ca ___inv_J_____, 203/cb ___inv_K_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 204/cc ___inv_L_____, 205/cd ___inv_M_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 206/ce ___inv_N_____, 207/cf ___inv_O_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 208/d0 ___inv_P_____, 209/d1 ___inv_Q_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 210/d2 ___inv_R_____, 211/d3 ___inv_S_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 212/d4 ___inv_T_____, 213/d5 ___inv_U_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 214/d6 ___inv_V_____, 215/d7 ___inv_W_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 216/d8 ___inv_X_____, 217/d9 ___inv_Y_____
+ ct_mix CT_UPPER_IDX, CT_NONE_IDX ; 218/da ___inv_Z_____, 219/db ___inv_[_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 220/dc ___inv_\_____, 221/dd ___inv_]_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 222/de ___inv_^_____, 223/df _inv_UNDRLIN_
+ ct_mix CT_NONE_IDX, CT_LOWER_XDIGIT_IDX ; 224/e0 _inv_diamond_, 225/e1 ___inv_a_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_XDIGIT_IDX ; 226/e2 ___inv_b_____, 227/e3 ___inv_c_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_XDIGIT_IDX ; 228/e4 ___inv_d_____, 229/e5 ___inv_e_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_IDX ; 230/e6 ___inv_f_____, 231/e7 ___inv_g_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 232/e8 ___inv_h_____, 233/e9 ___inv_i_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 234/ea ___inv_j_____, 235/eb ___inv_k_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 236/ec ___inv_l_____, 237/ed ___inv_m_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 238/ee ___inv_n_____, 239/ef ___inv_o_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 240/f0 ___inv_p_____, 241/f1 ___inv_q_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 242/f2 ___inv_r_____, 243/f3 ___inv_s_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 244/f4 ___inv_t_____, 245/f5 ___inv_u_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 246/f6 ___inv_v_____, 247/f7 ___inv_w_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 248/f8 ___inv_x_____, 249/f9 ___inv_y_____
+ ct_mix CT_LOWER_IDX, CT_NONE_IDX ; 250/fa ___inv_z_____, 251/fb __inv_spade__
+ ct_mix CT_NONE_IDX, CT_CTRL_IDX ; 252/fc __inv_v_line_, 253/fd ____BEEP_____
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 254/fe ____DELBS____, 255/ff ___INSERT____
diff --git a/libsrc/atari2600/ctype.s b/libsrc/atari2600/ctype.s
index 1892554f..1301965e 100644
--- a/libsrc/atari2600/ctype.s
+++ b/libsrc/atari2600/ctype.s
@@ -1,162 +1,5 @@
-;
-; Ullrich von Bassewitz, 2003-10-10
-;
; Character specification table.
;
+; uses the "common" definition
- .include "ctype.inc"
-
-; The tables are readonly, put them into the rodata segment
-
-.rodata
-
-; The following 256 byte wide table specifies attributes for the isxxx type
-; of functions. Doing it by a table means some overhead in space, but it
-; has major advantages:
-;
-; * It is fast. If it weren't for the slow parameter passing of cc65, one
-; could even define macros for the isxxx functions (this is usually
-; done on other platforms).
-;
-; * It is highly portable. The only unportable part is the table itself,
-; all real code goes into the common library.
-;
-; * We save some code in the isxxx functions.
-
-
-__ctype:
- .byte CT_CTRL ; 0/00 ___ctrl_@___
- .byte CT_CTRL ; 1/01 ___ctrl_A___
- .byte CT_CTRL ; 2/02 ___ctrl_B___
- .byte CT_CTRL ; 3/03 ___ctrl_C___
- .byte CT_CTRL ; 4/04 ___ctrl_D___
- .byte CT_CTRL ; 5/05 ___ctrl_E___
- .byte CT_CTRL ; 6/06 ___ctrl_F___
- .byte CT_CTRL ; 7/07 ___ctrl_G___
- .byte CT_CTRL ; 8/08 ___ctrl_H___
- .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB
- ; 9/09 ___ctrl_I___
- .byte CT_CTRL | CT_OTHER_WS ; 10/0a ___ctrl_J___
- .byte CT_CTRL | CT_OTHER_WS ; 11/0b ___ctrl_K___
- .byte CT_CTRL | CT_OTHER_WS ; 12/0c ___ctrl_L___
- .byte CT_CTRL | CT_OTHER_WS ; 13/0d ___ctrl_M___
- .byte CT_CTRL ; 14/0e ___ctrl_N___
- .byte CT_CTRL ; 15/0f ___ctrl_O___
- .byte CT_CTRL ; 16/10 ___ctrl_P___
- .byte CT_CTRL ; 17/11 ___ctrl_Q___
- .byte CT_CTRL ; 18/12 ___ctrl_R___
- .byte CT_CTRL ; 19/13 ___ctrl_S___
- .byte CT_CTRL ; 20/14 ___ctrl_T___
- .byte CT_CTRL ; 21/15 ___ctrl_U___
- .byte CT_CTRL ; 22/16 ___ctrl_V___
- .byte CT_CTRL ; 23/17 ___ctrl_W___
- .byte CT_CTRL ; 24/18 ___ctrl_X___
- .byte CT_CTRL ; 25/19 ___ctrl_Y___
- .byte CT_CTRL ; 26/1a ___ctrl_Z___
- .byte CT_CTRL ; 27/1b ___ctrl_[___
- .byte CT_CTRL ; 28/1c ___ctrl_\___
- .byte CT_CTRL ; 29/1d ___ctrl_]___
- .byte CT_CTRL ; 30/1e ___ctrl_^___
- .byte CT_CTRL ; 31/1f ___ctrl_____
- .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___
- .byte CT_NONE ; 33/21 _____!_____
- .byte CT_NONE ; 34/22 _____"_____
- .byte CT_NONE ; 35/23 _____#_____
- .byte CT_NONE ; 36/24 _____$_____
- .byte CT_NONE ; 37/25 _____%_____
- .byte CT_NONE ; 38/26 _____&_____
- .byte CT_NONE ; 39/27 _____'_____
- .byte CT_NONE ; 40/28 _____(_____
- .byte CT_NONE ; 41/29 _____)_____
- .byte CT_NONE ; 42/2a _____*_____
- .byte CT_NONE ; 43/2b _____+_____
- .byte CT_NONE ; 44/2c _____,_____
- .byte CT_NONE ; 45/2d _____-_____
- .byte CT_NONE ; 46/2e _____._____
- .byte CT_NONE ; 47/2f _____/_____
- .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____
- .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____
- .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____
- .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____
- .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____
- .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____
- .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____
- .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____
- .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____
- .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____
- .byte CT_NONE ; 58/3a _____:_____
- .byte CT_NONE ; 59/3b _____;_____
- .byte CT_NONE ; 60/3c _____<_____
- .byte CT_NONE ; 61/3d _____=_____
- .byte CT_NONE ; 62/3e _____>_____
- .byte CT_NONE ; 63/3f _____?_____
-
- .byte CT_NONE ; 64/40 _____@_____
- .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____
- .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____
- .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____
- .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____
- .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____
- .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____
- .byte CT_UPPER ; 71/47 _____G_____
- .byte CT_UPPER ; 72/48 _____H_____
- .byte CT_UPPER ; 73/49 _____I_____
- .byte CT_UPPER ; 74/4a _____J_____
- .byte CT_UPPER ; 75/4b _____K_____
- .byte CT_UPPER ; 76/4c _____L_____
- .byte CT_UPPER ; 77/4d _____M_____
- .byte CT_UPPER ; 78/4e _____N_____
- .byte CT_UPPER ; 79/4f _____O_____
- .byte CT_UPPER ; 80/50 _____P_____
- .byte CT_UPPER ; 81/51 _____Q_____
- .byte CT_UPPER ; 82/52 _____R_____
- .byte CT_UPPER ; 83/53 _____S_____
- .byte CT_UPPER ; 84/54 _____T_____
- .byte CT_UPPER ; 85/55 _____U_____
- .byte CT_UPPER ; 86/56 _____V_____
- .byte CT_UPPER ; 87/57 _____W_____
- .byte CT_UPPER ; 88/58 _____X_____
- .byte CT_UPPER ; 89/59 _____Y_____
- .byte CT_UPPER ; 90/5a _____Z_____
- .byte CT_NONE ; 91/5b _____[_____
- .byte CT_NONE ; 92/5c _____\_____
- .byte CT_NONE ; 93/5d _____]_____
- .byte CT_NONE ; 94/5e _____^_____
- .byte CT_NONE ; 95/5f _UNDERLINE_
- .byte CT_NONE ; 96/60 ___grave___
- .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____
- .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____
- .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____
- .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____
- .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____
- .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____
- .byte CT_LOWER ; 103/67 _____g_____
- .byte CT_LOWER ; 104/68 _____h_____
- .byte CT_LOWER ; 105/69 _____i_____
- .byte CT_LOWER ; 106/6a _____j_____
- .byte CT_LOWER ; 107/6b _____k_____
- .byte CT_LOWER ; 108/6c _____l_____
- .byte CT_LOWER ; 109/6d _____m_____
- .byte CT_LOWER ; 110/6e _____n_____
- .byte CT_LOWER ; 111/6f _____o_____
- .byte CT_LOWER ; 112/70 _____p_____
- .byte CT_LOWER ; 113/71 _____q_____
- .byte CT_LOWER ; 114/72 _____r_____
- .byte CT_LOWER ; 115/73 _____s_____
- .byte CT_LOWER ; 116/74 _____t_____
- .byte CT_LOWER ; 117/75 _____u_____
- .byte CT_LOWER ; 118/76 _____v_____
- .byte CT_LOWER ; 119/77 _____w_____
- .byte CT_LOWER ; 120/78 _____x_____
- .byte CT_LOWER ; 121/79 _____y_____
- .byte CT_LOWER ; 122/7a _____z_____
- .byte CT_NONE ; 123/7b _____{_____
- .byte CT_NONE ; 124/7c _____|_____
- .byte CT_NONE ; 125/7d _____}_____
- .byte CT_NONE ; 126/7e _____~_____
- .byte CT_OTHER_WS ; 127/7f ____DEL____
-
- .res 128, CT_NONE ; 128-255
-
-
-
+ .include "ctype_common.inc"
diff --git a/libsrc/atmos/ctype.s b/libsrc/atmos/ctype.s
index 79edafbb..3c3d7be5 100644
--- a/libsrc/atmos/ctype.s
+++ b/libsrc/atmos/ctype.s
@@ -1,299 +1,155 @@
+; ctype.s
;
-; Ullrich von Bassewitz, 2003-04-13
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
;
-; Character specification table.
+; https://github.com/cc65/cc65
;
+; See "LICENSE" file for legal information.
+;
+; ATMOS character specification table.
+;
+
+ .include "ctypetable.inc"
+ .export __ctypeIdx
; The tables are readonly, put them into the rodata segment
.rodata
-; The following 256 byte wide table specifies attributes for the isxxx type
-; of functions. Doing it by a table means some overhead in space, but it
-; has major advantages:
-;
-; * It is fast. If it were'nt for the slow parameter passing of cc65, one
-; could even define macros for the isxxx functions (this is usually
-; done on other platforms).
-;
-; * It is highly portable. The only unportable part is the table itself,
-; all real code goes into the common library.
-;
-; * We save some code in the isxxx functions.
-;
-;
-; Bit assignments:
-;
-; 0 - Lower case char
-; 1 - Upper case char
-; 2 - Numeric digit
-; 3 - Hex digit (both, lower and upper)
-; 4 - Control character
-; 5 - The space character itself
-; 6 - Other whitespace (that is: '\f', '\n', '\r', '\t' and '\v')
-; 7 - Space or tab character
-
- .export __ctype
+__ctypeIdx:
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 0/00 ___ctrl_@___, 1/01 ___ctrl_A___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 2/02 ___ctrl_B___, 3/03 ___ctrl_C___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 4/04 ___ctrl_D___, 5/05 ___ctrl_E___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 6/06 ___ctrl_F___, 7/07 ___ctrl_G___
+ ct_mix CT_CTRL_IDX, CT_CTRL_WS_SPACETAB_IDX ; 8/08 ___ctrl_H___, 9/09 ___ctrl_I___
+ ct_mix CT_CTRL_WS_IDX, CT_CTRL_WS_IDX ; 10/0a ___ctrl_J___, 11/0b ___ctrl_K___
+ ct_mix CT_CTRL_WS_IDX, CT_CTRL_WS_IDX ; 12/0c ___ctrl_L___, 13/0d ___ctrl_M___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 14/0e ___ctrl_N___, 15/0f ___ctrl_O___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 16/10 ___ctrl_P___, 17/11 ___ctrl_Q___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 18/12 ___ctrl_R___, 19/13 ___ctrl_S___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 20/14 ___ctrl_T___, 21/15 ___ctrl_U___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 22/16 ___ctrl_V___, 23/17 ___ctrl_W___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 24/18 ___ctrl_X___, 25/19 ___ctrl_Y___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 26/1a ___ctrl_Z___, 27/1b ___ctrl_[___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 28/1c ___ctrl_\___, 29/1d ___ctrl_]___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 30/1e ___ctrl_^___, 31/1f ___ctrl_____
-__ctype:
- .byte $10 ; 0/00 ___ctrl_@___
- .byte $10 ; 1/01 ___ctrl_A___
- .byte $10 ; 2/02 ___ctrl_B___
- .byte $10 ; 3/03 ___ctrl_C___
- .byte $10 ; 4/04 ___ctrl_D___
- .byte $10 ; 5/05 ___ctrl_E___
- .byte $10 ; 6/06 ___ctrl_F___
- .byte $10 ; 7/07 ___ctrl_G___
- .byte $10 ; 8/08 ___ctrl_H___
- .byte $D0 ; 9/09 ___ctrl_I___
- .byte $50 ; 10/0a ___ctrl_J___
- .byte $50 ; 11/0b ___ctrl_K___
- .byte $50 ; 12/0c ___ctrl_L___
- .byte $50 ; 13/0d ___ctrl_M___
- .byte $10 ; 14/0e ___ctrl_N___
- .byte $10 ; 15/0f ___ctrl_O___
- .byte $10 ; 16/10 ___ctrl_P___
- .byte $10 ; 17/11 ___ctrl_Q___
- .byte $10 ; 18/12 ___ctrl_R___
- .byte $10 ; 19/13 ___ctrl_S___
- .byte $10 ; 20/14 ___ctrl_T___
- .byte $10 ; 21/15 ___ctrl_U___
- .byte $10 ; 22/16 ___ctrl_V___
- .byte $10 ; 23/17 ___ctrl_W___
- .byte $10 ; 24/18 ___ctrl_X___
- .byte $10 ; 25/19 ___ctrl_Y___
- .byte $10 ; 26/1a ___ctrl_Z___
- .byte $10 ; 27/1b ___ctrl_[___
- .byte $10 ; 28/1c ___ctrl_\___
- .byte $10 ; 29/1d ___ctrl_]___
- .byte $10 ; 30/1e ___ctrl_^___
- .byte $10 ; 31/1f ___ctrl_____
- .byte $A0 ; 32/20 ___SPACE___
- .byte $00 ; 33/21 _____!_____
- .byte $00 ; 34/22 _____"_____
- .byte $00 ; 35/23 _____#_____
- .byte $00 ; 36/24 _____$_____
- .byte $00 ; 37/25 _____%_____
- .byte $00 ; 38/26 _____&_____
- .byte $00 ; 39/27 _____'_____
- .byte $00 ; 40/28 _____(_____
- .byte $00 ; 41/29 _____)_____
- .byte $00 ; 42/2a _____*_____
- .byte $00 ; 43/2b _____+_____
- .byte $00 ; 44/2c _____,_____
- .byte $00 ; 45/2d _____-_____
- .byte $00 ; 46/2e _____._____
- .byte $00 ; 47/2f _____/_____
- .byte $0C ; 48/30 _____0_____
- .byte $0C ; 49/31 _____1_____
- .byte $0C ; 50/32 _____2_____
- .byte $0C ; 51/33 _____3_____
- .byte $0C ; 52/34 _____4_____
- .byte $0C ; 53/35 _____5_____
- .byte $0C ; 54/36 _____6_____
- .byte $0C ; 55/37 _____7_____
- .byte $0C ; 56/38 _____8_____
- .byte $0C ; 57/39 _____9_____
- .byte $00 ; 58/3a _____:_____
- .byte $00 ; 59/3b _____;_____
- .byte $00 ; 60/3c _____<_____
- .byte $00 ; 61/3d _____=_____
- .byte $00 ; 62/3e _____>_____
- .byte $00 ; 63/3f _____?_____
+ ct_mix CT_SPACE_SPACETAB_IDX, CT_NONE_IDX ; 32/20 ___SPACE___, 33/21 _____!_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 34/22 _____"_____, 35/23 _____#_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 36/24 _____$_____, 37/25 _____%_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 38/26 _____&_____, 39/27 _____'_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 40/28 _____(_____, 41/29 _____)_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 42/2a _____*_____, 43/2b _____+_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 44/2c _____,_____, 45/2d _____-_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 46/2e _____._____, 47/2f _____/_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 48/30 _____0_____, 49/31 _____1_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 50/32 _____2_____, 51/33 _____3_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 52/34 _____4_____, 53/35 _____5_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 54/36 _____6_____, 55/37 _____7_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 56/38 _____8_____, 57/39 _____9_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 58/3a _____:_____, 59/3b _____;_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 60/3c _____<_____, 61/3d _____=_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 62/3e _____>_____, 63/3f _____?_____
- .byte $00 ; 64/40 _____@_____
- .byte $0A ; 65/41 _____A_____
- .byte $0A ; 66/42 _____B_____
- .byte $0A ; 67/43 _____C_____
- .byte $0A ; 68/44 _____D_____
- .byte $0A ; 69/45 _____E_____
- .byte $0A ; 70/46 _____F_____
- .byte $02 ; 71/47 _____G_____
- .byte $02 ; 72/48 _____H_____
- .byte $02 ; 73/49 _____I_____
- .byte $02 ; 74/4a _____J_____
- .byte $02 ; 75/4b _____K_____
- .byte $02 ; 76/4c _____L_____
- .byte $02 ; 77/4d _____M_____
- .byte $02 ; 78/4e _____N_____
- .byte $02 ; 79/4f _____O_____
- .byte $02 ; 80/50 _____P_____
- .byte $02 ; 81/51 _____Q_____
- .byte $02 ; 82/52 _____R_____
- .byte $02 ; 83/53 _____S_____
- .byte $02 ; 84/54 _____T_____
- .byte $02 ; 85/55 _____U_____
- .byte $02 ; 86/56 _____V_____
- .byte $02 ; 87/57 _____W_____
- .byte $02 ; 88/58 _____X_____
- .byte $02 ; 89/59 _____Y_____
- .byte $02 ; 90/5a _____Z_____
- .byte $00 ; 91/5b _____[_____
- .byte $00 ; 92/5c _____\_____
- .byte $00 ; 93/5d _____]_____
- .byte $00 ; 94/5e _____^_____
- .byte $00 ; 95/5f _UNDERLINE_
- .byte $00 ; 96/60 ___grave___
- .byte $09 ; 97/61 _____a_____
- .byte $09 ; 98/62 _____b_____
- .byte $09 ; 99/63 _____c_____
- .byte $09 ; 100/64 _____d_____
- .byte $09 ; 101/65 _____e_____
- .byte $09 ; 102/66 _____f_____
- .byte $01 ; 103/67 _____g_____
- .byte $01 ; 104/68 _____h_____
- .byte $01 ; 105/69 _____i_____
- .byte $01 ; 106/6a _____j_____
- .byte $01 ; 107/6b _____k_____
- .byte $01 ; 108/6c _____l_____
- .byte $01 ; 109/6d _____m_____
- .byte $01 ; 110/6e _____n_____
- .byte $01 ; 111/6f _____o_____
- .byte $01 ; 112/70 _____p_____
- .byte $01 ; 113/71 _____q_____
- .byte $01 ; 114/72 _____r_____
- .byte $01 ; 115/73 _____s_____
- .byte $01 ; 116/74 _____t_____
- .byte $01 ; 117/75 _____u_____
- .byte $01 ; 118/76 _____v_____
- .byte $01 ; 119/77 _____w_____
- .byte $01 ; 120/78 _____x_____
- .byte $01 ; 121/79 _____y_____
- .byte $01 ; 122/7a _____z_____
- .byte $00 ; 123/7b _____{_____
- .byte $00 ; 124/7c _____|_____
- .byte $00 ; 125/7d _____}_____
- .byte $00 ; 126/7e _____~_____
- .byte $40 ; 127/7f ____DEL____
+ ct_mix CT_NONE_IDX, CT_UPPER_XDIGIT_IDX ; 64/40 _____@_____, 65/41 _____A_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_XDIGIT_IDX ; 66/42 _____B_____, 67/43 _____C_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_XDIGIT_IDX ; 68/44 _____D_____, 69/45 _____E_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_IDX ; 70/46 _____F_____, 71/47 _____G_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 72/48 _____H_____, 73/49 _____I_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 74/4a _____J_____, 75/4b _____K_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 76/4c _____L_____, 77/4d _____M_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 78/4e _____N_____, 79/4f _____O_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 80/50 _____P_____, 81/51 _____Q_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 82/52 _____R_____, 83/53 _____S_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 84/54 _____T_____, 85/55 _____U_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 86/56 _____V_____, 87/57 _____W_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 88/58 _____X_____, 89/59 _____Y_____
+ ct_mix CT_UPPER_IDX, CT_NONE_IDX ; 90/5a _____Z_____, 91/5b _____[_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 92/5c _____\_____, 93/5d _____]_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 94/5e _____^_____, 95/5f _UNDERLINE_
- .byte $00 ; 128/80 ___________
- .byte $00 ; 129/81 ___________
- .byte $00 ; 130/82 ___________
- .byte $00 ; 131/83 ___________
- .byte $00 ; 132/84 ___________
- .byte $00 ; 133/85 ___________
- .byte $00 ; 134/86 ___________
- .byte $00 ; 135/87 ___________
- .byte $00 ; 136/88 ___________
- .byte $00 ; 137/89 ___________
- .byte $00 ; 138/8a ___________
- .byte $00 ; 139/8b ___________
- .byte $00 ; 140/8c ___________
- .byte $00 ; 141/8d ___________
- .byte $00 ; 142/8e ___________
- .byte $00 ; 143/8f ___________
- .byte $00 ; 144/90 ___________
- .byte $00 ; 145/91 ___________
- .byte $00 ; 146/92 ___________
- .byte $10 ; 147/93 ___________
- .byte $00 ; 148/94 ___________
- .byte $00 ; 149/95 ___________
- .byte $00 ; 150/96 ___________
- .byte $00 ; 151/97 ___________
- .byte $00 ; 152/98 ___________
- .byte $00 ; 153/99 ___________
- .byte $00 ; 154/9a ___________
- .byte $00 ; 155/9b ___________
- .byte $00 ; 156/9c ___________
- .byte $00 ; 157/9d ___________
- .byte $00 ; 158/9e ___________
- .byte $00 ; 159/9f ___________
+ ct_mix CT_NONE_IDX, CT_LOWER_XDIGIT_IDX ; 96/60 ___grave___, 97/61 _____a_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_XDIGIT_IDX ; 98/62 _____b_____, 99/63 _____c_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_XDIGIT_IDX ; 100/64 _____d_____, 101/65 _____e_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_IDX ; 102/66 _____f_____, 103/67 _____g_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 104/68 _____h_____, 105/69 _____i_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 106/6a _____j_____, 107/6b _____k_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 108/6c _____l_____, 109/6d _____m_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 110/6e _____n_____, 111/6f _____o_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 112/70 _____p_____, 113/71 _____q_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 114/72 _____r_____, 115/73 _____s_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 116/74 _____t_____, 117/75 _____u_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 118/76 _____v_____, 119/77 _____w_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 120/78 _____x_____, 121/79 _____y_____
+ ct_mix CT_LOWER_IDX, CT_NONE_IDX ; 122/7a _____z_____, 123/7b _____{_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 124/7c _____|_____, 125/7d _____}_____
+ ct_mix CT_NONE_IDX, CT_WS_IDX ; 126/7e _____~_____, 127/7f ____DEL____
- .byte $00 ; 160/a0 ___________
- .byte $00 ; 161/a1 ___________
- .byte $00 ; 162/a2 ___________
- .byte $00 ; 163/a3 ___________
- .byte $00 ; 164/a4 ___________
- .byte $00 ; 165/a5 ___________
- .byte $00 ; 166/a6 ___________
- .byte $00 ; 167/a7 ___________
- .byte $00 ; 168/a8 ___________
- .byte $00 ; 169/a9 ___________
- .byte $00 ; 170/aa ___________
- .byte $00 ; 171/ab ___________
- .byte $00 ; 172/ac ___________
- .byte $00 ; 173/ad ___________
- .byte $00 ; 174/ae ___________
- .byte $00 ; 175/af ___________
- .byte $00 ; 176/b0 ___________
- .byte $00 ; 177/b1 ___________
- .byte $00 ; 178/b2 ___________
- .byte $00 ; 179/b3 ___________
- .byte $00 ; 180/b4 ___________
- .byte $00 ; 181/b5 ___________
- .byte $00 ; 182/b6 ___________
- .byte $00 ; 183/b7 ___________
- .byte $00 ; 184/b8 ___________
- .byte $00 ; 185/b9 ___________
- .byte $00 ; 186/ba ___________
- .byte $00 ; 187/bb ___________
- .byte $00 ; 188/bc ___________
- .byte $00 ; 189/bd ___________
- .byte $00 ; 190/be ___________
- .byte $00 ; 191/bf ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 128/80 ___________, 129/81 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 130/82 ___________, 131/83 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 132/84 ___________, 133/85 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 134/86 ___________, 135/87 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 136/88 ___________, 137/89 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 138/8a ___________, 139/8b ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 140/8c ___________, 141/8d ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 142/8e ___________, 143/8f ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 144/90 ___________, 145/91 ___________
+ ct_mix CT_NONE_IDX, CT_CTRL_IDX ; 146/92 ___________, 147/93 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 148/94 ___________, 149/95 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 150/96 ___________, 151/97 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 152/98 ___________, 153/99 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 154/9a ___________, 155/9b ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 156/9c ___________, 157/9d ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 158/9e ___________, 159/9f ___________
- .byte $02 ; 192/c0 ___________
- .byte $02 ; 193/c1 ___________
- .byte $02 ; 194/c2 ___________
- .byte $02 ; 195/c3 ___________
- .byte $02 ; 196/c4 ___________
- .byte $02 ; 197/c5 ___________
- .byte $02 ; 198/c6 ___________
- .byte $02 ; 199/c7 ___________
- .byte $02 ; 200/c8 ___________
- .byte $02 ; 201/c9 ___________
- .byte $02 ; 202/ca ___________
- .byte $02 ; 203/cb ___________
- .byte $02 ; 204/cc ___________
- .byte $02 ; 205/cd ___________
- .byte $02 ; 206/ce ___________
- .byte $02 ; 207/cf ___________
- .byte $02 ; 208/d0 ___________
- .byte $02 ; 209/d1 ___________
- .byte $02 ; 210/d2 ___________
- .byte $02 ; 211/d3 ___________
- .byte $02 ; 212/d4 ___________
- .byte $02 ; 213/d5 ___________
- .byte $02 ; 214/d6 ___________
- .byte $02 ; 215/d7 ___________
- .byte $02 ; 216/d8 ___________
- .byte $02 ; 217/d9 ___________
- .byte $02 ; 218/da ___________
- .byte $02 ; 219/db ___________
- .byte $02 ; 220/dc ___________
- .byte $02 ; 221/dd ___________
- .byte $02 ; 222/de ___________
- .byte $00 ; 223/df ___________
- .byte $01 ; 224/e0 ___________
- .byte $01 ; 225/e1 ___________
- .byte $01 ; 226/e2 ___________
- .byte $01 ; 227/e3 ___________
- .byte $01 ; 228/e4 ___________
- .byte $01 ; 229/e5 ___________
- .byte $01 ; 230/e6 ___________
- .byte $01 ; 231/e7 ___________
- .byte $01 ; 232/e8 ___________
- .byte $01 ; 233/e9 ___________
- .byte $01 ; 234/ea ___________
- .byte $01 ; 235/eb ___________
- .byte $01 ; 236/ec ___________
- .byte $01 ; 237/ed ___________
- .byte $01 ; 238/ee ___________
- .byte $01 ; 239/ef ___________
- .byte $01 ; 240/f0 ___________
- .byte $01 ; 241/f1 ___________
- .byte $01 ; 242/f2 ___________
- .byte $01 ; 243/f3 ___________
- .byte $01 ; 244/f4 ___________
- .byte $01 ; 245/f5 ___________
- .byte $01 ; 246/f6 ___________
- .byte $01 ; 247/f7 ___________
- .byte $01 ; 248/f8 ___________
- .byte $01 ; 249/f9 ___________
- .byte $01 ; 250/fa ___________
- .byte $01 ; 251/fb ___________
- .byte $01 ; 252/fc ___________
- .byte $01 ; 253/fd ___________
- .byte $01 ; 254/fe ___________
- .byte $00 ; 255/ff ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 160/a0 ___________, 161/a1 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 162/a2 ___________, 163/a3 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 164/a4 ___________, 165/a5 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 166/a6 ___________, 167/a7 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 168/a8 ___________, 169/a9 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 170/aa ___________, 171/ab ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 172/ac ___________, 173/ad ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 174/ae ___________, 175/af ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 176/b0 ___________, 177/b1 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 178/b2 ___________, 179/b3 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 180/b4 ___________, 181/b5 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 182/b6 ___________, 183/b7 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 184/b8 ___________, 185/b9 ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 186/ba ___________, 187/bb ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 188/bc ___________, 189/bd ___________
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 190/be ___________, 191/bf ___________
+
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 192/c0 ___________, 193/c1 ___________
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 194/c2 ___________, 195/c3 ___________
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 196/c4 ___________, 197/c5 ___________
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 198/c6 ___________, 199/c7 ___________
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 200/c8 ___________, 201/c9 ___________
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 202/ca ___________, 203/cb ___________
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 204/cc ___________, 205/cd ___________
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 206/ce ___________, 207/cf ___________
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 208/d0 ___________, 209/d1 ___________
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 210/d2 ___________, 211/d3 ___________
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 212/d4 ___________, 213/d5 ___________
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 214/d6 ___________, 215/d7 ___________
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 216/d8 ___________, 217/d9 ___________
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 218/da ___________, 219/db ___________
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 220/dc ___________, 221/dd ___________
+ ct_mix CT_UPPER_IDX, CT_NONE_IDX ; 222/de ___________, 223/df ___________
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 224/e0 ___________, 225/e1 ___________
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 226/e2 ___________, 227/e3 ___________
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 228/e4 ___________, 229/e5 ___________
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 230/e6 ___________, 231/e7 ___________
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 232/e8 ___________, 233/e9 ___________
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 234/ea ___________, 235/eb ___________
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 236/ec ___________, 237/ed ___________
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 238/ee ___________, 239/ef ___________
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 240/f0 ___________, 241/f1 ___________
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 242/f2 ___________, 243/f3 ___________
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 244/f4 ___________, 245/f5 ___________
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 246/f6 ___________, 247/f7 ___________
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 248/f8 ___________, 249/f9 ___________
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 250/fa ___________, 251/fb ___________
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 252/fc ___________, 253/fd ___________
+ ct_mix CT_LOWER_IDX, CT_NONE_IDX ; 254/fe ___________, 255/ff ___________
diff --git a/libsrc/cbm/ctype.s b/libsrc/cbm/ctype.s
index ba096bb1..d0943b12 100644
--- a/libsrc/cbm/ctype.s
+++ b/libsrc/cbm/ctype.s
@@ -1,289 +1,156 @@
+; ctype.s
;
-; Character specification table.
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
;
-; Ullrich von Bassewitz, 02.06.1998
-; 2003-05-02, Greg King
+; https://github.com/cc65/cc65
;
-
-; The following 256-byte-wide table specifies attributes for the isxxx type
-; of functions. Doing it by a table means some overhead in space, but it
-; has major advantages:
-;
-; * It is fast. If it weren't for the slow parameter-passing of cc65,
-; one even could define C-language macroes for the isxxx functions
-; (as it usually is done, on other platforms).
+; See "LICENSE" file for legal information.
;
-; * It is highly portable. The only unportable part is the table itself;
-; all real code goes into the common library.
+; CBM character specification table.
;
-; * We save some code in the isxxx functions.
-
; This table is taken from Craig S. Bruce's technical docs. for the ACE OS.
- .include "ctype.inc"
+ .include "ctypetable.inc"
+ .export __ctypeIdx
+
+; The tables are readonly, put them into the rodata segment
+
+.rodata
+
+__ctypeIdx:
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 0/00 ___rvs_@___, 1/01 ___rvs_a___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 2/02 ___rvs_b___, 3/03 ___rvs_c___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 4/04 ___rvs_d___, 5/05 ___rvs_e___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 6/06 ___rvs_f___, 7/07 _BEL/rvs_g_
+ ct_mix CT_CTRL_IDX, CT_CTRL_WS_SPACETAB_IDX ; 8/08 ___rvs_h___, 9/09 _TAB/rvs_i_
+ ct_mix CT_CTRL_WS_IDX, CT_CTRL_IDX ; 10/0a _BOL/rvs_j_, 11/0b ___rvs_k___
+ ct_mix CT_CTRL_IDX, CT_CTRL_WS_IDX ; 12/0c ___rvs_l___, 13/0d _CR_/rvs_m_
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 14/0e ___rvs_n___, 15/0f ___rvs_o___
+ ct_mix CT_CTRL_IDX, CT_CTRL_WS_IDX ; 16/10 ___rvs_p___, 17/11 _VT_/rvs_q_
+ ct_mix CT_CTRL_IDX, CT_CTRL_WS_IDX ; 18/12 ___rvs_r___, 19/13 HOME/rvs_s_
+ ct_mix CT_CTRL_WS_IDX, CT_CTRL_IDX ; 20/14 _BS_/rvs_t_, 21/15 ___rvs_u___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 22/16 ___rvs_v___, 23/17 ___rvs_w___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 24/18 ___rvs_x___, 25/19 ___rvs_y___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 26/1a ___rvs_z___, 27/1b ___rvs_[___
+ ct_mix CT_CTRL_IDX, CT_CTRL_WS_IDX ; 28/1c ___rvs_\___, 29/1d cursr-right
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 30/1e ___rvs_^___, 31/1f _rvs_under_
-; The table is read-only, put it into the RODATA segment.
+ ct_mix CT_SPACE_SPACETAB_IDX, CT_NONE_IDX ; 32/20 ___SPACE___, 33/21 _____!_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 34/22 _____"_____, 35/23 _____#_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 36/24 _____$_____, 37/25 _____%_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 38/26 _____&_____, 39/27 _____'_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 40/28 _____(_____, 41/29 _____)_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 42/2a _____*_____, 43/2b _____+_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 44/2c _____,_____, 45/2d _____-_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 46/2e _____._____, 47/2f _____/_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 48/30 _____0_____, 49/31 _____1_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 50/32 _____2_____, 51/33 _____3_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 52/34 _____4_____, 53/35 _____5_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 54/36 _____6_____, 55/37 _____7_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 56/38 _____8_____, 57/39 _____9_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 58/3a _____:_____, 59/3b _____;_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 60/3c _____<_____, 61/3d _____=_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 62/3e _____>_____, 63/3f _____?_____
- .rodata
+ ct_mix CT_NONE_IDX, CT_LOWER_XDIGIT_IDX ; 64/40 _____@_____, 65/41 _____a_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_XDIGIT_IDX ; 66/42 _____b_____, 67/43 _____c_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_XDIGIT_IDX ; 68/44 _____d_____, 69/45 _____e_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_IDX ; 70/46 _____f_____, 71/47 _____g_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 72/48 _____h_____, 73/49 _____i_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 74/4a _____j_____, 75/4b _____k_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 76/4c _____l_____, 77/4d _____m_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 78/4e _____n_____, 79/4f _____o_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 80/50 _____p_____, 81/51 _____q_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 82/52 _____r_____, 83/53 _____s_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 84/54 _____t_____, 85/55 _____u_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 86/56 _____v_____, 87/57 _____w_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 88/58 _____x_____, 89/59 _____y_____
+ ct_mix CT_LOWER_IDX, CT_NONE_IDX ; 90/5a _____z_____, 91/5b _____[_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 92/5c _____\_____, 93/5d _____]_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 94/5e _____^_____, 95/5f _UNDERLINE_
-__ctype:
- .byte CT_CTRL ; 0/00 ___rvs_@___
- .byte CT_CTRL ; 1/01 ___rvs_a___
- .byte CT_CTRL ; 2/02 ___rvs_b___
- .byte CT_CTRL ; 3/03 ___rvs_c___
- .byte CT_CTRL ; 4/04 ___rvs_d___
- .byte CT_CTRL ; 5/05 ___rvs_e___
- .byte CT_CTRL ; 6/06 ___rvs_f___
- .byte CT_CTRL ; 7/07 _BEL/rvs_g_
- .byte CT_CTRL ; 8/08 ___rvs_h___
- .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB ; 9/09 _TAB/rvs_i_
- .byte CT_CTRL | CT_OTHER_WS ; 10/0a _BOL/rvs_j_
- .byte CT_CTRL ; 11/0b ___rvs_k___
- .byte CT_CTRL ; 12/0c ___rvs_l___
- .byte CT_CTRL | CT_OTHER_WS ; 13/0d _CR_/rvs_m_
- .byte CT_CTRL ; 14/0e ___rvs_n___
- .byte CT_CTRL ; 15/0f ___rvs_o___
- .byte CT_CTRL ; 16/10 ___rvs_p___
- .byte CT_CTRL | CT_OTHER_WS ; 17/11 _VT_/rvs_q_
- .byte CT_CTRL ; 18/12 ___rvs_r___
- .byte CT_CTRL | CT_OTHER_WS ; 19/13 HOME/rvs_s_
- .byte CT_CTRL | CT_OTHER_WS ; 20/14 _BS_/rvs_t_
- .byte CT_CTRL ; 21/15 ___rvs_u___
- .byte CT_CTRL ; 22/16 ___rvs_v___
- .byte CT_CTRL ; 23/17 ___rvs_w___
- .byte CT_CTRL ; 24/18 ___rvs_x___
- .byte CT_CTRL ; 25/19 ___rvs_y___
- .byte CT_CTRL ; 26/1a ___rvs_z___
- .byte CT_CTRL ; 27/1b ___rvs_[___
- .byte CT_CTRL ; 28/1c ___rvs_\___
- .byte CT_CTRL | CT_OTHER_WS ; 29/1d cursr-right
- .byte CT_CTRL ; 30/1e ___rvs_^___
- .byte CT_CTRL ; 31/1f _rvs_under_
- .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___
- .byte $00 ; 33/21 _____!_____
- .byte $00 ; 34/22 _____"_____
- .byte $00 ; 35/23 _____#_____
- .byte $00 ; 36/24 _____$_____
- .byte $00 ; 37/25 _____%_____
- .byte $00 ; 38/26 _____&_____
- .byte $00 ; 39/27 _____'_____
- .byte $00 ; 40/28 _____(_____
- .byte $00 ; 41/29 _____)_____
- .byte $00 ; 42/2a _____*_____
- .byte $00 ; 43/2b _____+_____
- .byte $00 ; 44/2c _____,_____
- .byte $00 ; 45/2d _____-_____
- .byte $00 ; 46/2e _____._____
- .byte $00 ; 47/2f _____/_____
- .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____
- .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____
- .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____
- .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____
- .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____
- .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____
- .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____
- .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____
- .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____
- .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____
- .byte $00 ; 58/3a _____:_____
- .byte $00 ; 59/3b _____;_____
- .byte $00 ; 60/3c _____<_____
- .byte $00 ; 61/3d _____=_____
- .byte $00 ; 62/3e _____>_____
- .byte $00 ; 63/3f _____?_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 96/60 _A`_grave__, 97/61 _A'_acute__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 98/62 _A^_circum_, 99/63 _A~_tilde__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 100/64 _A"_dieres_, 101/65 _A__ring___
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 102/66 _AE________, 103/67 _C,cedilla_
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 104/68 _E`_grave__, 105/69 _E'_acute__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 106/6a _E^_circum_, 107/6b _E"_dieres_
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 108/6c _I`_grave__, 109/6d _I'_acute__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 110/6e _I^_circum_, 111/6f _I"_dieres_
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 112/70 _D-_Eth_lr_, 113/71 _N~_tilde__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 114/72 _O`_grave__, 115/73 _O'_acute__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 116/74 _O^_circum_, 117/75 _O~_tilde__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 118/76 _O"_dieres_, 119/77 __multiply_
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 120/78 _O/_slash__, 121/79 _U`_grave__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 122/7a _U'_acute__, 123/7b _U^_circum_
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 124/7c _U"_dieres_, 125/7d _Y'_acute__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 126/7e _cap_thorn_, 127/7f _Es-sed_B__
- .byte $00 ; 64/40 _____@_____
- .byte CT_LOWER | CT_XDIGIT ; 65/41 _____a_____
- .byte CT_LOWER | CT_XDIGIT ; 66/42 _____b_____
- .byte CT_LOWER | CT_XDIGIT ; 67/43 _____c_____
- .byte CT_LOWER | CT_XDIGIT ; 68/44 _____d_____
- .byte CT_LOWER | CT_XDIGIT ; 69/45 _____e_____
- .byte CT_LOWER | CT_XDIGIT ; 70/46 _____f_____
- .byte CT_LOWER ; 71/47 _____g_____
- .byte CT_LOWER ; 72/48 _____h_____
- .byte CT_LOWER ; 73/49 _____i_____
- .byte CT_LOWER ; 74/4a _____j_____
- .byte CT_LOWER ; 75/4b _____k_____
- .byte CT_LOWER ; 76/4c _____l_____
- .byte CT_LOWER ; 77/4d _____m_____
- .byte CT_LOWER ; 78/4e _____n_____
- .byte CT_LOWER ; 79/4f _____o_____
- .byte CT_LOWER ; 80/50 _____p_____
- .byte CT_LOWER ; 81/51 _____q_____
- .byte CT_LOWER ; 82/52 _____r_____
- .byte CT_LOWER ; 83/53 _____s_____
- .byte CT_LOWER ; 84/54 _____t_____
- .byte CT_LOWER ; 85/55 _____u_____
- .byte CT_LOWER ; 86/56 _____v_____
- .byte CT_LOWER ; 87/57 _____w_____
- .byte CT_LOWER ; 88/58 _____x_____
- .byte CT_LOWER ; 89/59 _____y_____
- .byte CT_LOWER ; 90/5a _____z_____
- .byte $00 ; 91/5b _____[_____
- .byte $00 ; 92/5c _____\_____
- .byte $00 ; 93/5d _____]_____
- .byte $00 ; 94/5e _____^_____
- .byte $00 ; 95/5f _UNDERLINE_
- .byte $00 ; 96/60 _A`_grave__
- .byte $00 ; 97/61 _A'_acute__
- .byte $00 ; 98/62 _A^_circum_
- .byte $00 ; 99/63 _A~_tilde__
- .byte $00 ; 100/64 _A"_dieres_
- .byte $00 ; 101/65 _A__ring___
- .byte $00 ; 102/66 _AE________
- .byte $00 ; 103/67 _C,cedilla_
- .byte $00 ; 104/68 _E`_grave__
- .byte $00 ; 105/69 _E'_acute__
- .byte $00 ; 106/6a _E^_circum_
- .byte $00 ; 107/6b _E"_dieres_
- .byte $00 ; 108/6c _I`_grave__
- .byte $00 ; 109/6d _I'_acute__
- .byte $00 ; 110/6e _I^_circum_
- .byte $00 ; 111/6f _I"_dieres_
- .byte $00 ; 112/70 _D-_Eth_lr_
- .byte $00 ; 113/71 _N~_tilde__
- .byte $00 ; 114/72 _O`_grave__
- .byte $00 ; 115/73 _O'_acute__
- .byte $00 ; 116/74 _O^_circum_
- .byte $00 ; 117/75 _O~_tilde__
- .byte $00 ; 118/76 _O"_dieres_
- .byte $00 ; 119/77 __multiply_
- .byte $00 ; 120/78 _O/_slash__
- .byte $00 ; 121/79 _U`_grave__
- .byte $00 ; 122/7a _U'_acute__
- .byte $00 ; 123/7b _U^_circum_
- .byte $00 ; 124/7c _U"_dieres_
- .byte $00 ; 125/7d _Y'_acute__
- .byte $00 ; 126/7e _cap_thorn_
- .byte $00 ; 127/7f _Es-sed_B__
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 128/80 __bullet___, 129/81 __v_line___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 130/82 __h_line___, 131/83 ___cross___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 132/84 _tl_corner_, 133/85 _tr_corner_
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 134/86 _bl_corner_, 135/87 _br_corner_
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 136/88 ___l_tee___, 137/89 ___r_tee___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 138/8a ___t_tee___, 139/8b ___b_tee___
+ ct_mix CT_CTRL_IDX, CT_CTRL_WS_IDX ; 140/8c ___heart___, 141/8d _CR/diamond
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 142/8e ___club____, 143/8f ___spade___
+ ct_mix CT_CTRL_IDX, CT_CTRL_WS_IDX ; 144/90 _s_circle__, 145/91 _cursor-up_
+ ct_mix CT_CTRL_IDX, CT_CTRL_WS_IDX ; 146/92 ___pound___, 147/93 _CLS/check_
+ ct_mix CT_CTRL_WS_IDX, CT_CTRL_IDX ; 148/94 __INSert___, 149/95 ____+/-____
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 150/96 __divide___, 151/97 __degree___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 152/98 _c_checker_, 153/99 _f_checker_
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 154/9a _solid_sq__, 155/9b __cr_char__
+ ct_mix CT_CTRL_IDX, CT_CTRL_WS_IDX ; 156/9c _up_arrow__, 157/9d cursor-left
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 158/9e _left_arro_, 159/9f _right_arr_
- .byte CT_CTRL ; 128/80 __bullet___
- .byte CT_CTRL ; 129/81 __v_line___
- .byte CT_CTRL ; 130/82 __h_line___
- .byte CT_CTRL ; 131/83 ___cross___
- .byte CT_CTRL ; 132/84 _tl_corner_
- .byte CT_CTRL ; 133/85 _tr_corner_
- .byte CT_CTRL ; 134/86 _bl_corner_
- .byte CT_CTRL ; 135/87 _br_corner_
- .byte CT_CTRL ; 136/88 ___l_tee___
- .byte CT_CTRL ; 137/89 ___r_tee___
- .byte CT_CTRL ; 138/8a ___t_tee___
- .byte CT_CTRL ; 139/8b ___b_tee___
- .byte CT_CTRL ; 140/8c ___heart___
- .byte CT_CTRL | CT_OTHER_WS ; 141/8d _CR/diamond
- .byte CT_CTRL ; 142/8e ___club____
- .byte CT_CTRL ; 143/8f ___spade___
- .byte CT_CTRL ; 144/90 _s_circle__
- .byte CT_CTRL | CT_OTHER_WS ; 145/91 _cursor-up_
- .byte CT_CTRL ; 146/92 ___pound___
- .byte CT_CTRL | CT_OTHER_WS ; 147/93 _CLS/check_
- .byte CT_CTRL | CT_OTHER_WS ; 148/94 __INSert___
- .byte CT_CTRL ; 149/95 ____+/-____
- .byte CT_CTRL ; 150/96 __divide___
- .byte CT_CTRL ; 151/97 __degree___
- .byte CT_CTRL ; 152/98 _c_checker_
- .byte CT_CTRL ; 153/99 _f_checker_
- .byte CT_CTRL ; 154/9a _solid_sq__
- .byte CT_CTRL ; 155/9b __cr_char__
- .byte CT_CTRL ; 156/9c _up_arrow__
- .byte CT_CTRL | CT_OTHER_WS ; 157/9d cursor-left
- .byte CT_CTRL ; 158/9e _left_arro_
- .byte CT_CTRL ; 159/9f _right_arr_
- .byte CT_SPACE | CT_SPACE_TAB ; 160/a0 _req space_
- .byte $00 ; 161/a1 _!_invertd_
- .byte $00 ; 162/a2 ___cent____
- .byte $00 ; 163/a3 ___pound___
- .byte $00 ; 164/a4 __currency_
- .byte $00 ; 165/a5 ____yen____
- .byte $00 ; 166/a6 _|_broken__
- .byte $00 ; 167/a7 __section__
- .byte $00 ; 168/a8 __umulaut__
- .byte $00 ; 169/a9 _copyright_
- .byte $00 ; 170/aa __fem_ord__
- .byte $00 ; 171/ab _l_ang_quo_
- .byte $00 ; 172/ac ____not____
- .byte $00 ; 173/ad _syl_hyphn_
- .byte $00 ; 174/ae _registerd_
- .byte $00 ; 175/af _overline__
- .byte $00 ; 176/b0 __degrees__
- .byte $00 ; 177/b1 ____+/-____
- .byte $00 ; 178/b2 _2_supersc_
- .byte $00 ; 179/b3 _3_supersc_
- .byte $00 ; 180/b4 ___acute___
- .byte $00 ; 181/b5 ____mu_____
- .byte $00 ; 182/b6 _paragraph_
- .byte $00 ; 183/b7 __mid_dot__
- .byte $00 ; 184/b8 __cedilla__
- .byte $00 ; 185/b9 _1_supersc_
- .byte $00 ; 186/ba __mas_ord__
- .byte $00 ; 187/bb _r_ang_quo_
- .byte $00 ; 188/bc ____1/4____
- .byte $00 ; 189/bd ____1/2____
- .byte $00 ; 190/be ____3/4____
- .byte $00 ; 191/bf _?_invertd_
+ ct_mix CT_SPACE_SPACETAB_IDX, CT_NONE_IDX ; 160/a0 _req space_, 161/a1 _!_invertd_
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 162/a2 ___cent____, 163/a3 ___pound___
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 164/a4 __currency_, 165/a5 ____yen____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 166/a6 _|_broken__, 167/a7 __section__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 168/a8 __umulaut__, 169/a9 _copyright_
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 170/aa __fem_ord__, 171/ab _l_ang_quo_
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 172/ac ____not____, 173/ad _syl_hyphn_
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 174/ae _registerd_, 175/af _overline__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 176/b0 __degrees__, 177/b1 ____+/-____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 178/b2 _2_supersc_, 179/b3 _3_supersc_
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 180/b4 ___acute___, 181/b5 ____mu_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 182/b6 _paragraph_, 183/b7 __mid_dot__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 184/b8 __cedilla__, 185/b9 _1_supersc_
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 186/ba __mas_ord__, 187/bb _r_ang_quo_
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 188/bc ____1/4____, 189/bd ____1/2____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 190/be ____3/4____, 191/bf _?_invertd_
- .byte $00 ; 192/c0 _____`_____
- .byte CT_UPPER | CT_XDIGIT ; 193/c1 _____A_____
- .byte CT_UPPER | CT_XDIGIT ; 194/c2 _____B_____
- .byte CT_UPPER | CT_XDIGIT ; 195/c3 _____C_____
- .byte CT_UPPER | CT_XDIGIT ; 196/c4 _____D_____
- .byte CT_UPPER | CT_XDIGIT ; 197/c5 _____E_____
- .byte CT_UPPER | CT_XDIGIT ; 198/c6 _____F_____
- .byte CT_UPPER ; 199/c7 _____G_____
- .byte CT_UPPER ; 200/c8 _____H_____
- .byte CT_UPPER ; 201/c9 _____I_____
- .byte CT_UPPER ; 202/ca _____J_____
- .byte CT_UPPER ; 203/cb _____K_____
- .byte CT_UPPER ; 204/cc _____L_____
- .byte CT_UPPER ; 205/cd _____M_____
- .byte CT_UPPER ; 206/ce _____N_____
- .byte CT_UPPER ; 207/cf _____O_____
- .byte CT_UPPER ; 208/d0 _____P_____
- .byte CT_UPPER ; 209/d1 _____Q_____
- .byte CT_UPPER ; 210/d2 _____R_____
- .byte CT_UPPER ; 211/d3 _____S_____
- .byte CT_UPPER ; 212/d4 _____T_____
- .byte CT_UPPER ; 213/d5 _____U_____
- .byte CT_UPPER ; 214/d6 _____V_____
- .byte CT_UPPER ; 215/d7 _____W_____
- .byte CT_UPPER ; 216/d8 _____X_____
- .byte CT_UPPER ; 217/d9 _____Y_____
- .byte CT_UPPER ; 218/da _____Z_____
- .byte $00 ; 219/db _____{_____
- .byte $00 ; 220/dc _____|_____
- .byte $00 ; 221/dd _____}_____
- .byte $00 ; 222/de _____~_____
- .byte $00 ; 223/df ___HOUSE___
- .byte $00 ; 224/e0 _a`_grave__
- .byte $00 ; 225/e1 _a'_acute__
- .byte $00 ; 226/e2 _a^_circum_
- .byte $00 ; 227/e3 _a~_tilde__
- .byte $00 ; 228/e4 _a"_dieres_
- .byte $00 ; 229/e5 _a__ring___
- .byte $00 ; 230/e6 _ae________
- .byte $00 ; 231/e7 _c,cedilla_
- .byte $00 ; 232/e8 _e`_grave__
- .byte $00 ; 233/e9 _e'_acute__
- .byte $00 ; 234/ea _e^_circum_
- .byte $00 ; 235/eb _e"_dieres_
- .byte $00 ; 236/ec _i`_grave__
- .byte $00 ; 237/ed _i'_acute__
- .byte $00 ; 238/ee _i^_circum_
- .byte $00 ; 239/ef _i"_dieres_
- .byte $00 ; 240/f0 _o^x_Eth_s_
- .byte $00 ; 241/f1 _n~_tilda__
- .byte $00 ; 242/f2 _o`_grave__
- .byte $00 ; 243/f3 _o'_acute__
- .byte $00 ; 244/f4 _o^_circum_
- .byte $00 ; 245/f5 _o~_tilde__
- .byte $00 ; 246/f6 _o"_dieres_
- .byte $00 ; 247/f7 __divide___
- .byte $00 ; 248/f8 _o/_slash__
- .byte $00 ; 249/f9 _u`_grave__
- .byte $00 ; 250/fa _u'_acute__
- .byte $00 ; 251/fb _u^_circum_
- .byte $00 ; 252/fc _u"_dieres_
- .byte $00 ; 253/fd _y'_acute__
- .byte $00 ; 254/fe _sm_thorn__
- .byte $00 ; 255/ff _y"_dieres_
+ ct_mix CT_NONE_IDX, CT_UPPER_XDIGIT_IDX ; 192/c0 _____`_____, 193/c1 _____A_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_XDIGIT_IDX ; 194/c2 _____B_____, 195/c3 _____C_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_XDIGIT_IDX ; 196/c4 _____D_____, 197/c5 _____E_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_IDX ; 198/c6 _____F_____, 199/c7 _____G_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 200/c8 _____H_____, 201/c9 _____I_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 202/ca _____J_____, 203/cb _____K_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 204/cc _____L_____, 205/cd _____M_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 206/ce _____N_____, 207/cf _____O_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 208/d0 _____P_____, 209/d1 _____Q_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 210/d2 _____R_____, 211/d3 _____S_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 212/d4 _____T_____, 213/d5 _____U_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 214/d6 _____V_____, 215/d7 _____W_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 216/d8 _____X_____, 217/d9 _____Y_____
+ ct_mix CT_UPPER_IDX, CT_NONE_IDX ; 218/da _____Z_____, 219/db _____{_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 220/dc _____|_____, 221/dd _____}_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 222/de _____~_____, 223/df ___HOUSE___
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 224/e0 _a`_grave__, 225/e1 _a'_acute__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 226/e2 _a^_circum_, 227/e3 _a~_tilde__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 228/e4 _a"_dieres_, 229/e5 _a__ring___
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 230/e6 _ae________, 231/e7 _c,cedilla_
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 232/e8 _e`_grave__, 233/e9 _e'_acute__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 234/ea _e^_circum_, 235/eb _e"_dieres_
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 236/ec _i`_grave__, 237/ed _i'_acute__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 238/ee _i^_circum_, 239/ef _i"_dieres_
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 240/f0 _o^x_Eth_s_, 241/f1 _n~_tilda__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 242/f2 _o`_grave__, 243/f3 _o'_acute__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 244/f4 _o^_circum_, 245/f5 _o~_tilde__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 246/f6 _o"_dieres_, 247/f7 __divide___
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 248/f8 _o/_slash__, 249/f9 _u`_grave__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 250/fa _u'_acute__, 251/fb _u^_circum_
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 252/fc _u"_dieres_, 253/fd _y'_acute__
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 254/fe _sm_thorn__, 255/ff _y"_dieres_
diff --git a/libsrc/common/atoi.s b/libsrc/common/atoi.s
index cb598f71..8427be62 100644
--- a/libsrc/common/atoi.s
+++ b/libsrc/common/atoi.s
@@ -8,9 +8,8 @@
.export _atoi, _atol
.import negeax, __ctype
.importzp sreg, ptr1, ptr2, tmp1
-
+ .import ctype_preprocessor_no_check
.include "ctype.inc"
-
;
; Conversion routine (32 bit)
;
@@ -27,8 +26,9 @@ _atol: sta ptr1 ; Store s
; Skip whitespace
L1: lda (ptr1),y
- tax
- lda __ctype,x ; get character classification
+ ; get character classification
+ jsr ctype_preprocessor_no_check
+
and #CT_SPACE_TAB ; tab or space?
beq L2 ; jump if no
iny
@@ -36,10 +36,10 @@ L1: lda (ptr1),y
inc ptr1+1
bne L1 ; branch always
-; Check for a sign. The character is in X
+; Check for a sign. Refetch character, X is cleared by preprocessor
-L2: txa ; get char
- ldx #0 ; flag: positive
+L2: lda (ptr1),y ; get char
+ ; x=0 -> flag: positive
cmp #'+' ; ### portable?
beq L3
cmp #'-' ; ### portable?
@@ -54,9 +54,9 @@ L3: iny
L5: stx tmp1 ; remember sign flag
L6: lda (ptr1),y ; get next char
- tax
- lda __ctype,x ; get character classification
- and #$04 ; digit?
+ ; get character classification
+ jsr ctype_preprocessor_no_check
+ and #CT_DIGIT ; digit?
beq L8 ; done
; Multiply ptr2 (the converted value) by 10
@@ -91,7 +91,7 @@ L6: lda (ptr1),y ; get next char
; Get the character back and add it
- txa ; get char back
+ lda (ptr1),y ; fetch char again
sec
sbc #'0' ; make numeric value
clc
diff --git a/libsrc/common/ctype_preprocessor.s b/libsrc/common/ctype_preprocessor.s
new file mode 100644
index 00000000..1f33bd22
--- /dev/null
+++ b/libsrc/common/ctype_preprocessor.s
@@ -0,0 +1,50 @@
+; ctype_preprocessor.s
+;
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
+;
+; ctype_preprocessor(int c)
+;
+; converts a character to test via the is*-functions to the matching ctype-masks
+; If c is out of the 8-bit range, the function returns with carry set and accu cleared.
+; Return value is in accu and x has to be always clear when returning
+; (makes calling code shorter)!
+;
+; IMPORTANT: stricmp, strlower, strnicmp, strupper and atoi rely that Y is not changed
+; while calling this function!
+;
+
+ .export ctype_preprocessor
+ .export ctype_preprocessor_no_check
+ .import __ctype
+ .import __ctypeIdx
+
+ctype_preprocessor:
+ cpx #$00 ; char range ok?
+ bne SC ; branch if not
+ctype_preprocessor_no_check:
+ lsr a
+ tax
+ lda __ctypeIdx, x
+ bcc @lowerNibble
+@upperNibble:
+ lsr a
+ lsr a
+ lsr a
+ lsr a
+ clc ; remove out of bounds flag
+@lowerNibble:
+ and #%1111
+ tax
+ lda __ctype, x
+ ldx #0
+ rts
+
+SC: sec
+ lda #0
+ tax
+ rts
diff --git a/libsrc/common/isalnum.s b/libsrc/common/isalnum.s
index 33497a30..4f6a5e91 100644
--- a/libsrc/common/isalnum.s
+++ b/libsrc/common/isalnum.s
@@ -1,21 +1,21 @@
+; isalnum.s
;
-; Ullrich von Bassewitz, 02.06.1998
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
;
; int isalnum (int c);
;
.export _isalnum
.include "ctype.inc"
+ .import ctype_preprocessor
_isalnum:
- cpx #$00 ; Char range ok?
- bne @L1 ; Jump if no
- tay
- lda __ctype,y ; Get character classification
- and #CT_ALNUM ; Mask character/digit bits
- rts
-
-@L1: lda #$00 ; Return false
- tax
- rts
-
+ jsr ctype_preprocessor ; (clears always x)
+ bcs @L1 ; out of range? (everything already clear -> false)
+ and #CT_ALNUM ; mask character/digit bits
+@L1: rts
diff --git a/libsrc/common/isalpha.s b/libsrc/common/isalpha.s
index 2ab9bf26..a331722a 100644
--- a/libsrc/common/isalpha.s
+++ b/libsrc/common/isalpha.s
@@ -1,21 +1,21 @@
+; isalpha.s
;
-; Ullrich von Bassewitz, 02.06.1998
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
;
; int isalpha (int c);
;
.export _isalpha
.include "ctype.inc"
+ .import ctype_preprocessor
_isalpha:
- cpx #$00 ; Char range ok?
- bne @L1 ; Jump if no
- tay
- lda __ctype,y ; Get character classification
- and #CT_ALPHA ; Mask character bits
- rts
-
-@L1: lda #$00 ; Return false
- tax
- rts
-
+ jsr ctype_preprocessor ; (clears always x)
+ bcs @L1 ; out of range? (everything already clear -> false)
+ and #CT_ALPHA ; mask character bits
+@L1: rts
diff --git a/libsrc/common/isascii.s b/libsrc/common/isascii.s
new file mode 100644
index 00000000..dccfabaa
--- /dev/null
+++ b/libsrc/common/isascii.s
@@ -0,0 +1,27 @@
+; isascii.s
+;
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
+;
+; int isascii (int c);
+;
+
+ .export _isascii
+
+_isascii:
+ cpx #$00 ; Char range ok?
+ bne @L1 ; Jump if no
+
+ tay
+ bmi @L1
+
+ inx
+ rts
+
+@L1: lda #$00 ; Return false
+ tax
+ rts
diff --git a/libsrc/common/isblank.s b/libsrc/common/isblank.s
index 6babe885..5e0eafd7 100644
--- a/libsrc/common/isblank.s
+++ b/libsrc/common/isblank.s
@@ -1,5 +1,11 @@
+; isblank.s
;
-; Ullrich von Bassewitz, 02.06.1998
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
;
; int isblank (int c);
;
@@ -8,16 +14,10 @@
.export _isblank
.include "ctype.inc"
+ .import ctype_preprocessor
_isblank:
- cpx #$00 ; Char range ok?
- bne @L1 ; Jump if no
- tay
- lda __ctype,y ; Get character classification
- and #CT_SPACE_TAB ; Mask blank bit
- rts
-
-@L1: lda #$00 ; Return false
- tax
- rts
-
+ jsr ctype_preprocessor ; (clears always x)
+ bcs @L1 ; out of range? (everything already clear -> false)
+ and #CT_SPACE_TAB ; mask blank bit
+ @L1: rts
diff --git a/libsrc/common/iscntrl.s b/libsrc/common/iscntrl.s
index 72871645..f4bf0285 100644
--- a/libsrc/common/iscntrl.s
+++ b/libsrc/common/iscntrl.s
@@ -1,21 +1,21 @@
+; iscntrl.s
;
-; Ullrich von Bassewitz, 02.06.1998
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
;
; int iscntrl (int c);
;
.export _iscntrl
.include "ctype.inc"
+ .import ctype_preprocessor
_iscntrl:
- cpx #$00 ; Char range ok?
- bne @L1 ; Jump if no
- tay
- lda __ctype,y ; Get character classification
- and #CT_CTRL ; Mask control character bit
- rts
-
-@L1: lda #$00 ; Return false
- tax
- rts
-
+ jsr ctype_preprocessor ; (clears always x)
+ bcs @L1 ; out of range? (everything already clear -> false)
+ and #CT_CTRL ; mask control character bit
+@L1: rts
diff --git a/libsrc/common/isdigit.s b/libsrc/common/isdigit.s
index 2972c894..c0e8bb02 100644
--- a/libsrc/common/isdigit.s
+++ b/libsrc/common/isdigit.s
@@ -1,21 +1,21 @@
+; isdigit.s
;
-; Ullrich von Bassewitz, 02.06.1998
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
;
; int isdigit (int c);
;
.export _isdigit
.include "ctype.inc"
+ .import ctype_preprocessor
_isdigit:
- cpx #$00 ; Char range ok?
- bne @L1 ; Jump if no
- tay
- lda __ctype,y ; Get character classification
- and #CT_DIGIT ; Mask digit bit
- rts
-
-@L1: lda #$00 ; Return false
- tax
- rts
-
+ jsr ctype_preprocessor ; (clears always x)
+ bcs @L1 ; out of range? (everything already clear -> false)
+ and #CT_DIGIT ; mask digit bit
+ @L1: rts
diff --git a/libsrc/common/isgraph.s b/libsrc/common/isgraph.s
index bf94014e..575b05a6 100644
--- a/libsrc/common/isgraph.s
+++ b/libsrc/common/isgraph.s
@@ -1,25 +1,25 @@
+; isgraph.s
;
-; 1998-06-02, Ullrich von Bassewitz
-; 2014-09-10, Greg King
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
;
; int isgraph (int c);
;
.export _isgraph
.include "ctype.inc"
+ .import ctype_preprocessor
_isgraph:
- cpx #>$0000 ; Char range OK?
- bne @L1 ; Jump if no
- tay
- lda __ctype,y ; Get character classification
- and #CT_CTRL_SPACE ; Mask character bits
- cmp #1 ; If false, then set "borrow" flag
+ jsr ctype_preprocessor ; (clears always x)
+ bcs @L1 ; out of range? (everything already clear -> false)
+ and #CT_CTRL_SPACE ; mask character bits
+ cmp #1 ; if false, then set "borrow" flag
lda #0
- sbc #0 ; Invert logic
- rts ; Return NOT control and NOT space
-
-@L1: lda #<0 ; Return false
- tax
- rts
+ sbc #0 ; invert logic (return NOT control and NOT space)
+@L1: rts
diff --git a/libsrc/common/islower.s b/libsrc/common/islower.s
index 32e00fbd..62ae4164 100644
--- a/libsrc/common/islower.s
+++ b/libsrc/common/islower.s
@@ -1,21 +1,23 @@
+; islower.s
;
-; Ullrich von Bassewitz, 02.06.1998
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
;
; int islower (int c);
;
.export _islower
.include "ctype.inc"
+ .import ctype_preprocessor
_islower:
- cpx #$00 ; Char range ok?
- bne @L1 ; Jump if no
- tay
- lda __ctype,y ; Get character classification
- and #CT_LOWER ; Mask lower char bit
- rts
+ jsr ctype_preprocessor ; (clears always x)
+ bcs @L1 ; out of range? (everything already clear -> false)
+ and #CT_LOWER ; mask lower char bit
+@L1: rts
-@L1: lda #$00 ; Return false
- tax
- rts
diff --git a/libsrc/common/isprint.s b/libsrc/common/isprint.s
index 1511753f..cbe68c80 100644
--- a/libsrc/common/isprint.s
+++ b/libsrc/common/isprint.s
@@ -1,22 +1,22 @@
+; isprint.s
;
-; Ullrich von Bassewitz, 02.06.1998
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
;
; int isprint (int c);
;
.export _isprint
.include "ctype.inc"
+ .import ctype_preprocessor
_isprint:
- cpx #$00 ; Char range ok?
- bne @L1 ; Jump if no
- tay
- lda __ctype,y ; Get character classification
- eor #CT_CTRL ; NOT a control char
- and #CT_CTRL ; Mask control char bit
- rts
-
-@L1: lda #$00 ; Return false
- tax
- rts
-
+ jsr ctype_preprocessor ; (clears always x)
+ bcs @L1 ; out of range? (everything already clear -> false)
+ eor #CT_CTRL ; NOT a control char
+ and #CT_CTRL ; mask control char bit
+@L1: rts
diff --git a/libsrc/common/ispunct.s b/libsrc/common/ispunct.s
index 08753294..ad48fc53 100644
--- a/libsrc/common/ispunct.s
+++ b/libsrc/common/ispunct.s
@@ -1,25 +1,24 @@
+; ispunct.s
;
-; 1998-06-02, Ullrich von Bassewitz
-; 2014-09-10, Greg King
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
;
; int ispunct (int c);
;
.export _ispunct
.include "ctype.inc"
+ .import ctype_preprocessor
_ispunct:
- cpx #>$0000 ; Char range OK?
- bne @L1 ; Jump if no
- tay
- lda __ctype,y ; Get character classification
- and #CT_NOT_PUNCT ; Mask relevant bits
- cmp #1 ; If false, then set "borrow" flag
+ jsr ctype_preprocessor ; (clears always x)
+ bcs @L1 ; out of range? (everything already clear -> false)
+ and #CT_NOT_PUNCT ; mask relevant bits
+ cmp #1 ; if false, then set "borrow" flag
lda #0
- sbc #0 ; Invert logic
- rts ; Return NOT (space | control | digit | alpha)
-
-@L1: lda #<0 ; Return false
- tax
- rts
-
+ sbc #0 ; invert logic (return NOT (space | control | digit | alpha))
+@L1: rts
diff --git a/libsrc/common/isspace.s b/libsrc/common/isspace.s
index 64849f7f..272acac0 100644
--- a/libsrc/common/isspace.s
+++ b/libsrc/common/isspace.s
@@ -1,21 +1,21 @@
+; isspace.s
;
-; Ullrich von Bassewitz, 02.06.1998
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
;
; int isspace (int c);
;
.export _isspace
.include "ctype.inc"
+ .import ctype_preprocessor
_isspace:
- cpx #$00 ; Char range ok?
- bne @L1 ; Jump if no
- tay
- lda __ctype,y ; Get character classification
- and #(CT_SPACE | CT_OTHER_WS) ; Mask space bits
- rts
-
-@L1: lda #$00 ; Return false
- tax
- rts
-
+ jsr ctype_preprocessor ; (clears always x)
+ bcs @L1 ; out of range? (everything already clear -> false)
+ and #(CT_SPACE | CT_OTHER_WS) ; mask space bits
+ @L1: rts
diff --git a/libsrc/common/isupper.s b/libsrc/common/isupper.s
index 698983ec..2d89459a 100644
--- a/libsrc/common/isupper.s
+++ b/libsrc/common/isupper.s
@@ -1,21 +1,21 @@
+; isupper.s
;
-; Ullrich von Bassewitz, 02.06.1998
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
;
; int isupper (int c);
;
.export _isupper
.include "ctype.inc"
+ .import ctype_preprocessor
_isupper:
- cpx #$00 ; Char range ok?
- bne @L1 ; Jump if no
- tay
- lda __ctype,y ; Get character classification
- and #CT_UPPER ; Mask upper char bit
- rts
-
-@L1: lda #$00 ; Return false
- tax
- rts
-
+ jsr ctype_preprocessor ; (clears always x)
+ bcs @L1 ; out of range? (everything already clear -> false)
+ and #CT_UPPER ; mask upper char bit
+@L1: rts
diff --git a/libsrc/common/isxdigit.s b/libsrc/common/isxdigit.s
index 36f86ef1..07fef5c2 100644
--- a/libsrc/common/isxdigit.s
+++ b/libsrc/common/isxdigit.s
@@ -1,21 +1,21 @@
+; isxdigit.s
;
-; Ullrich von Bassewitz, 02.06.1998
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
;
; int isxdigit (int c);
;
.export _isxdigit
.include "ctype.inc"
+ .import ctype_preprocessor
_isxdigit:
- cpx #$00 ; Char range ok?
- bne @L1 ; Jump if no
- tay
- lda __ctype,y ; Get character classification
- and #CT_XDIGIT ; Mask xdigit bit
- rts
-
-@L1: lda #$00 ; Return false
- tax
- rts
-
+ jsr ctype_preprocessor ; (clears always x)
+ bcs @L1 ; out of range? (everything already clear -> false)
+ and #CT_XDIGIT ; mask xdigit bit
+@L1: rts
diff --git a/libsrc/common/stricmp.s b/libsrc/common/stricmp.s
index 384e78e3..e1683d9f 100644
--- a/libsrc/common/stricmp.s
+++ b/libsrc/common/stricmp.s
@@ -1,5 +1,11 @@
+; stricmp.s
;
-; Ullrich von Bassewitz, 03.06.1998
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
;
; int stricmp (const char* s1, const char* s2); /* DOS way */
; int strcasecmp (const char* s1, const char* s2); /* UNIX way */
@@ -7,9 +13,8 @@
.export _stricmp, _strcasecmp
.import popptr1
- .import __ctype
- .importzp ptr1, ptr2, tmp1
-
+ .importzp ptr1, ptr2, tmp1, tmp2
+ .import ctype_preprocessor_no_check
.include "ctype.inc"
_stricmp:
@@ -20,27 +25,27 @@ _strcasecmp:
; ldy #0 ; Y=0 guaranteed by popptr1
loop: lda (ptr2),y ; get char from second string
- tax
- lda __ctype,x ; get character classification
+ sta tmp2 ; and save it
+ ; get character classification
+ jsr ctype_preprocessor_no_check
and #CT_LOWER ; lower case char?
beq L1 ; jump if no
- txa ; get character back
- clc
- adc #<('A'-'a') ; make upper case char
- tax ;
-L1: stx tmp1 ; remember upper case equivalent
+ lda #<('A'-'a') ; make upper case char
+ adc tmp2 ; ctype_preprocessor_no_check ensures carry clear!
+ sta tmp2 ; remember upper case equivalent
- lda (ptr1),y ; get character from first string
- tax
- lda __ctype,x ; get character classification
+L1: lda (ptr1),y ; get character from first string
+ sta tmp1
+ ; get character classification
+ jsr ctype_preprocessor_no_check
and #CT_LOWER ; lower case char?
beq L2 ; jump if no
- txa ; get character back
- clc
- adc #<('A'-'a') ; make upper case char
- tax
+ lda #<('A'-'a') ; make upper case char
+ adc tmp1 ; ctype_preprocessor_no_check ensures carry clear!
+ sta tmp1 ; remember upper case equivalent
-L2: cpx tmp1 ; compare characters
+L2: ldx tmp1
+ cpx tmp2 ; compare characters
bne L3
txa ; end of strings?
beq L5 ; a/x both zero
diff --git a/libsrc/common/strlower.s b/libsrc/common/strlower.s
index 848a4faf..8c634b6e 100644
--- a/libsrc/common/strlower.s
+++ b/libsrc/common/strlower.s
@@ -10,9 +10,8 @@
.export _strlower, _strlwr
.import popax
- .import __ctype
.importzp ptr1, ptr2
-
+ .import ctype_preprocessor_no_check
.include "ctype.inc"
_strlower:
@@ -25,11 +24,11 @@ _strlwr:
loop: lda (ptr1),y ; get character
beq L9 ; jump if done
- tax
- lda __ctype,x ; get character classification
+ ; get character classification
+ jsr ctype_preprocessor_no_check
and #CT_UPPER ; upper case char?
beq L1 ; jump if no
- txa ; get character back into accu
+ lda (ptr1),y ; fetch character again
sec
sbc #<('A'-'a') ; make lower case char
sta (ptr1),y ; store back
diff --git a/libsrc/common/strnicmp.s b/libsrc/common/strnicmp.s
index 6a5de09e..54aef2bb 100644
--- a/libsrc/common/strnicmp.s
+++ b/libsrc/common/strnicmp.s
@@ -7,9 +7,9 @@
;
.export _strnicmp, _strncasecmp
- .import popax, popptr1, __ctype
- .importzp ptr1, ptr2, ptr3, tmp1
-
+ .import popax, popptr1
+ .importzp ptr1, ptr2, ptr3, tmp1, tmp2
+ .import ctype_preprocessor_no_check
.include "ctype.inc"
_strnicmp:
@@ -46,27 +46,27 @@ Loop: inc ptr3
; Compare a byte from the strings
Comp: lda (ptr2),y
- tax
- lda __ctype,x ; get character classification
+ sta tmp2 ; remember original char
+ ; get character classification
+ jsr ctype_preprocessor_no_check
and #CT_LOWER ; lower case char?
beq L1 ; jump if no
- txa ; get character back
- sec
- sbc #<('a'-'A') ; make upper case char
- tax ;
-L1: stx tmp1 ; remember upper case equivalent
-
- lda (ptr1),y ; get character from first string
- tax
- lda __ctype,x ; get character classification
+ lda #<('A'-'a') ; make upper case char
+ adc tmp2 ; ctype_preprocessor_no_check ensures carry clear!
+ sta tmp2 ; remember upper case equivalent
+
+L1: lda (ptr1),y ; get character from first string
+ sta tmp1 ; remember original char
+ ; get character classification
+ jsr ctype_preprocessor_no_check
and #CT_LOWER ; lower case char?
beq L2 ; jump if no
- txa ; get character back
- sec
- sbc #<('a'-'A') ; make upper case char
- tax
+ lda #<('A'-'a') ; make upper case char
+ adc tmp1 ; ctype_preprocessor_no_check ensures carry clear!
+ sta tmp1 ; remember upper case equivalent
-L2: cpx tmp1 ; compare characters
+L2: ldx tmp1
+ cpx tmp2 ; compare characters
bne NotEqual ; Jump if strings different
txa ; End of strings?
beq Equal1 ; Jump if EOS reached, a/x == 0
diff --git a/libsrc/common/strupper.s b/libsrc/common/strupper.s
index bf0d3b62..c07fb17c 100644
--- a/libsrc/common/strupper.s
+++ b/libsrc/common/strupper.s
@@ -10,9 +10,8 @@
.export _strupper, _strupr
.import popax
- .import __ctype
.importzp ptr1, ptr2
-
+ .import ctype_preprocessor_no_check
.include "ctype.inc"
_strupper:
@@ -25,11 +24,10 @@ _strupr:
loop: lda (ptr1),y ; get character
beq L9 ; jump if done
- tax
- lda __ctype,x ; get character classification
+ jsr ctype_preprocessor_no_check
and #CT_LOWER ; lower case char?
beq L1 ; jump if no
- txa ; get character back into accu
+ lda (ptr1),y ; fetch character again
clc
adc #<('A'-'a') ; make upper case char
sta (ptr1),y ; store back
diff --git a/libsrc/creativision/ctype.s b/libsrc/creativision/ctype.s
index 6e0ab178..da4d3847 100644
--- a/libsrc/creativision/ctype.s
+++ b/libsrc/creativision/ctype.s
@@ -1,172 +1,5 @@
-;
-; Ullrich von Bassewitz, 02.06.1998
-;
; Character specification table.
;
+; uses the "console" definition
-; The tables are readonly, put them into the rodata segment
-
-.rodata
-
-; The following 256 byte wide table specifies attributes for the isxxx type
-; of functions. Doing it by a table means some overhead in space, but it
-; has major advantages:
-;
-; * It is fast. If it were'nt for the slow parameter passing of cc65, one
-; could even define macros for the isxxx functions (this is usually
-; done on other platforms).
-;
-; * It is highly portable. The only unportable part is the table itself,
-; all real code goes into the common library.
-;
-; * We save some code in the isxxx functions.
-;
-;
-; Bit assignments:
-;
-; 0 - Lower case char
-; 1 - Upper case char
-; 2 - Numeric digit
-; 3 - Hex digit (both, lower and upper)
-; 4 - Control character
-; 5 - The space character itself
-; 6 - Other whitespace (that is: '\f', '\n', '\r', '\t' and '\v')
-; 7 - Space or tab character
-
- .export __ctype
-
-__ctype:
-
-.repeat 2 ; 2 times for normal and inverted
-
- .byte $10 ; 0/00 ___ctrl_@___
- .byte $10 ; 1/01 ___ctrl_A___
- .byte $10 ; 2/02 ___ctrl_B___
- .byte $10 ; 3/03 ___ctrl_C___
- .byte $10 ; 4/04 ___ctrl_D___
- .byte $10 ; 5/05 ___ctrl_E___
- .byte $10 ; 6/06 ___ctrl_F___
- .byte $10 ; 7/07 ___ctrl_G___
- .byte $10 ; 8/08 ___ctrl_H___
- .byte $D0 ; 9/09 ___ctrl_I___
- .byte $50 ; 10/0a ___ctrl_J___
- .byte $50 ; 11/0b ___ctrl_K___
- .byte $50 ; 12/0c ___ctrl_L___
- .byte $50 ; 13/0d ___ctrl_M___
- .byte $10 ; 14/0e ___ctrl_N___
- .byte $10 ; 15/0f ___ctrl_O___
- .byte $10 ; 16/10 ___ctrl_P___
- .byte $10 ; 17/11 ___ctrl_Q___
- .byte $10 ; 18/12 ___ctrl_R___
- .byte $10 ; 19/13 ___ctrl_S___
- .byte $10 ; 20/14 ___ctrl_T___
- .byte $10 ; 21/15 ___ctrl_U___
- .byte $10 ; 22/16 ___ctrl_V___
- .byte $10 ; 23/17 ___ctrl_W___
- .byte $10 ; 24/18 ___ctrl_X___
- .byte $10 ; 25/19 ___ctrl_Y___
- .byte $10 ; 26/1a ___ctrl_Z___
- .byte $10 ; 27/1b ___ctrl_[___
- .byte $10 ; 28/1c ___ctrl_\___
- .byte $10 ; 29/1d ___ctrl_]___
- .byte $10 ; 30/1e ___ctrl_^___
- .byte $10 ; 31/1f ___ctrl_____
- .byte $A0 ; 32/20 ___SPACE___
- .byte $00 ; 33/21 _____!_____
- .byte $00 ; 34/22 _____"_____
- .byte $00 ; 35/23 _____#_____
- .byte $00 ; 36/24 _____$_____
- .byte $00 ; 37/25 _____%_____
- .byte $00 ; 38/26 _____&_____
- .byte $00 ; 39/27 _____'_____
- .byte $00 ; 40/28 _____(_____
- .byte $00 ; 41/29 _____)_____
- .byte $00 ; 42/2a _____*_____
- .byte $00 ; 43/2b _____+_____
- .byte $00 ; 44/2c _____,_____
- .byte $00 ; 45/2d _____-_____
- .byte $00 ; 46/2e _____._____
- .byte $00 ; 47/2f _____/_____
- .byte $0C ; 48/30 _____0_____
- .byte $0C ; 49/31 _____1_____
- .byte $0C ; 50/32 _____2_____
- .byte $0C ; 51/33 _____3_____
- .byte $0C ; 52/34 _____4_____
- .byte $0C ; 53/35 _____5_____
- .byte $0C ; 54/36 _____6_____
- .byte $0C ; 55/37 _____7_____
- .byte $0C ; 56/38 _____8_____
- .byte $0C ; 57/39 _____9_____
- .byte $00 ; 58/3a _____:_____
- .byte $00 ; 59/3b _____;_____
- .byte $00 ; 60/3c _____<_____
- .byte $00 ; 61/3d _____=_____
- .byte $00 ; 62/3e _____>_____
- .byte $00 ; 63/3f _____?_____
-
- .byte $00 ; 64/40 _____@_____
- .byte $0A ; 65/41 _____A_____
- .byte $0A ; 66/42 _____B_____
- .byte $0A ; 67/43 _____C_____
- .byte $0A ; 68/44 _____D_____
- .byte $0A ; 69/45 _____E_____
- .byte $0A ; 70/46 _____F_____
- .byte $02 ; 71/47 _____G_____
- .byte $02 ; 72/48 _____H_____
- .byte $02 ; 73/49 _____I_____
- .byte $02 ; 74/4a _____J_____
- .byte $02 ; 75/4b _____K_____
- .byte $02 ; 76/4c _____L_____
- .byte $02 ; 77/4d _____M_____
- .byte $02 ; 78/4e _____N_____
- .byte $02 ; 79/4f _____O_____
- .byte $02 ; 80/50 _____P_____
- .byte $02 ; 81/51 _____Q_____
- .byte $02 ; 82/52 _____R_____
- .byte $02 ; 83/53 _____S_____
- .byte $02 ; 84/54 _____T_____
- .byte $02 ; 85/55 _____U_____
- .byte $02 ; 86/56 _____V_____
- .byte $02 ; 87/57 _____W_____
- .byte $02 ; 88/58 _____X_____
- .byte $02 ; 89/59 _____Y_____
- .byte $02 ; 90/5a _____Z_____
- .byte $00 ; 91/5b _____[_____
- .byte $00 ; 92/5c _____\_____
- .byte $00 ; 93/5d _____]_____
- .byte $00 ; 94/5e _____^_____
- .byte $00 ; 95/5f _UNDERLINE_
- .byte $00 ; 96/60 ___grave___
- .byte $09 ; 97/61 _____a_____
- .byte $09 ; 98/62 _____b_____
- .byte $09 ; 99/63 _____c_____
- .byte $09 ; 100/64 _____d_____
- .byte $09 ; 101/65 _____e_____
- .byte $09 ; 102/66 _____f_____
- .byte $01 ; 103/67 _____g_____
- .byte $01 ; 104/68 _____h_____
- .byte $01 ; 105/69 _____i_____
- .byte $01 ; 106/6a _____j_____
- .byte $01 ; 107/6b _____k_____
- .byte $01 ; 108/6c _____l_____
- .byte $01 ; 109/6d _____m_____
- .byte $01 ; 110/6e _____n_____
- .byte $01 ; 111/6f _____o_____
- .byte $01 ; 112/70 _____p_____
- .byte $01 ; 113/71 _____q_____
- .byte $01 ; 114/72 _____r_____
- .byte $01 ; 115/73 _____s_____
- .byte $01 ; 116/74 _____t_____
- .byte $01 ; 117/75 _____u_____
- .byte $01 ; 118/76 _____v_____
- .byte $01 ; 119/77 _____w_____
- .byte $01 ; 120/78 _____x_____
- .byte $01 ; 121/79 _____y_____
- .byte $01 ; 122/7a _____z_____
- .byte $00 ; 123/7b _____{_____
- .byte $00 ; 124/7c _____|_____
- .byte $00 ; 125/7d _____}_____
- .byte $00 ; 126/7e _____~_____
- .byte $40 ; 127/7f ____DEL____
-
-.endrepeat
+ .include "ctype_console.inc"
diff --git a/libsrc/gamate/ctype.s b/libsrc/gamate/ctype.s
index fa9a65c8..da4d3847 100644
--- a/libsrc/gamate/ctype.s
+++ b/libsrc/gamate/ctype.s
@@ -1,161 +1,5 @@
-;
-; Stefan Haubenthal with minor changes from Ullrich von Bassewitz, 2003-05-02
-;
; Character specification table.
;
+; uses the "console" definition
- .include "ctype.inc"
-
-; The tables are readonly, put them into the rodata segment
-
-.rodata
-
-; The following 256 byte wide table specifies attributes for the isxxx type
-; of functions. Doing it by a table means some overhead in space, but it
-; has major advantages:
-;
-; * It is fast. If it were'nt for the slow parameter passing of cc65, one
-; could even define macros for the isxxx functions (this is usually
-; done on other platforms).
-;
-; * It is highly portable. The only unportable part is the table itself,
-; all real code goes into the common library.
-;
-; * We save some code in the isxxx functions.
-
-
-__ctype:
- .repeat 2
- .byte CT_CTRL ; 0/00 ___ctrl_@___
- .byte CT_CTRL ; 1/01 ___ctrl_A___
- .byte CT_CTRL ; 2/02 ___ctrl_B___
- .byte CT_CTRL ; 3/03 ___ctrl_C___
- .byte CT_CTRL ; 4/04 ___ctrl_D___
- .byte CT_CTRL ; 5/05 ___ctrl_E___
- .byte CT_CTRL ; 6/06 ___ctrl_F___
- .byte CT_CTRL ; 7/07 ___ctrl_G___
- .byte CT_CTRL ; 8/08 ___ctrl_H___
- .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB
- ; 9/09 ___ctrl_I___
- .byte CT_CTRL | CT_OTHER_WS ; 10/0a ___ctrl_J___
- .byte CT_CTRL | CT_OTHER_WS ; 11/0b ___ctrl_K___
- .byte CT_CTRL | CT_OTHER_WS ; 12/0c ___ctrl_L___
- .byte CT_CTRL | CT_OTHER_WS ; 13/0d ___ctrl_M___
- .byte CT_CTRL ; 14/0e ___ctrl_N___
- .byte CT_CTRL ; 15/0f ___ctrl_O___
- .byte CT_CTRL ; 16/10 ___ctrl_P___
- .byte CT_CTRL ; 17/11 ___ctrl_Q___
- .byte CT_CTRL ; 18/12 ___ctrl_R___
- .byte CT_CTRL ; 19/13 ___ctrl_S___
- .byte CT_CTRL ; 20/14 ___ctrl_T___
- .byte CT_CTRL ; 21/15 ___ctrl_U___
- .byte CT_CTRL ; 22/16 ___ctrl_V___
- .byte CT_CTRL ; 23/17 ___ctrl_W___
- .byte CT_CTRL ; 24/18 ___ctrl_X___
- .byte CT_CTRL ; 25/19 ___ctrl_Y___
- .byte CT_CTRL ; 26/1a ___ctrl_Z___
- .byte CT_CTRL ; 27/1b ___ctrl_[___
- .byte CT_CTRL ; 28/1c ___ctrl_\___
- .byte CT_CTRL ; 29/1d ___ctrl_]___
- .byte CT_CTRL ; 30/1e ___ctrl_^___
- .byte CT_CTRL ; 31/1f ___ctrl_____
- .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___
- .byte CT_NONE ; 33/21 _____!_____
- .byte CT_NONE ; 34/22 _____"_____
- .byte CT_NONE ; 35/23 _____#_____
- .byte CT_NONE ; 36/24 _____$_____
- .byte CT_NONE ; 37/25 _____%_____
- .byte CT_NONE ; 38/26 _____&_____
- .byte CT_NONE ; 39/27 _____'_____
- .byte CT_NONE ; 40/28 _____(_____
- .byte CT_NONE ; 41/29 _____)_____
- .byte CT_NONE ; 42/2a _____*_____
- .byte CT_NONE ; 43/2b _____+_____
- .byte CT_NONE ; 44/2c _____,_____
- .byte CT_NONE ; 45/2d _____-_____
- .byte CT_NONE ; 46/2e _____._____
- .byte CT_NONE ; 47/2f _____/_____
- .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____
- .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____
- .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____
- .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____
- .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____
- .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____
- .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____
- .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____
- .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____
- .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____
- .byte CT_NONE ; 58/3a _____:_____
- .byte CT_NONE ; 59/3b _____;_____
- .byte CT_NONE ; 60/3c _____<_____
- .byte CT_NONE ; 61/3d _____=_____
- .byte CT_NONE ; 62/3e _____>_____
- .byte CT_NONE ; 63/3f _____?_____
-
- .byte CT_NONE ; 64/40 _____@_____
- .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____
- .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____
- .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____
- .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____
- .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____
- .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____
- .byte CT_UPPER ; 71/47 _____G_____
- .byte CT_UPPER ; 72/48 _____H_____
- .byte CT_UPPER ; 73/49 _____I_____
- .byte CT_UPPER ; 74/4a _____J_____
- .byte CT_UPPER ; 75/4b _____K_____
- .byte CT_UPPER ; 76/4c _____L_____
- .byte CT_UPPER ; 77/4d _____M_____
- .byte CT_UPPER ; 78/4e _____N_____
- .byte CT_UPPER ; 79/4f _____O_____
- .byte CT_UPPER ; 80/50 _____P_____
- .byte CT_UPPER ; 81/51 _____Q_____
- .byte CT_UPPER ; 82/52 _____R_____
- .byte CT_UPPER ; 83/53 _____S_____
- .byte CT_UPPER ; 84/54 _____T_____
- .byte CT_UPPER ; 85/55 _____U_____
- .byte CT_UPPER ; 86/56 _____V_____
- .byte CT_UPPER ; 87/57 _____W_____
- .byte CT_UPPER ; 88/58 _____X_____
- .byte CT_UPPER ; 89/59 _____Y_____
- .byte CT_UPPER ; 90/5a _____Z_____
- .byte CT_NONE ; 91/5b _____[_____
- .byte CT_NONE ; 92/5c _____\_____
- .byte CT_NONE ; 93/5d _____]_____
- .byte CT_NONE ; 94/5e _____^_____
- .byte CT_NONE ; 95/5f _UNDERLINE_
- .byte CT_NONE ; 96/60 ___grave___
- .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____
- .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____
- .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____
- .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____
- .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____
- .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____
- .byte CT_LOWER ; 103/67 _____g_____
- .byte CT_LOWER ; 104/68 _____h_____
- .byte CT_LOWER ; 105/69 _____i_____
- .byte CT_LOWER ; 106/6a _____j_____
- .byte CT_LOWER ; 107/6b _____k_____
- .byte CT_LOWER ; 108/6c _____l_____
- .byte CT_LOWER ; 109/6d _____m_____
- .byte CT_LOWER ; 110/6e _____n_____
- .byte CT_LOWER ; 111/6f _____o_____
- .byte CT_LOWER ; 112/70 _____p_____
- .byte CT_LOWER ; 113/71 _____q_____
- .byte CT_LOWER ; 114/72 _____r_____
- .byte CT_LOWER ; 115/73 _____s_____
- .byte CT_LOWER ; 116/74 _____t_____
- .byte CT_LOWER ; 117/75 _____u_____
- .byte CT_LOWER ; 118/76 _____v_____
- .byte CT_LOWER ; 119/77 _____w_____
- .byte CT_LOWER ; 120/78 _____x_____
- .byte CT_LOWER ; 121/79 _____y_____
- .byte CT_LOWER ; 122/7a _____z_____
- .byte CT_NONE ; 123/7b _____{_____
- .byte CT_NONE ; 124/7c _____|_____
- .byte CT_NONE ; 125/7d _____}_____
- .byte CT_NONE ; 126/7e _____~_____
- .byte CT_OTHER_WS ; 127/7f ____DEL____
- .endrepeat
-
-
+ .include "ctype_console.inc"
diff --git a/libsrc/geos-common/system/ctype.s b/libsrc/geos-common/system/ctype.s
index cc0cc98b..a50ad163 100644
--- a/libsrc/geos-common/system/ctype.s
+++ b/libsrc/geos-common/system/ctype.s
@@ -1,281 +1,157 @@
+; ctype.s
;
-; Source: The Hitchhiker's Guide To GEOS
-; http://lyonlabs.org/commodore/onrequest/geos-manuals/The_Hitchhikers_Guide_to_GEOS.pdf
+; This file is part of
+; cc65 - a freeware C compiler for 6502 based systems
+;
+; https://github.com/cc65/cc65
+;
+; See "LICENSE" file for legal information.
;
-; Character specification table.
+; GEOS character specification table.
;
+; Source: The Hitchhiker's Guide To GEOS
+; http://lyonlabs.org/commodore/onrequest/geos-manuals/The_Hitchhikers_Guide_to_GEOS.pdf
- .include "ctype.inc"
+ .include "ctypetable.inc"
+ .export __ctypeIdx
+
+; The tables are readonly, put them into the rodata segment
.rodata
-; The following 256 byte wide table specifies attributes for the isxxx type
-; of functions. Doing it by a table means some overhead in space, but it
-; has major advantages:
-;
-; * It is fast. If it were'nt for the slow parameter passing of cc65, one
-; could even define macros for the isxxx functions (this is usually
-; done on other platforms).
-;
-; * It is highly portable. The only unportable part is the table itself,
-; all real code goes into the common library.
-;
-; * We save some code in the isxxx functions.
+__ctypeIdx:
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 0/00 ____NULL___, 1/01 ____N/A____
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 2/02 ____N/A____, 3/03 ____N/A____
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 4/04 ____N/A____, 5/05 ____N/A____
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 6/06 ____N/A____, 7/07 ____N/A____
+ ct_mix CT_CTRL_IDX, CT_CTRL_WS_SPACETAB_IDX ; 8/08 __BAKSPACE_, 9/09 __FWDSPACE_
+ ct_mix CT_CTRL_WS_IDX, CT_CTRL_IDX ; 10/0a _____LF____, 11/0b ____HOME___
+ ct_mix CT_CTRL_IDX, CT_CTRL_WS_IDX ; 12/0c ___UPLINE__, 13/0d _____CR____
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 14/0e __ULINEON__, 15/0f __ULINEOFF_
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 16/10 _ESC_GRAPH_, 17/11 ____N/A____
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 18/12 ___REVON___, 19/13 ___REVOFF__
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 20/14 ___GOTOX___, 21/15 ___GOTOY___
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 22/16 ___GOTOXY__, 23/17 _NEWCRDSET_
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 24/18 ___BOLDON__, 25/19 __ITALICON_
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 26/1a _OUTLINEON_, 27/1b _PLAINTEXT_
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 28/1c ____N/A____, 29/1d ____N/A____
+ ct_mix CT_CTRL_IDX, CT_CTRL_IDX ; 30/1e ____N/A____, 31/1f ____N/A____
+
+ ct_mix CT_SPACE_SPACETAB_IDX, CT_NONE_IDX ; 32/20 ___SPACE___, 33/21 _____!_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 34/22 _____"_____, 35/23 _____#_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 36/24 _____$_____, 37/25 _____%_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 38/26 _____&_____, 39/27 _____'_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 40/28 _____(_____, 41/29 _____)_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 42/2a _____*_____, 43/2b _____+_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 44/2c _____,_____, 45/2d _____-_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 46/2e _____._____, 47/2f _____/_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 48/30 _____0_____, 49/31 _____1_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 50/32 _____2_____, 51/33 _____3_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 52/34 _____4_____, 53/35 _____5_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 54/36 _____6_____, 55/37 _____7_____
+ ct_mix CT_DIGIT_XDIGIT_IDX, CT_DIGIT_XDIGIT_IDX ; 56/38 _____8_____, 57/39 _____9_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 58/3a _____:_____, 59/3b _____;_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 60/3c _____<_____, 61/3d _____=_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 62/3e _____>_____, 63/3f _____?_____
+
+ ct_mix CT_NONE_IDX, CT_UPPER_XDIGIT_IDX ; 64/40 _____@_____, 65/41 _____A_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_XDIGIT_IDX ; 66/42 _____B_____, 67/43 _____C_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_XDIGIT_IDX ; 68/44 _____D_____, 69/45 _____E_____
+ ct_mix CT_UPPER_XDIGIT_IDX, CT_UPPER_IDX ; 70/46 _____F_____, 71/47 _____G_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 72/48 _____H_____, 73/49 _____I_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 74/4a _____J_____, 75/4b _____K_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 76/4c _____L_____, 77/4d _____M_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 78/4e _____N_____, 79/4f _____O_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 80/50 _____P_____, 81/51 _____Q_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 82/52 _____R_____, 83/53 _____S_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 84/54 _____T_____, 85/55 _____U_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 86/56 _____V_____, 87/57 _____W_____
+ ct_mix CT_UPPER_IDX, CT_UPPER_IDX ; 88/58 _____X_____, 89/59 _____Y_____
+ ct_mix CT_UPPER_IDX, CT_NONE_IDX ; 90/5a _____Z_____, 91/5b _____[_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 92/5c _____\_____, 93/5d _____]_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 94/5e _____^_____, 95/5f _UNDERLINE_
+
+ ct_mix CT_NONE_IDX, CT_LOWER_XDIGIT_IDX ; 96/60 _____`_____, 97/61 _____a_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_XDIGIT_IDX ; 98/62 _____b_____, 99/63 _____c_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_XDIGIT_IDX ; 100/64 _____d_____, 101/65 _____e_____
+ ct_mix CT_LOWER_XDIGIT_IDX, CT_LOWER_IDX ; 102/66 _____f_____, 103/67 _____g_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 104/68 _____h_____, 105/69 _____i_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 106/6a _____j_____, 107/6b _____k_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 108/6c _____l_____, 109/6d _____m_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 110/6e _____n_____, 111/6f _____o_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 112/70 _____p_____, 113/71 _____q_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 114/72 _____r_____, 15/73 _____s_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 116/74 _____t_____, 117/75 _____u_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 118/76 _____v_____, 119/77 _____w_____
+ ct_mix CT_LOWER_IDX, CT_LOWER_IDX ; 120/78 _____x_____, 121/79 _____y_____
+ ct_mix CT_LOWER_IDX, CT_NONE_IDX ; 122/7a _____z_____, 123/7b _____{_____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 124/7c _____|_____, 125/7d _____}_____
+ ct_mix CT_NONE_IDX, CT_CTRL_IDX ; 126/7e _____~_____, 127/7f __USELAST__
+
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 128/80 __SHORTCUT_ ,129/81 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 130/82 ____N/A____ ,131/83 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 132/84 ____N/A____ ,133/85 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 134/86 ____N/A____, 135/87 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 136/88 ____N/A____ ,137/89 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 138/8a ____N/A____ ,139/8b ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 140/8c ____N/A____, 141/8d ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 142/8e ____N/A____, 143/8f ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 144/90 ____N/A____, 145/91 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 146/92 ____N/A____, 147/93 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 148/94 ____N/A____, 149/95 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 150/96 ____N/A____, 151/97 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 152/98 ____N/A____, 153/99 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 154/9a ____N/A____, 155/9b ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 156/9c ____N/A____, 157/9d ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 158/9e ____N/A____, 159/9f ____N/A____
+
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 160/a0 ____N/A____, 161/a1 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 162/a2 ____N/A____, 163/a3 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 164/a4 ____N/A____, 165/a5 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 166/a6 ____N/A____, 167/a7 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 168/a8 ____N/A____, 169/a9 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 170/aa ____N/A____, 171/ab ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 172/ac ____N/A____, 173/ad ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 174/ae ____N/A____, 175/af ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 176/b0 ____N/A____, 177/b1 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 178/b2 ____N/A____, 179/b3 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 180/b4 ____N/A____, 181/b5 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 182/b6 ____N/A____, 183/b7 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 184/b8 ____N/A____, 185/b9 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 186/ba ____N/A____, 187/bb ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 188/bc ____N/A____, 189/bd ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 190/be ____N/A____, 191/bf ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 192/c0 ____N/A____, 193/c1 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 194/c2 ____N/A____, 195/c3 ____N/A____
+
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 196/c4 ____N/A____, 197/c5 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 198/c6 ____N/A____, 199/c7 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 200/c8 ____N/A____, 201/c9 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 202/ca ____N/A____, 203/cb ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 204/cc ____N/A____, 205/cd ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 206/ce ____N/A____, 207/cf ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 208/d0 ____N/A____, 209/d1 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 210/d2 ____N/A____, 211/d3 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 212/d4 ____N/A____, 213/d5 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 214/d6 ____N/A____, 215/d7 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 216/d8 ____N/A____, 217/d9 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 218/da ____N/A____, 219/db ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 220/dc ____N/A____, 221/dd ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 222/de ____N/A____, 223/df ____N/A____
-__ctype:
- .byte CT_CTRL ; 0/00 ____NULL___
- .byte CT_CTRL ; 1/01 ____N/A____
- .byte CT_CTRL ; 2/02 ____N/A____
- .byte CT_CTRL ; 3/03 ____N/A____
- .byte CT_CTRL ; 4/04 ____N/A____
- .byte CT_CTRL ; 5/05 ____N/A____
- .byte CT_CTRL ; 6/06 ____N/A____
- .byte CT_CTRL ; 7/07 ____N/A____
- .byte CT_CTRL ; 8/08 __BAKSPACE_
- .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB ; 9/09 __FWDSPACE_
- .byte CT_CTRL | CT_OTHER_WS ; 10/0a _____LF____
- .byte CT_CTRL ; 11/0b ____HOME___
- .byte CT_CTRL ; 12/0c ___UPLINE__
- .byte CT_CTRL | CT_OTHER_WS ; 13/0d _____CR____
- .byte CT_CTRL ; 14/0e __ULINEON__
- .byte CT_CTRL ; 15/0f __ULINEOFF_
- .byte CT_CTRL ; 16/10 _ESC_GRAPH_
- .byte CT_CTRL ; 17/11 ____N/A____
- .byte CT_CTRL ; 18/12 ___REVON___
- .byte CT_CTRL ; 19/13 ___REVOFF__
- .byte CT_CTRL ; 20/14 ___GOTOX___
- .byte CT_CTRL ; 21/15 ___GOTOY___
- .byte CT_CTRL ; 22/16 ___GOTOXY__
- .byte CT_CTRL ; 23/17 _NEWCRDSET_
- .byte CT_CTRL ; 24/18 ___BOLDON__
- .byte CT_CTRL ; 25/19 __ITALICON_
- .byte CT_CTRL ; 26/1a _OUTLINEON_
- .byte CT_CTRL ; 27/1b _PLAINTEXT_
- .byte CT_CTRL ; 28/1c ____N/A____
- .byte CT_CTRL ; 29/1d ____N/A____
- .byte CT_CTRL ; 30/1e ____N/A____
- .byte CT_CTRL ; 31/1f ____N/A____
- .byte CT_SPACE_TAB | CT_SPACE ; 32/20 ___SPACE___
- .byte CT_NONE ; 33/21 _____!_____
- .byte CT_NONE ; 34/22 _____"_____
- .byte CT_NONE ; 35/23 _____#_____
- .byte CT_NONE ; 36/24 _____$_____
- .byte CT_NONE ; 37/25 _____%_____
- .byte CT_NONE ; 38/26 _____&_____
- .byte CT_NONE ; 39/27 _____'_____
- .byte CT_NONE ; 40/28 _____(_____
- .byte CT_NONE ; 41/29 _____)_____
- .byte CT_NONE ; 42/2a _____*_____
- .byte CT_NONE ; 43/2b _____+_____
- .byte CT_NONE ; 44/2c _____,_____
- .byte CT_NONE ; 45/2d _____-_____
- .byte CT_NONE ; 46/2e _____._____
- .byte CT_NONE ; 47/2f _____/_____
- .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____
- .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____
- .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____
- .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____
- .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____
- .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____
- .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____
- .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____
- .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____
- .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____
- .byte CT_NONE ; 58/3a _____:_____
- .byte CT_NONE ; 59/3b _____;_____
- .byte CT_NONE ; 60/3c _____<_____
- .byte CT_NONE ; 61/3d _____=_____
- .byte CT_NONE ; 62/3e _____>_____
- .byte CT_NONE ; 63/3f _____?_____
- .byte CT_NONE ; 64/40 _____@_____
- .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____
- .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____
- .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____
- .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____
- .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____
- .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____
- .byte CT_UPPER ; 71/47 _____G_____
- .byte CT_UPPER ; 72/48 _____H_____
- .byte CT_UPPER ; 73/49 _____I_____
- .byte CT_UPPER ; 74/4a _____J_____
- .byte CT_UPPER ; 75/4b _____K_____
- .byte CT_UPPER ; 76/4c _____L_____
- .byte CT_UPPER ; 77/4d _____M_____
- .byte CT_UPPER ; 78/4e _____N_____
- .byte CT_UPPER ; 79/4f _____O_____
- .byte CT_UPPER ; 80/50 _____P_____
- .byte CT_UPPER ; 81/51 _____Q_____
- .byte CT_UPPER ; 82/52 _____R_____
- .byte CT_UPPER ; 83/53 _____S_____
- .byte CT_UPPER ; 84/54 _____T_____
- .byte CT_UPPER ; 85/55 _____U_____
- .byte CT_UPPER ; 86/56 _____V_____
- .byte CT_UPPER ; 87/57 _____W_____
- .byte CT_UPPER ; 88/58 _____X_____
- .byte CT_UPPER ; 89/59 _____Y_____
- .byte CT_UPPER ; 90/5a _____Z_____
- .byte CT_NONE ; 91/5b _____[_____
- .byte CT_NONE ; 92/5c _____\_____
- .byte CT_NONE ; 93/5d _____]_____
- .byte CT_NONE ; 94/5e _____^_____
- .byte CT_NONE ; 95/5f _UNDERLINE_
- .byte CT_NONE ; 96/60 _____`_____
- .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____
- .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____
- .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____
- .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____
- .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____
- .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____
- .byte CT_LOWER ; 103/67 _____g_____
- .byte CT_LOWER ; 104/68 _____h_____
- .byte CT_LOWER ; 105/69 _____i_____
- .byte CT_LOWER ; 106/6a _____j_____
- .byte CT_LOWER ; 107/6b _____k_____
- .byte CT_LOWER ; 108/6c _____l_____
- .byte CT_LOWER ; 109/6d _____m_____
- .byte CT_LOWER ; 110/6e _____n_____
- .byte CT_LOWER ; 111/6f _____o_____
- .byte CT_LOWER ; 112/70 _____p_____
- .byte CT_LOWER ; 113/71 _____q_____
- .byte CT_LOWER ; 114/72 _____r_____
- .byte CT_LOWER ; 115/73 _____s_____
- .byte CT_LOWER ; 116/74 _____t_____
- .byte CT_LOWER ; 117/75 _____u_____
- .byte CT_LOWER ; 118/76 _____v_____
- .byte CT_LOWER ; 119/77 _____w_____
- .byte CT_LOWER ; 120/78 _____x_____
- .byte CT_LOWER ; 121/79 _____y_____
- .byte CT_LOWER ; 122/7a _____z_____
- .byte CT_NONE ; 123/7b _____{_____
- .byte CT_NONE ; 124/7c _____|_____
- .byte CT_NONE ; 125/7d _____}_____
- .byte CT_NONE ; 126/7e _____~_____
- .byte CT_CTRL ; 127/7f __USELAST__
- .byte CT_NONE ; 128/80 __SHORTCUT_
- .byte CT_NONE ; 129/81 ____N/A____
- .byte CT_NONE ; 130/82 ____N/A____
- .byte CT_NONE ; 131/83 ____N/A____
- .byte CT_NONE ; 132/84 ____N/A____
- .byte CT_NONE ; 133/85 ____N/A____
- .byte CT_NONE ; 134/86 ____N/A____
- .byte CT_NONE ; 135/87 ____N/A____
- .byte CT_NONE ; 136/88 ____N/A____
- .byte CT_NONE ; 137/89 ____N/A____
- .byte CT_NONE ; 138/8a ____N/A____
- .byte CT_NONE ; 139/8b ____N/A____
- .byte CT_NONE ; 140/8c ____N/A____
- .byte CT_NONE ; 141/8d ____N/A____
- .byte CT_NONE ; 142/8e ____N/A____
- .byte CT_NONE ; 143/8f ____N/A____
- .byte CT_NONE ; 144/90 ____N/A____
- .byte CT_NONE ; 145/91 ____N/A____
- .byte CT_NONE ; 146/92 ____N/A____
- .byte CT_NONE ; 147/93 ____N/A____
- .byte CT_NONE ; 148/94 ____N/A____
- .byte CT_NONE ; 149/95 ____N/A____
- .byte CT_NONE ; 150/96 ____N/A____
- .byte CT_NONE ; 151/97 ____N/A____
- .byte CT_NONE ; 152/98 ____N/A____
- .byte CT_NONE ; 153/99 ____N/A____
- .byte CT_NONE ; 154/9a ____N/A____
- .byte CT_NONE ; 155/9b ____N/A____
- .byte CT_NONE ; 156/9c ____N/A____
- .byte CT_NONE ; 157/9d ____N/A____
- .byte CT_NONE ; 158/9e ____N/A____
- .byte CT_NONE ; 159/9f ____N/A____
- .byte CT_NONE ; 160/a0 ____N/A____
- .byte CT_NONE ; 161/a1 ____N/A____
- .byte CT_NONE ; 162/a2 ____N/A____
- .byte CT_NONE ; 163/a3 ____N/A____
- .byte CT_NONE ; 164/a4 ____N/A____
- .byte CT_NONE ; 165/a5 ____N/A____
- .byte CT_NONE ; 166/a6 ____N/A____
- .byte CT_NONE ; 167/a7 ____N/A____
- .byte CT_NONE ; 168/a8 ____N/A____
- .byte CT_NONE ; 169/a9 ____N/A____
- .byte CT_NONE ; 170/aa ____N/A____
- .byte CT_NONE ; 171/ab ____N/A____
- .byte CT_NONE ; 172/ac ____N/A____
- .byte CT_NONE ; 173/ad ____N/A____
- .byte CT_NONE ; 174/ae ____N/A____
- .byte CT_NONE ; 175/af ____N/A____
- .byte CT_NONE ; 176/b0 ____N/A____
- .byte CT_NONE ; 177/b1 ____N/A____
- .byte CT_NONE ; 178/b2 ____N/A____
- .byte CT_NONE ; 179/b3 ____N/A____
- .byte CT_NONE ; 180/b4 ____N/A____
- .byte CT_NONE ; 181/b5 ____N/A____
- .byte CT_NONE ; 182/b6 ____N/A____
- .byte CT_NONE ; 183/b7 ____N/A____
- .byte CT_NONE ; 184/b8 ____N/A____
- .byte CT_NONE ; 185/b9 ____N/A____
- .byte CT_NONE ; 186/ba ____N/A____
- .byte CT_NONE ; 187/bb ____N/A____
- .byte CT_NONE ; 188/bc ____N/A____
- .byte CT_NONE ; 189/bd ____N/A____
- .byte CT_NONE ; 190/be ____N/A____
- .byte CT_NONE ; 191/bf ____N/A____
- .byte CT_NONE ; 192/c0 ____N/A____
- .byte CT_NONE ; 193/c1 ____N/A____
- .byte CT_NONE ; 194/c2 ____N/A____
- .byte CT_NONE ; 195/c3 ____N/A____
- .byte CT_NONE ; 196/c4 ____N/A____
- .byte CT_NONE ; 197/c5 ____N/A____
- .byte CT_NONE ; 198/c6 ____N/A____
- .byte CT_NONE ; 199/c7 ____N/A____
- .byte CT_NONE ; 200/c8 ____N/A____
- .byte CT_NONE ; 201/c9 ____N/A____
- .byte CT_NONE ; 202/ca ____N/A____
- .byte CT_NONE ; 203/cb ____N/A____
- .byte CT_NONE ; 204/cc ____N/A____
- .byte CT_NONE ; 205/cd ____N/A____
- .byte CT_NONE ; 206/ce ____N/A____
- .byte CT_NONE ; 207/cf ____N/A____
- .byte CT_NONE ; 208/d0 ____N/A____
- .byte CT_NONE ; 209/d1 ____N/A____
- .byte CT_NONE ; 210/d2 ____N/A____
- .byte CT_NONE ; 211/d3 ____N/A____
- .byte CT_NONE ; 212/d4 ____N/A____
- .byte CT_NONE ; 213/d5 ____N/A____
- .byte CT_NONE ; 214/d6 ____N/A____
- .byte CT_NONE ; 215/d7 ____N/A____
- .byte CT_NONE ; 216/d8 ____N/A____
- .byte CT_NONE ; 217/d9 ____N/A____
- .byte CT_NONE ; 218/da ____N/A____
- .byte CT_NONE ; 219/db ____N/A____
- .byte CT_NONE ; 220/dc ____N/A____
- .byte CT_NONE ; 221/dd ____N/A____
- .byte CT_NONE ; 222/de ____N/A____
- .byte CT_NONE ; 223/df ____N/A____
- .byte CT_NONE ; 224/e0 ____N/A____
- .byte CT_NONE ; 225/e1 ____N/A____
- .byte CT_NONE ; 226/e2 ____N/A____
- .byte CT_NONE ; 227/e3 ____N/A____
- .byte CT_NONE ; 228/e4 ____N/A____
- .byte CT_NONE ; 229/e5 ____N/A____
- .byte CT_NONE ; 230/e6 ____N/A____
- .byte CT_NONE ; 231/e7 ____N/A____
- .byte CT_NONE ; 232/e8 ____N/A____
- .byte CT_NONE ; 233/e9 ____N/A____
- .byte CT_NONE ; 234/ea ____N/A____
- .byte CT_NONE ; 235/eb ____N/A____
- .byte CT_NONE ; 236/ec ____N/A____
- .byte CT_NONE ; 237/ed ____N/A____
- .byte CT_NONE ; 238/ee ____N/A____
- .byte CT_NONE ; 239/ef ____N/A____
- .byte CT_NONE ; 240/f0 ____N/A____
- .byte CT_NONE ; 241/f1 ____N/A____
- .byte CT_NONE ; 242/f2 ____N/A____
- .byte CT_NONE ; 243/f3 ____N/A____
- .byte CT_NONE ; 244/f4 ____N/A____
- .byte CT_NONE ; 245/f5 ____N/A____
- .byte CT_NONE ; 246/f6 ____N/A____
- .byte CT_NONE ; 247/f7 ____N/A____
- .byte CT_NONE ; 248/f8 ____N/A____
- .byte CT_NONE ; 249/f9 ____N/A____
- .byte CT_NONE ; 250/fa ____N/A____
- .byte CT_NONE ; 251/fb ____N/A____
- .byte CT_NONE ; 252/fc ____N/A____
- .byte CT_NONE ; 253/fd ____N/A____
- .byte CT_NONE ; 254/fe ____N/A____
- .byte CT_NONE ; 255/ff ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 224/e0 ____N/A____, 225/e1 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 226/e2 ____N/A____, 227/e3 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 228/e4 ____N/A____, 229/e5 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 230/e6 ____N/A____, 231/e7 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 232/e8 ____N/A____, 233/e9 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 234/ea ____N/A____, 235/eb ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 236/ec ____N/A____, 237/ed ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 238/ee ____N/A____, 239/ef ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 240/f0 ____N/A____, 241/f1 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 242/f2 ____N/A____, 243/f3 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 244/f4 ____N/A____, 245/f5 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 246/f6 ____N/A____, 247/f7 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 248/f8 ____N/A____, 249/f9 ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 250/fa ____N/A____, 251/fb ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 252/fc ____N/A____, 253/fd ____N/A____
+ ct_mix CT_NONE_IDX, CT_NONE_IDX ; 254/fe ____N/A____, 255/ff ____N/A____
diff --git a/libsrc/lynx/ctype.s b/libsrc/lynx/ctype.s
index 6e0ab178..da4d3847 100644
--- a/libsrc/lynx/ctype.s
+++ b/libsrc/lynx/ctype.s
@@ -1,172 +1,5 @@
-;
-; Ullrich von Bassewitz, 02.06.1998
-;
; Character specification table.
;
+; uses the "console" definition
-; The tables are readonly, put them into the rodata segment
-
-.rodata
-
-; The following 256 byte wide table specifies attributes for the isxxx type
-; of functions. Doing it by a table means some overhead in space, but it
-; has major advantages:
-;
-; * It is fast. If it were'nt for the slow parameter passing of cc65, one
-; could even define macros for the isxxx functions (this is usually
-; done on other platforms).
-;
-; * It is highly portable. The only unportable part is the table itself,
-; all real code goes into the common library.
-;
-; * We save some code in the isxxx functions.
-;
-;
-; Bit assignments:
-;
-; 0 - Lower case char
-; 1 - Upper case char
-; 2 - Numeric digit
-; 3 - Hex digit (both, lower and upper)
-; 4 - Control character
-; 5 - The space character itself
-; 6 - Other whitespace (that is: '\f', '\n', '\r', '\t' and '\v')
-; 7 - Space or tab character
-
- .export __ctype
-
-__ctype:
-
-.repeat 2 ; 2 times for normal and inverted
-
- .byte $10 ; 0/00 ___ctrl_@___
- .byte $10 ; 1/01 ___ctrl_A___
- .byte $10 ; 2/02 ___ctrl_B___
- .byte $10 ; 3/03 ___ctrl_C___
- .byte $10 ; 4/04 ___ctrl_D___
- .byte $10 ; 5/05 ___ctrl_E___
- .byte $10 ; 6/06 ___ctrl_F___
- .byte $10 ; 7/07 ___ctrl_G___
- .byte $10 ; 8/08 ___ctrl_H___
- .byte $D0 ; 9/09 ___ctrl_I___
- .byte $50 ; 10/0a ___ctrl_J___
- .byte $50 ; 11/0b ___ctrl_K___
- .byte $50 ; 12/0c ___ctrl_L___
- .byte $50 ; 13/0d ___ctrl_M___
- .byte $10 ; 14/0e ___ctrl_N___
- .byte $10 ; 15/0f ___ctrl_O___
- .byte $10 ; 16/10 ___ctrl_P___
- .byte $10 ; 17/11 ___ctrl_Q___
- .byte $10 ; 18/12 ___ctrl_R___
- .byte $10 ; 19/13 ___ctrl_S___
- .byte $10 ; 20/14 ___ctrl_T___
- .byte $10 ; 21/15 ___ctrl_U___
- .byte $10 ; 22/16 ___ctrl_V___
- .byte $10 ; 23/17 ___ctrl_W___
- .byte $10 ; 24/18 ___ctrl_X___
- .byte $10 ; 25/19 ___ctrl_Y___
- .byte $10 ; 26/1a ___ctrl_Z___
- .byte $10 ; 27/1b ___ctrl_[___
- .byte $10 ; 28/1c ___ctrl_\___
- .byte $10 ; 29/1d ___ctrl_]___
- .byte $10 ; 30/1e ___ctrl_^___
- .byte $10 ; 31/1f ___ctrl_____
- .byte $A0 ; 32/20 ___SPACE___
- .byte $00 ; 33/21 _____!_____
- .byte $00 ; 34/22 _____"_____
- .byte $00 ; 35/23 _____#_____
- .byte $00 ; 36/24 _____$_____
- .byte $00 ; 37/25 _____%_____
- .byte $00 ; 38/26 _____&_____
- .byte $00 ; 39/27 _____'_____
- .byte $00 ; 40/28 _____(_____
- .byte $00 ; 41/29 _____)_____
- .byte $00 ; 42/2a _____*_____
- .byte $00 ; 43/2b _____+_____
- .byte $00 ; 44/2c _____,_____
- .byte $00 ; 45/2d _____-_____
- .byte $00 ; 46/2e _____._____
- .byte $00 ; 47/2f _____/_____
- .byte $0C ; 48/30 _____0_____
- .byte $0C ; 49/31 _____1_____
- .byte $0C ; 50/32 _____2_____
- .byte $0C ; 51/33 _____3_____
- .byte $0C ; 52/34 _____4_____
- .byte $0C ; 53/35 _____5_____
- .byte $0C ; 54/36 _____6_____
- .byte $0C ; 55/37 _____7_____
- .byte $0C ; 56/38 _____8_____
- .byte $0C ; 57/39 _____9_____
- .byte $00 ; 58/3a _____:_____
- .byte $00 ; 59/3b _____;_____
- .byte $00 ; 60/3c _____<_____
- .byte $00 ; 61/3d _____=_____
- .byte $00 ; 62/3e _____>_____
- .byte $00 ; 63/3f _____?_____
-
- .byte $00 ; 64/40 _____@_____
- .byte $0A ; 65/41 _____A_____
- .byte $0A ; 66/42 _____B_____
- .byte $0A ; 67/43 _____C_____
- .byte $0A ; 68/44 _____D_____
- .byte $0A ; 69/45 _____E_____
- .byte $0A ; 70/46 _____F_____
- .byte $02 ; 71/47 _____G_____
- .byte $02 ; 72/48 _____H_____
- .byte $02 ; 73/49 _____I_____
- .byte $02 ; 74/4a _____J_____
- .byte $02 ; 75/4b _____K_____
- .byte $02 ; 76/4c _____L_____
- .byte $02 ; 77/4d _____M_____
- .byte $02 ; 78/4e _____N_____
- .byte $02 ; 79/4f _____O_____
- .byte $02 ; 80/50 _____P_____
- .byte $02 ; 81/51 _____Q_____
- .byte $02 ; 82/52 _____R_____
- .byte $02 ; 83/53 _____S_____
- .byte $02 ; 84/54 _____T_____
- .byte $02 ; 85/55 _____U_____
- .byte $02 ; 86/56 _____V_____
- .byte $02 ; 87/57 _____W_____
- .byte $02 ; 88/58 _____X_____
- .byte $02 ; 89/59 _____Y_____
- .byte $02 ; 90/5a _____Z_____
- .byte $00 ; 91/5b _____[_____
- .byte $00 ; 92/5c _____\_____
- .byte $00 ; 93/5d _____]_____
- .byte $00 ; 94/5e _____^_____
- .byte $00 ; 95/5f _UNDERLINE_
- .byte $00 ; 96/60 ___grave___
- .byte $09 ; 97/61 _____a_____
- .byte $09 ; 98/62 _____b_____
- .byte $09 ; 99/63 _____c_____
- .byte $09 ; 100/64 _____d_____
- .byte $09 ; 101/65 _____e_____
- .byte $09 ; 102/66 _____f_____
- .byte $01 ; 103/67 _____g_____
- .byte $01 ; 104/68 _____h_____
- .byte $01 ; 105/69 _____i_____
- .byte $01 ; 106/6a _____j_____
- .byte $01 ; 107/6b _____k_____
- .byte $01 ; 108/6c _____l_____
- .byte $01 ; 109/6d _____m_____
- .byte $01 ; 110/6e _____n_____
- .byte $01 ; 111/6f _____o_____
- .byte $01 ; 112/70 _____p_____
- .byte $01 ; 113/71 _____q_____
- .byte $01 ; 114/72 _____r_____
- .byte $01 ; 115/73 _____s_____
- .byte $01 ; 116/74 _____t_____
- .byte $01 ; 117/75 _____u_____
- .byte $01 ; 118/76 _____v_____
- .byte $01 ; 119/77 _____w_____
- .byte $01 ; 120/78 _____x_____
- .byte $01 ; 121/79 _____y_____
- .byte $01 ; 122/7a _____z_____
- .byte $00 ; 123/7b _____{_____
- .byte $00 ; 124/7c _____|_____
- .byte $00 ; 125/7d _____}_____
- .byte $00 ; 126/7e _____~_____
- .byte $40 ; 127/7f ____DEL____
-
-.endrepeat
+ .include "ctype_console.inc"
diff --git a/libsrc/nes/ctype.s b/libsrc/nes/ctype.s
index 6e0ab178..da4d3847 100644
--- a/libsrc/nes/ctype.s
+++ b/libsrc/nes/ctype.s
@@ -1,172 +1,5 @@
-;
-; Ullrich von Bassewitz, 02.06.1998
-;
; Character specification table.
;
+; uses the "console" definition
-; The tables are readonly, put them into the rodata segment
-
-.rodata
-
-; The following 256 byte wide table specifies attributes for the isxxx type
-; of functions. Doing it by a table means some overhead in space, but it
-; has major advantages:
-;
-; * It is fast. If it were'nt for the slow parameter passing of cc65, one
-; could even define macros for the isxxx functions (this is usually
-; done on other platforms).
-;
-; * It is highly portable. The only unportable part is the table itself,
-; all real code goes into the common library.
-;
-; * We save some code in the isxxx functions.
-;
-;
-; Bit assignments:
-;
-; 0 - Lower case char
-; 1 - Upper case char
-; 2 - Numeric digit
-; 3 - Hex digit (both, lower and upper)
-; 4 - Control character
-; 5 - The space character itself
-; 6 - Other whitespace (that is: '\f', '\n', '\r', '\t' and '\v')
-; 7 - Space or tab character
-
- .export __ctype
-
-__ctype:
-
-.repeat 2 ; 2 times for normal and inverted
-
- .byte $10 ; 0/00 ___ctrl_@___
- .byte $10 ; 1/01 ___ctrl_A___
- .byte $10 ; 2/02 ___ctrl_B___
- .byte $10 ; 3/03 ___ctrl_C___
- .byte $10 ; 4/04 ___ctrl_D___
- .byte $10 ; 5/05 ___ctrl_E___
- .byte $10 ; 6/06 ___ctrl_F___
- .byte $10 ; 7/07 ___ctrl_G___
- .byte $10 ; 8/08 ___ctrl_H___
- .byte $D0 ; 9/09 ___ctrl_I___
- .byte $50 ; 10/0a ___ctrl_J___
- .byte $50 ; 11/0b ___ctrl_K___
- .byte $50 ; 12/0c ___ctrl_L___
- .byte $50 ; 13/0d ___ctrl_M___
- .byte $10 ; 14/0e ___ctrl_N___
- .byte $10 ; 15/0f ___ctrl_O___
- .byte $10 ; 16/10 ___ctrl_P___
- .byte $10 ; 17/11 ___ctrl_Q___
- .byte $10 ; 18/12 ___ctrl_R___
- .byte $10 ; 19/13 ___ctrl_S___
- .byte $10 ; 20/14 ___ctrl_T___
- .byte $10 ; 21/15 ___ctrl_U___
- .byte $10 ; 22/16 ___ctrl_V___
- .byte $10 ; 23/17 ___ctrl_W___
- .byte $10 ; 24/18 ___ctrl_X___
- .byte $10 ; 25/19 ___ctrl_Y___
- .byte $10 ; 26/1a ___ctrl_Z___
- .byte $10 ; 27/1b ___ctrl_[___
- .byte $10 ; 28/1c ___ctrl_\___
- .byte $10 ; 29/1d ___ctrl_]___
- .byte $10 ; 30/1e ___ctrl_^___
- .byte $10 ; 31/1f ___ctrl_____
- .byte $A0 ; 32/20 ___SPACE___
- .byte $00 ; 33/21 _____!_____
- .byte $00 ; 34/22 _____"_____
- .byte $00 ; 35/23 _____#_____
- .byte $00 ; 36/24 _____$_____
- .byte $00 ; 37/25 _____%_____
- .byte $00 ; 38/26 _____&_____
- .byte $00 ; 39/27 _____'_____
- .byte $00 ; 40/28 _____(_____
- .byte $00 ; 41/29 _____)_____
- .byte $00 ; 42/2a _____*_____
- .byte $00 ; 43/2b _____+_____
- .byte $00 ; 44/2c _____,_____
- .byte $00 ; 45/2d _____-_____
- .byte $00 ; 46/2e _____._____
- .byte $00 ; 47/2f _____/_____
- .byte $0C ; 48/30 _____0_____
- .byte $0C ; 49/31 _____1_____
- .byte $0C ; 50/32 _____2_____
- .byte $0C ; 51/33 _____3_____
- .byte $0C ; 52/34 _____4_____
- .byte $0C ; 53/35 _____5_____
- .byte $0C ; 54/36 _____6_____
- .byte $0C ; 55/37 _____7_____
- .byte $0C ; 56/38 _____8_____
- .byte $0C ; 57/39 _____9_____
- .byte $00 ; 58/3a _____:_____
- .byte $00 ; 59/3b _____;_____
- .byte $00 ; 60/3c _____<_____
- .byte $00 ; 61/3d _____=_____
- .byte $00 ; 62/3e _____>_____
- .byte $00 ; 63/3f _____?_____
-
- .byte $00 ; 64/40 _____@_____
- .byte $0A ; 65/41 _____A_____
- .byte $0A ; 66/42 _____B_____
- .byte $0A ; 67/43 _____C_____
- .byte $0A ; 68/44 _____D_____
- .byte $0A ; 69/45 _____E_____
- .byte $0A ; 70/46 _____F_____
- .byte $02 ; 71/47 _____G_____
- .byte $02 ; 72/48 _____H_____
- .byte $02 ; 73/49 _____I_____
- .byte $02 ; 74/4a _____J_____
- .byte $02 ; 75/4b _____K_____
- .byte $02 ; 76/4c _____L_____
- .byte $02 ; 77/4d _____M_____
- .byte $02 ; 78/4e _____N_____
- .byte $02 ; 79/4f _____O_____
- .byte $02 ; 80/50 _____P_____
- .byte $02 ; 81/51 _____Q_____
- .byte $02 ; 82/52 _____R_____
- .byte $02 ; 83/53 _____S_____
- .byte $02 ; 84/54 _____T_____
- .byte $02 ; 85/55 _____U_____
- .byte $02 ; 86/56 _____V_____
- .byte $02 ; 87/57 _____W_____
- .byte $02 ; 88/58 _____X_____
- .byte $02 ; 89/59 _____Y_____
- .byte $02 ; 90/5a _____Z_____
- .byte $00 ; 91/5b _____[_____
- .byte $00 ; 92/5c _____\_____
- .byte $00 ; 93/5d _____]_____
- .byte $00 ; 94/5e _____^_____
- .byte $00 ; 95/5f _UNDERLINE_
- .byte $00 ; 96/60 ___grave___
- .byte $09 ; 97/61 _____a_____
- .byte $09 ; 98/62 _____b_____
- .byte $09 ; 99/63 _____c_____
- .byte $09 ; 100/64 _____d_____
- .byte $09 ; 101/65 _____e_____
- .byte $09 ; 102/66 _____f_____
- .byte $01 ; 103/67 _____g_____
- .byte $01 ; 104/68 _____h_____
- .byte $01 ; 105/69 _____i_____
- .byte $01 ; 106/6a _____j_____
- .byte $01 ; 107/6b _____k_____
- .byte $01 ; 108/6c _____l_____
- .byte $01 ; 109/6d _____m_____
- .byte $01 ; 110/6e _____n_____
- .byte $01 ; 111/6f _____o_____
- .byte $01 ; 112/70 _____p_____
- .byte $01 ; 113/71 _____q_____
- .byte $01 ; 114/72 _____r_____
- .byte $01 ; 115/73 _____s_____
- .byte $01 ; 116/74 _____t_____
- .byte $01 ; 117/75 _____u_____
- .byte $01 ; 118/76 _____v_____
- .byte $01 ; 119/77 _____w_____
- .byte $01 ; 120/78 _____x_____
- .byte $01 ; 121/79 _____y_____
- .byte $01 ; 122/7a _____z_____
- .byte $00 ; 123/7b _____{_____
- .byte $00 ; 124/7c _____|_____
- .byte $00 ; 125/7d _____}_____
- .byte $00 ; 126/7e _____~_____
- .byte $40 ; 127/7f ____DEL____
-
-.endrepeat
+ .include "ctype_console.inc"
diff --git a/libsrc/none/ctype.s b/libsrc/none/ctype.s
index 35968f98..1301965e 100644
--- a/libsrc/none/ctype.s
+++ b/libsrc/none/ctype.s
@@ -1,159 +1,5 @@
-;
-; Ullrich von Bassewitz, 2003-10-10
-;
; Character specification table.
;
+; uses the "common" definition
- .include "ctype.inc"
-
-; The tables are readonly, put them into the rodata segment
-
-.rodata
-
-; The following 256 byte wide table specifies attributes for the isxxx type
-; of functions. Doing it by a table means some overhead in space, but it
-; has major advantages:
-;
-; * It is fast. If it weren't for the slow parameter passing of cc65, one
-; could even define macros for the isxxx functions (this is usually
-; done on other platforms).
-;
-; * It is highly portable. The only unportable part is the table itself,
-; all real code goes into the common library.
-;
-; * We save some code in the isxxx functions.
-
-
-__ctype:
- .byte CT_CTRL ; 0/00 ___ctrl_@___
- .byte CT_CTRL ; 1/01 ___ctrl_A___
- .byte CT_CTRL ; 2/02 ___ctrl_B___
- .byte CT_CTRL ; 3/03 ___ctrl_C___
- .byte CT_CTRL ; 4/04 ___ctrl_D___
- .byte CT_CTRL ; 5/05 ___ctrl_E___
- .byte CT_CTRL ; 6/06 ___ctrl_F___
- .byte CT_CTRL ; 7/07 ___ctrl_G___
- .byte CT_CTRL ; 8/08 ___ctrl_H___
- .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB
- ; 9/09 ___ctrl_I___
- .byte CT_CTRL | CT_OTHER_WS ; 10/0a ___ctrl_J___
- .byte CT_CTRL | CT_OTHER_WS ; 11/0b ___ctrl_K___
- .byte CT_CTRL | CT_OTHER_WS ; 12/0c ___ctrl_L___
- .byte CT_CTRL | CT_OTHER_WS ; 13/0d ___ctrl_M___
- .byte CT_CTRL ; 14/0e ___ctrl_N___
- .byte CT_CTRL ; 15/0f ___ctrl_O___
- .byte CT_CTRL ; 16/10 ___ctrl_P___
- .byte CT_CTRL ; 17/11 ___ctrl_Q___
- .byte CT_CTRL ; 18/12 ___ctrl_R___
- .byte CT_CTRL ; 19/13 ___ctrl_S___
- .byte CT_CTRL ; 20/14 ___ctrl_T___
- .byte CT_CTRL ; 21/15 ___ctrl_U___
- .byte CT_CTRL ; 22/16 ___ctrl_V___
- .byte CT_CTRL ; 23/17 ___ctrl_W___
- .byte CT_CTRL ; 24/18 ___ctrl_X___
- .byte CT_CTRL ; 25/19 ___ctrl_Y___
- .byte CT_CTRL ; 26/1a ___ctrl_Z___
- .byte CT_CTRL ; 27/1b ___ctrl_[___
- .byte CT_CTRL ; 28/1c ___ctrl_\___
- .byte CT_CTRL ; 29/1d ___ctrl_]___
- .byte CT_CTRL ; 30/1e ___ctrl_^___
- .byte CT_CTRL ; 31/1f ___ctrl_____
- .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___
- .byte CT_NONE ; 33/21 _____!_____
- .byte CT_NONE ; 34/22 _____"_____
- .byte CT_NONE ; 35/23 _____#_____
- .byte CT_NONE ; 36/24 _____$_____
- .byte CT_NONE ; 37/25 _____%_____
- .byte CT_NONE ; 38/26 _____&_____
- .byte CT_NONE ; 39/27 _____'_____
- .byte CT_NONE ; 40/28 _____(_____
- .byte CT_NONE ; 41/29 _____)_____
- .byte CT_NONE ; 42/2a _____*_____
- .byte CT_NONE ; 43/2b _____+_____
- .byte CT_NONE ; 44/2c _____,_____
- .byte CT_NONE ; 45/2d _____-_____
- .byte CT_NONE ; 46/2e _____._____
- .byte CT_NONE ; 47/2f _____/_____
- .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____
- .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____
- .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____
- .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____
- .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____
- .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____
- .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____
- .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____
- .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____
- .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____
- .byte CT_NONE ; 58/3a _____:_____
- .byte CT_NONE ; 59/3b _____;_____
- .byte CT_NONE ; 60/3c _____<_____
- .byte CT_NONE ; 61/3d _____=_____
- .byte CT_NONE ; 62/3e _____>_____
- .byte CT_NONE ; 63/3f _____?_____
-
- .byte CT_NONE ; 64/40 _____@_____
- .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____
- .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____
- .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____
- .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____
- .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____
- .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____
- .byte CT_UPPER ; 71/47 _____G_____
- .byte CT_UPPER ; 72/48 _____H_____
- .byte CT_UPPER ; 73/49 _____I_____
- .byte CT_UPPER ; 74/4a _____J_____
- .byte CT_UPPER ; 75/4b _____K_____
- .byte CT_UPPER ; 76/4c _____L_____
- .byte CT_UPPER ; 77/4d _____M_____
- .byte CT_UPPER ; 78/4e _____N_____
- .byte CT_UPPER ; 79/4f _____O_____
- .byte CT_UPPER ; 80/50 _____P_____
- .byte CT_UPPER ; 81/51 _____Q_____
- .byte CT_UPPER ; 82/52 _____R_____
- .byte CT_UPPER ; 83/53 _____S_____
- .byte CT_UPPER ; 84/54 _____T_____
- .byte CT_UPPER ; 85/55 _____U_____
- .byte CT_UPPER ; 86/56 _____V_____
- .byte CT_UPPER ; 87/57 _____W_____
- .byte CT_UPPER ; 88/58 _____X_____
- .byte CT_UPPER ; 89/59 _____Y_____
- .byte CT_UPPER ; 90/5a _____Z_____
- .byte CT_NONE ; 91/5b _____[_____
- .byte CT_NONE ; 92/5c _____\_____
- .byte CT_NONE ; 93/5d _____]_____
- .byte CT_NONE ; 94/5e _____^_____
- .byte CT_NONE ; 95/5f _UNDERLINE_
- .byte CT_NONE ; 96/60 ___grave___
- .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____
- .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____
- .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____
- .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____
- .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____
- .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____
- .byte CT_LOWER ; 103/67 _____g_____
- .byte CT_LOWER ; 104/68 _____h_____
- .byte CT_LOWER ; 105/69 _____i_____
- .byte CT_LOWER ; 106/6a _____j_____
- .byte CT_LOWER ; 107/6b _____k_____
- .byte CT_LOWER ; 108/6c _____l_____
- .byte CT_LOWER ; 109/6d _____m_____
- .byte CT_LOWER ; 110/6e _____n_____
- .byte CT_LOWER ; 111/6f _____o_____
- .byte CT_LOWER ; 112/70 _____p_____
- .byte CT_LOWER ; 113/71 _____q_____
- .byte CT_LOWER ; 114/72 _____r_____
- .byte CT_LOWER ; 115/73 _____s_____
- .byte CT_LOWER ; 116/74 _____t_____
- .byte CT_LOWER ; 117/75 _____u_____
- .byte CT_LOWER ; 118/76 _____v_____
- .byte CT_LOWER ; 119/77 _____w_____
- .byte CT_LOWER ; 120/78 _____x_____
- .byte CT_LOWER ; 121/79 _____y_____
- .byte CT_LOWER ; 122/7a _____z_____
- .byte CT_NONE ; 123/7b _____{_____
- .byte CT_NONE ; 124/7c _____|_____
- .byte CT_NONE ; 125/7d _____}_____
- .byte CT_NONE ; 126/7e _____~_____
- .byte CT_OTHER_WS ; 127/7f ____DEL____
-
- .res 128, CT_NONE ; 128-255
+ .include "ctype_common.inc"
diff --git a/libsrc/osic1p/ctype.s b/libsrc/osic1p/ctype.s
index 35968f98..1301965e 100644
--- a/libsrc/osic1p/ctype.s
+++ b/libsrc/osic1p/ctype.s
@@ -1,159 +1,5 @@
-;
-; Ullrich von Bassewitz, 2003-10-10
-;
; Character specification table.
;
+; uses the "common" definition
- .include "ctype.inc"
-
-; The tables are readonly, put them into the rodata segment
-
-.rodata
-
-; The following 256 byte wide table specifies attributes for the isxxx type
-; of functions. Doing it by a table means some overhead in space, but it
-; has major advantages:
-;
-; * It is fast. If it weren't for the slow parameter passing of cc65, one
-; could even define macros for the isxxx functions (this is usually
-; done on other platforms).
-;
-; * It is highly portable. The only unportable part is the table itself,
-; all real code goes into the common library.
-;
-; * We save some code in the isxxx functions.
-
-
-__ctype:
- .byte CT_CTRL ; 0/00 ___ctrl_@___
- .byte CT_CTRL ; 1/01 ___ctrl_A___
- .byte CT_CTRL ; 2/02 ___ctrl_B___
- .byte CT_CTRL ; 3/03 ___ctrl_C___
- .byte CT_CTRL ; 4/04 ___ctrl_D___
- .byte CT_CTRL ; 5/05 ___ctrl_E___
- .byte CT_CTRL ; 6/06 ___ctrl_F___
- .byte CT_CTRL ; 7/07 ___ctrl_G___
- .byte CT_CTRL ; 8/08 ___ctrl_H___
- .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB
- ; 9/09 ___ctrl_I___
- .byte CT_CTRL | CT_OTHER_WS ; 10/0a ___ctrl_J___
- .byte CT_CTRL | CT_OTHER_WS ; 11/0b ___ctrl_K___
- .byte CT_CTRL | CT_OTHER_WS ; 12/0c ___ctrl_L___
- .byte CT_CTRL | CT_OTHER_WS ; 13/0d ___ctrl_M___
- .byte CT_CTRL ; 14/0e ___ctrl_N___
- .byte CT_CTRL ; 15/0f ___ctrl_O___
- .byte CT_CTRL ; 16/10 ___ctrl_P___
- .byte CT_CTRL ; 17/11 ___ctrl_Q___
- .byte CT_CTRL ; 18/12 ___ctrl_R___
- .byte CT_CTRL ; 19/13 ___ctrl_S___
- .byte CT_CTRL ; 20/14 ___ctrl_T___
- .byte CT_CTRL ; 21/15 ___ctrl_U___
- .byte CT_CTRL ; 22/16 ___ctrl_V___
- .byte CT_CTRL ; 23/17 ___ctrl_W___
- .byte CT_CTRL ; 24/18 ___ctrl_X___
- .byte CT_CTRL ; 25/19 ___ctrl_Y___
- .byte CT_CTRL ; 26/1a ___ctrl_Z___
- .byte CT_CTRL ; 27/1b ___ctrl_[___
- .byte CT_CTRL ; 28/1c ___ctrl_\___
- .byte CT_CTRL ; 29/1d ___ctrl_]___
- .byte CT_CTRL ; 30/1e ___ctrl_^___
- .byte CT_CTRL ; 31/1f ___ctrl_____
- .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___
- .byte CT_NONE ; 33/21 _____!_____
- .byte CT_NONE ; 34/22 _____"_____
- .byte CT_NONE ; 35/23 _____#_____
- .byte CT_NONE ; 36/24 _____$_____
- .byte CT_NONE ; 37/25 _____%_____
- .byte CT_NONE ; 38/26 _____&_____
- .byte CT_NONE ; 39/27 _____'_____
- .byte CT_NONE ; 40/28 _____(_____
- .byte CT_NONE ; 41/29 _____)_____
- .byte CT_NONE ; 42/2a _____*_____
- .byte CT_NONE ; 43/2b _____+_____
- .byte CT_NONE ; 44/2c _____,_____
- .byte CT_NONE ; 45/2d _____-_____
- .byte CT_NONE ; 46/2e _____._____
- .byte CT_NONE ; 47/2f _____/_____
- .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____
- .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____
- .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____
- .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____
- .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____
- .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____
- .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____
- .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____
- .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____
- .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____
- .byte CT_NONE ; 58/3a _____:_____
- .byte CT_NONE ; 59/3b _____;_____
- .byte CT_NONE ; 60/3c _____<_____
- .byte CT_NONE ; 61/3d _____=_____
- .byte CT_NONE ; 62/3e _____>_____
- .byte CT_NONE ; 63/3f _____?_____
-
- .byte CT_NONE ; 64/40 _____@_____
- .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____
- .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____
- .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____
- .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____
- .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____
- .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____
- .byte CT_UPPER ; 71/47 _____G_____
- .byte CT_UPPER ; 72/48 _____H_____
- .byte CT_UPPER ; 73/49 _____I_____
- .byte CT_UPPER ; 74/4a _____J_____
- .byte CT_UPPER ; 75/4b _____K_____
- .byte CT_UPPER ; 76/4c _____L_____
- .byte CT_UPPER ; 77/4d _____M_____
- .byte CT_UPPER ; 78/4e _____N_____
- .byte CT_UPPER ; 79/4f _____O_____
- .byte CT_UPPER ; 80/50 _____P_____
- .byte CT_UPPER ; 81/51 _____Q_____
- .byte CT_UPPER ; 82/52 _____R_____
- .byte CT_UPPER ; 83/53 _____S_____
- .byte CT_UPPER ; 84/54 _____T_____
- .byte CT_UPPER ; 85/55 _____U_____
- .byte CT_UPPER ; 86/56 _____V_____
- .byte CT_UPPER ; 87/57 _____W_____
- .byte CT_UPPER ; 88/58 _____X_____
- .byte CT_UPPER ; 89/59 _____Y_____
- .byte CT_UPPER ; 90/5a _____Z_____
- .byte CT_NONE ; 91/5b _____[_____
- .byte CT_NONE ; 92/5c _____\_____
- .byte CT_NONE ; 93/5d _____]_____
- .byte CT_NONE ; 94/5e _____^_____
- .byte CT_NONE ; 95/5f _UNDERLINE_
- .byte CT_NONE ; 96/60 ___grave___
- .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____
- .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____
- .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____
- .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____
- .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____
- .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____
- .byte CT_LOWER ; 103/67 _____g_____
- .byte CT_LOWER ; 104/68 _____h_____
- .byte CT_LOWER ; 105/69 _____i_____
- .byte CT_LOWER ; 106/6a _____j_____
- .byte CT_LOWER ; 107/6b _____k_____
- .byte CT_LOWER ; 108/6c _____l_____
- .byte CT_LOWER ; 109/6d _____m_____
- .byte CT_LOWER ; 110/6e _____n_____
- .byte CT_LOWER ; 111/6f _____o_____
- .byte CT_LOWER ; 112/70 _____p_____
- .byte CT_LOWER ; 113/71 _____q_____
- .byte CT_LOWER ; 114/72 _____r_____
- .byte CT_LOWER ; 115/73 _____s_____
- .byte CT_LOWER ; 116/74 _____t_____
- .byte CT_LOWER ; 117/75 _____u_____
- .byte CT_LOWER ; 118/76 _____v_____
- .byte CT_LOWER ; 119/77 _____w_____
- .byte CT_LOWER ; 120/78 _____x_____
- .byte CT_LOWER ; 121/79 _____y_____
- .byte CT_LOWER ; 122/7a _____z_____
- .byte CT_NONE ; 123/7b _____{_____
- .byte CT_NONE ; 124/7c _____|_____
- .byte CT_NONE ; 125/7d _____}_____
- .byte CT_NONE ; 126/7e _____~_____
- .byte CT_OTHER_WS ; 127/7f ____DEL____
-
- .res 128, CT_NONE ; 128-255
+ .include "ctype_common.inc"
diff --git a/libsrc/pce/ctype.s b/libsrc/pce/ctype.s
index 1ee51b23..da4d3847 100644
--- a/libsrc/pce/ctype.s
+++ b/libsrc/pce/ctype.s
@@ -1,158 +1,5 @@
-;
-; Stefan Haubenthal with minor changes from Ullrich von Bassewitz, 2003-05-02
-;
; Character specification table.
;
+; uses the "console" definition
- .include "ctype.inc"
-
-; The tables are read-only; put them into the RODATA segment.
-
-.rodata
-
-; The following 256-byte-wide table specifies attributes for the isxxx type
-; of functions. Doing it by a table means some overhead in space, but it
-; has major advantages:
-;
-; * It is fast. If it weren't for the slow parameter passing of cc65, one
-; could even define macros for the isxxx functions (this is usually
-; done on other platforms).
-;
-; * It is highly portable. The only unportable part is the table itself,
-; all real code goes into the common library.
-;
-; * We save some code in the isxxx functions.
-
-__ctype:
- .repeat 2
- .byte CT_CTRL ; 0/00 ___ctrl_@___
- .byte CT_CTRL ; 1/01 ___ctrl_A___
- .byte CT_CTRL ; 2/02 ___ctrl_B___
- .byte CT_CTRL ; 3/03 ___ctrl_C___
- .byte CT_CTRL ; 4/04 ___ctrl_D___
- .byte CT_CTRL ; 5/05 ___ctrl_E___
- .byte CT_CTRL ; 6/06 ___ctrl_F___
- .byte CT_CTRL ; 7/07 ___ctrl_G___
- .byte CT_CTRL ; 8/08 ___ctrl_H___
- .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB
- ; 9/09 ___ctrl_I___
- .byte CT_CTRL | CT_OTHER_WS ; 10/0a ___ctrl_J___
- .byte CT_CTRL | CT_OTHER_WS ; 11/0b ___ctrl_K___
- .byte CT_CTRL | CT_OTHER_WS ; 12/0c ___ctrl_L___
- .byte CT_CTRL | CT_OTHER_WS ; 13/0d ___ctrl_M___
- .byte CT_CTRL ; 14/0e ___ctrl_N___
- .byte CT_CTRL ; 15/0f ___ctrl_O___
- .byte CT_CTRL ; 16/10 ___ctrl_P___
- .byte CT_CTRL ; 17/11 ___ctrl_Q___
- .byte CT_CTRL ; 18/12 ___ctrl_R___
- .byte CT_CTRL ; 19/13 ___ctrl_S___
- .byte CT_CTRL ; 20/14 ___ctrl_T___
- .byte CT_CTRL ; 21/15 ___ctrl_U___
- .byte CT_CTRL ; 22/16 ___ctrl_V___
- .byte CT_CTRL ; 23/17 ___ctrl_W___
- .byte CT_CTRL ; 24/18 ___ctrl_X___
- .byte CT_CTRL ; 25/19 ___ctrl_Y___
- .byte CT_CTRL ; 26/1a ___ctrl_Z___
- .byte CT_CTRL ; 27/1b ___ctrl_[___
- .byte CT_CTRL ; 28/1c ___ctrl_\___
- .byte CT_CTRL ; 29/1d ___ctrl_]___
- .byte CT_CTRL ; 30/1e ___ctrl_^___
- .byte CT_CTRL ; 31/1f ___ctrl_____
- .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___
- .byte CT_NONE ; 33/21 _____!_____
- .byte CT_NONE ; 34/22 _____"_____
- .byte CT_NONE ; 35/23 _____#_____
- .byte CT_NONE ; 36/24 _____$_____
- .byte CT_NONE ; 37/25 _____%_____
- .byte CT_NONE ; 38/26 _____&_____
- .byte CT_NONE ; 39/27 _____'_____
- .byte CT_NONE ; 40/28 _____(_____
- .byte CT_NONE ; 41/29 _____)_____
- .byte CT_NONE ; 42/2a _____*_____
- .byte CT_NONE ; 43/2b _____+_____
- .byte CT_NONE ; 44/2c _____,_____
- .byte CT_NONE ; 45/2d _____-_____
- .byte CT_NONE ; 46/2e _____._____
- .byte CT_NONE ; 47/2f _____/_____
- .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____
- .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____
- .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____
- .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____
- .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____
- .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____
- .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____
- .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____
- .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____
- .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____
- .byte CT_NONE ; 58/3a _____:_____
- .byte CT_NONE ; 59/3b _____;_____
- .byte CT_NONE ; 60/3c _____<_____
- .byte CT_NONE ; 61/3d _____=_____
- .byte CT_NONE ; 62/3e _____>_____
- .byte CT_NONE ; 63/3f _____?_____
-
- .byte CT_NONE ; 64/40 _____@_____
- .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____
- .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____
- .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____
- .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____
- .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____
- .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____
- .byte CT_UPPER ; 71/47 _____G_____
- .byte CT_UPPER ; 72/48 _____H_____
- .byte CT_UPPER ; 73/49 _____I_____
- .byte CT_UPPER ; 74/4a _____J_____
- .byte CT_UPPER ; 75/4b _____K_____
- .byte CT_UPPER ; 76/4c _____L_____
- .byte CT_UPPER ; 77/4d _____M_____
- .byte CT_UPPER ; 78/4e _____N_____
- .byte CT_UPPER ; 79/4f _____O_____
- .byte CT_UPPER ; 80/50 _____P_____
- .byte CT_UPPER ; 81/51 _____Q_____
- .byte CT_UPPER ; 82/52 _____R_____
- .byte CT_UPPER ; 83/53 _____S_____
- .byte CT_UPPER ; 84/54 _____T_____
- .byte CT_UPPER ; 85/55 _____U_____
- .byte CT_UPPER ; 86/56 _____V_____
- .byte CT_UPPER ; 87/57 _____W_____
- .byte CT_UPPER ; 88/58 _____X_____
- .byte CT_UPPER ; 89/59 _____Y_____
- .byte CT_UPPER ; 90/5a _____Z_____
- .byte CT_NONE ; 91/5b _____[_____
- .byte CT_NONE ; 92/5c _____\_____
- .byte CT_NONE ; 93/5d _____]_____
- .byte CT_NONE ; 94/5e _____^_____
- .byte CT_NONE ; 95/5f _UNDERLINE_
- .byte CT_NONE ; 96/60 ___grave___
- .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____
- .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____
- .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____
- .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____
- .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____
- .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____
- .byte CT_LOWER ; 103/67 _____g_____
- .byte CT_LOWER ; 104/68 _____h_____
- .byte CT_LOWER ; 105/69 _____i_____
- .byte CT_LOWER ; 106/6a _____j_____
- .byte CT_LOWER ; 107/6b _____k_____
- .byte CT_LOWER ; 108/6c _____l_____
- .byte CT_LOWER ; 109/6d _____m_____
- .byte CT_LOWER ; 110/6e _____n_____
- .byte CT_LOWER ; 111/6f _____o_____
- .byte CT_LOWER ; 112/70 _____p_____
- .byte CT_LOWER ; 113/71 _____q_____
- .byte CT_LOWER ; 114/72 _____r_____
- .byte CT_LOWER ; 115/73 _____s_____
- .byte CT_LOWER ; 116/74 _____t_____
- .byte CT_LOWER ; 117/75 _____u_____
- .byte CT_LOWER ; 118/76 _____v_____
- .byte CT_LOWER ; 119/77 _____w_____
- .byte CT_LOWER ; 120/78 _____x_____
- .byte CT_LOWER ; 121/79 _____y_____
- .byte CT_LOWER ; 122/7a _____z_____
- .byte CT_NONE ; 123/7b _____{_____
- .byte CT_NONE ; 124/7c _____|_____
- .byte CT_NONE ; 125/7d _____}_____
- .byte CT_NONE ; 126/7e _____~_____
- .byte CT_OTHER_WS ; 127/7f ____DEL____
- .endrepeat
+ .include "ctype_console.inc"
diff --git a/libsrc/sim6502/ctype.s b/libsrc/sim6502/ctype.s
index 35968f98..1301965e 100644
--- a/libsrc/sim6502/ctype.s
+++ b/libsrc/sim6502/ctype.s
@@ -1,159 +1,5 @@
-;
-; Ullrich von Bassewitz, 2003-10-10
-;
; Character specification table.
;
+; uses the "common" definition
- .include "ctype.inc"
-
-; The tables are readonly, put them into the rodata segment
-
-.rodata
-
-; The following 256 byte wide table specifies attributes for the isxxx type
-; of functions. Doing it by a table means some overhead in space, but it
-; has major advantages:
-;
-; * It is fast. If it weren't for the slow parameter passing of cc65, one
-; could even define macros for the isxxx functions (this is usually
-; done on other platforms).
-;
-; * It is highly portable. The only unportable part is the table itself,
-; all real code goes into the common library.
-;
-; * We save some code in the isxxx functions.
-
-
-__ctype:
- .byte CT_CTRL ; 0/00 ___ctrl_@___
- .byte CT_CTRL ; 1/01 ___ctrl_A___
- .byte CT_CTRL ; 2/02 ___ctrl_B___
- .byte CT_CTRL ; 3/03 ___ctrl_C___
- .byte CT_CTRL ; 4/04 ___ctrl_D___
- .byte CT_CTRL ; 5/05 ___ctrl_E___
- .byte CT_CTRL ; 6/06 ___ctrl_F___
- .byte CT_CTRL ; 7/07 ___ctrl_G___
- .byte CT_CTRL ; 8/08 ___ctrl_H___
- .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB
- ; 9/09 ___ctrl_I___
- .byte CT_CTRL | CT_OTHER_WS ; 10/0a ___ctrl_J___
- .byte CT_CTRL | CT_OTHER_WS ; 11/0b ___ctrl_K___
- .byte CT_CTRL | CT_OTHER_WS ; 12/0c ___ctrl_L___
- .byte CT_CTRL | CT_OTHER_WS ; 13/0d ___ctrl_M___
- .byte CT_CTRL ; 14/0e ___ctrl_N___
- .byte CT_CTRL ; 15/0f ___ctrl_O___
- .byte CT_CTRL ; 16/10 ___ctrl_P___
- .byte CT_CTRL ; 17/11 ___ctrl_Q___
- .byte CT_CTRL ; 18/12 ___ctrl_R___
- .byte CT_CTRL ; 19/13 ___ctrl_S___
- .byte CT_CTRL ; 20/14 ___ctrl_T___
- .byte CT_CTRL ; 21/15 ___ctrl_U___
- .byte CT_CTRL ; 22/16 ___ctrl_V___
- .byte CT_CTRL ; 23/17 ___ctrl_W___
- .byte CT_CTRL ; 24/18 ___ctrl_X___
- .byte CT_CTRL ; 25/19 ___ctrl_Y___
- .byte CT_CTRL ; 26/1a ___ctrl_Z___
- .byte CT_CTRL ; 27/1b ___ctrl_[___
- .byte CT_CTRL ; 28/1c ___ctrl_\___
- .byte CT_CTRL ; 29/1d ___ctrl_]___
- .byte CT_CTRL ; 30/1e ___ctrl_^___
- .byte CT_CTRL ; 31/1f ___ctrl_____
- .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___
- .byte CT_NONE ; 33/21 _____!_____
- .byte CT_NONE ; 34/22 _____"_____
- .byte CT_NONE ; 35/23 _____#_____
- .byte CT_NONE ; 36/24 _____$_____
- .byte CT_NONE ; 37/25 _____%_____
- .byte CT_NONE ; 38/26 _____&_____
- .byte CT_NONE ; 39/27 _____'_____
- .byte CT_NONE ; 40/28 _____(_____
- .byte CT_NONE ; 41/29 _____)_____
- .byte CT_NONE ; 42/2a _____*_____
- .byte CT_NONE ; 43/2b _____+_____
- .byte CT_NONE ; 44/2c _____,_____
- .byte CT_NONE ; 45/2d _____-_____
- .byte CT_NONE ; 46/2e _____._____
- .byte CT_NONE ; 47/2f _____/_____
- .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____
- .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____
- .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____
- .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____
- .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____
- .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____
- .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____
- .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____
- .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____
- .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____
- .byte CT_NONE ; 58/3a _____:_____
- .byte CT_NONE ; 59/3b _____;_____
- .byte CT_NONE ; 60/3c _____<_____
- .byte CT_NONE ; 61/3d _____=_____
- .byte CT_NONE ; 62/3e _____>_____
- .byte CT_NONE ; 63/3f _____?_____
-
- .byte CT_NONE ; 64/40 _____@_____
- .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____
- .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____
- .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____
- .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____
- .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____
- .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____
- .byte CT_UPPER ; 71/47 _____G_____
- .byte CT_UPPER ; 72/48 _____H_____
- .byte CT_UPPER ; 73/49 _____I_____
- .byte CT_UPPER ; 74/4a _____J_____
- .byte CT_UPPER ; 75/4b _____K_____
- .byte CT_UPPER ; 76/4c _____L_____
- .byte CT_UPPER ; 77/4d _____M_____
- .byte CT_UPPER ; 78/4e _____N_____
- .byte CT_UPPER ; 79/4f _____O_____
- .byte CT_UPPER ; 80/50 _____P_____
- .byte CT_UPPER ; 81/51 _____Q_____
- .byte CT_UPPER ; 82/52 _____R_____
- .byte CT_UPPER ; 83/53 _____S_____
- .byte CT_UPPER ; 84/54 _____T_____
- .byte CT_UPPER ; 85/55 _____U_____
- .byte CT_UPPER ; 86/56 _____V_____
- .byte CT_UPPER ; 87/57 _____W_____
- .byte CT_UPPER ; 88/58 _____X_____
- .byte CT_UPPER ; 89/59 _____Y_____
- .byte CT_UPPER ; 90/5a _____Z_____
- .byte CT_NONE ; 91/5b _____[_____
- .byte CT_NONE ; 92/5c _____\_____
- .byte CT_NONE ; 93/5d _____]_____
- .byte CT_NONE ; 94/5e _____^_____
- .byte CT_NONE ; 95/5f _UNDERLINE_
- .byte CT_NONE ; 96/60 ___grave___
- .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____
- .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____
- .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____
- .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____
- .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____
- .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____
- .byte CT_LOWER ; 103/67 _____g_____
- .byte CT_LOWER ; 104/68 _____h_____
- .byte CT_LOWER ; 105/69 _____i_____
- .byte CT_LOWER ; 106/6a _____j_____
- .byte CT_LOWER ; 107/6b _____k_____
- .byte CT_LOWER ; 108/6c _____l_____
- .byte CT_LOWER ; 109/6d _____m_____
- .byte CT_LOWER ; 110/6e _____n_____
- .byte CT_LOWER ; 111/6f _____o_____
- .byte CT_LOWER ; 112/70 _____p_____
- .byte CT_LOWER ; 113/71 _____q_____
- .byte CT_LOWER ; 114/72 _____r_____
- .byte CT_LOWER ; 115/73 _____s_____
- .byte CT_LOWER ; 116/74 _____t_____
- .byte CT_LOWER ; 117/75 _____u_____
- .byte CT_LOWER ; 118/76 _____v_____
- .byte CT_LOWER ; 119/77 _____w_____
- .byte CT_LOWER ; 120/78 _____x_____
- .byte CT_LOWER ; 121/79 _____y_____
- .byte CT_LOWER ; 122/7a _____z_____
- .byte CT_NONE ; 123/7b _____{_____
- .byte CT_NONE ; 124/7c _____|_____
- .byte CT_NONE ; 125/7d _____}_____
- .byte CT_NONE ; 126/7e _____~_____
- .byte CT_OTHER_WS ; 127/7f ____DEL____
-
- .res 128, CT_NONE ; 128-255
+ .include "ctype_common.inc"
diff --git a/libsrc/supervision/ctype.s b/libsrc/supervision/ctype.s
index 1892554f..1301965e 100644
--- a/libsrc/supervision/ctype.s
+++ b/libsrc/supervision/ctype.s
@@ -1,162 +1,5 @@
-;
-; Ullrich von Bassewitz, 2003-10-10
-;
; Character specification table.
;
+; uses the "common" definition
- .include "ctype.inc"
-
-; The tables are readonly, put them into the rodata segment
-
-.rodata
-
-; The following 256 byte wide table specifies attributes for the isxxx type
-; of functions. Doing it by a table means some overhead in space, but it
-; has major advantages:
-;
-; * It is fast. If it weren't for the slow parameter passing of cc65, one
-; could even define macros for the isxxx functions (this is usually
-; done on other platforms).
-;
-; * It is highly portable. The only unportable part is the table itself,
-; all real code goes into the common library.
-;
-; * We save some code in the isxxx functions.
-
-
-__ctype:
- .byte CT_CTRL ; 0/00 ___ctrl_@___
- .byte CT_CTRL ; 1/01 ___ctrl_A___
- .byte CT_CTRL ; 2/02 ___ctrl_B___
- .byte CT_CTRL ; 3/03 ___ctrl_C___
- .byte CT_CTRL ; 4/04 ___ctrl_D___
- .byte CT_CTRL ; 5/05 ___ctrl_E___
- .byte CT_CTRL ; 6/06 ___ctrl_F___
- .byte CT_CTRL ; 7/07 ___ctrl_G___
- .byte CT_CTRL ; 8/08 ___ctrl_H___
- .byte CT_CTRL | CT_OTHER_WS | CT_SPACE_TAB
- ; 9/09 ___ctrl_I___
- .byte CT_CTRL | CT_OTHER_WS ; 10/0a ___ctrl_J___
- .byte CT_CTRL | CT_OTHER_WS ; 11/0b ___ctrl_K___
- .byte CT_CTRL | CT_OTHER_WS ; 12/0c ___ctrl_L___
- .byte CT_CTRL | CT_OTHER_WS ; 13/0d ___ctrl_M___
- .byte CT_CTRL ; 14/0e ___ctrl_N___
- .byte CT_CTRL ; 15/0f ___ctrl_O___
- .byte CT_CTRL ; 16/10 ___ctrl_P___
- .byte CT_CTRL ; 17/11 ___ctrl_Q___
- .byte CT_CTRL ; 18/12 ___ctrl_R___
- .byte CT_CTRL ; 19/13 ___ctrl_S___
- .byte CT_CTRL ; 20/14 ___ctrl_T___
- .byte CT_CTRL ; 21/15 ___ctrl_U___
- .byte CT_CTRL ; 22/16 ___ctrl_V___
- .byte CT_CTRL ; 23/17 ___ctrl_W___
- .byte CT_CTRL ; 24/18 ___ctrl_X___
- .byte CT_CTRL ; 25/19 ___ctrl_Y___
- .byte CT_CTRL ; 26/1a ___ctrl_Z___
- .byte CT_CTRL ; 27/1b ___ctrl_[___
- .byte CT_CTRL ; 28/1c ___ctrl_\___
- .byte CT_CTRL ; 29/1d ___ctrl_]___
- .byte CT_CTRL ; 30/1e ___ctrl_^___
- .byte CT_CTRL ; 31/1f ___ctrl_____
- .byte CT_SPACE | CT_SPACE_TAB ; 32/20 ___SPACE___
- .byte CT_NONE ; 33/21 _____!_____
- .byte CT_NONE ; 34/22 _____"_____
- .byte CT_NONE ; 35/23 _____#_____
- .byte CT_NONE ; 36/24 _____$_____
- .byte CT_NONE ; 37/25 _____%_____
- .byte CT_NONE ; 38/26 _____&_____
- .byte CT_NONE ; 39/27 _____'_____
- .byte CT_NONE ; 40/28 _____(_____
- .byte CT_NONE ; 41/29 _____)_____
- .byte CT_NONE ; 42/2a _____*_____
- .byte CT_NONE ; 43/2b _____+_____
- .byte CT_NONE ; 44/2c _____,_____
- .byte CT_NONE ; 45/2d _____-_____
- .byte CT_NONE ; 46/2e _____._____
- .byte CT_NONE ; 47/2f _____/_____
- .byte CT_DIGIT | CT_XDIGIT ; 48/30 _____0_____
- .byte CT_DIGIT | CT_XDIGIT ; 49/31 _____1_____
- .byte CT_DIGIT | CT_XDIGIT ; 50/32 _____2_____
- .byte CT_DIGIT | CT_XDIGIT ; 51/33 _____3_____
- .byte CT_DIGIT | CT_XDIGIT ; 52/34 _____4_____
- .byte CT_DIGIT | CT_XDIGIT ; 53/35 _____5_____
- .byte CT_DIGIT | CT_XDIGIT ; 54/36 _____6_____
- .byte CT_DIGIT | CT_XDIGIT ; 55/37 _____7_____
- .byte CT_DIGIT | CT_XDIGIT ; 56/38 _____8_____
- .byte CT_DIGIT | CT_XDIGIT ; 57/39 _____9_____
- .byte CT_NONE ; 58/3a _____:_____
- .byte CT_NONE ; 59/3b _____;_____
- .byte CT_NONE ; 60/3c _____<_____
- .byte CT_NONE ; 61/3d _____=_____
- .byte CT_NONE ; 62/3e _____>_____
- .byte CT_NONE ; 63/3f _____?_____
-
- .byte CT_NONE ; 64/40 _____@_____
- .byte CT_UPPER | CT_XDIGIT ; 65/41 _____A_____
- .byte CT_UPPER | CT_XDIGIT ; 66/42 _____B_____
- .byte CT_UPPER | CT_XDIGIT ; 67/43 _____C_____
- .byte CT_UPPER | CT_XDIGIT ; 68/44 _____D_____
- .byte CT_UPPER | CT_XDIGIT ; 69/45 _____E_____
- .byte CT_UPPER | CT_XDIGIT ; 70/46 _____F_____
- .byte CT_UPPER ; 71/47 _____G_____
- .byte CT_UPPER ; 72/48 _____H_____
- .byte CT_UPPER ; 73/49 _____I_____
- .byte CT_UPPER ; 74/4a _____J_____
- .byte CT_UPPER ; 75/4b _____K_____
- .byte CT_UPPER ; 76/4c _____L_____
- .byte CT_UPPER ; 77/4d _____M_____
- .byte CT_UPPER ; 78/4e _____N_____
- .byte CT_UPPER ; 79/4f _____O_____
- .byte CT_UPPER ; 80/50 _____P_____
- .byte CT_UPPER ; 81/51 _____Q_____
- .byte CT_UPPER ; 82/52 _____R_____
- .byte CT_UPPER ; 83/53 _____S_____
- .byte CT_UPPER ; 84/54 _____T_____
- .byte CT_UPPER ; 85/55 _____U_____
- .byte CT_UPPER ; 86/56 _____V_____
- .byte CT_UPPER ; 87/57 _____W_____
- .byte CT_UPPER ; 88/58 _____X_____
- .byte CT_UPPER ; 89/59 _____Y_____
- .byte CT_UPPER ; 90/5a _____Z_____
- .byte CT_NONE ; 91/5b _____[_____
- .byte CT_NONE ; 92/5c _____\_____
- .byte CT_NONE ; 93/5d _____]_____
- .byte CT_NONE ; 94/5e _____^_____
- .byte CT_NONE ; 95/5f _UNDERLINE_
- .byte CT_NONE ; 96/60 ___grave___
- .byte CT_LOWER | CT_XDIGIT ; 97/61 _____a_____
- .byte CT_LOWER | CT_XDIGIT ; 98/62 _____b_____
- .byte CT_LOWER | CT_XDIGIT ; 99/63 _____c_____
- .byte CT_LOWER | CT_XDIGIT ; 100/64 _____d_____
- .byte CT_LOWER | CT_XDIGIT ; 101/65 _____e_____
- .byte CT_LOWER | CT_XDIGIT ; 102/66 _____f_____
- .byte CT_LOWER ; 103/67 _____g_____
- .byte CT_LOWER ; 104/68 _____h_____
- .byte CT_LOWER ; 105/69 _____i_____
- .byte CT_LOWER ; 106/6a _____j_____
- .byte CT_LOWER ; 107/6b _____k_____
- .byte CT_LOWER ; 108/6c _____l_____
- .byte CT_LOWER ; 109/6d _____m_____
- .byte CT_LOWER ; 110/6e _____n_____
- .byte CT_LOWER ; 111/6f _____o_____
- .byte CT_LOWER ; 112/70 _____p_____
- .byte CT_LOWER ; 113/71 _____q_____
- .byte CT_LOWER ; 114/72 _____r_____
- .byte CT_LOWER ; 115/73 _____s_____
- .byte CT_LOWER ; 116/74 _____t_____
- .byte CT_LOWER ; 117/75 _____u_____
- .byte CT_LOWER ; 118/76 _____v_____
- .byte CT_LOWER ; 119/77 _____w_____
- .byte CT_LOWER ; 120/78 _____x_____
- .byte CT_LOWER ; 121/79 _____y_____
- .byte CT_LOWER ; 122/7a _____z_____
- .byte CT_NONE ; 123/7b _____{_____
- .byte CT_NONE ; 124/7c _____|_____
- .byte CT_NONE ; 125/7d _____}_____
- .byte CT_NONE ; 126/7e _____~_____
- .byte CT_OTHER_WS ; 127/7f ____DEL____
-
- .res 128, CT_NONE ; 128-255
-
-
-
+ .include "ctype_common.inc"
diff --git a/libsrc/telestrat/ctype.s b/libsrc/telestrat/ctype.s
index 79edafbb..db61b1bb 100644
--- a/libsrc/telestrat/ctype.s
+++ b/libsrc/telestrat/ctype.s
@@ -1,299 +1,5 @@
-;
-; Ullrich von Bassewitz, 2003-04-13
-;
; Character specification table.
;
+; same as for "atmos" target
-; The tables are readonly, put them into the rodata segment
-
-.rodata
-
-; The following 256 byte wide table specifies attributes for the isxxx type
-; of functions. Doing it by a table means some overhead in space, but it
-; has major advantages:
-;
-; * It is fast. If it were'nt for the slow parameter passing of cc65, one
-; could even define macros for the isxxx functions (this is usually
-; done on other platforms).
-;
-; * It is highly portable. The only unportable part is the table itself,
-; all real code goes into the common library.
-;
-; * We save some code in the isxxx functions.
-;
-;
-; Bit assignments:
-;
-; 0 - Lower case char
-; 1 - Upper case char
-; 2 - Numeric digit
-; 3 - Hex digit (both, lower and upper)
-; 4 - Control character
-; 5 - The space character itself
-; 6 - Other whitespace (that is: '\f', '\n', '\r', '\t' and '\v')
-; 7 - Space or tab character
-
- .export __ctype
-
-__ctype:
- .byte $10 ; 0/00 ___ctrl_@___
- .byte $10 ; 1/01 ___ctrl_A___
- .byte $10 ; 2/02 ___ctrl_B___
- .byte $10 ; 3/03 ___ctrl_C___
- .byte $10 ; 4/04 ___ctrl_D___
- .byte $10 ; 5/05 ___ctrl_E___
- .byte $10 ; 6/06 ___ctrl_F___
- .byte $10 ; 7/07 ___ctrl_G___
- .byte $10 ; 8/08 ___ctrl_H___
- .byte $D0 ; 9/09 ___ctrl_I___
- .byte $50 ; 10/0a ___ctrl_J___
- .byte $50 ; 11/0b ___ctrl_K___
- .byte $50 ; 12/0c ___ctrl_L___
- .byte $50 ; 13/0d ___ctrl_M___
- .byte $10 ; 14/0e ___ctrl_N___
- .byte $10 ; 15/0f ___ctrl_O___
- .byte $10 ; 16/10 ___ctrl_P___
- .byte $10 ; 17/11 ___ctrl_Q___
- .byte $10 ; 18/12 ___ctrl_R___
- .byte $10 ; 19/13 ___ctrl_S___
- .byte $10 ; 20/14 ___ctrl_T___
- .byte $10 ; 21/15 ___ctrl_U___
- .byte $10 ; 22/16 ___ctrl_V___
- .byte $10 ; 23/17 ___ctrl_W___
- .byte $10 ; 24/18 ___ctrl_X___
- .byte $10 ; 25/19 ___ctrl_Y___
- .byte $10 ; 26/1a ___ctrl_Z___
- .byte $10 ; 27/1b ___ctrl_[___
- .byte $10 ; 28/1c ___ctrl_\___
- .byte $10 ; 29/1d ___ctrl_]___
- .byte $10 ; 30/1e ___ctrl_^___
- .byte $10 ; 31/1f ___ctrl_____
- .byte $A0 ; 32/20 ___SPACE___
- .byte $00 ; 33/21 _____!_____
- .byte $00 ; 34/22 _____"_____
- .byte $00 ; 35/23 _____#_____
- .byte $00 ; 36/24 _____$_____
- .byte $00 ; 37/25 _____%_____
- .byte $00 ; 38/26 _____&_____
- .byte $00 ; 39/27 _____'_____
- .byte $00 ; 40/28 _____(_____
- .byte $00 ; 41/29 _____)_____
- .byte $00 ; 42/2a _____*_____
- .byte $00 ; 43/2b _____+_____
- .byte $00 ; 44/2c _____,_____
- .byte $00 ; 45/2d _____-_____
- .byte $00 ; 46/2e _____._____
- .byte $00 ; 47/2f _____/_____
- .byte $0C ; 48/30 _____0_____
- .byte $0C ; 49/31 _____1_____
- .byte $0C ; 50/32 _____2_____
- .byte $0C ; 51/33 _____3_____
- .byte $0C ; 52/34 _____4_____
- .byte $0C ; 53/35 _____5_____
- .byte $0C ; 54/36 _____6_____
- .byte $0C ; 55/37 _____7_____
- .byte $0C ; 56/38 _____8_____
- .byte $0C ; 57/39 _____9_____
- .byte $00 ; 58/3a _____:_____
- .byte $00 ; 59/3b _____;_____
- .byte $00 ; 60/3c _____<_____
- .byte $00 ; 61/3d _____=_____
- .byte $00 ; 62/3e _____>_____
- .byte $00 ; 63/3f _____?_____
-
- .byte $00 ; 64/40 _____@_____
- .byte $0A ; 65/41 _____A_____
- .byte $0A ; 66/42 _____B_____
- .byte $0A ; 67/43 _____C_____
- .byte $0A ; 68/44 _____D_____
- .byte $0A ; 69/45 _____E_____
- .byte $0A ; 70/46 _____F_____
- .byte $02 ; 71/47 _____G_____
- .byte $02 ; 72/48 _____H_____
- .byte $02 ; 73/49 _____I_____
- .byte $02 ; 74/4a _____J_____
- .byte $02 ; 75/4b _____K_____
- .byte $02 ; 76/4c _____L_____
- .byte $02 ; 77/4d _____M_____
- .byte $02 ; 78/4e _____N_____
- .byte $02 ; 79/4f _____O_____
- .byte $02 ; 80/50 _____P_____
- .byte $02 ; 81/51 _____Q_____
- .byte $02 ; 82/52 _____R_____
- .byte $02 ; 83/53 _____S_____
- .byte $02 ; 84/54 _____T_____
- .byte $02 ; 85/55 _____U_____
- .byte $02 ; 86/56 _____V_____
- .byte $02 ; 87/57 _____W_____
- .byte $02 ; 88/58 _____X_____
- .byte $02 ; 89/59 _____Y_____
- .byte $02 ; 90/5a _____Z_____
- .byte $00 ; 91/5b _____[_____
- .byte $00 ; 92/5c _____\_____
- .byte $00 ; 93/5d _____]_____
- .byte $00 ; 94/5e _____^_____
- .byte $00 ; 95/5f _UNDERLINE_
- .byte $00 ; 96/60 ___grave___
- .byte $09 ; 97/61 _____a_____
- .byte $09 ; 98/62 _____b_____
- .byte $09 ; 99/63 _____c_____
- .byte $09 ; 100/64 _____d_____
- .byte $09 ; 101/65 _____e_____
- .byte $09 ; 102/66 _____f_____
- .byte $01 ; 103/67 _____g_____
- .byte $01 ; 104/68 _____h_____
- .byte $01 ; 105/69 _____i_____
- .byte $01 ; 106/6a _____j_____
- .byte $01 ; 107/6b _____k_____
- .byte $01 ; 108/6c _____l_____
- .byte $01 ; 109/6d _____m_____
- .byte $01 ; 110/6e _____n_____
- .byte $01 ; 111/6f _____o_____
- .byte $01 ; 112/70 _____p_____
- .byte $01 ; 113/71 _____q_____
- .byte $01 ; 114/72 _____r_____
- .byte $01 ; 115/73 _____s_____
- .byte $01 ; 116/74 _____t_____
- .byte $01 ; 117/75 _____u_____
- .byte $01 ; 118/76 _____v_____
- .byte $01 ; 119/77 _____w_____
- .byte $01 ; 120/78 _____x_____
- .byte $01 ; 121/79 _____y_____
- .byte $01 ; 122/7a _____z_____
- .byte $00 ; 123/7b _____{_____
- .byte $00 ; 124/7c _____|_____
- .byte $00 ; 125/7d _____}_____
- .byte $00 ; 126/7e _____~_____
- .byte $40 ; 127/7f ____DEL____
-
- .byte $00 ; 128/80 ___________
- .byte $00 ; 129/81 ___________
- .byte $00 ; 130/82 ___________
- .byte $00 ; 131/83 ___________
- .byte $00 ; 132/84 ___________
- .byte $00 ; 133/85 ___________
- .byte $00 ; 134/86 ___________
- .byte $00 ; 135/87 ___________
- .byte $00 ; 136/88 ___________
- .byte $00 ; 137/89 ___________
- .byte $00 ; 138/8a ___________
- .byte $00 ; 139/8b ___________
- .byte $00 ; 140/8c ___________
- .byte $00 ; 141/8d ___________
- .byte $00 ; 142/8e ___________
- .byte $00 ; 143/8f ___________
- .byte $00 ; 144/90 ___________
- .byte $00 ; 145/91 ___________
- .byte $00 ; 146/92 ___________
- .byte $10 ; 147/93 ___________
- .byte $00 ; 148/94 ___________
- .byte $00 ; 149/95 ___________
- .byte $00 ; 150/96 ___________
- .byte $00 ; 151/97 ___________
- .byte $00 ; 152/98 ___________
- .byte $00 ; 153/99 ___________
- .byte $00 ; 154/9a ___________
- .byte $00 ; 155/9b ___________
- .byte $00 ; 156/9c ___________
- .byte $00 ; 157/9d ___________
- .byte $00 ; 158/9e ___________
- .byte $00 ; 159/9f ___________
-
- .byte $00 ; 160/a0 ___________
- .byte $00 ; 161/a1 ___________
- .byte $00 ; 162/a2 ___________
- .byte $00 ; 163/a3 ___________
- .byte $00 ; 164/a4 ___________
- .byte $00 ; 165/a5 ___________
- .byte $00 ; 166/a6 ___________
- .byte $00 ; 167/a7 ___________
- .byte $00 ; 168/a8 ___________
- .byte $00 ; 169/a9 ___________
- .byte $00 ; 170/aa ___________
- .byte $00 ; 171/ab ___________
- .byte $00 ; 172/ac ___________
- .byte $00 ; 173/ad ___________
- .byte $00 ; 174/ae ___________
- .byte $00 ; 175/af ___________
- .byte $00 ; 176/b0 ___________
- .byte $00 ; 177/b1 ___________
- .byte $00 ; 178/b2 ___________
- .byte $00 ; 179/b3 ___________
- .byte $00 ; 180/b4 ___________
- .byte $00 ; 181/b5 ___________
- .byte $00 ; 182/b6 ___________
- .byte $00 ; 183/b7 ___________
- .byte $00 ; 184/b8 ___________
- .byte $00 ; 185/b9 ___________
- .byte $00 ; 186/ba ___________
- .byte $00 ; 187/bb ___________
- .byte $00 ; 188/bc ___________
- .byte $00 ; 189/bd ___________
- .byte $00 ; 190/be ___________
- .byte $00 ; 191/bf ___________
-
- .byte $02 ; 192/c0 ___________
- .byte $02 ; 193/c1 ___________
- .byte $02 ; 194/c2 ___________
- .byte $02 ; 195/c3 ___________
- .byte $02 ; 196/c4 ___________
- .byte $02 ; 197/c5 ___________
- .byte $02 ; 198/c6 ___________
- .byte $02 ; 199/c7 ___________
- .byte $02 ; 200/c8 ___________
- .byte $02 ; 201/c9 ___________
- .byte $02 ; 202/ca ___________
- .byte $02 ; 203/cb ___________
- .byte $02 ; 204/cc ___________
- .byte $02 ; 205/cd ___________
- .byte $02 ; 206/ce ___________
- .byte $02 ; 207/cf ___________
- .byte $02 ; 208/d0 ___________
- .byte $02 ; 209/d1 ___________
- .byte $02 ; 210/d2 ___________
- .byte $02 ; 211/d3 ___________
- .byte $02 ; 212/d4 ___________
- .byte $02 ; 213/d5 ___________
- .byte $02 ; 214/d6 ___________
- .byte $02 ; 215/d7 ___________
- .byte $02 ; 216/d8 ___________
- .byte $02 ; 217/d9 ___________
- .byte $02 ; 218/da ___________
- .byte $02 ; 219/db ___________
- .byte $02 ; 220/dc ___________
- .byte $02 ; 221/dd ___________
- .byte $02 ; 222/de ___________
- .byte $00 ; 223/df ___________
- .byte $01 ; 224/e0 ___________
- .byte $01 ; 225/e1 ___________
- .byte $01 ; 226/e2 ___________
- .byte $01 ; 227/e3 ___________
- .byte $01 ; 228/e4 ___________
- .byte $01 ; 229/e5 ___________
- .byte $01 ; 230/e6 ___________
- .byte $01 ; 231/e7 ___________
- .byte $01 ; 232/e8 ___________
- .byte $01 ; 233/e9 ___________
- .byte $01 ; 234/ea ___________
- .byte $01 ; 235/eb ___________
- .byte $01 ; 236/ec ___________
- .byte $01 ; 237/ed ___________
- .byte $01 ; 238/ee ___________
- .byte $01 ; 239/ef ___________
- .byte $01 ; 240/f0 ___________
- .byte $01 ; 241/f1 ___________
- .byte $01 ; 242/f2 ___________
- .byte $01 ; 243/f3 ___________
- .byte $01 ; 244/f4 ___________
- .byte $01 ; 245/f5 ___________
- .byte $01 ; 246/f6 ___________
- .byte $01 ; 247/f7 ___________
- .byte $01 ; 248/f8 ___________
- .byte $01 ; 249/f9 ___________
- .byte $01 ; 250/fa ___________
- .byte $01 ; 251/fb ___________
- .byte $01 ; 252/fc ___________
- .byte $01 ; 253/fd ___________
- .byte $01 ; 254/fe ___________
- .byte $00 ; 255/ff ___________
-
+.include "../atmos/ctype.s"
diff --git a/test/val/lib_common_ctype.c b/test/val/lib_common_ctype.c
new file mode 100644
index 00000000..15980aff
--- /dev/null
+++ b/test/val/lib_common_ctype.c
@@ -0,0 +1,368 @@
+// lib_common_ctype.c
+//
+// This file is part of
+// cc65 - a freeware C compiler for 6502 based systems
+//
+// https://github.com/cc65/cc65
+//
+// See "LICENSE" file for legal information.
+//
+// Unit test for character classification functions ("is..")
+//
+
+#include <ctype.h>
+#include <stdbool.h>
+#include "unittest.h"
+
+#define NUMTESTS 257
+
+typedef struct
+{
+ bool isalnum;
+ bool isalpha;
+ bool isascii;
+ bool iscntrl;
+ bool isdigit;
+ bool isgraph;
+ bool islower;
+ bool isprint;
+ bool ispunct;
+ bool isspace;
+ bool isupper;
+ bool isxdigit;
+ bool isblank;
+
+} CTypeClassifications;
+
+
+CTypeClassifications testSet[NUMTESTS] =
+{
+ //alnum, alpha, ascii, cntrl, digit, graph, lower, print, punct, space, upper, xdigit,blank
+
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 00
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 01
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 02
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 03
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 04
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 05
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 06
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 07
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 08
+ {false, false, true, true, false, false, false, false, false, true, false, false, true }, // 09
+ {false, false, true, true, false, false, false, false, false, true, false, false, false}, // 0A
+ {false, false, true, true, false, false, false, false, false, true, false, false, false}, // 0B
+ {false, false, true, true, false, false, false, false, false, true, false, false, false}, // 0C
+ {false, false, true, true, false, false, false, false, false, true, false, false, false}, // 0D
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 0E
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 0F
+
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 10
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 11
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 12
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 13
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 14
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 15
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 16
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 17
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 18
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 19
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 1A
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 1B
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 1C
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 1D
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 1E
+ {false, false, true, true, false, false, false, false, false, false, false, false, false}, // 1F
+
+ {false, false, true, false, false, false, false, true, false, true, false, false, true }, // 20
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 21
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 22
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 23
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 24
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 25
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 26
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 27
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 28
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 29
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 2A
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 2B
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 2C
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 2D
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 2E
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 2F
+
+ {true, false, true, false, true, true, false, true, false, false, false, true, false}, // 30
+ {true, false, true, false, true, true, false, true, false, false, false, true, false}, // 31
+ {true, false, true, false, true, true, false, true, false, false, false, true, false}, // 32
+ {true, false, true, false, true, true, false, true, false, false, false, true, false}, // 33
+ {true, false, true, false, true, true, false, true, false, false, false, true, false}, // 34
+ {true, false, true, false, true, true, false, true, false, false, false, true, false}, // 35
+ {true, false, true, false, true, true, false, true, false, false, false, true, false}, // 36
+ {true, false, true, false, true, true, false, true, false, false, false, true, false}, // 37
+ {true, false, true, false, true, true, false, true, false, false, false, true, false}, // 38
+ {true, false, true, false, true, true, false, true, false, false, false, true, false}, // 39
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 3A
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 3B
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 3C
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 3D
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 3E
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 3F
+
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 40
+ {true, true, true, false, false, true, false, true, false, false, true, true, false}, // 41
+ {true, true, true, false, false, true, false, true, false, false, true, true, false}, // 42
+ {true, true, true, false, false, true, false, true, false, false, true, true, false}, // 43
+ {true, true, true, false, false, true, false, true, false, false, true, true, false}, // 44
+ {true, true, true, false, false, true, false, true, false, false, true, true, false}, // 45
+ {true, true, true, false, false, true, false, true, false, false, true, true, false}, // 46
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 47
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 48
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 49
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 4A
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 4B
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 4C
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 4D
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 4E
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 4F
+
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 50
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 51
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 52
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 53
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 54
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 55
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 56
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 57
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 58
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 59
+ {true, true, true, false, false, true, false, true, false, false, true, false, false}, // 5A
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 5B
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 5C
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 5D
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 5E
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 5F
+
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 60
+ {true, true, true, false, false, true, true, true, false, false, false, true, false}, // 61
+ {true, true, true, false, false, true, true, true, false, false, false, true, false}, // 62
+ {true, true, true, false, false, true, true, true, false, false, false, true, false}, // 63
+ {true, true, true, false, false, true, true, true, false, false, false, true, false}, // 64
+ {true, true, true, false, false, true, true, true, false, false, false, true, false}, // 65
+ {true, true, true, false, false, true, true, true, false, false, false, true, false}, // 66
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 67
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 68
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 69
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 6A
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 6B
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 6C
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 6D
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 6E
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 6F
+
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 70
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 71
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 72
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 73
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 74
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 75
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 76
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 77
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 78
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 79
+ {true, true, true, false, false, true, true, true, false, false, false, false, false}, // 7A
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 7B
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 7C
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 7D
+ {false, false, true, false, false, true, false, true, true, false, false, false, false}, // 7E
+ {false, false, true, false, false, true, false, true, true, true, false, false, false}, // 7F
+
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 80
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 81
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 82
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 83
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 84
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 85
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 86
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 87
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 88
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 89
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 8A
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 8B
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 8C
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 8D
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 8E
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 8F
+
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 90
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 91
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 92
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 93
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 94
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 95
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 96
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 97
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 98
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 99
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 9A
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 9B
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 9C
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 9D
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 9E
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // 9F
+
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // A0
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // A1
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // A2
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // A3
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // A4
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // A5
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // A6
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // A7
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // A8
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // A9
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // AA
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // AB
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // AC
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // AD
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // AE
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // AF
+
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // B0
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // B1
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // B2
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // B3
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // B4
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // B5
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // B6
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // B7
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // B8
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // B9
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // BA
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // BB
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // BC
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // BD
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // BE
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // BF
+
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // C0
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // C1
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // C2
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // C3
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // C4
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // C5
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // C6
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // C7
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // C8
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // C9
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // CA
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // CB
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // CC
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // CD
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // CE
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // CF
+
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // D0
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // D1
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // D2
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // D3
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // D4
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // D5
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // D6
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // D7
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // D8
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // D9
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // DA
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // DB
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // DC
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // DD
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // DE
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // DF
+
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // E0
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // E1
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // E2
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // E3
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // E4
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // E5
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // E6
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // E7
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // E8
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // E9
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // EA
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // EB
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // EC
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // ED
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // EE
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // EF
+
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // F0
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // F1
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // F2
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // F3
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // F4
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // F5
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // F6
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // F7
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // F8
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // F9
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // FA
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // FB
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // FC
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // FD
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // FE
+ {false, false, false, false, false, true, false, true, true, false, false, false, false}, // FF
+
+ // out of range test
+ {false, false, false, false, false, false, false, false, false, false, false, false, false} // 100
+};
+
+
+TEST
+{
+ int i = 0;
+
+ while (i<NUMTESTS)
+ {
+ // isalnum()
+ ASSERT_AreEqual(testSet[i].isalnum, (isalnum(i) ? true : false), "%d", "Invalid 'isalnum(%d)' classification!" COMMA i);
+
+ // isalpha()
+ ASSERT_AreEqual(testSet[i].isalpha, (isalpha(i) ? true : false), "%d", "Invalid 'isalpha(%d)' classification!" COMMA i);
+
+ // isascii()
+ ASSERT_AreEqual(testSet[i].isascii, (isascii(i) ? true : false), "%d", "Invalid 'isascii(%d)' classification!" COMMA i);
+
+ // iscntrl()
+ ASSERT_AreEqual(testSet[i].iscntrl, (iscntrl(i) ? true : false), "%d", "Invalid 'iscntrl(%d)' classification!" COMMA i);
+
+ // isdigit()
+ ASSERT_AreEqual(testSet[i].isdigit, (isdigit(i) ? true : false), "%d", "Invalid 'isdigit(%d)' classification!" COMMA i);
+
+ // isgraph()
+ ASSERT_AreEqual(testSet[i].isgraph, (isgraph(i) ? true : false), "%d", "Invalid 'isgraph(%d)' classification!" COMMA i);
+
+ // islower()
+ ASSERT_AreEqual(testSet[i].islower, (islower(i) ? true : false), "%d", "Invalid 'islower(%d)' classification!" COMMA i);
+
+ // isprint()
+ ASSERT_AreEqual(testSet[i].isprint, (isprint(i) ? true : false), "%d", "Invalid 'isprint(%d)' classification!" COMMA i);
+
+ // ispunct()
+ ASSERT_AreEqual(testSet[i].ispunct, (ispunct(i) ? true : false), "%d", "Invalid 'ispunct(%d)' classification!" COMMA i);
+
+ // isspace()
+ ASSERT_AreEqual(testSet[i].isspace, (isspace(i) ? true : false), "%d", "Invalid 'isspace(%d)' classification!" COMMA i);
+
+ // isupper()
+ ASSERT_AreEqual(testSet[i].isupper, (isupper(i) ? true : false), "%d", "Invalid 'isupper(%d)' classification!" COMMA i);
+
+ // isxdigit()
+ ASSERT_AreEqual(testSet[i].isxdigit, (isxdigit(i) ? true : false), "%d", "Invalid 'isxdigit(%d)' classification!" COMMA i);
+
+#if __CC65_STD__ >= __CC65_STD_C99__
+ // isblank()
+ ASSERT_AreEqual(testSet[i].isblank, (isblank(i) ? true : false), "%d", "Invalid 'isblank(%d)' classification!" COMMA i);
+#endif
+ ++i;
+ }
+}
+ENDTEST
--
2.26.0