diff --git a/src/harddisk.a b/src/harddisk.a index 809e08f..c4a6699 100644 --- a/src/harddisk.a +++ b/src/harddisk.a @@ -24,6 +24,7 @@ HardDiskImagePath ; 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 ;------------------------------- CreateFileOnHardDisk jsr LookupUnitNumberOfSelectedHardDisk @@ -112,8 +113,8 @@ CreateFileOnHardDisk ; does not return any error status because no one cares ; ; in: ProDOS is in memory -; out: ProDOS is in memory -; all registers and flags clobbered +; out: all registers and flags clobbered +; ProDOS is in memory ;------------------------------- CloseFileOnHardDisk lda gHardDiskRef @@ -127,7 +128,7 @@ CloseFileOnHardDisk ; PrintHardDiskImagePath ; print full path of file on hard disk ; -; in: @HardDiskImagePath must be populated and have non-zero length +; in: @HardDiskImagePath is populated and has non-zero length ; out: all registers and flags clobbered ;------------------------------- PrintHardDiskImagePath diff --git a/src/passport.a b/src/passport.a index 18263bb..b9e0e09 100755 --- a/src/passport.a +++ b/src/passport.a @@ -199,38 +199,42 @@ MainMenu @usingHardDisk lda #s_targetfile jsr PrintByID -.getkey +@getkey jsr WaitForKey cmp #$80 bne + jsr EnterCFFAIfAvailable bcc ResetVector - bcs .getkey -+ cmp #$9B ; esc - beq .jmptoexit - cmp #$91 ; ctrl-Q - beq .jmptoexit + bcs @getkey + ++ cmp #$9B ; Esc quits + beq @jumpToExit + cmp #$91 ; Ctrl-Q quits + beq @jumpToExit cmp #k_quit bne + -.jmptoexit +@jumpToExit jmp CleanExit + + cmp #k_slot bne + jsr NextSlot lda #TRUE sta gChangedPrefs - beq MainMenu ; always branches + beq MainMenu ; always branches + + cmp #k_verify bne + lda #%00000000 - beq Action ; unconditional branch + beq Action ; always branches + + cmp #k_crack - bne .getkey + bne @getkey lda #%11000000 ; /!\ execution falls through here + Action sta gMode - jsr ResetProgress jsr InitSectorMap Reaction lda #FALSE @@ -246,13 +250,7 @@ Reaction sta jCallRWTS+1 lda #$08 sta gAddress+1 - jsr ClearScreen - lda #s_header - jsr PrintByID - lda #s_progbar - jsr PrintByID - lda VPOS - sta TEXTTOP + jsr ShowInitialProgressScreen lda gMode bpl @printReading ; don't create RAM disk or hard disk file in verify mode @@ -274,7 +272,6 @@ Reaction 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 - ; /!\ execution falls through here @printReading lda #s_reading jsr PrintByID @@ -592,43 +589,6 @@ Pass jsr PrintByID jmp TheEnd -SwitchToUniv - lda gSector - sta gDisplayBytes - lda #s_switch - !byte $2C ; hide next LDA -StartWithUniv - lda #s_builtin - jsr PrintByID - lda #TRUE - sta gTriedUniv - lda #FALSE - sta gIsProtDOS - -; note: execution falls through here - -CopyUniversal - lda #$B8 -CopyUniversalAnywhere - sta universalrwts - clc - adc #$02 - sta .cu+2 - lda #>universalrwts - sta _byte_hi - lda # in lda gChangedPrefs bne + jsr SavePrefs + jsr DeleteFileOnRAMDisk ; always safe to call jsr MLI ; does not return !byte $65 - !word .quitparm -.quitparm - !byte $04,$00,$00,$00,$00,$00,$00 + !word + ++ !byte $04 !source "progress.a" @@ -803,24 +772,6 @@ ChangeSector sta gAddress+1 rts -;------------------------------- -; RestartScan -; Print 'Restarting scan...' then do exactly that. -; Used by several patchers that find evidence of a protection -; then activate an expensive search the second time around. -; Can be called from anywhere. -; Resets stack, never returns. -; Exits via ReadWithRWTS -;------------------------------- -RestartScan - lda #s_restart - jsr PrintByID - jsr RestartProgress - jsr IncProgress - ldx #$FF - txs - jmp ReadWithRWTS - ;------------------------------- ; AnalyzeTrack routine ; Looks at buffer in memory to detect known diff --git a/src/progress.a b/src/progress.a index 2a5bdb7..cc21b16 100644 --- a/src/progress.a +++ b/src/progress.a @@ -1,12 +1,22 @@ ;------------------------------- ; Progress bar functions ; -; ResetProgress - called once when verify/demuffin/crack process starts +; ShowInitialProgressScreen - called once when a verify or crack process starts +; ResetProgress - called once when a verify or crack process starts ; IncProgress - called repeatedly during process (visibly increments progress bar) ; RestartProgress - called from certain patchers (Sierra) or when writing from RAM disk ; (visibly clears progress bar and exits via ResetProgress) ;------------------------------- -!zone { +ShowInitialProgressScreen + jsr ClearScreen + lda #s_header + jsr PrintByID + lda #s_progbar + jsr PrintByID + lda VPOS + sta TEXTTOP + bne ResetProgress ; always branches + RestartProgress lda VPOS pha @@ -20,16 +30,15 @@ RestartProgress ; /!\ execution falls through here ResetProgress - lda #$82 ; reset progress indicator + lda #$82 ; reset progress indicator sta progressind+1 lda #$05 sta progressind+2 rts IncProgress - lda #$20 ; display minimal progress indicator + lda #$20 ; display minimal progress indicator progressind - sta $FFFF ; set at runtime + sta $FFFF ; SMC inc progressind+1 rts -} diff --git a/src/ramdisk.a b/src/ramdisk.a index 48ea9f9..dd04f29 100644 --- a/src/ramdisk.a +++ b/src/ramdisk.a @@ -1,10 +1,10 @@ RAMDiskImagePath - !byte 0 ; length byte (0 means no suitable RAM disk is available) - !fill 1 ; / character - !fill 4 ; longest possible volume name for supported RAM disks - ; (code only matches 'RAM' or 'RAMn' where n is usually a slot number) - !fill 1 ; / character - !fill 15 ; filename without leading slash (constant, see initscan.a) + !byte 0 ; length byte (0 means no suitable RAM disk is available) + !fill 1 ; / character + !fill 4 ; longest possible volume name for supported RAM disks + ; (code only matches 'RAM' or 'RAMn' where n is usually a slot number) + !fill 1 ; / character + !fill 15 ; filename without leading slash (constant, see initscan.a) ;------------------------------- ; CreateFileOnRAMDisk @@ -66,6 +66,7 @@ DeleteFileOnRAMDisk ; in: ProDOS is in memory ; out: if error, C set and A contains error code ; if success, C clear +; if a key is pressed, exits via Cancel ; all other flags clobbered ; all registers clobbered ; ProDOS is in memory diff --git a/src/rwts.a b/src/rwts.a index 01caea6..75821ff 100755 --- a/src/rwts.a +++ b/src/rwts.a @@ -213,6 +213,42 @@ tsr_callback jmp $B9A0 } +SwitchToUniv + lda gSector + sta gDisplayBytes + lda #s_switch + !byte $2C ; hide next LDA +StartWithUniv + lda #s_builtin + jsr PrintByID + lda #TRUE + sta gTriedUniv + lda #FALSE + sta gIsProtDOS + ; /!\ execution falls through here + +CopyUniversal + lda #$B8 +CopyUniversalAnywhere + sta universalrwts + clc + adc #$02 + sta .cu+2 + lda #>universalrwts + sta _byte_hi + lda #