mirror of
https://github.com/TomHarte/CLK.git
synced 2025-08-08 14:25:05 +00:00
Further improve error reporting.
This commit is contained in:
@@ -184,6 +184,25 @@ class Status {
|
|||||||
(not_parity_bit() ? 0 : ConditionCode::Parity);
|
(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 {
|
bool operator ==(const Status &rhs) const {
|
||||||
return get() == rhs.get();
|
return get() == rhs.get();
|
||||||
}
|
}
|
||||||
|
@@ -702,9 +702,11 @@ struct FailedExecution {
|
|||||||
|
|
||||||
NSMutableArray<NSString *> *reasons = [[NSMutableArray alloc] init];
|
NSMutableArray<NSString *> *reasons = [[NSMutableArray alloc] init];
|
||||||
if(!statusEqual) {
|
if(!statusEqual) {
|
||||||
|
Status difference;
|
||||||
|
difference.set((intended_status.get() ^ execution_support.status.get()) & flags_mask);
|
||||||
[reasons addObject:
|
[reasons addObject:
|
||||||
[NSString stringWithFormat:@"status differs by %04x",
|
[NSString stringWithFormat:@"status differs; errors in %s",
|
||||||
(intended_status.get() ^ execution_support.status.get()) & flags_mask]];
|
difference.to_string().c_str()]];
|
||||||
}
|
}
|
||||||
if(!registersEqual) {
|
if(!registersEqual) {
|
||||||
[reasons addObject:@"registers don't match"];
|
[reasons addObject:@"registers don't match"];
|
||||||
|
Reference in New Issue
Block a user