Skip to content

Commit

Permalink
SPC700: implement NOTC, SETC, SETP, CLRC, CLRP, CLRV
Browse files Browse the repository at this point in the history
  • Loading branch information
twvd committed Nov 21, 2023
1 parent 4f9e622 commit 5e33f39
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 6 deletions.
25 changes: 25 additions & 0 deletions src/snes/cpu_spc700/cpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
12 changes: 6 additions & 6 deletions src/test/processortests_spc700.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down

0 comments on commit 5e33f39

Please sign in to comment.