mirror of
https://github.com/a2-4am/passport.git
synced 2024-09-29 15:54:59 +00:00
restore and refactor ResetVector, fix SwapProDOS confusion on exit
This commit is contained in:
parent
3e9dd24ed9
commit
80c2b93165
@ -65,7 +65,7 @@ UNIV_D3 = $B8FC
|
|||||||
!source "apidefs.a"
|
!source "apidefs.a"
|
||||||
|
|
||||||
FirstMover
|
FirstMover
|
||||||
jmp MainMenu
|
jmp ResetVector
|
||||||
|
|
||||||
!source "strings/en.a"
|
!source "strings/en.a"
|
||||||
!source "analyze.a"
|
!source "analyze.a"
|
||||||
@ -115,16 +115,11 @@ FirstMover
|
|||||||
!source "prefs.a"
|
!source "prefs.a"
|
||||||
!source "keys.a"
|
!source "keys.a"
|
||||||
!source "cffa.a"
|
!source "cffa.a"
|
||||||
|
!source "progress.a"
|
||||||
!source "rwts.a"
|
!source "rwts.a"
|
||||||
!source "standarddelivery.a"
|
!source "standarddelivery.a"
|
||||||
|
|
||||||
MainMenu
|
ResetVector
|
||||||
lda #<MainMenu
|
|
||||||
sta $03F2
|
|
||||||
lda #>MainMenu
|
|
||||||
sta $03F3
|
|
||||||
eor #$A5
|
|
||||||
sta $03F4
|
|
||||||
ldx #$FF
|
ldx #$FF
|
||||||
txs
|
txs
|
||||||
lda $C0E8
|
lda $C0E8
|
||||||
@ -135,8 +130,10 @@ MainMenu
|
|||||||
sta $C004
|
sta $C004
|
||||||
sta $C00C
|
sta $C00C
|
||||||
sta $C00E
|
sta $C00E
|
||||||
jsr CleanupFiles
|
|
||||||
jsr ThisSlot
|
jsr ThisSlot
|
||||||
|
jsr CleanupFiles ; RAM/HD files might be left open after Ctrl-Reset
|
||||||
|
; /!\ execution falls through here
|
||||||
|
MainMenu
|
||||||
jsr ClearScreen
|
jsr ClearScreen
|
||||||
lda #s_header
|
lda #s_header
|
||||||
jsr PrintByID
|
jsr PrintByID
|
||||||
@ -581,6 +578,24 @@ TheEnd
|
|||||||
beq HandleRedoWithIgnore
|
beq HandleRedoWithIgnore
|
||||||
jmp MainMenu
|
jmp MainMenu
|
||||||
|
|
||||||
|
;-------------------------------
|
||||||
|
; CleanupFiles
|
||||||
|
;
|
||||||
|
; Cleans up open files (if any)
|
||||||
|
;
|
||||||
|
; in: ProDOS is NOT in memory
|
||||||
|
; out: all registers and flags clobbered
|
||||||
|
;-------------------------------
|
||||||
|
CleanupFiles
|
||||||
|
lda gHardDiskRef
|
||||||
|
ora gRAMDiskRef
|
||||||
|
beq +
|
||||||
|
jsr SwapProDOS ; ProDOS out -> in
|
||||||
|
jsr DeleteFileOnRAMDisk
|
||||||
|
jsr CloseFileOnHardDisk
|
||||||
|
jsr SwapProDOS ; ProDOS out -> in
|
||||||
|
+ rts
|
||||||
|
|
||||||
HandleRedoWithIgnore
|
HandleRedoWithIgnore
|
||||||
jsr InitSectorMapWithIgnore
|
jsr InitSectorMapWithIgnore
|
||||||
jmp Reaction
|
jmp Reaction
|
||||||
@ -609,25 +624,26 @@ RestartScan
|
|||||||
txs
|
txs
|
||||||
jmp ReadWithRWTS
|
jmp ReadWithRWTS
|
||||||
|
|
||||||
|
;-------------------------------
|
||||||
|
; CleanExit
|
||||||
|
;
|
||||||
|
; Cleans up open files, saves preferences (if modified),
|
||||||
|
; and quits via ProDOS MLI
|
||||||
|
;
|
||||||
|
; in: ProDOS is NOT in memory
|
||||||
|
; out: does not return
|
||||||
|
;-------------------------------
|
||||||
CleanExit
|
CleanExit
|
||||||
|
jsr CleanupFiles
|
||||||
jsr SwapProDOS ; ProDOS out -> in
|
jsr SwapProDOS ; ProDOS out -> in
|
||||||
lda gChangedPrefs
|
lda gChangedPrefs
|
||||||
bne +
|
bne +
|
||||||
jsr SavePrefs
|
jsr SavePrefs
|
||||||
+ jsr CleanupFiles
|
+ jsr MLI ; does not return
|
||||||
jsr MLI ; does not return
|
|
||||||
!byte $65
|
!byte $65
|
||||||
!word +
|
!word +
|
||||||
+ !byte $04
|
+ !byte $04
|
||||||
|
|
||||||
!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
|
; WriteTrack
|
||||||
;-------------------------------
|
;-------------------------------
|
||||||
|
@ -18,7 +18,7 @@ OneTimeSetup
|
|||||||
jsr $FB2F ; TEXT
|
jsr $FB2F ; TEXT
|
||||||
jsr $FC58 ; HOME
|
jsr $FC58 ; HOME
|
||||||
jsr decrunch ; decompress main Passport code
|
jsr decrunch ; decompress main Passport code
|
||||||
sty $fe ;;zp_dest_lo = low byte of Passport entry point
|
sty $FE ;;zp_dest_lo = low byte of Passport entry point
|
||||||
ldy #0 ; save a copy of ProDOS system global page
|
ldy #0 ; save a copy of ProDOS system global page
|
||||||
- lda $BF00, y ; (will be copied back and forth by SwapProDOS later)
|
- lda $BF00, y ; (will be copied back and forth by SwapProDOS later)
|
||||||
sta $0F00, y
|
sta $0F00, y
|
||||||
@ -40,7 +40,13 @@ OneTimeSetup
|
|||||||
+
|
+
|
||||||
jsr ScanForRAMAndHardDisks; scan for things that look like RAM disks or hard disks
|
jsr ScanForRAMAndHardDisks; scan for things that look like RAM disks or hard disks
|
||||||
jsr LoadPrefs ; load preferences (if available)
|
jsr LoadPrefs ; load preferences (if available)
|
||||||
jmp ($fe) ; jump to decompressed code (FirstMover)
|
lda $FE
|
||||||
|
sta $03F2
|
||||||
|
lda $FF
|
||||||
|
sta $03F3
|
||||||
|
eor #$A5
|
||||||
|
sta $03F4
|
||||||
|
jmp ($FE) ; jump to decompressed code (FirstMover)
|
||||||
|
|
||||||
!source "apidefs.a"
|
!source "apidefs.a"
|
||||||
!source "strings/enid.a"
|
!source "strings/enid.a"
|
||||||
|
Loading…
Reference in New Issue
Block a user