about summary refs log tree commit diff stats
path: root/307size.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-07-05 12:13:28 -0700
committerKartik Agaram <vc@akkartik.com>2020-07-05 12:13:28 -0700
commitc09c91e185aad8e01b570c2569e13c1e429d2f99 (patch)
tree52a5ae1494ad5b7b2319411815dc45510e761c24 /307size.subx
parentf2c5b05374186f9422cfdaf1ada096e39ac91a8b (diff)
downloadmu-c09c91e185aad8e01b570c2569e13c1e429d2f99.tar.gz
6612 - reorganize layers
Diffstat (limited to '307size.subx')
-rw-r--r--307size.subx17
1 files changed, 17 insertions, 0 deletions
diff --git a/307size.subx b/307size.subx
new file mode 100644
index 00000000..9d2be695
--- /dev/null
+++ b/307size.subx
@@ -0,0 +1,17 @@
+# Size of an array in bytes.
+
+== code
+
+size:  # in: (addr array _) -> result/eax: int
+    # . prologue
+    55/push-ebp
+    89/<- %ebp 4/r32/esp
+    # eax = in
+    8b/-> *(ebp+8) 0/r32/eax
+    #
+    8b/-> *eax 0/r32/eax
+$size:end:
+    # . epilogue
+    89/<- %esp 5/r32/ebp
+    5d/pop-to-ebp
+    c3/return