mirror of
https://github.com/a2-4am/passport.git
synced 2024-09-26 10:54:31 +00:00
move some code around, shave some bytes
This commit is contained in:
parent
b3a75e8748
commit
d4939063b9
@ -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
|
||||
|
129
src/passport.a
129
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 #<universalrwts
|
||||
sta _byte_lo
|
||||
jsr decrunch
|
||||
sty jCallRWTS+1
|
||||
lda #$BD
|
||||
sta jCallRWTS+2
|
||||
ldy #$96
|
||||
.culoop lda gNIBTable,y
|
||||
.cu sta $d100,y ; set at runtime
|
||||
iny
|
||||
bne .culoop
|
||||
rts
|
||||
|
||||
Cancel
|
||||
lda #s_canceled
|
||||
jsr PrintByID
|
||||
@ -651,8 +611,7 @@ FatalError
|
||||
.failont22s0f
|
||||
lda #s_fatal220f
|
||||
jsr PrintByID
|
||||
|
||||
; note: execution falls through here
|
||||
; /!\ execution falls through here
|
||||
|
||||
TheEnd
|
||||
lda $C0E8
|
||||
@ -672,33 +631,43 @@ TheEnd
|
||||
jmp MainMenu
|
||||
|
||||
HandleRedoWithIgnore
|
||||
jsr ResetProgress
|
||||
jsr InitSectorMapWithIgnore
|
||||
jmp Reaction
|
||||
|
||||
HandleRedo
|
||||
jsr ClearScreen
|
||||
lda #s_header
|
||||
jsr PrintByID
|
||||
lda #s_progbar
|
||||
jsr PrintByID
|
||||
lda VPOS
|
||||
sta TEXTTOP
|
||||
jsr ShowInitialProgressScreen
|
||||
lda #s_reading
|
||||
jsr PrintByID
|
||||
jmp RestartScan
|
||||
; /!\ execution falls through here
|
||||
|
||||
;-------------------------------
|
||||
; 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
|
||||
|
||||
CleanExit
|
||||
jsr SwapProDOS
|
||||
jsr SwapProDOS ; ProDOS out -> 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
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
|
36
src/rwts.a
36
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 #<universalrwts
|
||||
sta _byte_lo
|
||||
jsr decrunch
|
||||
sty jCallRWTS+1
|
||||
lda #$BD
|
||||
sta jCallRWTS+2
|
||||
ldy #$96
|
||||
.culoop lda gNIBTable,y
|
||||
.cu sta $d100,y ; set at runtime
|
||||
iny
|
||||
bne .culoop
|
||||
rts
|
||||
|
||||
gTrack !byte $00
|
||||
gSector !byte $00
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user