@@ 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");