mirror of
https://github.com/a2-4am/passport.git
synced 2025-01-09 17:31:02 +00:00
shave some bytes
This commit is contained in:
parent
c490d4febb
commit
cefbc184a1
@ -1,7 +1,34 @@
|
|||||||
|
;-------------------------------
|
||||||
|
; UseUniversal
|
||||||
|
; Caller has decided to use the built-in RWTS to read
|
||||||
|
; this disk (possibly already patched with disk-specific
|
||||||
|
; parameters). Now we check for protections that require
|
||||||
|
; additional patches or callbacks before we start.
|
||||||
|
;
|
||||||
|
; in: $0800..$08FF contains boot0
|
||||||
|
; $B600..$BFFF contains boot1
|
||||||
|
; out: all registers clobbered
|
||||||
|
; exits via ReadWithRWTS
|
||||||
|
;-------------------------------
|
||||||
UseUniversal
|
UseUniversal
|
||||||
jsr IncProgress
|
jsr IncProgress
|
||||||
|
;
|
||||||
|
; Copy built-in RWTS into place ($B800..$BFFF)
|
||||||
|
;
|
||||||
jsr StartWithUniv
|
jsr StartWithUniv
|
||||||
;
|
;
|
||||||
|
; On pure 13-sector disks, we just hijack the read routine to perform a
|
||||||
|
; verification instead.
|
||||||
|
;
|
||||||
|
+
|
||||||
|
lda gIs13Sector
|
||||||
|
bne +
|
||||||
|
lda #<read13
|
||||||
|
sta jCallRWTS+1
|
||||||
|
lda #>read13
|
||||||
|
sta jCallRWTS+2
|
||||||
|
bne @doneUnivPatching ; always branches
|
||||||
|
;
|
||||||
; On Dinkey-DOS disks (e.g. Ultima V, Times of Lore), we start with the
|
; On Dinkey-DOS disks (e.g. Ultima V, Times of Lore), we start with the
|
||||||
; universal RWTS then apply a patch in memory.
|
; universal RWTS then apply a patch in memory.
|
||||||
; These disks use a hybrid RWTS that alters the sector number in the
|
; These disks use a hybrid RWTS that alters the sector number in the
|
||||||
@ -12,37 +39,49 @@ UseUniversal
|
|||||||
;
|
;
|
||||||
lda gIsDinkeyDOS
|
lda gIsDinkeyDOS
|
||||||
bne +
|
bne +
|
||||||
jsr PatchUniversalRWTSForOrigin
|
ldy #$0F
|
||||||
|
- lda _originAddressEpilogue, y
|
||||||
|
sta $B990, y
|
||||||
|
dey
|
||||||
|
bpl -
|
||||||
|
ldy #$0A
|
||||||
|
- lda _originDataEpilogue, y
|
||||||
|
sta $B92F, y
|
||||||
|
dey
|
||||||
|
bpl -
|
||||||
bmi @doneUnivPatching ; always branches
|
bmi @doneUnivPatching ; always branches
|
||||||
;
|
;
|
||||||
; On TSR disks (e.g. Dawn Patrol, Dungeon), we start with the universal
|
; On TSR disks (e.g. Dawn Patrol, Dungeon), we start with the universal
|
||||||
; RWTS then apply a patch in memory.
|
; RWTS then apply a patch in memory.
|
||||||
;
|
;
|
||||||
+ lda gIsTSR
|
+
|
||||||
|
lda gIsTSR
|
||||||
bne +
|
bne +
|
||||||
jsr PatchUniversalRWTSForTSR
|
lda #<_tsrCallback
|
||||||
;
|
sta $BE8C
|
||||||
; On pure 13-sector disks, we just hijack the read routine to perform a
|
lda #>_tsrCallback
|
||||||
; verification instead.
|
sta $BE8D
|
||||||
;
|
|
||||||
+ lda gIs13Sector
|
|
||||||
bne +
|
|
||||||
lda #<read13
|
|
||||||
sta jCallRWTS+1
|
|
||||||
lda #>read13
|
|
||||||
sta jCallRWTS+2
|
|
||||||
bne @doneUnivPatching ; always branches
|
|
||||||
;
|
;
|
||||||
; On other disks that use the universal RWTS for the entire disk, we use
|
; On other disks that use the universal RWTS for the entire disk, we use
|
||||||
; an adaptive RWTS that accepts any epilogue on the first sector but then
|
; an adaptive RWTS that accepts any epilogue on the first sector but then
|
||||||
; enforces all other sectors to have the same epilogue.
|
; enforces all other sectors to have the same epilogue.
|
||||||
;
|
;
|
||||||
+ jsr PatchUniversalRWTSForAdaptive
|
+
|
||||||
|
ldy #$09
|
||||||
|
- lda _adaptiveAddressEpilogue, y
|
||||||
|
sta $B994, y
|
||||||
|
lda _adaptiveDataEpilogue, y
|
||||||
|
sta $B938, y
|
||||||
|
dey
|
||||||
|
bpl -
|
||||||
;
|
;
|
||||||
; Disable drive recalibration on bad sectors so we give up on bad sectors
|
; Disable drive recalibration on bad sectors so we give up on bad sectors
|
||||||
; faster and detect unformatted or specially structured tracks faster.
|
; faster and detect unformatted or specially structured tracks faster.
|
||||||
;
|
;
|
||||||
jsr PatchUniversalRWTSForNoRecal
|
lda #$B0
|
||||||
|
sta $BDD2
|
||||||
|
lda #$30
|
||||||
|
sta $BDD3
|
||||||
;
|
;
|
||||||
; Some disks have different epilogues on track 0, so we stop using the
|
; Some disks have different epilogues on track 0, so we stop using the
|
||||||
; adaptive RWTS so we don't falsely accuse those disks of being damaged.
|
; adaptive RWTS so we don't falsely accuse those disks of being damaged.
|
||||||
@ -100,49 +139,20 @@ CopyUniversalAnywhere
|
|||||||
bne .culoop
|
bne .culoop
|
||||||
rts
|
rts
|
||||||
|
|
||||||
PatchUniversalRWTSForNoRecal
|
_adaptiveAddressEpilogue ; to $B994
|
||||||
lda #$B0
|
|
||||||
sta $BDD2
|
|
||||||
lda #$30
|
|
||||||
sta $BDD3
|
|
||||||
rts
|
|
||||||
|
|
||||||
PatchUniversalRWTSForAdaptive
|
|
||||||
; out: N flag set
|
|
||||||
ldy #$09
|
|
||||||
- lda @addressepilogue, y
|
|
||||||
sta $B994, y
|
|
||||||
lda @dataepilogue, y
|
|
||||||
sta $B938, y
|
|
||||||
dey
|
|
||||||
bpl -
|
|
||||||
rts
|
|
||||||
@addressepilogue ; to $B994
|
|
||||||
!byte $8D,$91,$B9
|
!byte $8D,$91,$B9
|
||||||
!byte $A9,$AE
|
!byte $A9,$AE
|
||||||
!byte $8D,$93,$B9
|
!byte $8D,$93,$B9
|
||||||
!byte $D0,$00
|
!byte $D0,$00
|
||||||
@dataepilogue ; to $B938
|
|
||||||
|
_adaptiveDataEpilogue ; to $B938
|
||||||
!byte $8D,$35,$B9
|
!byte $8D,$35,$B9
|
||||||
!byte $A9,$0A
|
!byte $A9,$0A
|
||||||
!byte $8D,$37,$B9
|
!byte $8D,$37,$B9
|
||||||
!byte $18
|
!byte $18
|
||||||
!byte $60
|
!byte $60
|
||||||
|
|
||||||
PatchUniversalRWTSForOrigin
|
_originAddressEpilogue ; to $B990
|
||||||
; out: N=1
|
|
||||||
ldy #$0F
|
|
||||||
- lda @addressepilogue, y
|
|
||||||
sta $B990, y
|
|
||||||
dey
|
|
||||||
bpl -
|
|
||||||
ldy #$0A
|
|
||||||
- lda @dataepilogue, y
|
|
||||||
sta $B92F, y
|
|
||||||
dey
|
|
||||||
bpl -
|
|
||||||
rts
|
|
||||||
@addressepilogue ; to $B990
|
|
||||||
!byte $C9,$AB
|
!byte $C9,$AB
|
||||||
!byte $D0,$0A
|
!byte $D0,$0A
|
||||||
!byte $EA
|
!byte $EA
|
||||||
@ -151,7 +161,8 @@ PatchUniversalRWTSForOrigin
|
|||||||
!byte $F0,$95
|
!byte $F0,$95
|
||||||
!byte $D0,$00
|
!byte $D0,$00
|
||||||
!byte $18,$60
|
!byte $18,$60
|
||||||
@dataepilogue ; to $B92F
|
|
||||||
|
_originDataEpilogue ; to $B92F
|
||||||
!byte $18
|
!byte $18
|
||||||
!byte $60
|
!byte $60
|
||||||
!byte $38
|
!byte $38
|
||||||
@ -161,14 +172,7 @@ PatchUniversalRWTSForOrigin
|
|||||||
!byte $18
|
!byte $18
|
||||||
!byte $60
|
!byte $60
|
||||||
|
|
||||||
PatchUniversalRWTSForTSR
|
_tsrCallback
|
||||||
; out: Z=0
|
|
||||||
lda #<@tsr_callback
|
|
||||||
sta $BE8C
|
|
||||||
lda #>@tsr_callback
|
|
||||||
sta $BE8D
|
|
||||||
rts
|
|
||||||
@tsr_callback
|
|
||||||
pha
|
pha
|
||||||
ldy gTrack
|
ldy gTrack
|
||||||
cpy #$05
|
cpy #$05
|
||||||
|
Loading…
x
Reference in New Issue
Block a user