mirror of
https://github.com/FranLMSP/snes.git
synced 2026-10-03 16:05:18 -04:00
WIP PPU structure
This commit is contained in:
@@ -2,19 +2,19 @@ use super::registers::PPURegisters;
|
||||
|
||||
pub struct PPU {
|
||||
framebuffer: Vec<u8>,
|
||||
registers: PPURegisters,
|
||||
pub registers: PPURegisters,
|
||||
}
|
||||
|
||||
impl PPU {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
framebuffer: vec![],
|
||||
registers: PPURegisters,
|
||||
registers: PPURegisters::new(),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn tick(&mut self, cycles: usize) {
|
||||
for _ in 0..cycles {
|
||||
pub fn tick(&mut self, cpu_cycles: usize) {
|
||||
for _ in 0..cpu_cycles {
|
||||
self.do_cycle();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,10 +61,21 @@ pub const TMW: u16 = 0x212E; // Window Area Main Screen Disable (W)
|
||||
pub const TSW: u16 = 0x212F; // Window Area Sub Screen Disable (W)
|
||||
|
||||
pub struct PPURegisters {
|
||||
|
||||
data: [u8; 256],
|
||||
}
|
||||
|
||||
impl PPURegisters {
|
||||
pub fn new() -> Self {
|
||||
Self {
|
||||
data: [0x00; 256],
|
||||
}
|
||||
}
|
||||
|
||||
pub fn read(&self, address: u16) -> u8 {
|
||||
self.data[(address as usize) - 0x2100]
|
||||
}
|
||||
|
||||
pub fn write(&mut self, address: u16, value: u8) {
|
||||
self.data[(address as usize) - 0x2100] = value;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user