0dmg

Learning Rust by building a partial Game Boy emulator.

This project is maintained by jeremyBanks

Update

I’ve been grinding out opcodes, after a bit of refactoring so they’re a little cleaner to implement:

op(0x7E, |gb| {
    let a0 = gb.a();
    let hl = gb.hl();
    let a1 = gb.get_memory(hl);
    gb.set_a(a1);
    (
        format!("LD A, (HL)"),
        format!("A₀ = ${:02x}, HL = ${:04x}, (HL) = ${:04x}", a0, hl, a1),
    )
});

The code is writing to a new section of memory: the audio registers and buffers! But I’m not planning to support that yet, so I can get away with:

} else if 0xFF10 <= address && address <= 0xFF26 {
    println!("  ; skipping write to sound control memory -- not implemented");
}

IO UI

How do I want to do I/O – initially just meaning video output – for this thing?

To me, the simplest thing is probably a tiny web server that pushes frames over a websocket. A real GUI framework might be neccessary for a real emulator, but we don’t need much. https://ws-rs.org/guide

I’ve gone and thrown together a web page UI (not connected to anything yet) at https://gb-io.glitch.me/. It’s designed to look a bit like my first game boy: an “Ice Blue” Game Boy Pocket. That was fun.