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

View File

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

View File

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

View File

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