~sircmpwn/hdmg

cb46d255c8aed66110c55d3f863589e44992a2db — Drew DeVault 2 years ago bbc0a0e
sm83: implement RST instructions
1 files changed, 39 insertions(+), 8 deletions(-)

M sm83/instr.ha
M sm83/instr.ha => sm83/instr.ha +39 -8
@@ 16,14 16,45 @@ fn exec_prefix(cpu: *sm83) void = {
	abort("Unimplemented instruction"); // TODO
};

fn exec_rst_00(cpu: *sm83) void = abort("TODO");
fn exec_rst_08(cpu: *sm83) void = abort("TODO");
fn exec_rst_10(cpu: *sm83) void = abort("TODO");
fn exec_rst_18(cpu: *sm83) void = abort("TODO");
fn exec_rst_20(cpu: *sm83) void = abort("TODO");
fn exec_rst_28(cpu: *sm83) void = abort("TODO");
fn exec_rst_30(cpu: *sm83) void = abort("TODO");
fn exec_rst_38(cpu: *sm83) void = abort("TODO");
fn exec_rst_00(cpu: *sm83) void = {
	push(cpu, cpu.regs.PC);
	cpu.regs.PC = 0x00;
};

fn exec_rst_08(cpu: *sm83) void = {
	push(cpu, cpu.regs.PC);
	cpu.regs.PC = 0x08;
};

fn exec_rst_10(cpu: *sm83) void = {
	push(cpu, cpu.regs.PC);
	cpu.regs.PC = 0x10;
};

fn exec_rst_18(cpu: *sm83) void = {
	push(cpu, cpu.regs.PC);
	cpu.regs.PC = 0x18;
};

fn exec_rst_20(cpu: *sm83) void = {
	push(cpu, cpu.regs.PC);
	cpu.regs.PC = 0x20;
};

fn exec_rst_28(cpu: *sm83) void = {
	push(cpu, cpu.regs.PC);
	cpu.regs.PC = 0x28;
};

fn exec_rst_30(cpu: *sm83) void = {
	push(cpu, cpu.regs.PC);
	cpu.regs.PC = 0x30;
};

fn exec_rst_38(cpu: *sm83) void = {
	push(cpu, cpu.regs.PC);
	cpu.regs.PC = 0x38;
};

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