chore: rename a couple of interrupt instances to "int" instead of
"interrupt"
This commit is contained in:
parent
7c9bff61f6
commit
62bd88945f
30
src/bus.rs
30
src/bus.rs
|
@ -20,7 +20,7 @@ pub struct Bus {
|
||||||
wram: WorkRam,
|
wram: WorkRam,
|
||||||
vwram: VariableWorkRam,
|
vwram: VariableWorkRam,
|
||||||
timer: Timer,
|
timer: Timer,
|
||||||
interrupt: Interrupt,
|
int: Interrupt,
|
||||||
sound: Sound,
|
sound: Sound,
|
||||||
hram: HighRam,
|
hram: HighRam,
|
||||||
serial: Serial,
|
serial: Serial,
|
||||||
|
@ -36,7 +36,7 @@ impl Default for Bus {
|
||||||
wram: Default::default(),
|
wram: Default::default(),
|
||||||
vwram: Default::default(),
|
vwram: Default::default(),
|
||||||
timer: Default::default(),
|
timer: Default::default(),
|
||||||
interrupt: Default::default(),
|
int: Default::default(),
|
||||||
sound: Default::default(),
|
sound: Default::default(),
|
||||||
hram: Default::default(),
|
hram: Default::default(),
|
||||||
serial: Default::default(),
|
serial: Default::default(),
|
||||||
|
@ -64,9 +64,9 @@ impl Bus {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn step(&mut self, cycles: Cycle) {
|
pub fn step(&mut self, cycles: Cycle) {
|
||||||
|
self.ppu.step(cycles);
|
||||||
self.timer.step(cycles);
|
self.timer.step(cycles);
|
||||||
self.sound.step(cycles);
|
self.sound.step(cycles);
|
||||||
self.ppu.step(cycles);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@ impl Bus {
|
||||||
}
|
}
|
||||||
0xFFFF => {
|
0xFFFF => {
|
||||||
// Interrupts Enable Register
|
// Interrupts Enable Register
|
||||||
self.interrupt.enable.into()
|
self.int.enable.into()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -266,7 +266,7 @@ impl Bus {
|
||||||
}
|
}
|
||||||
0xFFFF => {
|
0xFFFF => {
|
||||||
// Interrupts Enable Register
|
// Interrupts Enable Register
|
||||||
self.interrupt.enable = byte.into();
|
self.int.enable = byte.into();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -284,8 +284,8 @@ impl Bus {
|
||||||
impl Bus {
|
impl Bus {
|
||||||
fn interrupt_flag(&self) -> InterruptFlag {
|
fn interrupt_flag(&self) -> InterruptFlag {
|
||||||
// Read the current interrupt information from the PPU
|
// Read the current interrupt information from the PPU
|
||||||
let vblank = self.ppu.interrupt.vblank();
|
let vblank = self.ppu.int.vblank();
|
||||||
let lcd_stat = self.ppu.interrupt.lcd_stat();
|
let lcd_stat = self.ppu.int.lcd_stat();
|
||||||
|
|
||||||
// Read the current interrupt information from the Joypad
|
// Read the current interrupt information from the Joypad
|
||||||
let joypad = self.joypad.interrupt();
|
let joypad = self.joypad.interrupt();
|
||||||
|
@ -294,7 +294,7 @@ impl Bus {
|
||||||
let timer = self.timer.interrupt();
|
let timer = self.timer.interrupt();
|
||||||
|
|
||||||
// Copy the Interrupt Flag register 0xFF0F
|
// Copy the Interrupt Flag register 0xFF0F
|
||||||
let mut flag = self.interrupt.flag;
|
let mut flag = self.int.flag;
|
||||||
|
|
||||||
// Update the flag to have the most accurate information
|
// Update the flag to have the most accurate information
|
||||||
flag.set_vblank(vblank);
|
flag.set_vblank(vblank);
|
||||||
|
@ -306,16 +306,16 @@ impl Bus {
|
||||||
|
|
||||||
fn set_interrupt_flag(&mut self, byte: u8) {
|
fn set_interrupt_flag(&mut self, byte: u8) {
|
||||||
// Update the Interrupt register 0xFF0F
|
// Update the Interrupt register 0xFF0F
|
||||||
self.interrupt.flag = byte.into();
|
self.int.flag = byte.into();
|
||||||
|
|
||||||
let vblank = self.interrupt.flag.vblank();
|
let vblank = self.int.flag.vblank();
|
||||||
let lcd_stat = self.interrupt.flag.lcd_stat();
|
let lcd_stat = self.int.flag.lcd_stat();
|
||||||
let joypad = self.interrupt.flag.joypad();
|
let joypad = self.int.flag.joypad();
|
||||||
let timer = self.interrupt.flag.timer();
|
let timer = self.int.flag.timer();
|
||||||
|
|
||||||
// Update the PPU's instance of the following interrupts
|
// Update the PPU's instance of the following interrupts
|
||||||
self.ppu.interrupt.set_vblank(vblank);
|
self.ppu.int.set_vblank(vblank);
|
||||||
self.ppu.interrupt.set_lcd_stat(lcd_stat);
|
self.ppu.int.set_lcd_stat(lcd_stat);
|
||||||
|
|
||||||
// Update the Joypad's instance of the following interrupts
|
// Update the Joypad's instance of the following interrupts
|
||||||
self.joypad.set_interrupt(joypad);
|
self.joypad.set_interrupt(joypad);
|
||||||
|
|
14
src/ppu.rs
14
src/ppu.rs
|
@ -14,7 +14,7 @@ const BLACK: [u8; 4] = [0x00, 0x00, 0x00, 0x00];
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct Ppu {
|
pub struct Ppu {
|
||||||
pub interrupt: Interrupt,
|
pub int: Interrupt,
|
||||||
pub lcd_control: LCDControl,
|
pub lcd_control: LCDControl,
|
||||||
pub monochrome: Monochrome,
|
pub monochrome: Monochrome,
|
||||||
pub pos: ScreenPosition,
|
pub pos: ScreenPosition,
|
||||||
|
@ -57,7 +57,7 @@ impl Ppu {
|
||||||
self.cycles %= 172;
|
self.cycles %= 172;
|
||||||
|
|
||||||
if self.stat.hblank_int() {
|
if self.stat.hblank_int() {
|
||||||
self.interrupt.set_lcd_stat(true);
|
self.int.set_lcd_stat(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.stat.set_mode(Mode::HBlank);
|
self.stat.set_mode(Mode::HBlank);
|
||||||
|
@ -71,16 +71,16 @@ impl Ppu {
|
||||||
self.pos.line_y += 1;
|
self.pos.line_y += 1;
|
||||||
|
|
||||||
let next_mode = if self.pos.line_y >= 144 {
|
let next_mode = if self.pos.line_y >= 144 {
|
||||||
self.interrupt.set_vblank(true);
|
self.int.set_vblank(true);
|
||||||
|
|
||||||
if self.stat.vblank_int() {
|
if self.stat.vblank_int() {
|
||||||
self.interrupt.set_lcd_stat(true);
|
self.int.set_lcd_stat(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Mode::VBlank
|
Mode::VBlank
|
||||||
} else {
|
} else {
|
||||||
if self.stat.oam_int() {
|
if self.stat.oam_int() {
|
||||||
self.interrupt.set_lcd_stat(true);
|
self.int.set_lcd_stat(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
Mode::OamScan
|
Mode::OamScan
|
||||||
|
@ -105,7 +105,7 @@ impl Ppu {
|
||||||
self.pos.line_y = 0;
|
self.pos.line_y = 0;
|
||||||
|
|
||||||
if self.stat.oam_int() {
|
if self.stat.oam_int() {
|
||||||
self.interrupt.set_lcd_stat(true);
|
self.int.set_lcd_stat(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.stat.set_mode(Mode::OamScan);
|
self.stat.set_mode(Mode::OamScan);
|
||||||
|
@ -179,7 +179,7 @@ impl Ppu {
|
||||||
impl Default for Ppu {
|
impl Default for Ppu {
|
||||||
fn default() -> Self {
|
fn default() -> Self {
|
||||||
Self {
|
Self {
|
||||||
interrupt: Interrupt::default(),
|
int: Interrupt::default(),
|
||||||
lcd_control: Default::default(),
|
lcd_control: Default::default(),
|
||||||
monochrome: Default::default(),
|
monochrome: Default::default(),
|
||||||
pos: Default::default(),
|
pos: Default::default(),
|
||||||
|
|
Loading…
Reference in New Issue