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 jmp IDBootloader ; /src/id/inspect0
@notHardDrive @notHardDrive
lda RAMDiskImagePath +MaybeCreateFileOnRAMDisk
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
@printReading @printReading
jsr PrintByID jsr PrintByID
!byte s_reading !byte s_reading

View File

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

View File

@ -341,7 +341,7 @@ StringTableHigh
.passport .passport
!text "Passport ",$00 !text "Passport ",$00
.header .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 .bar9
!text "_________",$00 !text "_________",$00
.bar18 .bar18