From 5f6f15ce7896d33a977ccb9ef4063ee3c0590e71 Mon Sep 17 00:00:00 2001 From: 4am Date: Sun, 10 Jul 2022 00:16:59 -0400 Subject: [PATCH] add support for Enlightenment disks [fixes Paul Whitehead Teaches Chess] --- README.md | 8 ++++- src/apicode.a | 4 +++ src/apidefs.a | 3 +- src/id/enlightenment.a | 18 ++++++++++++ src/id/inspect0.a | 15 +++++++++- src/mods/t00only.a | 1 + src/passport.a | 4 ++- src/patchers/enlightenment.a | 50 ++++++++++++++++++++++++++++++++ src/patchers/t00_enlightenment.a | 41 ++++++++++++++++++++++++++ src/strings/en.a | 10 ++++++- src/strings/enid.a | 2 ++ 11 files changed, 151 insertions(+), 5 deletions(-) create mode 100644 src/id/enlightenment.a create mode 100644 src/patchers/enlightenment.a create mode 100644 src/patchers/t00_enlightenment.a diff --git a/README.md b/README.md index bae1e84..c0a4fa5 100644 --- a/README.md +++ b/README.md @@ -115,6 +115,10 @@ were common in educational software. e.g. Problem Solving in Algebra, Math Skills: Elementary Level +- Enlightenment + e.g. Paul Whitehead Teaches Chess, + Living Chess Library + - Focus Media e.g. The Time Tunnel (series), Travels with Za-Zoom @@ -417,7 +421,7 @@ IN THE SOFTWARE. ## History -2022-07-07 +2022-07-12 - NEW: patchers/mak.a (fixes "Kittens, Kids, and a Frog") - NEW: patchers/t00_baudville.a (fixes @@ -428,6 +432,8 @@ IN THE SOFTWARE. pfs:* Pascal titles) - NEW: patchers/pfs.prodos.a (fixes pfs:* ProDOS titles) +- NEW: patchers/enlightenment.a (fixes + Paul Whitehead Teaches Chess) - IMPROVED: id/555.a (fixes Fax, Funbunch College Prep) - IMPROVED: patchers/ea.a (fixes diff --git a/src/apicode.a b/src/apicode.a index 5afc3c7..8e2a40c 100644 --- a/src/apicode.a +++ b/src/apicode.a @@ -79,6 +79,10 @@ ; set in IDBootFailure() after reading T00 FIRSTFILTER +;gIsEnlightenment + !byte FALSE ; 0=true, 1=false + ; reset before each operation + ; set in IDBootloader() after reading T00,S00 ;gIsBaudville !byte FALSE ; 0=true, 1=false ; reset before each operation diff --git a/src/apidefs.a b/src/apidefs.a index 01741a0..f636abb 100644 --- a/src/apidefs.a +++ b/src/apidefs.a @@ -184,9 +184,10 @@ gPossibleWoodbury = gPossibleMECCSwapper-$01 ; byte gPossibleB4BBBasic = gPossibleWoodbury-$01 ; byte gIsLowDOS = gPossibleB4BBBasic-$01 ; byte gIsBaudville = gIsLowDOS-$01 ; byte +gIsEnlightenment = gIsBaudville-$01 ; byte ;LASTFILTER ; add new gIs* above this line ;gIsInfocom18 is a special case whose ID is not in the regular inspection path -gIsInfocom18 = gIsBaudville-$01 ; byte +gIsInfocom18 = gIsEnlightenment-$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/enlightenment.a b/src/id/enlightenment.a new file mode 100644 index 0000000..38fb119 --- /dev/null +++ b/src/id/enlightenment.a @@ -0,0 +1,18 @@ +;------------------------------- +; IDEnlightenment +; identify Enlightenment bootloader +; +; in: $800..$8FF contains T00,S00 +; out: C clear if Enlightenment bootloader found +; C set otherwise +; all other registers & flags clobbered +;------------------------------- +!macro IDEnlightenment { + lda #$08 + ldx #$01 + ldy #$04 + jsr CompareMemory + !byte $A9,$B7 + !byte $85,$27 + ; passport-test-suite/Paul Whitehead Teaches Chess.woz [C=0] matches +} diff --git a/src/id/inspect0.a b/src/id/inspect0.a index e7cbe31..6af04da 100755 --- a/src/id/inspect0.a +++ b/src/id/inspect0.a @@ -57,6 +57,7 @@ IDBootloader .sanity ; ; Quick sanity check -- only recognized values for $0800 are +; $00 = some Enlightenment disks ; $01 = most disks ; $02 = Special Delivery (DOS 3.3P) ; $05 = some EA disks @@ -67,7 +68,19 @@ IDBootloader bcc .sane cmp #$05 beq .sane -+ jmp UseUniversal +- jmp UseUniversal ++ +; +; Try to identify Enlightenment bootloader. +; (in none; out none) +; + +IDEnlightenment + bcs - + lda #TRUE + sta gIsEnlightenment + jsr PrintByID + !byte s_enlightenmentb0 + bvc - ; always branches .sane ; diff --git a/src/mods/t00only.a b/src/mods/t00only.a index c72b647..f13a028 100644 --- a/src/mods/t00only.a +++ b/src/mods/t00only.a @@ -96,6 +96,7 @@ T00_IsNotRWTS !source "../patchers/t00_rol1e.a" !source "../patchers/t00_sigcheck.a" !source "../patchers/t00_baudville.a" + !source "../patchers/t00_enlightenment.a" rts !if * > $3200 { diff --git a/src/passport.a b/src/passport.a index 0ea34f9..ec280d9 100755 --- a/src/passport.a +++ b/src/passport.a @@ -1,7 +1,7 @@ ;------------------------------- ; Passport ; a 4am hack -; (c) 2016-2021 by 4am +; (c) 2016-2022 by 4am ; ; Permission is hereby granted, free of charge, to any ; person obtaining a copy of this software and associated @@ -72,6 +72,7 @@ NonRelocatable !source "id/dinkeydos.a" !source "id/advent.a" !source "id/baudville.a" + !source "id/enlightenment.a" !source "id/panglosdos.a" !source "id/davidson.a" !source "id/holle.a" @@ -368,6 +369,7 @@ AnalyzeTrack !source "patchers/b4bbbasic.a" ; gPossibleB4BBBasic only !source "patchers/sigcheck.a" ; gPossibleSigCheck only !source "patchers/errord51.a" ; gIsLowDOS only + !source "patchers/enlightenment.a" ; gIsEnlightenment && T02 only ; ; DOS 3.3-specific patchers ; diff --git a/src/patchers/enlightenment.a b/src/patchers/enlightenment.a new file mode 100644 index 0000000..a6029d4 --- /dev/null +++ b/src/patchers/enlightenment.a @@ -0,0 +1,50 @@ +;------------------------------- +; #ENLIGHTENMENT +; anti-tamper checks on the changes +; we're about to make on track 0 +; to disable the RWTS swapper and +; protection check +;------------------------------- +!zone { + lda gIsEnlightenment + bne .exit + lda gTrack + cmp #$02 + bne .exit + + lda #$01 + ldx #$AE + jsr compare1 + !byte $48 + bcs + + + jsr PrintByID + !byte s_tamper + jsr modify1 + !byte $EA ++ + lda #$01 + ldx #$D5 + jsr compare1 + !byte $48 + bcs + + + jsr PrintByID + !byte s_tamper + jsr modify1 + !byte $EA ++ + lda #$09 + ldx #$8A + jsr compare3 + !byte $A9,$00 + !byte $48 + bcs + + inx + jsr PrintByID + !byte s_tamper + jsr modify1 + !byte $52 ++ +.exit +} diff --git a/src/patchers/t00_enlightenment.a b/src/patchers/t00_enlightenment.a new file mode 100644 index 0000000..ffbc99a --- /dev/null +++ b/src/patchers/t00_enlightenment.a @@ -0,0 +1,41 @@ +;------------------------------- +; #T00_ENLIGHTENMENT +; RWTS third data prologue varies, +; also an insane flux-level timing +; protection +; +; tested on +; - Paul Whitehead Teaches Chess +; - King's Indian Defense +; - Living Chess Library - 50 Classic Games +;------------------------------- +!zone { + lda gIsEnlightenment + bne .exit + + lda #$0A + ldx #$26 + jsr compare2 + !byte $85,$3D + bcs + + + jsr PrintByID + !byte s_enlightenment + jsr modify2 + !byte $18 + !byte $60 ++ + lda #$0C + ldx #$94 + jsr compare3 + !byte $BD,$00,$BF + bcs + + + jsr PrintByID + !byte s_bytrack + jsr modify3 + !byte $EA + !byte $A9,$AD ++ +.exit +} diff --git a/src/strings/en.a b/src/strings/en.a index aa02d1c..407a200 100755 --- a/src/strings/en.a +++ b/src/strings/en.a @@ -213,6 +213,8 @@ StringTableLow ; must be kept in sync with constants in enid.a !byte <.protection !byte <.baudville !byte <.pfs + !byte <.enlightenmentb0 + !byte <.enlightenment StringTableHigh ; must be kept in sync with constants in enid.a !byte >.header @@ -365,11 +367,13 @@ StringTableHigh ; must be kept in sync with constants in enid.a !byte >.protection !byte >.baudville !byte >.pfs + !byte >.enlightenmentb0 + !byte >.enlightenment .passport !text "Passport ",$00 .header - !text "@",s_passport,"by 4am@",s_space7,"@",s_space7," 2022-07-07",$00 + !text "@",s_passport,"by 4am@",s_space7,"@",s_space7," 2022-07-09",$00 .bar9 !text "_________",$00 .bar18 @@ -756,3 +760,7 @@ StringTableHigh ; must be kept in sync with constants in enid.a !text "@",s_found,"Baudville @",s_bootloader,$8D,$00 .pfs !text "@",s_found,"PFS @",s_protectioncheck,$8D,$00 +.enlightenmentb0 + !text "@",s_found,"Enlightenment @",s_bootloader,$8D,$00 +.enlightenment + !text "@",s_found,"flux timing @",s_protection,$8D,$00 diff --git a/src/strings/enid.a b/src/strings/enid.a index f15c2a8..75eb5f1 100644 --- a/src/strings/enid.a +++ b/src/strings/enid.a @@ -151,3 +151,5 @@ s_lockitupserial = $92 s_protection = $93 s_baudville = $94 s_pfs = $95 +s_enlightenmentb0 = $96 +s_enlightenment = $97