shave some bytes in and around CreateFileOnRAMDisk

This commit is contained in:
4am 2021-07-10 21:05:29 -04:00
parent 696f20ba49
commit e505ed9206
3 changed files with 18 additions and 17 deletions

View File

@ -199,13 +199,7 @@ Reaction
jmp IDBootloader ; /src/id/inspect0
@notHardDrive
lda RAMDiskImagePath
beq @printReading ; no RAM disk available
jsr CreateFileOnRAMDisk
bcc @printReading
lda #0 ; failed to create temporary file on RAM disk
sta RAMDiskImagePath ; this is not fatal, but we'll mark the RAM
; disk as unavailable so we don't bother with it
+MaybeCreateFileOnRAMDisk
@printReading
jsr PrintByID
!byte s_reading

View File

@ -1,16 +1,16 @@
;-------------------------------
; CreateFileOnRAMDisk
; MaybeCreateFileOnRAMDisk
; create 140KB file on RAM disk (filename is hardcoded)
;
; 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
; out: if creation succeeded, gRAMDiskRef contains file refnum
; all flags clobbered
; all registers clobbered
; ProDOS is not in memory
;-------------------------------
CreateFileOnRAMDisk
!macro MaybeCreateFileOnRAMDisk {
lda RAMDiskImagePath
beq @doneRAMDisk ; no RAM disk available -> skip everything
jsr SwapProDOS ; ProDOS out -> in (preserves flags)
jsr DeleteFileOnRAMDisk ; always safe to call
lda #<RAMDiskImagePath
@ -18,9 +18,16 @@ CreateFileOnRAMDisk
lda #>RAMDiskImagePath
sta mliparam+2
jsr Create140KFile
bcs +
sta gRAMDiskRef
+ jmp SwapProDOS ; ProDOS in -> out (preserves flags)
bcc +
; We failed to create temporary file on RAM disk.
; This is not fatal, but we'll mark the RAM
; disk as unavailable so we don't bother with it
lda #0
sta RAMDiskImagePath
+ sta gRAMDiskRef
jsr SwapProDOS ; ProDOS in -> out (preserves flags)
@doneRAMDisk
}
;-------------------------------
; DeleteFileOnRAMDisk

View File

@ -341,7 +341,7 @@ StringTableHigh
.passport
!text "Passport ",$00
.header
!text "@",s_passport,"by 4am@",s_space7,"@",s_space7," 2021-07-09",$00
!text "@",s_passport,"by 4am@",s_space7,"@",s_space7," 2021-07-10",$00
.bar9
!text "_________",$00
.bar18