aboutsummaryrefslogtreecommitdiff
path: root/main.c
diff options
context:
space:
mode:
authorAndrew Chambers <[email protected]>2021-10-09 00:55:24 +1300
committerAndrew Chambers <[email protected]>2021-10-09 00:55:24 +1300
commitbefbbba725873cd801e9f78bf4852d90bc272bfd (patch)
tree77d4fbbae92b6adc978a19bff44de622c64a1177 /main.c
parentee80372abea5d9a2ff100f1ddb8be08470cc272d (diff)
Refactor op args.
Diffstat (limited to 'main.c')
-rw-r--r--main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/main.c b/main.c
index 9fc57f6..3337bcc 100644
--- a/main.c
+++ b/main.c
@@ -458,16 +458,16 @@ static void assemblemov(Instr *mov) {
uint8_t opcode, rex, mod, rm;
static uint8_t variant2op[20] = {
- 0xb0, 0xb8, 0xb8, 0xc7, 0xc6, 0xc7, 0xc7, 0xc7, 0x8a, 0x8b,
+ 0xc6, 0xc7, 0xc7, 0xc7, 0xb0, 0xb8, 0xb8, 0xc7, 0x8a, 0x8b,
0x8b, 0x8b, 0x88, 0x89, 0x89, 0x89, 0x88, 0x89, 0x89, 0x89,
};
opcode = variant2op[mov->variant];
- if (mov->variant < 3) {
+ if (mov->variant >= 4 && mov->variant <= 6) {
imm = &mov->src->imm;
assembleplusr(opcode, mov->dst->kind);
assemblevalue(imm->l, imm->c, imm->nbytes);
- } else if (mov->variant < 8) {
+ } else if (mov->variant == 7 || mov->variant < 4) {
uint8_t opsz = 1 << (mov->variant % 4);
assembleimmrm(mov, opcode, 0x00, opsz);
} else {