finally...

This commit is contained in:
Alex Janka 2023-03-03 13:33:44 +11:00
parent f9915c6ebf
commit 405a47f779

View file

@ -40,6 +40,7 @@ pub struct Gpu {
scy: u8,
wx: u8,
wy: u8,
prev_stat: bool,
}
impl Gpu {
@ -72,6 +73,7 @@ impl Gpu {
scy: 0,
wx: 0,
wy: 0,
prev_stat: false,
}
}
@ -125,12 +127,13 @@ impl Gpu {
self.scanline = 0;
}
interrupts.lcd_stat = (self.stat.lyc_eq_ly_interrupt_enabled
&& (self.lyc == self.scanline))
let this_stat = (self.stat.lyc_eq_ly_interrupt_enabled && (self.lyc == self.scanline))
|| (self.stat.mode_2_interrupt_enabled && (self.stat.mode == DrawMode::Mode2))
|| (self.stat.vblank_interrupt_enabled && (self.stat.mode == DrawMode::VBlank))
|| (self.stat.hblank_interrupt_enabled && (self.stat.mode == DrawMode::HBlank));
interrupts.lcd_stat = this_stat & !self.prev_stat;
self.prev_stat = this_stat;
interrupts
}