From 5e33f395a9684494552c879ad1656ac0867fa014 Mon Sep 17 00:00:00 2001 From: Thomas Date: Tue, 21 Nov 2023 22:58:55 +0100 Subject: [PATCH] SPC700: implement NOTC, SETC, SETP, CLRC, CLRP, CLRV --- src/snes/cpu_spc700/cpu.rs | 25 +++++++++++++++++++++++++ src/test/processortests_spc700.rs | 12 ++++++------ 2 files changed, 31 insertions(+), 6 deletions(-) diff --git a/src/snes/cpu_spc700/cpu.rs b/src/snes/cpu_spc700/cpu.rs index 4aa2782..7f55ee5 100644 --- a/src/snes/cpu_spc700/cpu.rs +++ b/src/snes/cpu_spc700/cpu.rs @@ -174,6 +174,31 @@ where self.regs.write_flags(&[(Flag::I, false)]); self.tick_bus(2) } + InstructionType::NOTC => { + let c = self.regs.test_flag(Flag::C); + self.regs.write_flags(&[(Flag::C, !c)]); + self.tick_bus(2) + } + InstructionType::SETC => { + self.regs.write_flags(&[(Flag::C, true)]); + self.tick_bus(1) + } + InstructionType::SETP => { + self.regs.write_flags(&[(Flag::P, true)]); + self.tick_bus(1) + } + InstructionType::CLRP => { + self.regs.write_flags(&[(Flag::P, false)]); + self.tick_bus(1) + } + InstructionType::CLRC => { + self.regs.write_flags(&[(Flag::C, false)]); + self.tick_bus(1) + } + InstructionType::CLRV => { + self.regs.write_flags(&[(Flag::V, false), (Flag::H, false)]); + self.tick_bus(1) + } InstructionType::SET1 => self.op_setclr1(instr, true), InstructionType::CLR1 => self.op_setclr1(instr, false), InstructionType::OR => self.op_or(instr), diff --git a/src/test/processortests_spc700.rs b/src/test/processortests_spc700.rs index 2b21d1c..e4cb4da 100644 --- a/src/test/processortests_spc700.rs +++ b/src/test/processortests_spc700.rs @@ -204,7 +204,7 @@ cpu_test_no_trace!(instr_19, 0x19); //cpu_test!(instr_1d, 0x1d); //cpu_test!(instr_1e, 0x1e); //cpu_test!(instr_1f, 0x1f); -//cpu_test!(instr_20, 0x20); +cpu_test!(instr_20, 0x20); //cpu_test!(instr_21, 0x21); cpu_test!(instr_22, 0x22); //cpu_test!(instr_23, 0x23); @@ -240,7 +240,7 @@ cpu_test_no_trace!(instr_39, 0x39); //cpu_test!(instr_3d, 0x3d); //cpu_test!(instr_3e, 0x3e); //cpu_test!(instr_3f, 0x3f); -//cpu_test!(instr_40, 0x40); +cpu_test!(instr_40, 0x40); //cpu_test!(instr_41, 0x41); cpu_test!(instr_42, 0x42); //cpu_test!(instr_43, 0x43); @@ -276,7 +276,7 @@ cpu_test_no_trace!(instr_59, 0x59); cpu_test!(instr_5d, 0x5d); //cpu_test!(instr_5e, 0x5e); //cpu_test!(instr_5f, 0x5f); -//cpu_test!(instr_60, 0x60); +cpu_test!(instr_60, 0x60); //cpu_test!(instr_61, 0x61); cpu_test!(instr_62, 0x62); //cpu_test!(instr_63, 0x63); @@ -308,7 +308,7 @@ cpu_test!(instr_72, 0x72); cpu_test!(instr_7d, 0x7d); //cpu_test!(instr_7e, 0x7e); //cpu_test!(instr_7f, 0x7f); -//cpu_test!(instr_80, 0x80); +cpu_test!(instr_80, 0x80); //cpu_test!(instr_81, 0x81); cpu_test!(instr_82, 0x82); //cpu_test!(instr_83, 0x83); @@ -406,7 +406,7 @@ cpu_test!(instr_db, 0xdb); cpu_test!(instr_dd, 0xdd); //cpu_test!(instr_de, 0xde); //cpu_test!(instr_df, 0xdf); -//cpu_test!(instr_e0, 0xe0); +cpu_test!(instr_e0, 0xe0); //cpu_test!(instr_e1, 0xe1); cpu_test!(instr_e2, 0xe2); //cpu_test!(instr_e3, 0xe3); @@ -419,7 +419,7 @@ cpu_test!(instr_e9, 0xe9); //cpu_test!(instr_ea, 0xea); cpu_test!(instr_eb, 0xeb); cpu_test!(instr_ec, 0xec); -//cpu_test!(instr_ed, 0xed); +cpu_test!(instr_ed, 0xed); //cpu_test!(instr_ee, 0xee); //cpu_test!(instr_ef, 0xef); //cpu_test!(instr_f0, 0xf0);