chore(ppu): rename discriminants of fetcher state
This commit is contained in:
parent
1acb5de19d
commit
e27d6dc25b
58
src/ppu.rs
58
src/ppu.rs
|
@ -252,10 +252,10 @@ impl Ppu {
|
||||||
match self.fetch.obj.state {
|
match self.fetch.obj.state {
|
||||||
TileNumber => {
|
TileNumber => {
|
||||||
self.fetch.obj.tile.with_id(attr.tile_index);
|
self.fetch.obj.tile.with_id(attr.tile_index);
|
||||||
self.fetch.obj.next(ToLowByteSleep);
|
self.fetch.obj.next(SleepOne);
|
||||||
}
|
}
|
||||||
ToLowByteSleep => self.fetch.obj.next(TileLowByte),
|
SleepOne => self.fetch.obj.next(TileLow),
|
||||||
TileLowByte => {
|
TileLow => {
|
||||||
let obj_size = self.ctrl.obj_size();
|
let obj_size = self.ctrl.obj_size();
|
||||||
|
|
||||||
let addr = PixelFetcher::get_obj_addr(&attr, &self.pos, obj_size);
|
let addr = PixelFetcher::get_obj_addr(&attr, &self.pos, obj_size);
|
||||||
|
@ -263,10 +263,10 @@ impl Ppu {
|
||||||
let byte = self.read_byte(addr);
|
let byte = self.read_byte(addr);
|
||||||
self.fetch.obj.tile.with_low_byte(byte);
|
self.fetch.obj.tile.with_low_byte(byte);
|
||||||
|
|
||||||
self.fetch.obj.next(ToHighByteSleep);
|
self.fetch.obj.next(SleepTwo);
|
||||||
}
|
}
|
||||||
ToHighByteSleep => self.fetch.obj.next(TileHighByte),
|
SleepTwo => self.fetch.obj.next(TileHigh),
|
||||||
TileHighByte => {
|
TileHigh => {
|
||||||
let obj_size = self.ctrl.obj_size();
|
let obj_size = self.ctrl.obj_size();
|
||||||
|
|
||||||
let addr = PixelFetcher::get_obj_addr(&attr, &self.pos, obj_size);
|
let addr = PixelFetcher::get_obj_addr(&attr, &self.pos, obj_size);
|
||||||
|
@ -274,10 +274,10 @@ impl Ppu {
|
||||||
let byte = self.read_byte(addr + 1);
|
let byte = self.read_byte(addr + 1);
|
||||||
self.fetch.obj.tile.with_high_byte(byte);
|
self.fetch.obj.tile.with_high_byte(byte);
|
||||||
|
|
||||||
self.fetch.obj.next(ToFifoSleep);
|
self.fetch.obj.next(SleepThree);
|
||||||
}
|
}
|
||||||
ToFifoSleep => self.fetch.obj.next(SendToFifoOne),
|
SleepThree => self.fetch.obj.next(ToFifoOne),
|
||||||
SendToFifoOne => {
|
ToFifoOne => {
|
||||||
// Load into Fifo
|
// Load into Fifo
|
||||||
let (high, low) = self
|
let (high, low) = self
|
||||||
.fetch
|
.fetch
|
||||||
|
@ -314,9 +314,9 @@ impl Ppu {
|
||||||
self.fifo.resume();
|
self.fifo.resume();
|
||||||
self.obj_buffer.remove(&attr);
|
self.obj_buffer.remove(&attr);
|
||||||
|
|
||||||
self.fetch.obj.next(SendToFifoTwo);
|
self.fetch.obj.next(ToFifoTwo);
|
||||||
}
|
}
|
||||||
SendToFifoTwo => self.fetch.obj.reset(),
|
ToFifoTwo => self.fetch.obj.reset(),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,31 +346,31 @@ impl Ppu {
|
||||||
self.fetch.back.tile.with_id(id);
|
self.fetch.back.tile.with_id(id);
|
||||||
|
|
||||||
// Move on to the Next state in 2 T-cycles
|
// Move on to the Next state in 2 T-cycles
|
||||||
self.fetch.back.next(ToLowByteSleep);
|
self.fetch.back.next(SleepOne);
|
||||||
}
|
}
|
||||||
ToLowByteSleep => self.fetch.back.next(TileLowByte),
|
SleepOne => self.fetch.back.next(TileLow),
|
||||||
TileLowByte => {
|
TileLow => {
|
||||||
let addr = self.fetch.bg_byte_addr(&self.ctrl, &self.pos);
|
let addr = self.fetch.bg_byte_addr(&self.ctrl, &self.pos);
|
||||||
|
|
||||||
let low = self.read_byte(addr);
|
let low = self.read_byte(addr);
|
||||||
self.fetch.back.tile.with_low_byte(low);
|
self.fetch.back.tile.with_low_byte(low);
|
||||||
|
|
||||||
self.fetch.back.next(ToHighByteSleep);
|
self.fetch.back.next(SleepTwo);
|
||||||
}
|
}
|
||||||
ToHighByteSleep => self.fetch.back.next(TileHighByte),
|
SleepTwo => self.fetch.back.next(TileHigh),
|
||||||
TileHighByte => {
|
TileHigh => {
|
||||||
let addr = self.fetch.bg_byte_addr(&self.ctrl, &self.pos);
|
let addr = self.fetch.bg_byte_addr(&self.ctrl, &self.pos);
|
||||||
|
|
||||||
let high = self.read_byte(addr + 1);
|
let high = self.read_byte(addr + 1);
|
||||||
self.fetch.back.tile.with_high_byte(high);
|
self.fetch.back.tile.with_high_byte(high);
|
||||||
|
|
||||||
self.fetch.back.next(ToFifoSleep);
|
self.fetch.back.next(SleepThree);
|
||||||
}
|
}
|
||||||
ToFifoSleep => self.fetch.back.next(SendToFifoOne),
|
SleepThree => self.fetch.back.next(ToFifoOne),
|
||||||
SendToFifoOne => {
|
ToFifoOne => {
|
||||||
self.fetch.back.next(SendToFifoTwo);
|
self.fetch.back.next(ToFifoTwo);
|
||||||
}
|
}
|
||||||
SendToFifoTwo => {
|
ToFifoTwo => {
|
||||||
if let Ok(()) = self.fetch.send_to_fifo(&mut self.fifo) {
|
if let Ok(()) = self.fetch.send_to_fifo(&mut self.fifo) {
|
||||||
self.fetch.x_pos += 1;
|
self.fetch.x_pos += 1;
|
||||||
self.fetch.back.next(TileNumber);
|
self.fetch.back.next(TileNumber);
|
||||||
|
@ -903,13 +903,13 @@ impl WindowLineCounter {
|
||||||
#[derive(Debug, Clone, Copy)]
|
#[derive(Debug, Clone, Copy)]
|
||||||
enum FetcherState {
|
enum FetcherState {
|
||||||
TileNumber,
|
TileNumber,
|
||||||
ToLowByteSleep,
|
SleepOne,
|
||||||
TileLowByte,
|
TileLow,
|
||||||
ToHighByteSleep,
|
SleepTwo,
|
||||||
TileHighByte,
|
TileHigh,
|
||||||
ToFifoSleep,
|
SleepThree,
|
||||||
SendToFifoOne,
|
ToFifoOne,
|
||||||
SendToFifoTwo,
|
ToFifoTwo,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Default for FetcherState {
|
impl Default for FetcherState {
|
||||||
|
|
Loading…
Reference in New Issue