Author Topic: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")  (Read 7907 times)

0 Members and 1 Guest are viewing this topic.

Offline OmerMor

I'm trying to re-compile a decompiled script (KQ6 Spanish, script# 921).

The compiler gives the following error:
Quote
[Error]: &rest cannot be used if the send target itself contains nested procedure calls or sends. Assign the result of the procedure call or send to a temporary variable and use that instead.  Line: 17, col: 42

The relevant procedure is this:
Code: [Select]
(procedure (proc921_0 &tmp newPrint)
((= newPrint (Print new:)) addText: &rest init:)
)

I've got 2 questions:
  • Why does the decompiler output this if it's not valid?
  • What can I do to fix this?
« Last Edit: February 27, 2016, 04:47:15 PM by OmerMor »



Offline Kawa

Re: Compilation error help
« Reply #1 on: February 26, 2016, 04:57:59 PM »
I remember that. Split it up.
Code: [Select]
(procedure (proc921_0 &tmp newPrint)
(= newPrint (Print new:))
(newPrint addText: &rest init:)
)

Offline OmerMor

Re: Compilation error help
« Reply #2 on: February 26, 2016, 05:42:37 PM »
Thanks!
That did the trick.

I've been able to find and enable a debug menu for King's Quest 6. But it only works with the Spanish and Italian versions.
Every other versions crashes. I'll add more information tomorrow, and maybe together we'll be able to coerce these versions to work as well.
« Last Edit: February 27, 2016, 02:21:38 PM by OmerMor »

Offline OmerMor

Re: Compilation error help
« Reply #3 on: February 27, 2016, 03:28:32 PM »
OK, so here's what I've been doing:

I found that KQ6 is checking for the existence of the file 911.SCR as a trigger for an internal debug menu:

n0.sc:
Code: [Select]
(Format @temp0 0 0 911)   ; temp0 <-- "911.scr"
(if (FileIO fiEXISTS @temp0)
(= global100 1)
else
(= global100 0)
)

However most KQ6 versions no longer contain script# 911. The only versions that still has it are the Spanish and Italian ones.
I tried extracting 911.scr, and scummvm crashes because Print::addEdit in script# 921 is doing uninitialized read from temporary variables:
Code: [Select]
(method (addEdit param1 param2 param3 param4 param5 &tmp temp0 temp1)
(if (not dialog) (= dialog (Dialog new:)))
(StrCpy param1 (if (> argc 4) param5 else {}))
(if (> argc 2)
(= temp0 param3)
(if (> argc 3) (= temp1 param4))
)
(dialog
add:
((DEdit new:)
text: param1
max: param2
setSize:
moveTo: (+ temp0 4) (+ temp1 4)
yourself:
)
setSize:
)
)

This was easily fixed by initialized temp0 and temp1 to 0.
I tried to compile n921.sc but failed on the error from the start of this thread.
Kawa's tip was extremely helpful, and I managed to get the debug menu.
Great!

I now tried to backport this to the English versions of KQ6. I copied 911.* and 921.* to the game's folder.
Scummvm crash on start with the following error (floppy version):
  ERROR: Send to invalid selector 0xcd of object at 0001:1d56!

The backtrace gives the following:
Code: [Select]
...
6: script 99 - speedRoom::init()
    by 5 obj@0030:026b pc=0030:0065 sp=ST:002a fp=ST:0029 argp:ST:0028
7: script 911 - export 1 ()
    by 6 obj@0030:026b pc=0032:0024 sp=ST:0035 fp=ST:002b argp:ST:002a

frame 6's instruction is
  0030:005f: calle 038f 0001 00.

frame 7's instruction is
  0032:0024: send 06
  Kq6::addButton[INVALID](0001:2070)


Here's sv.exe for 911:export_1 :
Code: [Select]

; export911_1
code_0012: link $7
ldi $0
sat temp[$2]
ldi $0
sat temp[$1]
pushi $cd ; 205, setCursor
push1
lsg global[$14]
lag global[$1]
send $6

The decompiled snippet is:
Code: [Select]
(procedure (proc911_1 &tmp temp0 temp1 [temp2 5])
(= temp2 0)
(= temp1 0)
(gKq6 setCursor: gArrowCursor)

So it seems like problem is that Kq6::setCursor from Spanish-KQ6 is mapped to Kq6::addButton in English-Kq6.

Offline OmerMor

Re: Compilation error help
« Reply #4 on: February 27, 2016, 03:38:26 PM »
OK, it's not mapped to Kq6::addButton because there's no such method. It's probably just scummvm choking on this selector (0001:00cd).
I verified that in english kq6, Kq6::setCursor is located in [0c5] while in spanish kq6, Kq6::setCursor is located in [0cd] as expected.

So I guess for the 911.scr to be usable in english KQ6, it would have to be recompiled with this version.
I hope I'll manage to do that.

Offline OmerMor

Re: Compilation error help
« Reply #5 on: February 27, 2016, 03:58:57 PM »
Yay - success!  8) 8) 8)
I attached the debug script + fixed 921 (Print) script.
It is compatible with the English floppy version of King's Quest 6.

For extra credit, create an empty file named "g" in the game's folder.
When the game starts - enter one of these room number: {470, 480, 740, 750}. They all check for the existence of the "g" file, and give extra options.

Offline Kawa

Re: Compilation error help
« Reply #6 on: February 27, 2016, 04:05:45 PM »
lol "stud". I think the Carlosbashing in LSL6 was funnier for sheer scope but "where to stud" gets a good second place.

Offline MusicallyInspired

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #7 on: February 27, 2016, 04:58:12 PM »
Nice, Omer!!
Brass Lantern Prop Competition

Offline Collector

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #8 on: February 27, 2016, 05:00:55 PM »
I need to add 'magic' files to the Wiki's debug page.
KQII Remake Pic

Offline Collector

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #9 on: September 28, 2022, 10:35:08 PM »
Just revisiting this. I was just trying it and these files are ignored by Version 1.000, Interp. 1.001.054. The same with the CD version, both by ScummVM and DOSBox. What version did you try it on. I did not try it with any localized versions.
KQII Remake Pic

Offline MusicallyInspired

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #10 on: September 29, 2022, 03:51:49 PM »
Just revisiting this. I was just trying it and these files are ignored by Version 1.000, Interp. 1.001.054. The same with the CD version, both by ScummVM and DOSBox. What version did you try it on. I did not try it with any localized versions.

I found that KQ6 is checking for the existence of the file 911.SCR as a trigger for an internal debug menu:

...

However most KQ6 versions no longer contain script# 911. The only versions that still has it are the Spanish and Italian ones.
Brass Lantern Prop Competition

Offline Collector

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #11 on: September 30, 2022, 09:14:03 AM »
Yay - success!  8) 8) 8)
I attached the debug script + fixed 921 (Print) script.
It is compatible with the English floppy version of King's Quest 6
.

For extra credit, create an empty file named "g" in the game's folder.
When the game starts - enter one of these room number: {470, 480, 740, 750}. They all check for the existence of the "g" file, and give extra options.
KQII Remake Pic

Offline MusicallyInspired

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #12 on: September 30, 2022, 02:01:12 PM »
Quote from: Somebody somewhere probably who's 100% correct
Brandon is an idiot.
Brass Lantern Prop Competition

Offline doomlazer

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #13 on: September 30, 2022, 09:46:47 PM »
The 94 King's Quest Collector's Edition also still has the 911 debugger script, so I tried to get it working with the GOG and Steam versions. It's now partially functional, only requiring the 911.scr, 911.hep, and 911.txt files attached below.

While the "Where to, STUD?" is fine, the actual DebugHandler is still in assembly and not working. I changed the "debugHandler of Actions" to "debugHandler of Feature", which stops keypresses from crashing the game, but none of the ALT+'key' commands work at the moment. Should be easy enough to rewrite from scratch or copy/paste from another debugger.

Here is the edited script if anyone is curious. 
Code: [Select]
;;; Sierra Script 1.0 - (do not remove this comment)
(script# 911)
(include sci.sh)
(use Main)
(use Class_255_0)
(use n913)
(use Print)
(use DIcon)
(use DlgWindow)
(use Class_948_0)
(use Blk)
(use CueObj)
(use SysWindow)
(use Flags)
(use User)
(use Obj)

(public
debugHandler 0
proc911_1 1
)

(local
local0
local1
)
(procedure (proc911_1 &tmp temp0 temp1 [temp2 5])
(= temp2 0)
(= temp1 0)
;(gKq6 open: gArrowCursor)
(gKq6 setCursor: gArrowCursor)
(while
(not
(!=
(= temp1
;(Controls
(Print
font: global23
;advance: {Where to, STUD?}
addText: {Where to, STUD?}
;center: @temp2 5 80
addEdit: @temp2 5 80
;setCursor: 100 {______Opening________} 0 20  -change setCursor to addButton
addButton: 100 {______Opening________} 0 20
addButton: 200 { Isle of the Crown_} 101 20
addButton: 300 {__Isle Sacred Mtn__} 0 34
addButton: 405 {_____Labyrinth_____} 101 34
addButton: 450 {__Isle of Wonder___} 0 48
addButton: 500 {___Isle of Beast___} 101 48
addButton: 550 { Isle of the Mists_} 0 62
addButton: 600 { Realm of the Dead_} 101 62
addButton: 730 {__Castle - Beauty__} 0 76
addButton: 710 {Castle - Magic Door} 101 76
addButton: -100 {_____< Restore >_____} 0 90
addButton: 205 {_____Tutorial______} 101 90
;refresh:
init: ;not refresh
)
)
0
)
)
)
(if temp2 (= temp1 (ReadNumber @temp2)))
(if (== temp1 -100) (gKq6 restore:))
;global87 should be game speed; a var between 0 and 15, but this sets it much higher for some reason.
(if (< global87 100)
(= global87 (+ global87 temp1))
else
(= global87 (+ global87 1000))
)
;this seems to set 'isTeleporting' flag, but Proc999_5 doesn't evaluate the params correctly for this purpose.
(if (proc999_5 temp1 200 300 450 500 550)
(proc913_1 103) ;flag 103 'isTeleporting' according to the SCI decompile archive
)
;(global2 east: temp1)
(global2 newRoom: temp1)
)

(procedure (localproc_0161 param1 param2 &tmp [temp0 40])
(= temp0 0)
(if (> argc 1) (Format @temp0 911 0 param2))
(return
(if (proc921_2 @temp0 10 param1)
(ReadNumber @temp0)
else
-1
)
)
)

(procedure (localproc_019c)
(if (proc999_5 (global2 style?) 11 12 13 14)
(global2 sayNext: (global2 roomToEdge:) 100 style: 100)
)
)

;(instance debugHandler of Actions
(instance debugHandler of Code
(properties)

(method (handleEvent param1 &tmp [temp0 200] temp200 temp201 temp202 temp203 temp204 [temp205 4] temp209 temp210 temp211 temp212 temp213 temp214 temp215 temp216 temp217)
(asm
pushi    #type
pushi    0
lap      param1
send     4
push   
dup     
ldi      4
eq?     
bnt      code_0b20
pushi    #claimed
pushi    1
pushi    1
lap      param1
send     6
pushi    #message
pushi    0
lap      param1
send     4
push   
dup     
ldi      7680
eq?     
bnt      code_0386
pushi    #contains
pushi    0
lag      gNewEventHandler
send     4
sat      temp203
code_0208:
lat      temp203
bnt      code_0b1c
pushi    1
push   
callk    NodeValue,  2
sat      temp204
pushi    17
lea      @temp0
push   
lofsa    {name: %s\nclass: %s\nview: %d\nloop: %d\ncel: %d\nposn: %d %d %d\nheading: %d\npri: %d\nsignal: $%x\nscaleSignal: $%x\nscaleX: %d\nscaleY: %d\nillBits: $%x\n}
push   
pushi    #name
pushi    0
lat      temp204
send     4
push   
pushi    #name
pushi    0
pushi    #-super-
pushi    0
lat      temp204
send     4
send     4
push   
pushi    #view
pushi    0
lat      temp204
send     4
push   
pushi    #loop
pushi    0
lat      temp204
send     4
push   
pushi    #cel
pushi    0
lat      temp204
send     4
push   
pushi    #x
pushi    0
lat      temp204
send     4
push   
pushi    #y
pushi    0
lat      temp204
send     4
push   
pushi    #z
pushi    0
lat      temp204
send     4
push   
pushi    #heading
pushi    0
lat      temp204
send     4
push   
pushi    #priority
pushi    0
lat      temp204
send     4
push   
pushi    #signal
pushi    0
lat      temp204
send     4
push   
pushi    #scaleSignal
pushi    0
lat      temp204
send     4
push   
pushi    #scaleX
pushi    0
lat      temp204
send     4
push   
pushi    #scaleY
pushi    0
lat      temp204
send     4
push   
pushi    #-super-
pushi    0
lat      temp204
send     4
push   
class    User
eq?     
bt       code_02d4
pushi    #-super-
pushi    0
lat      temp204
send     4
push   
class    Blk
eq?     
bnt      code_02df
code_02d4:
pushi    #illegalBits
pushi    0
lat      temp204
send     4
jmp      code_02e1
code_02df:
ldi      65535
code_02e1:
push   
callk    Format,  34
pushi    #scaleSignal
pushi    0
lat      temp204
send     4
not     
bnt      code_0357
pushi    #addText
pushi    5
pushi    #view
pushi    0
lat      temp204
send     4
push   
pushi    #loop
pushi    0
lat      temp204
send     4
push   
pushi    #cel
pushi    0
lat      temp204
send     4
push   
pushi    0
pushi    0
pushi    30
pushi    1
lsg      global23
pushi    206
pushi    3
lea      @temp0
push   
pushi    3
pushi    #view
pushi    0
lat      temp204
send     4
push   
pushi    #loop
pushi    0
lat      temp204
send     4
push   
pushi    #cel
pushi    0
lat      temp204
send     4
push   
callk    CelWide,  6
push   
pushi    0
pushi    112
pushi    0
class    Print ;Controls
send     34
jmp      code_0372
code_0357:
pushi    #font
pushi    1
lsg      global23
pushi    206
pushi    3
lea      @temp0
push   
pushi    0
pushi    0
pushi    112
pushi    0
class    Print ;Controls
send     20
code_0372:
pushi    #next
pushi    1
lst      temp203
lag      gNewEventHandler
send     6
sat      temp203
jmp      code_0208
jmp      code_0b1c
code_0386:
dup     
ldi      12288
eq?     
bnt      code_03bc
pushi    #firstTrue
pushi    1
lsg      gEgo
lag      gNewEventHandler
send     6
sal      local1
bnt      code_03a3
pushi    #hide
pushi    0
lag      gEgo
send     4
code_03a3:
pushi    #doit
pushi    0
class    Class_948_1
send     4
lal      local1
bnt      code_0b1c
pushi    #curIcon
pushi    0
lag      gEgo
send     4
jmp      code_0b1c
code_03bc:
dup     
ldi      11776
eq?     
bnt      code_0420
pushi    0
call     localproc_019c,  0
pushi    1
pushi    4
callk    Show,  2
jmp      code_0b1c ;pushi    1  -Fixes Show Control command
pushi    #elements
pushi    0
lag      gNewEventHandler
send     4
push   
callk    Animate,  2
code_03de:
pushi    #cue
pushi    0
class    Event
send     4
sap      param1
pushi    #type
pushi    0
send     4
push   
ldi      1
eq?     
bt       code_0402
pushi    #type
pushi    0
lap      param1
send     4
push   
ldi      4
eq?     
bnt      code_0404
code_0402:
jmp      code_040e
code_0404:
pushi    #new
pushi    0
lap      param1
send     4
jmp      code_03de
code_040e:
pushi    #new
pushi    0
lap      param1
send     4
pushi    1
pushi    1
callk    Show,  2
jmp      code_0b1c
code_0420:
dup     
ldi      8192
eq?     
bnt      code_044c
lag      global14
not     
sag      global14
bnt      code_043d
pushi    1
lofsa    {On}
push   
calle    proc921_0,  2
jmp      code_0b1c
code_043d:
pushi    1
lofsa    {Off}
push   
calle    proc921_0,  2
jmp      code_0b1c
code_044c:
dup     
ldi      4608
eq?     
bnt      code_045e
pushi    #doit
pushi    0
class    Flags
send     4
jmp      code_0b1c
code_045e:
dup     
ldi      8448
eq?     
bnt      code_04b8
ldi      0
sat      temp209
pushi    1
lofsa    {Flag #:}
push   
calle    proc255_1,  2
sat      temp209
pushi    1
push   
calle    proc913_0,  2
bnt      code_049e
pushi    1
lofsa    {cleared}
push   
calle    proc921_0,  2
pushi    1
lst      temp209
calle    proc913_2,  2
jmp      code_0b1c
code_049e:
pushi    1
lofsa    {set}
push   
calle    proc921_0,  2
pushi    1
lst      temp209
calle    proc913_1,  2
jmp      code_0b1c
code_04b8:
dup     
ldi      8704
eq?     
bnt      code_0511
ldi      0
sat      temp0
pushi    3
lea      @temp0
push   
pushi    5
lofsa    {Variable No.}
push   
calle    proc921_2,  6
pushi    1
lea      @temp0
push   
callk    ReadNumber,  2
sat      temp203
not     
bnt      code_04e5
ret     
code_04e5:
ldi      0
sat      temp0
pushi    3
lea      @temp0
push   
pushi    5
lofsa    {Value}
push   
calle    proc921_2,  6
pushi    1
lea      @temp0
push   
callk    ReadNumber,  2
push   
lat      temp203
sagi     gEgo
ldi      0
sat      temp0
jmp      code_0b1c
code_0511:
dup     
ldi      5888
eq?     
bnt      code_0590
code_0518:
pushi    #font
pushi    1
lsg      global23
pushi    206
pushi    3
lofsa    {Enter Inv#:}
push   
pushi    0
pushi    0
pushi    208
pushi    3
lea      @temp0
push   
pushi    5
pushi    80
pushi    213
pushi    4
pushi    100
lofsa    {Outta here!}
push   
pushi    0
pushi    17
pushi    112
pushi    0
class    Print ;Controls
send     42
sat      temp203
push   
ldi      100
eq?     
bnt      code_055b
jmp      code_0b1c
code_055b:
lat      temp0
bnt      code_0579
pushi    1
lea      @temp0
push   
callk    ReadNumber,  2
sat      temp203
pushi    #get ;#lftBordColor
pushi    1
push   
lag      gEgo
send     6
ldi      0
sat      temp0
code_0579:
lst      temp203
ldi      20
eq?     
bnt      code_0518
pushi    1
pushi    1
callk    GetTime,  2
sag      global157
jmp      code_0518
jmp      code_0b1c
code_0590:
dup     
ldi      9472
eq?     
bnt      code_06f6
pushi    0
callk    GetPort,  0
sat      temp200
pushi    1
pushi    0
callk    SetPort,  2
ldi      5
sat      temp216
ldi      16
sat      temp217
ldi      15
sat      temp212
ldi      80
sat      temp213
lst      temp212
pushi    34
lat      temp216
mul     
add     
sat      temp215
lst      temp213
pushi    10
lat      temp217
mul     
add     
sat      temp214
pushi    6
pushi    7
lst      temp212
lst      temp213
lst      temp215
push   
pushi    1
callk    Graph,  12
sat      temp210
pushi    7
pushi    11
lst      temp212
lst      temp213
lst      temp215
lst      temp214
pushi    1
pushi    255
callk    Graph,  14
ldi      0
sat      temp211
code_0608:
lst      temp211
ldi      256
lt?     
bnt      code_067b
pushi    7
pushi    11
lst      temp212
lat      temp216
add     
push   
lst      temp216
lst      temp211
ldi      8
div     
mul     
add     
push   
lst      temp213
lat      temp217
add     
push   
pushi    16
lst      temp211
ldi      8
mod     
mul     
add     
push   
lst      temp212
lat      temp216
add     
push   
lat      temp216
add     
push   
lst      temp216
lst      temp211
ldi      8
div     
mul     
add     
push   
lst      temp213
lat      temp217
add     
push   
lat      temp217
add     
push   
lst      temp217
lst      temp211
ldi      8
mod     
mul     
add     
push   
pushi    1
lst      temp211
callk    Graph,  14
+at      temp211
jmp      code_0608
code_067b:
pushi    6
pushi    12
lst      temp212
lst      temp213
lst      temp215
lst      temp214
pushi    1
callk    Graph,  12
code_0690:
pushi    #cue
pushi    0
class    Event
send     4
sat      temp201
pushi    #type
pushi    0
send     4
push   
ldi      1
eq?     
bt       code_06b6
pushi    #type
pushi    0
lat      temp201
send     4
push   
ldi      4
eq?     
bnt      code_06b8
code_06b6:
jmp      code_06c3
code_06b8:
pushi    #new
pushi    0
lat      temp201
send     4
jmp      code_0690
code_06c3:
pushi    #new
pushi    0
lat      temp201
send     4
pushi    2
pushi    8
lst      temp210
callk    Graph,  4
pushi    6
pushi    12
lst      temp212
lst      temp213
lst      temp215
lst      temp214
pushi    1
callk    Graph,  12
pushi    1
lst      temp200
callk    SetPort,  2
jmp      code_0b1c
code_06f6:
dup     
ldi      12800
eq?     
bnt      code_0709
pushi    #west
pushi    0
lag      gKq6
send     4
jmp      code_0b1c
code_0709:
dup     
ldi      9728
eq?     
bnt      code_073e
pushi    1
pushi    1
callk    MemoryInfo,  2
push   
ldi      1536
ugt?   
bnt      code_072f
pushi    #doit
pushi    0
pushi    1
pushi    952
callk    ScriptID,  2
send     4
jmp      code_0b1c
code_072f:
pushi    1
lofsa    {No Memory!!}
push   
calle    proc921_0,  2
jmp      code_0b1c
code_073e:
dup     
ldi      6400
eq?     
bnt      code_0755
pushi    0
call     localproc_019c,  0
pushi    1
pushi    2
callk    Show,  2
jmp      code_0b1c
code_0755:
dup     
ldi      4096
eq?     
bnt      code_0788
pushi    #font
pushi    1
lsg      global23
pushi    207
pushi    3
lofsa    {Cur X: %d,Y: %d}
push   
pushi    #x
pushi    0
lap      param1
send     4
push   
pushi    #y
pushi    0
lap      param1
send     4
push   
pushi    112
pushi    0
class    Print ;Controls
send     20
jmp      code_0b1c
code_0788:
dup     
ldi      4864
eq?     
bnt      code_0850
pushi    30
pushi    1
lsg      global23
pushi    207
pushi    13
lofsa    {name: %s\nscript: %s\nhorizon: %d\nvanishingX: %d\nvanishingY: %d\npicAngle: %d\nnorth: %d\nsouth: %d\neast: %d\nwest: %d\nstyle: %d\ncurPic: %d_}
push   
pushi    #name
pushi    0
lag      global2
send     4
push   
pushi    1
pushi    #lastTicks
pushi    0
lag      global2
send     4
push   
callk    IsObject,  2
bnt      code_07ca
pushi    #name
pushi    0
pushi    #lastTicks
pushi    0
lag      global2
send     4
send     4
jmp      code_07cd
code_07ca:
lofsa    {none}
code_07cd:
push   
pushi    #close
pushi    0
lag      global2
send     4
push   
pushi    #vanishingX
pushi    0
lag      global2
send     4
push   
pushi    #vanishingY
pushi    0
lag      global2
send     4
push   
pushi    #oldIconBarState
pushi    0
lag      global2
send     4
push   
pushi    #setInset
pushi    0
lag      global2
send     4
push   
pushi    #oneOnly
pushi    0
lag      global2
send     4
push   
pushi    #disposeWhenDone
pushi    0
lag      global2
send     4
push   
pushi    #killed
pushi    0
lag      global2
send     4
push   
pushi    #style
pushi    0
lag      global2
send     4
push   
pushi    #overlay
pushi    0
lag      global2
send     4
push   
pushi    32
pushi    1
class    Window
push   
pushi    67
pushi    1
pushi    170
pushi    77
pushi    1
lofsa    {Current Room}
push   
pushi    112
pushi    0
class    Print ;Controls
send     58
jmp      code_0b1c
code_0850:
dup     
ldi      5120
eq?     
bnt      code_0860
pushi    0
call     proc911_1,  0
jmp      code_0b1c
code_0860:
dup     
ldi      7936
eq?     
bnt      code_0a01
pushi    #contains
pushi    0
lag      gNewEventHandler
send     4
sat      temp203
code_0873:
lat      temp203
bnt      code_0b1c
pushi    1
push   
callk    NodeValue,  2
sat      temp204
pushi    #signal
pushi    0
send     4
push   
ldi      4
and     
not     
bnt      code_09ed
pushi    #signal
pushi    0
lat      temp204
send     4
push   
ldi      128
and     
not     
bnt      code_09ed
pushi    14
lea      @temp0
push   
lofsa    {Updating cast members\nname: %s\nclass: %s\nview: %d\nloop: %d\ncel: %d\nposn: %d %d %d\nheading: %d\npri: %d\nsignal: $%x\nillBits: $%x\n}
push   
pushi    #name
pushi    0
lat      temp204
send     4
push   
pushi    #name
pushi    0
pushi    #-super-
pushi    0
lat      temp204
send     4
send     4
push   
pushi    #view
pushi    0
lat      temp204
send     4
push   
pushi    #loop
pushi    0
lat      temp204
send     4
push   
pushi    #cel
pushi    0
lat      temp204
send     4
push   
pushi    #x
pushi    0
lat      temp204
send     4
push   
pushi    #y
pushi    0
lat      temp204
send     4
push   
pushi    #z
pushi    0
lat      temp204
send     4
push   
pushi    #heading
pushi    0
lat      temp204
send     4
push   
pushi    #priority
pushi    0
lat      temp204
send     4
push   
pushi    #signal
pushi    0
lat      temp204
send     4
push   
pushi    #-super-
pushi    0
lat      temp204
send     4
push   
class    User
eq?     
bt       code_0941
pushi    #-super-
pushi    0
lat      temp204
send     4
push   
class    Blk
eq?     
bnt      code_094c
code_0941:
pushi    #illegalBits
pushi    0
lat      temp204
send     4
jmp      code_094e
code_094c:
ldi      65535
code_094e:
push   
callk    Format,  28
pushi    #scaleSignal
pushi    0
lat      temp204
send     4
not     
bnt      code_09cb
pushi    #addText
pushi    5
pushi    #view
pushi    0
lat      temp204
send     4
push   
pushi    #loop
pushi    0
lat      temp204
send     4
push   
pushi    #cel
pushi    0
lat      temp204
send     4
push   
pushi    0
pushi    0
pushi    30
pushi    1
lsg      global23
pushi    206
pushi    3
lea      @temp0
push   
pushi    3
pushi    #view
pushi    0
lat      temp204
send     4
push   
pushi    #loop
pushi    0
lat      temp204
send     4
push   
pushi    #cel
pushi    0
lat      temp204
send     4
push   
callk    CelWide,  6
push   
pushi    0
pushi    32
pushi    1
class    Window
push   
pushi    112
pushi    0
class    Print ;Controls
send     40
jmp      code_09ed
code_09cb:
pushi    #font
pushi    1
lsg      global23
pushi    206
pushi    3
lea      @temp0
push   
pushi    0
pushi    0
pushi    32
pushi    1
class    Window
push   
pushi    112
pushi    0
class    Print ;Controls
send     26
code_09ed:
pushi    #next
pushi    1
lst      temp203
lag      gNewEventHandler
send     6
sat      temp203
jmp      code_0873
jmp      code_0b1c
code_0a01:
dup     
ldi      5632
eq?     
bnt      code_0a14
pushi    #strPointer
pushi    0
lag      gKq6
send     4
jmp      code_0b1c
code_0a14:
dup     
ldi      12032
eq?     
bnt      code_0a25
pushi    1
pushi    1
callk    Show,  2
jmp      code_0b1c
code_0a25:
dup     
ldi      4352
eq?     
bnt      code_0a37
pushi    #doit
pushi    0
class    DlgWindow
send     4
jmp      code_0b1c
code_0a37:
dup     
ldi      5376
eq?     
bnt      code_0ae5
pushi    #font
pushi    1
lsg      global23
pushi    207
pushi    3
lofsa    {vanishing x: %d,y: %d}
push   
pushi    #vanishingX
pushi    0
lag      global2
send     4
push   
pushi    #vanishingY
pushi    0
lag      global2
send     4
push   
pushi    112
pushi    0
class    Print ;Controls
send     20
pushi    1
lofsa    {vanishingX:}
push   
call     localproc_0161,  2
sat      temp203
pushi    3
push   
pushi    65535
pushi    0
calle    proc999_5,  6
bt       code_0a8f
pushi    #vanishingX
pushi    1
lst      temp203
lag      global2
send     6
code_0a8f:
pushi    1
lofsa    {vanishingY:}
push   
call     localproc_0161,  2
sat      temp203
pushi    3
push   
pushi    65535
pushi    0
calle    proc999_5,  6
bt       code_0ab6
pushi    #vanishingY
pushi    1
lst      temp203
lag      global2
send     6
code_0ab6:
pushi    #font
pushi    1
lsg      global23
pushi    207
pushi    3
lofsa    {vanishing x: %d,y: %d}
push   
pushi    #vanishingX
pushi    0
lag      global2
send     4
push   
pushi    #vanishingY
pushi    0
lag      global2
send     4
push   
pushi    112
pushi    0
class    Print ;Controls
send     20
ldi      0
sat      temp0
jmp      code_0b1c
code_0ae5:
dup     
ldi      11264
eq?     
bnt      code_0af2
ldi      1
sag      global4
jmp      code_0b1c
code_0af2:
dup     
ldi      8960
eq?     
bnt      code_0b12
pushi    #font
pushi    1
lsg      global23
pushi    206
pushi    1
lofsa    {ALT-A show Cast\nALT-B Polygon Editor\nALT-C Control map\nALT-D DebugOn toggle\nALT-F Flag set/clr\nALT-G Global set\nALT-I Inv items\nALT-L Log file\nALT-M Memory\nALT-P Priority map\nALT-Q show Cursor Coords\nALT-R Room info\nALT-S Updating cast elements\nALT-T Teleport\nALT-U return User control\nALT-V Visual map\nALT-W feature Writer\nALT-Y Vanishing point adj\nALT-Z QUICK QUIT}
push   
pushi    112
pushi    0
class    Print ;Controls
send     16
jmp      code_0b1c
code_0b12:
pushi    #claimed
pushi    1
pushi    0
lap      param1
send     6
code_0b1c:
toss   
jmp      code_0c96
code_0b20:
dup     
ldi      1
eq?     
bnt      code_0c96
pushi    #modifiers
pushi    0
lap      param1
send     4
push   
ldi      4
eq?     
bnt      code_0bab
pushi    #claimed
pushi    1
pushi    1
lap      param1
send     6
code_0b3f:
pushi    2
pushi    #type
pushi    0
pushi    #cue
pushi    0
class    Event
send     4
sat      temp201
send     4
ne?     
bnt      code_0b9f
pushi    154
pushi    #view
pushi    #x
pushi    0
lat      temp201
send     4
push   
pushi    #y
pushi    0
lat      temp201
send     4
push   
ldi      10
sub     
push   
pushi    300
pushi    1
pushi    0
pushi    #rename
pushi    0
class    OnMeAndLowY
send     4
send     14
pushi    2
pushi    #elements
pushi    0
lag      gNewEventHandler
send     4
push   
pushi    0
callk    Animate,  4
pushi    #new
pushi    0
lat      temp201
send     4
jmp      code_0b3f
code_0b9f:
pushi    #new
pushi    0
lat      temp201
send     4
jmp      code_0c96
code_0bab:
pushi    #modifiers
pushi    0
lap      param1
send     4
push   
ldi      8
and     
bnt      code_0c96
pushi    #claimed
pushi    1
pushi    1
lap      param1
send     6
pushi    30
pushi    1
pushi    999
pushi    207
pushi    3
lofsa    {%d/%d}
push   
pushi    #x
pushi    0
lap      param1
send     4
push   
pushi    #y
pushi    0
lap      param1
send     4
push   
pushi    154
pushi    2
pushi    #x
pushi    0
lap      param1
send     4
push   
ldi      20
lt?     
bnt      code_0c03
pushi    #x
pushi    0
lap      param1
send     4
jmp      code_0c2b
code_0c03:
pushi    300
pushi    #x
pushi    0
lap      param1
send     4
lt?     
bnt      code_0c1f
pushi    #x
pushi    0
lap      param1
send     4
push   
ldi      40
sub     
jmp      code_0c2b
code_0c1f:
pushi    #x
pushi    0
lap      param1
send     4
push   
ldi      20
sub     
code_0c2b:
push   
pushi    #y
pushi    0
lap      param1
send     4
push   
ldi      16
lt?     
bnt      code_0c44
pushi    #y
pushi    0
lap      param1
send     4
jmp      code_0c50
code_0c44:
pushi    #y
pushi    0
lap      param1
send     4
push   
ldi      6
sub     
code_0c50:
push   
pushi    211
pushi    1
pushi    1
pushi    112
pushi    0
class    Print ;Controls
send     34
sat      temp200
code_0c63:
pushi    2
pushi    #type
pushi    0
pushi    #cue
pushi    0
class    Event
send     4
sat      temp201
send     4
ne?     
bnt      code_0c84
pushi    #new
pushi    0
lat      temp201
send     4
jmp      code_0c63
code_0c84:
pushi    #new
pushi    0
lat      temp201
send     4
pushi    #new
pushi    0
lat      temp200
send     4
code_0c96:
toss   
ret     
)
)
)

Edit: removed out-of-date attachment

« Last Edit: October 04, 2022, 05:16:31 PM by doomlazer »

Offline Collector

Re: King's Quest 6 Debug Mode (previous subject was: "Compilation error help")
« Reply #14 on: September 30, 2022, 11:15:21 PM »
EricOakford did a full decompilation of KQ6CD, I think with no assembly. https://github.com/EricOakford/SCI-Decompilation-Archive/tree/master/kq6cd/src It would be nice to get a full decompilation of the debugger script, too.
KQII Remake Pic


SMF 2.0.19 | SMF © 2021, Simple Machines
Simple Audio Video Embedder

Page created in 0.03 seconds with 19 queries.