data/claims/solomons-key.yamlSolomon's Key (USA) mechanics read in the ROM
Game: Solomon's Key.
Each room initializes the four-digit LIFE meter to 1000 (displayed as 10000) with a default drain step of 1 and selects one of three per-room drain rates (adding 45, 34, or 25 per tick into an eight-bit fractional accumulator). Four hourglass pickups in the item table alter LIFE directly: resetting it to 1000, overwriting it to 500, doubling it while setting the drain step to 2, or multiplying both LIFE and the drain step by 5. On room clear, the bonus tally subtracts 8 LIFE units per NMI-synchronized frame into the score while LIFE is at least 8, then executes one final borrow pass to clear the meter and add the remainder (including 0 when LIFE is divisible by 8), spending floor(LIFE / 8) + 1 frames before advancing. solomons-key/life-countdown-hourglass-and-room-tally
Value: 8 units/frame
CodeSolomon's Key (USA) ·0x19CF-0x19D1 — $99BF-$99C1 (RoomSetupData99BF): three LIFE drain accumulator increments ($2D = 45, $22 = 34, $19 = 25)Solomon's Key (USA) · 0x1827-0x1848 — $9817-$9838 (SetUpRoomData): loads room drain rate from $99BF into $0436, sets drain step $0435 = 1, sets thousands digit $043B = 1, and clears $0438-$043A to 0 (LIFE = 1000)Solomon's Key (USA) · 0x216F-0x21C4 — $A15F-$A1B4 (UpdateDecimalDisplayState): adds $0436 into fractional byte $0437 and, on carry, subtracts drain step ($0435 & $7F) across decimal digits $0438-$043BSolomon's Key (USA) · 0x44E3-0x451C — $C4D3-$C50C: item pickup jump table mapping tiles $11-$14 to $C628 (x2), $C64B (x5), $C67E (1000), and $C682 (500)Solomon's Key (USA) · 0x4638-0x46A7 — $C628-$C697 (DoubleFourDecimalDigits, MultiplyDecimalDigitsByFive, FillFourBytesWithOne, InitializeFourBytesWithFive): implements x2 (setting $0435 step to 2), x5 (multiplying $0435 by 5), 1000, and 500 LIFE transformsSolomon's Key (USA) · 0x0F92-0x0F94 — $8F82-$8F84: room-clear sequence calls SubtractEightAndUpdateDigits ($8FB0)Solomon's Key (USA) · 0x0FC0-0x102D — $8FB0-$901D (SubtractEightAndUpdateDigits / AddDigitsAndPrepareVram): subtracts 8 from $0438-$043B; while Carry stays set (LIFE >= 8) adds 8 to score and loops ($8FCD: BCS $8FE4 -> BNE $8FB0), and on borrow clears $0438-$043B and runs one final pass adding LIFE mod 8 (0 when divisible by 8), taking floor(LIFE / 8) + 1 passesSolomon's Key (USA) · 0x4413-0x443E — $C403-$C42E (PrepareDecimalDigitsVramBuffer): calls AdvanceSlotsWhileMaskFFSet ($C3E0) to wait for NMI VRAM flush ($001B == 0), pacing the tally at 1 frame per passSolomon's Key (USA) · 0x43F0-0x43F6 — $C3E0-$C3E6 (AdvanceSlotsWhileMaskFFSet): loads mask #$FF and address $001B and jumps to AdvanceWhileMaskSet ($9165)Solomon's Key (USA) · 0x1175-0x1188 — $9165-$9178 (AdvanceWhileMaskSet): yields via AdvanceStackSlot ($8DB4) in a loop until ($00,X & mask) == 0 ($001B == 0)Solomon's Key (USA) · 0x003B-0x0043 — $802B-$8033 (ServiceNmiFrame): during NMI, runs ProcessVramCommands ($8B7F) whenever $001B >= 2Solomon's Key (USA) · 0x0BD1-0x0BDD — $8BC1-$8BCD (ProcessVramCommands): writes 0 to $001B after flushing the VRAM buffer during NMIChecked by claude, 2026-11-26 — disassembled $802B-$8033, $8BC1-$8BCD, $8F82-$8F84, $8FB0-$901D, $9165-$9178, $9817-$9838, $99BF-$99C1, $A15F-$A1B4, $C3E0-$C3E6, $C403-$C42E, $C4D3-$C50C, and $C628-$C697 directly from the USA ROMEvery room's 16-by-12 playable stone layout unpacks into a 224-byte grid buffer in RAM bounded by unbreakable top and bottom border rows, with interior cells first cleared to an empty-space value. In ROM, each room occupies 48 bytes arranged as two consecutive 24-byte (192-bit) bitplanes: the unpacker expands the first 24 bytes into breakable brown stone cells and the second 24 bytes into unbreakable white stone cells across the 192 interior tiles. solomons-key/two-bitplane-room-grid-encoding
Value: 48 bytes
CodeSolomon's Key (USA) ·0x1A02-0x1A5A — $99F2-$9A4A (InitializeRoomBuffer): fills $0304-$03E3 with #$10 (empty), borders $0304-$0313 and $03D4-$03E3 with #$F8 (solid), computes $E02C + RoomIndex * 48, and calls $9A4B twice with #$90 (brown) then +$18 bytes with #$F8 (white)Solomon's Key (USA) · 0x1A5B-0x1A7C — $9A4B-$9A6C (FillBufferWhenFlagSet): shifts 24 bytes (192 bits) right through Carry and stamps the tile code into $0304+$CF down to $0304+$10 wherever a bit is setChecked by claude, 2026-11-26 — disassembled $99F2-$9A6C directly from the USA ROMPicking up a room's key writes an open-door tile into the playfield grid, and entering that open door normally advances the zero-based room index by 1. Collecting a warp item sets a room-status flag that causes the room-advance routine to add 5 before the normal increment, jumping forward by 6 rooms instead of 1. Clearing Room 48 (index 47) while holding fewer than 8 special seal collectibles triggers an extra increment that skips Room 49 directly to Room 50; when exiting a hidden room (where a saved return-room index is nonzero), the routine skips both the normal room increment and the Room 48 seal check. solomons-key/room-progression-and-seal-warps
Value: 6 rooms
CodeSolomon's Key (USA) ·0x44E3-0x451C — $C4D3-$C50C: item pickup jump table mapping key tile $06 to $C563, open-door tile $07 to $C587, seal tile $20 to $C553, and warp tile $22 to $C53DSolomon's Key (USA) · 0x454D-0x4553 — $C53D-$C543 (SetFlag28Bit6): warp item (tile $22) sets bit 6 (#$40) of room status byte $0028Solomon's Key (USA) · 0x4563-0x456B — $C553-$C55B (Increment79AndMergeFlags): seal item (tile $20) increments counter $0079Solomon's Key (USA) · 0x4573-0x4596 — $C563-$C586 (UpdateRoomLookupAndInitializeSlot): key pickup (tile $06) writes open-door tile #$07 into RoomGrid ($0304,Y) and sets key flag $0028 bit 5 (#$20)Solomon's Key (USA) · 0x4597-0x45DC — $C587-$C5CC (InitializeRoomState): when $0028 & #$40 is set adds 5 to RoomIndex ($0428); when hidden-room return byte $0429 is nonzero ($C5A9-$C5AE) branches past both +1 progression and the Room 48 check; otherwise increments RoomIndex (+1 normal, +6 with warp, or +2 on RoomIndex == #$2F when $0079 < 8)Solomon's Key (USA) · 0x103A-0x1054 — $902A-$9044: when hidden-room flags ($0078 & #$30) are set, saves current RoomIndex ($0428) into $0429 and switches RoomIndex to the hidden room ($32-$34)Solomon's Key (USA) · 0x10BC-0x10CE — $90AC-$90BE: restores RoomIndex ($0428) from saved return byte $0429 after hidden-room setupChecked by claude, 2026-11-26 — disassembled $902A-$9044, $90AC-$90BE, $C4D3-$C50C, $C53D-$C543, $C553-$C55B, and $C563-$C5CC directly from the USA ROMDana's fireball stock is packed across two bytes as a queue of up to eight two-bit slots (four slots per byte), bounded by a separate capacity counter that caps at 8 when jar upgrades are collected. Picking up a normal fireball writes bit-pair 01 and a super fireball writes bit-pair 10 into the first empty slot within current capacity. Casting a fireball pops the front slot by shifting both packed bytes left two bits through carry into the low two bits of the accumulator. The upgrade routine tests only bit 0 of each two-bit pair to promote a normal slot (01) to super (10) by XORing both bits, and loads its initial bitmask once before the outer loop, so the mask shifts to zero after the first byte's four slots. solomons-key/packed-two-bit-fireball-inventory
Value: 8 slots
CodeSolomon's Key (USA) ·0x46A8-0x46C4 — $C698-$C6B4 (CompareCountWithEight, InsertPackedFieldOne, InsertPackedFieldTwo): caps jar capacity $042B at 8; passes #$55 (01 pairs) for normal fireballs and #$AA (10 pairs) for super fireballsSolomon's Key (USA) · 0x46E5-0x4712 — $C6D5-$C702: scans up to $042B two-bit slots across $042F and $042E (shifting mask #$C0 right by 2 per slot) and ORs the new fireball bit-pair into the first empty slotSolomon's Key (USA) · 0x1B5C-0x1B69 — $9B4C-$9B59: casting pops the front 2-bit slot by looping twice over ASL $042E, ROL $042F, ROL A and masking the popped code with AND #$03Solomon's Key (USA) · 0x25BE-0x25EC — $A5AE-$A5DC (UpdatePackedStateBits): loads mask #$40 once at $A5B5 outside the two-byte outer loop ($A5B9/$A5D0), tests bit 0 of each 2-bit slot in $042F, and XORs both bits to promote 01 to 10 (mask shifts to #$00 before the second byte $042E)Checked by claude, 2026-11-26 — disassembled $9B4C-$9B59, $A5AE-$A5DC, $C698-$C6B4, and $C6D5-$C702 directly from the USA ROMBefore building OAM sprite entries each frame, the sprite renderer copies the vertical coordinate of all 20 object slots into a 20-byte key array paired with an index array. It sorts all 20 entries into ascending vertical order using a gap-decreasing Shell-style insertion sort whose gap steps down by 1 on each pass from 10 through 1, swapping out-of-order pairs and backtracking by the current gap. It then groups adjacent sorted entries separated by fewer than 16 vertical pixels into horizontal bands (splitting to a new band whenever separation is at least 16 pixels), updates per-band rotation offsets to cycle draw order within crowded bands across frames, and emits two hardware sprites per active object into OAM. solomons-key/shell-sort-sprite-oam-builder
Value: 20 objects
CodeSolomon's Key (USA) ·0x04DE-0x0556 — $84CE-$8546 (SortRecordsAndBuildSprites): loads offset +7 (Y) of 20 records ($13..0) into $0040-$0053 with doubled indices in $0054-$0067, runs a gap sort from gap #$0A down to 1 ($84E7-$8527), and splits bands via UpdateIndexedCounter whenever adjacent Y delta >= #$10, grouping entries < 16 px apart ($8528-$8546)Solomon's Key (USA) · 0x0557-0x061B — $8547-$860B: walks each vertical band using per-band rotation offset $0068,X (decremented by 3 via ADC #$FD each frame at $8572-$8578) and writes two hardware sprites per active object to shadow OAM ($0210,X and $0214,X)Solomon's Key (USA) · 0x061D-0x064B — $860D-$863B (UpdateIndexedCounter): adjusts or resets per-band rotation offset $0068,Y for each 16-pixel vertical band whenever a band boundary is finalizedChecked by claude, 2026-11-26 — disassembled $84CE-$863B directly from the USA ROMThe controller reader strobes both ports and ORs bits 0 and 1 on each serial read to accept Famicom expansion controllers alongside standard pads, storing raw button bytes for both ports. When the active-gameplay flag bit is clear, the input filter copies only the Select and Start bits from the freshly read raw byte while preserving the other six button bits from the previous filtered state, locking out movement and action changes outside active room gameplay. solomons-key/joypad-read-and-gameplay-mask-filter
Value: 8 bits
CodeSolomon's Key (USA) ·0x038D-0x03D1 — $837D-$83C1 (ReadAndFilterJoypads / ReadJoypadBits): reads 8 bits from $4016/$4017 ORing bits 0 and 1 into $0082/$0083; when $0078 bit 0 is clear, updates only #$30 (Select/Start) into $03E4/$03E5 while keeping #$CF from the prior byteChecked by claude, 2026-11-26 — disassembled $837D-$83C1 directly from the USA ROM