1
0
mirror of https://github.com/TomHarte/CLK.git synced 2024-10-01 13:58:20 +00:00

Resolve new decoding errors.

This commit is contained in:
Thomas Harte 2023-11-07 22:08:44 -05:00
parent f608153c1a
commit b927cf4159
2 changed files with 12 additions and 7 deletions

View File

@ -163,19 +163,19 @@ std::pair<int, typename Decoder<model>::InstructionT> Decoder<model>::decode(con
PartialBlock(0x20, AND); break;
case 0x26: segment_override_ = Source::ES; break;
case 0x27: Complete(DAA, eAX, eAX, DataSize::Byte); break;
case 0x27: Complete(DAA, None, None, DataSize::Byte); break;
PartialBlock(0x28, SUB); break;
case 0x2e: segment_override_ = Source::CS; break;
case 0x2f: Complete(DAS, eAX, eAX, DataSize::Byte); break;
case 0x2f: Complete(DAS, None, None, DataSize::Byte); break;
PartialBlock(0x30, XOR); break;
case 0x36: segment_override_ = Source::SS; break;
case 0x37: Complete(AAA, eAX, eAX, DataSize::Word); break;
case 0x37: Complete(AAA, None, None, DataSize::Word); break;
PartialBlock(0x38, CMP); break;
case 0x3e: segment_override_ = Source::DS; break;
case 0x3f: Complete(AAS, eAX, eAX, DataSize::Word); break;
case 0x3f: Complete(AAS, None, None, DataSize::Word); break;
#undef PartialBlock
@ -361,8 +361,8 @@ std::pair<int, typename Decoder<model>::InstructionT> Decoder<model>::decode(con
case 0x96: Complete(XCHG, eAX, eSI, data_size_); break;
case 0x97: Complete(XCHG, eAX, eDI, data_size_); break;
case 0x98: Complete(CBW, eAX, AH, data_size_); break;
case 0x99: Complete(CWD, eAX, eDX, data_size_); break;
case 0x98: Complete(CBW, None, None, data_size_); break;
case 0x99: Complete(CWD, None, None, data_size_); break;
case 0x9a: Far(CALLfar); break;
case 0x9b: Complete(WAIT, None, None, DataSize::Byte); break;
case 0x9c: Complete(PUSHF, None, None, data_size_); break;

View File

@ -506,7 +506,12 @@ std::string InstructionSet::x86::to_string(
default: {
const int operands = max_displayed_operands(instruction.second.operation());
const bool displacement = has_displacement(instruction.second.operation());
const bool print_first = operands > 1 && instruction.second.destination().source() != Source::None;
const bool print_first =
instruction.second.destination().source() != Source::None &&
(
operands > 1 ||
(operands > 0 && instruction.second.source().source() == Source::None)
);
if(print_first) {
operation += to_string(instruction.second.destination(), instruction.second, offset_length, immediate_length);
}