about summary refs log tree commit diff stats
path: root/subx/067print-int.subx
diff options
context:
space:
mode:
authornc <charles.saternos@gmail.com>2019-07-07 21:19:50 -0400
committernc <charles.saternos@gmail.com>2019-07-07 21:19:50 -0400
commitc0a904382ba1b224275d0ac65eec9469d70e7b36 (patch)
tree9cb383b40e31e4eddc324587b746d5a2eefc46e5 /subx/067print-int.subx
parentc17643b7a8d8d1e1b1647b495058688cf13605d4 (diff)
downloadmu-c0a904382ba1b224275d0ac65eec9469d70e7b36.tar.gz
made first compute-offset test pass
Diffstat (limited to 'subx/067print-int.subx')
-rw-r--r--subx/067print-int.subx17
1 files changed, 17 insertions, 0 deletions
diff --git a/subx/067print-int.subx b/subx/067print-int.subx
index c9b8d2e4..6ce50cc3 100644
--- a/subx/067print-int.subx
+++ b/subx/067print-int.subx
@@ -252,6 +252,23 @@ test-print-int32:
     # . end
     c3/return
 
+# TODO: append to string
+check-ints-equal2: # (a : int, b : int, msg : (address array byte))
+    # . prolog
+    55/push-EBP
+    89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
+    ff          6/subop/push        1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0x10/disp8      .                 # push *(EBP+16)
+    ff          6/subop/push        1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0xc/disp8       .                 # push *(EBP+12)
+    ff          6/subop/push        1/mod/*+disp8   5/rm32/EBP    .           .             .           .           8/disp8         .                 # push *(EBP+8)
+    e8/call  check-ints-equal/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               0xc/imm32           # add to ESP
+    ff          6/subop/push        1/mod/*+disp8   5/rm32/EBP    .           .             .           .           8/disp8         .                 # push *(EBP+8)
+    # . epilog
+    89/copy                         3/mod/direct    4/rm32/ESP    .           .             .           5/r32/EBP   .               .                 # copy EBP to ESP
+    5d/pop-to-EBP
+    c3/return
+
 print-int32-buffered:  # f : (address buffered-file), n : int -> <void>
     # pseudocode:
     #  write-buffered(f, "0x")