diff --git a/doc/keydef.txt b/doc/keydef.txt new file mode 100644 index 0000000..a3fe293 --- /dev/null +++ b/doc/keydef.txt @@ -0,0 +1,60 @@ +Key Definitions for C02 Programs + +This module contains symbolic representations of the character codes +generated by non-printing keyboard keys. + +The set of symbolic names is intended to encompass all supported 6502 +based microcomputers. Any key that is inapplicable to a particular +machine will have a defined character value of 0. + +The default header file contains keys with standard ASCII definitions. + +At the beginning of the program use the directive + + #include + +The following are defined: + + struct keydef {}; Structure containing the symbolic key names + + const struct keydef keys; Struct variable containing the character codes + +The structure contains the following members: + + key.bckspc Backspace + key.break Break + key.clear Clear + key.copy Copy + key.delete Delete + key.down Cursor Down + key.escape Escape + key.fn1 Function Key 1 + key.fn2 Function Key 2 + key.fn3 Function Key 3 + key.fn4 Function Key 4 + key.fn5 Function Key 5 + key.fn6 Function Key 6 + key.fn7 Function Key 7 + key.fn8 Function Key 8 + key.fn9 Function Key 9 + key.fn10 Function Key 10 + key.fn11 Function Key 11 + key.fn12 Function Key 12 + key.help Help + key.home Home + key.insert Insert + key.left Cursor Left + key.lnfd Line Feed + key.right Cursor Right + key.return Return + key.shfrtn Shift-Return + key.run Run + key.rvsoff Reverse Off + key.rvson Reverse On + key.shfspc Shifted Space + key.tab Tab + key.shftab Shift-Tab + key.up Cursor Up + + Note: This library has no external requirement. + \ No newline at end of file diff --git a/include/c64/keydef.a02 b/include/c64/keydef.a02 index b868a1f..f0a6d17 100644 --- a/include/c64/keydef.a02 +++ b/include/c64/keydef.a02 @@ -1,37 +1,39 @@ ;PETSCII Key Code Definitions ;for Commmodore 64 Computer -KEYBCK EQU $00 ;Backspace [N/A] -KEYBRK EQU $03 ;Break (RUN/STOP) -KEYCLR EQU $93 ;Clear (Shift-CLR/HOME) -KEYCPY EQU $00 ;Copy [N/A] -KEYDEL EQU $14 ;Delete -KEYDN EQU $11 ;Cursor Down -KEYESC EQU $00 ;Escape [N/A] -KEYFN1 EQU $85 ;F1 (F1/F2) -KEYFN2 EQU $89 ;F2 (Shift-F1/F2) -KEYFN3 EQU $86 ;F3 (F3/F4) -KEYFN4 EQU $8A ;F4 (Shift-F3/F4) -KEYFN5 EQU $87 ;F5 (F5/F6) -KEYFN6 EQU $8B ;F6 (Shift-F5/F6) -KEYFN7 EQU $88 ;F7 (F7/F8) -KEYFN8 EQU $8C ;F8 (Shift-F7/F8) -KEYFN9 EQU $00 ;F9 [N/A] -KEYFNA EQU $00 ;F10 [N/A] -KEYFNB EQU $00 ;F11 [N/A] -KEYFNC EQU $00 ;F12 [N/A] -KEYHLP EQU $84 ;Help [N/A] -KEYHOM EQU $13 ;Home (CLR/HOME) -KEYINS EQU $94 ;Insert (Shift-INS/DEL) -KEYLFT EQU $9D ;Cursor Left -KEYLNF EQU $00 ;Line Feed [N/A] -KEYRGT EQU $1D ;Cursor Right -KEYRTN EQU $0D ;Return -KEYRTS EQU $8D ;Shift-Return -KEYRUN EQU $00 ;Run (Shift-RUN/STOP) -KEYRVF EQU $92 ;Reverse Off -KEYRVS EQU $12 ;Reverse On -KEYSPS EQU $A0 ;Shifted Space -KEYTAB EQU $09 ;Tab -KEYTAS EQU $00 ;Shift-Tab [N/A] -KEYUP EQU $91 ;Cursor Up +KEYS: ;Key Definitions (Struct Key Codes) +;NAME Chr Description VICE x64 +.BCKSPC BYTE $00 ;Backspace [N/A] +.BREAK BYTE $03 ;Break (RUN/STOP) Escape, Caps Lock, or Tab-C +.CLEAR BYTE $93 ;Clear (Shift-CLR/HOME) Shift-Home +.COPY BYTE $00 ;Copy [N/A] +.DELETE BYTE $14 ;Delete Backspace, Delete, or Tab-T +.DOWN BYTE $11 ;Cursor Down Cursor Down or Tab-Q +.ESCAPE BYTE $00 ;Escape [N/A] +.FN1 BYTE $85 ;F1 (F1/F2) F1 +.FN2 BYTE $89 ;F2 (Shift-F1/F2) F2 or Shift-F1 +.FN3 BYTE $86 ;F3 (F3/F4) F3 +.FN4 BYTE $8A ;F4 (Shift-F3/F4) F4 or Shift-F3 +.FN5 BYTE $87 ;F5 (F5/F6) F5 +.FN6 BYTE $8B ;F6 (Shift-F5/F6) F6 or Shift-F5 +.FN7 BYTE $88 ;F7 (F7/F8) F7 +.FN8 BYTE $8C ;F8 (Shift-F7/F8) F8 or Shift-F7 +.FN9 BYTE $00 ;F9 [N/A] +.FN10 BYTE $00 ;F10 [N/A] +.FN11 BYTE $00 ;F11 [N/A] +.FN12 BYTE $00 ;F12 [N/A] +.HELP BYTE $84 ;Help [N/A] +.HOME BYTE $13 ;Home (CLR/HOME) Home or Tab-S +.INSERT BYTE $94 ;Insert (Shift-INS/DEL) Insert or Shift-Back +.LEFT BYTE $9D ;Cursor Left Cursor Left +.LNFD BYTE $00 ;Line Feed [N/A] +.RIGHT BYTE $1D ;Cursor Right Cursor Right +.RETURN BYTE $0D ;Return Enter or Tab-M +.SHFRTN BYTE $8D ;Shift-Return Shift-Enter +.RUN BYTE $83 ;Run (Shift-RUN/STOP) Shift-Escape +.RVSOFF BYTE $92 ;Reverse Off Tab-0 +.RVSON BYTE $12 ;Reverse On Tab-9 or Tab-R +.SHFSPC BYTE $A0 ;Shift-Space Shift-Space +.TAB BYTE $00 ;Tab +.SHFTAB BYTE $00 ;Shift-Tab [N/A] +.UP BYTE $91 ;Cursor Up Cursor Up diff --git a/include/c64/keydef.h02 b/include/c64/keydef.h02 index ab29a51..a771549 100644 --- a/include/c64/keydef.h02 +++ b/include/c64/keydef.h02 @@ -1,37 +1,43 @@ /* PETSCII Key Code Definitions * * for Commodore 64 Computer */ -#define KEYBCK $00 //Backspace -#define KEYBRK $03 //Break (RUN/STOP) -#define KEYCLR $93 //Clear (Shift-CLR/HOME) -#define KEYCPY $00 //Copy [N/A] -#define KEYDEL $14 //Delete -#define KEYDN $11 //Cursor Down -#define KEYESC $00 //Escape [N/A] -#define KEYFN1 $85 //Function Key 1 (F1/F2) -#define KEYFN2 $89 //Function Key 2 (Shift-F1/F2) -#define KEYFN3 $86 //Function Key 3 (F3/F4) -#define KEYFN4 $8A //Function Key 4 (Shift-F3/F4) -#define KEYFN5 $87 //Function Key 5 (F5/F6) -#define KEYFN6 $8B //Function Key 6 (Shift-F5/F6) -#define KEYFN7 $88 //Function Key 7 (F7/F8) -#define KEYFN8 $8C //Function Key 8 (Shift-F7/F8) [HELP on C16] -#define KEYFN9 $00 //Function Key 9 [N/A] -#define KEYFNA $00 //Function Key 10 [N/A] -#define KEYFNB $00 //Function Key 11 [N/A] -#define KEYFNC $00 //Function Key 12 [N/A] -#define KEYHLP $84 //Help [N/A] -#define KEYHOM $13 //Home (CLR/HOME) -#define KEYINS $94 //Insert (Shift-INS/DEL) -#define KEYLFT $9D //Cursor Left -#define KEYLNF $00 //Line Feed (N/A) -#define KEYRGT $1D //Cursor Right -#define KEYRTN $0D //Return -#define KEYRTS $8D //Shift-Return -#define KEYRUN $00 //Run (Shift-RUN/STOP) -#define KEYRVF $92 //Reverse Off -#define KEYRVS $12 //Reverse On -#define KEYSPS $A0 //Shifted Space -#define KEYTAB $09 //Tab -#define KEYTAS $00 //Shift-Tab [N/A] -#define KEYUP $91 //Cursor Up +/* Structure for Key Definitions */ +struct keydef { + char bckspc; //Backspace + char break; //Break (RUN/STOP) + char clear; //Clear (Shift-CLR/HOME) + char copy; //Copy [N/A] + char delete; //Delete + char down; //Cursor Down + char escape; //Escape [N/A] + char fn1; //Function Key 1 (F1/F2) + char fn2; //Function Key 2 (Shift-F1/F2) + char fn3; //Function Key 3 (F3/F4) + char fn4; //Function Key 4 (Shift-F3/F4) + char fn5; //Function Key 5 (F5/F6) + char fn6; //Function Key 6 (Shift-F5/F6) + char fn7; //Function Key 7 (F7/F8) + char fn8; //Function Key 8 (Shift-F7/F8) [HELP on C16] + char fn9; //Function Key 9 [N/A] + char fn10; //Function Key 10 [N/A] + char fn11; //Function Key 11 [N/A] + char fn12; //Function Key 12 [N/A] + char help; //Help [N/A] + char home; //Home (CLR/HOME) + char insert; //Insert (Shift-INS/DEL) + char left; //Cursor Left + char lnfd; //Line Feed (N/A) + char right; //Cursor Right + char return; //Return + char shfrtn; //Shift-Return + char run; //Run (Shift-RUN/STOP) + char rvsoff; //Reverse Off + char rvson; //Reverse On + char shfspc; //Shifted Space + char tab; //Tab + char shftab; //Shift-Tab [N/A] + char up; //Cursor Up +}; + +/* Actual Key Definitions */ +const struct keydef keys; diff --git a/include/cbm/keydef.a02 b/include/cbm/keydef.a02 index a7170fc..500d76d 100644 --- a/include/cbm/keydef.a02 +++ b/include/cbm/keydef.a02 @@ -1,37 +1,39 @@ -;PETSCII Key Code Definitions +;PETSCII Key Code Definitions ;Common to All PET/CBM Computers -KEYBCK EQU $00 ;Backspace [N/A] -KEYBRK EQU $03 ;Break (RUN/STOP) -KEYCLR EQU $93 ;Clear (Shift-CLR/HOME) -KEYCPY EQU $00 ;Copy [N/A] -KEYDEL EQU $14 ;Delete -KEYDN EQU $11 ;Cursor Down -KEYESC EQU $00 ;Escape [C128/C65] -KEYFN1 EQU $85 ;F1 [VIC20/C64/C16/C128/C65] -KEYFN2 EQU $89 ;F2 [VIC20/C64/C16/C128/C65] -KEYFN3 EQU $86 ;F3 [VIC20/C64/C16/C128/C65] -KEYFN4 EQU $8A ;F4 [VIC20/C64/C16/C128/C65] -KEYFN5 EQU $87 ;F5 [VIC20/C64/C16/C128/C65] -KEYFN6 EQU $8B ;F6 [VIC20/C64/C16/C128/C65] -KEYFN7 EQU $88 ;F7 [VIC20/C64/C16/C128/C65] -KEYFN8 EQU $8C ;F8 [VIC20/C64/C128/C65] [HELP on C16] -KEYFN9 EQU $00 ;F9 [C65] -KEYFNA EQU $00 ;F10 [C65] -KEYFNB EQU $00 ;F11 [C65] -KEYFNC EQU $00 ;F12 [C65] -KEYHLP EQU $84 ;Help [C128/xC65] -KEYHOM EQU $13 ;Home (CLR/HOME) -KEYINS EQU $94 ;Insert (Shift-INS/DEL) -KEYLFT EQU $9D ;Cursor Left -KEYLNF EQU $00 ;Line Feed [C128] -KEYRGT EQU $1D ;Cursor Right -KEYRTN EQU $0D ;Return -KEYRTS EQU $8D ;Shift-Return -KEYRUN EQU $00 ;Run (Shift-RUN/STOP) -KEYRVF EQU $92 ;Reverse Off -KEYRVS EQU $12 ;Reverse On -KEYSPS EQU $A0 ;Shifted Space -KEYTAB EQU $09 ;Tab -KEYTAS EQU $00 ;Shift-Tab [C128/C65] -KEYUP EQU $91 ;Cursor Up +KEYS: ;Key Definitions (Struct Key Codes) +;NAME Chr Description +.BCKSPC BYTE $00 ;Backspace [N/A] +.BREAK BYTE $03 ;Break (RUN/STOP) +.CLEAR BYTE $93 ;Clear (Shift-CLR/HOME) +.COPY BYTE $00 ;Copy [N/A] +.DELETE BYTE $14 ;Delete +.DOWN BYTE $11 ;Cursor Down +.ESCAPE BYTE $00 ;Escape [C128/C65] +.FN1 BYTE $85 ;F1 [VIC20/C64/C16/C128/C65] +.FN2 BYTE $89 ;F2 [VIC20/C64/C16/C128/C65] +.FN3 BYTE $86 ;F3 [VIC20/C64/C16/C128/C65] +.FN4 BYTE $8A ;F4 [VIC20/C64/C16/C128/C65] +.FN5 BYTE $87 ;F5 [VIC20/C64/C16/C128/C65] +.FN6 BYTE $8B ;F6 [VIC20/C64/C16/C128/C65] +.FN7 BYTE $88 ;F7 [VIC20/C64/C16/C128/C65] +.FN8 BYTE $8C ;F8 [VIC20/C64/C128/C65] [HELP on C16] +.FN9 BYTE $00 ;F9 [C65] +.FN10 BYTE $00 ;F10 [C65] +.FN11 BYTE $00 ;F11 [C65] +.FN12 BYTE $00 ;F12 [C65] +.HELP BYTE $84 ;Help [C128/xC65] +.HOME BYTE $13 ;Home (CLR/HOME) +.INSERT BYTE $94 ;Insert (Shift-INS/DEL) +.LEFT BYTE $9D ;Cursor Left +.LNFD BYTE $00 ;Line Feed [C128] +.RIGHT BYTE $1D ;Cursor Right +.RETURN BYTE $0D ;Return +.SHFRTN BYTE $8D ;Shift-Return +.RUN BYTE $00 ;Run (Shift-RUN/STOP) +.RVSOFF BYTE $92 ;Reverse Off +.RVSON BYTE $12 ;Reverse On +.SHFSPC BYTE $A0 ;Shifted Space +.TAB BYTE $09 ;Tab +.SHFTAB BYTE $00 ;Shift-Tab [C128/C65] +.UP BYTE $91 ;Cursor Up diff --git a/include/cbm/keydef.h02 b/include/cbm/keydef.h02 index b917859..2fd312f 100644 --- a/include/cbm/keydef.h02 +++ b/include/cbm/keydef.h02 @@ -1,37 +1,43 @@ /* PETSCII Key Code Definitions * * Common to All PET/CBM Computers */ -#define KEYBCK $00 //Backspace -#define KEYBRK $03 //Break (RUN/STOP) -#define KEYCLR $93 //Clear (Shift-CLR/HOME) -#define KEYCPY $00 //Copy -#define KEYDEL $20 //Delete -#define KEYDN $11 //Cursor Down -#define KEYESC $00 //Escape (N/A) -#define KEYFN1 $00 //F1 (N/A) -#define KEYFN2 $00 //F2 (N/A) -#define KEYFN3 $00 //F3 (N/A) -#define KEYFN4 $00 //F4 (N/A) -#define KEYFN5 $00 //F5 (N/A) -#define KEYFN6 $00 //F6 (N/A) -#define KEYFN7 $00 //F7 (N/A) -#define KEYFN8 $00 //F8 (N/A) -#define KEYFN9 $00 //F9 (N/A) -#define KEYFNA $00 //F10 (N/A) -#define KEYFNB $00 //F11 (N/A) -#define KEYFNC $00 //F12 (N/A) -#define KEYHLP $00 //Help (N/A) -#define KEYHOM $13 //Home (CLR/HOME) -#define KEYINS $94 //Insert (Shift-INS/DEL) -#define KEYLFT $9C //Cursor Left -#define KEYLNF $00 //Line Feed (N/A) -#define KEYRGT $1D //Cursor Right -#define KEYRTN $0D //Return -#define KEYRTS $8D //Shift-Return -#define KEYRUN $83 //Run (Shift-RUN/STOP) -#define KEYRVF $92 //Reverse Off -#define KEYRVS $12 //Reverse On -#define KEYSPS $A0 //Shifted Space -#define KEYTAB $09 //Tab -#define KEYTAS $00 //Shift-Tab (N/A) -#define KEYUP $91 //Cursor Up +/* Structure for Key Definitions */ +struct keydef { + char bckspc; $00 //Backspace + char break; $03 //Break (RUN/STOP) + char clear; $93 //Clear (Shift-CLR/HOME) + char copy; $00 //Copy + char delete; $20 //Delete + char down; $11 //Cursor Down + char escape; $00 //Escape (N/A) + char fn1; $00 //F1 (N/A) + char fn2; $00 //F2 (N/A) + char fn3; $00 //F3 (N/A) + char fn4; $00 //F4 (N/A) + char fn5; $00 //F5 (N/A) + char fn6; $00 //F6 (N/A) + char fn7; $00 //F7 (N/A) + char fn8; $00 //F8 (N/A) + char fn9; $00 //F9 (N/A) + char fn10; $00 //F10 (N/A) + char fn11; $00 //F11 (N/A) + char fn12; $00 //F12 (N/A) + char help; $00 //Help (N/A) + char home; $13 //Home (CLR/HOME) + char insert; $94 //Insert (Shift-INS/DEL) + char left; $9C //Cursor Left + char lnfd; $00 //Line Feed (N/A) + char right; $1D //Cursor Right + char return; $0D //Return + char shfrtn; $8D //Shift-Return + char run; $83 //Run (Shift-RUN/STOP) + char rvsoff; $92 //Reverse Off + char rvson; $12 //Reverse On + char shfspc; $A0 //Shifted Space + char tab; $09 //Tab + char shftab; $00 //Shift-Tab (N/A) + char up; $91 //Cursor Up +}; + +/* Actual Key Definitions */ +const struct keydef keys; diff --git a/include/keydef.a02 b/include/keydef.a02 index 1b50623..4953328 100644 --- a/include/keydef.a02 +++ b/include/keydef.a02 @@ -1,37 +1,39 @@ ;Standard ASCII Key Code Definitions ;Undefined Keys hae value $00 -KEYBCK EQU $08 ;Backspace -KEYBRK EQU $03 ;Break -KEYCLR EQU $00 ;Clear -KEYCPY EQU $00 ;Copy [Acorn Atom] -KEYDEL EQU $7F ;Delete -KEYDN EQU $00 ;Cursor Down -KEYESC EQU $1B ;Escape -KEYFN1 EQU $00 ;F1 -KEYFN2 EQU $00 ;F2 -KEYFN3 EQU $00 ;F3 -KEYFN4 EQU $00 ;F4 -KEYFN5 EQU $00 ;F5 -KEYFN6 EQU $00 ;F6 -KEYFN7 EQU $00 ;F7 -KEYFN8 EQU $00 ;F8 -KEYFN9 EQU $00 ;F9 -KEYFNA EQU $00 ;F10 -KEYFNB EQU $00 ;F11 -KEYFNC EQU $00 ;F12 -KEYHLP EQU $00 ;Help [C128/C65] -KEYHOM EQU $00 ;Home -KEYINS EQU $00 ;Insert -KEYLFT EQU $00 ;Cursor Left -KEYLNF EQU $0A ;;Line Feed [C128] -KEYRGT EQU $00 ;Cursor Right -KEYRTN EQU $0D ;Return -KEYRTS EQU $80 ;Shift-Return -KEYRUN EQU $00 ;Run [PET/CBM] -KEYRVF EQU $92 ;Reverse OffCtrl-0 -KEYRVS EQU $12 ;Reverse On Ctrl-9 -KEYSPS EQU $00 ;Shifted Space -KEYTAB EQU $09 ;Tab -KEYTAS EQU $00 ;Shift-Tab -KEYUP EQU $00 ;Cursor Up +KEYS: ;Key Definitions (Struct Key Codes) +;NAME Chr Description +.BCKSPC BYTE $08 ;Backspace +.BREAK BYTE $03 ;Break +.CLEAR BYTE $00 ;Clear +.COPY BYTE $00 ;Copy [Acorn Atom] +.DELETE BYTE $7F ;Delete +.DOWN BYTE $00 ;Cursor Down +.ESCAPE BYTE $1B ;Escape +.FN1 BYTE $00 ;F1 +.FN2 BYTE $00 ;F2 +.FN3 BYTE $00 ;F3 +.FN4 BYTE $00 ;F4 +.FN5 BYTE $00 ;F5 +.FN6 BYTE $00 ;F6 +.FN7 BYTE $00 ;F7 +.FN8 BYTE $00 ;F8 +.FN9 BYTE $00 ;F9 +.FN10 BYTE $00 ;F10 +.FN11 BYTE $00 ;F11 +.FN12 BYTE $00 ;F12 +.HELP BYTE $00 ;Help [C128/C65] +.HOME BYTE $00 ;Home +.INSERT BYTE $00 ;Insert +.LEFT BYTE $00 ;Cursor Left +.LNFD BYTE $0A ;;Line Feed [C128] +.RIGHT BYTE $00 ;Cursor Right +.RETURN BYTE $0D ;Return +.SHFRTN BYTE $80 ;Shift-Return +.RUN BYTE $00 ;Run [PET/CBM] +.RVSOFF BYTE $92 ;Reverse OffCtrl-0 +.RVSON BYTE $12 ;Reverse On Ctrl-9 +.SHFSPC BYTE $00 ;Shifted Space +.TAB BYTE $09 ;Tab +.SHFTAB BYTE $00 ;Shift-Tab +.UP BYTE $00 ;Cursor Up diff --git a/include/keydef.h02 b/include/keydef.h02 index b11e438..0a9ea5c 100644 --- a/include/keydef.h02 +++ b/include/keydef.h02 @@ -1,37 +1,43 @@ /* Standard ASCII Key Code Definitions * - * Undefined Keys hae value $00 * + * Undefined Keys have value $00 * -#define KEYBCK $08 //Backspace -#define KEYBRK $03 //Break -#define KEYCLR $00 //Clear -#define KEYCPY $00 //Copy -#define KEYDEL $7F //Delete -#define KEYDN $00 //Cursor Down -#define KEYESC $1B //Escape -#define KEYFN1 $00 //1 -#define KEYFN2 $00 //2 -#define KEYFN3 $00 //3 -#define KEYFN4 $00 //4 -#define KEYFN5 $00 //5 -#define KEYFN6 $00 //6 -#define KEYFN7 $00 //7 -#define KEYFN8 $00 //8 -#define KEYFN9 $00 //9 -#define KEYFNA $00 //10 -#define KEYFNB $00 //11 -#define KEYFNC $00 //12 -#define KEYHLP $00 //Help -#define KEYHOM $00 //Home -#define KEYINS $00 //Insert -#define KEYLFT $00 //Cursor Left -#define KEYLNF $0A //Line Feed -#define KEYRGT $00 //Cursor Right -#define KEYRTN $0D //Return -#define KEYRTS $80 //Shift-Return -#define KEYRUN $00 //Run -#define KEYRVF $92 //Reverse Off -#define KEYRVS $12 //Reverse On -#define KEYSPS $00 //Shifted Space -#define KEYTAB $09 //Tab -#define KEYTAS $00 //Shift-Tab -#define KEYUP $00 //Cursor Up +/* Structure for Key Definitions */ +struct keydef { + char bckspc; //Backspace + char break; //Break + char clear; //Clear + char copy; //Copy + char delete; //Delete + char down; //Cursor Down + char escape; //Escape + char fn1; //F1 + char fn2; //F2 + char fn3; //F3 + char fn4; //F4 + char fn5; //F5 + char fn6; //F6 + char fn7; //F7 + char fn8; //F8 + char fn9; //F9 + char fn10; //F10 + char fn11; //F11 + char fn12; //F12 + char help; //Help + char home; //Home + char insert; //Insert + char left; //Cursor Left + char lnfd; //Line Feed + char right; //Cursor Right + char return; //Return + char shfrtn; //Shift-Return + char run; //Run + char rvsoff; //Reverse Off + char rvson; //Reverse On + char shfspc; //Shifted Space + char tab; //Tab + char shftab; //Shift-Tab + char up; //Cursor Up +}; + +/* Actual Key Definitions */ +const struct keydef keys; diff --git a/include/vic/keydef.a02 b/include/vic/keydef.a02 index b868a1f..c1f8674 100644 --- a/include/vic/keydef.a02 +++ b/include/vic/keydef.a02 @@ -1,37 +1,39 @@ ;PETSCII Key Code Definitions ;for Commmodore 64 Computer -KEYBCK EQU $00 ;Backspace [N/A] -KEYBRK EQU $03 ;Break (RUN/STOP) -KEYCLR EQU $93 ;Clear (Shift-CLR/HOME) -KEYCPY EQU $00 ;Copy [N/A] -KEYDEL EQU $14 ;Delete -KEYDN EQU $11 ;Cursor Down -KEYESC EQU $00 ;Escape [N/A] -KEYFN1 EQU $85 ;F1 (F1/F2) -KEYFN2 EQU $89 ;F2 (Shift-F1/F2) -KEYFN3 EQU $86 ;F3 (F3/F4) -KEYFN4 EQU $8A ;F4 (Shift-F3/F4) -KEYFN5 EQU $87 ;F5 (F5/F6) -KEYFN6 EQU $8B ;F6 (Shift-F5/F6) -KEYFN7 EQU $88 ;F7 (F7/F8) -KEYFN8 EQU $8C ;F8 (Shift-F7/F8) -KEYFN9 EQU $00 ;F9 [N/A] -KEYFNA EQU $00 ;F10 [N/A] -KEYFNB EQU $00 ;F11 [N/A] -KEYFNC EQU $00 ;F12 [N/A] -KEYHLP EQU $84 ;Help [N/A] -KEYHOM EQU $13 ;Home (CLR/HOME) -KEYINS EQU $94 ;Insert (Shift-INS/DEL) -KEYLFT EQU $9D ;Cursor Left -KEYLNF EQU $00 ;Line Feed [N/A] -KEYRGT EQU $1D ;Cursor Right -KEYRTN EQU $0D ;Return -KEYRTS EQU $8D ;Shift-Return -KEYRUN EQU $00 ;Run (Shift-RUN/STOP) -KEYRVF EQU $92 ;Reverse Off -KEYRVS EQU $12 ;Reverse On -KEYSPS EQU $A0 ;Shifted Space -KEYTAB EQU $09 ;Tab -KEYTAS EQU $00 ;Shift-Tab [N/A] -KEYUP EQU $91 ;Cursor Up +KEYS: ;Key Definitions (Struct Key Codes) +;NAME Chr Description VICE xvic +.BCKSPC BYTE $00 ;Backspace [N/A] +.BREAK BYTE $03 ;Break (RUN/STOP) Escape or Caps Lock +.CLEAR BYTE $93 ;Clear (Shift-CLR/HOME) Shift-Home +.COPY BYTE $00 ;Copy [N/A] +.DELETE BYTE $14 ;Delete Backspace +.DOWN BYTE $11 ;Cursor Down Cursor Down +.ESCAPE BYTE $00 ;Escape [N/A] +.FN1 BYTE $85 ;F1 (F1/F2) F1 +.FN2 BYTE $89 ;F2 (Shift-F1/F2) F2 or Shift-F1 +.FN3 BYTE $86 ;F3 (F3/F4) F3 +.FN4 BYTE $8A ;F4 (Shift-F3/F4) F4 or Shift-F3 +.FN5 BYTE $87 ;F5 (F5/F6) F5 +.FN6 BYTE $8B ;F6 (Shift-F5/F6) F6 or Shift-F5 +.FN7 BYTE $88 ;F7 (F7/F8) F7 +.FN8 BYTE $8C ;F8 (Shift-F7/F8) F8 or Shift-F7 +.FN9 BYTE $00 ;F9 [N/A] +.FN10 BYTE $00 ;F10 [N/A] +.FN11 BYTE $00 ;F11 [N/A] +.FN12 BYTE $00 ;F12 [N/A] +.HELP BYTE $84 ;Help [N/A] +.HOME BYTE $13 ;Home (CLR/HOME) Home +.INSERT BYTE $94 ;Insert (Shift-INS/DEL) Shift-Backspace +.LEFT BYTE $9D ;Cursor Left Cursor Left +.LNFD BYTE $00 ;Line Feed [N/A] +.RIGHT BYTE $1D ;Cursor Right Cursor Right +.RETURN BYTE $0D ;Return Enter +.SHFRTN BYTE $8D ;Shift-Return Shift-Enter +.RUN BYTE $83 ;Run (Shift-RUN/STOP) Shift-Escape +.RVSOFF BYTE $92 ;Reverse Off Tab-0 +.RVSON BYTE $12 ;Reverse On Tab-9 +.SHFSPC BYTE $A0 ;Shifted Space Shift-Space +.TAB BYTE $00 ;Tab +.SHFTAB BYTE $00 ;Shift-Tab [N/A] +.UP BYTE $91 ;Cursor Up Cursor Up diff --git a/include/vic/keydef.h02 b/include/vic/keydef.h02 index ab29a51..443fe0c 100644 --- a/include/vic/keydef.h02 +++ b/include/vic/keydef.h02 @@ -1,37 +1,43 @@ -/* PETSCII Key Code Definitions * - * for Commodore 64 Computer */ +/* PETSCII Key Code Definitions * + * for Commodore VIC 20 Computer */ -#define KEYBCK $00 //Backspace -#define KEYBRK $03 //Break (RUN/STOP) -#define KEYCLR $93 //Clear (Shift-CLR/HOME) -#define KEYCPY $00 //Copy [N/A] -#define KEYDEL $14 //Delete -#define KEYDN $11 //Cursor Down -#define KEYESC $00 //Escape [N/A] -#define KEYFN1 $85 //Function Key 1 (F1/F2) -#define KEYFN2 $89 //Function Key 2 (Shift-F1/F2) -#define KEYFN3 $86 //Function Key 3 (F3/F4) -#define KEYFN4 $8A //Function Key 4 (Shift-F3/F4) -#define KEYFN5 $87 //Function Key 5 (F5/F6) -#define KEYFN6 $8B //Function Key 6 (Shift-F5/F6) -#define KEYFN7 $88 //Function Key 7 (F7/F8) -#define KEYFN8 $8C //Function Key 8 (Shift-F7/F8) [HELP on C16] -#define KEYFN9 $00 //Function Key 9 [N/A] -#define KEYFNA $00 //Function Key 10 [N/A] -#define KEYFNB $00 //Function Key 11 [N/A] -#define KEYFNC $00 //Function Key 12 [N/A] -#define KEYHLP $84 //Help [N/A] -#define KEYHOM $13 //Home (CLR/HOME) -#define KEYINS $94 //Insert (Shift-INS/DEL) -#define KEYLFT $9D //Cursor Left -#define KEYLNF $00 //Line Feed (N/A) -#define KEYRGT $1D //Cursor Right -#define KEYRTN $0D //Return -#define KEYRTS $8D //Shift-Return -#define KEYRUN $00 //Run (Shift-RUN/STOP) -#define KEYRVF $92 //Reverse Off -#define KEYRVS $12 //Reverse On -#define KEYSPS $A0 //Shifted Space -#define KEYTAB $09 //Tab -#define KEYTAS $00 //Shift-Tab [N/A] -#define KEYUP $91 //Cursor Up +/* Structure for Key Definitions */ +struct keydef { + char bckspc; //Backspace + char break; //Break (RUN/STOP) + char clear; //Clear (Shift-CLR/HOME) + char copy; //Copy [N/A] + char delete; //Delete + char down; //Cursor Down + char escape; //Escape [N/A] + char fn1; //Function Key 1 (F1/F2) + char fn2; //Function Key 2 (Shift-F1/F2) + char fn3; //Function Key 3 (F3/F4) + char fn4; //Function Key 4 (Shift-F3/F4) + char fn5; //Function Key 5 (F5/F6) + char fn6; //Function Key 6 (Shift-F5/F6) + char fn7; //Function Key 7 (F7/F8) + char fn8; //Function Key 8 (Shift-F7/F8) [HELP on C16] + char fn9; //Function Key 9 [N/A] + char fn10; //Function Key 10 [N/A] + char fn11; //Function Key 11 [N/A] + char fn12; //Function Key 12 [N/A] + char help; //Help [N/A] + char home; //Home (CLR/HOME) + char insert; //Insert (Shift-INS/DEL) + char left; //Cursor Left + char lnfd; //Line Feed (N/A) + char right; //Cursor Right + char return; //Return + char shfrtn; //Shift-Return + char run; //Run (Shift-RUN/STOP) + char rvsoff; //Reverse Off + char rvson; //Reverse On + char shfspc; //Shifted Space + char tab; //Tab + char shftab; //Shift-Tab [N/A] + char up; //Cursor Up +}; + +/* Actual Key Definitions */ +const struct keydef keys; diff --git a/include/x16/keydef.a02 b/include/x16/keydef.a02 index 730cacb..4a5c0de 100644 --- a/include/x16/keydef.a02 +++ b/include/x16/keydef.a02 @@ -1,37 +1,38 @@ ;PETSCII Key Code Definitions for Commander X16 -;NAME Chr Description x16emu -KEYBCK EQU $00 ;Backspace [N/A] -KEYBRK EQU $03 ;Break (RUN/STOP) **missing** -KEYCLR EQU $93 ;Clear (Shift-CLR/HOME) Shift-Home -KEYCPY EQU $00 ;Copy [N/A] -KEYDEL EQU $14 ;Delete Backspace -KEYDN EQU $11 ;Cursor Down Cursor Down -KEYESC EQU $1B ;Escape [C128/C65] **missing** -KEYFN1 EQU $85 ;F1 (F1/F2) F1 -KEYFN2 EQU $89 ;F2 (Shift-F1/F2) F2 -KEYFN3 EQU $86 ;F3 (F3/F4) F3 -KEYFN4 EQU $8A ;F4 (Shift-F3/F4) F4 -KEYFN5 EQU $87 ;F5 (F5/F6) F5 -KEYFN6 EQU $8B ;F6 (Shift-F5/F6) F6 -KEYFN7 EQU $88 ;F7 (F7/F8) F7 -KEYFN8 EQU $8C ;F8 (Shift-F7/F8) F8 -KEYFN9 EQU $89 ;F9 [C65] F9 -KEYFNA EQU $15 ;F10 [C65] F10 -KEYFNB EQU $16 ;F11 [C65] F11 -KEYFNC EQU $17 ;F12 [C65] F12 -KEYHLP EQU $84 ;Help [C65] -KEYHOM EQU $13 ;Home (CLR/HOME) Home -KEYINS EQU $94 ;Insert (Shift-INS/DEL) Shift-Backspace -KEYLFT EQU $9D ;Cursor Left Cursor Left -KEYLNF EQU $00 ;Line Feed [C128] -KEYRGT EQU $1D ;Cursor Right Cursor Right -KEYRTN EQU $0D ;Return Enter -KEYRTS EQU $8D ;Shift-Return Shift-Enter -KEYRUN EQU $00 ;Run (Shift-RUN/STOP) -KEYRVF EQU $92 ;Reverse Off Ctrl-0 -KEYRVS EQU $12 ;Reverse On Ctrl-9 -KEYSPS EQU $A0 ;Shifted Space Shifted Space -KEYTAB EQU $09 ;Tab Tab -KEYTAS EQU $18 ;Shift-Tab **missing** -KEYUP EQU $91 ;Cursor Up Cursor Up +KEYS: ;Key Definitions (Struct Key Codes) +;NAME Chr Description x16emu +.BCKSPC BYTE $00 ;Backspace [N/A] +.BREAK BYTE $03 ;Break (RUN/STOP) **missing** +.CLEAR BYTE $93 ;Clear (Shift-CLR/HOME) Shift-Home +.COPY BYTE $00 ;Copy [N/A] +.DELETE BYTE $14 ;Delete Backspace +.DOWN BYTE $11 ;Cursor Down Cursor Down +.ESCAPE BYTE $1B ;Escape [C128/C65] **missing** +.FN1 BYTE $85 ;F1 (F1/F2) F1 +.FN2 BYTE $89 ;F2 (Shift-F1/F2) F2 +.FN3 BYTE $86 ;F3 (F3/F4) F3 +.FN4 BYTE $8A ;F4 (Shift-F3/F4) F4 +.FN5 BYTE $87 ;F5 (F5/F6) F5 +.FN6 BYTE $8B ;F6 (Shift-F5/F6) F6 +.FN7 BYTE $88 ;F7 (F7/F8) F7 +.FN8 BYTE $8C ;F8 (Shift-F7/F8) F8 +.FN9 BYTE $89 ;F9 [C65] F9 +.FN10 BYTE $15 ;F10 [C65] F10 +.FN11 BYTE $16 ;F11 [C65] F11 +.FN12 BYTE $17 ;F12 [C65] F12 +.HELP BYTE $84 ;Help [C65] +.HOME BYTE $13 ;Home (CLR/HOME) Home +.INSERT BYTE $94 ;Insert (Shift-INS/DEL) Shift-Backspace +.LEFT BYTE $9D ;Cursor Left Cursor Left +.LNFD BYTE $00 ;Line Feed [C128] +.RIGHT BYTE $1D ;Cursor Right Cursor Right +.RETURN BYTE $0D ;Return Enter +.SHFRTN BYTE $8D ;Shift-Return Shift-Enter +.RUN BYTE $00 ;Run (Shift-RUN/STOP) +.RVSOFF BYTE $92 ;Reverse Off Ctrl-0 +.RVSON BYTE $12 ;Reverse On Ctrl-9 +.SHFSPC BYTE $A0 ;Shifted Space Shifted Space +.TAB BYTE $09 ;Tab Tab +.SHFTAB BYTE $18 ;Shift-Tab **missing** +.UP BYTE $91 ;Cursor Up Cursor Up diff --git a/include/x16/keydef.h02 b/include/x16/keydef.h02 index e343eed..cef293b 100644 --- a/include/x16/keydef.h02 +++ b/include/x16/keydef.h02 @@ -1,36 +1,42 @@ /* PETSCII Key Code Definitions for Commander X16 */ -#define KEYBCK $00 //Backspace -#define KEYBRK $03 //Break (RUN/STOP) -#define KEYCLR $93 //Clear (Shift-CLR/HOME) -#define KEYCPY $00 //Copy -#define KEYDEL $14 //Delete -#define KEYDN $11 //Cursor Down -#define KEYESC $1B //Escape -#define KEYFN1 $85 //Function Key 1 (F1/F2) -#define KEYFN2 $89 //Function Key 2 (Shift-F1/F2) -#define KEYFN3 $86 //Function Key 3 (F3/F4) -#define KEYFN4 $8A //Function Key 4 (Shift-F3/F4) -#define KEYFN5 $87 //Function Key 5 (F5/F6) -#define KEYFN6 $8B //Function Key 6 (Shift-F5/F6) -#define KEYFN7 $88 //Function Key 7 (F7/F8) -#define KEYFN8 $8C //Function Key 8 (Shift-F7/F8) [HELP on C16] -#define KEYFN9 $89 //Function Key 9 -#define KEYFNA $15 //Function Key 10 -#define KEYFNB $16 //Function Key 11 -#define KEYFNC $17 //Function Key 12 -#define KEYHLP $84 //Help (C65) -#define KEYHOM $13 //Home (CLR/HOME) -#define KEYINS $94 //Insert (Shift-INS/DEL) -#define KEYLFT $9D //Cursor Left -#define KEYLNF $00 //Line Feed (N/A) -#define KEYRGT $1D //Cursor Right -#define KEYRTN $0D //Return -#define KEYRTS $8D //Shift-Return -#define KEYRUN $00 //Run (Shift-RUN/STOP) -#define KEYRVF $92 //Reverse Off -#define KEYRVS $12 //Reverse On -#define KEYSPS $A0 //Shifted Space -#define KEYTAB $09 //Tab -#define KEYTAS $18 //Shift-Tab [C65] -#define KEYUP $91 //Cursor Up +/* Structure for Key Definitions */ +struct keydef { + char bckspc; //Backspace + char break; //Break (RUN/STOP) + char clear; //Clear (Shift-CLR/HOME) + char copy; //Copy + char delete; //Delete + char down; //Cursor Down + char escape; //Escape + char fn1; //Function Key 1 (F1/F2) + char fn2; //Function Key 2 (Shift-F1/F2) + char fn3; //Function Key 3 (F3/F4) + char fn4; //Function Key 4 (Shift-F3/F4) + char fn5; //Function Key 5 (F5/F6) + char fn6; //Function Key 6 (Shift-F5/F6) + char fn7; //Function Key 7 (F7/F8) + char fn8; //Function Key 8 (Shift-F7/F8) [HELP on C16] + char fn9; //Function Key 9 + char fn10; //Function Key 10 + char fn11; //Function Key 11 + char fn12; //Function Key 12 + char help; //Help (C65) + char home; //Home (CLR/HOME) + char insert; //Insert (Shift-INS/DEL) + char left; //Cursor Left + char lnfd; //Line Feed (N/A) + char right; //Cursor Right + char return; //Return + char shfrtn; //Shift-Return + char run; //Run (Shift-RUN/STOP) + char rvsoff; //Reverse Off + char rvson; //Reverse On + char shfspc; //Shifted Space + char tab; //Tab + char shftab; //Shift-Tab [C65] + char up; //Cursor Up +}; + +/* Actual Key Definitions */ +const struct keydef keys; diff --git a/test/keydefs.c02 b/test/keydefs.c02 index 65043ec..c8e7820 100644 --- a/test/keydefs.c02 +++ b/test/keydefs.c02 @@ -13,40 +13,41 @@ main: key = getchr(); if (!key) continue; select (key) { - case #KEYBCK: putstr("BACKSPACE"); - case #KEYBRK: putstr("BREAK"); - case #KEYCLR: putstr("CLEAR"); - case #KEYCPY: putstr("COPY"); - case #KEYDEL: putstr("DELETE"); - case #KEYDN : putstr("DOWN"); - case #KEYESC: putstr("ESCAPE"); - case #KEYFN1: putstr("F1"); - case #KEYFN2: putstr("F2"); - case #KEYFN3: putstr("F3"); - case #KEYFN4: putstr("F4"); - case #KEYFN5: putstr("F5"); - case #KEYFN6: putstr("F6"); - case #KEYFN7: putstr("F7"); - case #KEYFN8: putstr("F8"); - case #KEYFN9: putstr("F9"); - case #KEYFNA: putstr("F10"); - case #KEYFNB: putstr("F11"); - case #KEYFNC: putstr("F12"); - case #KEYHLP: putstr("HELP"); - case #KEYHOM: putstr("HOME"); - case #KEYINS: putstr("INSERT"); - case #KEYLFT: putstr("LEFT"); - case #KEYRGT: putstr("RIGHT"); - case #KEYRTN: putstr("RETURN"); - case #KEYRTS: putstr("SHIFT-RETURN"); - case #KEYRUN: putstr("RUN"); - case #KEYRVF: putstr("RVS-OFF"); - case #KEYRVS: putstr("RVS-ON"); - case #KEYSPS: putstr("SHIFT-SPACE"); - case #KEYTAB: putstr("TAB"); - case #KEYTAS: putstr("SHIFT-TAB"); - case #KEYUP : putstr("UP"); - case ' ': putstr("SPACE"); + case keys.bckspc: putstr("BACKSPACE"); + case keys.break: putstr("BREAK"); + case keys.clear: putstr("CLEAR"); + case keys.copy: putstr("COPY"); + case keys.delete: putstr("DELETE"); + case keys.down: putstr("DOWN"); + case keys.escape: putstr("ESCAPE"); + case keys.fn1: putstr("F1"); + case keys.fn2: putstr("F2"); + case keys.fn3: putstr("F3"); + case keys.fn4: putstr("F4"); + case keys.fn5: putstr("F5"); + case keys.fn6: putstr("F6"); + case keys.fn7: putstr("F7"); + case keys.fn8: putstr("F8"); + case keys.fn9: putstr("F9"); + case keys.fn10: putstr("F10"); + case keys.fn11: putstr("F11"); + case keys.fn12: putstr("F12"); + case keys.help: putstr("HELP"); + case keys.home: putstr("HOME"); + case keys.insert: putstr("INSERT"); + case keys.left: putstr("LEFT"); + case keys.lnfd: putstr("LINE FEED"); + case keys.right: putstr("RIGHT"); + case keys.return: putstr("RETURN"); + case keys.shfrtn: putstr("SHIFT-RETURN"); + case keys.run: putstr("RUN"); + case keys.rvsoff: putstr("RVS-OFF"); + case keys.rvson: putstr("RVS-ON"); + case keys.shfspc: putstr("SHIFT-SPACE"); + case keys.tab: putstr("TAB"); + case keys.shftab: putstr("SHIFT-TAB"); + case keys.up: putstr("UP"); + case ' ': putstr("SPACE"); default: if (key > ' ' and key <> #DELKEY) putchr(key); } putstr(" ["); prbyte(key); putstr("] ");