From d05f2980db4a3bd6cb90dae478560fc15fccb128 Mon Sep 17 00:00:00 2001 From: krolxon Date: Sun, 4 Jan 2026 19:18:53 +0530 Subject: add code formatting --- src/main.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 24a43ae..fc7f311 100644 --- a/src/main.rs +++ b/src/main.rs @@ -3,15 +3,13 @@ mod instructions; mod memory; use cpu::CPU; -use memory::Memory; use instructions::Instruction; +use memory::Memory; fn main() { let mut cpu = CPU::default(); let mut mem = Memory::new(); - - // a = 10 mem.write(0x0000, Instruction::MOV as u8); mem.write(0x0001, 0); @@ -45,17 +43,16 @@ fn main() { cpu.inc_pc(); match opcode { - x if x == Instruction::MOV as u8 => cpu.mov(&mut mem), + x if x == Instruction::MOV as u8 => cpu.mov(&mut mem), x if x == Instruction::ADD as u8 => cpu.add(&mut mem), x if x == Instruction::SUB as u8 => cpu.sub(&mut mem), x if x == Instruction::JMP as u8 => cpu.jmp(&mut mem), - x if x == Instruction::JZ as u8 => cpu.jz(&mut mem), - x if x == Instruction::JNZ as u8 => cpu.jnz(&mut mem), + x if x == Instruction::JZ as u8 => cpu.jz(&mut mem), + x if x == Instruction::JNZ as u8 => cpu.jnz(&mut mem), x if x == Instruction::HLT as u8 => cpu.halt(), _ => panic!("Unknown opcode {:02X}", opcode), } } println!("{:#?}", cpu); - } -- cgit v1.2.3