~sircmpwn/hdmg

b77f47f68c70cb6b2cde5811fc51785d0f572dc8 — Drew DeVault 1 year, 6 months ago bb71f72
sm83: implement RES
1 files changed, 71 insertions(+), 64 deletions(-)

M sm83/prefix.ha
M sm83/prefix.ha => sm83/prefix.ha +71 -64
@@ 151,70 151,77 @@ fn exec_bit_7_l(cpu: *sm83) void = bit(cpu, 7, cpu.regs.L);
fn exec_bit_7_hl(cpu: *sm83) void = bit(cpu, 7, readb(cpu, cpu.regs.HL));
fn exec_bit_7_a(cpu: *sm83) void = bit(cpu, 7, cpu.regs.A);

fn exec_res_0_b(cpu: *sm83) void = abort("TODO");
fn exec_res_0_c(cpu: *sm83) void = abort("TODO");
fn exec_res_0_d(cpu: *sm83) void = abort("TODO");
fn exec_res_0_e(cpu: *sm83) void = abort("TODO");
fn exec_res_0_h(cpu: *sm83) void = abort("TODO");
fn exec_res_0_l(cpu: *sm83) void = abort("TODO");
fn exec_res_0_hl(cpu: *sm83) void = abort("TODO");
fn exec_res_0_a(cpu: *sm83) void = abort("TODO");
fn exec_res_1_b(cpu: *sm83) void = abort("TODO");
fn exec_res_1_c(cpu: *sm83) void = abort("TODO");
fn exec_res_1_d(cpu: *sm83) void = abort("TODO");
fn exec_res_1_e(cpu: *sm83) void = abort("TODO");
fn exec_res_1_h(cpu: *sm83) void = abort("TODO");
fn exec_res_1_l(cpu: *sm83) void = abort("TODO");
fn exec_res_1_hl(cpu: *sm83) void = abort("TODO");
fn exec_res_1_a(cpu: *sm83) void = abort("TODO");
fn exec_res_2_b(cpu: *sm83) void = abort("TODO");
fn exec_res_2_c(cpu: *sm83) void = abort("TODO");
fn exec_res_2_d(cpu: *sm83) void = abort("TODO");
fn exec_res_2_e(cpu: *sm83) void = abort("TODO");
fn exec_res_2_h(cpu: *sm83) void = abort("TODO");
fn exec_res_2_l(cpu: *sm83) void = abort("TODO");
fn exec_res_2_hl(cpu: *sm83) void = abort("TODO");
fn exec_res_2_a(cpu: *sm83) void = abort("TODO");
fn exec_res_3_b(cpu: *sm83) void = abort("TODO");
fn exec_res_3_c(cpu: *sm83) void = abort("TODO");
fn exec_res_3_d(cpu: *sm83) void = abort("TODO");
fn exec_res_3_e(cpu: *sm83) void = abort("TODO");
fn exec_res_3_h(cpu: *sm83) void = abort("TODO");
fn exec_res_3_l(cpu: *sm83) void = abort("TODO");
fn exec_res_3_hl(cpu: *sm83) void = abort("TODO");
fn exec_res_3_a(cpu: *sm83) void = abort("TODO");
fn exec_res_4_b(cpu: *sm83) void = abort("TODO");
fn exec_res_4_c(cpu: *sm83) void = abort("TODO");
fn exec_res_4_d(cpu: *sm83) void = abort("TODO");
fn exec_res_4_e(cpu: *sm83) void = abort("TODO");
fn exec_res_4_h(cpu: *sm83) void = abort("TODO");
fn exec_res_4_l(cpu: *sm83) void = abort("TODO");
fn exec_res_4_hl(cpu: *sm83) void = abort("TODO");
fn exec_res_4_a(cpu: *sm83) void = abort("TODO");
fn exec_res_5_b(cpu: *sm83) void = abort("TODO");
fn exec_res_5_c(cpu: *sm83) void = abort("TODO");
fn exec_res_5_d(cpu: *sm83) void = abort("TODO");
fn exec_res_5_e(cpu: *sm83) void = abort("TODO");
fn exec_res_5_h(cpu: *sm83) void = abort("TODO");
fn exec_res_5_l(cpu: *sm83) void = abort("TODO");
fn exec_res_5_hl(cpu: *sm83) void = abort("TODO");
fn exec_res_5_a(cpu: *sm83) void = abort("TODO");
fn exec_res_6_b(cpu: *sm83) void = abort("TODO");
fn exec_res_6_c(cpu: *sm83) void = abort("TODO");
fn exec_res_6_d(cpu: *sm83) void = abort("TODO");
fn exec_res_6_e(cpu: *sm83) void = abort("TODO");
fn exec_res_6_h(cpu: *sm83) void = abort("TODO");
fn exec_res_6_l(cpu: *sm83) void = abort("TODO");
fn exec_res_6_hl(cpu: *sm83) void = abort("TODO");
fn exec_res_6_a(cpu: *sm83) void = abort("TODO");
fn exec_res_7_b(cpu: *sm83) void = abort("TODO");
fn exec_res_7_c(cpu: *sm83) void = abort("TODO");
fn exec_res_7_d(cpu: *sm83) void = abort("TODO");
fn exec_res_7_e(cpu: *sm83) void = abort("TODO");
fn exec_res_7_h(cpu: *sm83) void = abort("TODO");
fn exec_res_7_l(cpu: *sm83) void = abort("TODO");
fn exec_res_7_hl(cpu: *sm83) void = abort("TODO");
fn exec_res_7_a(cpu: *sm83) void = abort("TODO");
fn exec_res_0_b(cpu: *sm83) void = cpu.regs.B &= ~(1 << 0);
fn exec_res_0_c(cpu: *sm83) void = cpu.regs.C &= ~(1 << 0);
fn exec_res_0_d(cpu: *sm83) void = cpu.regs.D &= ~(1 << 0);
fn exec_res_0_e(cpu: *sm83) void = cpu.regs.E &= ~(1 << 0);
fn exec_res_0_h(cpu: *sm83) void = cpu.regs.H &= ~(1 << 0);
fn exec_res_0_l(cpu: *sm83) void = cpu.regs.L &= ~(1 << 0);
fn exec_res_0_a(cpu: *sm83) void = cpu.regs.A &= ~(1 << 0);
fn exec_res_1_b(cpu: *sm83) void = cpu.regs.B &= ~(1 << 1);
fn exec_res_1_c(cpu: *sm83) void = cpu.regs.C &= ~(1 << 1);
fn exec_res_1_d(cpu: *sm83) void = cpu.regs.D &= ~(1 << 1);
fn exec_res_1_e(cpu: *sm83) void = cpu.regs.E &= ~(1 << 1);
fn exec_res_1_h(cpu: *sm83) void = cpu.regs.H &= ~(1 << 1);
fn exec_res_1_l(cpu: *sm83) void = cpu.regs.L &= ~(1 << 1);
fn exec_res_1_a(cpu: *sm83) void = cpu.regs.A &= ~(1 << 1);
fn exec_res_2_b(cpu: *sm83) void = cpu.regs.B &= ~(1 << 2);
fn exec_res_2_c(cpu: *sm83) void = cpu.regs.C &= ~(1 << 2);
fn exec_res_2_d(cpu: *sm83) void = cpu.regs.D &= ~(1 << 2);
fn exec_res_2_e(cpu: *sm83) void = cpu.regs.E &= ~(1 << 2);
fn exec_res_2_h(cpu: *sm83) void = cpu.regs.H &= ~(1 << 2);
fn exec_res_2_l(cpu: *sm83) void = cpu.regs.L &= ~(1 << 2);
fn exec_res_2_a(cpu: *sm83) void = cpu.regs.A &= ~(1 << 2);
fn exec_res_3_b(cpu: *sm83) void = cpu.regs.B &= ~(1 << 3);
fn exec_res_3_c(cpu: *sm83) void = cpu.regs.C &= ~(1 << 3);
fn exec_res_3_d(cpu: *sm83) void = cpu.regs.D &= ~(1 << 3);
fn exec_res_3_e(cpu: *sm83) void = cpu.regs.E &= ~(1 << 3);
fn exec_res_3_h(cpu: *sm83) void = cpu.regs.H &= ~(1 << 3);
fn exec_res_3_l(cpu: *sm83) void = cpu.regs.L &= ~(1 << 3);
fn exec_res_3_a(cpu: *sm83) void = cpu.regs.A &= ~(1 << 3);
fn exec_res_4_b(cpu: *sm83) void = cpu.regs.B &= ~(1 << 4);
fn exec_res_4_c(cpu: *sm83) void = cpu.regs.C &= ~(1 << 4);
fn exec_res_4_d(cpu: *sm83) void = cpu.regs.D &= ~(1 << 4);
fn exec_res_4_e(cpu: *sm83) void = cpu.regs.E &= ~(1 << 4);
fn exec_res_4_h(cpu: *sm83) void = cpu.regs.H &= ~(1 << 4);
fn exec_res_4_l(cpu: *sm83) void = cpu.regs.L &= ~(1 << 4);
fn exec_res_4_a(cpu: *sm83) void = cpu.regs.A &= ~(1 << 4);
fn exec_res_5_b(cpu: *sm83) void = cpu.regs.B &= ~(1 << 5);
fn exec_res_5_c(cpu: *sm83) void = cpu.regs.C &= ~(1 << 5);
fn exec_res_5_d(cpu: *sm83) void = cpu.regs.D &= ~(1 << 5);
fn exec_res_5_e(cpu: *sm83) void = cpu.regs.E &= ~(1 << 5);
fn exec_res_5_h(cpu: *sm83) void = cpu.regs.H &= ~(1 << 5);
fn exec_res_5_l(cpu: *sm83) void = cpu.regs.L &= ~(1 << 5);
fn exec_res_5_a(cpu: *sm83) void = cpu.regs.A &= ~(1 << 5);
fn exec_res_6_b(cpu: *sm83) void = cpu.regs.B &= ~(1 << 6);
fn exec_res_6_c(cpu: *sm83) void = cpu.regs.C &= ~(1 << 6);
fn exec_res_6_d(cpu: *sm83) void = cpu.regs.D &= ~(1 << 6);
fn exec_res_6_e(cpu: *sm83) void = cpu.regs.E &= ~(1 << 6);
fn exec_res_6_h(cpu: *sm83) void = cpu.regs.H &= ~(1 << 6);
fn exec_res_6_l(cpu: *sm83) void = cpu.regs.L &= ~(1 << 6);
fn exec_res_6_a(cpu: *sm83) void = cpu.regs.A &= ~(1 << 6);
fn exec_res_7_b(cpu: *sm83) void = cpu.regs.B &= ~(1 << 7);
fn exec_res_7_c(cpu: *sm83) void = cpu.regs.C &= ~(1 << 7);
fn exec_res_7_d(cpu: *sm83) void = cpu.regs.D &= ~(1 << 7);
fn exec_res_7_e(cpu: *sm83) void = cpu.regs.E &= ~(1 << 7);
fn exec_res_7_h(cpu: *sm83) void = cpu.regs.H &= ~(1 << 7);
fn exec_res_7_l(cpu: *sm83) void = cpu.regs.L &= ~(1 << 7);
fn exec_res_7_a(cpu: *sm83) void = cpu.regs.A &= ~(1 << 7);

fn reshl(cpu: *sm83, bit: u8) void = {
	let val = readb(cpu, cpu.regs.HL);
	val &= ~(1 << bit);
	writeb(cpu, cpu.regs.HL, val);
};

fn exec_res_0_hl(cpu: *sm83) void = reshl(cpu, 1);
fn exec_res_1_hl(cpu: *sm83) void = reshl(cpu, 1);
fn exec_res_2_hl(cpu: *sm83) void = reshl(cpu, 2);
fn exec_res_3_hl(cpu: *sm83) void = reshl(cpu, 3);
fn exec_res_4_hl(cpu: *sm83) void = reshl(cpu, 4);
fn exec_res_5_hl(cpu: *sm83) void = reshl(cpu, 5);
fn exec_res_6_hl(cpu: *sm83) void = reshl(cpu, 6);
fn exec_res_7_hl(cpu: *sm83) void = reshl(cpu, 7);

fn exec_set_0_b(cpu: *sm83) void = abort("TODO");
fn exec_set_0_c(cpu: *sm83) void = abort("TODO");