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

feat: more new instructions

parent 96839ea9
No related branches found
No related tags found
No related merge requests found
......@@ -196,7 +196,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
(noimpl, 4, "! UNIMP !"),
(noimpl, 4, "! UNIMP !"),
(noimpl, 4, "! UNIMP !"),
(noimpl, 4, "! UNIMP !"),
(or_a_a, 4, "OR A, A"),
(noimpl, 4, "! UNIMP !"),
(noimpl, 4, "! UNIMP !"),
(noimpl, 4, "! UNIMP !"),
......@@ -229,7 +229,7 @@ pub const INSTRUCTIONS: [(fn(&mut Cpu), u8, &'static str); 256] = [
(noimpl, 4, "! UNIMP !"),
(noimpl, 4, "! UNIMP !"),
(noimpl, 4, "! UNIMP !"),
(noimpl, 4, "! UNIMP !"),
(sub_a_u8, 8, "SUB A, u8"),
(noimpl, 4, "! UNIMP !"),
(noimpl, 4, "! UNIMP !"),
(noimpl, 4, "! UNIMP !"),
......@@ -868,6 +868,15 @@ fn or_a_c(cpu: &mut Cpu) {
cpu.set_carry(false);
}
fn or_a_a(cpu: &mut Cpu) {
cpu.a |= cpu.a;
cpu.set_sub(false);
cpu.set_zero(cpu.a == 0);
cpu.set_half_carry(false);
cpu.set_carry(false);
}
fn cp_a_mhl(cpu: &mut Cpu) {
let byte = cpu.mmu.read(cpu.hl());
sub_set_flags(cpu, cpu.a, byte);
......@@ -927,6 +936,11 @@ fn rst_08h(cpu: &mut Cpu) {
rst(cpu, 0x0008);
}
fn sub_a_u8(cpu: &mut Cpu) {
let byte = cpu.read_u8();
cpu.a = sub_set_flags(cpu, cpu.a, byte);
}
fn ld_mff00u8_a(cpu: &mut Cpu) {
let byte = cpu.read_u8();
cpu.mmu.write(0xff00 + byte as u16, cpu.a);
......
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