A gameboy emulator with an embedded debugger and a video ram viewer.
Clone and build the projet with the following commands
git clone https://github.com/qoda-dev/qoboy.git
cd qoboy/
cargo build --release
To use the emulator, you have to bring your own boot rom and game rom files. Then you can run the game with the following command:
cargo run <boot_rom_path> <game_rom_path>
The keyboard mapping is defined as follows:
Gameboy control | Keyboard |
---|---|
A | a |
B | s |
start | enter |
select | space |
left | left arrow |
right | right arrow |
up | up arrow |
down | down arrow |
This emulator comes with an embedded video ram viewer and a light debugger which can ease the development of your game or your own emulator by using this one as a reference.
To launch the debugger, add --debug when running your game rom:
cargo run <boot_rom_path> <game_rom_path> --debug
Till now, the debugger can handle the following commands:
command | argument | description |
---|---|---|
run | none | run the cpu until it encounters a breakpoint or a halt command is received |
halt | none | when the cpu is running, halt its execution to the current program counter |
step | none | when the cpu is halted, execute the instruction pointed by the program counter and update the PC to the next instruction |
break_set | address | set a breakpoint to the address |
break_reset | none | reset the breakpoint |
The emulator can manage only one breakpoint and the address passed to the break_set command shall meet the following format:
break_set C012
Where C012 is the program address on which we want to break in hexadecimal format.
When launched with the --debug option, the emulator stops at address 0x0000 by default and waits for a command just like after a halt command has been typed. Type run or step to run your program.
In addition to unit tests for each module, more general functionnal tests are done with blargg's and Acid2 test roms.
Source files can be found here. These roms are used to test general behaviour of CPU, timer and memory subsystems.
Blargg's test rom | Comment | Result |
---|---|---|
cpu_instrs | none | ✔️ |
instr_timing | none | ✔️ |
interrupt_time | need sound to pass | ❌ |
dmg_sound | need sound to pass | ❌ |
oam_bug | not implemented | ❌ |
halt_bug | not implemented | ❌ |
mem_timing | need a clock cycle accurate emulator | ❌ |
mem_timing-2 | need a clock cycle accurate emulator | ❌ |
Source files can be found here. This rom is used to test the PPU unit.
test rom | Comment | Result |
---|---|---|
dmg_acid2 | sprite priority follows GB color behaviour | ❌ |
- implement a gameboy emulator which passes all cpu_instr and instr_timing tests
- add support to no_mbc / mbc1 / mbc3 cartridge types
- implement a lightweight debugger
- implement a vram viewer
- fix sprite priority to pass ACID2 test
- add possibility to save a game
- use winit and softbuffer instead of minifb (which is not as stable as expected)