pineman / fpt

Gameboy emulator (yes, written in rust)
https://pineman.github.io/fpt
MIT License
5 stars 1 forks source link

Initialize CPU and hardware registers to post-bootrom values #50

Closed diogotito closed 2 months ago

diogotito commented 2 months ago

I used the values found at https://gbdev.io/pandocs/Power_Up_Sequence.html#console-state-after-boot-rom-hand-off.

I also moved these values from the LR35902 constructor to the fpt library crate root module, in a Gameboy method, that is optionally called from fpt-cli by passing --fake-bootrom dmg0 as the first argument in the CLI (maybe this should be the default, instead of fully emulating the bootrom?)

I'm open to other ways of modeling other bootrom values, or going with a simpler approach (maybe it's too early for a struct GameboyConfig in fpt-cli?).

diogotito commented 2 months ago

can we apply this for fpt-egui too please?

Done.

The logic is a bit duplicated. Maybe we could generalize fpt-cli's GameboyOptions into a GameboyBuilder in project fpt, and derive some clap traits on it, but I don't know about adding the clap dependency on fpt.

btw fpt-egui is building with errors, but they should be fixed when overall work on #47 (which this PR complements) finishes.