Skip to content

Game analysis

Linkatplug edited this page Dec 5, 2026 · 1 revision

Game analysis: TUCKER.EXE and its files

🇺🇸 English · 🇫🇷 Français · Overview: technical documentation

Where this document comes from. It is the reverse-engineering notebook kept while studying the game, before and during the recompilation: disassembly of TUCKER.EXE (Ghidra, a home-made disassembler), reading the data files, comparison with the original game under DOSBox. It is published as is, with a few corrections. This is a translation of the French original (ANALYSE.md), which remains the reference.

  • When it talks about "the engine" (Bud's walk, x86 interpreter in Python, tucker/core/…), it means the tucker-viewer prototype, a Python reimplementation written first to understand the game. The current recompilation, on the other hand, runs the original code: it does not need to reproduce these behaviours, they come straight from TUCKER.EXE.
  • The addresses are those of the French version of the CD. The other versions have a TUCKER.EXE whose code is shifted (see technical documentation, § Versions).
  • The files cited in extracted\pe\ (disassembly, call graph, tools) are local working files, not published: they are derived from the game's executable.
  • No game code, image or sound is reproduced here: only addresses, formats, behaviours and short quotes of text, useful for interoperability and preservation.
  • Game text is quoted from the French version, with an English gloss.

The addresses are LE linear addresses: object 1 (code) is at 0x10000 and object 2 (data) at 0x40000. They are also the addresses of extracted\pe\TUCKER_flat.exe in Ghidra. Conventions: names in quotes ("loadFile") are mine. Arguments follow the Watcom convention EAX, EDX, EBX, ECX. Ghidra wrongly shows them as param_n and extraout_ECX.

1. CD contents

The CD (591 MB ISO image) holds 5,841 files, mostly in TUCKER\.

Ext. Count Role
WAV 4,758 voices SPEECH\SAM####.WAV (4,196), music MUSIC\, effects FX\
SPR 654 sprites SPRITES\A##_## (Bud), C##_## (characters), others
PCX 317 backgrounds, walk masks, interface: all 320×200, 8-bit
C 28 not C code: tables and text scripts (see §4.5)
FLC/FLR/PIC 16 intro animations (INTRO.EXE)
DIG 9 Miles AIL 3.02 sound drivers (SB, SB Pro, SB16, GUS…)
EXE 5 TUCKER.EXE (the game), INTRO.EXE, SETSOUND.EXE, INSTALL.EXE, DOS4GW.EXE
DTA/DAT/CFG/INI/TXT 7 CHARSIZE.DTA, TUCKER.CFG, DIG.INI, INFOBAR.TXT…

The main executable is TUCKER\TUCKER.EXE (284,677 bytes). TUCK.BAT and BUD.BAT start it after INTRO.EXE.

2. Binary format and REA/Ghidra setup

  • It starts with an MZ header whose e_lfanew is 0x2A50. At that offset is an LE (Linear Executable) header: 32-bit protected mode, started by the DOS/4GW extender. The compiler is Watcom C/C++32: the string "WATCOM C/C++32 Run-Time system … 1988-1994" follows the entry point.
  • The LE header describes 53 pages of 4 KB, with no name table and no debug info.
    • Object 1: code, base 0x10000, size 0x2DA9A, 32-bit.
    • Object 2: data, base 0x40000, size 0x12330. The stack is at the top of this object (ESP = obj2:0x12330).
    • Entry point: obj1:0x1E318, i.e. 0x2E318 (Watcom's _cstart_).
    • 8,389 relocations, all of type "internal 32-bit offset".
  • REA rejects the LE (unsupported LE executable in MZ image), even though Ghidra 12.2 is available in REA. So I wrote extracted\pe\outils\le2pe.py. It rebuilds the memory image, applies the relocations and wraps everything in a flat PE32. REA/Ghidra always load it at base 0x1000, so I placed the sections at RVA = LE base − 0x1000: Ghidra addresses are then equal to LE addresses.

3. Architecture

_cstart_ 0x2E318 ──► __CMain 0x37474 ──► main 0x12300 (EAX=argc, EDX=argv) ──► exit 0x28892
main 0x12300
 ├─ mouse(0) 0x113E0 ............. int386(0x33) fn 0: missing → "NO MOUSE DRIVER DETECTED"
 ├─ malloc(0x563650) 0x10010 ..... a single 5.6 MB block, split into ~18 fixed areas
 │                                 (+0x15E00 load buffer [0x46858], background buffers, sprites…)
 ├─ initSound 0x114D4 / timer 0x12274: AIL_register_timer(0x12250) + AIL_set_timer_frequency(46 Hz)
 ├─ getVideoMode 0x10098 ......... int386(0x10) AH=0Fh, stored in [0x4FD0C]
 ├─ initGame 0x12528 ............. tucker.cfg, infobar.txt, .enc/.c texts, nofiles.dta
 ├─ setVideoMode(0x13) 0x10064 ... int386(0x10) AH=0: VGA 320×200×256
 ├─ gameLoop 0x129DC
 └─ stop timer 0x122C8, restore video mode, stop sound 0x11598, free 0x10040

The game code spans roughly 0x10010–0x27200. Beyond that are the Watcom C library and Miles AIL 3.02. All the hard-coded int 21h (48 sites) and int 31h (DPMI, 30 sites) are in these libraries (addresses ≥ 0x27D98). The game code contains no int instruction: it goes through int386(n, &in, &out) at 0x27D03, which ends in the _DoINTR dispatcher (0x377CC, one int instruction for each of the 256 values), or through the C library.

Service Function Detail
Mouse int 33h 0x113E0(fn=EAX, &x=EDX, &y=EBX, &buttons=ECX) fn 0 = reset/detection, 3 = position+buttons, 4 = set cursor. 0x113A8 checks the 33h vector (int 21h AX=3533h).
Keyboard 0x10D30 → _bios_keybrd 0x28B43 (int 16h) returns the scancode (AX>>8)
Video int 10h 0x10064 (mode), 0x10098 (read mode)
VGA palette 0x10204 outp(0x3C6,0xFF), outp(0x3C8,i), outp(0x3C9,r/g/b)
Whole palette 0x10CCC 256 entries from R 0x46010, G 0x46210, B 0x46410
Fades 0x1053C (in), 0x1062C (out) ±5 per step and per component
Video memory 0xA0000 0x10D88 (display), 0x10820 (clear) copies 200 lines × 320 from a work buffer 640 px wide (pitch 0x280)
Rectangle copy 0x112DC, 0x1133C destination or source with pitch 640
RLE sprite 0x10F18(dst=EAX, src=EDX, w=EBX, h=ECX) see §4.4
Timer callback 0x12250 [0x46634]++ (frame pacing), [0x46804]++

Main loop 0x129DC

An inner loop runs once per logical "tick", and an outer loop handles rendering and input:

  1. Pacing: [0x46808] counts the ticks. After [0x4228C] ticks, the loop waits for the 46 Hz timer [0x46634] to catch up.
  2. Input: mouse 0x13560 (int 33h fn 3), scrolling and cursor.
  3. Logic:
    • opening fades ([0x4ECB8]);
    • cutscene script if [0x4FB34] (0x21BA8 then the interpreter 0x20A00);
    • Bud's animation 0x17B80, characters 0x19200 and 0x19100, objects 0x200E4 and 0x16C78;
    • location change 0x178C4 if [0x47A24] changed;
    • interface panel in mode 0x8C (game area 140 lines high).
  4. Rendering: copy of the background ([0x46890], animated image if [0x42290+loc*4] ≥ 4), objects 0x16DE0, sprites 0x1A4A8 into the 640 px buffer, cursor, texts, then 0x10D88 which sends it all to 0xA0000.
  5. Keyboard 0x10D30:
    • P (0x19) → pause (0x25CC0 and 0x25D20). It ends on a new press of P; keys 1 to 5 are read during it.
    • In debug mode ([0x46714] ≠ 0):
      • F1 "next location";
      • F2: displays;
      • F3 "object number";
      • F4: quit;
      • F5 to F10: force Bud's animation no. 1 to 6;
      • Esc: 0x2693C, then exit.
  6. Ends when [0x4681C] is 1 (quit) or [0x47990] is 1 (victory: congrat.pcx).

4. File loading and formats

4.1 Generic loading: loadFile 0x100CC (dest=EAX, level=EDX)

  • The name is prepared beforehand in the global buffer 0x41F68 by strcpy (0x27D1E). The digits in it are often rewritten byte by byte.
  • If level > [0x46718] (the first byte of tucker.cfg), the path is prefixed with the CD path [0x46720] = "X:\tucker", with X = tucker.cfg[1] + 0x40.
  • The function chains open(O_BINARY) 0x27D74, read 0x27FC2 (int 21h) and close 0x280D5. It returns the size read, also stored in [0x46614].
  • Writing is 0x10184(src=EAX, size=EDX).

4.2 PCX: loadPCX 0x10864 (dest=EAX, mode=EDX)

  • fopen(name,"rb"), then the 128 header bytes are skipped without being read. The format is ZSoft v5, 8-bit, 1 plane, always 320×200 (checked on all 317 PCX files).
  • PCX RLE: a byte ≥ 0xC0 gives n = byte − 0xC0 repetitions of the next byte, otherwise it is a literal pixel. Decoding stops at 64,001 bytes (0xFA01).
  • If mode ≠ 0: fseek(-768, SEEK_END), then 256 × 8-bit RGB are read and reduced to 6 bits (>>2) for the DAC in 0x46010/0x46210/0x46410. The 0x0C marker before the palette is ignored. With mode = 2, the sound is kept fed during the read (0x12208).
  • On failure: black screen, then "READ ERROR READING FILE:" followed by the name, then exit.

4.3 Backgrounds: 0x1383C and 0x13A28 (x=EAX, type=EDX)

  • [0x42290 + loc*4] gives the number of images of the location (1 to 4). The names are locNN.pcx or locNNa/b/c/d.pcx, plus the masks pathNN[a|b].pcx.
  • Each PCX is decoded into the load buffer, then copied line by line ([0x4FD04] = 140 lines, or 200 beyond location 0x48) into the 640 px work buffer [0x4685C] at x = 0 or 320. The path masks go to [0x4689C].
  • Each 320×140 panel (0xAF00 bytes) is then stored in [0x4688C] at positions +0, +0xAF00, +0x15E00 and +0x20D00. These are the images the loop alternates for animated backgrounds.
  • Role of the layers (checked in 0x1383C and 0x129DC):
    • 1 image: locNN.pcx + pathNN.pcx, 320 px room;
    • 2 images: a at x=0 and b at x=320, 640 px room, with pathNNa/b. Scrolling is only allowed in this case (0x19100);
    • 4 images (locations 15, 22, 40, 46, 52, 63, 64, 70): 320 px room; a counter 0..39 [0x4FCE0] picks image counter/10, so a→b→c→d every 10 frames;
    • no location has 3 images. LOC15.PCX exists next to LOC15A..D but is never loaded.
  • path mask: 0x17310(x, y) answers "walkable" if the mask byte is > 0, or if a script forces the walk ([0x4F050], [0x4FBA4]). In locations 0x1A and 0x20, it tests y−3.
    • Values 1, 2 and 255 are therefore equivalent for walking.
    • The 150 pixels at 255 in PATH09B.PCX (x 307–319, y 116–135) form a walkable strip on the right edge, with no special handling.
  • ROCHPATH.PCX (location 1 only) is loaded in place of the 3rd panel ([0x46800]). It is not used for Bud: 0x221A8 moves small creatures over its pixels > 0, trying 8 directions (0x2206C) and avoiding the other positions in 0x420E4…. The code never distinguishes 2 from 1.

4.4 Sprites (.SPR)

  • Loading Bud's animations: 0x19F98. For aLL_NN.spr (location LL, animation NN = 1..[0x44414+loc]), all the files are concatenated into [0x4ED14], with their offsets in 0x4ECC4[].
  • Characters use cLL_NN.spr.
  • The format was checked on all 654 files: 17,021 frames out of 17,022 decode exactly. The only exception is frame 19 of C24_09.SPR: a final transparent run overflows by 51 pixels (2,781 instead of 2,730) and spills 3 bytes into the next frame. It has no visible effect.
uint32  frameCount
uint32  offset[frameCount]        ; from the start of the file, offset[0] = 4 + 4*n
for each frame, at offset[i]:
  +0  uint16 width   (w)
  +2  uint16 height  (h)
  +4  int16  ax      ; offset from the animation's anchor point: IGNORED by the engine
  +6  int16  ay      ; same, IGNORED
  +8  int16  x       ; absolute position of the top-left corner (0..319, or x in the 640 px room)
  +10 int16  y       ; absolute position of the top-left corner (0..199)
  +12 RLE data:  0x00, n  → n transparent pixels
                 other b  → 1 pixel of colour b
  • Role of the 4 fields (checked):
    • The engine reads x/y (+8/+10) only in the two drawing routines.
    • 0x1A4A8 (characters, cLL_NN.spr): destination = y*640 + x + 0x4F1A8[i], where 0x4F1A8[i] is a per-character offset, advanced on each frame by 0x4F228[i] (speed). Clipping takes the scroll [0x46854] into account.
    • 0x1A0A4 (Bud's special animations, aLL_NN.spr): destination = [0x4685C] + y*640 + x + [0x4ED24]. 320 is added if Bud is in the right half, plus three hard-coded corrections: location 0x1D, location 0x3A and location 0x16 (for the latter, y += [0x4B558]).
    • ax/ay (+4/+6) are read into local variables ([ebp-0x10]/[ebp-0xC] in 0x1A0A4, [ebp-0x20]/[ebp-0x1C] in 0x1A4A8) and then never read again. No other code reads bytes +4..+7.
    • Check against the data: in the 455 files where ax/ay are not zero, (x − ax, y − ay) is constant over every frame of the file. They are therefore offsets from an anchor point specific to the animation, left by the cutting tool, and the engine uses the absolute positions directly.
    • No collision box is stored in the SPR files. Clickable areas come from CHARPOS.C and DATA4.C.
    • Across the 17,022 frames, x + w ≤ 320 and y + h ≤ 200.
  • Display: 0x10F18(dst, src = frame + 12, w, h) as a plain copy. The variant 0x11038 is used if 0x4F94C[i] == 99, and the mirrored version 0x11168 otherwise (flip 0x4F96C[i]).
  • Bud's walk does not use SPR files. It cuts rectangles out of bud_N.pcx, peg_N.pcx or mac_N.pcx, described by CTABLE01.C (see 4.9). 0x17B80 is Bud's state machine: direction, CTABLE sequence or special animation.

4.5 Text files (.C and .ENC)

  • For each file, the game first tries xxx.enc, then xxx.c. Decoding 0x124E0(buf=EAX, len=EDX) subtracts 0x80 from each byte if [0x41FBC] is set. The French CD only has .c files, so plain text; the English, German and Spanish versions ship .enc files (same text, each byte + 0x80).
  • Common structure:
    • !!NN sections (location number), found by 0x15ED8;
    • dw a,b,c,… lines, found by 0x15F70, which searches for "dw" up to 110,000 bytes;
    • fixed-width decimal numbers read by 0x15DC0(buf=EAX, offset=EDX, digitCount=BX). The function reads exactly 2, 3 or 4 characters:
      • a - gives −1;
      • a space in the last position counts as 9;
      • a result outside 0..10000 gives −2.
    • The loaders advance by a fixed number of characters (width + 1) without looking at the separator. ,, -, . or ; are therefore equivalent: the file contains dw 04-178,040 or bus,014;wa+;. A modern parser must read by fixed columns, not with split(',').
    • Everything after the last field read is ignored (; and // comments, free text).
    • The text is in CP437 (é = 0x82, à = 0x85…).

Loaders, found through the references to the file names:

File Loader Contents
INFOBAR.TXT, DATA5.C, BGTEXT.C, CHARNAME.C, CSDATA.C 0x12528 (init) loaded raw into memory
OBJTXTn.C, PTnTEXT.C 0x12858 texts of part n (the digit is replaced in the name)
DATA.C 0x16654 rectangles of the scenery objects in scrobjNN.pcx
DATA3.C 0x168F4 pick-up objects per location
DATA4.C 0x15FDC clickable areas without an object, and exits
CTABLE01.C 0x17690 rectangles of Bud's frames in bud/peg/mac_N.pcx
CTABLE02.C 0x17A00 Bud's standard animation sequences
ACTION1/2/3.C 0x18594 "verb + target → result" rules
CHARPOS.C 0x20354 characters per location, plus their animation lists
FX.C (named fx.enc) 0x2578C per-location sound ambience
CHARSIZE.DTA 0x270EC 256 character widths, into 0x42408[]
CREDITS.TXT 0x2693C credits
  • Files not referenced by the executable: ACTION.C, DATA2.C, EXIT.C, COMMON.C, PT1.C, TEST.C, OBJTXT.C, CSDATA1.C. They are development leftovers or earlier versions. The engine only loads csdata.c.
  • Free-text files, one entry per \r\n line: 0x140A4(n, buf) returns the start of the n-th line. Lines of dialogue are located by tpo (base) + number (see 4.8). The matching voice is SPEECH\SAMxxxx.WAV, with xxxx = (part−1)*3000 + base + n − 1.
  • INFOBAR.TXT holds the verbs of the bar (in the French version: Aller, Regarder, Parler, Ouvrir, Fermer, Donner, Prendre, Déplacer, Utiliser, "avec", "à" = Go, Look, Talk, Open, Close, Give, Take, Move, Use, "with", "to"), followed by the location names.
  • The cutscene interpreter is 0x20A00 (see 4.8). 0x21BA8 finds the !!NN table, advances to the n-th dw line (n = [0x4FB34]), then calls 0x20A00 as long as it returns 0. It prints "Table not found", "dw not found" or "Instruction not recognised" on error.

4.6 Saved games: 0x25424 (slot=EAX)

  • savegm.NN is 2,000 bytes, i.e. 500 dwords:
    • [0..299]: game flags 0x47800[300];
    • [300..339]: copy of 0x4B5E8 (40 dwords);
    • [340..459]: copy of 0x4B3C8 (120 dwords);
    • +0x730: location number [0x4680C];
    • +0x734 and +0x738: Bud's position [0x43F0C] and [0x43F10];
    • +0x73C and +0x740: [0x4B688].
  • nofiles.dta is 10 bytes: byte 0 is the highest save number, byte 4 the last one used.
  • Loading 0x255D0 then 0x2572E: flags, inventory, object state, location [0x468C8] and Bud's position, then the location is loaded. The format is reused as is by tucker/core/savegame.py, and the files stay readable by the game under DOS.
  • Menu: click on inventory object 30 (0x15C56, [0x468D4] = 2), then LOAD / SAVE / play / QUIT (CHARGER / SAUVEGARDER / jouer / QUITTER in the French version) and choice of the number (mode 3, 0x1524C). Detail of the areas in tucker/core/savemenu.py.

4.7 Sound

  • Voices: 0x11F64(n=EAX). The file is X:\tucker\speech\samNNNN.wav, where X is the CD drive and NNNN is written at positions 0x14 to 0x17. It is opened in binary mode, its WAV header is read, then it is streamed by AIL.
  • Music music\musN.wav (0x11AE8), effects fx\fxN.wav (0x11784), driver chosen in DIG.INI (Miles AIL 3.02). AIL volumes from 0 to 127.
  • FX.C, read by 0x2578E on each location change. Section !!NN, first dw line:
    • count(2), then count entries fx(3) volume(3) type(2) into 0x46CE4, 0x46D5C, 0x46DD4, plus fields depending on the type:
      • type 5: x(3) slope(3) into 0x46838, 0x4683C (the slot is noted in 0x46830);
      • types 6 and 8: anim(2) frame(3) source(2) into 0x46F3C, 0x46FB4, 0x46EC4;
      • type 7: like 6, then flag(3) value(2) anim2(2) frame2(3) value2(2) into 0x4702C, 0x470A4, 0x47194, 0x4711C, 0x4720C.
    • Between two entries, control characters are skipped (0x25AA4): the list can continue on the following lines (location 40: 26 effects over 13 lines).
    • Type 8: no file; the slot reuses the sound of slot number fx, already loaded, then becomes type 6.
    • Next dw line (0x25B56), music: count(2), then count entries flag(3) value(2) music(3) volume(3) type(2). Only those where 0x47800[flag] == value are loaded, into 0x47288, 0x47298, 0x472A8 (count in 0x47284). Example in location 2: mus9 once while flag 195 is 0, then mus51 looping.
    • Data errors kept as they are: location 40, slot 12 of type 8 pointing to slot 16, not loaded yet; location 68, ///122; fx226.wav missing (location 54).
  • Effect types:
    • playback 0x118B0(sound, slot, volume): looped for types 2, 5 and 7 (type of the slot played), once otherwise;
    • on arrival (0x25D20, first 29 slots): types 1, 2, 5, and 7 if flag == value; then the loaded music with type > 0 (0x11C14, looped if type 2);
    • types 3 and 4, on each tick (0x25E28), if slot 0 is not playing ([0x46644]): each type 3 (or 4) effect plays in slot 0 if rand() > 0x7E2C (or > 0x7FFB), only one per tick. These draws use the same rand() as the characters;
    • type 5, on each tick (0x25EEC): volume = volume − |Bud's x − x| × slope / 10, at least 0;
    • types 6 and 7: sound tied to an animation frame. Source 0: Bud's special animation ([0x4ED18] = number, [0x4ED1C] = frame, 0x25F74); source 1: any character (0x4F104[j] = state, 0x4F144[j] = frame, 0x260C4). Type 7 sets flag := value when the sound starts, and on (anim2, frame2) sets flag := value2 and stops it (location 8: fx186 looping until frame 22 of special animation 2). The EXE restarts the sound on every tick while the frame stays on screen; the engine only triggers it once per arrival on the frame;
    • type 0: played only on request (fx,NN in scripts, fx column of ACTIONn.C).
  • Location change: 0x25CC0 stops all the effects (0x11614) and all the music (0x115DC).
  • Order within a tick: characters (0x200E4), character sounds (0x260C4), camera (0x19100), Bud's sounds (0x25F74), …, random ambience (0x25E28), type 5 volume (0x25EEC).

4.8 Cutscene instruction set (CSDATA.C, 0x20A00)

Mechanism:

  • Decoding tests P[0], then P[1] or P[2], against the letter table 0x44790 (a b c d e f g h l m n o p r s t v w x +).
  • N is a character digit (0 to 5), NNN a 3-digit number, NN a 2-digit number. The width is imposed by how far the pointer [0x4FB40] advances.
  • Return code:
    • 0: next instruction in the same tick;
    • 1: yields until the next tick, or until the wait is over;
    • 2: end;
    • 3: jump (sse).
Instr. Format Effect Var.
pan pan,NN interface panel mode (00 = bar hidden during the scene) 0x468D4, 0x468D8=1
bua bua,NNN Bud plays special animation NNN (aLL_NNN.spr) from the 1st frame 0x4ED18
bub bub,NNN Bud plays standard sequence NNN of CTABLE02 0x4D7D4=0x4CE04[NNN]
buc buc,NNN plays list NNN (counted from 0) of Bud's lists in CHARPOS: 1st number = aLL_NN.spr file, then the frames (from 1), 99 = end 0x2084C
b?d bsd,NN (bcd) Bud's direction: 1 = frame 0x11, 2 = 0x10, 4 = 0xF, other = 0x10 mirrored 0x4D7D8
bof / bon — hides / shows Bud again 0x4FB48=1/0
buh buh,NN if ≠ 0, freezes the special animation 0x4FCE8
bso bso,NNN X offset of the special animation (used by 0x1A0A4) 0x4ED24
bus bus,NNN Bud says line tpo+NNN−1 of PTnTEXT.C (colour 1); voice samMMMM.wav with MMMM = (part−1)·3000 + tpo + NNN − 1; bubble at (xBud, yBud−64) 0x11F64, 0x4EC98 (duration)
buv buv,NNN volume of Bud's voice (127 by default, 2nd argument of 0x11F64) 0x4214C
buw buw,XXX,YYY Bud walks to (X,Y) 0x4B564/68, 0x4B56C=1
bux bux,XXX,YYY puts Bud at (X,Y) without walking 0x43F0C/10
cNa c0a,NNN character N: animation list NNN, 999 = none (−1). Without cNa, the active list is set by the per-location code (0x1A78F…) 0x4F104[N]
cNc c0c,NNN character N: restarts its animation list (CHARPOS, ended by 99) 0x208B8
cNs c0s,NNN character N says line tpo+NNN−1, in colour 0xB5+N; bubble at ssp, or at sNp if [0x4FBA8] ≠ 0 0x4FBEC, 0x4FBF0=N
cNv c0v,NNN volume of character N's voice 0x42150[N]
end — end of the script returns 2
fad fad,NN fade counter: 20 = fade to black in 14 steps, 00 = opening fade (see 4.18) 0x4ECB8
fx fx,NN plays slot NN (counted from 0) of the location's FX.C list: fxF.wav, F = 0x46CE4[NN] 0x118B0, 0x4FD08
flx flx,NN effect NN looped (type 2) 0x46DD4[NN]=2
f?x fsx,NN stops effect NN if it is playing 0x11614
fm — makes the inventory flash 0x4FBE0=50
fw fw,NN Bud goes to area NN of the location (0x14798); if it is an exit, he takes it 0x477F8
gfg gfg,NNN,VV game flag [NNN] = VV (300 flags, saved) 0x47800[]
gv gv,NN chains CTABLE02 sequence NN at the end of the current sequence 0x467DC
loc loc,NN changes location on the next tick; the script continues in the new location (loading 0x136DC does not reset [0x4FB34] to 0), e.g. bof,loc,70 then loc,36,bon,… 0x468C8, returns 1
ofg ofg,NNN,VV VV ≠ 0: adds object NNN to the inventory (0x16F94); VV = 0: removes it (0x17008) 0x4B5E8[]
opt opt,NN,{TTT,EEE}×NN dialogue menu: NN choices; text = line tpo+TTT−1; leads to dw entry EEE (counted from 1) 0x4FB64/68/84
opf opf,NN,{FFF,VV,TTT,EEE}×NN same, but a choice only appears if flag FFF equals VV same
sse sse,NNN jumps to dw entry NNN of the current table 0x4FB34, returns 3
ssp ssp,XXX,YYY bubble position for all characters 0x4FB5C/60
sNp s0p,XXX,YYY bubble position for character N 0x4FBAC/C4[N]
sp — special pose of Bud: while his sequence has 2 parts, a counter goes up to 121, then back to 0, and picks frames 0x77 to 0x7A by direction (0x17B80) 0x467D4=1
s?c — 0x4F2E8=0; never used —
tpo tpo,NNNN base for lines of dialogue (line number in PTnTEXT) 0x4FCD0
wa+ — waits for the end of the line, then 20 ticks 0x4FB4C, 0x4FB44=20
was — waits for the end of the line 0x4FB4C
wat wat,NNN waits NNN ticks 0x4FB44
wsm — waits until Bud has finished walking 0x4FBA0
wfx — waits for the end of the last slot played by fx ([0x4FD08]) 0x467D8
wNa/wba — waits for the end of the animation of character N or of Bud. The pointer does not advance, so the instruction is unusable and absent from the data 0x4FB54
xhr / xhm — camera follows Bud (scroll = xBud − 200) / normal camera 0x4FCE4

Frequencies found in CSDATA.C (42 different mnemonics): wa+ 1,866, bus 1,054, c0s 796, sse 271, was 247, c1s 174, gfg 147, opt 146, wat 124… All these instructions are covered by the table.

Anomalies in the data:

  • CSDATA.C line 500 contains bud,004. The name is recognised as b?d, but the argument has 3 digits instead of 2: the pointer lands on , and the engine prints "Instruction not recognised".
  • CSDATA1.C, not loaded, also contains c0+ and cos.
  • A modern engine must report these cases without crashing.

4.9 Structure of the !!NN tables (widths in digits)

  • DATA.C (!!NN = number of scrobjNN.pcx): id(3) xs(3) ys(3) w(3) h(3) xd(3) yd(3).
    • Destinations: 0x4AB94[id] = ys*320+xs, 0x49424 = w, 0x49BF4 = h, 0x48484 = xd, 0x48C54 = yd.
    • The two trailing 0 are ignored.
  • DATA3.C (!!NN = location): graphic(3) sequence(3) takeable(2) inventoryNo(2) flag(3) value(2) textNo(3) xStand(3) yStand(3).
    • Destinations: 0x474D4, local, 0x475C4, 0x47614, 0x47664, 0x476B4, 0x4B378, 0x47758, 0x477A8.
    • The sequence (0 = none) refers to a run of the EXE's animation table 0x4260C (§4.11). The code handles neither flipping nor the value 999: the file's comment "High=Flip, Low=Seq" matches nothing in the EXE.
    • "At most 19 objects": the loader stops when the index reaches 0x13 (0x16B8A).
    • Mistyped lines (w 220,…, d 007,…) are skipped, because 0x15F70 looks for "dw".
  • DATA4.C:
    • Header: dw NN,NN, into 0x46714 and 0x46798.
    • Then, per location, up to 10 areas ended by dw -1: x(3) y(3) w(3) h(3) xStand(3) yStand(3) textNo(3) cursor(2) destLoc(2) x1(3) y1(3) x2(3) y2(3) xWalk2(3) ?(3).
    • 10-entry arrays, from 0x472F4 to 0x474AC.
  • CTABLE01.C (!!00):
    • dw 999,file,loc selects the bud_N.pcx sheet;
    • then xs(3) ys(3) w(3) h(3) xOff(3) yOff(3), into 0x4B694 = ys*320+xs, 0x4B9B4, 0x4BCD4, 0x4BFF4, 0x4C314. A value > 300 means value − 500.
  • CTABLE02.C (no section, one line per sequence):
    • partCount(2) rotation(2) loc(2), then the frame numbers in 4 columns, ended by 999;
    • destinations: 0x4D124, 0x4D444, then the list 0x4C634[]; the start of each sequence is in 0x4CE04[seq].
  • ACTION1/2/3.C (!!NN = location), in two parts:
    • key: verb(2) targetType1(2) target1(3) targetType2(2) target2(3), encoded as type*1000 + no;
    • result: flag1(3) val1(2) flag2(3) val2(2) budSeq(3) ?(2) line(3) duration(2) flagToSet(3) value(2) fx(2) fxDelay(2), into 0x4D9A4 … 0x4EAD4 (100-entry arrays).
  • CHARPOS.C (!!NN = location):
    • up to 8 characters: x(3) y(3) w(3) h(3) xWalk(3) yWalk(3) flag(3) value(2) direction(2) nameNo(3) descriptionNo(2), into 0x4F9D0 … 0x4FB10;
    • then two blocks of animation lists, each ended by dw -1 (loader 0x20354):
      • Bud's special animations go, flattened, into 0x4ED2C[] (one list per line, end = 99);
      • the characters' ones go into 0x4F2EC[]. A line ends with 99 (end of list) or with 98, which means "the list continues on the next line": the 98 is overwritten (index decremented), then reading resumes at the next dw line. Example: the dentist in location 13 has a 91-frame list over 4 lines.
      • List format: nSPR, frame1, frame2, …, with frame numbers counted from 1.
  • FX.C (!!NN = location): see §4.7 (read by 0x2578E).

4.10 Interface: panel, verbs, font, sentence

  • Font:
    • 0x13FC0 cuts CHARSET.PCX into 10×10 cells (32 per row, 7 rows, codes 0x20..0xFF in CP437 order: é = 0x82, à = 0x85, ç = 0x87…). Each glyph is compressed (0x10DF0) into [0x46868], with the offsets in 0x468DC[].
    • Drawing a character 0x141B0(dst, code, pitch, colour): 0 = transparent, 0x80 = outline kept as is, any other value takes the requested colour.
    • 0x14384 draws a line of text advancing by width[code]. CHARSIZE.DTA contains 256 2-digit widths, read by 0x270EC into 0x42408[]; 0x14144 measures a line.
  • Panel: 0x13BCC loads PANEL1.PCX (written verbs) if [0x468D0] = 0, otherwise PANEL2.PCX (icons). Initialisation (0x12554) sets [0x468D0] to 1: the game therefore starts with the icons. F1 (code 0x3B, 0x18FED) toggles between the two. 0x13D8C fills the 320×60 bar [0x46864], displayed at y = 140, according to the pan mode [0x468D4]:
    • 0: lines 0..49 to 10..59, then the inventory (0x1716C);
    • 1: lines 51..110 to 0..59;
    • 2: like 1, plus lines 172..187 to 20..35 (LOAD / SAVE / PLAY / QUIT);
    • 3: lines 110..169 to 0..59 (OK / CANCEL).
  • Verb under the mouse (0x15A14, screen coordinates):
    • y < 150: 0 (Go); x > 195: 1;
    • with PANEL1, ((y−150) div 17)·3 + x div 67, which gives the grid Go to / Look / Talk to // Open / Close / Give // Take / Move / Use;
    • PANEL2 has irregular areas.
  • Sentence (0x14404) on lines 0..9 of the bar, colour 1:
    • verb = line verb+1 of INFOBAR.TXT;
    • then the object name = line n+1 of the file chosen by [0x472DC]: 0 = DATA5.C (DATA4 areas), 1 = BGTEXT.C (scenery objects), 2 = CHARNAME.C (characters), 3 = OBJTXTn.C (inventory);
    • where relevant, "with" or "to" (line 11, or line 12 for Give), then the second object;
    • words 4 px apart, the whole centred: x = 0x9F − width/2.

4.11 Scenery objects and inventory

  • Game part [0x46814] (0x12858):
    • locations 1–23 → 1;
    • 24–40, 70–72 and 79–82 → 2;
    • 41–69 and 73–78 → 3.
    • It selects the DATA.C sections, the OBJTXTn.C, PTnTEXT.C and PANOBJSn.PCX files, and the base of the object descriptions [0x4FD00] (0xA4F, 0xA77 or 0xA9F).
  • DATA.C (0x16654):
    • sections !!P0, !!P1… read up to the first missing one; section k describes the scrobjPk.pcx sheet;
    • the id is global to the part, and 0x4A3C4[id] gives its sheet;
    • 0x16598 recompresses each rectangle as RLE (0 = transparent).
  • Starting inventory (0x2624C, on each part change 0x128EF): if flag 219 is 1 (new game 0x1280E, or gfg,219,01 in scripts), it resets it to 0, empties the inventory and 0x4B3C8[0..49], gives the floppy disk (object 30), then in part 1 or 3 the map (1) and the matches (0). A new game also sets flag 105 to 1.
  • Visibility (0x16BA8):
    • hidden if flag > 0 and flags[flag] ≠ value;
    • otherwise, a takeable object is only visible if 0x4B3C8[inventoryNo] = 0;
    • otherwise visible.
  • Animation (0x16C78, once per pass through the loop):
    • the EXE table 0x4260C contains 169 runs ended by 999 (1,323 dwords);
    • on each tick, the position advances by 1 and goes back to the start after the end;
    • the value 998, f, v does flags[f] = v, goes back to the start and hides the object;
    • any other value read becomes the object's graphic.
  • Drawing (0x16DE0): transparent copy into the room (pitch 640) at (xdest, ydest), after the background and before the characters.
  • Hover (0x16450):
    • objects are tested from last to first;
    • if the mouse is inside the rectangle of a visible object, its text number is returned (BGTEXT.C, line n+1);
    • an object with text 0 stops the search among objects, but the DATA4 areas are still tested.
    • Full order in 0x15670: characters 0x206DC, objects 0x16450, areas 0x1631C, inventory 0x15BA0.
  • Verb rules (0x15670):
    • the right button moves to the next verb (0..8) and locks it; otherwise the verb follows the mouse (0x15A14);
    • "Talk" only accepts characters; "Give" only accepts the inventory for the first object;
    • verb not locked and mouse over a character (except no. 0x15) → "Talk";
    • in location 63, "Go" becomes "Use".
  • Inventory:
    • list 0x4B5E8, count 0x4B688, scroll 0x4B68C (a word) in steps of 3. The arrows are at x 200–211: click up if y < 175, down otherwise;
    • at the start: object 30 (the options floppy disk), plus objects 1 and 0 in part 3 (0x2629D);
    • 32×24 icons in PANOBJSn.PCX, 10 per row (0x16EB4);
    • 2 × 3 slots drawn at (212 + 34c, 150 + 26r) (0x1716C); the clickable area has a 36 × 25 pitch (0x15BA0).
  • "Look" (0x18920, 0x150F0): the line is spoken by Bud, and its voice has the same number.
    • DATA4 area: line 0x749 + textNo. If that line starts with *E, *M or *R, Bud says a generic line 0x749 + 0x106 (resp. 0x10C, 0x119) + k, with a shared counter 0x47B20 (1..6 or 1..10).
    • Takeable object or inventory object: [0x4FD00] + inventoryNo.
    • Character: 0x87F + CHARPOS description number (0 = no line).
    • Other cases: ACTIONn.C table.

4.12 Speech bubbles, voices and dialogue menu

  • Voice 0x11F64(n, volume): speech\samNNNN.wav. The bubble lasts [0x4EC98] = [0x420E0] = 1 tick, extended while the voice is playing (0x19056 → 0x12208).
  • Line breaking 0x19C8C(text, start, maxWidth):
    • characters are added while width ≤ max, and each space remembers (count, width);
    • CR or LF ends the text;
    • if the text overflows, it is cut at the last space, and the next line starts after it.
  • Placement 0x19D74(x, y, text, colour):
    • max width = 2·min(x − scroll, scroll + 320 − x), replaced by 220 outside [150, 180];
    • at most 4 lines, each centred on x and clamped to the screen; if 10·count > y, then y = 10·count; line i is at y − 10·(count − i);
    • colours: 1 for Bud, 0xB5 + N for character N.
  • Dialogue menu 0x21EB4, active when [0x4FB64] > 0:
    • drawn on the bar, after the panel copy;
    • choices from y = 141, x = 0, max width 319, lines going down;
    • colour 0x6C, and 0x6A for the hovered choice;
    • a click jumps to entry 0x4FB84[i] (0x21DFB).

4.13 Bud

  • CTABLE01.C (0x176A0, section !!00): 172 frames. dw 999,FF,LL opens the bud_FF.pcx sheet.
  • CTABLE02.C (0x17A00): frame numbers read as 3 digits every 5 characters. The few truncated lines of the file give −2 values.
    • Base sequences: 0 walk right, 1 stand right, 2 walk up, 3 stand back, 4 walk down, 5 stand front.
    • Left is right mirrored ([0x4D7F0]).
  • Drawing 0x12E74 → 0x11168:
    • position x + xOff − 14, or mirrored x − w − xOff + 14; line y − 54 + yOff (+ [0x4B558]); two frames stacked for 2-part sequences;
    • a pixel is not written if the background under it is ≥ 0xF8, nor if it is ≥ 0xE0 on lines where line + yOff ≥ 0x442D4[loc] (Bud's top goes in front, his bottom behind; test at 0x11293) (60 in locations 2, 3, 9, 16, 18, 51, 54; 28 in location 1; 48 in location 64);
    • the high colours of the palette therefore act as a depth layer.
  • Pose when Bud is not walking (0x17B80): [0x4D7E4] is 0 when stopped, 1..4 while walking, 5 during an action, 6 when Bud talks; the orientation is [0x4D7D8] (1 up, 2 right, 3 left, 4 down). The pose is chosen again when [0x4D7E4] changes or when the sequence ends (999). [0x4D7DC] is 1 during a CSDATA script (0x21CB6, reset to 0 at 0x21E80):
    • stopped outside a script, random front pose: rand() < 2000 → 0xD; otherwise rand() < 3000 → 0xE (0x12 in location 57); otherwise rand() < 20000 → 0x12; otherwise 6. Checked under DOSBox: Bud turns to face the player as soon as he stops, even after walking in profile;
    • stopped within a script, pose by orientation: 3 (up), 1 (right), 1 mirrored (left), 5 (down);
    • when Bud talks: 0xF outside a script; within a script 0x11 (up), 0x10 (right), 0xF (down), 0x10 mirrored (left).
  • The original walk (0x17B80: speeds, choice of direction, detours) is not reproduced. The engine runs a breadth-first path search on the mask (2 px grid, no corner cutting), smooths it with lines of sight, then Bud follows the segments (at most 4 px in x and 2 px in y per tick).

4.14 Actions (ACTIONn.C), exits, Bud's special animations

  • Camera (0x19100, called every frame at 0x12B8D; scroll [0x46854], reset to 0 on entering a location at 0x194FF):

    • single-background room (0x42290[loc] ≠ 2): scroll 0;
    • xhr ([0x4FCE4] = 1): scroll = Bud's x − 200, unclamped;
    • location 16 with special animation 6: +1 px per frame while scroll + 200 < x, at most 320;
    • otherwise dead zone: if scroll + 120 > x, scroll = x − 120 (at least 0); if scroll + 200 < x, scroll = x − 200 (at most 320). The adjustment is immediate. Example checked under DOSBox: arrival in location 3 at x = 496, scroll 296.
  • Loading 0x18594: ACTIONn.C (n = part), section !!LL of the location, at most 100 lines, into the arrays 0x4D9A4…0x4EAD4.

    • A line contains: verb(2) type1(2) target1(3) type2(2) target2(3), then flag1(3) val1(2) flag2(3) val2(2) budSeq(3) mirror(2) csdataEntry(3) delay(2) flag(3) value(2) fx(2) fxDelay(2).
    • Key: type1·1000 + target1 + verb·10000 + type2·100000 + target2·1000000.
    • Target types: 0 = DATA4 area (text number), 1 = DATA3 object (text number), 2 = character (CHARPOS name number), 3 = inventory object.
  • Execution 0x18BC4: the first line with the same key whose two conditions hold is kept. A condition d < 500 requires flags[d] == v, a condition d ≥ 500 requires 0x4B3C8[d − 500] == v, and d = 0 requires nothing.

    • budSeq 6: nothing;
    • budSeq < 100: CTABLE02 sequence, the next field giving the mirroring;
    • budSeq ≥ 100: special animation [0x4ED18] = budSeq − 100.
    • The deferred result is stored at 0x4EC68…0x4EC80.
  • No line: default answer 0x14B94(verb).

    • The first lines are at 0x447E0 (0, 2235, 2235, 2251, 2261, 2276, 2294, 2312, 2235) and the number of variants at 0x423E4.
    • A counter per verb rotates: the line spoken is base + counter.
    • "Use" on inventory object 6 gives 0x95B.
  • Deferred result 0x18EDC, called when [0x4D7E0] == 0, i.e. one loop pass out of 4:

    • after "delay" passes, verbs 2, 3, 4 and 8 do flags[d] = v; verb 6 with v = 1 adds object d to the inventory (0x16F94);
    • then, if the CSDATA entry is > 0, [0x4FB34] starts the script.
    • FX 0x18E84: after "fxDelay" passes (0 = never), plays slot fx of FX.C (same arrays 0x46D5C and 0x46E4C as the fx script instruction).
  • What happens on a click (0x14B20, 0x14798, 0x14FC4):

    • On a scenery target, Bud first walks to the target's point: the area's stand (the clicked point if its text is 0), the object's stand_x/y, the character's walk_x/y, or the clicked point if y = 0.
    • "Go" only walks.
    • On the inventory, there is no walking: "Look" describes, "Give" and "Use" open the two-object sentence, and the other verbs give the default answer.
    • "Look" (0x18920) answers without walking: description of the area, takeable object, inventory object or character; failing that, the ACTION table (verb 1).
  • Characters: a CHARPOS character can only be hovered if flags[flag] == value (0x206DC).

  • Exits 0x14864 / 0x19299: "Go" (or "Use") on an area whose dest_loc > 0. Bud goes to stand, then:

    1. he walks to (walk_x2, unk), or plays special animation walk_x2 − 900 if the value is above 800;
    2. location dest_loc is loaded and Bud is placed at (to_x, to_y);
    3. he walks to (to_x2, to_y2), or plays animation to_x2 − 900;
    4. destination 99 is the map (0x195C4, not reproduced).
  • Special animations:

    • 0x19F98 loads aLL_01.SPR … aLL_nn.SPR (n = byte 0x44414[loc]) into a bank; 0x4ECC4[k] gives the offset of file k, and k = 0 falls on the first file;
    • 0x17B80 / 0x1A0A4 play every frame of the file once, in place of Bud. The coordinates are those of the sprite, with +320 if 320 < Bud's x < 640 (hard-coded exceptions in locations 22, 29 and 58);
    • examples: location 1, A01_02 (Bud climbs over the window sill); location 2, A02_01 (he climbs down the drainpipe).

4.15 Animated characters (per-location routines)

  • Fields per character i (dword arrays):
    • 0x4F104 state = number of the CLL_ss.SPR file played (−1: none), 0x4F188 previous state;
    • 0x4F144 current frame (1..n), 0x4F124 frame count (first word of the file);
    • 0x4F1C8 wait before deciding, 0x4F268 ticks per frame, 0x4F1E8 reverse playback, 0x4F208 ping-pong;
    • 0x4F248 "change when speech starts or ends", 0x4F92C position in the CHARPOS lists, 0x4F1A8 x offset (0 or 320).
  • 0x200E4, every tick, for each character:
    • a running CHARPOS list advances, and 99 ends it;
    • otherwise, 0x1F594 is called if the state is −1, if the character starts talking ([0x4EC98] > 0 and [0x4FBF0] == i) or if speech has ended while 0x4F248 > 0;
    • otherwise, the frame advances (wait, speed, ping-pong) and 0x1F594 is called at the end of the animation.
  • 0x1F594 resets these fields, then calls the routine of the location and the character:
    • location 2: 0x1A770;
    • location 3: 0x1AA60 (Vera, the bouncer), 0x1AB58 (Tony, offset 320), 0x1C160 (Dave);
    • these routines pick the next state from the flags, rand() (0x2E2E2, Watcom) and speech.
  • Link with the scripts:
    • cNa,NNN (0x20F05) sets state NNN (999 = none);
    • cNc,NNN (0x20FA9 → 0x208B8) plays list NNN of CHARPOS.C (file, frames…, 99).
    • The CHARPOS lists are therefore not the default animation. The engine could not draw Vera, the bouncer of location 3 (C03_01…05), who does not appear in them.
  • Peculiarities:
    • [0x4D7DC] = conversation in progress, set to 1 and 0 by the dialogue menu;
    • 0x47B1C…0x47B3C are flags (199, 203, 205, 207);
    • flag 0x4F98C makes the EXE write the frame count into the state (0x200A3). The engine reproduces this behaviour as is.
  • Number of animated characters: 0x44600[loc] (0x1A3E5). The fields are reset on loading (0x1A3F0, including 0x4F228, 0x4F94C and 0x4F9B0).
  • Execution rather than translation: the dispatcher 0x1F594 and the hundred or so routines from 0x1A770 to 0x1F594 are run as they are.
    • tucker/core/x86.py is a 32-bit interpreter limited to the instructions of this Watcom code. Its decoding was compared with the disassembly: same length for the 4,898 instructions of the area.
    • The code comes from the user's EXE, relocated at startup by LEImage.relocated().
    • tucker/core/exe_routines.py copies the engine state into the emulated memory before the call, then reads it back after:
      • copied: flags 0x47800[300], inventory 0x4B3C8, location, Bud's position, speech 0x4EC98/0x4FBF0, running script 0x4D7DC, special animation 0x4ED18, character fields;
      • read back: the same, plus 0x4FCD8, 0x4F98C and the requested script 0x4FB34.
    • Intercepted calls: 0x208B8 (CHARPOS list, in Python) and the sound driver (0x118B0 play, 0x11614 stop, 0x11D78 volume), turned into events. [0x41F90] = 0 disables the native part.
    • rand() (0x2E2E2) runs natively (Watcom LCG ×0x41C64E6D + 0x3039).
  • Validation: the routines of locations 2 and 3, translated by hand, give exactly the same states as the emulated execution over 1,000 ticks, with the same seed. All 82 locations run without errors.
    • Characters absent at the start of the game are absent because of their flags (example: location 4, Mr Pastry only if flag 9 is 2).
  • Comparison with the game under DOSBox (locations 1 to 3): a game played from the bedroom to Seedy street. DOSBox's native captures (Ctrl+F5, indexed 320×200 PNG) are compared with the engine's rendering, pixel by pixel. Characters are identified by counting only the sprite pixels that differ from the bare background (some frames, like C03_14 no. 2, are already painted into the background).
    • Location 1: same start (160, 125) and same stopping points ("Go bed"; washbasin at 115, 101). Differences fixed: the standing pose (4.13) and the starting panel (4.10).
    • Location 2: arrival at (220, 112); background, animated laundry and Mr Pastry (C02_01) identical to the pixel. Frames 7 = 1 and 5 = 3 of C02_01 are the same: frame 7 is never shown (end of animation at num_frames − 1, 0x200E4).
    • Location 3: Bud arrives at x = 496, feet at y = 120 in both versions. Difference fixed: the camera (4.14). Vera (C03_01…05, mostly state 5), Tony (+320, states 6, 10 and 11) and Dave (C03_14 / C03_15, about 60/40) have the same states and the same proportions as the emulated execution.
    • DOSBox mouse (mouse not captured, autolock=false): absolute position, x_game = 10 + 1.754·(x − 170) and y_game = 3 + 0.882·(y − 182), in the tool's screen coordinates. A click must last about 0.25 s to be seen by the game.

4.16 Town map (0x195C4)

  • Opening:

    • exit to location 99 (0x19411, with [0x4FCF8] = 1: "from an exit"); locations 3, 9, 16, 19, 20 and their equivalents 65, 66, 61, 62, 68;
    • "Use" object 1 (the map) in the inventory (0x15CE8), if the table 0x42170[loc] is 1. Locations 41 to 52 are added when flag 223 is set (0x23F95, and on loading a save). Otherwise Bud answers with line 0x8BB (2235).
  • Image: map2.pcx (blank map), onto which 0x19530(x, y, w, h) copies rectangles of map1.pcx:

    • flag 7 > 0: (0, 0, 140, 86); > 1: (0, 60, 122, 120); > 2: (122, 114, 97, 86); = 4: (140, 0, 88, 125);
    • flag 120 = 1: (220, 0, 100, 180).
  • Areas (strict bounds, screen coordinates), name = line of INFOBAR.TXT in colour 0x60, placed like a bubble (0x19D74) at (mouse x + 8, mouse y − 10):

    Area Condition Line Location (part 1 / 2-3) Bud
    30 < x < 86, 36 < y < 86 flag 7 > 0 13 Seedy street 3 / 65 (620, 130)
    60 < x < 120, 120 < y < 170 flag 7 > 1 14 shopping centre 9 / 66 (344, 120)
    160 < x < 210, 110 < y < 160 flag 7 > 2 15 Park 16 / 61 (590, 130)
    150 < x < 200, 20 < y < 70 flag 7 = 4 or 6 16 Museum 20 / 68 (20, 130)
    240 < x < 290, 35 < y < 90 flag 120 = 1 17 Docks 19 / 62 (20, 124)
    135 < x < 185, 170 < y < 200 always 18 Go back current location see below
  • "Go back": from an exit, Bud is placed according to the location he left (3/65: (620, 130); 9/66: (344, 120); 16/61: (590, 130); 20/68: (20, 130); otherwise (20, 124)). From the inventory, he keeps his position. In both cases the location is reloaded ([0x468C8]).

  • Arriving from an exit in location 9: Bud's special animation 2; in location 66: animation 1 (0x19B7E).

  • While the map is open the game stops running: opening fade in 14 steps (0x1053C), loop until a click on an area, closing fade.

4.17 Per-location code (0x24C8C)

  • Called every tick from the loop (0x12DF7): a chain of cmp [0x4680C], n leads to 46 routines, for locations 1-6, 9-16, 19, 21, 22, 24-36, 38, 41-44, 49, 52, 53, 57, 58, 61, 63-66 and 70. Location 14 is called conditionally.
  • These routines read and write the game variables directly:
    • flags 0x47800 + 4n (many "globals" are flags: 0x47A3C = flag 143);
    • areas (0x472F4…, 10 per location);
    • FX slots (volume 0x46D5C, type 0x46DD4);
    • Bud's depth table 0x442D4 and the map table 0x42170;
    • walk target [0x4B56C]; requested script [0x4FB34];
    • DAC (0x10270, 0x103F8) and walk mask (0x13A28, e.g. PATH02B in location 2);
    • location init [0x4FBF4], reset to 0 on loading.
  • Some draw directly into the 640 buffer [0x4685C] from the DATA.C graphics:
    • buffer [0x48480] filled by 0x16598, sheet by sheet and by increasing id; each rectangle is compressed by 0x10DF0 (byte ≠ 0 copied, run of 0 → 0, n, split beyond 200);
    • tables per id (0x16654): offset 0x4AB94, x 0x48484, y 0x48C54, width 0x49424, height 0x49BF4, sheet 0x4A3C4;
    • location 6: the stage curtain (graphic 238, 8 × 51 with no transparent pixel) is copied strip by strip by 0x2279C and 0x22880 according to flag 27.
  • The modern engine runs them as they are in its x86 emulator (tucker/core/x86.py, memory shared with the characters 0x1F594); graphics and sound calls are intercepted and handed to the engine.
  • Location 70, terminal:
    • scancode [0x4EC8C] translated by the table 0x41FF8, at most 19 characters, Backspace 0x0E/0x53, Enter 0x1C;
    • the first 16 characters are compared with line 24 of INFOBAR.TXT (in the French version "GRAND PANTALON JAUNE", "big yellow trousers");
    • result in flag 143 (1 = right, lines 25-26; 2 = wrong, lines 27-28), then script 1.

4.18 Fades, pause and help

  • Fades (0x12A5B, steps 0x1053C / 0x1062C): counter [0x4ECB8], + 1 per tick.
    • c < 16 and c > 1: each DAC component + 5 (6-bit) towards the target colour; loading a location sets c = 0, i.e. 14 steps.
    • 19 < c < 34: − 5 per component. An exit fades to black before loading; the map opens and closes the same way.
  • Pause: P key (except in location 70), [0x467B0].
    • All sounds stop and the bar shows line 36 ("EN PAUSE", "paused").
    • Keys 1 to 5 replay Bud's last 5 bus lines (history 0x467B8…).
    • P resumes the game and the sounds.
  • F3 help (0x26ECC): active only if the 2nd number of the DATA4.C header is ≠ 0. The shipped version has dw 00,00, so no help.
    • Steps: 0 → 1 (flag 3), → 2 (12), → 3 (20), → 4 (9), → 5 (23); flag 19 → 6 (end).
    • Help is ready after 1,500 ticks in the step. If the mouse has not moved for 1,000 ticks, the bar shows line 29 ("Press F3").
    • F3 shows line 30 + step.

5. Limitations

  • Ghidra's decompiler does not know the Watcom convention: the arguments were re-read in the assembly, provided in extracted\pe\dis.txt. REA is read-only under Windows, so no function could be renamed in Ghidra.
  • fw and sp are now described; the behaviour of sp was re-read in 0x17B80, that of fw in 0x14798.

Working files produced locally in extracted\pe\ (not published): TUCKER_flat.exe, dis.txt (full disassembly), callgraph.txt, procs.txt, strings.txt, decompile\*.c (Ghidra output via REA), rea_evidence.json (REA evidence), outils\ (le2pe.py, dis.py, show.py, pseudo.py).


Page générée depuis docs/ANALYSE.en.md.

Clone this wiki locally