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:
parent
89743f0ba0
commit
440f3bdb10
@ -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();
|
||||
}
|
||||
|
@ -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"];
|
||||
|
Loading…
Reference in New Issue
Block a user