recopy reset vector code to during Reenter, because some games and demos clobber it

This commit is contained in:
4am 2019-09-15 21:00:38 -04:00
parent 1abaf7c5ad
commit 986244b88b
2 changed files with 14 additions and 16 deletions

View File

@ -44,6 +44,17 @@ Reenter
+READ_RAM2_WRITE_RAM2
jsr CloseHandles ; close any open handles to restore ProRWTS
jsr SaveOrRestoreScreenHoles ; restore original screen hole contents
ldx #5
- lda ResetVector,x ; copy reentry wrapper to bottom of stack
sta $100,x ; (used as reset vector because ][+ always
dex ; switches to ROM on Ctrl-Reset)
bpl -
inx
stx $3F2 ; page 3 reset vector to ($100)
inx
stx $3F3
ldx #$A4
stx $3F4
RestoreStackNextTime
clc ; SMC
bcc SearchMode ; not an unconditional branch because code
@ -62,6 +73,9 @@ RestoreStackNextTime
txs
+READ_RAM1_WRITE_RAM1
rts ; and return to caller
ResetVector ; 6 bytes, copied to $100
+READ_RAM1_NO_WRITE
jmp Reenter
; these routines will only be called after relocating to language card
!source "src/ui.search.mode.a"

View File

@ -245,23 +245,7 @@ OneTimeSetup
cpy #$03
bcc @outer
ldx #5
- lda @ResetVector,x ; copy reentry wrapper to bottom of stack
sta $100,x ; (used as reset vector because ][+ always
dex ; switches to ROM on Ctrl-Reset)
bpl -
inx
stx $3F2 ; page 3 reset vector to ($100)
inx
stx $3F3
ldx #$A4
stx $3F4
bit CLEARKBD
; execution falls through here
@ResetVector
; main entry point into launcher (also used by self-running demos, vectors)
+READ_RAM1_NO_WRITE
jmp Reenter
@kGameListConfFile