Merge remote-tracking branch 'origin/master' into coniopeek
This commit is contained in:
@@ -7,9 +7,44 @@
|
||||
|
||||
.include "atmos.inc"
|
||||
|
||||
_atmos_ping := PING
|
||||
_atmos_shoot := SHOOT
|
||||
_atmos_explode := EXPLODE
|
||||
_atmos_zap := ZAP
|
||||
_atmos_tick := TICK
|
||||
_atmos_tock := TOCK
|
||||
.proc _atmos_ping
|
||||
bit $31
|
||||
bvs L1 ; Atmos?
|
||||
jmp PING
|
||||
L1: jmp PING1
|
||||
.endproc
|
||||
|
||||
.proc _atmos_shoot
|
||||
bit $31
|
||||
bvs L1 ; Atmos?
|
||||
jmp SHOOT
|
||||
L1: jmp SHOOT1
|
||||
.endproc
|
||||
|
||||
.proc _atmos_explode
|
||||
bit $31
|
||||
bvs L1 ; Atmos?
|
||||
jmp EXPLODE
|
||||
L1: jmp EXPLODE1
|
||||
.endproc
|
||||
|
||||
.proc _atmos_zap
|
||||
bit $31
|
||||
bvs L1 ; Atmos?
|
||||
jmp ZAP
|
||||
L1: jmp ZAP1
|
||||
.endproc
|
||||
|
||||
.proc _atmos_tick
|
||||
bit $31
|
||||
bvs L1 ; Atmos?
|
||||
jmp TICK
|
||||
L1: jmp TICK1
|
||||
.endproc
|
||||
|
||||
.proc _atmos_tock
|
||||
bit $31
|
||||
bvs L1 ; Atmos?
|
||||
jmp TOCK
|
||||
L1: jmp TOCK1
|
||||
.endproc
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;
|
||||
; 2010-11-14, Ullrich von Bassewitz
|
||||
; 2014-09-06, Greg King
|
||||
; 2016-03-17, Greg King
|
||||
;
|
||||
; This module supplies a small BASIC stub program that uses CALL
|
||||
; to jump to the machine-language code that follows it.
|
||||
@@ -22,3 +22,13 @@
|
||||
.byte $00 ; End of BASIC line
|
||||
Next: .addr $0000 ; BASIC program end marker
|
||||
Start:
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
; This padding is needed by a bug in the ROM.
|
||||
; (The CLOAD command starts BASIC's variables table on top of the last byte
|
||||
; that was loaded [instead of at the next address].)
|
||||
|
||||
.segment "BASTAIL"
|
||||
|
||||
.byte 0
|
||||
|
||||
@@ -15,9 +15,10 @@
|
||||
|
||||
|
||||
;--------------------------------------------------------------------------
|
||||
; Put this constructor into a segment that can be re-used by programs.
|
||||
; Put this constructor into a segment whose space
|
||||
; will be re-used by BSS, the heap, and the C stack.
|
||||
;
|
||||
.segment "INIT"
|
||||
.segment "ONCE"
|
||||
|
||||
; Turn the capitals lock off.
|
||||
|
||||
@@ -43,7 +44,7 @@ restore_caps:
|
||||
|
||||
;--------------------------------------------------------------------------
|
||||
|
||||
.bss
|
||||
.segment "INIT"
|
||||
|
||||
capsave:
|
||||
.res 1
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
;
|
||||
|
||||
.export _cclearxy, _cclear
|
||||
.import setscrptr
|
||||
.import setscrptr
|
||||
.import rvs
|
||||
.import popax
|
||||
.importzp ptr2
|
||||
@@ -25,7 +25,7 @@ _cclear:
|
||||
tax ; Is the length zero?
|
||||
beq @L9 ; Jump if done
|
||||
jsr setscrptr ; Set ptr2 to screen, won't use X
|
||||
lda #' '
|
||||
lda #' '
|
||||
ora rvs
|
||||
@L1: sta (ptr2),y ; Write one char
|
||||
iny ; Next char
|
||||
|
||||
@@ -6,7 +6,6 @@
|
||||
;
|
||||
|
||||
.export _cgetc
|
||||
.constructor initcgetc
|
||||
|
||||
.import cursor
|
||||
.forceimport disable_caps
|
||||
@@ -53,14 +52,3 @@
|
||||
@L3: rts
|
||||
|
||||
.endproc
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Switch the cursor off. Code goes into the INIT segment
|
||||
; which may be reused after it is run.
|
||||
|
||||
.segment "INIT"
|
||||
|
||||
initcgetc:
|
||||
lsr STATUS
|
||||
asl STATUS ; Clear bit zero
|
||||
rts
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
;
|
||||
|
||||
.export _cputcxy, _cputc
|
||||
.export setscrptr, putchar
|
||||
.export setscrptr, cputdirect, putchar
|
||||
.constructor initcputc
|
||||
.import rvs
|
||||
.import popax
|
||||
.importzp ptr2
|
||||
@@ -31,13 +32,13 @@ _cputc: cmp #$0D ; CR?
|
||||
rts
|
||||
|
||||
L1: cmp #$0A ; LF?
|
||||
bne output
|
||||
bne cputdirect
|
||||
inc CURS_Y ; Newline
|
||||
rts
|
||||
|
||||
; Output the character, then advance the cursor position
|
||||
|
||||
output:
|
||||
cputdirect:
|
||||
jsr putchar
|
||||
|
||||
advance:
|
||||
@@ -95,3 +96,13 @@ ScrTabHi:
|
||||
.byte >(SCREEN + Line * SCREEN_XSIZE)
|
||||
.endrep
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Switch the cursor off. Code goes into the ONCE segment,
|
||||
; which will be reused after it is run.
|
||||
|
||||
.segment "ONCE"
|
||||
|
||||
initcputc:
|
||||
lsr STATUS
|
||||
asl STATUS ; Clear bit zero
|
||||
rts
|
||||
|
||||
@@ -2,14 +2,15 @@
|
||||
; Startup code for cc65 (Oric version)
|
||||
;
|
||||
; By Debrune J<>r<EFBFBD>me <jede@oric.org> and Ullrich von Bassewitz <uz@cc65.org>
|
||||
; 2015-01-09, Greg King
|
||||
; 2016-03-18, Greg King
|
||||
;
|
||||
|
||||
.export _exit
|
||||
.export __STARTUP__ : absolute = 1 ; Mark as startup
|
||||
|
||||
.import initlib, donelib
|
||||
.import callmain, zerobss
|
||||
.import __RAM_START__, __RAM_SIZE__, __STACKSIZE__
|
||||
.import __MAIN_START__, __MAIN_SIZE__
|
||||
|
||||
.include "zeropage.inc"
|
||||
.include "atmos.inc"
|
||||
@@ -19,39 +20,17 @@
|
||||
|
||||
.segment "STARTUP"
|
||||
|
||||
; Save the zero-page area that we're about to use.
|
||||
|
||||
ldx #zpspace-1
|
||||
L1: lda sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl L1
|
||||
|
||||
; Clear the BSS data.
|
||||
|
||||
jsr zerobss
|
||||
|
||||
; Currently, color isn't supported on the text screen.
|
||||
; Unprotect screen columns 0 and 1 (where each line's color codes would sit).
|
||||
|
||||
lda STATUS
|
||||
sta stsave
|
||||
and #%11011111
|
||||
sta STATUS
|
||||
|
||||
; Save some system stuff; and, set up the stack.
|
||||
|
||||
tsx
|
||||
stx spsave ; Save system stk ptr
|
||||
|
||||
lda #<(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
|
||||
sta sp
|
||||
lda #>(__RAM_START__ + __RAM_SIZE__ + __STACKSIZE__)
|
||||
sta sp+1 ; Set argument stack ptr
|
||||
; Save space by putting some of the start-up code in a segment
|
||||
; that will be re-used.
|
||||
|
||||
; Call the module constructors.
|
||||
jsr init
|
||||
|
||||
jsr initlib
|
||||
; Clear the BSS variables (after the constructors have been run).
|
||||
|
||||
jsr zerobss
|
||||
|
||||
; Push the command-line arguments; and, call main().
|
||||
|
||||
@@ -70,7 +49,7 @@ _exit: jsr donelib
|
||||
|
||||
; Copy back the zero-page stuff.
|
||||
|
||||
ldx #zpspace-1
|
||||
ldx #zpspace - 1
|
||||
L2: lda zpsave,x
|
||||
sta sp,x
|
||||
dex
|
||||
@@ -81,28 +60,42 @@ L2: lda zpsave,x
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Put this code in a place that will be re-used by BSS, the heap,
|
||||
; and the C stack.
|
||||
|
||||
.segment "ZPSAVE1"
|
||||
.segment "ONCE"
|
||||
|
||||
zpsave:
|
||||
; Save the zero-page area that we're about to use.
|
||||
|
||||
; This padding is needed by a bug in the ROM.
|
||||
; (The CLOAD command starts BASIC's variables table on top of the last byte
|
||||
; that was loaded [instead of at the next address].)
|
||||
; This is overlaid on a buffer, so that it doesn't use extra space in RAM.
|
||||
init: ldx #zpspace - 1
|
||||
L1: lda sp,x
|
||||
sta zpsave,x
|
||||
dex
|
||||
bpl L1
|
||||
|
||||
.byte 0
|
||||
; Currently, color isn't supported on the text screen.
|
||||
; Unprotect screen columns 0 and 1 (where each line's color codes would sit).
|
||||
|
||||
; The segments "ZPSAVE1" and "ZPSAVE2" always must be together.
|
||||
; They create a single object (the zpsave buffer).
|
||||
lda STATUS
|
||||
sta stsave
|
||||
and #%11011111
|
||||
sta STATUS
|
||||
|
||||
.segment "ZPSAVE2"
|
||||
; Set up the C stack.
|
||||
|
||||
.res zpspace - 1
|
||||
lda #<(__MAIN_START__ + __MAIN_SIZE__)
|
||||
ldx #>(__MAIN_START__ + __MAIN_SIZE__)
|
||||
sta sp
|
||||
stx sp+1 ; Set argument stack ptr
|
||||
|
||||
; Call the module constructors.
|
||||
|
||||
jmp initlib
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.bss
|
||||
.segment "INIT"
|
||||
|
||||
spsave: .res 1
|
||||
stsave: .res 1
|
||||
zpsave: .res zpspace
|
||||
|
||||
@@ -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://cc65.github.io
|
||||
;
|
||||
; 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
|
||||
__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_____
|
||||
|
||||
.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 $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_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 ___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_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 ; 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_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 $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 ; 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 ___________
|
||||
|
||||
.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_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 ___________
|
||||
|
||||
@@ -1,14 +1,18 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 2003-04-13
|
||||
; 2003-04-13, Ullrich von Bassewitz
|
||||
; 2017-06-15, Greg King
|
||||
;
|
||||
; void gotoxy (unsigned char x, unsigned char y);
|
||||
;
|
||||
|
||||
.export _gotoxy
|
||||
.export gotoxy, _gotoxy
|
||||
|
||||
.import popa
|
||||
|
||||
.include "atmos.inc"
|
||||
|
||||
gotoxy: jsr popa ; Get Y
|
||||
|
||||
.proc _gotoxy
|
||||
|
||||
sta CURS_Y ; Set Y
|
||||
@@ -17,5 +21,3 @@
|
||||
rts
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
|
||||
.segment "INIT"
|
||||
.segment "ONCE"
|
||||
|
||||
initirq:
|
||||
lda IRQVec
|
||||
|
||||
134
libsrc/atmos/joy/atmos-ijk.s
Normal file
134
libsrc/atmos/joy/atmos-ijk.s
Normal file
@@ -0,0 +1,134 @@
|
||||
;
|
||||
; IJK joystick driver for the Atmos
|
||||
; Can be used multiple times when statically linked to the application.
|
||||
;
|
||||
; 2002-12-20, Based on Ullrich von Bassewitz's code.
|
||||
; 2017-11-01, Stefan Haubenthal
|
||||
;
|
||||
|
||||
.include "joy-kernel.inc"
|
||||
.include "joy-error.inc"
|
||||
.include "atmos.inc"
|
||||
|
||||
.macpack module
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Header. Includes jump table
|
||||
|
||||
module_header _atmos_ijk_joy
|
||||
|
||||
; Driver signature
|
||||
|
||||
.byte $6A, $6F, $79 ; "joy"
|
||||
.byte JOY_API_VERSION ; Driver API version number
|
||||
|
||||
; Library reference
|
||||
|
||||
.addr $0000
|
||||
|
||||
; Jump table.
|
||||
|
||||
.addr INSTALL
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READ
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Constants
|
||||
|
||||
JOY_COUNT = 2 ; Number of joysticks we support
|
||||
|
||||
.code
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; INSTALL routine. Is called after the driver is loaded into memory. If
|
||||
; possible, check if the hardware is present and determine the amount of
|
||||
; memory available.
|
||||
; Must return an JOY_ERR_xx code in a/x.
|
||||
;
|
||||
|
||||
INSTALL:
|
||||
lda #%11000000
|
||||
sta VIA::DDRA
|
||||
sta VIA::PRA
|
||||
lda VIA::PRA
|
||||
and #%00100000
|
||||
bne ijkPresent
|
||||
lda #<JOY_ERR_NO_DEVICE
|
||||
.byte $2C ; Skip next opcode
|
||||
ijkPresent:
|
||||
lda #<JOY_ERR_OK
|
||||
ldx #>JOY_ERR_OK
|
||||
; rts ; Run into UNINSTALL instead
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; UNINSTALL routine. Is called before the driver is removed from memory.
|
||||
; Can do cleanup or whatever. Must not return anything.
|
||||
;
|
||||
|
||||
UNINSTALL:
|
||||
rts
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; COUNT: Return the total number of available joysticks in a/x.
|
||||
;
|
||||
|
||||
COUNT:
|
||||
lda #<JOY_COUNT
|
||||
ldx #>JOY_COUNT
|
||||
rts
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; READ: Read a particular joystick passed in A.
|
||||
;
|
||||
|
||||
READ:
|
||||
bne right
|
||||
|
||||
; Ensure Printer Strobe is set to Output
|
||||
lda #%10110111
|
||||
sta VIA::DDRB
|
||||
; Set Strobe Low
|
||||
lda #%00000000
|
||||
sta VIA::PRB
|
||||
; Set Top two bits of PortA to Output and rest as Input
|
||||
lda #%11000000
|
||||
sta VIA::DDRA
|
||||
|
||||
; Select Left Joystick
|
||||
lda #%01111111
|
||||
sta VIA::PRA
|
||||
; Read back Left Joystick state
|
||||
lda VIA::PRA
|
||||
; Mask out unused bits
|
||||
and #%00011111
|
||||
; Invert Bits
|
||||
eor #%00011111
|
||||
; Index table to conform to Generic Format
|
||||
tax
|
||||
lda GenericIJKBits,X
|
||||
bne L1
|
||||
|
||||
right:
|
||||
; Select Right Joystick
|
||||
lda #%10111111
|
||||
sta VIA::PRA
|
||||
; Read back Right Joystick state and rejig bits
|
||||
lda VIA::PRA
|
||||
and #%00011111
|
||||
eor #%00011111
|
||||
tax
|
||||
lda GenericIJKBits,X
|
||||
|
||||
; Restore VIA PortA state
|
||||
L1: ldx #%11111111
|
||||
stx VIA::DDRA
|
||||
inx ; x=0
|
||||
rts
|
||||
|
||||
.rodata
|
||||
GenericIJKBits:
|
||||
.byte 0,2,1,3,32,34,33,0,8,10,9,0,40,42,41,0
|
||||
.byte 16,18,17,0,48,50,49,0,0,0,0,0,0,0,0,0
|
||||
@@ -28,24 +28,12 @@
|
||||
|
||||
.addr $0000
|
||||
|
||||
; Button state masks (8 values)
|
||||
|
||||
.byte $10 ; JOY_UP
|
||||
.byte $08 ; JOY_DOWN
|
||||
.byte $01 ; JOY_LEFT
|
||||
.byte $02 ; JOY_RIGHT
|
||||
.byte $20 ; JOY_FIRE
|
||||
.byte $00 ; Future expansion
|
||||
.byte $00 ; Future expansion
|
||||
.byte $00 ; Future expansion
|
||||
|
||||
; Jump table.
|
||||
|
||||
.addr INSTALL
|
||||
.addr UNINSTALL
|
||||
.addr COUNT
|
||||
.addr READ
|
||||
.addr 0 ; IRQ entry unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Constants
|
||||
|
||||
@@ -13,34 +13,34 @@
|
||||
.macpack generic
|
||||
|
||||
MAXARGS = 10 ; Maximum number of arguments allowed
|
||||
REM = $9d ; BASIC token-code
|
||||
REM = $9D ; BASIC token-code
|
||||
|
||||
|
||||
;---------------------------------------------------------------------------
|
||||
; Get possible command-line arguments. Goes into the special INIT segment,
|
||||
; which may be reused after the startup code is run
|
||||
; Get possible command-line arguments. Goes into the special ONCE segment,
|
||||
; which will be reused after the startup code is run.
|
||||
|
||||
.segment "INIT"
|
||||
.segment "ONCE"
|
||||
|
||||
.proc initmainargs
|
||||
|
||||
; Assume that the program was loaded, a moment ago, by the traditional LOAD
|
||||
; statement. Save the "most-recent filename" as argument #0.
|
||||
; Because the buffer, that we're copying into, was zeroed out,
|
||||
; we don't need to add a NUL character.
|
||||
;
|
||||
ldy #FNAME_LEN - 1 ; limit the length
|
||||
|
||||
ldy #FNAME_LEN ; Limit the length
|
||||
lda #0 ; The terminating NUL character
|
||||
beq L1 ; Branch always
|
||||
L0: lda CFOUND_NAME,y
|
||||
sta name,y
|
||||
L1: sta name,y
|
||||
dey
|
||||
bpl L0
|
||||
inc __argc ; argc always is equal to, at least, 1
|
||||
|
||||
; Find the "rem" token.
|
||||
;
|
||||
|
||||
ldx #0
|
||||
L2: lda BASIC_BUF,x
|
||||
beq done ; no "rem", no args.
|
||||
beq done ; No "rem", no args.
|
||||
inx
|
||||
cmp #REM
|
||||
bne L2
|
||||
@@ -62,7 +62,7 @@ next: lda BASIC_BUF,x
|
||||
beq done ; End of line reached
|
||||
inx
|
||||
cmp #' ' ; Skip leading spaces
|
||||
beq next ;
|
||||
beq next
|
||||
|
||||
; Found start of next argument. We've incremented the pointer in X already, so
|
||||
; it points to the second character of the argument. This is useful since we
|
||||
@@ -79,7 +79,7 @@ setterm:sta term ; Set end of argument marker
|
||||
|
||||
txa ; Get low byte
|
||||
add #<args
|
||||
sta argv,y ; argv[y]= &arg
|
||||
sta argv,y ; argv[y]=&arg
|
||||
lda #>$0000
|
||||
adc #>args
|
||||
sta argv+1,y
|
||||
@@ -99,7 +99,7 @@ argloop:lda BASIC_BUF,x
|
||||
; A contains the terminating character. To make the argument a valid C string,
|
||||
; replace the terminating character by a zero.
|
||||
|
||||
lda #$00
|
||||
lda #0
|
||||
sta args-1,x
|
||||
|
||||
; Check if the maximum number of command line arguments is reached. If not,
|
||||
@@ -119,15 +119,16 @@ done: lda #<argv
|
||||
|
||||
.endproc
|
||||
|
||||
; These arrays are zeroed before initmainargs is called.
|
||||
; char name[16+1];
|
||||
; char* argv[MAXARGS+1]={name};
|
||||
;
|
||||
.bss
|
||||
.segment "INIT"
|
||||
|
||||
term: .res 1
|
||||
name: .res FNAME_LEN + 1
|
||||
args: .res SCREEN_XSIZE * 2 - 1
|
||||
|
||||
.data
|
||||
|
||||
; This array has zeroes when initmainargs starts.
|
||||
; char* argv[MAXARGS+1]={name};
|
||||
|
||||
argv: .addr name
|
||||
.res MAXARGS * 2, $00
|
||||
.res MAXARGS * 2
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
.export _read
|
||||
.constructor initstdin
|
||||
|
||||
.import popax
|
||||
.import popax, popptr1
|
||||
.importzp ptr1, ptr2, ptr3
|
||||
.forceimport disable_caps
|
||||
|
||||
@@ -20,20 +20,19 @@
|
||||
|
||||
sta ptr3
|
||||
stx ptr3+1 ; save count as result
|
||||
eor #$FF
|
||||
sta ptr2
|
||||
txa
|
||||
eor #$FF
|
||||
sta ptr2+1 ; Remember -count-1
|
||||
|
||||
jsr popax ; get buf
|
||||
sta ptr1
|
||||
stx ptr1+1
|
||||
inx
|
||||
stx ptr2+1
|
||||
tax
|
||||
inx
|
||||
stx ptr2 ; save count with each byte incremented separately
|
||||
|
||||
jsr popptr1 ; get buf
|
||||
jsr popax ; get fd and discard
|
||||
|
||||
L1: inc ptr2
|
||||
L1: dec ptr2
|
||||
bnz L2
|
||||
inc ptr2+1
|
||||
dec ptr2+1
|
||||
bze L9 ; no more room in buf
|
||||
|
||||
; If there are no more characters in BASIC's input buffer, then get a line from
|
||||
@@ -69,7 +68,7 @@ L9: lda ptr3
|
||||
;--------------------------------------------------------------------------
|
||||
; initstdin: Reset the stdin console.
|
||||
|
||||
.segment "INIT"
|
||||
.segment "ONCE"
|
||||
|
||||
initstdin:
|
||||
ldx #<-1
|
||||
@@ -79,8 +78,7 @@ initstdin:
|
||||
|
||||
;--------------------------------------------------------------------------
|
||||
|
||||
.bss
|
||||
.segment "INIT"
|
||||
|
||||
text_count:
|
||||
.res 1
|
||||
|
||||
|
||||
@@ -44,15 +44,15 @@
|
||||
.addr $0000
|
||||
|
||||
; Jump table
|
||||
.addr INSTALL
|
||||
.addr UNINSTALL
|
||||
.addr OPEN
|
||||
.addr CLOSE
|
||||
.addr GET
|
||||
.addr PUT
|
||||
.addr SER_INSTALL
|
||||
.addr SER_UNINSTALL
|
||||
.addr SER_OPEN
|
||||
.addr SER_CLOSE
|
||||
.addr SER_GET
|
||||
.addr SER_PUT
|
||||
.addr SER_STATUS
|
||||
.addr IOCTL
|
||||
.addr IRQ
|
||||
.addr SER_IOCTL
|
||||
.addr SER_IRQ
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; Global variables
|
||||
@@ -116,23 +116,23 @@ ParityTable:
|
||||
.code
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; INSTALL: Is called after the driver is loaded into memory. If possible,
|
||||
; SER_INSTALL: Is called after the driver is loaded into memory. If possible,
|
||||
; check if the hardware is present. Must return an SER_ERR_xx code in a/x.
|
||||
;
|
||||
; Since we don't have to manage the IRQ vector on the Telestrat/Atmos, this is
|
||||
; actually the same as:
|
||||
;
|
||||
; UNINSTALL: Is called before the driver is removed from memory.
|
||||
; SER_UNINSTALL: Is called before the driver is removed from memory.
|
||||
; No return code required (the driver is removed from memory on return).
|
||||
;
|
||||
; and:
|
||||
;
|
||||
; CLOSE: Close the port and disable interrupts. Called without parameters.
|
||||
; SER_CLOSE: Close the port and disable interrupts. Called without parameters.
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
INSTALL:
|
||||
UNINSTALL:
|
||||
CLOSE:
|
||||
SER_INSTALL:
|
||||
SER_UNINSTALL:
|
||||
SER_CLOSE:
|
||||
ldx Index ; Check for open port
|
||||
beq :+
|
||||
|
||||
@@ -147,10 +147,10 @@ CLOSE:
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; OPEN: A pointer to a ser_params structure is passed in ptr1.
|
||||
; SER_OPEN: A pointer to a ser_params structure is passed in ptr1.
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
OPEN:
|
||||
SER_OPEN:
|
||||
; Check if the handshake setting is valid
|
||||
ldy #SER_PARAMS::HANDSHAKE ; Handshake
|
||||
lda (ptr1),y
|
||||
@@ -220,11 +220,11 @@ InvBaud:lda #<SER_ERR_BAUD_UNAVAIL
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; GET: Will fetch a character from the receive buffer and store it into the
|
||||
; SER_GET: Will fetch a character from the receive buffer and store it into the
|
||||
; variable pointed to by ptr1. If no data is available, SER_ERR_NO_DATA is
|
||||
; returned.
|
||||
|
||||
GET:
|
||||
SER_GET:
|
||||
ldy SendFreeCnt ; Send data if necessary
|
||||
iny ; Y == $FF?
|
||||
beq :+
|
||||
@@ -261,10 +261,10 @@ GET:
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; PUT: Output character in A.
|
||||
; SER_PUT: Output character in A.
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
PUT:
|
||||
SER_PUT:
|
||||
; Try to send
|
||||
ldy SendFreeCnt
|
||||
iny ; Y = $FF?
|
||||
@@ -303,22 +303,22 @@ SER_STATUS:
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl
|
||||
; SER_IOCTL: Driver defined entry point. The wrapper will pass a pointer to ioctl
|
||||
; specific data in ptr1, and the ioctl code in A.
|
||||
; Must return an SER_ERR_xx code in a/x.
|
||||
|
||||
IOCTL:
|
||||
SER_IOCTL:
|
||||
lda #<SER_ERR_INV_IOCTL
|
||||
ldx #>SER_ERR_INV_IOCTL
|
||||
rts
|
||||
|
||||
;----------------------------------------------------------------------------
|
||||
; IRQ: Called from the builtin runtime IRQ handler as a subroutine. All
|
||||
; SER_IRQ: Called from the builtin runtime IRQ handler as a subroutine. All
|
||||
; registers are already saved, no parameters are passed, but the carry flag
|
||||
; is clear on entry. The routine must return with carry set if the interrupt
|
||||
; was handled, otherwise with carry clear.
|
||||
|
||||
IRQ:
|
||||
SER_IRQ:
|
||||
ldx Index ; Check for open port
|
||||
beq Done
|
||||
lda ACIA::STATUS,x ; Check ACIA status for receive interrupt
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
;
|
||||
; Ullrich von Bassewitz, 12.11.2002
|
||||
;
|
||||
; time_t _systime (void);
|
||||
; /* Similar to time(), but:
|
||||
; ** - Is not ISO C
|
||||
; ** - Does not take the additional pointer
|
||||
; ** - Does not set errno when returning -1
|
||||
; */
|
||||
;
|
||||
|
||||
.export __systime
|
||||
|
||||
.importzp sreg
|
||||
|
||||
.code
|
||||
|
||||
.proc __systime
|
||||
|
||||
lda #$FF
|
||||
tax
|
||||
sta sreg
|
||||
sta sreg+1
|
||||
rts ; Return -1
|
||||
|
||||
.endproc
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
;
|
||||
; Based on code by Debrune J<>r<EFBFBD>me <jede@oric.org>
|
||||
; 2015-01-08, Greg King
|
||||
; 2016-03-17, Greg King
|
||||
;
|
||||
|
||||
; The following symbol is used by the linker config. file
|
||||
@@ -8,7 +8,8 @@
|
||||
.export __TAPEHDR__:abs = 1
|
||||
|
||||
; These symbols, also, come from the configuration file.
|
||||
.import __BASHDR_LOAD__, __ZPSAVE1_LOAD__, __AUTORUN__, __PROGFLAG__
|
||||
.import __AUTORUN__, __PROGFLAG__
|
||||
.import __BASHEAD_START__, __MAIN_LAST__
|
||||
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
@@ -16,16 +17,16 @@
|
||||
|
||||
.segment "TAPEHDR"
|
||||
|
||||
.byte $16, $16, $16 ; Sync bytes
|
||||
.byte $24 ; Beginning-of-header marker
|
||||
.byte $16, $16, $16 ; Sync bytes
|
||||
.byte $24 ; Beginning-of-header marker
|
||||
|
||||
.byte $00 ; $2B0
|
||||
.byte $00 ; $2AF
|
||||
.byte <__PROGFLAG__ ; $2AE Language flag ($00=BASIC, $80=machine code)
|
||||
.byte <__AUTORUN__ ; $2AD Auto-run flag ($C7=run, $00=only load)
|
||||
.dbyt __ZPSAVE1_LOAD__ ;$2AB Address of end of file
|
||||
.dbyt __BASHDR_LOAD__ ; $2A9 Address of start of file
|
||||
.byte $00 ; $2A8
|
||||
.byte $00 ; $2B0
|
||||
.byte $00 ; $2AF
|
||||
.byte <__PROGFLAG__ ; $2AE Language flag ($00=BASIC, $80=machine code)
|
||||
.byte <__AUTORUN__ ; $2AD Auto-run flag ($C7=run, $00=only load)
|
||||
.dbyt __MAIN_LAST__ - 1 ; $2AB Address of end of file
|
||||
.dbyt __BASHEAD_START__ ; $2A9 Address of start of file
|
||||
.byte $00 ; $2A8
|
||||
|
||||
; File name (a maximum of 17 characters), zero-terminated
|
||||
.asciiz .sprintf("%u", .time)
|
||||
|
||||
@@ -59,7 +59,6 @@ YSIZE = 8 ; System font height
|
||||
.addr BAR
|
||||
.addr TEXTSTYLE
|
||||
.addr OUTTEXT
|
||||
.addr 0 ; IRQ entry is unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Data.
|
||||
|
||||
@@ -59,7 +59,6 @@ YSIZE = 8 ; System font height
|
||||
.addr BAR
|
||||
.addr TEXTSTYLE
|
||||
.addr OUTTEXT
|
||||
.addr 0 ; IRQ entry is unused
|
||||
|
||||
; ------------------------------------------------------------------------
|
||||
; Data.
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
;
|
||||
; Target-specific black & white values for use by the target-shared TGI kernel
|
||||
;
|
||||
|
||||
.include "tgi-kernel.inc"
|
||||
|
||||
.export tgi_color_black:zp = $00
|
||||
.export tgi_color_white:zp = $01
|
||||
@@ -1,14 +0,0 @@
|
||||
;
|
||||
; char __fastcall__ toascii (char c);
|
||||
; /* Convert a target-specific character to ASCII. */
|
||||
;
|
||||
|
||||
.export _toascii
|
||||
|
||||
.proc _toascii
|
||||
|
||||
; .X must be zero, on return.
|
||||
ldx #>$0000
|
||||
rts
|
||||
|
||||
.endproc
|
||||
@@ -7,7 +7,7 @@
|
||||
;
|
||||
|
||||
.export _write
|
||||
.import popax
|
||||
.import popax, popptr1
|
||||
.importzp ptr1, ptr2, ptr3, tmp1
|
||||
|
||||
.include "atmos.inc"
|
||||
@@ -17,19 +17,17 @@
|
||||
sta ptr3
|
||||
stx ptr3+1 ; save count as result
|
||||
|
||||
eor #$FF
|
||||
sta ptr2
|
||||
txa
|
||||
eor #$FF
|
||||
sta ptr2+1 ; Remember -count-1
|
||||
inx
|
||||
stx ptr2+1
|
||||
tax
|
||||
inx
|
||||
stx ptr2 ; save count with each byte incremented separately
|
||||
|
||||
jsr popax ; get buf
|
||||
sta ptr1
|
||||
stx ptr1+1
|
||||
jsr popptr1 ; get buf
|
||||
jsr popax ; get fd and discard
|
||||
L1: inc ptr2
|
||||
L1: dec ptr2
|
||||
bne L2
|
||||
inc ptr2+1
|
||||
dec ptr2+1
|
||||
beq L9
|
||||
L2: ldy #0
|
||||
lda (ptr1),y
|
||||
|
||||
Reference in New Issue
Block a user