From 168dc12e270dbb862ad0c557beb86da6fb7097d7 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Wed, 8 Jun 2022 16:03:02 -0400 Subject: [PATCH] Avoid spurious mismatches. --- OSBindings/Mac/Clock SignalTests/68000OldVsNew.mm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/OSBindings/Mac/Clock SignalTests/68000OldVsNew.mm b/OSBindings/Mac/Clock SignalTests/68000OldVsNew.mm index 2f8631488..605957e94 100644 --- a/OSBindings/Mac/Clock SignalTests/68000OldVsNew.mm +++ b/OSBindings/Mac/Clock SignalTests/68000OldVsNew.mm @@ -214,7 +214,7 @@ template struct Tester { bus_handler.instructions = instructions; try { - processor.run_for(HalfCycles(5000)); + processor.run_for(HalfCycles(5000)); // Arbitrary, but will definitely exceed any one instruction (by quite a distance). } catch (const HarmlessStopException &) {} } @@ -279,11 +279,17 @@ template struct Tester { oldState.data[c] = newState.registers.data[c] = rand() ^ (rand() << 1); if(c != 7) oldState.address[c] = newState.registers.address[c] = rand() << 1; } - oldState.status = newState.registers.status = rand() | (1 << 13); + // Fully to paper over the two 68000s' different ways of doing a faked + // reset, pick a random status such that: + // + // (i) supervisor mode is active; + // (ii) trace is inactive; and + // (iii) interrupt level is 7. + oldState.status = newState.registers.status = (rand() | (1 << 13) | (7 << 8)) & ~(1 << 15); oldState.user_stack_pointer = newState.registers.user_stack_pointer = rand() << 1; - oldTester->processor.set_state(oldState); newTester->processor.set_state(newState); + oldTester->processor.set_state(oldState); // Run a single instruction. newTester->run_instructions(1);