Beginner guide
By the end of this page you will have run a Game Boy ROM in a window, learned the controls, and run a CPU test from the terminal.
What you need
- gameboy built from source. See Install.
- A terminal opened in the
gameboysource folder. git,curland an internet connection, to download the test ROMs.
Get a ROM you may use
gameboy does not come with any ROMs. The repository has a script that downloads two free sets of test ROMs: blargg's Game Boy test suites and dmg-acid2, a graphics test.
./tests/roms/fetch_roms.shWhen it finishes, the script checks the download of dmg-acid2.gb and prints a line starting with done:. The files are in tests/roms.
WARNING
Only run ROMs you have the right to use: these test ROMs, homebrew released by its author, or dumps you made from cartridges you own. Commercial game ROMs downloaded from the internet are not yours to use.
Run your first ROM
Start the graphics test:
bash./build/gameboy tests/roms/dmg-acid2.gbA 640×576 window opens. Its title is
gameboy -followed by the title stored in the ROM.Look at the picture.
dmg-acid2draws a smiling face in four shades of green. Every part of the face tests one graphics feature, so a complete, tidy face means the graphics work.Press Esc to quit. Closing the window does the same.
Learn the controls
| Game Boy button | Key |
|---|---|
| D-pad | Arrow keys |
| A | X |
| B | Z |
| Start | Enter |
| Select | Right Shift |
Two more keys control the emulator: hold Tab for turbo, and press Esc to quit.
Play a homebrew game
Homebrew games are new Game Boy programs released by their authors. The project has been checked with two of them: Libbet and the Magic Floor and Adjustris. Download a homebrew ROM from its author's page, then run it the same way:
./build/gameboy path/to/game.gbThree options are useful when you play:
--scale 6makes the window bigger. The default is 4.--muteturns sound off.--turboruns as fast as your computer allows for the whole session. Holding Tab does the same for as long as you hold it. Sound is dropped during turbo.
WARNING
gameboy does not write battery saves. A game that saves to its cartridge starts from scratch each time you run it.
Run a CPU test from the terminal
gb_run_rom runs a ROM with no window. Blargg's test ROMs report their result as text, which the runner prints.
./build/gb_run_rom tests/roms/gb-test-roms/cpu_instrs/individual/01-special.gbThe runner prints the name of the loaded ROM, then the text the test sends, which ends in Passed, then a line with the number of cycles and frames it ran. Its exit status is 0 for a pass, 1 for a fail and 2 if the test never gave a verdict.
What you learned
- ROMs are not bundled;
tests/roms/fetch_roms.shdownloads free test ROMs. ./build/gameboy rom.gbopens the window. Arrows, X, Z, Enter and Right Shift are the buttons.- Tab is turbo and Esc quits.
gb_run_romruns test ROMs without a window and reports pass or fail.