changeset 2982:83f8f5e29ac5

sierra: Correct set.pri.base routine used in KingsQuest4 point X to priority table The procedure updates the priority table, pointed by reg X but this register is never assigned. Reg X point to the command table ($81B0) when the procedure is executed and overwrites it, crashing the interpreter almost immediately after the procedure returns. I found out that the priority table resides at $05EE. This table is an array of 168 8-bit values that defines a priority number between 1 and 15 for each line of the graphic screen. I had to insert another routine at the end of the module to have reg X to point at the priority table location and modify the command table to call the alternate routine. Patch by Guillaume Major and Robert Gault.
author Guillaume Major <guillaume.major@gmail.com>
date Sat, 12 Apr 2014 15:30:16 +0200
parents 9550602c9a0b
children 9b876d8e765e
files 3rdparty/packages/sierra/objs_lsl/mnln.asm
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/3rdparty/packages/sierra/objs_lsl/mnln.asm	Sat Apr 12 15:30:03 2014 +0200
+++ b/3rdparty/packages/sierra/objs_lsl/mnln.asm	Sat Apr 12 15:30:16 2014 +0200
@@ -638,7 +638,7 @@
          fdb  L49D1,$0000	*push script
          fdb  L49D8,$0000	*pop script
          fdb  L5A16,$0000	*hold key
-         fdb  L115C,$100	*set pri base
+         fdb  L115CB,$100	*set pri base, via patch stub
          fdb  L5A14,$180	*discard sound
          fdb  L5A16,$0000	*do nothing
          fdb  L29BB,$100
@@ -10758,6 +10758,9 @@
          bra   L6323
 L6334    rts
   
+L115CB   ldx   #$05ee	* regX will now point to the priority table
+         lbra  L115C	* back to the original code
+
 L125CB   lbsr  L125C
          tfr   u,d
          rts