Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pokemon Gold: Invalid data written to VRAM #3

Open
aksiksi opened this issue Feb 1, 2021 · 1 comment
Open

Pokemon Gold: Invalid data written to VRAM #3

aksiksi opened this issue Feb 1, 2021 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@aksiksi
Copy link
Owner

aksiksi commented Feb 1, 2021

Right after the player first appears, some tiles get invalid tile attributes written to bank 1 of VRAM. The data should have been written to bank 0. For some reason, these invalid writes to the tile map area only occur for 3 lines worth of tiles. Also, the failure is intermittent, even for the same save state.

gbcemu_lowG4G9HlZ

In BGB, writing to the tilemap takes place in this function:

0x20E6: ld de, 0xC3A0
...
0x20F5: ld (0xFF4F), a ; VRAM bank 1
...
0x2101: ldi (hl), a ; write to tilemap
...
0x210F: ld (0xFF4F), a ; VRAM bank 0
...
0x2111: ret

The callstack to get here is:

??: rst 08
0x0008: jp 0x2E27
0x2E27: ld (0xD156), a
...
0x2E31: call 0x2E48
0x2E48: jp (HL) ; passed in prior to rst
??: call 20C3
0x20C3: call 20E6
@aksiksi aksiksi added the bug Something isn't working label Feb 1, 2021
@aksiksi
Copy link
Owner Author

aksiksi commented Feb 2, 2021

Refer to disassembly here: https://github.com/pret/pokegold

@aksiksi aksiksi self-assigned this Mar 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant