object attribute memory

This commit is contained in:
Alex Janka 2023-01-17 09:39:05 +11:00
parent 2fd4266156
commit 7bf1034265

View file

@ -48,6 +48,7 @@ pub struct Memory {
ram: [u8; 8192],
switchable_ram: [u8; 8192],
cpu_ram: [u8; 128],
oam: [u8; 160],
}
impl Memory {
@ -58,6 +59,7 @@ impl Memory {
ram: [0x0; 8192],
switchable_ram: [0x0; 8192],
cpu_ram: [0x0; 128],
oam: [0x0; 160],
}
}
@ -81,7 +83,7 @@ impl Memory {
return self.ram[(address - 0xE000) as usize];
}
0xFE00..0xFEA0 => {
panic!("sprite attrib memory read");
return self.oam[(address - 0xFE00) as usize];
}
0xFEA0..0xFF00 => {
panic!("empty space read")
@ -120,7 +122,7 @@ impl Memory {
self.ram[(address - 0xE000) as usize] = data;
}
0xFE00..0xFEA0 => {
panic!("sprite attrib memory write");
self.oam[(address - 0xFE00) as usize] = data;
}
0xFEA0..0xFF00 => {
panic!("empty space write")