Dr. Robotnik's Mean Bean Machine

From Sonic Retro

This is the Sonic Community Hacking Guide for Dr. Robotnik's Mean Bean Machine.


This is an highly incomplete list of locations in the ROM, mainly about the sound driver and music-related stuff.

Offset Description
$18BA - $2791 Bytecode
$B0000 - $E7FFF PCM samples. Split in banks of $8000 bytes to work with the Z80, padded with $FF.
$E8000 - $EFFFF DAC samples. Padded with $FF.
$F6000 Sound driver (Cube/Iwadare). Z80 code.
$F8000 Voices used in the songs, arranged in groups of $1D bytes each.
$F937C Song data, in the Cube/Iwadare format.


The game uses bytecode for the general main loop rather than just using 68000 code. This is also present in the original Puyo Puyo and subsequent ports. Here are the instructions:

$00 Stops executing the bytecode. Execution is to be resumed by other code.
$01 NOP (I think)
$02 Delay for a number of frames
$03 Waits for a palette fade to finish
$04 Stores a word sized value into RAM
$05 Calls a 68000 routine
$06 Equivalent to BRA
$07 Equivalent to BEQ
$08 Equivalent to BNE
$09 Using what's stored in the bytecode's flag, it branches to an address from a table
$0A Initializes VDP registers from an ID (the game uses different sets of register data)
$0B Decompresses "Puyo" art into VRAM
$0C Call set of a VDP plane commands
$0D Loads a palette into a palette line
$0E Fades into a palette in a palette line
$0F Play a sound
$10 Play a sound (checks if samples are allowed)
$11 Fade out music
$12 Stop all sounds
$13 Identical to $10
$14 Decompresses Nemesis art into VRAM
$15 Fades into a palette in a palette line (with a check for which stage intro that is used)
$16 Decompresses "Puyo" art into VRAM (with a check for which stage intro that is used)

RAM Locations

Offset Description
$FF0112 Stage ID
$FF0113 Opponent ID
$FF0134 - $FF0135 DMA disable flag
$FF05C6 - $FF05C7 Frame count (used for VSync)
$FF05D2 - $FF0621 Vertical scroll buffer
$FF0622 - $FF0A21 Horizontal scroll buffer
$FF0A22 - $FF0A35 VDP register values
$FF0A36 - $FF0A39 Bytecode PC
$FF0A3A Flag used for bytecode, typically used in the bytecode for branching
$FF0A3B Bytecode disable flag
$FF0A3C Flag in which if set it runs the next instruction in bytecode without VSync
$FF0A3E - $FF0A56 Palette data
$FF0AD6 - $FF0C5B Palette fade data
$FF0E86 - $FF1105 Sprite buffer
$FF110A - $FF110F Player 1 controller data
$FF1110 - $FF1115 Player 2 controller data
$FF1116 Random number generator seed
$FF112A Flag in which if set it will load Robotnik's lair as the level intro
$FF4100 - $FF42FF Nemesis decompression buffer
$FF4300 - $FF4FFF DMA queue
$FFE000 - $FFEFFF Object RAM
$FFFC02 Flag that is set if the console is detected as non-Japanese
$FFFCA4 Number of game matches in 1P vs. 2P mode
$FFFCA6 Player 1 A button assignment
$FFFCA7 Player 1 B button assignment
$FFFCA8 Player 1 C button assignment
$FFFCA9 Player 2 A button assignment
$FFFCAA Player 2 B button assignment
$FFFCAB Player 2 C button assignment
Sonic Community Hacking Guide
Sonic Music Hacking Guide | SonED2 Manual
Sonic the Hedgehog (16-bit) | Sonic the Hedgehog (8-bit) | Sonic Eraser | Sonic CD (prototype 510) | Sonic CD | Sonic CD (PC) | Sonic CD (2011) | Sonic 2 (Nick Arcade prototype) | Sonic 2 (Simon Wai prototype) | Sonic 2 (16-bit) | Sonic 2 (8-bit) | Sonic 2 & Knuckles | Dr. Robotnik's Mean Bean Machine | Sonic Triple Trouble | Sonic 3 | Sonic & Knuckles | Sonic the Hedgehog 3 & Knuckles | Sonic & Knuckles Collection | Sonic Crackers | Sonic 3D: Flickies' Island | Chaotix | Sonic R PC | Sonic Jam 6 | Sonic Advance | Sonic Advance 2 | Sonic Advance 3 | Sonic Battle | Sonic Adventure | Sonic Adventure DX: Director's Cut | Sonic Adventure DX: PC | Sonic Adventure (2010) | Sonic Shuffle | Sonic Adventure 2 | Sonic Adventure 2: Battle | Sonic Adventure 2 (PC) | Sonic Heroes | Shadow the Hedgehog | Sonic Riders | Sonic the Hedgehog (2006) | Sonic & Sega All-Stars Racing | Sonic Unleashed (Xbox 360/PS3) | Sonic Colours | Sonic Generations | Sonic Lost World | Sonic Forces
Legacy Guides
The Nemesis Hacking Guides The Esrael Hacking Guides
ROM: Sonic 1 | Sonic 2 | Sonic 2 Beta | Sonic 3

Savestate: Sonic 1 | Sonic 2 Beta/Final | Sonic 3

Sonic 1 (English / Portuguese) | Sonic 2 Beta (English / Portuguese) | Sonic 2 and Knuckles (English / Portuguese)
Move to Sega Retro
Number Systems (or scrap) | Assembly Hacking Guide | Subroutine Equivalency List | 68000 Instruction Set | 68000 ASM-to-Hex Code Reference | VDP Documentation | Official Sega 32X Documentation | Official Mega-CD Documentation | Official Sega Mega Drive Documentation