From 9c6a93029e0c77479807846962dc680f0b70dc38 Mon Sep 17 00:00:00 2001 From: Peter Ferrie Date: Thu, 30 Jul 2020 10:21:42 -0700 Subject: [PATCH] stable exit to GS/OS --- src/4cade.a | 5 +++++ src/4cade.init.a | 8 +++++++- src/constants.a | 3 +-- src/glue.launch.lc2.a | 5 ----- 4 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/4cade.a b/src/4cade.a index db0c9a5d7..04963b957 100644 --- a/src/4cade.a +++ b/src/4cade.a @@ -46,6 +46,11 @@ Reenter jsr DisableAccelerator ; back to 1 MHz (especially important on IIgs ; which restores default speed on Ctrl-Reset) jsr CloseHandles ; close any open handles to restore ProRWTS + ldx #(end_promote-promote-1) +- lda promote,x ; copy ProDOS shim to main memory for GS/OS exit + sta $bf00,x + dex + bpl - ldx #5 - lda ResetVector,x ; copy reentry wrapper to bottom of stack sta $100,x ; (used as reset vector because //e always diff --git a/src/4cade.init.a b/src/4cade.init.a index b66669aa0..f729a2ef5 100644 --- a/src/4cade.init.a +++ b/src/4cade.init.a @@ -336,7 +336,7 @@ OneTimeSetup lda $E100BD ; Make sure GS/OS was the boot OS !cpu 6502 beq @NotGSOS - ldx #5 + ldx #(QuitToGSOS_e-QuitToGSOS)-1 - lda QuitToGSOS,x sta PatchQuit,x dex @@ -454,8 +454,14 @@ CopyDevs !byte 1 QuitToGSOS + lda #$8B + sta ProDOS_exit+1 ; restore bank 1 + lda #$FF ; no prefix + sta ProDOS_prefix + !cpu 65816 clc xce jmp $E0D000 !cpu 6502 +QuitToGSOS_e diff --git a/src/constants.a b/src/constants.a index 3d1c50993..67674fc23 100644 --- a/src/constants.a +++ b/src/constants.a @@ -7,8 +7,7 @@ ; ; LC RAM BANK 1 ; D000..E908 - persistent data structures (gGlobalPrefsStore, gGamesListStore) -; ...unused... -; E914..FFF1 - main program code +; E909..FFF1 - main program code ; FFF2..FFF9 - API functions and global constants available for main program ; code, prelaunchers, transition effects, &c. ; (Wait/UnwaitForVBL, MockingboardStuff, MachineStatus) diff --git a/src/glue.launch.lc2.a b/src/glue.launch.lc2.a index c439a020f..f62863b5c 100644 --- a/src/glue.launch.lc2.a +++ b/src/glue.launch.lc2.a @@ -18,11 +18,6 @@ LaunchInternal sty RestoreStackNextTime + 1 ; tell |Reenter| to 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