Skip to content

Commit

Permalink
rust 1.73.0
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Oct 24, 2023
1 parent a742c64 commit eb7af0f
Show file tree
Hide file tree
Showing 21 changed files with 1,144 additions and 1,123 deletions.
7 changes: 6 additions & 1 deletion rust-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1,6 @@
1.72.0
# If you see this, run "rustup self update" to get rustup 1.23 or newer.

[toolchain]
channel = "1.73.0"
components = ["rustfmt", "clippy"]
targets = ["wasm32-unknown-unknown"]
6 changes: 3 additions & 3 deletions src/cpu/cpu.rs → src/cpu/core.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::cpu::registers::Registers;
use crate::cpu::{data, ld, misc, stack};
use crate::mmu::mmu::MMU;
use crate::mmu::MemoryManagementUnit;

#[allow(dead_code)]
pub enum Interrupt {
Expand All @@ -18,15 +18,15 @@ pub struct Cpu<'a> {
pub setei: u32,
pub halt: u32,
pub stop: u32,
pub memory: MMU<'a>,
pub memory: MemoryManagementUnit<'a>,

// To debug
_executed_operations: Vec<u8>,
}

impl Cpu<'_> {
pub fn new(data: Vec<u8>, file: Option<std::path::PathBuf>) -> Self {
let memory = MMU::new_cgb(data, file).unwrap();
let memory = MemoryManagementUnit::new_cgb(data, file).unwrap();
let registers = Registers::new(memory.gbmode);

Cpu {
Expand Down
4 changes: 3 additions & 1 deletion src/cpu/data.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::cpu::cpu::Cpu;
use crate::cpu::core::Cpu;
use crate::cpu::registers::CpuFlag::{C, H, N, Z};

fn alu_sub(cpu: &mut Cpu, b: u8, usec: bool) {
Expand Down Expand Up @@ -538,6 +538,7 @@ pub fn orr_l(cpu: &mut Cpu) {
cpu.registers.a = r;
}
pub fn orr_a(cpu: &mut Cpu) {
#[allow(clippy::eq_op)]
let r = cpu.registers.a | cpu.registers.a;
cpu.registers.flag(Z, r == 0);
cpu.registers.flag(C, false);
Expand Down Expand Up @@ -613,6 +614,7 @@ pub fn xorr_l(cpu: &mut Cpu) {
cpu.registers.a = r;
}
pub fn xorr_a(cpu: &mut Cpu) {
#[allow(clippy::eq_op)]
let r = cpu.registers.a ^ cpu.registers.a;
cpu.registers.flag(Z, r == 0);
cpu.registers.flag(C, false);
Expand Down
2 changes: 1 addition & 1 deletion src/cpu/ld.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::cpu::cpu::Cpu;
use crate::cpu::core::Cpu;
use crate::cpu::registers::CpuFlag::{C, H, N, Z};

pub fn r_hlm_b(cpu: &mut Cpu) {
Expand Down
2 changes: 1 addition & 1 deletion src/cpu/misc.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::cpu::cpu::Cpu;
use crate::cpu::core::Cpu;
use crate::cpu::registers::CpuFlag::{C, H, N, Z};

pub fn bit(cpu: &mut Cpu, a: u8, b: u8) -> u32 {
Expand Down
2 changes: 1 addition & 1 deletion src/cpu/mod.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
pub mod cpu;
pub mod core;
mod registers;

mod data;
Expand Down
2 changes: 1 addition & 1 deletion src/cpu/stack.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::cpu::cpu::Cpu;
use crate::cpu::core::Cpu;
use crate::cpu::registers::CpuFlag::{C, Z};

pub fn pushstack(cpu: &mut Cpu, value: u16) {
Expand Down
4 changes: 2 additions & 2 deletions src/gameboy.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::cpu::cpu::Cpu;
use crate::cpu::core::Cpu;
use crate::input::KeypadKey;

pub struct Gameboy {
Expand Down Expand Up @@ -50,7 +50,7 @@ pub fn load_rom(filepath: &str) -> Result<(Vec<u8>, std::path::PathBuf), String>

pub const CYCLES: u32 = 70224;

impl<'a> Gameboy {
impl Gameboy {
pub fn new(data: Vec<u8>, filepath: Option<std::path::PathBuf>) -> Gameboy {
// let rom = load_rom();

Expand Down
Loading

0 comments on commit eb7af0f

Please sign in to comment.