move most of Launch code to LC RAM bank 2

This commit is contained in:
4am 2019-09-24 18:40:43 -04:00
parent 01f1885ea4
commit a50b4d8a04
3 changed files with 29 additions and 23 deletions

View File

@ -9,7 +9,7 @@
; D000..E5F4 - persistent data structures (per-game cheat categories,
; gGlobalPrefsStore, gGamesListStore)
; ...unused...
; EC89..FFF9 - main program code
; ECBA..FFF9 - main program code
; FFFA..FFFF - NMI, reset, IRQ vectors
;
; LC RAM BANK 2

View File

@ -9,6 +9,9 @@
; - PlayGame
; - Launch
;
; Public variables:
; - gGameToLaunch - 0-based index into gGamesListStore
;
GetGameDisplayName
; in: A/Y points to game filename
@ -146,25 +149,4 @@ gGameToLaunch=*+1
; execution falls through here
Launch
jsr SwitchToBank2
jsr SaveOrRestoreScreenHoles ; save screen hole contents
ldy #$F1
- lda $100,y
sta $DF00,y ; back up stack
iny
bne -
tsx ; back up stack pointer
stx $DFF0
lda #$38 ; 'sec' opcode to tell |Reenter| to
sta RestoreStackNextTime ; restore the stack and stack pointer
ldx #(end_promote-promote-1)
- lda promote,x ; copy ProDOS shim to main memory
sta $bf00,x
dex
bpl -
tya
ldy #$18
- sta $bf57,y
dey
bne -
jmp $106 ; jump to pre-launch code
jmp LaunchInternal

View File

@ -630,3 +630,27 @@ SaveSmallFileInternal
sta reqcmd
sta sizelo ; non-zero
jmp hddopendir ; exit via ProRWTS2 (must re-open the file after query)
LaunchInternal
jsr SaveOrRestoreScreenHoles ; save screen hole contents
ldy #$F1
- lda $100,y
sta $DF00,y ; back up stack
iny
bne -
tsx ; back up stack pointer
stx $DFF0
lda #$38 ; 'sec' opcode to tell |Reenter| to
sta RestoreStackNextTime ; restore the stack and stack pointer
ldx #(end_promote-promote-1)
- lda promote,x ; copy ProDOS shim to main memory
sta $bf00,x
dex
bpl -
tya
ldy #$18
- sta $bf57,y
dey
bne -
jmp $106 ; jump to pre-launch code