mirror of
https://github.com/a2-4am/passport.git
synced 2024-12-22 19:30:50 +00:00
add support for Methods and Solutions RWTS swapper, JSR 08B3 bootloader
This commit is contained in:
parent
398e849f8b
commit
74cc71b644
@ -133,7 +133,9 @@ IDBootloader
|
||||
;
|
||||
jsr ID8b3
|
||||
bcs .not8b3
|
||||
jmp found8b3
|
||||
lda #s_jsr8b3
|
||||
jsr PrintByID
|
||||
jmp Trace8B3
|
||||
|
||||
.not8b3
|
||||
;
|
||||
|
@ -45,33 +45,4 @@ ID8b3
|
||||
!byte $C6,$01,$A9,$08,$C5,$01,$D0,$EC
|
||||
!byte $60
|
||||
rts
|
||||
|
||||
found8b3
|
||||
tya
|
||||
pha
|
||||
ldy #$0F
|
||||
lda #$00
|
||||
A8b3 sta T00,y
|
||||
dey
|
||||
bpl A8b3
|
||||
ldy #$0B
|
||||
B8b3 sta T02,y
|
||||
iny
|
||||
cpy #$10
|
||||
bne B8b3
|
||||
pla
|
||||
tay
|
||||
lda #$4C
|
||||
sta $085A
|
||||
lda #<Inspect1_8b3
|
||||
sta $085B
|
||||
lda #>Inspect1_8b3
|
||||
sta $085C
|
||||
lda #$60
|
||||
sta $08CC
|
||||
lda #$2C
|
||||
sta $083F
|
||||
sta $0842
|
||||
sta $0845
|
||||
jmp $0801
|
||||
}
|
||||
|
@ -15,6 +15,15 @@ TraceDOS33
|
||||
sta gTrack
|
||||
lda #$09
|
||||
sta gSector
|
||||
;
|
||||
; This pre-check is made more difficult by the fact that
|
||||
; some disks have a timing bit after the $D5 nibble in
|
||||
; the address prologue, which triggers the wrong code path
|
||||
; in our built-in RWTS. So just for this pre-check, we
|
||||
; disable that code path. This hack will get overwritten
|
||||
; either by the disk's own RWTS when we capture it, or by
|
||||
; re-copying the built-in RWTS later.
|
||||
;
|
||||
lda #$F0
|
||||
sta $B959
|
||||
lda #$05
|
||||
@ -28,9 +37,9 @@ precheck
|
||||
+
|
||||
dec gSector
|
||||
bne precheck
|
||||
|
||||
;
|
||||
; pre-check passed, do the trace
|
||||
|
||||
;
|
||||
lda #<TraceDOS33b
|
||||
ldx #>TraceDOS33b
|
||||
jmp Trace
|
||||
@ -145,14 +154,6 @@ _Inspect1a
|
||||
sta T02S05
|
||||
+ jmp ADStyle ; use this RWTS to read the disk
|
||||
|
||||
; TODO this doesn't belong here
|
||||
Inspect1_8b3
|
||||
jsr WriteTrack
|
||||
lda $08FE
|
||||
clc
|
||||
adc #$01
|
||||
jmp _Inspect1a
|
||||
|
||||
;-------------------------------
|
||||
; Trace
|
||||
; common code for all boot tracers
|
||||
|
110
src/id/trace8b3.a
Normal file
110
src/id/trace8b3.a
Normal file
@ -0,0 +1,110 @@
|
||||
;-------------------------------
|
||||
; Trace8B3
|
||||
; set up 1st-level boot trace on
|
||||
; a bootloader that calls $08B3
|
||||
; on first run to alter nibble table
|
||||
; for rest of track 0
|
||||
;-------------------------------
|
||||
!zone {
|
||||
Trace8B3
|
||||
lda #<Trace8B3b
|
||||
ldx #>Trace8B3b
|
||||
jmp Trace
|
||||
|
||||
;-------------------------------
|
||||
; Trace8B3b
|
||||
; set up 2nd boot trace at $084A
|
||||
;-------------------------------
|
||||
Trace8B3b
|
||||
lda $085A
|
||||
sta _restore1+1
|
||||
lda $085B
|
||||
sta _restore2+1
|
||||
lda $085C
|
||||
sta _restore3+1
|
||||
lda #$4C
|
||||
sta $085A
|
||||
lda #<Trace8B3c
|
||||
sta $085B
|
||||
lda #>Trace8B3c
|
||||
sta $085C
|
||||
lda #$2C ; disable calls to
|
||||
sta $083F ; TEXt/PR0/IN0
|
||||
sta $0842
|
||||
sta $0845
|
||||
lda #$60 ; disable memory wipe
|
||||
sta $08CC
|
||||
jmp $0801
|
||||
|
||||
Trace8B3c
|
||||
;
|
||||
; Need to write out track 0 now because the built-in RWTS
|
||||
; won't be able to read it later.
|
||||
;
|
||||
lda $C0E8 ; turn off source drive
|
||||
;
|
||||
; Restore the original code in memory before continuing
|
||||
;
|
||||
lda #$B6
|
||||
sta $B6FE
|
||||
lda #$09
|
||||
sta $B6FF
|
||||
lda #$20
|
||||
sta $B63F
|
||||
sta $B642
|
||||
sta $B645
|
||||
lda #$A9
|
||||
sta $B6CC
|
||||
_restore1
|
||||
lda #$d1 ; set at runtime (in Trace8B3b)
|
||||
sta $B65A
|
||||
_restore2
|
||||
lda #$d1 ; set at runtime (in Trace8B3b)
|
||||
sta $B65B
|
||||
_restore3
|
||||
lda #$d1 ; set at runtime (in Trace8B3b)
|
||||
sta $B65C
|
||||
;
|
||||
; Copy track into buffer from writing
|
||||
;
|
||||
jsr ClearTSBuffer
|
||||
lda #$B6
|
||||
ldx #$10
|
||||
ldy #$0A
|
||||
jsr CopyMemory
|
||||
;
|
||||
; Manually write out track 0 (with patches)
|
||||
;
|
||||
jsr IncProgress
|
||||
lda #$00
|
||||
sta gTrack
|
||||
jsr AnalyzeTrack
|
||||
jsr ReorderLogicalToPhysical ; bootloader expects sectors in physical sector order
|
||||
jsr WriteTrackNA
|
||||
;
|
||||
; Mark track 0 and part of track 2 as "skip" in sector map
|
||||
;
|
||||
ldy #$0F
|
||||
lda #$00
|
||||
- sta T00,y
|
||||
dey
|
||||
bpl -
|
||||
ldy #$0B
|
||||
- sta T02,y
|
||||
iny
|
||||
cpy #$10
|
||||
bne -
|
||||
;
|
||||
; Set up RWTS entry point
|
||||
;
|
||||
lda #$00
|
||||
sta callrwts+1
|
||||
lda #$BD
|
||||
sta callrwts+2
|
||||
;
|
||||
; Read the rest of the disk with the original RWTS
|
||||
;
|
||||
lda #$01
|
||||
sta gLastTrack
|
||||
jmp ADStyle
|
||||
}
|
80
src/memory.a
80
src/memory.a
@ -151,3 +151,83 @@ SwapProDOS
|
||||
ldy #$01
|
||||
jsr SwapMemory
|
||||
rts
|
||||
|
||||
;-------------------------------
|
||||
; ReorderLogicalToPhysical - reorder pages in
|
||||
; track data buffer for disks that expect
|
||||
; sectors in physical sector order
|
||||
;
|
||||
; 1 -> 7
|
||||
; 2 -> E
|
||||
; 3 -> 6
|
||||
; 4 -> D
|
||||
;
|
||||
; 6 -> C
|
||||
; 7 -> 4
|
||||
; 8 -> B
|
||||
; 9 -> 3
|
||||
;
|
||||
; B -> 2
|
||||
; C -> 9
|
||||
; D -> 1
|
||||
; E -> 8
|
||||
;
|
||||
; 0123456789ABCDEF
|
||||
; 07E6D5C4B3A2918F
|
||||
; in: track buffer has data in logical sector order
|
||||
; out: A,Y clobbered
|
||||
; X preserved
|
||||
;-------------------------------
|
||||
!zone {
|
||||
ReorderLogicalToPhysical
|
||||
ldy #$00
|
||||
- lda $1100,y
|
||||
pha
|
||||
lda $1200,y
|
||||
pha
|
||||
lda $1300,y
|
||||
pha
|
||||
lda $1400,y
|
||||
pha
|
||||
lda $1600,y
|
||||
pha
|
||||
lda $1700,y
|
||||
pha
|
||||
lda $1800,y
|
||||
pha
|
||||
lda $1900,y
|
||||
pha
|
||||
lda $1b00,y
|
||||
pha
|
||||
lda $1c00,y
|
||||
pha
|
||||
lda $1d00,y
|
||||
pha
|
||||
lda $1e00,y
|
||||
sta $1800,y
|
||||
pla
|
||||
sta $1100,y
|
||||
pla
|
||||
sta $1900,y
|
||||
pla
|
||||
sta $1200,y
|
||||
pla
|
||||
sta $1300,y
|
||||
pla
|
||||
sta $1b00,y
|
||||
pla
|
||||
sta $1400,y
|
||||
pla
|
||||
sta $1c00,y
|
||||
pla
|
||||
sta $1d00,y
|
||||
pla
|
||||
sta $1600,y
|
||||
pla
|
||||
sta $1e00,y
|
||||
pla
|
||||
sta $1700,y
|
||||
iny
|
||||
bne -
|
||||
rts
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ flag = $FF ; byte
|
||||
}
|
||||
|
||||
; Application constants (not zero addresses)
|
||||
RELBASE = $6500 ; address to move Passport code
|
||||
RELBASE = $6300 ; address to move Passport code
|
||||
; so that it's out of the way
|
||||
LOWPOINT = $4300 ; lowest available address for code
|
||||
BASEPAGE = $10 ; Special Delivery tracer assumes
|
||||
@ -142,6 +142,7 @@ FirstMover
|
||||
!source "id/trace.a"
|
||||
!source "id/dos33.a"
|
||||
!source "id/jsr8b3.a"
|
||||
!source "id/trace8b3.a"
|
||||
!source "id/mecc.a"
|
||||
!source "id/datasoft.a"
|
||||
!source "id/protecteddos.a"
|
||||
@ -692,6 +693,8 @@ _applyToT00
|
||||
!source "patchers/diskvol.a"
|
||||
!source "patchers/c9ff.a"
|
||||
!source "patchers/milliken.a"
|
||||
!source "patchers/methods.a"
|
||||
!source "patchers/jsr8b3.a"
|
||||
_applyToAll
|
||||
!source "patchers/universale7.a"
|
||||
!source "patchers/runhello.a"
|
||||
|
42
src/patchers/jsr8b3.a
Normal file
42
src/patchers/jsr8b3.a
Normal file
@ -0,0 +1,42 @@
|
||||
;-------------------------------
|
||||
; #JSR8B3
|
||||
; patch insane bootloader that
|
||||
; alters the nibble table used
|
||||
; by the drive firmware, reads
|
||||
; sectors in the wrong order,
|
||||
; and decodes nibbles in the
|
||||
; wrong order
|
||||
; e.g. English Achievement I
|
||||
;-------------------------------
|
||||
!zone {
|
||||
jsr ID8b3
|
||||
bcs .exit
|
||||
bcc +
|
||||
|
||||
.sectors
|
||||
!byte $00,$00,$02,$02,$02,$02,$02,$02,$02,$02
|
||||
.offsets
|
||||
!byte $02,$5C,$0A,$0E,$10,$20,$25,$CA,$CE,$D2
|
||||
.values
|
||||
!byte $C7,$B7,$BC,$BC,$00,$BC,$BC,$00,$BC,$BC
|
||||
|
||||
+ lda #$09
|
||||
sta .loop+1
|
||||
ldx #$B8
|
||||
ldy #$10
|
||||
jsr modify
|
||||
!byte $00,$0D,$0B,$09,$07,$05,$03,$01
|
||||
!byte $0E,$0C,$0A,$08,$06,$04,$02,$0F
|
||||
|
||||
.loop ldy #$d1
|
||||
lda .values,y
|
||||
sta .value
|
||||
lda .sectors,y
|
||||
ldx .offsets,y
|
||||
ldy #$01
|
||||
jsr modify
|
||||
.value !byte $d1
|
||||
dec .loop+1
|
||||
bpl .loop
|
||||
.exit
|
||||
}
|
56
src/patchers/methods.a
Normal file
56
src/patchers/methods.a
Normal file
@ -0,0 +1,56 @@
|
||||
;-------------------------------
|
||||
; #METHODS
|
||||
; RWTS changes prologue with RWTS
|
||||
; swapper at $B6B4
|
||||
; e.g. "Alphabetizing: Blue Level"
|
||||
; and others by Methods & Solutions
|
||||
;-------------------------------
|
||||
!zone {
|
||||
_methods
|
||||
lda gIsBoot0 ; if DOS 3.3 boot0 loader
|
||||
bne .exit
|
||||
lda #$08
|
||||
ldx #$5A
|
||||
ldy #$03
|
||||
jsr compare ; and T00,S08,$5A ==
|
||||
!byte $4C,$B4,$36; JMP $36B4
|
||||
bcs .exit
|
||||
lda #$00
|
||||
ldx #$B4
|
||||
ldy #$1A
|
||||
jsr compare ; and T00,S00,$B4 ==
|
||||
!byte $48 ; PHA
|
||||
!byte $68 ; PLA
|
||||
!byte $48 ; PHA
|
||||
!byte $F0,$06 ; BEQ +$06
|
||||
!byte $A9,WILDCARD; LDA #$**
|
||||
!byte $A0,WILDCARD; LDY #$**
|
||||
!byte $D0,$04 ; BNE +$04
|
||||
!byte $A9,$D5 ; LDA #$D5
|
||||
!byte $A0,$AA ; LDY #$AA
|
||||
!byte $8D,$55,$39; STA $3955
|
||||
!byte $8C,$5F,$39; STY $395F
|
||||
!byte $A0,$01 ; LDY #$01
|
||||
!byte $4C,$5D,$3E; JMP $3E5D
|
||||
bcs .exit
|
||||
sta gDisplayBytes
|
||||
lda #s_bytrack
|
||||
jsr PrintByID
|
||||
lda #$00
|
||||
ldx #$BD
|
||||
ldy #$01
|
||||
jsr modify ; then set T00,S00,$BD =
|
||||
!byte $24 ; BIT
|
||||
lda #$01
|
||||
ldx #$47
|
||||
ldy #$03
|
||||
jsr compare ; if T00,S01,$47 ==
|
||||
!byte $4C,$CE,$36; JMP $36CE
|
||||
bcs .exit
|
||||
lda #$01
|
||||
ldx #$48
|
||||
ldy #$01
|
||||
jsr modify ; then set T00,S01,$48 =
|
||||
!byte $D8
|
||||
.exit
|
||||
}
|
@ -91,7 +91,8 @@ s_eeef = $48
|
||||
s_poke = $49
|
||||
s_bootcounter = $4A
|
||||
s_milliken = $4B
|
||||
STRINGCOUNT = $4C
|
||||
s_jsr8b3 = $4C
|
||||
STRINGCOUNT = $4D
|
||||
|
||||
!zone {
|
||||
StringTable
|
||||
@ -171,6 +172,7 @@ StringTable
|
||||
!word .poke
|
||||
!word .bootcounter
|
||||
!word .milliken
|
||||
!word .jsr8b3
|
||||
;
|
||||
; Text can contain substitution strings, which
|
||||
; are replaced by current values at runtime. Each
|
||||
@ -196,7 +198,7 @@ StringTable
|
||||
; can be set directly before calling PrintByID.
|
||||
;
|
||||
.header
|
||||
!text "Passport by 4am 2017-04-18",00
|
||||
!text "Passport by 4am 2017-05-01",00
|
||||
.mainmenu
|
||||
!text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D
|
||||
!text " "
|
||||
@ -437,4 +439,6 @@ StringTable
|
||||
.milliken
|
||||
!text "T00,S0A Found Milliken protection check",$8D
|
||||
!text "T02,S05 might be unreadable",$8D,00
|
||||
.jsr8b3
|
||||
!text "T00,S00 Found JSR $08B3 bootloader",$8D,00
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user