From 39f0ec753609866e02a072059491f8500219d385 Mon Sep 17 00:00:00 2001
From: Thomas Harte <thomas.harte@gmail.com>
Date: Tue, 3 May 2022 15:40:04 -0400
Subject: [PATCH] Get far enough through CHK to realise that MOVEM probably
 needs to be divided by direction.

---
 InstructionSets/M68k/Instruction.hpp            | 17 +++++++++++++++++
 .../Clock SignalTests/68000ComparativeTests.mm  |  5 ++++-
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/InstructionSets/M68k/Instruction.hpp b/InstructionSets/M68k/Instruction.hpp
index 51fd07fe2..ff484f148 100644
--- a/InstructionSets/M68k/Instruction.hpp
+++ b/InstructionSets/M68k/Instruction.hpp
@@ -287,14 +287,28 @@ template <Model model, Operation t_operation = Operation::Undefined> uint8_t ope
 		//	Single-operand read-modify-write.
 		//
 		case Operation::NBCD:
+		case Operation::NOTb:		case Operation::NOTw:		case Operation::NOTl:
+		case Operation::NEGb:		case Operation::NEGw:		case Operation::NEGl:
+		case Operation::NEGXb:		case Operation::NEGXw:		case Operation::NEGXl:
 		case Operation::EXTbtow:	case Operation::EXTwtol:
 			return FetchOp1 | StoreOp1;
 
+		//
+		//	CLR, which is model-dependent.
+		//
+		case Operation::CLRb:	case Operation::CLRw:	case Operation::CLRl:
+			if constexpr (model == Model::M68000) {
+				return FetchOp1 | StoreOp1;
+			} else {
+				return StoreOp1;
+			}
+
 		//
 		//	Two-operand; read both.
 		//
 		case Operation::CMPb:	case Operation::CMPw:	case Operation::CMPl:
 		case Operation::CMPAw:	case Operation::CMPAl:
+		case Operation::CHK:
 			return FetchOp1 | FetchOp2;
 
 		//
@@ -319,6 +333,9 @@ template <Model model, Operation t_operation = Operation::Undefined> uint8_t ope
 		case Operation::EORb:	case Operation::EORw:	case Operation::EORl:
 			return FetchOp1 | FetchOp2 | StoreOp2;
 
+//		case Operation::MOVEMw:
+//		case Operation::MOVEMl:
+
 		//
 		// Two-operand; read both, write source.
 		//
diff --git a/OSBindings/Mac/Clock SignalTests/68000ComparativeTests.mm b/OSBindings/Mac/Clock SignalTests/68000ComparativeTests.mm
index 7d24a212e..e8befd407 100644
--- a/OSBindings/Mac/Clock SignalTests/68000ComparativeTests.mm	
+++ b/OSBindings/Mac/Clock SignalTests/68000ComparativeTests.mm	
@@ -37,9 +37,12 @@
 //	addx_subx
 //	bcc
 
+// Skipped for now:
+//	btst_bchg_bclr_bset
+
 - (void)setUp {
 	// To limit tests run to a subset of files and/or of tests, uncomment and fill in below.
-	_fileSet = [NSSet setWithArray:@[@"btst_bchg_bclr_bset.json"]];
+	_fileSet = [NSSet setWithArray:@[@"chk.json"]];
 //	_testSet = [NSSet setWithArray:@[@"Bcc 6206"]];
 //	_fileSet = [NSSet setWithArray:@[@"jmp_jsr.json"]];
 //	_testSet = [NSSet setWithArray:@[@"CHK 41a8"]];