1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-07-15 15:29:53 +00:00

Find first failing execution, note reason.

This commit is contained in:
Thomas Harte 2023-10-06 11:43:18 -04:00
parent 2d17d9d316
commit 82f0cd790f
2 changed files with 14 additions and 6 deletions

View File

@ -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 SF, ZF, and PF flags are set according to the result.
The OF, AF, and CF flags are undefined. 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.high = ax.halves.low / imm;
ax.halves.low = ax.halves.low % imm; ax.halves.low = ax.halves.low % imm;
status.sign = ax.halves.low & 0x80; status.sign = ax.halves.low & 0x80;
status.parity = status.zero = ax.halves.low; status.parity = status.zero = ax.halves.low;
// TODO: #DE.
} }
inline void aas(CPU::RegisterPair16 &ax, Status &status) { inline void aas(CPU::RegisterPair16 &ax, Status &status) {

View File

@ -315,20 +315,23 @@ struct FlowController {
if(assert) { if(assert) {
XCTAssert( XCTAssert(
statusEqual, statusEqual,
"Status doesn't match — differs in %02x after %@", "Status doesn't match — differs in %02x after %@; executing %@",
intended_status.get() ^ status.get(), 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. // TODO: should probably say more about the following two.
XCTAssert( XCTAssert(
registersEqual, registersEqual,
"Register mismatch after %@", "Register mismatch after %@; executing %@",
test[@"name"] test[@"name"],
[self toString:decoded.second offsetLength:4 immediateLength:4]
); );
XCTAssert( XCTAssert(
ramEqual, ramEqual,
"Memory contents mismatch after %@", "Memory contents mismatch after %@; executing %@",
test[@"name"] test[@"name"],
[self toString:decoded.second offsetLength:4 immediateLength:4]
); );
} }