all repos — mgba @ 1589b26ade442d1779ac339ca1e1b56b17fede27

mGBA Game Boy Advance Emulator

GB Video: Register LYC during Vblank
Jeffrey Pfau jeffrey@endrift.com
Wed, 27 Jan 2016 23:00:23 -0800
commit

1589b26ade442d1779ac339ca1e1b56b17fede27

parent

b9e6ac954d606130f968878138163e304fdaa4c4

1 files changed, 5 insertions(+), 1 deletions(-)

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