# Robinson's Requiem (DOS, PC CD) — the original ALIS VM, decompiledGoal of this folder: compare, handler by handler, the ORIGINAL virtual machine of the game (the DOS executable) withthe PHP port's implementation, and report what is missing or behaves differently.## The binary- Original executable: `/home/david/Bureau/old/robinson/iso_src/START.EXE` (DOS extender by Doug Huffman + a second MZ program that holds the game). The game's 32-bit code and data are one flat image.- Extracted image (load it at address 0): `rrq_dos32.bin` in this folder (= START.EXE bytes from offset 1319 + 160 + 0x4290). An address A in the image is byte A of `rrq_dos32.bin`.- Disassemble a handler: `ndisasm -b 32 -o 0xADDR -e 0xADDR rrq_dos32.bin | head -80` (code is hand-written assembly: handlers share code, fall through and jump into each other; follow the jumps/calls you need).- Ghidra decompilation of every table entry (C-like): `out/opcodes.c`, `out/esc1.c`, `out/opernames.c`, `out/tab189ae.c`, `out/tab18a26.c` (each entry starts with `// ===== <table>[i] (0xii) -> 0xADDR =====`). Ghidra project (headless) in `proj/`; script `scripts/ExportTables.java`.## The VM (as found in the binary)- Main loop at 0x7b73: `sub eax,eax; lodsb; call [eax*4+0x18432]; jmp 0x7b73` — ESI = script program counter.- Opcode table: 0x18432, 256 dword entries (index = opcode byte).- cesc1 (opcode 0x01) does `lodsb; jmp [eax*4+0x18832]`: escape table 0x18832 (7 entries).- Expression elements ("opernames"): dispatched by `lodsb; jmp [eax*2+0x1884e]` (0x9d30): the operand codes are EVEN, entry = code/2, table at 0x1884e.- Two more tables of 27 entries at 0x189ae and 0x18a26: most likely the store targets ("storenames") and the add targets ("addnames") — check which is which from the code that dispatches to them (search the image for `ff 24 45` / `ff 14 45` / `ff 24 85` with those addresses, or look at cstore (opcode 0x1e, 0x3bb9) and cadd).- Interesting globals seen so far: [0x16008] / [0x1600c] (expression string buffers?), [0x16006], [0x15fcb], ES:EBP = the current script's variables (negative offsets = locals, like the port's vb/vw at -offset).- Robinson's Requiem is ALIS version 31 (v3), little endian (DOS).## The port (what to compare with)- PHP port: `/home/david/Projets/JumPHPGames/alis/games/alis/src/Alis/` — functions in `fn/*.php` (opcodes in `fn/opcodes*.php`, `fn/opernames.php`, `fn/storenames.php`, `fn/addnames.php`, `fn/escnames.php`, images in `fn/image*.php`, 3D in `fn/rrq3d*.php`, sound `fn/audio*.php` …), dispatch tables built in `fn/alis.php` (`set_dispatch_tables`, `alis_tab_opcodes()`, `table_opcodes()`, …) and `Tables.php`. Opcode names and operand kinds: `Lang/Grammar.php` (OPCODES, ESC1).- The C reimplementation the port was translated from: `/home/david/programs/alis/alis/src/` (opcodes.c, opernames.c, storenames.c, addnames.c, escnames.c, image.c, …). Its descriptions (`DECL_OPCODE(...)` in opcodes.c) mark unimplemented ones `[N/I]`.- What the game really uses: the decompiled scripts of Robinson's Requiem, `/home/david/Projets/JumPHPGames/alis/.alis-data/robinson/src/*.als` (canonical form: `docs/language.md` of the game; a statement is the opcode name without its leading `c`, e.g. `putnat` = `cputnat`). Grep them to know if an opcode / expression element / store target is used, and how often.## Rules for the audit- READ ONLY: do not modify any file of the port or of this folder (write nothing outside your own reasoning).- For each entry: find the original handler, understand what it does (operands read from the script, globals changed, calls), find the port's function for the same index, compare. Report precisely: what the original does that the port does not (or does differently), with the original's addresses and the port's file:line.- "Same behaviour" means same operands consumed (the script stays in sync), same effects on VM state / memory / screen / sound, same results in edge cases (signedness, 8/16/32-bit wrap, clipping).- Platform-only things (DOS sound card, VGA ports, timer interrupts) need not match byte for byte: report them as "platform" if the port does the equivalent through its host layer.