shave some bytes

This commit is contained in:
4am 2021-06-19 00:28:52 -04:00
parent 5b02464c14
commit 79c3aacb75
4 changed files with 12 additions and 14 deletions

View File

@ -11,13 +11,14 @@ HardDiskName_e
;
; in: HardDiskArray populated
; user's select target is a hard disk
; ProDOS is in memory
; ProDOS is not in memory
; out: if C set, create or open failed (A contains MLI error code)
; if C clear, everything succeeded (A is clobbered)
; all other registers and flags clobbered
; ProDOS is in memory
; ProDOS is not in memory
;-------------------------------
CreateFileOnHardDisk
jsr SwapProDOS ; ProDOS out -> in (preserves flags)
jsr LookupUnitNumberOfSelectedHardDisk
jsr GetVolumeName
lda OnlineReturn
@ -94,7 +95,7 @@ CreateFileOnHardDisk
jsr Create140KFile
bcs +
sta gHardDiskRef
+ rts
+ jmp SwapProDOS ; ProDOS in -> out (preserves flags)
;-------------------------------
; CloseFileOnHardDisk

View File

@ -77,8 +77,8 @@ NonRelocatable
!source "id/panglosdos.a"
!source "id/davidson.a"
!source "id/holle.a"
!source "id/bootfailure.a"
!source "id/phoenix.a"
!source "id/bootfailure.a"
!source "id/555.a"
!source "id/inspect0.a"
!source "print.a"
@ -190,9 +190,7 @@ Reaction
bpl @printReading ; don't create RAM disk or hard disk file in verify mode
jsr LookupUnitNumberOfSelectedHardDisk
beq @notHardDrive
jsr SwapProDOS ; ProDOS out -> in (preserves flags)
jsr CreateFileOnHardDisk
jsr SwapProDOS ; ProDOS in -> out (preserves flags)
bcc @printReading
jmp FatalWriteError ; failed to create target file on hard disk
; this is fatal
@ -203,9 +201,7 @@ Reaction
@notHardDrive
lda RAMDiskImagePath
beq @printReading ; no RAM disk available
jsr SwapProDOS ; ProDOS out -> in (preserves flags)
jsr CreateFileOnRAMDisk
jsr SwapProDOS ; ProDOS in -> out (preserves flags)
bcc @printReading
lda #0 ; failed to create temporary file on RAM disk
sta RAMDiskImagePath ; this is not fatal, but we'll mark the RAM
@ -301,7 +297,6 @@ Cleanup
;-------------------------------
CleanExit
jsr Cleanup
jsr SwapProDOS ; ProDOS out -> in
+SavePrefs
jsr PRODOSMLI ; does not return
!byte $65

View File

@ -2,16 +2,17 @@
; SavePrefs
; save preferences to file
;
; in: ProDOS must be in memory
; in: ProDOS in not in memory
;-------------------------------
!macro SavePrefs {
jsr SwapProDOS ; ProDOS out -> in
lda gChangedPrefs
bne +
lda #<PREFSFILE
sta mliparam+1
lda #>PREFSFILE
sta mliparam+2
jsr DeleteFile ; don't care if this fails
jsr DeleteFile ; don't care if this fails
jsr CreateTxtFile
bcs +
lda #<PREFSBUFFER

View File

@ -2,15 +2,16 @@
; CreateFileOnRAMDisk
; create 140KB file on RAM disk (filename is hardcoded)
;
; in: ProDOS is in memory
; in: ProDOS is not in memory
; RAMDiskImagePath populated
; out: if C set, creation failed (A contains MLI error code)
; if C clear, creation succeeded (A clobbered, gRAMDiskRef contains file refnum)
; all other flags clobbered
; all registers clobbered
; ProDOS is in memory
; ProDOS is not in memory
;-------------------------------
CreateFileOnRAMDisk
jsr SwapProDOS ; ProDOS out -> in (preserves flags)
jsr DeleteFileOnRAMDisk ; always safe to call
lda #<RAMDiskImagePath
sta mliparam+1
@ -19,7 +20,7 @@ CreateFileOnRAMDisk
jsr Create140KFile
bcs +
sta gRAMDiskRef
+ rts
+ jmp SwapProDOS ; ProDOS in -> out (preserves flags)
;-------------------------------
; DeleteFileOnRAMDisk