move some more stuff around

This commit is contained in:
4am 2021-04-20 00:02:09 -04:00
parent 8a244c82b9
commit b5db14e87a
2 changed files with 82 additions and 79 deletions

View File

@ -39,13 +39,11 @@ VERBOSE = $00 ; set to $01 to display API label addresses
!to "../build/PASSPORT.TMP",plain !to "../build/PASSPORT.TMP",plain
!source "apidefs.a" ; no code in here
FirstMover FirstMover
jmp ResetVector jmp ResetVector
!source "apidefs.a"
!source "strings/en.a" !source "strings/en.a"
!source "analyze.a"
!source "id/inspect0.a" !source "id/inspect0.a"
!source "id/precheck.a" !source "id/precheck.a"
!source "id/trace.a" !source "id/trace.a"
@ -95,6 +93,7 @@ FirstMover
!source "progress.a" !source "progress.a"
!source "rwts.a" !source "rwts.a"
!source "standarddelivery.a" !source "standarddelivery.a"
!source "wholetrack.a"
!source "adstyle.a" !source "adstyle.a"
!source "universalstyle.a" !source "universalstyle.a"
!source "crackme.a" !source "crackme.a"

View File

@ -3,30 +3,29 @@
; out: C clear if we should skip this track ; out: C clear if we should skip this track
; C set if we should not skip this track ; C set if we should not skip this track
;------------------------------- ;-------------------------------
!zone {
SkipTrack SkipTrack
; don't look for whole-track protections on track 0, that's silly ; don't look for whole-track protections on track 0, that's silly
lda gTrack lda gTrack
sec sec
beq .linknoskip beq @linknoskip
; ;
; Electronic Arts protection track? ; Electronic Arts protection track?
; ;
jsr IsEATrack6 jsr IsEATrack6
lda #s_eatrk6 lda #s_eatrk6
bcc .print bcc @print
; ;
; Nibble count track? ; Nibble count track?
; ;
jsr JustTheSameDamnThingOverAndOver jsr JustTheSameDamnThingOverAndOver
lda #s_sync lda #s_sync
bcc .print ; always branches bcc @print ; always branches
; ;
; Unformatted track? ; Unformatted track?
; ;
jsr IsUnformatted jsr IsUnformatted
.linknoskip @linknoskip
bcs .donotskip bcs @donotskip
; ;
; $F7F6EFEAAB protection track? ; $F7F6EFEAAB protection track?
; (initially presents as unformatted, needs separate test because it ; (initially presents as unformatted, needs separate test because it
@ -34,15 +33,15 @@ SkipTrack
; ;
jsr IsF7F6 jsr IsF7F6
lda #s_unformat lda #s_unformat
bcs .print bcs @print
lda #s_f7 lda #s_f7
bit gMode bit gMode
bpl .print bpl @print
bvc .print bvc @print
; if we're in 'crack' mode, restart the scan to find the protection code ; if we're in 'crack' mode, restart the scan to find the protection code
jmp SetupF7F6SecondRound jmp SetupF7F6SecondRound
.print @print
jsr PrintByID jsr PrintByID
; ;
; Skipping T22 on a ProDOS disk might indicate the presence of a ; Skipping T22 on a ProDOS disk might indicate the presence of a
@ -55,13 +54,12 @@ SkipTrack
lda gTrack lda gTrack
cmp #$22 cmp #$22
clc clc
bne .donotskip bne @donotskip
lda gIsProDOS lda gIsProDOS
bne .donotskip bne @donotskip
sta gPossibleGamco sta gPossibleGamco
.donotskip @donotskip
rts rts
}
;------------------------------- ;-------------------------------
; IsF7F6 ; IsF7F6
@ -73,7 +71,6 @@ SkipTrack
; out C clear if sequence was found ; out C clear if sequence was found
; C set if sequence was not found ; C set if sequence was not found
;------------------------------- ;-------------------------------
!zone {
IsF7F6 IsF7F6
lda $C0E9 lda $C0E9
lda #$00 lda #$00
@ -84,46 +81,28 @@ IsF7F6
- jsr ReadNib - jsr ReadNib
cmp #$F7 cmp #$F7
beq + beq +
.restart iny @restart iny
bne - bne -
dec nibcount dec nibcount
bne - bne -
sec sec
beq .driveoff beq @driveoff
+ + jsr ReadNib
jsr ReadNib
cmp #$F6 cmp #$F6
bne .restart bne @restart
jsr ReadNib jsr ReadNib
cmp #$EF cmp #$EF
bne .restart bne @restart
jsr ReadNib jsr ReadNib
cmp #$EE cmp #$EE
bne .restart bne @restart
jsr ReadNib jsr ReadNib
cmp #$AB cmp #$AB
bne .restart bne @restart
clc clc
.driveoff @driveoff
lda $C0E8 lda $C0E8
rts rts
}
ReadNib
- lda $C0EC
bpl -
rts
Read4x4
- lda $C0EC
bpl -
sec
rol
sta tmp
- lda $C0EC
bpl -
and tmp
rts
;------------------------------- ;-------------------------------
; SetupF7F6SecondRound ; SetupF7F6SecondRound
@ -138,24 +117,22 @@ SetupF7F6SecondRound
; Mark in the sector map that we should ignore ; Mark in the sector map that we should ignore
; this protection track the second time around. ; this protection track the second time around.
lda checksector+1 lda checksector+1
sta .a+1 sta @a+1
lda checksector+2 lda checksector+2
sta .a+2 sta @a+2
ldy gSector ldy gSector
lda #kSectorIgnore lda #kSectorIgnore
.a sta $D1D1 ; modifed at runtime @a sta $D1D1 ; modifed at runtime
ldx .a+1 ldx @a+1
bne + bne +
dec .a+2 dec @a+2
+ dec .a+1 + dec @a+1
dey dey
bpl .a bpl @a
; print that we found the protection track lda #s_f7 ; print that we found the protection track
lda #s_f7
jsr PrintByID jsr PrintByID
; set global to activate expensive patcher
lda #TRUE lda #TRUE
sta gIsF7F6 sta gIsF7F6 ; set global to activate expensive patcher
jmp RestartScan jmp RestartScan
;------------------------------- ;-------------------------------
@ -166,7 +143,6 @@ SetupF7F6SecondRound
; out C clear if found ; out C clear if found
; C set otherwise ; C set otherwise
;------------------------------- ;-------------------------------
!zone {
JustTheSameDamnThingOverAndOver JustTheSameDamnThingOverAndOver
lda $C0E9 ; turn on drive motor, but we assume it's already spun up from previous reads so no waiting lda $C0E9 ; turn on drive motor, but we assume it's already spun up from previous reads so no waiting
lda #$60 lda #$60
@ -177,30 +153,29 @@ JustTheSameDamnThingOverAndOver
; ;
; Timing-sensitive code! Cycle counts in margin for worst case path ; Timing-sensitive code! Cycle counts in margin for worst case path
; ;
.reset clv ; 2 @reset clv ; 2
ldy #$00 ; 2 ldy #$00 ; 2
sta .cmp+1 ; 4 sta @cmp+1 ; 4
.loop lda $C0EC ; 4 @loop lda $C0EC ; 4
bpl .loop ; 2 when not taken bpl @loop ; 2 when not taken
dex ; 2 dex ; 2
bne .cmp ; 2 when not taken bne @cmp ; 2 when not taken
dec unform+1 ; 5 dec unform+1 ; 5
beq .notfound ; 2 when not taken beq @notfound ; 2 when not taken
.cmp cmp #$d1 ; 2 @cmp cmp #$d1 ; 2
bne .reset ; 2 when not taken bne @reset ; 2 when not taken
iny ; 2 iny ; 2
bne .loop ; 2 when not taken (3 when taken) bne @loop ; 2 when not taken (3 when taken)
bvs .found ; 2 when not taken bvs @found ; 2 when not taken
bit tmp ; 3 (sets overflow flag) bit tmp ; 3 (sets overflow flag)
bvs .loop ; 3 (always taken) bvs @loop ; 3 (always taken)
.found @found
clc clc
!byte $24 !byte $24
.notfound @notfound
sec sec
lda $C0E8 lda $C0E8
rts rts
}
;------------------------------- ;-------------------------------
; IsUnformatted ; IsUnformatted
@ -211,7 +186,6 @@ JustTheSameDamnThingOverAndOver
; out C clear if track is unformatted ; out C clear if track is unformatted
; C set if track is formatted ; C set if track is formatted
;------------------------------- ;-------------------------------
!zone {
IsUnformatted IsUnformatted
lda #$FD lda #$FD
sta gNIBTableFF sta gNIBTableFF
@ -224,27 +198,26 @@ IsUnformatted
; ;
; Timing-sensitive code! Cycle counts in margin for worst case path ; Timing-sensitive code! Cycle counts in margin for worst case path
; ;
.reset ldy #$00 @reset ldy #$00
.loop ldx $C0EC ; 4 @loop ldx $C0EC ; 4
bpl .loop ; 2 when not taken bpl @loop ; 2 when not taken
dec unform ; 5 dec unform ; 5
bne + ; 2 when not taken bne + ; 2 when not taken
dec unform+1 ; 5 dec unform+1 ; 5
beq .unformatted;2 when not taken beq @unformatted;2 when not taken
+ lda gNIBTable,x; 4 + lda gNIBTable,x; 4
bmi .reset ; 2 when not taken bmi @reset ; 2 when not taken
iny ; 2 iny ; 2
bne .loop ; 3 when taken bne @loop ; 3 when taken
sec sec
!byte $24 !byte $24
.unformatted @unformatted
clc clc
lda $C0E8 lda $C0E8
lda #$3F lda #$3F
sta gNIBTableFF sta gNIBTableFF
rts rts
}
;------------------------------- ;-------------------------------
; IsEATrack6 ; IsEATrack6
@ -264,3 +237,34 @@ IsEATrack6
sbc #5 sbc #5
cmp #1 cmp #1
+ rts + rts
;-------------------------------
; ReadNib
; read a single nibble from S6,D1
;
; in: S6,D1 must be spun up and ready to read
; out: A contains nibble value
;-------------------------------
ReadNib
- lda $C0EC
bpl -
rts
;-------------------------------
; Read4x4
; read a 4-4-encoded value from S6,D1
;
; in: S6,D1 must be spun up and ready to read
; out: A contains decoded value
; @tmp clobbered
;-------------------------------
Read4x4
- lda $C0EC
bpl -
sec
rol
sta tmp
- lda $C0EC
bpl -
and tmp
rts