about summary refs log tree commit diff stats
path: root/subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2018-09-20 16:30:40 -0700
committerKartik Agaram <vc@akkartik.com>2018-09-20 16:30:40 -0700
commitb83654d51fc80c0a991237dba6389e684be24b41 (patch)
treeaef216ccd23acb7b0553cb3a17c4b092c25c099b /subx
parent7b8cd5dd8dcecfb76389a5fa3f62229d171c70e2 (diff)
downloadmu-b83654d51fc80c0a991237dba6389e684be24b41.tar.gz
4559
Diffstat (limited to 'subx')
-rwxr-xr-xsubx/apps/crenshaw2-1bin304 -> 333 bytes
-rw-r--r--subx/apps/crenshaw2-1.subx16
2 files changed, 16 insertions, 0 deletions
diff --git a/subx/apps/crenshaw2-1 b/subx/apps/crenshaw2-1
index 826d5776..d85b2556 100755
--- a/subx/apps/crenshaw2-1
+++ b/subx/apps/crenshaw2-1
Binary files differdiff --git a/subx/apps/crenshaw2-1.subx b/subx/apps/crenshaw2-1.subx
index 2b46f07f..32436bad 100644
--- a/subx/apps/crenshaw2-1.subx
+++ b/subx/apps/crenshaw2-1.subx
@@ -92,6 +92,22 @@ write_stderr:  # s : (address array byte) -> <void>
   # end
   c3/return
 
+write_stdout:  # s : (address array byte) -> <void>
+  # write(1/stdout, (data) s+4, (size) *s)
+    # fd = 1 (stdout)
+  bb/copy                         .               .             .           .             .           .           .               1/imm32           # copy 1 to EBX
+    # x = s+4
+  8b/copy                         1/mod/*+disp8   4/rm32/SIB    4/base/ESP  4/index/none  .           1/r32/ECX   4/disp8         .                 # copy *(ESP+4) to ECX
+  81          0/subop/add         3/mod/direct    1/rm32/ECX    .           .             .           .           .               4/imm32           # add 4 to ECX
+    # size = *s
+  8b/copy                         1/mod/*+disp8   4/rm32/SIB    4/base/ESP  4/index/none  .           2/r32/EDX   4/disp8         .                 # copy *(ESP+4) to EDX
+  8b/copy                         0/mod/indirect  2/rm32/EDX    .           .             .           2/r32/EDX   .               .                 # copy *EDX to EDX
+    # call write()
+  b8/copy                         .               .             .           .             .           .           .               4/imm32/write     # copy 1 to EAX
+  cd/syscall                      .               .             .           .             .           .           .               0x80/imm8         # int 80h
+  # end
+  c3/return
+
 == data
 Newline:
   # size