diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2017-10-15 00:06:37 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2017-10-15 00:06:37 -0700 |
commit | 125bea475fab2220e3e462986cfc8313fa937f7f (patch) | |
tree | 572373684305516deefbea2abab782629dc0d0f9 /subx/012indirect_addressing.cc | |
parent | 311297cb006201f4706704b32c762630806c7adb (diff) | |
download | mu-125bea475fab2220e3e462986cfc8313fa937f7f.tar.gz |
4067
subx: 'mov'
Diffstat (limited to 'subx/012indirect_addressing.cc')
-rw-r--r-- | subx/012indirect_addressing.cc | 35 |
1 files changed, 34 insertions, 1 deletions
diff --git a/subx/012indirect_addressing.cc b/subx/012indirect_addressing.cc index 546df707..3b2944b2 100644 --- a/subx/012indirect_addressing.cc +++ b/subx/012indirect_addressing.cc @@ -193,7 +193,7 @@ case 0x33: { // xor r/m32 with r32 +run: effective address is mem at address 0x60 (reg 3) +run: storing 0xf0f0ff00 -//:: compare +//:: compare (cmp) :(scenario compare_mem_at_r32_with_r32_greater) % Reg[0].i = 0x60; @@ -272,3 +272,36 @@ case 0x3b: { // set SF if r32 < r/m32 +run: compare effective address with reg 3 +run: effective address is mem at address 0x60 (reg 0) +run: SF=0; ZF=1; OF=0 + +//:: copy (mov) + +:(scenario copy_r32_to_mem_at_r32) +% Reg[3].i = 0xaf; +% Reg[0].i = 0x60; +# op ModRM SIB displacement immediate + 89 18 # copy EBX (reg 3) to *EAX (reg 0) ++run: copy reg 3 to effective address ++run: effective address is mem at address 0x60 (reg 0) ++run: storing 0x000000af + +//: + +:(scenario copy_mem_at_r32_to_r32) +% Reg[0].i = 0x60; +% SET_WORD_IN_MEM(0x60, 0x000000af); +# op ModRM SIB displacement immediate + 8b 18 # copy *EAX (reg 0) to EBX (reg 3) ++run: copy effective address to reg 3 ++run: effective address is mem at address 0x60 (reg 0) ++run: storing 0x000000af + +:(before "End Single-Byte Opcodes") +case 0x8b: { // copy r32 to r/m32 + uint8_t modrm = next(); + uint8_t reg1 = (modrm>>3)&0x7; + trace(2, "run") << "copy effective address to reg " << NUM(reg1) << end(); + int32_t* arg2 = effective_address(modrm); + Reg[reg1].i = *arg2; + trace(2, "run") << "storing 0x" << HEXWORD << *arg2 << end(); + break; +} |