verify RW18 (WIP)

This commit is contained in:
Peter Ferrie 2021-04-20 16:29:46 -07:00
parent 09b58e2c58
commit b080cbf31c
9 changed files with 160 additions and 31 deletions

View File

@ -67,6 +67,11 @@
; reset before each operation
; set in IDBootloader() after reading T00,S00
;gIsRW18
!byte FALSE ; 0=true, 1=false
; reset before each operation
; set in IDBootFailure() after reading T00
FIRSTFILTER
;gPossibleB4BBBasic
!byte FALSE ; 0=true, 1=false

View File

@ -145,8 +145,10 @@ gIsInfocom18 = gPossibleB4BBBasic-$01 ; byte
gIs13Sector = gIsInfocom18-$01 ; byte
;gMECCFastloadType is a special case integer whose default value cannot be #FALSE
gMECCFastloadType = gIs13Sector-$01 ; byte
;gIsRW18 is a special case whose ID is not in the regular inspection path
gIsRW18 = gMECCFastloadType-$01 ; byte
gOnAClearDayYouCanReadForever = gMECCFastloadType-$01 ; byte
gOnAClearDayYouCanReadForever = gIsRW18-$01 ; byte
gTargetType = gOnAClearDayYouCanReadForever-$01 ; byte
gRAMDiskRef = gTargetType-$01 ; byte
gHardDiskRef = gRAMDiskRef-$01 ; byte
@ -222,6 +224,7 @@ ConstructStandardDelivery = jConstructStandardDelivery
!warn "gIsRDOS13=",gIsRDOS13
!warn "gIsInfocom18=",gIsInfocom18
!warn "gIs13Sector=",gIs13Sector
!warn "gIsRW18=",gIsRW18
!warn "gOnAClearDayYouCanReadForever=",gOnAClearDayYouCanReadForever
!warn "gTargetType=",gTargetType
!warn "gRAMDiskRef=",gRAMDiskRef

View File

@ -19,6 +19,7 @@ ReadWithRWTS
jmp Cancel
.checkinfocom
lda gIsInfocom18
and gIsRW18
bne checksector
jsr VerifyInfocom18
bcc .passtrack

View File

@ -40,6 +40,10 @@ IDBootloader
ldx gIsInfocom18
beq .printinfo
lda #s_rw18
ldx gIsRW18
beq .printinfo
.check13
lda gIs13Sector
bne .sanity
@ -341,7 +345,9 @@ PrereadT00Partial
; when the initial read failed
; identifies Infocom 18-sector side B disks
; and pure 13-sector disks
; and Broderbund RW18 disks
; doubles as Infocom verification routine after ID
; triples as RW18 verification routine after ID
; written by qkumba
;
; in: nothing
@ -372,7 +378,8 @@ VerifyInfocom18
dec modsrc
beq .no
lda gIsInfocom18
beq .no ; if in Infocom mode already then we have a true failure
and gIsRW18
beq .no ; if in Infocom/RW18 mode already then we have a true failure
bne .retry13 ; otherwise, try to identify 13-sector instead
; the issue being that both have a D5 AA AD sequence
@ -381,6 +388,8 @@ VerifyInfocom18
-- cmp #$D5
bne ---
jsr ReadNib
cmp #$9D
beq .RW18
cmp #$AA
bne --
jsr ReadNib
@ -431,6 +440,14 @@ VerifyInfocom18
lda $C0E8
rts
.RW18
jsr .rw18pro
bne --
ldx gIsRW18
beq .verifyrw18
sta gIsRW18
bne .checkmode ; always taken
;build 5-and-3 decoding table
;for 13-sector support
@ -453,6 +470,88 @@ VerifyInfocom18
sty gIs13Sector
beq .checkmode ; always taken
.verifyrw18
ldx #$06 ; six sectors, three times the usual size
stx tmp ; sector counter
bne +
--- jsr ReadNib
-- cmp #$D5
bne ---
jsr ReadNib
cmp #$9D
bne --
jsr .rw18pro
bne .badrw18
+ ldy #4
- dey
beq .badrw18
jsr ReadNib6
eor #$A5
bne -
sta $3A
tay
-- ldx $C0EC
bpl --
eor $3A
eor $BA00,x
sta $2F
lda $BA00,x
asl
asl
sta $30
- ldx $C0EC
bpl -
and #$C0
ora $BA00,x
sta $3A
lda $30
asl
asl
- ldx $C0EC
bpl -
sta $30
and #$C0
ora $BA00,x
sta $3B
lda $30
asl
- ldx $C0EC
bpl -
asl
ora $BA00,x
eor $3B
eor $2F
iny
bne --
- ldx $C0EC
bpl -
eor $BA00,x
eor $3A
and #$3F
bne .badrw18
jsr ReadNib
cmp #$D4
bne .badrw18
dec tmp
bne ---
jmp .checkmode
.badrw18
jmp .badsect
.rw18pro
jsr ReadNib6 ; region (half)
sta $2C
jsr ReadNib6 ; region (half)
sta $2D
jsr ReadNib6 ; checksum
eor $2C
eor $2D
bne .badrw18
jsr ReadNib6 ; epilogue
eor #$AA
rts
read13
lda $C0E9
lda #$1C ; retry count

View File

@ -165,6 +165,7 @@ Reaction
sta gIsProtDOS
sta gIsInfocom18
sta gIs13Sector
sta gIsRW18
lda #$00
sta gTrack
sta gSector
@ -440,31 +441,31 @@ LastMover
!warn "LowPoint=", HIGHPOINT - (LastMover - FirstMover)
}
!warn "CleanExit=",CleanExit
!warn "WaitForKey=",WaitForKey
!warn "OpenFile=",OpenFile
!warn "ReadFile=",ReadFile
!warn "CloseFile=",CloseFile
!warn "GetVolumeName=",GetVolumeName
!warn "OnlineReturn=",OnlineReturn
!warn "VolumeName=",VolumeName
!warn "RAMDiskImagePath=",RAMDiskImagePath
!warn "GetVolumeInfo=",GetVolumeInfo
!warn "mliparam=",mliparam
!warn "access=",access
!warn "filetype=",filetype
!warn "auxtype=",auxtype
!warn "blocks=",blocks
!warn "PREFSFILE=",PREFSFILE
!warn "PREFSBUFFER=",PREFSBUFFER
!warn "PREFSREADLEN=",PREFSREADLEN
!warn "PREFSVER=",PREFSVER
!warn "SavePrefs=",SavePrefs
!warn "ValidatePrefs=",ValidatePrefs
!warn "kForceLower=",kForceLower
!warn "PrintByID=",PrintByID
!warn "DiskIIArray=",DiskIIArray
!warn "HardDiskArray=",HardDiskArray
!warn "ThisSlot=",ThisSlot
!warn "CheckCache=",CheckCache
!warn "^!set CleanExit=",CleanExit
!warn "^!set WaitForKey=",WaitForKey
!warn "^!set OpenFile=",OpenFile
!warn "^!set ReadFile=",ReadFile
!warn "^!set CloseFile=",CloseFile
!warn "^!set GetVolumeName=",GetVolumeName
!warn "^!set OnlineReturn=",OnlineReturn
!warn "^!set VolumeName=",VolumeName
!warn "^!set RAMDiskImagePath=",RAMDiskImagePath
!warn "^!set GetVolumeInfo=",GetVolumeInfo
!warn "^!set mliparam=",mliparam
!warn "^!set access=",access
!warn "^!set filetype=",filetype
!warn "^!set auxtype=",auxtype
!warn "^!set blocks=",blocks
!warn "^!set PREFSFILE=",PREFSFILE
!warn "^!set PREFSBUFFER=",PREFSBUFFER
!warn "^!set PREFSREADLEN=",PREFSREADLEN
!warn "^!set PREFSVER=",PREFSVER
!warn "^!set SavePrefs=",SavePrefs
!warn "^!set ValidatePrefs=",ValidatePrefs
!warn "^!set kForceLower=",kForceLower
!warn "^!set PrintByID=",PrintByID
!warn "^!set DiskIIArray=",DiskIIArray
!warn "^!set HardDiskArray=",HardDiskArray
!warn "^!set ThisSlot=",ThisSlot
!warn "^!set CheckCache=",CheckCache
}

View File

@ -162,6 +162,7 @@ StringTableLow
!byte <.targetdisk
!byte <.targetfile
!byte <.targetcffa
!byte <.rw18
StringTableHigh
!byte >.header
@ -307,6 +308,7 @@ StringTableHigh
!byte >.targetdisk
!byte >.targetfile
!byte >.targetcffa
!byte >.rw18
;
; Text can contain substitution strings, which
@ -342,7 +344,7 @@ StringTableHigh
.passport
!text "Passport ",$00
.header
!text "@",s_passport,"by 4am@",s_space7,"@",s_space7," 2021-04-19",$00
!text "@",s_passport,"by 4am@",s_space7,"@",s_space7," 2021-04-20",$00
.bar9
!text "_________",$00
.bar18
@ -715,4 +717,6 @@ StringTableHigh
!text "T00,S01 Erasing site license information",$00
.badblock
!text "@",s_found,"bad block @",s_protectioncheck,$00
.rw18
!text "@",s_found,"RW18-sector format",$8D,$00
}

View File

@ -145,3 +145,4 @@ s_writingto = $8B
s_targetdisk = $8C
s_targetfile = $8D
s_targetcffa = $8E
s_rw18 = $8F

View File

@ -250,6 +250,21 @@ ReadNib
bpl -
rts
;-------------------------------
; ReadNib6
; read a single nibble from S6,D1
; return corresponding 6-bit value
;
; in: S6,D1 must be spun up and ready to read
; out: A contains 6-bit value
; X contains nibble value
;-------------------------------
ReadNib6
jsr ReadNib
tax
lda $BA00,x
rts
;-------------------------------
; Read4x4
; read a 4-4-encoded value from S6,D1

View File

@ -50,7 +50,7 @@ for /f "tokens=4,* delims=:(" %%q in ('find "mliparam=" ..\build\out.txt') do ec
for /f "tokens=4,* delims=:(" %%q in ('find "OpenFile=" ..\build\out.txt') do echo %%q >> ..\build\vars.a
for /f "tokens=4,* delims=:(" %%q in ('find "ReadFile=" ..\build\out.txt') do echo %%q >> ..\build\vars.a
for /f "tokens=4,* delims=:(" %%q in ('find "CloseFile=" ..\build\out.txt') do echo %%q >> ..\build\vars.a
for /f "tokens=4,* delims=:(" %%q in ('find "CheckCache=" ..\build\out.txt') do echo %%q > ..\build\vars.a
for /f "tokens=4,* delims=:(" %%q in ('find "CheckCache=" ..\build\out.txt') do echo %%q >> ..\build\vars.a
cd ..\build
%EXOMIZER% raw -q -P23 -T4 -b passport.tmp -o passport.pak
cd ..\src