finally...
This commit is contained in:
parent
f9915c6ebf
commit
405a47f779
|
@ -40,6 +40,7 @@ pub struct Gpu {
|
||||||
scy: u8,
|
scy: u8,
|
||||||
wx: u8,
|
wx: u8,
|
||||||
wy: u8,
|
wy: u8,
|
||||||
|
prev_stat: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Gpu {
|
impl Gpu {
|
||||||
|
@ -72,6 +73,7 @@ impl Gpu {
|
||||||
scy: 0,
|
scy: 0,
|
||||||
wx: 0,
|
wx: 0,
|
||||||
wy: 0,
|
wy: 0,
|
||||||
|
prev_stat: false,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,12 +127,13 @@ impl Gpu {
|
||||||
self.scanline = 0;
|
self.scanline = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
interrupts.lcd_stat = (self.stat.lyc_eq_ly_interrupt_enabled
|
let this_stat = (self.stat.lyc_eq_ly_interrupt_enabled && (self.lyc == self.scanline))
|
||||||
&& (self.lyc == self.scanline))
|
|
||||||
|| (self.stat.mode_2_interrupt_enabled && (self.stat.mode == DrawMode::Mode2))
|
|| (self.stat.mode_2_interrupt_enabled && (self.stat.mode == DrawMode::Mode2))
|
||||||
|| (self.stat.vblank_interrupt_enabled && (self.stat.mode == DrawMode::VBlank))
|
|| (self.stat.vblank_interrupt_enabled && (self.stat.mode == DrawMode::VBlank))
|
||||||
|| (self.stat.hblank_interrupt_enabled && (self.stat.mode == DrawMode::HBlank));
|
|| (self.stat.hblank_interrupt_enabled && (self.stat.mode == DrawMode::HBlank));
|
||||||
|
|
||||||
|
interrupts.lcd_stat = this_stat & !self.prev_stat;
|
||||||
|
self.prev_stat = this_stat;
|
||||||
interrupts
|
interrupts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue