From 984946a2b7afb257b7777eeddfa1d61b63a954c7 Mon Sep 17 00:00:00 2001 From: 4am Date: Fri, 24 Jun 2022 13:44:26 -0400 Subject: [PATCH] add support for Baudville --- src/apicode.a | 4 ++ src/apidefs.a | 3 +- src/id/baudville.a | 39 +++++++++++++++++++ src/id/inspect0.a | 11 ++++++ src/mods/t00only.a | 1 + src/passport.a | 1 + src/patchers/t00_baudville.a | 75 ++++++++++++++++++++++++++++++++++++ src/strings/en.a | 6 ++- src/strings/enid.a | 1 + 9 files changed, 139 insertions(+), 2 deletions(-) create mode 100644 src/id/baudville.a create mode 100644 src/patchers/t00_baudville.a diff --git a/src/apicode.a b/src/apicode.a index f42adc4..5afc3c7 100644 --- a/src/apicode.a +++ b/src/apicode.a @@ -79,6 +79,10 @@ ; set in IDBootFailure() after reading T00 FIRSTFILTER +;gIsBaudville + !byte FALSE ; 0=true, 1=false + ; reset before each operation + ; set in IDBootloader() after reading T00,S00 ;gIsLowDOS !byte FALSE ; 0=true, 1=false ; reset before each operation diff --git a/src/apidefs.a b/src/apidefs.a index dbc9ebc..01741a0 100644 --- a/src/apidefs.a +++ b/src/apidefs.a @@ -183,9 +183,10 @@ gPossibleMECCSwapper = gIsTSR-$01 ; byte gPossibleWoodbury = gPossibleMECCSwapper-$01 ; byte gPossibleB4BBBasic = gPossibleWoodbury-$01 ; byte gIsLowDOS = gPossibleB4BBBasic-$01 ; byte +gIsBaudville = gIsLowDOS-$01 ; byte ;LASTFILTER ; add new gIs* above this line ;gIsInfocom18 is a special case whose ID is not in the regular inspection path -gIsInfocom18 = gIsLowDOS-$01 ; byte +gIsInfocom18 = gIsBaudville-$01 ; byte ;gIs13Sector is a special case whose ID is not in the regular inspection path gIs13Sector = gIsInfocom18-$01 ; byte ;gMECCFastloadType is a special case integer whose default value cannot be #FALSE diff --git a/src/id/baudville.a b/src/id/baudville.a new file mode 100644 index 0000000..12a921c --- /dev/null +++ b/src/id/baudville.a @@ -0,0 +1,39 @@ +;------------------------------- +; IDBaudville +; identify Baudville bootloader +; +; in: track buffer contains T00,S00 +; out: C clear if Baudville bootloader found +; C set otherwise +; all other registers & flags clobbered +;------------------------------- +!macro IDBaudville { +; variation 1 +; - Blazing Paddles rev. 0 +; - Blazing Paddles v04421 +; - Blazing Paddles v04431 +; - Pixit v01331 + lda #$00 + ldx #$15 + jsr compare3 + !byte $18,$AD,$4A + bcc + ; passport-test-suite/Blazing Paddles.woz [C=0] matches +; variation 2 +; - Guitar Wizard v11601 +; - Prince v15521 +; - Prince v15531 +; - Rainy Day Games v13501 +; - Ski Crazed v28701 +; - Take 1 v06431 +; - Take 1 v06451 +; - Video Vegas v12501 +; - Video Vegas v12511 + lda #BASEPAGE + ldy #$05 + jsr SearchSector + !byte $48 + !byte $AD,$01,$E0 + !byte $48 + ; passport-test-suite/Take 1.woz [C=0] matches ++ +} diff --git a/src/id/inspect0.a b/src/id/inspect0.a index c9d64dd..e7cbe31 100755 --- a/src/id/inspect0.a +++ b/src/id/inspect0.a @@ -339,6 +339,17 @@ IDBootloader jmp foundadvent .notInterplay ; +; Try to identify Baudville bootloader. +; (in none; out none) +; + +IDBaudville + bcs .notBaudville + jsr PrintByID + !byte s_baudville + lda #TRUE + sta gIsBaudville +.notBaudville +; ; Try to detect whether there is code in the boot sector ; that loads 4-and-4-encoded data. This is an early escape ; hatch for disks that will fail later anyway. diff --git a/src/mods/t00only.a b/src/mods/t00only.a index 8e6009d..c72b647 100644 --- a/src/mods/t00only.a +++ b/src/mods/t00only.a @@ -95,6 +95,7 @@ T00_IsNotRWTS !source "../patchers/t00_rdos13.a" !source "../patchers/t00_rol1e.a" !source "../patchers/t00_sigcheck.a" + !source "../patchers/t00_baudville.a" rts !if * > $3200 { diff --git a/src/passport.a b/src/passport.a index c2606b3..0ea34f9 100755 --- a/src/passport.a +++ b/src/passport.a @@ -71,6 +71,7 @@ NonRelocatable !source "id/volumename.a" !source "id/dinkeydos.a" !source "id/advent.a" + !source "id/baudville.a" !source "id/panglosdos.a" !source "id/davidson.a" !source "id/holle.a" diff --git a/src/patchers/t00_baudville.a b/src/patchers/t00_baudville.a new file mode 100644 index 0000000..b1caa03 --- /dev/null +++ b/src/patchers/t00_baudville.a @@ -0,0 +1,75 @@ +;------------------------------- +; #BAUDVILLE +; track sync and hidden sector checks +; +; tested on +; - Blazing Paddles rev. 0 +; - Blazing Paddles v04421 +; - Blazing Paddles v04431 +; - Guitar Wizard v11601 +; - Pixit v01331 +; - Prince v15521 +; - Prince v15531 +; - Rainy Day Games v13501 +; - Ski Crazed v28701 +; - Take 1 v06431 +; - Take 1 v06451 +; - Video Vegas v12501 +; - Video Vegas v12511 +;------------------------------- +!zone { + lda gIsBaudville + bne .exit + +;.variation1 + ldy #$03 + jsr SearchTrack + !byte $4C,$00,$BB + bcs .variation2 + tay ; only continue if we found it in sector 0 + bne .variation2 + inx + inx + jsr modify1 + !byte $B1 ; JMP $BB00 -> JMP $B100 + bvc .secondary ; always branches + +.variation2 + lda #$06 + ldx #$00 + jsr compare2 + !byte $E0,$02 + bcs .secondary + + ldy #$04 + jsr SearchTrack + !byte $A5,$2B + !byte $8D,$D0 + bcs .secondary + cmp #$06 ; only continue if we found it in sector 6 + bne .secondary + dex + stx @offset + ldx #$01 + jsr modify1 ; change entry point to first instruction after protection +@offset !byte $FD ; SMC + ; /!\ execution falls through here + +.secondary + lda #$0F + ldx #$04 + ldy #$06 + jsr compare + !byte $A5,$2D + !byte $C9,$FF + !byte $D0,$F7 + bcs .exit + inx + inx + inx + inx + inx + jsr modify1 + !byte $00 ; branch back -> branch to next instruction (i.e. ignore) +.exit +} diff --git a/src/strings/en.a b/src/strings/en.a index cba5b1d..4e4d882 100755 --- a/src/strings/en.a +++ b/src/strings/en.a @@ -211,6 +211,7 @@ StringTableLow ; must be kept in sync with constants in enid.a !byte <.erasingserialnumber !byte <.lockitupserial !byte <.protection + !byte <.baudville StringTableHigh ; must be kept in sync with constants in enid.a !byte >.header @@ -361,11 +362,12 @@ StringTableHigh ; must be kept in sync with constants in enid.a !byte >.erasingserialnumber !byte >.lockitupserial !byte >.protection + !byte >.baudville .passport !text "Passport ",$00 .header - !text "@",s_passport,"by 4am@",s_space7,"@",s_space7," 2022-06-12",$00 + !text "@",s_passport,"by 4am@",s_space7,"@",s_space7," 2022-06-24",$00 .bar9 !text "_________",$00 .bar18 @@ -748,3 +750,5 @@ StringTableHigh ; must be kept in sync with constants in enid.a !text "@",s_found,"RW18-sector format",$8D,$00 .x555 !text "@",s_found,"5-5-5 spiral @",s_bootloader,$8D,$00 +.baudville + !text "@",s_found,"Baudville @",s_bootloader,$8D,$00 diff --git a/src/strings/enid.a b/src/strings/enid.a index a6a7da2..7617c91 100644 --- a/src/strings/enid.a +++ b/src/strings/enid.a @@ -149,3 +149,4 @@ s_555 = $90 s_erasingserialnumber = $91 s_lockitupserial = $92 s_protection = $93 +s_baudville = $94