shrink saved stack

This commit is contained in:
Peter Ferrie 2021-10-26 22:05:15 -07:00
parent d679959325
commit 5a9681c91a
3 changed files with 9 additions and 6 deletions

View File

@ -78,8 +78,9 @@ RestoreStackNextTime
; reset to branch so we don't try to
sta RestoreStackNextTime + 1
; restore the same stack twice
ldx #$F1
- lda STACKBASE - $EF,x ; restore stack
ldx #-gStackSize
- lda STACKBASE - $FE + gStackSize,x
; restore stack
sta $100,x
inx
bne -
@ -179,7 +180,7 @@ COPYSRC = *
!source "src/glue.launch.lc2.a"
!source "src/hw.accel.lc2.a"
STACKBASE = *
LCRAM2_END = STACKBASE + 15
LCRAM2_END = STACKBASE + gStackSize
!if LCRAM2_END >= DisableAccelerator {
!error "code is too large: ends at ", LCRAM2_END
}

View File

@ -17,7 +17,7 @@
; D000..D3FF - ProRWTS data
; D400..D6C3 - ProRWTS code
; D6C4..DB91 - HGR font code & ProRWTS glue code
; DB92..DBA1 - backup of stack (during gameplay and self-running demos)
; DB92..DB98 - backup of stack (during gameplay and self-running demos)
; ...unused...
; DBB4..DBFF - (de)acceleration function
; DC00..DFFF - HGR font data
@ -104,6 +104,7 @@ BestMatchScore = $FC ; byte
; $FF ; used by ParseGamesList
; main memory
gStackSize = 6 ; seems like only six are needed
gPathname = $BFD0 ; used by SetPath/AddToPath
gKeyLen = $1F00 ; used by ParseGamesList
gKey = $1F01

View File

@ -8,9 +8,10 @@
; which handle bank switching for you.
LaunchInternal
ldy #$F1
ldy #-gStackSize
- lda $100,y
sta STACKBASE - $EF,y ; back up stack
sta STACKBASE - $FE + gStackSize,y
; back up stack
iny
bne -
tsx ; back up stack pointer