save okvs across demo runs

This commit is contained in:
Peter Ferrie 2021-10-29 12:59:35 -07:00
parent dc021b45d3
commit 89895ea52d
4 changed files with 12 additions and 6 deletions

View File

@ -177,7 +177,8 @@ COPYSRC = *
!source "src/glue.launch.lc2.a" !source "src/glue.launch.lc2.a"
!source "src/hw.accel.lc2.a" !source "src/hw.accel.lc2.a"
STACKBASE = * STACKBASE = *
LCRAM2_END = STACKBASE + gStackSize - 1 OKVS_CACHE = STACKBASE + gStackSize
LCRAM2_END = OKVS_CACHE + 5
!if LCRAM2_END >= DisableAccelerator { !if LCRAM2_END >= DisableAccelerator {
!error "code is too large: ends at ", LCRAM2_END !error "code is too large: ends at ", LCRAM2_END
} }
@ -194,6 +195,7 @@ EvenLasterMover
!set PASS2=1 !set PASS2=1
!warn "ProRWTS ends at ", hdddataend - 1 !warn "ProRWTS ends at ", hdddataend - 1
!warn "STACK at ", STACKBASE !warn "STACK at ", STACKBASE
!warn "OKVS CACHE at ", OKVS_CACHE
!warn "LCRAM2 ends at ", LCRAM2_END !warn "LCRAM2 ends at ", LCRAM2_END
!warn "RELBASE = ", $10000 - (LastMover - FirstMover) !warn "RELBASE = ", $10000 - (LastMover - FirstMover)
} }

View File

@ -10,7 +10,7 @@
; ...unused... ; ...unused...
; E000..E3FF - HGR font data ; E000..E3FF - HGR font data
; ...unused... ; ...unused...
; E96C..FFEE - main program code ; E966..FFEE - main program code
; FFEF..FFF9 - API functions and global constants available for main program ; FFEF..FFF9 - API functions and global constants available for main program
; code, prelaunchers, transition effects, &c. ; code, prelaunchers, transition effects, &c.
; (LoadFileDirect, Wait/UnwaitForVBL, MockingboardStuff, MachineStatus) ; (LoadFileDirect, Wait/UnwaitForVBL, MockingboardStuff, MachineStatus)
@ -21,6 +21,7 @@
; D400..D6C3 - ProRWTS code ; D400..D6C3 - ProRWTS code
; D6C4..DAB9 - ProRWTS glue code ; D6C4..DAB9 - ProRWTS glue code
; DABA..DABF - backup of stack (during gameplay and self-running demos) ; DABA..DABF - backup of stack (during gameplay and self-running demos)
; DAC0..DAC5 - okvs cache (attract state saved across self-running demo)
; ...unused... ; ...unused...
; DBB4..DBFF - (de)acceleration function ; DBB4..DBFF - (de)acceleration function
; DC00..DFFF - unused ; DC00..DFFF - unused
@ -149,6 +150,8 @@ HAS_VIDHD = %00010000
SUPPORTS_SHR = %00110000 SUPPORTS_SHR = %00110000
CHEATS_ENABLED = %00001000 CHEATS_ENABLED = %00001000
PRELAUNCH_STANDARD_SIZE = 61 ; LoadStandardPrelaunch, eventually to be determined at build-time
; shared symbols for prelaunch and effects to call ProRWTS2 functions ; shared symbols for prelaunch and effects to call ProRWTS2 functions
iCurBlockLo = $D401 ; constant iCurBlockLo = $D401 ; constant
iCurBlockHi = $D403 ; constant iCurBlockHi = $D403 ; constant

View File

@ -233,4 +233,4 @@ LoadStandardPrelaunch
rts rts
+ !byte 0 + !byte 0
!be24 0 !be24 0
!le16 68 !le16 PRELAUNCH_STANDARD_SIZE

View File

@ -78,10 +78,11 @@ MiniAttractMode
!word - !word -
+ !word $FDFD ; SMC + !word $FDFD ; SMC
jsr okvs_get_current jsr okvs_get_current
sty $1FFA jsr SwitchToBank2
sty OKVS_CACHE
ldy #4 ldy #4
- lda (PTR), y - lda (PTR), y
sta $1FFB, y sta OKVS_CACHE + 1, y
dey dey
bpl - bpl -
@ -95,7 +96,7 @@ MiniAttractMode
jsr LoadIndexedFile jsr LoadIndexedFile
!word kAttractModeFulFile !word kAttractModeFulFile
- !word $6000 - !word $6000
!word $1FFA !word OKVS_CACHE
+LDADDR - +LDADDR -
jsr okvs_len jsr okvs_len