all repos — mgba @ 47364e47691f6aa04ad51a11652518e4685391c1

mGBA Game Boy Advance Emulator

GB Video: Implement LYC
Jeffrey Pfau jeffrey@endrift.com
Thu, 21 Jan 2016 19:43:40 -0800
commit

47364e47691f6aa04ad51a11652518e4685391c1

parent

25627bf6a31cee7f1dcf4bb09bec71d0ad3fe388

1 files changed, 6 insertions(+), 2 deletions(-)

jump to
M src/gb/video.csrc/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;