mirror of
https://github.com/a2-4am/4cade.git
synced 2024-11-26 17:49:43 +00:00
fix Reenter race-condition and mini-attract off-by-one
This commit is contained in:
parent
92aefda47f
commit
f287cc4d98
12
src/4cade.a
12
src/4cade.a
@ -78,15 +78,15 @@ RestoreStackNextTime
|
||||
; reset to branch so we don't try to
|
||||
sta RestoreStackNextTime + 1
|
||||
; restore the same stack twice
|
||||
ldx #-gStackSize
|
||||
- lda STACKBASE - $FE + gStackSize,x
|
||||
STACKPTR
|
||||
ldx #$D1 ; SMC, restore stack pointer
|
||||
txs
|
||||
inx
|
||||
- lda STACKBASE - $100 + gStackSize,x
|
||||
; restore stack
|
||||
sta $100,x
|
||||
inx
|
||||
bne -
|
||||
STACKPTR
|
||||
ldx #$D1 ; SMC, restore stack pointer
|
||||
txs
|
||||
SwitchToBank1
|
||||
+READ_RAM1_WRITE_RAM1
|
||||
rts
|
||||
@ -177,7 +177,7 @@ COPYSRC = *
|
||||
!source "src/glue.launch.lc2.a"
|
||||
!source "src/hw.accel.lc2.a"
|
||||
STACKBASE = *
|
||||
LCRAM2_END = STACKBASE + gStackSize
|
||||
LCRAM2_END = STACKBASE + gStackSize - 1
|
||||
!if LCRAM2_END >= DisableAccelerator {
|
||||
!error "code is too large: ends at ", LCRAM2_END
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
;license:MIT
|
||||
;(c) 2018-9 by 4am & qkumba
|
||||
;(c) 2018-2021 by 4am & qkumba
|
||||
;
|
||||
; Functions to launch games and self-running demos
|
||||
;
|
||||
@ -8,18 +8,18 @@
|
||||
; which handle bank switching for you.
|
||||
|
||||
LaunchInternal
|
||||
ldy #-gStackSize
|
||||
- lda $100,y
|
||||
sta STACKBASE - $FE + gStackSize,y
|
||||
; back up stack
|
||||
iny
|
||||
bne -
|
||||
tsx ; back up stack pointer
|
||||
stx STACKPTR + 1
|
||||
sty RestoreStackNextTime + 1
|
||||
inx
|
||||
- pla
|
||||
sta STACKBASE - $100 + gStackSize,x
|
||||
; back up stack
|
||||
inx
|
||||
bne -
|
||||
stx RestoreStackNextTime + 1
|
||||
; tell |Reenter| to restore the stack and stack pointer
|
||||
|
||||
tya
|
||||
txa
|
||||
ldy #$18
|
||||
- sta $bf57,y
|
||||
dey
|
||||
|
@ -78,10 +78,10 @@ MiniAttractMode
|
||||
!word -
|
||||
+ !word $FDFD ; SMC
|
||||
jsr okvs_get_current
|
||||
sty $1FFB
|
||||
sty $1FFA
|
||||
ldy #4
|
||||
- lda (PTR), y
|
||||
sta $1FFC, y
|
||||
sta $1FFB, y
|
||||
dey
|
||||
bpl -
|
||||
|
||||
@ -93,7 +93,7 @@ MiniAttractMode
|
||||
jsr LoadIndexedFile
|
||||
!word kAttractModeFulFile
|
||||
- !word $6000
|
||||
!word $1FFB
|
||||
!word $1FFA
|
||||
|
||||
+LDADDR -
|
||||
jsr okvs_len
|
||||
|
Loading…
Reference in New Issue
Block a user