Closed EvilJagaGenius closed 2 years ago
The hack is constantly doing invalid VRAM writes. I've read it doesn't even work on real hardware (haven't checked myself).
Slight progress on this, seems to be getting stuck in an infinite loop with GB instruction CALL $402D (address 0x08400a in the patched ROM)
I can't debug GBA, however...
I don't think it's an infinite loop. At 21:4004
, the game is trying to set CGB double speed mode:
ld a, KEY1F_PREPARE
ldh [rKEY1], a
stop ;needed
That stop
is required according to Pandocs. It stops for 2050 cycles then wakes up.
All games (including DX hacks) that use double speed mode work in Goomba Color, so I'm not sure if that's the problem :-/
No, it's emulating the stop fine, it just screws up the call instruction; the location it jumps to is 0x4000 less than where it needs to be. Think I've made some more progress though.
Took a look at this website, talking about bank switching with MBC1: https://b13rg.github.io/Gameboy-Bank-Switching/
Writing a value to this address range will select the lower 5 bits of the bank number. There are a few special cases though. If the value $00 is written, it will converted to bank $01. This is not an issue because bank $00 is always present at $0000-$3FFF. The issue lies in writing the values $20, $40, and $60. When these values are written, instead of addressing the correct ROM banks they will address banks $21$41 and $61 respectively. I couldn’t find an explanation of why this takes place, but I assume it has something to do with how the lower 5 bits are used when choosing the bank. Each of these numbers have all zeros as the lower 5 bits (0x0XX00000). This issue is not present in MBC2 and MBC3.
Wario Land (and the DX hack) uses MBC1, so I added a quick check in the map4567_ function, cart.s:751.
@----------------------------------------------------------------------------
map4567_:
@----------------------------------------------------------------------------
tst r0,#0x1f @ r0 = rom bank, check the lower 5 bits
addeq r0,r0,#1 @ If 0s, add 1
ldr_ r1,rommask @ Continue as normal
...
When I add this, the hack boots and seems to behave, but I'm afraid it'll screw up other games since it's an MBC1-specific glitch. Need to add another check so it only executes for MBC1.
Should be fixed in v0.5, closing the issue.
https://www.romhacking.net/hacks/6683/
Wario Land runs fine on Goomba Color, but this hack gives a black screen and won't start.
(For those wondering about the lack of activity, I've been job hunting and haven't found the time or space to work on Jagoomba. Hopefully that'll change, but thanks for your patience in the meantime.)