Updated cx16 to match the Commander X16 ROMs and emulator, release 34.

This commit is contained in:
Greg King
2019-11-16 13:11:40 -05:00
parent 4dda5d2173
commit d78133e1f0
37 changed files with 607 additions and 182 deletions

View File

@@ -9,7 +9,6 @@
.import zerobss, callmain
.import CHROUT
.import __MAIN_START__, __MAIN_SIZE__ ; Linker-generated
.importzp ST
.include "zeropage.inc"
.include "cx16.inc"
@@ -36,11 +35,18 @@ Start: tsx
jsr callmain
; Back from main() [this is also the exit() entry]. Run the module destructors.
; Back from main() [this is also the exit() entry].
_exit:
; Put the program return code into BASIC's status variable.
sta STATUS
; Run the module destructors.
_exit: pha ; Save the return code on stack
jsr donelib
.if 0 ; We no longer need to preserve zero-page space for cc65's variables.
; Copy back the zero-page stuff.
ldx #zpspace-1
@@ -48,11 +54,7 @@ L2: lda zpsave,x
sta sp,x
dex
bpl L2
; Place the program return code into BASIC's status variable.
pla
sta ST
.endif
; Restore the system stuff.
@@ -88,6 +90,7 @@ init:
lda #$00 ; Choose RAM bank zero
sta VIA1::PRA2
.if 0 ; We no longer need to preserve zero-page space for cc65's variables.
; Save the zero-page locations that we need.
ldx #zpspace-1
@@ -95,6 +98,7 @@ L1: lda sp,x
sta zpsave,x
dex
bpl L1
.endif
; Set up the stack.
@@ -121,4 +125,6 @@ L1: lda sp,x
ramsave:
.res 1
spsave: .res 1
.if 0
zpsave: .res zpspace
.endif