diff options
author | Kartik Agaram <vc@akkartik.com> | 2018-10-12 23:27:26 -0700 |
---|---|---|
committer | Kartik Agaram <vc@akkartik.com> | 2018-10-12 23:27:26 -0700 |
commit | 01dada15c33dff954f3b76406fd9ed09ef4834c8 (patch) | |
tree | 3182032b3956bc0b2121ea26a46ff2dc758c8f1a | |
parent | 544fbdc6e2b6022297afe6e260e1986f1ce9a003 (diff) | |
download | mu-01dada15c33dff954f3b76406fd9ed09ef4834c8.tar.gz |
4687
-rw-r--r-- | subx/014indirect_addressing.cc | 22 | ||||
-rw-r--r-- | subx/015immediate_addressing.cc | 16 |
2 files changed, 19 insertions, 19 deletions
diff --git a/subx/014indirect_addressing.cc b/subx/014indirect_addressing.cc index a0369590..2355273d 100644 --- a/subx/014indirect_addressing.cc +++ b/subx/014indirect_addressing.cc @@ -374,11 +374,11 @@ af 00 00 00 # 0xaf :(before "End Single-Byte Opcodes") case 0x8b: { // copy r32 to r/m32 uint8_t modrm = next(); - uint8_t reg1 = (modrm>>3)&0x7; - trace(90, "run") << "copy r/m32 to " << rname(reg1) << end(); - int32_t* arg2 = effective_address(modrm); - Reg[reg1].i = *arg2; - trace(90, "run") << "storing 0x" << HEXWORD << *arg2 << end(); + uint8_t rdest = (modrm>>3)&0x7; + trace(90, "run") << "copy r/m32 to " << rname(rdest) << end(); + int32_t* src = effective_address(modrm); + Reg[rdest].i = *src; + trace(90, "run") << "storing 0x" << HEXWORD << *src << end(); break; } @@ -436,13 +436,13 @@ ab ff ff ff # 0xab with more data in following bytes :(before "End Single-Byte Opcodes") case 0x8a: { // copy r/m8 to r8 uint8_t modrm = next(); - uint8_t reg1 = (modrm>>3)&0x7; - trace(90, "run") << "copy r8/m8-at-r32 to lowermost byte of " << rname(reg1) << end(); + uint8_t rdest = (modrm>>3)&0x7; + trace(90, "run") << "copy r8/m8-at-r32 to lowermost byte of " << rname(rdest) << end(); // use unsigned to zero-extend 8-bit value to 32 bits - uint8_t* arg2 = reinterpret_cast<uint8_t*>(effective_address(modrm)); - trace(90, "run") << "storing 0x" << HEXBYTE << NUM(*arg2) << end(); - *reinterpret_cast<uint8_t*>(&Reg[reg1].u) = *arg2; // assumes host is little-endian - trace(90, "run") << rname(reg1) << " now contains 0x" << HEXWORD << Reg[reg1].u << end(); + uint8_t* src = reinterpret_cast<uint8_t*>(effective_address(modrm)); + trace(90, "run") << "storing 0x" << HEXBYTE << NUM(*src) << end(); + *reinterpret_cast<uint8_t*>(&Reg[rdest].u) = *src; // assumes host is little-endian + trace(90, "run") << rname(rdest) << " now contains 0x" << HEXWORD << Reg[rdest].u << end(); break; } diff --git a/subx/015immediate_addressing.cc b/subx/015immediate_addressing.cc index 1be27ec4..b5acc2cb 100644 --- a/subx/015immediate_addressing.cc +++ b/subx/015immediate_addressing.cc @@ -437,10 +437,10 @@ case 0xbc: case 0xbd: case 0xbe: case 0xbf: { // copy imm32 to r32 - uint8_t reg1 = op & 0x7; - int32_t arg2 = next32(); - trace(90, "run") << "copy imm32 0x" << HEXWORD << arg2 << " to " << rname(reg1) << end(); - Reg[reg1].i = arg2; + uint8_t rdest = op & 0x7; + int32_t src = next32(); + trace(90, "run") << "copy imm32 0x" << HEXWORD << src << " to " << rname(rdest) << end(); + Reg[rdest].i = src; break; } @@ -463,10 +463,10 @@ put(name, "c7", "copy imm32 to rm32"); case 0xc7: { // copy imm32 to r32 uint8_t modrm = next(); trace(90, "run") << "copy imm32 to r/m32" << end(); - int32_t* arg1 = effective_address(modrm); - int32_t arg2 = next32(); - trace(90, "run") << "imm32 is 0x" << HEXWORD << arg2 << end(); - *arg1 = arg2; + int32_t* dest = effective_address(modrm); + int32_t src = next32(); + trace(90, "run") << "imm32 is 0x" << HEXWORD << src << end(); + *dest = src; break; } |