diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-10-18 02:00:44 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-10-18 02:00:44 -0700 |
commit | 9ecbcc552ee4646bdec8181bb6a8757a7b0fd700 (patch) | |
tree | b12b8cde13c1ce0ce3149390fd681b0458d59f85 /subx | |
parent | cb4be511b7bae326802420125403ba91870f30c5 (diff) | |
download | mu-9ecbcc552ee4646bdec8181bb6a8757a7b0fd700.tar.gz |
4082
subx: correct a 'copy' ('mov') instruction as well to get its operand right from the opcode.
Diffstat (limited to 'subx')
-rw-r--r-- | subx/011direct_addressing.cc | 2 | ||||
-rw-r--r-- | subx/013immediate_addressing.cc | 14 |
2 files changed, 11 insertions, 5 deletions
diff --git a/subx/011direct_addressing.cc b/subx/011direct_addressing.cc index 827ce41e..a8f3fe7e 100644 --- a/subx/011direct_addressing.cc +++ b/subx/011direct_addressing.cc @@ -235,7 +235,7 @@ case 0x53: case 0x54: case 0x55: case 0x56: -case 0x57: { +case 0x57: { // push r32 to stack uint8_t reg = op & 0x7; trace(2, "run") << "push reg " << NUM(reg) << end(); const int32_t val = Reg[reg].u; diff --git a/subx/013immediate_addressing.cc b/subx/013immediate_addressing.cc index 14121d42..4773e75f 100644 --- a/subx/013immediate_addressing.cc +++ b/subx/013immediate_addressing.cc @@ -332,14 +332,20 @@ case 7: { :(scenario copy_imm32_to_r32) # op ModRM SIB displacement immediate - b8 03 0a 0b 0c 0d # copy 0x0d0c0b0a to EBX (reg 3) + bb 0a 0b 0c 0d # copy 0x0d0c0b0a to EBX (reg 3) +run: copy imm32 0x0d0c0b0a to reg 3 :(before "End Single-Byte Opcodes") -case 0xb8: { // copy imm32 to r32 - uint8_t modrm = next(); +case 0xb8: +case 0xb9: +case 0xba: +case 0xbb: +case 0xbc: +case 0xbd: +case 0xbe: +case 0xbf: { // copy imm32 to r32 + uint8_t reg1 = op & 0x7; int32_t arg2 = imm32(); - uint8_t reg1 = modrm&0x7; // ignore mod bits trace(2, "run") << "copy imm32 0x" << HEXWORD << arg2 << " to reg " << NUM(reg1) << end(); Reg[reg1].i = arg2; break; |