mirror of
https://github.com/a2-4am/passport.git
synced 2025-01-03 08:33:18 +00:00
5-5-5 WIP
This commit is contained in:
parent
c6d2031368
commit
648507f1fd
@ -52,12 +52,7 @@
|
||||
; instead of falling back to built-in RWTS
|
||||
; compile-time flag, no way to change at runtime
|
||||
|
||||
;gIs13Sector
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootFailure() after reading T00
|
||||
|
||||
;gIsInfocom18
|
||||
;gIsRW18
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootFailure() after reading T00
|
||||
@ -67,7 +62,12 @@
|
||||
; reset before each operation
|
||||
; set in IDBootloader() after reading T00,S00
|
||||
|
||||
;gIsRW18
|
||||
;gIs13Sector
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootFailure() after reading T00
|
||||
|
||||
;gIsInfocom18
|
||||
!byte FALSE ; 0=true, 1=false
|
||||
; reset before each operation
|
||||
; set in IDBootFailure() after reading T00
|
||||
|
29
src/id/555.a
Normal file
29
src/id/555.a
Normal file
@ -0,0 +1,29 @@
|
||||
;-------------------------------
|
||||
; ID555
|
||||
; identify 555 bootloader
|
||||
;
|
||||
; in: track buffer contains T00,S00
|
||||
; out: C clear if 555 bootloader found
|
||||
; C set otherwise
|
||||
; all registers clobbered
|
||||
; all other flags clobbered
|
||||
;
|
||||
; tested with
|
||||
; - Bumble Games
|
||||
;-------------------------------
|
||||
ID555
|
||||
lda #8
|
||||
ldy #22
|
||||
jsr SearchSector
|
||||
!byte $85,$27 ; STA $27
|
||||
!byte $E8 ; INX
|
||||
!byte $86,WILDCARD ; STX $xx
|
||||
!byte $84,WILDCARD ; STY $xx
|
||||
!byte $B9,WILDCARD,$08 ; LDA $08xx,Y
|
||||
!byte $85,$3D ; STA $3D
|
||||
!byte $20,WILDCARD,$08 ; JSR $08xx
|
||||
!byte $A4,WILDCARD ; LDY $xx
|
||||
!byte $C8 ; INY
|
||||
!byte $C4,WILDCARD ; CPY $xx
|
||||
!byte $90,$EF ; BCC *-$0F
|
||||
rts
|
@ -315,6 +315,14 @@ IDBootloader
|
||||
jsr PrintByID
|
||||
lda #TRUE
|
||||
sta gIsHolle
|
||||
;
|
||||
; 555 bootloader
|
||||
;
|
||||
+ jsr ID555
|
||||
bcs +
|
||||
lda #s_555
|
||||
jsr PrintByID
|
||||
jmp Do555
|
||||
|
||||
+ jmp UseUniversal
|
||||
}
|
||||
@ -442,7 +450,7 @@ VerifyInfocom18
|
||||
|
||||
.RW18
|
||||
jsr .rw18pro
|
||||
bne --
|
||||
bne .badsect
|
||||
ldx gIsRW18
|
||||
beq .verifyrw18
|
||||
sta gIsRW18
|
||||
@ -547,10 +555,10 @@ VerifyInfocom18
|
||||
jsr ReadNib6 ; checksum
|
||||
eor $2C
|
||||
eor $2D
|
||||
bne .badrw18
|
||||
bne +
|
||||
jsr ReadNib6 ; epilogue
|
||||
eor #$AA
|
||||
rts
|
||||
+ rts
|
||||
|
||||
read13
|
||||
lda $C0E9
|
||||
|
@ -78,6 +78,7 @@ FirstMover
|
||||
!source "id/davidson.a"
|
||||
!source "id/holle.a"
|
||||
!source "id/phoenix.a"
|
||||
!source "id/555.a"
|
||||
!source "print.a"
|
||||
!source "compare.a"
|
||||
!source "modify.a"
|
||||
@ -391,6 +392,7 @@ AnalyzeTrack
|
||||
!source "patchers/b4bbbasic.a" ; gPossibleB4BBBasic only
|
||||
!source "patchers/errord51.a" ; gIsLowDOS only
|
||||
!source "patchers/sigcheck.a" ; gIsDiversi only
|
||||
!source "patchers/555.a" ; gIs555 only
|
||||
|
||||
_checkPatchCount
|
||||
lda gPatchCount
|
||||
|
388
src/patchers/555.a
Normal file
388
src/patchers/555.a
Normal file
@ -0,0 +1,388 @@
|
||||
;-------------------------------
|
||||
; #555
|
||||
; RWTS reads 5 sectors from
|
||||
; three consecutive half-tracks
|
||||
;
|
||||
; module by qkumba
|
||||
;
|
||||
; tested on
|
||||
; - Bumble Games
|
||||
;-------------------------------
|
||||
!zone {
|
||||
jmp .exit2 ; reachable only via inspect
|
||||
|
||||
.refindPC
|
||||
inc $3E
|
||||
sec
|
||||
!byte $A9
|
||||
Do555
|
||||
clc
|
||||
inc $3E
|
||||
php
|
||||
|
||||
.findPC
|
||||
lda #8
|
||||
ldy #3
|
||||
ldx $3E
|
||||
jsr CompareMemory
|
||||
!byte $A9,WILDCARD ; LDA #$xx
|
||||
!byte $48 ; PHA
|
||||
bcc .checkpha
|
||||
ldy #0
|
||||
lda ($3E),y
|
||||
jsr $F88E ; INSDS2
|
||||
lda $2F
|
||||
sec
|
||||
adc $3E
|
||||
sta $3E
|
||||
bcc .findPC
|
||||
jmp .fatal
|
||||
|
||||
.checkpha
|
||||
plp
|
||||
bcc .refindPC
|
||||
|
||||
lda #0
|
||||
sta .curtrk+1
|
||||
ldy #1
|
||||
adc ($3E),y ; add 1, carry is set by CMP
|
||||
sta .initPC+1
|
||||
tya
|
||||
.loopsect
|
||||
sta gSector
|
||||
jsr ReadSector
|
||||
bcs .jmpexit
|
||||
lda #8
|
||||
sta $3B
|
||||
.initPC
|
||||
ldx #0 ; SMC
|
||||
ldy #5
|
||||
jsr CompareMemory
|
||||
!byte $46, $4A ; LSR $4A
|
||||
!byte $20, WILDCARD, $04 ; JSR $04xx
|
||||
bcc .foundstage
|
||||
ldy gSector
|
||||
iny
|
||||
tya
|
||||
and #$0F
|
||||
bne .loopsect
|
||||
.jmpexit
|
||||
jmp .fatal
|
||||
|
||||
;search for seek routine
|
||||
;so we can count calls to whole-track seek
|
||||
|
||||
.foundstage
|
||||
lda gSector
|
||||
sta .cmpsect+1
|
||||
ldy $803,x
|
||||
.retrystage
|
||||
sty .stagePC1+1
|
||||
sty .stagePC5+1
|
||||
sty .patch1+1
|
||||
iny
|
||||
sty .stagePC3+1
|
||||
sty .stagePC6+1
|
||||
iny
|
||||
sty .stagePC2+1
|
||||
iny
|
||||
sty .stagePC4+1
|
||||
sty .patch2+1
|
||||
|
||||
.stagePC1
|
||||
lda $800 ; SMC
|
||||
cmp #$20
|
||||
bne .jmpexit
|
||||
.stagePC2
|
||||
lda $800 ; SMC
|
||||
cmp #4
|
||||
bne .jmpexit
|
||||
.stagePC3
|
||||
ldy $800 ; SMC
|
||||
.stagePC4
|
||||
cpy #$D1 ; SMC
|
||||
beq .foundseek
|
||||
.stagePC5
|
||||
ldx #$D1 ; SMC
|
||||
bne .retrystage ; always
|
||||
|
||||
.foundseek
|
||||
stx $3A
|
||||
|
||||
.walkcode
|
||||
ldy #0
|
||||
lda ($3A),y
|
||||
cmp #$AA
|
||||
beq .isldx
|
||||
cmp #$A2
|
||||
bne .tryseek
|
||||
iny
|
||||
.isldx
|
||||
iny
|
||||
lda ($3A),y
|
||||
cmp #$20
|
||||
bne .sizeinst
|
||||
iny
|
||||
.skipjsr2
|
||||
iny
|
||||
.skipjsr1
|
||||
tya
|
||||
bne .skipinst ; always
|
||||
|
||||
.tryseek
|
||||
cmp #$20
|
||||
bne .trylda
|
||||
iny
|
||||
iny
|
||||
lda ($3A),y
|
||||
cmp #4
|
||||
bne .skipjsr1
|
||||
dey
|
||||
lda ($3A),y
|
||||
cmp .stagePC5+1
|
||||
bcc .skipjsr2
|
||||
bne .followjsr
|
||||
inc .curtrk+1
|
||||
bne .skipjsr2 ; always
|
||||
|
||||
.followjsr
|
||||
sta $3A
|
||||
bcs .walkcode
|
||||
|
||||
.trylda
|
||||
lda #8
|
||||
ldy #3
|
||||
ldx $3A
|
||||
jsr CompareMemory
|
||||
!byte $38 ; SEC
|
||||
!byte $66, $4A ; ROR $4A
|
||||
bcc .foundpart
|
||||
|
||||
.sizeinst
|
||||
ldy #0
|
||||
lda ($3A),y
|
||||
jsr $F88E ; INSDS2
|
||||
lda $2F
|
||||
.skipinst
|
||||
sec
|
||||
adc $3A
|
||||
sta $3A
|
||||
bcc .walkcode
|
||||
jmp .fatal
|
||||
|
||||
; success!
|
||||
; found where the partial tracks start
|
||||
; read whole tracks to this point
|
||||
; then the partial tracks
|
||||
; and then the rest of the disk
|
||||
|
||||
.foundpart
|
||||
jsr IncProgress
|
||||
lda #BASEPAGE
|
||||
sta gAddress+1
|
||||
|
||||
.copytracks
|
||||
ldx #0
|
||||
stx gSector
|
||||
ldy #$10
|
||||
jsr .readwrite
|
||||
lda gTrack
|
||||
.curtrk
|
||||
cmp #00 ; SMC
|
||||
bne .notpartial
|
||||
jsr .setup2
|
||||
ldx #1
|
||||
ldy #6
|
||||
jsr .readsectors
|
||||
sec
|
||||
rol gTrack
|
||||
dec dct+1 ; half-track stepping!
|
||||
ldx #6
|
||||
ldy #11
|
||||
jsr .readsectors
|
||||
inc gTrack
|
||||
ldx #11
|
||||
ldy #16
|
||||
jsr .readsectors
|
||||
lsr gTrack
|
||||
dec gTrack
|
||||
inc dct+1 ; back to normal
|
||||
jsr .writesectors
|
||||
inc gTrack
|
||||
|
||||
.notpartial
|
||||
jsr .setup1
|
||||
lda gTrack
|
||||
cmp #$23
|
||||
bcc .copytracks
|
||||
jsr IncProgress
|
||||
jsr .cleanup
|
||||
jmp .exit
|
||||
|
||||
.readwrite
|
||||
jsr .readsectors
|
||||
|
||||
.writesectors
|
||||
jsr WriteTrackNA
|
||||
jsr IncProgress
|
||||
lda KEY
|
||||
bmi .cancel
|
||||
ldx gTrack
|
||||
inx
|
||||
txa
|
||||
jmp ChangeTrackNW
|
||||
|
||||
.readsectors
|
||||
sty .endsector+1
|
||||
.readsector
|
||||
txa
|
||||
jsr ChangeSector
|
||||
.retryread
|
||||
jsr ReadSector
|
||||
bcs .maybefatal
|
||||
lda gTrack
|
||||
bne .notpatch
|
||||
lda gSector
|
||||
.cmpsect
|
||||
cmp #$00 ; SMC
|
||||
bne .notpatch
|
||||
|
||||
.stagePC6
|
||||
ldy #00 ; SMC
|
||||
lda $3A
|
||||
adc #$0E
|
||||
sta ($3E),y
|
||||
sec
|
||||
sbc #3
|
||||
tax
|
||||
lda $3F
|
||||
sbc #BASEPAGE
|
||||
ldy #15
|
||||
jsr modify
|
||||
.patch1
|
||||
!byte $4C,$00,$04 ; JMP $04xx
|
||||
!byte $48 ; PHA
|
||||
!byte $A5,$FC ; LDA $FC
|
||||
!byte $4A ; LSR
|
||||
!byte $69,$01 ; ADC #$01
|
||||
!byte $85,$41 ; STA $41
|
||||
!byte $68 ; PLA
|
||||
.patch2
|
||||
!byte $4C,$00,$04 ; JMP $04xx
|
||||
txa
|
||||
tay
|
||||
dey
|
||||
dey
|
||||
dey
|
||||
dey
|
||||
lda #$0F
|
||||
sta ($3E),y
|
||||
tya
|
||||
sec
|
||||
sbc #6
|
||||
tay
|
||||
lda #$EA
|
||||
sta ($3E),y
|
||||
dey
|
||||
dey
|
||||
dey
|
||||
lda ($3E),y
|
||||
cmp #$41
|
||||
bne .notpatch
|
||||
lda #$EA
|
||||
sta ($3E),y
|
||||
|
||||
.notpatch
|
||||
ldx gSector
|
||||
inx
|
||||
.endsector
|
||||
cpx #00 ; SMC
|
||||
bne .readsector
|
||||
ldy #12
|
||||
jsr SearchTrack
|
||||
!byte $C9,$FF ; CMP #$FF
|
||||
!byte $D0,$0A ; BNE *+$0C
|
||||
!byte $EA ; NOP
|
||||
!byte $BD,$8C,$C0 ; LDA $C08C,X
|
||||
!byte $10,$FB ; BPL *-3
|
||||
!byte $C9,$FF ; CMP #$FF
|
||||
bcc .patchepi
|
||||
|
||||
.ignore
|
||||
rts
|
||||
|
||||
.cancel
|
||||
jsr .cleanup
|
||||
jmp Cancel
|
||||
|
||||
.maybefatal
|
||||
lda $BDF2
|
||||
cmp #$F0
|
||||
jsr .cleanup
|
||||
bcc .retryread
|
||||
lda gTrack
|
||||
cmp #$12
|
||||
bcc .fatal
|
||||
lda gSector
|
||||
beq .ignore
|
||||
.fatal
|
||||
jmp FatalError
|
||||
|
||||
.patchepi
|
||||
inx
|
||||
ldy #1
|
||||
pha
|
||||
jsr modify
|
||||
!byte $DE
|
||||
txa
|
||||
clc
|
||||
adc #10
|
||||
tax
|
||||
ldy #1
|
||||
pla
|
||||
pha
|
||||
jsr modify
|
||||
!byte $AA
|
||||
txa
|
||||
clc
|
||||
adc #$52
|
||||
tax
|
||||
ldy #1
|
||||
pla
|
||||
pha
|
||||
jsr modify
|
||||
!byte $DE
|
||||
txa
|
||||
clc
|
||||
adc #10
|
||||
tax
|
||||
ldy #1
|
||||
pla
|
||||
jsr modify
|
||||
!byte $AA
|
||||
rts
|
||||
|
||||
.setup2
|
||||
ldy #$CD
|
||||
bne .patchDOS2
|
||||
|
||||
.cleanup
|
||||
lda #1
|
||||
sta dct
|
||||
ldx #$F0
|
||||
!byte $AD
|
||||
.setup1
|
||||
ldx #$90
|
||||
ldy #$B9
|
||||
|
||||
.patchDOS1
|
||||
stx $BDF2
|
||||
.patchDOS2
|
||||
sty $BE2B
|
||||
rts
|
||||
|
||||
.exit
|
||||
jmp Pass
|
||||
|
||||
.exit2
|
||||
}
|
@ -163,6 +163,7 @@ StringTableLow
|
||||
!byte <.targetfile
|
||||
!byte <.targetcffa
|
||||
!byte <.rw18
|
||||
!byte <.x555
|
||||
|
||||
StringTableHigh
|
||||
!byte >.header
|
||||
@ -309,6 +310,7 @@ StringTableHigh
|
||||
!byte >.targetfile
|
||||
!byte >.targetcffa
|
||||
!byte >.rw18
|
||||
!byte >.x555
|
||||
|
||||
;
|
||||
; Text can contain substitution strings, which
|
||||
@ -344,7 +346,7 @@ StringTableHigh
|
||||
.passport
|
||||
!text "Passport ",$00
|
||||
.header
|
||||
!text "@",s_passport,"by 4am@",s_space7,"@",s_space7," 2021-05-22",$00
|
||||
!text "@",s_passport,"by 4am@",s_space7,"@",s_space7," 2021-05-26",$00
|
||||
.bar9
|
||||
!text "_________",$00
|
||||
.bar18
|
||||
@ -719,4 +721,7 @@ StringTableHigh
|
||||
!text "@",s_found,"bad block @",s_protectioncheck,$00
|
||||
.rw18
|
||||
!text "@",s_found,"RW18-sector format",$8D,$00
|
||||
.x555
|
||||
!text "@",s_found,"555 @",s_bootloader,$8D
|
||||
!text "Doing it the hard way.",$8D,$00
|
||||
}
|
||||
|
@ -146,3 +146,4 @@ s_targetdisk = $8C
|
||||
s_targetfile = $8D
|
||||
s_targetcffa = $8E
|
||||
s_rw18 = $8F
|
||||
s_555 = $90
|
||||
|
Loading…
Reference in New Issue
Block a user