deltabeard / Peanut-GB

A Game Boy (DMG) emulator single header library written in C99. Performance is prioritised over accuracy.
https://projects.deltabeard.com/peanutgb/
276 stars 35 forks source link

gb: Final Fantasy Legend crashes on start #80

Closed deltabeard closed 1 year ago

deltabeard commented 1 year ago

The incorrect execution of the CPU (mostly NOP sliding) starts after the instruction at ROM address 0x02D5 (CALL u16), which calls the address 0x4000. In BGB, the MBC is set to ROM7, but in Peanut-GB, the second ROM bank is still set to 1, causing invalid instructions being executed after the jump to 0x4000.

This game uses MBC2, so this is probably a bug in the Peanut-GB MBC2 logic.

deltabeard commented 1 year ago

ab1203aaaf2e39f33106c4eeb6f0c8105e9f4ccb Final Fantasy Legend is tested working.