devkitPro / libgba

C Library for Nintendo GBA
http://devkitpro.org/viewforum.php?f=5
Other
192 stars 26 forks source link

Replace invalid CpuFastSet() in console #12

Closed AntonioND closed 1 year ago

AntonioND commented 2 years ago

This BIOS call can only copy in units of 8 words (32 bytes). A row is 30 entries, 2 bytes each, so the final size is 60 bytes. This isn't a valid size for this BIOS call.

It happened to work because it copied 64 bytes instead of 60, and the additional 4 bytes are just the unused space of the background outside of the screen.

CpuSet() doesn't copy 8 words in a row, so it is possible to use it instead of CpuFastSet().

AntonioND commented 2 years ago

I detected this issue because my GBA emulator didn't emulate the behaviour of CpuFastSet() correctly, so the call only copied 32 bytes, and only half of the console was scrolling.