[ref] Refactor memory

This commit is contained in:
2024-02-18 09:35:58 +05:30
parent 5701808e77
commit 2f0e0b4730
4 changed files with 83 additions and 40 deletions

View File

@@ -0,0 +1,45 @@
use crate::emu::mmu::{MappedMemory, Memory};
use crate::misc::result::EmulatorResult;
#[derive(Debug)]
pub enum CpuState{
Running,
Paused
}
#[derive(Debug)]
pub struct Cpu{
mapped_memory: MappedMemory,
}
impl Cpu{
pub fn new(mapped_memory: MappedMemory)->Cpu{
Cpu{
mapped_memory
}
}
pub fn cycle()->EmulatorResult<()>{
todo!();
Ok(())
}
fn set_pc(&self,value: &[u8;3])->EmulatorResult<()>{
todo!()
// for bytete in value {
// self.mapped_memory.try_set_byte()
// }try_set_byte
}
}
#[cfg(test)]
mod test{
#[test]
pub fn construct(){
}
}