clean up RAM/HD files on Ctrl-Reset

This commit is contained in:
4am 2021-04-19 10:44:51 -04:00
parent 4a97d929eb
commit 6d70d7956d
2 changed files with 13 additions and 11 deletions

View File

@ -127,6 +127,7 @@ ResetVector
sta $C004
sta $C00C
sta $C00E
jsr CleanupFiles
jsr ThisSlot
; /!\ execution falls through here
@ -571,10 +572,7 @@ FatalError
TheEnd
lda $C0E8
jsr SwapProDOS ; ProDOS out -> in
jsr DeleteFileOnRAMDisk ; always safe to call
jsr CloseFileOnHardDisk ; always safe to call
jsr SwapProDOS ; ProDOS in -> out
jsr CleanupFiles
lda #s_done
jsr PrintByID
jsr WaitForKey
@ -619,7 +617,7 @@ CleanExit
lda gChangedPrefs
bne +
jsr SavePrefs
+ jsr DeleteFileOnRAMDisk ; always safe to call
+ jsr CleanupFiles
jsr MLI ; does not return
!byte $65
!word +
@ -627,6 +625,12 @@ CleanExit
!source "progress.a"
CleanupFiles
jsr SwapProDOS ; ProDOS out -> in
jsr DeleteFileOnRAMDisk ; always safe to call
jsr CloseFileOnHardDisk ; always safe to call
jmp SwapProDOS ; ProDOS in -> out
;-------------------------------
; WriteTrack
;-------------------------------

View File

@ -6,21 +6,19 @@
lda $BF98 ; ProDOS MachineID
and #$20 ; at least 64K?
bne good_mem
bne OneTimeSetup
jsr $BF00 ; immediately quit on 48K machine
!byte $65 ; (but congratulations on launching Passport at all)
!word quit
quit !byte 4
good_mem
OneTimeSetup
jsr $FE89 ; PR#0
jsr $FE93 ; IN#0
jsr $FB2F ; TEXT
jsr $FC58 ; HOME
jsr decrunch
sty $fe ;;zp_dest_lo
OneTimeSetup
jsr decrunch ; decompress main Passport code
sty $fe ;;zp_dest_lo = low byte of Passport entry point
ldy #0 ; save a copy of ProDOS system global page
- lda $BF00, y ; (will be copied back and forth by SwapProDOS later)
sta $0F00, y