From ddfb3a3b29dcdb5b55743be19237a2a848ea1872 Mon Sep 17 00:00:00 2001 From: kzzt Date: Thu, 25 Oct 2018 13:29:38 -0500 Subject: [PATCH] ran clippy and renamed main.rs to mos6502.rs --- src/bin/{main.rs => mos6502.rs} | 0 src/cpu.rs | 9 +++------ src/registers.rs | 16 ++++++++-------- 3 files changed, 11 insertions(+), 14 deletions(-) rename src/bin/{main.rs => mos6502.rs} (100%) diff --git a/src/bin/main.rs b/src/bin/mos6502.rs similarity index 100% rename from src/bin/main.rs rename to src/bin/mos6502.rs diff --git a/src/cpu.rs b/src/cpu.rs index 2bdca43..bfdfc14 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -410,13 +410,10 @@ impl CPU { } pub fn run(&mut self) { - loop { - if let Some(decoded_instr) = self.fetch_next_and_decode() { + while let Some(decoded_instr) = self.fetch_next_and_decode() { self.execute_instruction(decoded_instr); - } else { - break; - } - } + } + } fn set_flags_from_i8(status: &mut Status, value: i8) { diff --git a/src/registers.rs b/src/registers.rs index 77ea196..cb3dc91 100644 --- a/src/registers.rs +++ b/src/registers.rs @@ -58,17 +58,17 @@ impl StatusArgs { bitflags! { pub struct Status: u8 { - const PS_NEGATIVE = 0b10000000; - const PS_OVERFLOW = 0b01000000; - const PS_UNUSED = 0b00100000; // JAM: Should this exist? + const PS_NEGATIVE = 0b1000_0000; + const PS_OVERFLOW = 0b0100_0000; + const PS_UNUSED = 0b0010_0000; // JAM: Should this exist? // (note that it affects the // behavior of things like // from_bits_truncate) - const PS_BRK = 0b00010000; - const PS_DECIMAL_MODE = 0b00001000; - const PS_DISABLE_INTERRUPTS = 0b00000100; - const PS_ZERO = 0b00000010; - const PS_CARRY = 0b00000001; + const PS_BRK = 0b0001_0000; + const PS_DECIMAL_MODE = 0b0000_1000; + const PS_DISABLE_INTERRUPTS = 0b0000_0100; + const PS_ZERO = 0b0000_0010; + const PS_CARRY = 0b0000_0001; } }