mirror of
https://github.com/TomHarte/CLK.git
synced 2026-01-23 01:16:10 +00:00
Support 286-style DAS.
321 failures to go.
This commit is contained in:
@@ -104,18 +104,27 @@ void daas(
|
||||
ContextT &context
|
||||
) {
|
||||
bool top_exceeded_threshold;
|
||||
if constexpr (ContextT::model == Model::i8086) {
|
||||
constexpr bool is_8086 = ContextT::model == Model::i8086;
|
||||
if constexpr (is_8086) {
|
||||
top_exceeded_threshold = al > (context.flags.template flag<Flag::AuxiliaryCarry>() ? 0x9f : 0x99);
|
||||
} else {
|
||||
top_exceeded_threshold = al > 0x99;
|
||||
}
|
||||
|
||||
const auto initial_cf = context.flags.template flag<Flag::Carry>();
|
||||
if((al & 0x0f) > 0x09 || context.flags.template flag<Flag::AuxiliaryCarry>()) {
|
||||
if constexpr (add) al += 0x06; else al -= 0x06;
|
||||
const auto prior_al = al;
|
||||
if constexpr (add) {
|
||||
al += 0x06;
|
||||
if(!is_8086 && al < prior_al) context.flags.template set_from<Flag::Carry>(1);
|
||||
} else {
|
||||
al -= 0x06;
|
||||
if(!is_8086 && al > prior_al) context.flags.template set_from<Flag::Carry>(1);
|
||||
}
|
||||
context.flags.template set_from<Flag::AuxiliaryCarry>(1);
|
||||
}
|
||||
|
||||
if(top_exceeded_threshold || context.flags.template flag<Flag::Carry>()) {
|
||||
if(top_exceeded_threshold || initial_cf) {
|
||||
if constexpr (add) al += 0x60; else al -= 0x60;
|
||||
context.flags.template set_from<Flag::Carry>(1);
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ NSSet *const allowList = [NSSet setWithArray:@[
|
||||
// @"F7.7.json.gz", // IDIV word
|
||||
// @"00.json.gz",
|
||||
|
||||
// @"2F.json.gz", // DAS
|
||||
// @"61.json.gz", // POPA
|
||||
// @"69.json.gz", // IMUL
|
||||
// @"81.0.json.gz", // ADD
|
||||
@@ -386,7 +385,7 @@ void apply_execution_test(
|
||||
NSDictionary *metadata
|
||||
) {
|
||||
// NSLog(@"%@", test[@"hash"]);
|
||||
if([test[@"hash"] isEqualToString:@"3744dfa0a1386ef97ddd25c67bad150ba05beb3b"]) {
|
||||
if([test[@"hash"] isEqualToString:@"453ef52b02539ada0b78a7bdc319c4d7d06fc0a2"]) {
|
||||
printf("");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user