From 665834bc74e378a99f88f0dc49206f2ea3198f08 Mon Sep 17 00:00:00 2001 From: Curtis F Kaylor Date: Wed, 20 Nov 2019 01:44:06 -0500 Subject: [PATCH] Imported keydef and screen modules from master --- include/x16/keydef.a02 | 37 ++++++++++++++++++++++++++++++++++ include/x16/keydef.h02 | 36 +++++++++++++++++++++++++++++++++ include/x16/screen.a02 | 45 ++++++++++++++++++++++++++++++++++++++++++ include/x16/screen.h02 | 38 +++++++++++++++++++++++++++++++++++ 4 files changed, 156 insertions(+) create mode 100644 include/x16/keydef.a02 create mode 100644 include/x16/keydef.h02 create mode 100644 include/x16/screen.a02 create mode 100644 include/x16/screen.h02 diff --git a/include/x16/keydef.a02 b/include/x16/keydef.a02 new file mode 100644 index 0000000..730cacb --- /dev/null +++ b/include/x16/keydef.a02 @@ -0,0 +1,37 @@ +;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 diff --git a/include/x16/keydef.h02 b/include/x16/keydef.h02 new file mode 100644 index 0000000..e343eed --- /dev/null +++ b/include/x16/keydef.h02 @@ -0,0 +1,36 @@ +/* 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 diff --git a/include/x16/screen.a02 b/include/x16/screen.a02 new file mode 100644 index 0000000..43ff8ca --- /dev/null +++ b/include/x16/screen.a02 @@ -0,0 +1,45 @@ +;Screen Control Assembly Lanuage Routines for VIC-20 + + ;SUBROUTINE + +SMTEXT EQU $00 ;Default Text Screen +SMWIDE EQU $02 ;Wide Text Screen (Undefined) + +;Set Screen Mode +SETSCR: SEC ;Set Carry + JSR $FF5F ;Call SCRMOD + LDA #0 ;Set Return Value to Zero + BCC .RETURN ;If Carry Set + DEC ; Return 255 (Error) +.RETURN RTS + +;Get Screen Mode +GETSCR: CLC ;Clear Carry + JMP $FF5F ;Execute SCRMOD + RTS + +;Clear the Screen +CLRSCR LDA #$93 ;Load CLR/HOME Character + JMP PUTCHR ;and Print to Screen + +;Move Cursor To Home Position +CRSRHM LDA #$13 ;Load HOME Character + JMP PUTCHR ;and Print to Screen + +;Move Cursor to Specified Coordinates +SETPOS: .DC $5A ;PHY Copy Row + .DC $FA ;PLX to X Register, + TAY ;Column to Y Register + CLC ;Set Carry + JMP $FFF0 ;and Execute Plot + +;Get Cursor Position +GETPOS: LDY $D6 ;Load Cursor Row + LDA $D3 ;Load Cursor Column + RTS + +;Get Screen Size +GETSIZ: JSR $FFED ;Call SCREEN Kernal Routine + TXA ;Transfer Width to Accumulator + RTS + diff --git a/include/x16/screen.h02 b/include/x16/screen.h02 new file mode 100644 index 0000000..052b196 --- /dev/null +++ b/include/x16/screen.h02 @@ -0,0 +1,38 @@ +/***************************************************** + * Screen Control Functions and Constants for VIC-20 * + *****************************************************/ + +/* Screen Modes for getscr() and setscr() */ +#define SMTEXT $00 //Default Text Mode (40x30) +#define SMWIDE $02 //Wide Screen Text Mode (80x60) + +/* Clear the Screen */ +void clrscn(); + +/* Move Cursor to Top Left of Screen */ +void crsrhm(); + +/* Get Current Cursor Position * + * Returns: cursor column * + ( cursor row */ +char getpos(); + +/* Get Screen Size * + * Returns: width in columns * + * height in rows */ +char getsiz(); + +/* Get Screen Mode * + * Returns: char mode - Current Screen Mode */ +char getscr(); + +/* Move Cursor to Specified Position * + * Args: column - screen column (0 = left) * + * row - screen line (0 = top) */ +void setpos(); + +/* Set Screen Mode * + * Args: char mode - screen mode * + * 0 = default text mode * + * Returns: $FF if Mode Invalid */ +char setscr();