diff --git a/src/cpu.rs b/src/cpu.rs index b16002dd59777e5f5e0273cb4d229f790ae837b5..e9da59931e9a4fefea139af6441bce62d6557273 100644 --- a/src/cpu.rs +++ b/src/cpu.rs @@ -40,7 +40,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [ // 0x2 opcodes (jr_nz_i8, 8, "JR NZ, i8"), (ld_hl_u16, 12, "LD HL, u16"), - (ld_mhli_a, 8, "LD [HL]+, A"), + (ld_mhli_a, 8, "LD [HL+], A"), (inc_hl, 8, "INC HL"), (nop, 4, "! UNIMP !"), (nop, 4, "! UNIMP !"), @@ -57,7 +57,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [ // 0x3 opcodes (nop, 4, "! UNIMP !"), (ld_sp_u16, 12, "LD SP, u16"), - (ld_mhld_a, 8, "LD [HL]-, A"), + (ld_mhld_a, 8, "LD [HL-], A"), (nop, 4, "! UNIMP !"), (nop, 4, "! UNIMP !"), (nop, 4, "! UNIMP !"), @@ -134,7 +134,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [ (nop, 4, "! UNIMP !"), (nop, 4, "! UNIMP !"), (nop, 4, "! UNIMP !"), - (nop, 4, "! UNIMP !"), + (ld_a_e, 4, "LD A, E"), (nop, 4, "! UNIMP !"), (nop, 4, "! UNIMP !"), (nop, 4, "! UNIMP !"), @@ -829,6 +829,10 @@ fn ld_c_a(cpu: &mut Cpu) { cpu.c = cpu.a; } +fn ld_a_e(cpu: &mut Cpu) { + cpu.a = cpu.e; +} + fn xor_a_a(cpu: &mut Cpu) { cpu.a ^= cpu.a; diff --git a/src/gb.rs b/src/gb.rs index cf4dd195cdfe4eac0490656e612b35f80072625c..6d6739c07bc7ad2b825b7f2f7e8f712455f7f746 100644 --- a/src/gb.rs +++ b/src/gb.rs @@ -1,14 +1,4 @@ -use std::{ - cell::RefCell, - rc::{Rc, Weak}, -}; - -use crate::{ - cpu::Cpu, - mmu::Mmu, - ppu::Ppu, - util::{read_file, SharedMut}, -}; +use crate::{cpu::Cpu, mmu::Mmu, ppu::Ppu, util::read_file}; pub struct GameBoy { cpu: Cpu,