mirror of https://github.com/mgba-emu/mgba.git
GB: Palette I/O fixes
This commit is contained in:
parent
ca46fedd34
commit
74caccd6df
|
@ -408,7 +408,7 @@ void GBIOWrite(struct GB* gb, unsigned address, uint8_t value) {
|
|||
case REG_BCPD:
|
||||
GBVideoProcessDots(&gb->video);
|
||||
GBVideoWritePalette(&gb->video, address, value);
|
||||
break;
|
||||
return;
|
||||
case REG_OCPS:
|
||||
gb->video.ocpIndex = value & 0x3F;
|
||||
gb->video.ocpIncrement = value & 0x80;
|
||||
|
@ -417,7 +417,7 @@ void GBIOWrite(struct GB* gb, unsigned address, uint8_t value) {
|
|||
case REG_OCPD:
|
||||
GBVideoProcessDots(&gb->video);
|
||||
GBVideoWritePalette(&gb->video, address, value);
|
||||
break;
|
||||
return;
|
||||
case REG_SVBK:
|
||||
GBMemorySwitchWramBank(&gb->memory, value);
|
||||
value = gb->memory.wramCurrentBank;
|
||||
|
@ -537,7 +537,9 @@ uint8_t GBIORead(struct GB* gb, unsigned address) {
|
|||
case REG_HDMA3:
|
||||
case REG_HDMA4:
|
||||
case REG_HDMA5:
|
||||
case REG_BCPS:
|
||||
case REG_BCPD:
|
||||
case REG_OCPS:
|
||||
case REG_OCPD:
|
||||
case REG_SVBK:
|
||||
// Handled transparently by the registers
|
||||
|
|
|
@ -354,7 +354,9 @@ void GBVideoWritePalette(struct GBVideo* video, uint16_t address, uint8_t value)
|
|||
if (video->bcpIncrement) {
|
||||
++video->bcpIndex;
|
||||
video->bcpIndex &= 0x3F;
|
||||
video->p->memory.io[REG_BCPD] = video->palette[video->bcpIndex >> 1];
|
||||
video->p->memory.io[REG_BCPS] &= 0x80;
|
||||
video->p->memory.io[REG_BCPS] |= video->bcpIndex;
|
||||
video->p->memory.io[REG_BCPD] = video->palette[video->bcpIndex >> 1] >> (8 * (video->bcpIndex & 1));
|
||||
}
|
||||
break;
|
||||
case REG_OCPD:
|
||||
|
@ -369,7 +371,9 @@ void GBVideoWritePalette(struct GBVideo* video, uint16_t address, uint8_t value)
|
|||
if (video->ocpIncrement) {
|
||||
++video->ocpIndex;
|
||||
video->ocpIndex &= 0x3F;
|
||||
video->p->memory.io[REG_OCPD] = video->palette[8 * 4 + (video->ocpIndex >> 1)];
|
||||
video->p->memory.io[REG_OCPS] &= 0x80;
|
||||
video->p->memory.io[REG_OCPS] |= video->ocpIndex;
|
||||
video->p->memory.io[REG_OCPD] = video->palette[8 * 4 + (video->ocpIndex >> 1)] >> (8 * (video->ocpIndex & 1));
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue