~sircmpwn/hdmg

150cabfcdb0ec5080fb44a827d0e4ef3d23501e0 — Drew DeVault 1 year, 6 months ago b77f47f
sm83: implement SET
1 files changed, 71 insertions(+), 64 deletions(-)

M sm83/prefix.ha
M sm83/prefix.ha => sm83/prefix.ha +71 -64
@@ 223,67 223,74 @@ 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");
fn exec_set_0_d(cpu: *sm83) void = abort("TODO");
fn exec_set_0_e(cpu: *sm83) void = abort("TODO");
fn exec_set_0_h(cpu: *sm83) void = abort("TODO");
fn exec_set_0_l(cpu: *sm83) void = abort("TODO");
fn exec_set_0_hl(cpu: *sm83) void = abort("TODO");
fn exec_set_0_a(cpu: *sm83) void = abort("TODO");
fn exec_set_1_b(cpu: *sm83) void = abort("TODO");
fn exec_set_1_c(cpu: *sm83) void = abort("TODO");
fn exec_set_1_d(cpu: *sm83) void = abort("TODO");
fn exec_set_1_e(cpu: *sm83) void = abort("TODO");
fn exec_set_1_h(cpu: *sm83) void = abort("TODO");
fn exec_set_1_l(cpu: *sm83) void = abort("TODO");
fn exec_set_1_hl(cpu: *sm83) void = abort("TODO");
fn exec_set_1_a(cpu: *sm83) void = abort("TODO");
fn exec_set_2_b(cpu: *sm83) void = abort("TODO");
fn exec_set_2_c(cpu: *sm83) void = abort("TODO");
fn exec_set_2_d(cpu: *sm83) void = abort("TODO");
fn exec_set_2_e(cpu: *sm83) void = abort("TODO");
fn exec_set_2_h(cpu: *sm83) void = abort("TODO");
fn exec_set_2_l(cpu: *sm83) void = abort("TODO");
fn exec_set_2_hl(cpu: *sm83) void = abort("TODO");
fn exec_set_2_a(cpu: *sm83) void = abort("TODO");
fn exec_set_3_b(cpu: *sm83) void = abort("TODO");
fn exec_set_3_c(cpu: *sm83) void = abort("TODO");
fn exec_set_3_d(cpu: *sm83) void = abort("TODO");
fn exec_set_3_e(cpu: *sm83) void = abort("TODO");
fn exec_set_3_h(cpu: *sm83) void = abort("TODO");
fn exec_set_3_l(cpu: *sm83) void = abort("TODO");
fn exec_set_3_hl(cpu: *sm83) void = abort("TODO");
fn exec_set_3_a(cpu: *sm83) void = abort("TODO");
fn exec_set_4_b(cpu: *sm83) void = abort("TODO");
fn exec_set_4_c(cpu: *sm83) void = abort("TODO");
fn exec_set_4_d(cpu: *sm83) void = abort("TODO");
fn exec_set_4_e(cpu: *sm83) void = abort("TODO");
fn exec_set_4_h(cpu: *sm83) void = abort("TODO");
fn exec_set_4_l(cpu: *sm83) void = abort("TODO");
fn exec_set_4_hl(cpu: *sm83) void = abort("TODO");
fn exec_set_4_a(cpu: *sm83) void = abort("TODO");
fn exec_set_5_b(cpu: *sm83) void = abort("TODO");
fn exec_set_5_c(cpu: *sm83) void = abort("TODO");
fn exec_set_5_d(cpu: *sm83) void = abort("TODO");
fn exec_set_5_e(cpu: *sm83) void = abort("TODO");
fn exec_set_5_h(cpu: *sm83) void = abort("TODO");
fn exec_set_5_l(cpu: *sm83) void = abort("TODO");
fn exec_set_5_hl(cpu: *sm83) void = abort("TODO");
fn exec_set_5_a(cpu: *sm83) void = abort("TODO");
fn exec_set_6_b(cpu: *sm83) void = abort("TODO");
fn exec_set_6_c(cpu: *sm83) void = abort("TODO");
fn exec_set_6_d(cpu: *sm83) void = abort("TODO");
fn exec_set_6_e(cpu: *sm83) void = abort("TODO");
fn exec_set_6_h(cpu: *sm83) void = abort("TODO");
fn exec_set_6_l(cpu: *sm83) void = abort("TODO");
fn exec_set_6_hl(cpu: *sm83) void = abort("TODO");
fn exec_set_6_a(cpu: *sm83) void = abort("TODO");
fn exec_set_7_b(cpu: *sm83) void = abort("TODO");
fn exec_set_7_c(cpu: *sm83) void = abort("TODO");
fn exec_set_7_d(cpu: *sm83) void = abort("TODO");
fn exec_set_7_e(cpu: *sm83) void = abort("TODO");
fn exec_set_7_h(cpu: *sm83) void = abort("TODO");
fn exec_set_7_l(cpu: *sm83) void = abort("TODO");
fn exec_set_7_hl(cpu: *sm83) void = abort("TODO");
fn exec_set_7_a(cpu: *sm83) void = abort("TODO");
fn exec_set_0_b(cpu: *sm83) void = cpu.regs.B |= 1 << 0;
fn exec_set_0_c(cpu: *sm83) void = cpu.regs.C |= 1 << 0;
fn exec_set_0_d(cpu: *sm83) void = cpu.regs.D |= 1 << 0;
fn exec_set_0_e(cpu: *sm83) void = cpu.regs.E |= 1 << 0;
fn exec_set_0_h(cpu: *sm83) void = cpu.regs.H |= 1 << 0;
fn exec_set_0_l(cpu: *sm83) void = cpu.regs.L |= 1 << 0;
fn exec_set_0_a(cpu: *sm83) void = cpu.regs.A |= 1 << 0;
fn exec_set_1_b(cpu: *sm83) void = cpu.regs.B |= 1 << 1;
fn exec_set_1_c(cpu: *sm83) void = cpu.regs.C |= 1 << 1;
fn exec_set_1_d(cpu: *sm83) void = cpu.regs.D |= 1 << 1;
fn exec_set_1_e(cpu: *sm83) void = cpu.regs.E |= 1 << 1;
fn exec_set_1_h(cpu: *sm83) void = cpu.regs.H |= 1 << 1;
fn exec_set_1_l(cpu: *sm83) void = cpu.regs.L |= 1 << 1;
fn exec_set_1_a(cpu: *sm83) void = cpu.regs.A |= 1 << 1;
fn exec_set_2_b(cpu: *sm83) void = cpu.regs.B |= 1 << 2;
fn exec_set_2_c(cpu: *sm83) void = cpu.regs.C |= 1 << 2;
fn exec_set_2_d(cpu: *sm83) void = cpu.regs.D |= 1 << 2;
fn exec_set_2_e(cpu: *sm83) void = cpu.regs.E |= 1 << 2;
fn exec_set_2_h(cpu: *sm83) void = cpu.regs.H |= 1 << 2;
fn exec_set_2_l(cpu: *sm83) void = cpu.regs.L |= 1 << 2;
fn exec_set_2_a(cpu: *sm83) void = cpu.regs.A |= 1 << 2;
fn exec_set_3_b(cpu: *sm83) void = cpu.regs.B |= 1 << 3;
fn exec_set_3_c(cpu: *sm83) void = cpu.regs.C |= 1 << 3;
fn exec_set_3_d(cpu: *sm83) void = cpu.regs.D |= 1 << 3;
fn exec_set_3_e(cpu: *sm83) void = cpu.regs.E |= 1 << 3;
fn exec_set_3_h(cpu: *sm83) void = cpu.regs.H |= 1 << 3;
fn exec_set_3_l(cpu: *sm83) void = cpu.regs.L |= 1 << 3;
fn exec_set_3_a(cpu: *sm83) void = cpu.regs.A |= 1 << 3;
fn exec_set_4_b(cpu: *sm83) void = cpu.regs.B |= 1 << 4;
fn exec_set_4_c(cpu: *sm83) void = cpu.regs.C |= 1 << 4;
fn exec_set_4_d(cpu: *sm83) void = cpu.regs.D |= 1 << 4;
fn exec_set_4_e(cpu: *sm83) void = cpu.regs.E |= 1 << 4;
fn exec_set_4_h(cpu: *sm83) void = cpu.regs.H |= 1 << 4;
fn exec_set_4_l(cpu: *sm83) void = cpu.regs.L |= 1 << 4;
fn exec_set_4_a(cpu: *sm83) void = cpu.regs.A |= 1 << 4;
fn exec_set_5_b(cpu: *sm83) void = cpu.regs.B |= 1 << 5;
fn exec_set_5_c(cpu: *sm83) void = cpu.regs.C |= 1 << 5;
fn exec_set_5_d(cpu: *sm83) void = cpu.regs.D |= 1 << 5;
fn exec_set_5_e(cpu: *sm83) void = cpu.regs.E |= 1 << 5;
fn exec_set_5_h(cpu: *sm83) void = cpu.regs.H |= 1 << 5;
fn exec_set_5_l(cpu: *sm83) void = cpu.regs.L |= 1 << 5;
fn exec_set_5_a(cpu: *sm83) void = cpu.regs.A |= 1 << 5;
fn exec_set_6_b(cpu: *sm83) void = cpu.regs.B |= 1 << 6;
fn exec_set_6_c(cpu: *sm83) void = cpu.regs.C |= 1 << 6;
fn exec_set_6_d(cpu: *sm83) void = cpu.regs.D |= 1 << 6;
fn exec_set_6_e(cpu: *sm83) void = cpu.regs.E |= 1 << 6;
fn exec_set_6_h(cpu: *sm83) void = cpu.regs.H |= 1 << 6;
fn exec_set_6_l(cpu: *sm83) void = cpu.regs.L |= 1 << 6;
fn exec_set_6_a(cpu: *sm83) void = cpu.regs.A |= 1 << 6;
fn exec_set_7_b(cpu: *sm83) void = cpu.regs.B |= 1 << 7;
fn exec_set_7_c(cpu: *sm83) void = cpu.regs.C |= 1 << 7;
fn exec_set_7_d(cpu: *sm83) void = cpu.regs.D |= 1 << 7;
fn exec_set_7_e(cpu: *sm83) void = cpu.regs.E |= 1 << 7;
fn exec_set_7_h(cpu: *sm83) void = cpu.regs.H |= 1 << 7;
fn exec_set_7_l(cpu: *sm83) void = cpu.regs.L |= 1 << 7;
fn exec_set_7_a(cpu: *sm83) void = cpu.regs.A |= 1 << 7;

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

fn exec_set_0_hl(cpu: *sm83) void = sethl(cpu, 0);
fn exec_set_1_hl(cpu: *sm83) void = sethl(cpu, 1);
fn exec_set_2_hl(cpu: *sm83) void = sethl(cpu, 2);
fn exec_set_3_hl(cpu: *sm83) void = sethl(cpu, 3);
fn exec_set_4_hl(cpu: *sm83) void = sethl(cpu, 4);
fn exec_set_5_hl(cpu: *sm83) void = sethl(cpu, 5);
fn exec_set_6_hl(cpu: *sm83) void = sethl(cpu, 6);
fn exec_set_7_hl(cpu: *sm83) void = sethl(cpu, 7);