GB Video: Implement LYC
Jeffrey Pfau jeffrey@endrift.com
Thu, 21 Jan 2016 19:43:40 -0800
1 files changed,
6 insertions(+),
2 deletions(-)
jump to
M
src/gb/video.c
→
src/gb/video.c
@@ -88,13 +88,17 @@ switch (video->mode) {
case 0: ++video->ly; video->p->memory.io[REG_LY] = video->ly; + int lyc = video->p->memory.io[REG_LYC]; + video->stat = GBRegisterSTATSetLYC(video->stat, lyc == video->ly); + if (GBRegisterSTATIsLYCIRQ(video->stat) && lyc == video->ly) { + video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT); + } if (video->ly < GB_VIDEO_VERTICAL_PIXELS) { video->renderer->drawScanline(video->renderer, video->ly); video->nextMode = GB_VIDEO_MODE_2_LENGTH; video->mode = 2; if (GBRegisterSTATIsOAMIRQ(video->stat)) { video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT); - GBUpdateIRQs(video->p); } } else { video->nextMode = GB_VIDEO_HORIZONTAL_LENGTH;@@ -105,8 +109,8 @@ if (GBRegisterSTATIsVblankIRQ(video->stat)) {
video->p->memory.io[REG_IF] |= (1 << GB_IRQ_LCDSTAT); } video->p->memory.io[REG_IF] |= (1 << GB_IRQ_VBLANK); - GBUpdateIRQs(video->p); } + GBUpdateIRQs(video->p); break; case 1: ++video->ly;