From e505ed920634131d2a0105c5875d1f14d1ef914e Mon Sep 17 00:00:00 2001 From: 4am Date: Sat, 10 Jul 2021 21:05:29 -0400 Subject: [PATCH] shave some bytes in and around CreateFileOnRAMDisk --- src/passport.a | 8 +------- src/ramdisk.a | 25 ++++++++++++++++--------- src/strings/en.a | 2 +- 3 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/passport.a b/src/passport.a index cbcdbbb..5a4cd53 100755 --- a/src/passport.a +++ b/src/passport.a @@ -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 diff --git a/src/ramdisk.a b/src/ramdisk.a index ce73b67..a9edddf 100644 --- a/src/ramdisk.a +++ b/src/ramdisk.a @@ -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 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 diff --git a/src/strings/en.a b/src/strings/en.a index 3d9ff1b..53c75b3 100755 --- a/src/strings/en.a +++ b/src/strings/en.a @@ -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