Skip to content
Snippets Groups Projects
Verified Commit 5f07f753 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

chore: initial unsafe write and read

parent f6b77b50
No related branches found
No related tags found
1 merge request!31System state save
Pipeline #3298 passed
...@@ -656,6 +656,14 @@ impl Apu { ...@@ -656,6 +656,14 @@ impl Apu {
} }
} }
pub fn read_unsafe(&mut self, addr: u16) -> u8 {
self.read(addr)
}
pub fn write_unsafe(&mut self, addr: u16, value: u8) {
self.write(addr, value);
}
#[inline(always)] #[inline(always)]
pub fn output(&self) -> u8 { pub fn output(&self) -> u8 {
self.ch1_output() + self.ch2_output() + self.ch3_output() + self.ch4_output() self.ch1_output() + self.ch2_output() + self.ch3_output() + self.ch4_output()
......
...@@ -502,6 +502,7 @@ impl Mmu { ...@@ -502,6 +502,7 @@ impl Mmu {
/// Game Boy verifications, allowing deep read of values. /// Game Boy verifications, allowing deep read of values.
pub fn read_unsafe(&mut self, addr: u16) -> u8 { pub fn read_unsafe(&mut self, addr: u16) -> u8 {
match addr { match addr {
0xff10..=0xff3f => self.apu.read_unsafe(addr),
_ => self.read(addr), _ => self.read(addr),
} }
} }
...@@ -512,6 +513,7 @@ impl Mmu { ...@@ -512,6 +513,7 @@ impl Mmu {
/// inaccessible. /// inaccessible.
pub fn write_unsafe(&mut self, addr: u16, value: u8) { pub fn write_unsafe(&mut self, addr: u16, value: u8) {
match addr { match addr {
0xff10..=0xff3f => self.apu.write_unsafe(addr, value),
_ => self.write(addr, value), _ => self.write(addr, value),
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment