mattrberry/crab

wrong mask for 8bit write to ppu

ITotalJustice opened this issue · 1 comments

(opening this here so you dont forget, also to link this issue for other emudevs with the same bug)

https://github.com/mattrberry/crab/blob/master/src/crab/gba/bus.cr#L173

from gbatek:

Writes to OBJ (6010000h-6017FFFh) (or 6014000h-6017FFFh in Bitmap mode) and to OAM (7000000h-70003FFh) are ignored, the memory content remains unchanged.
Writes to BG (6000000h-600FFFFh) (or 6000000h-6013FFFh in Bitmap mode) and to Palette (5000000h-50003FFh) are writing the new 8bit value to BOTH upper and lower 8bits of the addressed halfword, ie. "[addr AND NOT 1]=data*101h".

with the mask you currently have, it results in an imagine like this

screen_record-2022-03-25_02.33.33.mp4

here's an implementation of the masking if you need a reference https://github.com/ITotalJustice/notorious_beeg/blob/57e87ed423233709883f6b15693b1057d252e95e/src/core/mem.cpp#L592.

Fixed in 0f21ea6. Thanks for the detailed report!!