Skip to content
Snippets Groups Projects
Verified Commit 079926e2 authored by João Magalhães's avatar João Magalhães :rocket:
Browse files

feat: new instruction and better code

parent 5766d0ab
No related branches found
No related tags found
No related merge requests found
...@@ -40,7 +40,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [ ...@@ -40,7 +40,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
// 0x2 opcodes // 0x2 opcodes
(jr_nz_i8, 8, "JR NZ, i8"), (jr_nz_i8, 8, "JR NZ, i8"),
(ld_hl_u16, 12, "LD HL, u16"), (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"), (inc_hl, 8, "INC HL"),
(nop, 4, "! UNIMP !"), (nop, 4, "! UNIMP !"),
(nop, 4, "! UNIMP !"), (nop, 4, "! UNIMP !"),
...@@ -57,7 +57,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [ ...@@ -57,7 +57,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
// 0x3 opcodes // 0x3 opcodes
(nop, 4, "! UNIMP !"), (nop, 4, "! UNIMP !"),
(ld_sp_u16, 12, "LD SP, u16"), (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 !"), (nop, 4, "! UNIMP !"),
(nop, 4, "! UNIMP !"), (nop, 4, "! UNIMP !"),
...@@ -134,7 +134,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [ ...@@ -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 !"),
(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 !"), (nop, 4, "! UNIMP !"),
(nop, 4, "! UNIMP !"), (nop, 4, "! UNIMP !"),
...@@ -829,6 +829,10 @@ fn ld_c_a(cpu: &mut Cpu) { ...@@ -829,6 +829,10 @@ fn ld_c_a(cpu: &mut Cpu) {
cpu.c = cpu.a; cpu.c = cpu.a;
} }
fn ld_a_e(cpu: &mut Cpu) {
cpu.a = cpu.e;
}
fn xor_a_a(cpu: &mut Cpu) { fn xor_a_a(cpu: &mut Cpu) {
cpu.a ^= cpu.a; cpu.a ^= cpu.a;
......
use std::{ use crate::{cpu::Cpu, mmu::Mmu, ppu::Ppu, util::read_file};
cell::RefCell,
rc::{Rc, Weak},
};
use crate::{
cpu::Cpu,
mmu::Mmu,
ppu::Ppu,
util::{read_file, SharedMut},
};
pub struct GameBoy { pub struct GameBoy {
cpu: Cpu, cpu: Cpu,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment