diff options
| author | Andrew Chambers <[email protected]> | 2021-10-09 00:55:24 +1300 |
|---|---|---|
| committer | Andrew Chambers <[email protected]> | 2021-10-09 00:55:24 +1300 |
| commit | befbbba725873cd801e9f78bf4852d90bc272bfd (patch) | |
| tree | 77d4fbbae92b6adc978a19bff44de622c64a1177 /main.c | |
| parent | ee80372abea5d9a2ff100f1ddb8be08470cc272d (diff) | |
Refactor op args.
Diffstat (limited to 'main.c')
| -rw-r--r-- | main.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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 { |
