[brw] Use cell and refcell to implement shared behaviour

This commit is contained in:
2024-02-18 22:03:10 +05:30
parent f6eca76b0c
commit 04d1d9160d
5 changed files with 68 additions and 56 deletions

View File

@@ -17,16 +17,10 @@ mod graphics;
fn main() -> EmulatorResult<()> {
SimpleLogger::new().env().init().unwrap();
let mut program_counter = ProgramCounter::new();
let mut mmio = MemoryMappedIO::new(&mut program_counter);
let mut ram = RamMemory::try_new()?;
let mut mmu = MappedMemory::new(&mut mmio,&mut ram);
// for i in 0..10 {
// log::info!("Memory at {} is {}",i,mmu.try_get_byte(i)?);
// }
mmu.try_set_byte(0x2,0x1)?;
let data = program_counter.try_get_byte(0x0)?;
log::info!("Computed data {}",data);
let program_counter = ProgramCounter::new();
let mmio = MemoryMappedIO::new(&program_counter);
let ram = RamMemory::try_new()?;
let mmu = MappedMemory::new(&mmio,&ram);
// let sdl_context = sdl2::init().unwrap();