about summary refs log tree commit diff stats
path: root/examples/ex9.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-08-26 11:55:26 -0700
committerKartik Agaram <vc@akkartik.com>2019-08-26 11:59:21 -0700
commit333525360b22f3d3ea31db46a4d2f1b4edbfebdb (patch)
treeed255f308542ba28a99d862d54d4992dcf749622 /examples/ex9.subx
parent22fb844ba4edf14eb85245a35f42e721658c4f8e (diff)
downloadmu-333525360b22f3d3ea31db46a4d2f1b4edbfebdb.tar.gz
5592 - switch register names to lowercase
Diffstat (limited to 'examples/ex9.subx')
-rw-r--r--examples/ex9.subx36
1 files changed, 18 insertions, 18 deletions
diff --git a/examples/ex9.subx b/examples/ex9.subx
index a580c749..8793e941 100644
--- a/examples/ex9.subx
+++ b/examples/ex9.subx
@@ -11,11 +11,11 @@
 #   2
 #
 # At the start of a SubX program:
-#   argc: *ESP
-#   argv[0]: *(ESP+4)
-#   argv[1]: *(ESP+8)
+#   argc: *esp
+#   argv[0]: *(esp+4)
+#   argv[1]: *(esp+8)
 #   ...
-# Locals start from ESP-4 downwards.
+# Locals start from esp-4 downwards.
 
 == code 0x09000000
 #   instruction                     effective address                                                   register    displacement    immediate
@@ -24,30 +24,30 @@
 
 Entry:
     # . prolog
-    89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
+    89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
     # ascii-difference(argv[1], argv[2])
     # . . push argv[2]
-    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    .           .             .           .           0xc/disp8       .                 # push *(ebp+12)
     # . . push argv[1]
-    ff          6/subop/push        1/mod/*+disp8   5/rm32/EBP    .           .             .           .           8/disp8         .                 # push *(EBP+8)
+    ff          6/subop/push        1/mod/*+disp8   5/rm32/ebp    .           .             .           .           8/disp8         .                 # push *(ebp+8)
     # . . call
     e8/call  ascii-difference/disp32
     # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
-    # syscall(exit, EAX)
-    89/copy                         3/mod/direct    3/rm32/EBX    .           .             .           0/r32/EAX   .               .                 # copy EAX to EBX
-    b8/copy-to-EAX  1/imm32/exit
+    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
+    # syscall(exit, eax)
+    89/copy                         3/mod/direct    3/rm32/ebx    .           .             .           0/r32/eax   .               .                 # copy eax to ebx
+    b8/copy-to-eax  1/imm32/exit
     cd/syscall  0x80/imm8
 
 ascii-difference:  # (s1, s2) : null-terminated ascii strings
-    # a = first letter of s1 (ECX)
-    8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/ESP  4/index/none              0/r32/EAX   4/disp8         .                 # copy *(ESP+4) to EAX
-    8b/copy                         0/mod/indirect  0/rm32/EAX    .           .             .           0/r32/EAX   .               .                 # copy *EAX to EAX
-    # b = first letter of s2 (EDX)
-    8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/ESP  4/index/none              1/r32/ECX   8/disp8                           # copy *(ESP+8) to ECX
-    8b/copy                         0/mod/indirect  1/rm32/ECX    .           .             .           1/r32/ECX   .               .                 # copy *ECX to ECX
+    # a = first letter of s1 (ecx)
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/esp  4/index/none              0/r32/eax   4/disp8         .                 # copy *(esp+4) to eax
+    8b/copy                         0/mod/indirect  0/rm32/eax    .           .             .           0/r32/eax   .               .                 # copy *eax to eax
+    # b = first letter of s2 (edx)
+    8b/copy                         1/mod/*+disp8   4/rm32/sib    4/base/esp  4/index/none              1/r32/ecx   8/disp8                           # copy *(esp+8) to ecx
+    8b/copy                         0/mod/indirect  1/rm32/ecx    .           .             .           1/r32/ecx   .               .                 # copy *ecx to ecx
     # a-b
-    29/subtract                     3/mod/direct    0/rm32/EAX    .           .             .           1/r32/ECX   .               .                 # subtract ECX from EAX
+    29/subtract                     3/mod/direct    0/rm32/eax    .           .             .           1/r32/ecx   .               .                 # subtract ecx from eax
     c3/return
 
 == data 0x0a000000