From 2a66e5995135f84ce04c032c2aeb28148ed18891 Mon Sep 17 00:00:00 2001
From: 4am <a2_4am@sent.com>
Date: Wed, 24 Mar 2021 19:06:00 -0400
Subject: [PATCH] add support for Leisure Genius disk volume check

fixes Clue, Risk
---
 src/passport.a            |  1 +
 src/patchers/leisure.a    | 37 +++++++++++++++++++++++++++++++++++++
 src/patchers/zoomgrafix.a |  4 +++-
 src/strings/en.a          | 10 +++++-----
 src/strings/enid.a        |  2 +-
 5 files changed, 47 insertions(+), 7 deletions(-)
 create mode 100644 src/patchers/leisure.a

diff --git a/src/passport.a b/src/passport.a
index b9c581b..0c075fb 100755
--- a/src/passport.a
+++ b/src/passport.a
@@ -834,6 +834,7 @@ _applyToAll
          !source "patchers/harvey.a"            ; T01 only
          !source "patchers/tsr.a"               ; T04 && gIsTSR only
          !source "patchers/woodbury.a"          ; gPossibleWoodbury only
+         !source "patchers/leisure.a"           ; gIsProDOS && T22 only
 
          lda   gPatchCount
          beq   .nopatches
diff --git a/src/patchers/leisure.a b/src/patchers/leisure.a
new file mode 100644
index 0000000..c2c274a
--- /dev/null
+++ b/src/patchers/leisure.a
@@ -0,0 +1,37 @@
+;-------------------------------
+; #LEISURE
+; disk volume check
+;
+; Tested on
+; - Clue: Master Detective (Leisure Genius)
+; - Risk v1.4 (Leisure Genius)
+;-------------------------------
+!zone {
+         bit   gMode      ; nothing to do here in verify-only mode
+         bpl   .exit
+         lda   gIsProDOS
+         bne   .exit
+         lda   gTrack
+         cmp   #$22
+         bne   .exit
+
+         ldy   #$08
+         jsr   SearchTrack
+         !byte $AD,$70,$D3
+         !byte $C9,$01
+         !byte $D0,$01
+         !byte $60
+         bcs   .exit      ; passport-test-suite/Clue Master Detective.woz [C=0] matches
+         sta   gDisplayBytes
+         pha
+         lda   #$01
+         sta   gDisplayBytes+1
+         lda   #s_diskvol0x
+         jsr   PrintByID
+         pla
+         jsr   inx6
+         ldy   #$01
+         jsr   modify
+         !byte $00
+.exit
+}
diff --git a/src/patchers/zoomgrafix.a b/src/patchers/zoomgrafix.a
index 1005315..8b26f0e 100644
--- a/src/patchers/zoomgrafix.a
+++ b/src/patchers/zoomgrafix.a
@@ -18,7 +18,9 @@
          bcs   .exit      ; passport-test-suite/Zoom Grafix 26-JAN-82.woz [C=0] matches
          sta   gDisplayBytes
          pha
-         lda   #s_diskvol0
+         lda   #$00
+         sta   gDisplayBytes+1
+         lda   #s_diskvol0x
          jsr   PrintByID
          txa
          clc
diff --git a/src/strings/en.a b/src/strings/en.a
index 7e7b047..d23d23b 100755
--- a/src/strings/en.a
+++ b/src/strings/en.a
@@ -129,7 +129,7 @@ StringTableLow
          !byte <.hallabs
          !byte <.holle
          !byte <.hoffman
-         !byte <.diskvol0
+         !byte <.diskvol0x
          !byte <.e7everywhere
          !byte <.choplifter
          !byte <.pdi
@@ -253,7 +253,7 @@ StringTableHigh
          !byte >.hallabs
          !byte >.holle
          !byte >.hoffman
-         !byte >.diskvol0
+         !byte >.diskvol0x
          !byte >.e7everywhere
          !byte >.choplifter
          !byte >.pdi
@@ -288,7 +288,7 @@ StringTableHigh
 ; can be set directly before calling PrintByID.
 ;
 .header
-         !text "Passport by 4am               2021-03-05",$00
+         !text "Passport by 4am               2021-03-24",$00
 .mainmenu
          !text "________________________________________",$8D,$8D,$8D,$8D,$8D,$8D,$8D,$8D
          !text "               "
@@ -606,8 +606,8 @@ StringTableHigh
          !text "T00,S00 Found Holle bootloader",$8D,$00
 .hoffman
          !text "T%t,S%0 Found Hoffman protection check",$8D,$00
-.diskvol0
-         !text "T%t,S%0 Disk requires volume number 000",$8D,$00
+.diskvol0x
+         !text "T%t,S%0 Disk requires volume number 0%1",$8D,$00
 .e7everywhere
          !text "T%t,S%0 Found E7 Everywhere protection",$8D,$00
 .choplifter
diff --git a/src/strings/enid.a b/src/strings/enid.a
index a5917ec..62e859b 100644
--- a/src/strings/enid.a
+++ b/src/strings/enid.a
@@ -115,7 +115,7 @@ s_springboard =$6D
 s_hallabs =    $6E
 s_holle =      $6F
 s_hoffman =    $70
-s_diskvol0 =   $71
+s_diskvol0x =  $71
 s_e7everywhere=$72
 s_choplifter = $73
 s_pdi        = $74