From 82f0cd790fe2047b15668cf7735a8837c7817a18 Mon Sep 17 00:00:00 2001 From: Thomas Harte Date: Fri, 6 Oct 2023 11:43:18 -0400 Subject: [PATCH] Find first failing execution, note reason. --- .../x86/Implementation/PerformImplementation.hpp | 5 +++++ OSBindings/Mac/Clock SignalTests/8088Tests.mm | 15 +++++++++------ 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/InstructionSets/x86/Implementation/PerformImplementation.hpp b/InstructionSets/x86/Implementation/PerformImplementation.hpp index 072d59e53..6f4a8df92 100644 --- a/InstructionSets/x86/Implementation/PerformImplementation.hpp +++ b/InstructionSets/x86/Implementation/PerformImplementation.hpp @@ -118,10 +118,15 @@ inline void aam(CPU::RegisterPair16 &ax, uint8_t imm, Status &status) { The SF, ZF, and PF flags are set according to the result. The OF, AF, and CF flags are undefined. */ + /* + If ... an immediate value of 0 is used, it will cause a #DE (divide error) exception. + */ ax.halves.high = ax.halves.low / imm; ax.halves.low = ax.halves.low % imm; status.sign = ax.halves.low & 0x80; status.parity = status.zero = ax.halves.low; + + // TODO: #DE. } inline void aas(CPU::RegisterPair16 &ax, Status &status) { diff --git a/OSBindings/Mac/Clock SignalTests/8088Tests.mm b/OSBindings/Mac/Clock SignalTests/8088Tests.mm index 25748663a..296beca58 100644 --- a/OSBindings/Mac/Clock SignalTests/8088Tests.mm +++ b/OSBindings/Mac/Clock SignalTests/8088Tests.mm @@ -315,20 +315,23 @@ struct FlowController { if(assert) { XCTAssert( statusEqual, - "Status doesn't match — differs in %02x after %@", + "Status doesn't match — differs in %02x after %@; executing %@", intended_status.get() ^ status.get(), - test[@"name"] + test[@"name"], + [self toString:decoded.second offsetLength:4 immediateLength:4] ); // TODO: should probably say more about the following two. XCTAssert( registersEqual, - "Register mismatch after %@", - test[@"name"] + "Register mismatch after %@; executing %@", + test[@"name"], + [self toString:decoded.second offsetLength:4 immediateLength:4] ); XCTAssert( ramEqual, - "Memory contents mismatch after %@", - test[@"name"] + "Memory contents mismatch after %@; executing %@", + test[@"name"], + [self toString:decoded.second offsetLength:4 immediateLength:4] ); }