diff options
-rw-r--r-- | Cargo.lock | 2 | ||||
-rw-r--r-- | Cargo.toml | 10 | ||||
-rw-r--r-- | src/lib.rs | 8 | ||||
-rw-r--r-- | src/main.rs | 4 |
4 files changed, 13 insertions, 11 deletions
@@ -15,7 +15,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] -name = "chip8" +name = "chippy" version = "0.1.0" dependencies = [ "rand", @@ -1,8 +1,14 @@ [package] -name = "chip8" +name = "chippy" version = "0.1.0" +license = "MPL-2.0" edition = "2021" - +description = "Yet another Chip 8 Emulator" +readme = "README.md" +homepage = "https://github.com/aadityadhruv/chip-8" +repository = "https://github.com/aadityadhruv/chip-8" +keywords = ["emulator", "games", "graphics", "assembly"] +categories = ["emulators"] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] @@ -115,7 +115,7 @@ impl Chip { pub fn fetch(&mut self) { self.instr = ((self.mem[self.pc as usize] as u16) << 8) | self.mem[(self.pc + 1) as usize] as u16; self.pc += 2; - println!("Fetching next instruction: {:#06X}", self.instr); + //println!("Fetching next instruction: {:#06X}", self.instr); } pub fn execute(&mut self) { @@ -145,7 +145,7 @@ impl Chip { 0xd000..=0xdfff => { self.drw_dxyn() }, 0xe000..=0xefa1 => { self.match_exxk() } 0xf000..=0xff65 => { self.match_fxxk() } - _ => { println!("Doing nothing!"); } + _ => { } } } @@ -262,8 +262,6 @@ impl Chip { self.registers[self.x] = self.registers[self.x].wrapping_add(self.registers[self.y]); } fn sub_8xy5(&mut self) { - println!("Checking sub1"); - println!("{}, {}", self.registers[self.x], self.registers[self.y]); if self.registers[self.x] > self.registers[self.y] { self.registers[0xF] = 1; } @@ -273,7 +271,6 @@ impl Chip { self.registers[self.x] = self.registers[self.x].wrapping_sub(self.registers[self.y]); } fn sub_8xy7(&mut self) { - println!("Checking sub2"); match self.registers[self.y].checked_sub(self.registers[self.x]) { Some(_) => { self.registers[0xF] = 1; } None => { self.registers[0xF] = 0; } @@ -319,7 +316,6 @@ impl Chip { } } fn skp_ex9e(&mut self) { - println!("Same key"); if self.registers[self.x] as i8 == self.keys_pressed { self.pc += 2; } diff --git a/src/main.rs b/src/main.rs index 9a26b32..535615f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,7 +4,7 @@ use sdl2::pixels::Color; use sdl2::event::Event; use sdl2::keyboard::Keycode; use std::time::Duration; -use chip8::Chip; +use chippy::Chip; use std::env; @@ -20,7 +20,7 @@ pub fn main() { //SDL initalizationa and window creation let sdl_context = sdl2::init().unwrap(); let video_subsystem = sdl_context.video().unwrap(); - let window = video_subsystem.window("CHIP-8", chip8::WIDTH * chip8::SCALE, chip8::HEIGHT * chip8::SCALE) + let window = video_subsystem.window("CHIP-8", chippy::WIDTH * chippy::SCALE, chippy::HEIGHT * chippy::SCALE) .position_centered() .build() .unwrap(); |