mirror of
https://github.com/TomHarte/CLK.git
synced 2025-02-06 13:31:55 +00:00
Simplify roll/shift case.
This commit is contained in:
parent
f6fd49d950
commit
6597283c34
@ -530,28 +530,19 @@ std::string InstructionSet::x86::to_string(
|
|||||||
case Operation::SAL: case Operation::SAR:
|
case Operation::SAL: case Operation::SAR:
|
||||||
case Operation::SHR:
|
case Operation::SHR:
|
||||||
case Operation::SETMO: case Operation::SETMOC:
|
case Operation::SETMO: case Operation::SETMOC:
|
||||||
const int operands = max_displayed_operands(instruction.operation);
|
operation += to_string(instruction.destination(), instruction, offset_length, immediate_length);
|
||||||
const bool displacement = has_displacement(instruction.operation);
|
switch(instruction.source().source()) {
|
||||||
if(operands > 1) {
|
case Source::None: break;
|
||||||
operation += to_string(instruction.destination(), instruction, offset_length, immediate_length);
|
case Source::eCX: operation += ", cl"; break;
|
||||||
}
|
case Source::Immediate:
|
||||||
if(operands > 0) {
|
// Providing an immediate operand of 1 is a little future-proofing by the decoder; the '1'
|
||||||
switch(instruction.source().source()) {
|
// is actually implicit on a real 8088. So omit it.
|
||||||
case Source::None: break;
|
if(instruction.operand() == 1) break;
|
||||||
case Source::eCX: operation += ", cl"; break;
|
[[fallthrough]];
|
||||||
case Source::Immediate:
|
default:
|
||||||
// Providing an immediate operand of 1 is a little future-proofing by the decoder; the '1'
|
operation += ", ";
|
||||||
// is actually implicit on a real 8088. So omit it.
|
operation += to_string(instruction.source(), instruction, offset_length, immediate_length);
|
||||||
if(instruction.operand() == 1) break;
|
break;
|
||||||
[[fallthrough]];
|
|
||||||
default:
|
|
||||||
operation += ", ";
|
|
||||||
operation += to_string(instruction.source(), instruction, offset_length, immediate_length);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if(displacement) {
|
|
||||||
operation += to_hex(instruction.displacement(), offset_length);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user