about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-10-22 00:59:46 -0700
committerKartik Agaram <vc@akkartik.com>2020-10-22 00:59:46 -0700
commitc82d149b3f92cccdbaa054e7ee4ecb814b523fec (patch)
tree2bda68504f9435d57a341f0d614ab526b7d00147
parentd409be9b29b4bbfdf10fa26620fa6abbe45a87da (diff)
downloadmu-c82d149b3f92cccdbaa054e7ee4ecb814b523fec.tar.gz
7089
-rw-r--r--013direct_addressing.cc29
-rw-r--r--014indirect_addressing.cc48
-rw-r--r--015immediate_addressing.cc36
-rw-r--r--016index_addressing.cc10
-rw-r--r--019functions.cc6
5 files changed, 66 insertions, 63 deletions
diff --git a/013direct_addressing.cc b/013direct_addressing.cc
index 8dc2bb77..ee0b11fc 100644
--- a/013direct_addressing.cc
+++ b/013direct_addressing.cc
@@ -44,7 +44,7 @@ case 0x01: {  // add r32 to r/m32
 
 :(code)
 void test_add_r32_to_r32_signed_overflow() {
-  Reg[EAX].i = 0x7fffffff;  // largest positive signed integer
+  Reg[EAX].i = INT32_MAX;
   Reg[EBX].i = 1;
   run(
       "== code 0x1\n"  // code segment
@@ -61,7 +61,7 @@ void test_add_r32_to_r32_signed_overflow() {
 }
 
 void test_add_r32_to_r32_unsigned_overflow() {
-  Reg[EAX].u = 0xffffffff;  // largest unsigned number
+  Reg[EAX].u = UINT_MAX;
   Reg[EBX].u = 1;
   run(
       "== code 0x1\n"  // code segment
@@ -78,7 +78,7 @@ void test_add_r32_to_r32_unsigned_overflow() {
 }
 
 void test_add_r32_to_r32_unsigned_and_signed_overflow() {
-  Reg[EAX].u = Reg[EBX].u = 0x80000000;  // smallest negative signed integer
+  Reg[EAX].i = Reg[EBX].i = INT32_MIN;
   run(
       "== code 0x1\n"  // code segment
       // op     ModR/M  SIB   displacement  immediate
@@ -193,8 +193,8 @@ case 0x29: {  // subtract r32 from r/m32
 
 :(code)
 void test_subtract_r32_from_r32_signed_overflow() {
-  Reg[EAX].i = 0x80000000;  // smallest negative signed integer
-  Reg[EBX].i = 0x7fffffff;  // largest positive signed integer
+  Reg[EAX].i = INT32_MIN;
+  Reg[EBX].i = INT32_MAX;
   run(
       "== code 0x1\n"  // code segment
       // op     ModR/M  SIB   displacement  immediate
@@ -228,7 +228,7 @@ void test_subtract_r32_from_r32_unsigned_overflow() {
 
 void test_subtract_r32_from_r32_signed_and_unsigned_overflow() {
   Reg[EAX].i = 0;
-  Reg[EBX].i = 0x80000000;  // smallest negative signed integer
+  Reg[EBX].i = INT32_MIN;
   run(
       "== code 0x1\n"  // code segment
       // op     ModR/M  SIB   displacement  immediate
@@ -894,8 +894,8 @@ void test_compare_r32_with_r32_lesser_unsigned_and_signed() {
 }
 
 void test_compare_r32_with_r32_lesser_unsigned_and_signed_due_to_overflow() {
-  Reg[EAX].i = 0x7fffffff;  // largest positive signed integer
-  Reg[EBX].i = 0x80000000;  // smallest negative signed integer
+  Reg[EAX].i = INT32_MAX;
+  Reg[EBX].i = INT32_MIN;
   run(
       "== code 0x1\n"  // code segment
       // op     ModR/M  SIB   displacement  immediate
@@ -910,8 +910,8 @@ void test_compare_r32_with_r32_lesser_unsigned_and_signed_due_to_overflow() {
 }
 
 void test_compare_r32_with_r32_lesser_signed() {
-  Reg[EAX].i = 0xffffffff;  // -1
-  Reg[EBX].i = 0x00000001;  // 1
+  Reg[EAX].i = -1;
+  Reg[EBX].i = 1;
   run(
       "== code 0x1\n"  // code segment
       // op     ModR/M  SIB   displacement  immediate
@@ -926,8 +926,8 @@ void test_compare_r32_with_r32_lesser_signed() {
 }
 
 void test_compare_r32_with_r32_lesser_unsigned() {
-  Reg[EAX].i = 0x00000001;  // 1
-  Reg[EBX].i = 0xffffffff;  // -1
+  Reg[EAX].i = 1;
+  Reg[EBX].i = -1;
   run(
       "== code 0x1\n"  // code segment
       // op     ModR/M  SIB   displacement  immediate
@@ -1241,7 +1241,7 @@ void test_pop_r32() {
       // op     ModR/M  SIB   displacement  immediate
       "  5b                                           \n"  // pop stack to EBX
       "== data 0x2000\n"  // data segment
-      "0a 00 00 00\n"  // 0x0000000a
+      "0a 00 00 00\n"  // 0xa
   );
   CHECK_TRACE_CONTENTS(
       "run: pop into EBX\n"
@@ -1275,3 +1275,6 @@ uint32_t pop() {
   assert(Reg[ESP].u < AFTER_STACK);
   return result;
 }
+
+:(before "End Includes")
+#include <climits>
diff --git a/014indirect_addressing.cc b/014indirect_addressing.cc
index 61e78dfa..36b680ca 100644
--- a/014indirect_addressing.cc
+++ b/014indirect_addressing.cc
@@ -10,7 +10,7 @@ void test_add_r32_to_mem_at_rm32() {
       "  01     18                                    \n"  // add EBX to *EAX
       // ModR/M in binary: 00 (indirect mode) 011 (src EBX) 000 (dest EAX)
       "== data 0x2000\n"
-      "01 00 00 00\n"  // 0x00000001
+      "01 00 00 00\n"  // 0x1
   );
   CHECK_TRACE_CONTENTS(
       "run: add EBX to r/m32\n"
@@ -45,7 +45,7 @@ void test_add_mem_at_rm32_to_r32() {
       "  03     18                                    \n"  // add *EAX to EBX
       // ModR/M in binary: 00 (indirect mode) 011 (src EBX) 000 (dest EAX)
       "== data 0x2000\n"
-      "01 00 00 00\n"  // 0x00000001
+      "01 00 00 00\n"  // 0x1
   );
   CHECK_TRACE_CONTENTS(
       "run: add r/m32 to EBX\n"
@@ -79,7 +79,7 @@ case 0x03: {  // add r/m32 to r32
 :(code)
 void test_add_mem_at_rm32_to_r32_signed_overflow() {
   Reg[EAX].i = 0x2000;
-  Reg[EBX].i = 0x7fffffff;  // largest positive signed integer
+  Reg[EBX].i = INT32_MAX;
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
@@ -99,7 +99,7 @@ void test_add_mem_at_rm32_to_r32_signed_overflow() {
 
 void test_add_mem_at_rm32_to_r32_unsigned_overflow() {
   Reg[EAX].u = 0x2000;
-  Reg[EBX].u = 0xffffffff;  // largest unsigned number
+  Reg[EBX].u = UINT_MAX;
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
@@ -119,14 +119,14 @@ void test_add_mem_at_rm32_to_r32_unsigned_overflow() {
 
 void test_add_mem_at_rm32_to_r32_unsigned_and_signed_overflow() {
   Reg[EAX].u = 0x2000;
-  Reg[EBX].u = 0x80000000;  // smallest negative signed integer
+  Reg[EBX].i = INT32_MIN;
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
       "  03     18                                    \n" // add *EAX to EBX
       // ModR/M in binary: 00 (indirect mode) 011 (src EBX) 000 (dest EAX)
       "== data 0x2000\n"
-      "00 00 00 80\n"  // smallest negative signed integer
+      "00 00 00 80\n"  // INT32_MIN
   );
   CHECK_TRACE_CONTENTS(
       "run: add r/m32 to EBX\n"
@@ -149,7 +149,7 @@ void test_subtract_r32_from_mem_at_rm32() {
       "  29     18                                    \n"  // subtract EBX from *EAX
       // ModR/M in binary: 00 (indirect mode) 011 (src EBX) 000 (dest EAX)
       "== data 0x2000\n"
-      "0a 00 00 00\n"  // 0x0000000a
+      "0a 00 00 00\n"  // 0xa
   );
   CHECK_TRACE_CONTENTS(
       "run: subtract EBX from r/m32\n"
@@ -173,7 +173,7 @@ void test_subtract_mem_at_rm32_from_r32() {
       "  2b     18                                    \n"  // subtract *EAX from EBX
       // ModR/M in binary: 00 (indirect mode) 011 (src EBX) 000 (dest EAX)
       "== data 0x2000\n"
-      "01 00 00 00\n"  // 0x00000001
+      "01 00 00 00\n"  // 0x1
   );
   CHECK_TRACE_CONTENTS(
       "run: subtract r/m32 from EBX\n"
@@ -207,14 +207,14 @@ case 0x2b: {  // subtract r/m32 from r32
 :(code)
 void test_subtract_mem_at_rm32_from_r32_signed_overflow() {
   Reg[EAX].i = 0x2000;
-  Reg[EBX].i = 0x80000000;  // smallest negative signed integer
+  Reg[EBX].i = INT32_MIN;
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
       "  2b     18                                    \n"  // subtract *EAX from EBX
       // ModR/M in binary: 00 (indirect mode) 011 (src EBX) 000 (dest EAX)
       "== data 0x2000\n"
-      "ff ff ff 7f\n"  // largest positive signed integer
+      "ff ff ff 7f\n"  // INT32_MAX
   );
   CHECK_TRACE_CONTENTS(
       "run: subtract r/m32 from EBX\n"
@@ -254,7 +254,7 @@ void test_subtract_mem_at_rm32_from_r32_signed_and_unsigned_overflow() {
       "  2b     18                                    \n"  // subtract *EAX from EBX
       // ModR/M in binary: 00 (indirect mode) 011 (src EBX) 000 (dest EAX)
       "== data 0x2000\n"
-      "00 00 00 80\n"  // smallest negative signed integer
+      "00 00 00 80\n"  // INT32_MIN
   );
   CHECK_TRACE_CONTENTS(
       "run: subtract r/m32 from EBX\n"
@@ -300,7 +300,7 @@ void test_and_mem_at_rm32_with_r32() {
       "  23     18                                    \n"  // and *EAX with EBX
       // ModR/M in binary: 00 (indirect mode) 011 (src EBX) 000 (dest EAX)
       "== data 0x2000\n"
-      "ff 00 00 00\n"  // 0x000000ff
+      "ff 00 00 00\n"  // 0xff
   );
   CHECK_TRACE_CONTENTS(
       "run: and r/m32 with EBX\n"
@@ -597,14 +597,14 @@ void test_compare_r32_with_mem_at_rm32_lesser_unsigned_and_signed() {
 
 void test_compare_r32_with_mem_at_rm32_lesser_unsigned_and_signed_due_to_overflow() {
   Reg[EAX].i = 0x2000;
-  Reg[EBX].i = 0x7fffffff;  // largest positive signed integer
+  Reg[EBX].i = INT32_MAX;
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
       "  3b     18                                    \n"  // compare EBX with *EAX
       // ModR/M in binary: 00 (indirect mode) 011 (lhs EBX) 000 (rhs EAX)
       "== data 0x2000\n"
-      "00 00 00 80\n"  // smallest negative signed integer
+      "00 00 00 80\n"  // INT32_MIN
   );
   CHECK_TRACE_CONTENTS(
       "run: compare EBX with r/m32\n"
@@ -616,7 +616,7 @@ void test_compare_r32_with_mem_at_rm32_lesser_unsigned_and_signed_due_to_overflo
 
 void test_compare_r32_with_mem_at_rm32_lesser_signed() {
   Reg[EAX].i = 0x2000;
-  Reg[EBX].i = 0xffffffff;  // -1
+  Reg[EBX].i = -1;
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
@@ -635,7 +635,7 @@ void test_compare_r32_with_mem_at_rm32_lesser_signed() {
 
 void test_compare_r32_with_mem_at_rm32_lesser_unsigned() {
   Reg[EAX].i = 0x2000;
-  Reg[EBX].i = 0x00000001;  // 1
+  Reg[EBX].i = 1;
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
@@ -701,7 +701,7 @@ void test_copy_mem_at_rm32_to_r32() {
       // op     ModR/M  SIB   displacement  immediate
       "  8b     18                                    \n"  // copy *EAX to EBX
       "== data 0x2000\n"
-      "af 00 00 00\n"  // 0x000000af
+      "af 00 00 00\n"  // 0xaf
   );
   CHECK_TRACE_CONTENTS(
       "run: copy r/m32 to EBX\n"
@@ -734,7 +734,7 @@ void test_jump_mem_at_rm32() {
       "  b8                                 00 00 00 01\n"
       "  b8                                 00 00 00 02\n"
       "== data 0x2000\n"
-      "08 00 00 00\n"  // 0x00000008
+      "08 00 00 00\n"  // 0x8
   );
   CHECK_TRACE_CONTENTS(
       "run: 0x00000001 opcode: ff\n"
@@ -767,7 +767,7 @@ void test_push_mem_at_rm32() {
       // op     ModR/M  SIB   displacement  immediate
       "  ff     30                                    \n"  // push *EAX to stack
       "== data 0x2000\n"
-      "af 00 00 00\n"  // 0x000000af
+      "af 00 00 00\n"  // 0xaf
   );
   CHECK_TRACE_CONTENTS(
       "run: push r/m32\n"
@@ -836,7 +836,7 @@ void test_add_r32_to_mem_at_displacement() {
       "  01     1d            00 20 00 00             \n"  // add EBX to *0x2000
       // ModR/M in binary: 00 (indirect mode) 011 (src EBX) 101 (dest in disp32)
       "== data 0x2000\n"
-      "01 00 00 00\n"  // 0x00000001
+      "01 00 00 00\n"  // 0x1
   );
   CHECK_TRACE_CONTENTS(
       "run: add EBX to r/m32\n"
@@ -863,7 +863,7 @@ void test_add_r32_to_mem_at_rm32_plus_disp8() {
       "  01     58            02                      \n"  // add EBX to *(EAX+2)
       // ModR/M in binary: 01 (indirect+disp8 mode) 011 (src EBX) 000 (dest EAX)
       "== data 0x2000\n"
-      "01 00 00 00\n"  // 0x00000001
+      "01 00 00 00\n"  // 0x1
   );
   CHECK_TRACE_CONTENTS(
       "run: add EBX to r/m32\n"
@@ -903,7 +903,7 @@ void test_add_r32_to_mem_at_rm32_plus_negative_disp8() {
       "  01     58            ff                      \n"  // add EBX to *(EAX-1)
       // ModR/M in binary: 01 (indirect+disp8 mode) 011 (src EBX) 000 (dest EAX)
       "== data 0x2000\n"
-      "01 00 00 00\n"  // 0x00000001
+      "01 00 00 00\n"  // 0x1
   );
   CHECK_TRACE_CONTENTS(
       "run: add EBX to r/m32\n"
@@ -925,7 +925,7 @@ void test_add_r32_to_mem_at_rm32_plus_disp32() {
       "  01     98            02 00 00 00             \n"  // add EBX to *(EAX+2)
       // ModR/M in binary: 10 (indirect+disp32 mode) 011 (src EBX) 000 (dest EAX)
       "== data 0x2000\n"
-      "01 00 00 00\n"  // 0x00000001
+      "01 00 00 00\n"  // 0x1
   );
   CHECK_TRACE_CONTENTS(
       "run: add EBX to r/m32\n"
@@ -965,7 +965,7 @@ void test_add_r32_to_mem_at_rm32_plus_negative_disp32() {
       "  01     98            ff ff ff ff             \n"  // add EBX to *(EAX-1)
       // ModR/M in binary: 10 (indirect+disp32 mode) 011 (src EBX) 000 (dest EAX)
       "== data 0x2000\n"
-      "01 00 00 00\n"  // 0x00000001
+      "01 00 00 00\n"  // 0x1
   );
   CHECK_TRACE_CONTENTS(
       "run: add EBX to r/m32\n"
diff --git a/015immediate_addressing.cc b/015immediate_addressing.cc
index d4c3b14d..9dbf470c 100644
--- a/015immediate_addressing.cc
+++ b/015immediate_addressing.cc
@@ -25,7 +25,7 @@ case 0x05: {  // add imm32 to EAX
 
 :(code)
 void test_add_imm32_to_EAX_signed_overflow() {
-  Reg[EAX].i = 0x7fffffff;  // largest positive signed integer
+  Reg[EAX].i = INT_MAX;
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
@@ -39,7 +39,7 @@ void test_add_imm32_to_EAX_signed_overflow() {
 }
 
 void test_add_imm32_to_EAX_unsigned_overflow() {
-  Reg[EAX].u = 0xffffffff;  // largest unsigned number
+  Reg[EAX].u = UINT_MAX;
   Reg[EBX].u = 1;
   run(
       "== code 0x1\n"
@@ -54,7 +54,7 @@ void test_add_imm32_to_EAX_unsigned_overflow() {
 }
 
 void test_add_imm32_to_EAX_unsigned_and_signed_overflow() {
-  Reg[EAX].u = 0x80000000;  // smallest negative signed integer
+  Reg[EAX].u = 0x80000000;  // INT32_MIN
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
@@ -127,7 +127,7 @@ case 0x81: {  // combine r/m32 with imm32
 
 :(code)
 void test_add_imm32_to_r32_signed_overflow() {
-  Reg[EBX].i = 0x7fffffff;  // largest positive signed integer
+  Reg[EBX].i = INT_MAX;
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
@@ -145,7 +145,7 @@ void test_add_imm32_to_r32_signed_overflow() {
 }
 
 void test_add_imm32_to_r32_unsigned_overflow() {
-  Reg[EBX].u = 0xffffffff;  // largest unsigned number
+  Reg[EBX].u = UINT_MAX;
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
@@ -163,7 +163,7 @@ void test_add_imm32_to_r32_unsigned_overflow() {
 }
 
 void test_add_imm32_to_r32_unsigned_and_signed_overflow() {
-  Reg[EBX].u = 0x80000000;  // smallest negative signed integer
+  Reg[EBX].u = 0x80000000;  // INT32_MIN
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
@@ -243,7 +243,7 @@ case 0x2d: {  // subtract imm32 from EAX
 
 :(code)
 void test_subtract_imm32_from_EAX_signed_overflow() {
-  Reg[EAX].i = 0x80000000;  // smallest negative signed integer
+  Reg[EAX].u = 0x80000000;  // INT32_MIN
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
@@ -275,7 +275,7 @@ void test_subtract_imm32_from_EAX_signed_and_unsigned_overflow() {
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
-      "  2d                                 00 00 00 80 \n"  // subtract smallest negative signed integer from EAX
+      "  2d                                 00 00 00 80 \n"  // subtract INT32_MIN from EAX
   );
   CHECK_TRACE_CONTENTS(
       "run: subtract imm32 0x80000000 from EAX\n"
@@ -334,7 +334,7 @@ void test_subtract_imm32_from_mem_at_rm32_signed_overflow() {
       "  81     2b                          ff ff ff 7f \n"  // subtract largest positive signed integer from *EBX
       // ModR/M in binary: 00 (indirect mode) 101 (subop subtract) 011 (dest EBX)
       "== data 0x2000\n"
-      "00 00 00 80\n"  // smallest negative signed integer
+      "00 00 00 80\n"  // INT32_MIN
   );
   CHECK_TRACE_CONTENTS(
       "run: combine r/m32 with imm32\n"
@@ -373,7 +373,7 @@ void test_subtract_imm32_from_mem_at_rm32_signed_and_unsigned_overflow() {
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
-      "  81     2b                          00 00 00 80 \n"  // subtract smallest negative signed integer from *EBX
+      "  81     2b                          00 00 00 80 \n"  // subtract INT32_MIN from *EBX
       // ModR/M in binary: 00 (indirect mode) 101 (subop subtract) 011 (dest EBX)
       "== data 0x2000\n"
       "00 00 00 00\n"  // 0
@@ -933,11 +933,11 @@ void test_compare_EAX_with_imm32_lesser_unsigned_and_signed() {
 }
 
 void test_compare_EAX_with_imm32_lesser_unsigned_and_signed_due_to_overflow() {
-  Reg[EAX].i = 0x7fffffff;  // largest positive signed integer
+  Reg[EAX].i = INT_MAX;
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
-      "  3d                                 00 00 00 80\n"  // compare EAX with smallest negative signed integer
+      "  3d                                 00 00 00 80\n"  // compare EAX with INT32_MIN
   );
   CHECK_TRACE_CONTENTS(
       "run: compare EAX with imm32 0x80000000\n"
@@ -946,7 +946,7 @@ void test_compare_EAX_with_imm32_lesser_unsigned_and_signed_due_to_overflow() {
 }
 
 void test_compare_EAX_with_imm32_lesser_signed() {
-  Reg[EAX].i = 0xffffffff;  // -1
+  Reg[EAX].i = -1;
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
@@ -959,7 +959,7 @@ void test_compare_EAX_with_imm32_lesser_signed() {
 }
 
 void test_compare_EAX_with_imm32_lesser_unsigned() {
-  Reg[EAX].i = 0x00000001;  // 1
+  Reg[EAX].i = 1;
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
@@ -1038,11 +1038,11 @@ void test_compare_rm32_with_imm32_lesser_unsigned_and_signed() {
 }
 
 void test_compare_rm32_with_imm32_lesser_unsigned_and_signed_due_to_overflow() {
-  Reg[EAX].i = 0x7fffffff;  // largest positive signed integer
+  Reg[EAX].i = INT_MAX;
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
-      "  81     f8                          00 00 00 80\n"  // compare EAX with smallest negative signed integer
+      "  81     f8                          00 00 00 80\n"  // compare EAX with INT32_MIN
       // ModR/M in binary: 11 (direct mode) 111 (subop compare) 000 (dest EAX)
   );
   CHECK_TRACE_CONTENTS(
@@ -1055,7 +1055,7 @@ void test_compare_rm32_with_imm32_lesser_unsigned_and_signed_due_to_overflow() {
 }
 
 void test_compare_rm32_with_imm32_lesser_signed() {
-  Reg[EAX].i = 0xffffffff;  // -1
+  Reg[EAX].i = -1;
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
@@ -1072,7 +1072,7 @@ void test_compare_rm32_with_imm32_lesser_signed() {
 }
 
 void test_compare_rm32_with_imm32_lesser_unsigned() {
-  Reg[EAX].i = 0x00000001;  // 1
+  Reg[EAX].i = 1;
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
diff --git a/016index_addressing.cc b/016index_addressing.cc
index 454051a2..f6c6f2aa 100644
--- a/016index_addressing.cc
+++ b/016index_addressing.cc
@@ -11,7 +11,7 @@ void test_add_r32_to_mem_at_rm32_with_sib() {
       // ModR/M in binary: 00 (indirect mode) 011 (src EBX) 100 (dest in SIB)
       // SIB in binary: 00 (scale 1) 100 (no index) 000 (base EAX)
       "== data 0x2000\n"
-      "01 00 00 00\n"  // 0x00000001
+      "01 00 00 00\n"  // 1
   );
   CHECK_TRACE_CONTENTS(
       "run: add EBX to r/m32\n"
@@ -64,7 +64,7 @@ void test_add_r32_to_mem_at_base_r32_index_r32() {
       // ModR/M in binary: 00 (indirect mode) 011 (src EBX) 100 (dest in SIB)
       // SIB in binary: 00 (scale 1) 001 (index ECX) 000 (base EAX)
       "== data 0x2000\n"
-      "01 00 00 00\n"  // 0x00000001
+      "01 00 00 00\n"  // 1
   );
   CHECK_TRACE_CONTENTS(
       "run: add EBX to r/m32\n"
@@ -84,7 +84,7 @@ void test_add_r32_to_mem_at_displacement_using_sib() {
       // ModR/M in binary: 00 (indirect mode) 011 (src EBX) 100 (dest in SIB)
       // SIB in binary: 00 (scale 1) 100 (no index) 101 (not EBP but disp32)
       "== data 0x2000\n"
-      "01 00 00 00\n"  // 0x00000001
+      "01 00 00 00\n"  // 1
   );
   CHECK_TRACE_CONTENTS(
       "run: add EBX to r/m32\n"
@@ -108,7 +108,7 @@ void test_add_r32_to_mem_at_base_r32_index_r32_plus_disp8() {
       // ModR/M in binary: 01 (indirect+disp8 mode) 011 (src EBX) 100 (dest in SIB)
       // SIB in binary: 00 (scale 1) 001 (index ECX) 000 (base EAX)
       "== data 0x2000\n"
-      "01 00 00 00\n"  // 0x00000001
+      "01 00 00 00\n"  // 1
   );
   CHECK_TRACE_CONTENTS(
       "run: add EBX to r/m32\n"
@@ -138,7 +138,7 @@ void test_add_r32_to_mem_at_base_r32_index_r32_plus_disp32() {
       // ModR/M in binary: 10 (indirect+disp32 mode) 011 (src EBX) 100 (dest in SIB)
       // SIB in binary: 00 (scale 1) 001 (index ECX) 000 (base EAX)
       "== data 0x2000\n"
-      "01 00 00 00\n"  // 0x00000001
+      "01 00 00 00\n"  // 1
   );
   CHECK_TRACE_CONTENTS(
       "run: add EBX to r/m32\n"
diff --git a/019functions.cc b/019functions.cc
index 0f1bd425..55633f64 100644
--- a/019functions.cc
+++ b/019functions.cc
@@ -10,7 +10,7 @@ void test_call_disp32() {
   run(
       "== code 0x1\n"
       // op     ModR/M  SIB   displacement  immediate
-      "  e8                                 a0 00 00 00 \n"  // call function offset at 0x000000a0
+      "  e8                                 a0 00 00 00 \n"  // call function offset at 0xa0
       // next EIP is 6
   );
   CHECK_TRACE_CONTENTS(
@@ -77,7 +77,7 @@ void test_call_mem_at_rm32() {
       "  ff     13                                      \n"  // call function offset at *EBX
       // next EIP is 3
       "== data 0x2000\n"
-      "a0 00 00 00\n"  // 0x000000a0
+      "a0 00 00 00\n"  // 0xa0
   );
   CHECK_TRACE_CONTENTS(
       "run: call to r/m32\n"
@@ -103,7 +103,7 @@ void test_ret() {
       // op     ModR/M  SIB   displacement  immediate
       "  c3                                           \n"  // return
       "== data 0x2000\n"
-      "10 00 00 00\n"  // 0x00000010
+      "10 00 00 00\n"  // 0x10
   );
   CHECK_TRACE_CONTENTS(
       "run: return\n"