Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
lyrakisk committed Oct 4, 2024
1 parent 9e9f3de commit 0102594
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 18 deletions.
6 changes: 3 additions & 3 deletions examples/snake/main.rs
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
use rand::Rng;
use LochNES::bus::*;
use LochNES::cpu::*;
use LochNES::rom::*;
use rand::Rng;

use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use sdl2::pixels::Color;
use sdl2::pixels::PixelFormatEnum;
use sdl2::EventPump;

use std::sync::{Arc, Mutex};
use std::fs::read;
use std::path::PathBuf;
use std::sync::{Arc, Mutex};
fn main() {
let sdl_context = sdl2::init().unwrap();
let video_subsystem = sdl_context.video().unwrap();
Expand Down Expand Up @@ -125,4 +125,4 @@ fn read_screen_state(cpu: &CPU, frame: &mut [u8; 32 * 3 * 32]) -> bool {
frame_idx += 3;
}
update
}
}
11 changes: 0 additions & 11 deletions src/cpu/instructions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,6 @@ pub struct Instruction {
pub addressing_mode: AddressingMode,
}

impl Instruction {
pub fn new(opcode: u8, name: &'static str, bytes: u8, addressing_mode: AddressingMode) -> Self {
Instruction {
opcode: opcode,
name: name,
bytes: bytes,
addressing_mode: addressing_mode,
}
}
}

#[rustfmt::skip]
pub static INSTRUCTIONS: Lazy<HashMap<u8, Instruction>> = Lazy::new(|| {
vec![
Expand Down
8 changes: 4 additions & 4 deletions src/cpu/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ impl CPU {
for address in self.program_counter..=(self.program_counter - 1 + program.len() as u16) {
let program_address = (address).wrapping_sub(self.program_counter) as usize;
self.bus
.lock()
.unwrap()
.mem_write(address as u16, program[program_address]);
}
.lock()
.unwrap()
.mem_write(address as u16, program[program_address]);
}
}

fn stack_pop(&mut self) -> u8 {
Expand Down

0 comments on commit 0102594

Please sign in to comment.