1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-12-27 16:31:31 +00:00

Further improve error reporting.

This commit is contained in:
Thomas Harte 2023-10-16 15:47:06 -04:00
parent 89743f0ba0
commit 440f3bdb10
2 changed files with 23 additions and 2 deletions

View File

@ -184,6 +184,25 @@ class Status {
(not_parity_bit() ? 0 : ConditionCode::Parity);
}
std::string to_string() const {
std::string result;
if(overflow) result += "O"; else result += "-";
if(direction) result += "D"; else result += "-";
if(interrupt) result += "I"; else result += "-";
if(trap) result += "T"; else result += "-";
if(sign) result += "S"; else result += "-";
if(!zero) result += "S"; else result += "-";
result += "-";
if(auxiliary_carry) result += "A"; else result += "-";
result += "-";
if(!not_parity_bit()) result += "P"; else result += "-";
result += "-";
if(carry) result += "C"; else result += "-";
return result;
}
bool operator ==(const Status &rhs) const {
return get() == rhs.get();
}

View File

@ -702,9 +702,11 @@ struct FailedExecution {
NSMutableArray<NSString *> *reasons = [[NSMutableArray alloc] init];
if(!statusEqual) {
Status difference;
difference.set((intended_status.get() ^ execution_support.status.get()) & flags_mask);
[reasons addObject:
[NSString stringWithFormat:@"status differs by %04x",
(intended_status.get() ^ execution_support.status.get()) & flags_mask]];
[NSString stringWithFormat:@"status differs; errors in %s",
difference.to_string().c_str()]];
}
if(!registersEqual) {
[reasons addObject:@"registers don't match"];