Add basic support for ORIC Atmos

git-svn-id: svn://svn.cc65.org/cc65/trunk@2046 b7a2c559-68d2-44c3-8de9-860c34a00d81
This commit is contained in:
cuz
2003-04-13 22:12:09 +00:00
parent d48f341bba
commit 9f547a5a4d
21 changed files with 1001 additions and 5 deletions

View File

@@ -8,25 +8,59 @@
.export _exit
.import initlib, donelib
.import push0, callmain, zerobss
.import __RAM_START__, __RAM_SIZE__ ; Linker generated
.import callmain, zerobss
.import __RAM_START__, __RAM_SIZE__, __RAM_LAST__
.include "zeropage.inc"
.include "atmos.inc"
.importzp sp
; ------------------------------------------------------------------------
; Create an empty LOWCODE segment to avoid linker warnings
.segment "LOWCODE"
; ------------------------------------------------------------------------
; Oric tape header
.segment "TAPEHDR"
.byte $16, $16, $16 ; Sync bytes
.byte $24 ; End of header marker
.byte $00 ; $2B0
.byte $00 ; $2AF
.byte $80 ; $2AE Machine code flag
.byte $C7 ; $2AD Autoload flag
.dbyt __RAM_START__ + __RAM_LAST__ ; $2AB
.dbyt __RAM_START__ ; $2A9
.byte $00 ; $2A8
.byte $00 ; Zero terminated name
; ------------------------------------------------------------------------
; Place the startup code in a special segment.
.segment "STARTUP"
; Save the zero page area we're about to use
ldx #zpspace-1
L1: lda sp,x
sta zpsave,x ; Save the zero page locations we need
dex
bpl L1
; Clear the BSS data
jsr zerobss
; Unprotect columns 0 and 1
lda STATUS
sta stsave
and #%11011111
sta STATUS
; Save system stuff and setup the stack
tsx
@@ -53,6 +87,16 @@ _exit: jsr donelib ; Run module destructors
ldx spsave
txs
lda stsave
sta STATUS
; Copy back the zero page stuff
ldx #zpspace-1
L2: lda zpsave,x
sta sp,x
dex
bpl L2
; Back to BASIC
@@ -61,7 +105,12 @@ _exit: jsr donelib ; Run module destructors
; ------------------------------------------------------------------------
; Data
.data
zpsave: .res zpspace
.bss
spsave: .res 1
stsave: .res 1