From 7a219c68bae6dbe214aec69a051015e851e32400 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Thu, 12 Oct 2017 23:55:19 -0700 Subject: 4054 --- html/subx/012indirect_addressing.cc.html | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) (limited to 'html/subx/012indirect_addressing.cc.html') diff --git a/html/subx/012indirect_addressing.cc.html b/html/subx/012indirect_addressing.cc.html index b5360e6f..8f90ff92 100644 --- a/html/subx/012indirect_addressing.cc.html +++ b/html/subx/012indirect_addressing.cc.html @@ -70,7 +70,7 @@ if ('onhashchange' in window) { 7 % Mem.at(0x60) = 1; 8 # op ModR/M SIB displacement immediate 9 01 18 # add EBX (reg 3) to *EAX (reg 0) -10 +run: add reg 3 to effective address +10 +run: add reg 3 to effective address 11 +run: effective address is mem at address 0x60 (reg 0) 12 +run: storing 0x00000011 13 @@ -79,9 +79,9 @@ if ('onhashchange' in window) { 16 // mod 0 is usually indirect addressing 17 switch (rm) { 18 default: -19 ¦ trace(2, "run") << "effective address is mem at address 0x" << std::hex << Reg[rm].u << " (reg " << NUM(rm) << ")" << end(); -20 ¦ assert(Reg[rm].u + sizeof(int32_t) <= Mem.size()); -21 ¦ result = reinterpret_cast<int32_t*>(&Mem.at(Reg[rm].u)); // rely on the host itself being in little-endian order +19 ¦ trace(2, "run") << "effective address is mem at address 0x" << std::hex << Reg[rm].u << " (reg " << NUM(rm) << ")" << end(); +20 ¦ assert(Reg[rm].u + sizeof(int32_t) <= Mem.size()); +21 ¦ result = reinterpret_cast<int32_t*>(&Mem.at(Reg[rm].u)); // rely on the host itself being in little-endian order 22 ¦ break; 23 // End Mod 0 Special-cases 24 } @@ -95,17 +95,17 @@ if ('onhashchange' in window) { 32 % Mem.at(0x60) = 1; 33 # op ModR/M SIB displacement immediate 34 03 18 # add *EAX (reg 0) to EBX (reg 3) -35 +run: add effective address to reg 3 +35 +run: add effective address to reg 3 36 +run: effective address is mem at address 0x60 (reg 0) 37 +run: storing 0x00000011 38 39 :(before "End Single-Byte Opcodes") 40 case 0x03: { // add r/m32 to r32 -41 uint8_t modrm = next(); +41 uint8_t modrm = next(); 42 uint8_t arg1 = (modrm>>3)&0x7; -43 trace(2, "run") << "add effective address to reg " << NUM(arg1) << end(); -44 const int32_t* arg2 = effective_address(modrm); -45 BINARY_ARITHMETIC_OP(+, Reg[arg1].i, *arg2); +43 trace(2, "run") << "add effective address to reg " << NUM(arg1) << end(); +44 const int32_t* arg2 = effective_address(modrm); +45 BINARY_ARITHMETIC_OP(+, Reg[arg1].i, *arg2); 46 break; 47 } 48 @@ -117,7 +117,7 @@ if ('onhashchange' in window) { 54 % Reg[3].i = 1; 55 # op ModRM SIB displacement immediate 56 29 18 # subtract EBX (reg 3) from *EAX (reg 0) -57 +run: subtract reg 3 from effective address +57 +run: subtract reg 3 from effective address 58 +run: effective address is mem at address 0x60 (reg 0) 59 +run: storing 0x00000009 60 @@ -129,17 +129,17 @@ if ('onhashchange' in window) { 66 % Reg[3].i = 10; 67 # op ModRM SIB displacement immediate 68 2b 18 # subtract *EAX (reg 0) from EBX (reg 3) -69 +run: subtract effective address from reg 3 +69 +run: subtract effective address from reg 3 70 +run: effective address is mem at address 0x60 (reg 0) 71 +run: storing 0x00000009 72 73 :(before "End Single-Byte Opcodes") 74 case 0x2b: { // subtract r/m32 from r32 -75 uint8_t modrm = next(); +75 uint8_t modrm = next(); 76 uint8_t arg1 = (modrm>>3)&0x7; -77 trace(2, "run") << "subtract effective address from reg " << NUM(arg1) << end(); -78 const int32_t* arg2 = effective_address(modrm); -79 BINARY_ARITHMETIC_OP(-, Reg[arg1].i, *arg2); +77 trace(2, "run") << "subtract effective address from reg " << NUM(arg1) << end(); +78 const int32_t* arg2 = effective_address(modrm); +79 BINARY_ARITHMETIC_OP(-, Reg[arg1].i, *arg2); 80 break; 81 } -- cgit 1.4.1-2-gfad0