Compare commits

..

No commits in common. "9964b49ce1fc94f6bd56475111c088da4b8cbab4" and "1001b0b124eae6bfe13f9199637dc8ae52c93f47" have entirely different histories.

2 changed files with 18 additions and 17 deletions

View File

@ -325,7 +325,7 @@ impl Ppu {
if self.ctrl.window_enabled()
&& !self.window_stat.should_draw()
&& self.window_stat.coincidence()
&& self.x_pos as i16 >= self.pos.window_x as i16 - 7
&& self.x_pos as i8 as i16 >= self.pos.window_x as i8 as i16 - 7
{
self.window_stat.set_should_draw(true);
self.fetch.back.reset();
@ -700,7 +700,7 @@ impl PixelFetcher {
let id = self.back.tile.id.expect("Tile Number is present");
let tile_data_addr = match control.tile_data_addr() {
TileDataAddress::X8800 => 0x9000u16.wrapping_add((id as i8 as i16 * 16) as u16),
TileDataAddress::X8800 => 0x9000u16.wrapping_add(((id as i8 as i16) * 16) as u16),
TileDataAddress::X8000 => 0x8000 + (id as u16 * 16),
};

View File

@ -21,6 +21,17 @@ impl Timer {
use State::*;
use TimerSpeed::*;
match self.state {
TIMAOverflow(_) | AbortedTIMAOverflow(_) => self.next(),
LoadTMA => {
self.counter = self.modulo;
self.interrupt = true;
self.next();
}
Normal => {}
}
self.divider = self.divider.wrapping_add(1);
// Get Bit Position
@ -42,17 +53,6 @@ impl Timer {
}
self.and_result = Some(new_result);
match self.state {
TIMAOverflow(_) | AbortedTIMAOverflow(_) => self.next(),
LoadTIMA => {
self.counter = self.modulo;
self.interrupt = true;
self.next();
}
Normal => {}
}
}
/// 0xFF05 | TIMA - Timer Counter
@ -70,7 +70,7 @@ impl Timer {
self.counter = byte;
self.state = AbortedTIMAOverflow(step);
}
LoadTIMA => { /* Ignored */ }
LoadTMA => {}
}
}
@ -95,8 +95,9 @@ impl Timer {
use State::*;
self.state = match self.state {
Normal | LoadTIMA | AbortedTIMAOverflow(3) => Normal,
TIMAOverflow(3) => LoadTIMA,
Normal | LoadTMA => Normal,
AbortedTIMAOverflow(4) => Normal,
TIMAOverflow(4) => LoadTMA,
AbortedTIMAOverflow(step) => AbortedTIMAOverflow(step + 1),
TIMAOverflow(step) => TIMAOverflow(step + 1),
}
@ -180,5 +181,5 @@ enum State {
TIMAOverflow(u8),
AbortedTIMAOverflow(u8),
Normal,
LoadTIMA,
LoadTMA,
}