GB Video: Register LYC during Vblank
Jeffrey Pfau jeffrey@endrift.com
Wed, 27 Jan 2016 23:00:23 -0800
1 files changed,
5 insertions(+),
1 deletions(-)
jump to
M
src/gb/video.c
→
src/gb/video.c
@@ -85,11 +85,11 @@ if (video->nextEvent != INT_MAX) {
video->nextMode -= video->eventDiff; } if (video->nextMode <= 0) { + int lyc = video->p->memory.io[REG_LYC]; 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);@@ -115,6 +115,10 @@ GBUpdateIRQs(video->p);
break; case 1: ++video->ly; + 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_TOTAL_PIXELS) { video->ly = 0; video->renderer->drawScanline(video->renderer, video->ly);