mirror of https://github.com/mgba-emu/mgba.git
GB Video: Setting LYC=LY during mode 2 should trigger an IRQ
This commit is contained in:
parent
575a37fd83
commit
1cb054ec67
1
CHANGES
1
CHANGES
|
@ -1,6 +1,7 @@
|
|||
0.6.0: (Future)
|
||||
Bugfixes:
|
||||
- GB MBC: Fix MBC7 when size is incorrectly specified
|
||||
- GB Video: Setting LYC=LY during mode 2 should trigger an IRQ
|
||||
Misc:
|
||||
- All: Only update version info if needed
|
||||
|
||||
|
|
|
@ -341,7 +341,6 @@ void GBIOWrite(struct GB* gb, unsigned address, uint8_t value) {
|
|||
case REG_SB:
|
||||
case REG_TIMA:
|
||||
case REG_TMA:
|
||||
case REG_LYC:
|
||||
// Handled transparently by the registers
|
||||
break;
|
||||
case REG_TAC:
|
||||
|
@ -357,6 +356,9 @@ void GBIOWrite(struct GB* gb, unsigned address, uint8_t value) {
|
|||
value = gb->video.renderer->writeVideoRegister(gb->video.renderer, address, value);
|
||||
GBVideoWriteLCDC(&gb->video, value);
|
||||
break;
|
||||
case REG_LYC:
|
||||
GBVideoWriteLYC(&gb->video, value);
|
||||
break;
|
||||
case REG_DMA:
|
||||
GBMemoryDMA(gb, value << 8);
|
||||
break;
|
||||
|
|
|
@ -312,6 +312,16 @@ void GBVideoWriteSTAT(struct GBVideo* video, GBRegisterSTAT value) {
|
|||
}
|
||||
}
|
||||
|
||||
void GBVideoWriteLYC(struct GBVideo* video, uint8_t value) {
|
||||
if (video->mode == 2) {
|
||||
video->stat = GBRegisterSTATSetLYC(video->stat, value == video->ly);
|
||||
if (GBRegisterSTATIsLYCIRQ(video->stat) && value == video->ly) {
|
||||
video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT);
|
||||
GBUpdateIRQs(video->p);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void GBVideoWritePalette(struct GBVideo* video, uint16_t address, uint8_t value) {
|
||||
static const uint16_t dmgPalette[4] = { 0x7FFF, 0x56B5, 0x294A, 0x0000};
|
||||
if (video->p->model < GB_MODEL_CGB) {
|
||||
|
|
|
@ -135,6 +135,7 @@ void GBVideoProcessDots(struct GBVideo* video);
|
|||
|
||||
void GBVideoWriteLCDC(struct GBVideo* video, GBRegisterLCDC value);
|
||||
void GBVideoWriteSTAT(struct GBVideo* video, GBRegisterSTAT value);
|
||||
void GBVideoWriteLYC(struct GBVideo* video, uint8_t value);
|
||||
void GBVideoWritePalette(struct GBVideo* video, uint16_t address, uint8_t value);
|
||||
void GBVideoSwitchBank(struct GBVideo* video, uint8_t value);
|
||||
|
||||
|
|
Loading…
Reference in New Issue