diff --git a/src/constants.a b/src/constants.a index 37ba7f198..fd580d27e 100644 --- a/src/constants.a +++ b/src/constants.a @@ -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 diff --git a/src/glue.launch.a b/src/glue.launch.a index 7842a8dfd..a096eac5e 100644 --- a/src/glue.launch.a +++ b/src/glue.launch.a @@ -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 diff --git a/src/prodos.impl.a b/src/prodos.impl.a index 8c9c647d1..e60083967 100644 --- a/src/prodos.impl.a +++ b/src/prodos.impl.a @@ -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