From 7ced09699636956fe1c0e4bc9748d482c1b40239 Mon Sep 17 00:00:00 2001 From: Determinant Date: Wed, 15 Nov 2017 12:38:11 -0500 Subject: ... --- src/main.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 57af3e4..c53068b 100644 --- a/src/main.rs +++ b/src/main.rs @@ -214,11 +214,10 @@ fn main() { //let win = Window {buff: RefCell::new([[0; 256]; 240])}; let win = SDLWindow::new(); let mapper = mapper::Mapper2::new(&cart); - let pmem = memory::PPUMemory::new(&mapper, &cart); - let mem = memory::CPUMemory::new(&mapper); - let mut ppu = ppu::PPU::new(&pmem, &win); - let mut cpu = mos6502::CPU::new(&mem); - mem.init(&mut cpu, &mut ppu); + let mut ppu = ppu::PPU::new(memory::PPUMemory::new(&mapper, &cart), &win); + let mut cpu = mos6502::CPU::new(memory::CPUMemory::new(&mut ppu, &mapper)); + let ptr = &mut cpu as *mut mos6502::CPU; + cpu.mem.init(ptr); let mut cnt = 0; use ppu::Screen; const CYC_PER_FRAME: u32 = mos6502::CPU_FREQ / 60; -- cgit v1.2.3-70-g09d2