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

Add notes to self, finally figuring out segment issue.

This commit is contained in:
Thomas Harte 2023-09-19 23:27:42 -04:00
parent 406c838c39
commit 7ebecd2f41
3 changed files with 6 additions and 2 deletions

View File

@ -673,6 +673,9 @@ std::pair<int, typename Decoder<model>::InstructionT> Decoder<model>::decode(con
ScaleIndexBase(0, Source::None, Source::eBX),
};
// TODO: unless overridden, BP and SP are always relative to ss; SI to ds; DI to es.
// Capture that.
sib_ = rm_table[rm];
}
}

View File

@ -760,12 +760,12 @@ template<bool is_32bit> class Instruction {
return AddressSize(mem_exts_source_ >> 7);
}
/// @returns @c Source::DS if no segment override was found; the overridden segment otherwise.
/// @returns @c Source::None if no segment override was found; the overridden segment otherwise.
/// On x86 a segment override cannot modify the segment used as a destination in string instructions,
/// or that used by stack instructions, but this function does not spend the time necessary to provide
/// the correct default for those.
Source data_segment() const {
if(!has_length_extension()) return Source::DS;
if(!has_length_extension()) return Source::None;
return Source(
int(Source::ES) +
((length_extension() >> 1) & 7)

View File

@ -172,6 +172,7 @@ constexpr char TestSuiteHome[] = "/Users/tharte/Projects/ProcessorTests/8088/v1"
log_hex();
// Repeat operand conversions, for debugging.
Decoder().decode(data.data(), data.size());
const auto destination = decoded.second.destination();
to_string(destination, decoded.second);
const auto source = decoded.second.source();