verify Infocom 18-sector format

This commit is contained in:
Peter Ferrie 2018-12-28 11:46:36 -08:00
parent 7ac054c7b4
commit 8b58e3b94f
6 changed files with 126 additions and 8 deletions

View File

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

View File

@ -99,8 +99,10 @@ gIsPanglosDOS = gIsAdvent-$01 ; byte
gIsDavidson = gIsPanglosDOS-$01 ; byte gIsDavidson = gIsPanglosDOS-$01 ; byte
gIsRDOS13 = gIsDavidson-$01 ; byte gIsRDOS13 = gIsDavidson-$01 ; byte
;LASTFILTER ; add new gIs* above this line ;LASTFILTER ; add new gIs* above this line
;gIsInfocom18 is a special case whose ID is not in the regular inspection path
gIsInfocom18 = gIsRDOS13-$01 ; byte
;gMECCFastloadType is a special case integer whose default value cannot be #FALSE ;gMECCFastloadType is a special case integer whose default value cannot be #FALSE
gMECCFastloadType = gIsRDOS13-$01 ; byte gMECCFastloadType = gIsInfocom18-$01 ; byte
gOnAClearDayYouCanReadForever = gMECCFastloadType-$01 ; byte gOnAClearDayYouCanReadForever = gMECCFastloadType-$01 ; byte
gUsingRAMDisk = gOnAClearDayYouCanReadForever-$01 ; byte gUsingRAMDisk = gOnAClearDayYouCanReadForever-$01 ; byte
@ -168,6 +170,7 @@ ConstructStandardDelivery = jConstructStandardDelivery
!warn "gIsPanglosDOS=",gIsPanglosDOS !warn "gIsPanglosDOS=",gIsPanglosDOS
!warn "gIsDavidson=",gIsDavidson !warn "gIsDavidson=",gIsDavidson
!warn "gIsRDOS13=",gIsRDOS13 !warn "gIsRDOS13=",gIsRDOS13
!warn "gIsInfocom18=",gIsInfocom18
!warn "gOnAClearDayYouCanReadForever=",gOnAClearDayYouCanReadForever !warn "gOnAClearDayYouCanReadForever=",gOnAClearDayYouCanReadForever
!warn "gUsingRAMDisk=",gUsingRAMDisk !warn "gUsingRAMDisk=",gUsingRAMDisk
!warn "gRAMDiskRef=",gRAMDiskRef !warn "gRAMDiskRef=",gRAMDiskRef

View File

@ -18,6 +18,14 @@ IDBootloader
bne - bne -
stx gMECCFastloadType stx gMECCFastloadType
stx gLastTrack stx gLastTrack
lda gIsInfocom18
bne .sanity
lda #s_infocom18
jsr PrintByID
jmp UseUniversal
.sanity
; ;
; Quick sanity check -- only recognized values for $0800 ; Quick sanity check -- only recognized values for $0800
; are 1 or 2 for regular disks, and 5 for possible Electronic Arts. ; are 1 or 2 for regular disks, and 5 for possible Electronic Arts.
@ -288,3 +296,92 @@ PrereadT00Partial
.exit .exit
rts rts
} }
;-------------------------------
; IDBootFailure
; main entry point to identify the bootloader
; when the initial read failed
; identifies Infocom 18-sector side B disks
; doubles as verification routine after ID
; written by qkumba
;
; in: nothing
; out: carry set if we can't ID it
;-------------------------------
!zone {
IDBootFailure
lda #FALSE
sta gIsInfocom18
bit gMode ; only in verify-mode
bmi .branchno
VerifyInfocom18
lda $C0E9
lda #$1A ; the length of a track
sta tmp ; keep X register free
ldy #0
- iny
bne +
dec tmp
beq .branchno
+ lda $C0EC
bpl -
-- cmp #$D5
bne -
- lda $C0EC
bpl -
cmp #$AA
bne --
- lda $C0EC
bpl -
cmp #$AD
beq .tryinfocom
ldx gIsInfocom18
beq -- ; resume if already in Infocom mode
;;other things here in future
.branchno
jmp .no
.tryinfocom
- lda $C0EC
bpl -
nop
nop ; ignore half of 4x4 track number
- lda $C0EC
bpl - ; ignore half of 4x4 track number
lda #$12 ; all 18 sectors when in verify mode
ldx gIsInfocom18
beq .setcount
lda #$01 ; only one sector when in ID mode
.setcount
sta tmp ; sector counter
lda #$00
-- ldy #$56
- ldx $C0EC
bpl -
eor $BA00,x ; from universal RWTS
dey
bne -
- ldx $C0EC
bpl -
eor $BA00,x ; from universal RWTS
iny
bne -
- ldx $C0EC
bpl -
eor $BA00,x ; from universal RWTS
bne .no
dec tmp
bne --
sta gIsInfocom18
clc ; all clear
!byte $24
.no
sec
lda $C0E8
rts
}

View File

@ -274,6 +274,8 @@ Reaction
jsr IgnoreAddressChecksum jsr IgnoreAddressChecksum
jsr ReadSector jsr ReadSector
bcc + bcc +
jsr IDBootFailure ; /src/id/inspect0
bcc +
lda #s_fail lda #s_fail
jsr PrintByID jsr PrintByID
lda #s_fatal0000 lda #s_fatal0000
@ -375,11 +377,20 @@ ReadWithRWTS
sta checksector+2 sta checksector+2
.read .read
lda KEY lda KEY
bpl checksector bpl .checkinfocom
bit STROBE bit STROBE
cmp #$e0 ;ignore backtick (MAME debug break) cmp #$e0 ;ignore backtick (MAME debug break)
beq checksector beq .checkinfocom
jmp Cancel jmp Cancel
.checkinfocom
lda gIsInfocom18
bne checksector
jsr VerifyInfocom18
bcc .passtrack
jmp FatalError
.passtrack
jmp .prevtrack
checksector checksector
lda $FFFF ; status of current sector in sector map (modified above) lda $FFFF ; status of current sector in sector map (modified above)
pha pha
@ -387,10 +398,8 @@ checksector
bcc + bcc +
cmp #kSectorCustomLast cmp #kSectorCustomLast
bcs + bcs +
jsr PreReadSector
tax
pla pla
txa jsr PreReadSector
pha ; replace status (on stack) with new status returned from PreReadSector pha ; replace status (on stack) with new status returned from PreReadSector
+ cmp #kSectorIgnore ; skip this sector? + cmp #kSectorIgnore ; skip this sector?
beq nextsector beq nextsector

View File

@ -123,6 +123,7 @@ StringTable
!word .rdos13 !word .rdos13
!word .ssi !word .ssi
!word .aacount !word .aacount
!word .infocom18
; ;
; Text can contain substitution strings, which ; Text can contain substitution strings, which
; are replaced by current values at runtime. Each ; are replaced by current values at runtime. Each
@ -148,7 +149,7 @@ StringTable
; can be set directly before calling PrintByID. ; can be set directly before calling PrintByID.
; ;
.header .header
!text "Passport by 4am 2018-10-14",$00 !text "Passport by 4am 2018-12-28",$00
.mainmenu .mainmenu
!text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D !text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D
!text " " !text " "
@ -456,4 +457,6 @@ StringTable
!text "T%t,S%0 Found SSI protection check",$8D,$00 !text "T%t,S%0 Found SSI protection check",$8D,$00
.aacount .aacount
!text "T%t,S%0 Found AA nibble count",$8D,$00 !text "T%t,S%0 Found AA nibble count",$8D,$00
.infocom18
!text "T00,S00 Found Infocom 18-sector format",$8D,$00
} }

View File

@ -109,4 +109,5 @@ s_davidson = $67
s_rdos13 = $68 s_rdos13 = $68
s_ssi = $69 s_ssi = $69
s_aacount = $6A s_aacount = $6A
STRINGCOUNT = $6B s_infocom18 = $6B
STRINGCOUNT = $6C