// SPDX-License-Identifier: AGPL-3.0-or-later //! 6502 Emulator written in Rust. Based off of information from Dave's playlist //! //! using the now defunct obelisk 6502 documentation. //! //! Many comments are sourced from the Obelisk 6502 documentation //! mod cpu; mod instruction; mod memory; use tracing::level_filters::LevelFilter; use cpu::Cpu; use memory::Memory; fn main() { tracing_subscriber::fmt() .with_max_level(LevelFilter::TRACE) .init(); let mut cpu = Cpu::new(); let mut memory = Memory::new(); cpu.reset(&mut memory); // little program if let Some(opcode) = memory.data.get_mut(0xFFFC) { *opcode = 0x20; } if let Some(opcode) = memory.data.get_mut(0xFFFD) { *opcode = 0x42; } if let Some(opcode) = memory.data.get_mut(0xFFFE) { *opcode = 0x42; } if let Some(opcode) = memory.data.get_mut(0x4242) { *opcode = 0xA9; } if let Some(opcode) = memory.data.get_mut(0x4243) { *opcode = 0x84; } // end program cpu.execute(9, &mut memory); }