Claim set · data/claims/romance-of-the-three-kingdoms-ii-snes.yaml

Romance of the Three Kingdoms II (SNES) engine, read from the ROM (no disassembly)

Game: Romance of the Three Kingdoms II.

Much of the game's logic is bytecode, not machine code: an interpreter in the cartridge's first bank reads it a byte at a time and jumps through a table of 256 handlers, one for each byte. The bytecode sits in blocks the game copies into work RAM and runs from there, the first of them, 20,978 bytes, at power-on; the setup menu's block is copied when that menu opens, before a scenario is chosen, and the officers' ability panel has its text fetched through the handler of byte $D3. romance-of-the-three-kingdoms-ii-snes/bytecode

Value: entry bytes 24 · entry also in Gemfire (USA), Aerobiz (USA), Inindo - Way of the Ninja (USA), P.T.O. - Pacific Theater of Operations (USA) · entry not in Genghis Khan II - Clan of the Gray Wolf (USA), Romance of the Three Kingdoms III - Dragon of Destiny (USA), Romance of the Three Kingdoms IV - Wall of Fire (USA), Nobunaga's Ambition (USA), P.T.O. II - Pacific Theater of Operations (USA), Liberty or Death (USA), Aerobiz Supersonic (USA) · root 0x8000 · root ram $7E2000 · root bytes 20978 · setup 0xD1F2 · setup ram $7E7200 · setup bytes 11790 · dispatch $00:9AA8 · handlers 0x20E6 · format string $7E9873 · byte handler $00:9E79, $00:9E83

CodeRomance of the Three Kingdoms II (USA) · 0x0-0x2 — $00:8000: JMP $9A4C, the interpreter's entryRomance of the Three Kingdoms II (USA) · 0x1A4C-0x1AAA — $00:9A4C-$00:9AAA: the entry pulls its caller's return addresses off the stack, the second the address of the bytecode that follows the call, then from $9A92 loads the next byte (LDA [$06],Y; INC $06), doubles it, takes its handler from $00:A0E6 plus that (LDA $00A0E6,X) and jumps to it (JMP ($0000))Romance of the Three Kingdoms II (USA) · 0x20E6-0x22E5 — the 256 handler addresses, a word eachRomance of the Three Kingdoms II (USA) · 0x83E6-0x83F8 — $7E:23E6 once copied (the power-on block's bytes 0x3E6 on): JSL $008000, the stub that enters the interpreter, three more JSLs into the first bank, and at $7E:23F6 a JSR $23E6, a call of the stubRomance of the Three Kingdoms II (USA) · 0x1E79-0x1E85 — $00:9E79-$00:9E85, the handler of byte $D3: a byte read through the pointer at direct page $0A (LDA ($0A),Y), stored back there, and a jump back to the loop (JMP $9A90)Romance of the Three Kingdoms II (USA) · 0x7800-0x782F — a directory of three 16-byte entries, "root", "settei" and "sdata", each a name of eight bytes, a word 1, and two words: $8000 and $51F2 (20,978) for root, $D1F2 for settei, $FC32 for sdataGenghis Khan II - Clan of the Gray Wolf (USA) · 0x44688-0x446F5 — for comparison, Genghis Khan II's rand() and rand(n), native 65816 code that takes its argument on the stack (LDA $04,S), as that game's routines do (genghis-khan-ii-snes, the set's header)Checked by claude, 2026-11-16 — ran the probe in MesenCE: the first block copy after power-on is the claim's 20,978 bytes to $7E:2000, the setup menu's the claim's 11,790; the interpreter dispatches hundreds of thousands of bytes by the panel; the only code reading the panel's format string is the handler of byte $D3Revised after a check by a second AI model, 2026-11-16.Probe: probes/romance-of-the-three-kingdoms-ii/engine.mjs

Genghis Khan II (1993 on the SNES) is native code compiled from C (genghis-khan-ii-snes); this game's cartridge runs an interpreter instead, so routines of the two games can't be matched as code: a counterpart of a Genghis Khan II routine here would be bytecode. The probe logs the game's block copies (its MVN at $00:006C) and counts the interpreter's dispatches: at power-on the cartridge copies the block at 0x8000 to $7E:2000, the length the directory gives "root"; when the setup menu opens it copies 11,790 bytes from 0xD1F2, where the directory puts "settei" (Japanese for settings), to $7E:7200; the scenario records begin four bytes into "sdata" (romance-of-the-three-kingdoms-ii-snes-tables/scenarios). Settei's second word is $2A40, not the length copied, so what the words mean beyond a start isn't settled. The panel that shows a ruler's Int, War and Chm (romance-of-the-three-kingdoms-ii-snes-tables/officers) reads its format string, in the setup block's copy at $7E:9873, through the handler of byte $D3, which reads a byte for the bytecode. The bytecode's own instruction set isn't decoded here. The probe also searches other Koei SNES images (No-Intro names; it prints each one's SHA-1) for the interpreter's first 24 bytes, from $00:9A4C: they occur in Gemfire (USA), Aerobiz (USA), Inindo - Way of the Ninja (USA) and P.T.O. - Pacific Theater of Operations (USA), and not in Genghis Khan II, Romance of the Three Kingdoms III or IV, Nobunaga's Ambition, P.T.O. II, Liberty or Death or Aerobiz Supersonic. That is a search, not a match: it doesn't show those games run bytecode of the same kind.

Cited by: Romance of the Three Kingdoms II

The ROM doesn't hold the multiplier of Genghis Khan II's random number generator, 1,103,515,245, the C standard's example rand(), as a 32-bit number in either byte order. romance-of-the-three-kingdoms-ii-snes/rand-multiplier

Value: multiplier 1103515245 · found 0 · immediates in Genghis Khan II - Clan of the Gray Wolf (USA), Romance of the Three Kingdoms III - Dragon of Destiny (USA), Romance of the Three Kingdoms IV - Wall of Fire (USA), Nobunaga's Ambition (USA), P.T.O. II - Pacific Theater of Operations (USA), Liberty or Death (USA), P.T.O. - Pacific Theater of Operations (USA)

VerifiedRomance of the Three Kingdoms II (USA) · 0x0-0xFFFFF — the whole ROM, searched by the probeGenghis Khan II - Clan of the Gray Wolf (USA) · 0x44688-0x446F5 — Genghis Khan II's rand(): LDA #$4E6D and LDA #$41C6, the multiplier's two halves as immediates (genghis-khan-ii-snes-battle/random)Checked by claude, 2026-11-16 — ran the probe, which searches the ROM image for the byte stringsRevised after a check by a second AI model, 2026-11-16.Probe: probes/romance-of-the-three-kingdoms-ii/engine.mjs

A search, so a measurement of absence only (docs/verification.md#roms): the four bytes $6D $4E $C6 $41 and $41 $C6 $4E $6D occur nowhere in the image. Genghis Khan II loads the multiplier as two 16-bit halves, and the probe also finds no LDA #$4E6D ($A9 $6D $4E). This game's random number generator, the season's advance, death of age, market prices and the rate weren't found; if they are bytecode (romance-of-the-three-kingdoms-ii-snes/bytecode), they can't be read yet. The same search over other Koei SNES images finds LDA #$4E6D, LDA #$41C6 and ADC #$3039 each at least once in Genghis Khan II, Romance of the Three Kingdoms III and IV, Nobunaga's Ambition, P.T.O. II, Liberty or Death and P.T.O., the last of which also holds the interpreter's first 24 bytes; a search, it shows the instructions' bytes are there, not that they run as Genghis Khan II's rand().

Cited by: Romance of the Three Kingdoms II