about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-07-21 01:06:12 -0700
committerKartik Agaram <vc@akkartik.com>2019-07-21 01:09:51 -0700
commit6d79c2bbf62660274bf2f66c783c99bfdae41e34 (patch)
tree72cef5637549249087ebfd5a5a6632c08d643dd5
parent22a9035e82f6584e86f0400353f5013029b6a6e1 (diff)
downloadmu-6d79c2bbf62660274bf2f66c783c99bfdae41e34.tar.gz
5435 - redo 5426
We can now translate layers 49-55 using translate and ntranslate. Next
step is to support '\n' in dquotes.subx.
-rw-r--r--subx/apps/assort.subx2
-rw-r--r--subx/apps/dquotes.subx2
-rwxr-xr-xsubx/apps/surveybin42815 -> 42816 bytes
-rw-r--r--subx/apps/survey.subx101
4 files changed, 99 insertions, 6 deletions
diff --git a/subx/apps/assort.subx b/subx/apps/assort.subx
index a855f245..911cbad4 100644
--- a/subx/apps/assort.subx
+++ b/subx/apps/assort.subx
@@ -28,7 +28,7 @@ Entry:
     # . Heap = new-segment(Heap-size)
     # . . push args
     68/push  Heap/imm32
-    68/push  Heap-size/imm32
+    ff          6/subop/push        0/mod/indirect  5/rm32/.disp32            .             .           .           Heap-size/disp32                  # push *Heap-size
     # . . call
     e8/call  new-segment/disp32
     # . . discard args
diff --git a/subx/apps/dquotes.subx b/subx/apps/dquotes.subx
index 9331843c..6dd045f2 100644
--- a/subx/apps/dquotes.subx
+++ b/subx/apps/dquotes.subx
@@ -24,7 +24,7 @@ Entry:
     # . Heap = new-segment(Heap-size)
     # . . push args
     68/push  Heap/imm32
-    68/push  Heap-size/imm32
+    ff          6/subop/push        0/mod/indirect  5/rm32/.disp32            .             .           .           Heap-size/disp32                  # push *Heap-size
     # . . call
     e8/call  new-segment/disp32
     # . . discard args
diff --git a/subx/apps/survey b/subx/apps/survey
index 7150b3b4..90865471 100755
--- a/subx/apps/survey
+++ b/subx/apps/survey
Binary files differdiff --git a/subx/apps/survey.subx b/subx/apps/survey.subx
index 3506e354..9bee7e16 100644
--- a/subx/apps/survey.subx
+++ b/subx/apps/survey.subx
@@ -45,7 +45,7 @@ Entry:
     # Heap = new-segment(Heap-size)
     # . . push args
     68/push  Heap/imm32
-    68/push  Heap-size/imm32
+    ff          6/subop/push        0/mod/indirect  5/rm32/.disp32            .             .           .           Heap-size/disp32                  # push *Heap-size
     # . . call
     e8/call  new-segment/disp32
     # . . discard args
@@ -143,14 +143,61 @@ convert:  # infile : (address buffered-file), out : (address buffered-file) -> <
     68/push  0/imm32/write
     89/copy                         3/mod/direct    2/rm32/EDX    .           .             .           4/r32/ESP   .               .                 # copy ESP to EDX
     # var in/ESI = stream(Input-size * 1)
-    81          5/subop/subtract    3/mod/direct    4/rm32/ESP    .           .             .           .           .               0x4000/imm32      # subtract from ESP
-    68/push  Input-size/imm32
+    2b/subtract                     0/mod/indirect  5/rm32/.disp32            .             .           4/r32/ESP   Input-size/disp32                 # subtract *Input-size from ESP
+    ff          6/subop/push        0/mod/indirect  5/rm32/.disp32            .             .           .           Input-size/disp32                 # push *Input-size
     68/push  0/imm32/read
     68/push  0/imm32/write
     89/copy                         3/mod/direct    6/rm32/ESI    .           .             .           4/r32/ESP   .               .                 # copy ESP to ESI
+#?     # dump labels->write {{{
+#?     # . write(2/stderr, "labels->write right after initialization: ")
+#?     # . . push args
+#?     68/push  "labels->write right after initialization: "/imm32
+#?     68/push  2/imm32/stderr
+#?     # . . call
+#?     e8/call  write/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+#?     # . clear-stream(Stderr+4)
+#?     # . . save EAX
+#?     50/push-EAX
+#?     # . . push args
+#?     b8/copy-to-EAX  Stderr/imm32
+#?     05/add-to-EAX  4/imm32
+#?     50/push-EAX
+#?     # . . call
+#?     e8/call  clear-stream/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
+#?     # . . restore EAX
+#?     58/pop-to-EAX
+#?     # . print-int32-buffered(Stderr, labels->write)
+#?     # . . push args
+#? $watch-1:
+#?     ff          6/subop/push        0/mod/indirect  2/rm32/EDX    .           .             .           .           .               .                 # push *EDX
+#?     68/push  Stderr/imm32
+#?     # . . call
+#?     e8/call  print-int32-buffered/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+#?     # . flush(Stderr)
+#?     # . . push args
+#?     68/push  Stderr/imm32
+#?     # . . call
+#?     e8/call  flush/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
+#?     # . write(2/stderr, "\n")
+#?     # . . push args
+#?     68/push  "\n"/imm32
+#?     68/push  2/imm32/stderr
+#?     # . . call
+#?     e8/call  write/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+#?     # }}}
 #?     # write(2/stderr, "slurp in\n") {{{
 #?     # . . push args
-#?     68/push  "compute-offsets\n"/imm32
+#?     68/push  "slurp in\n"/imm32
 #?     68/push  2/imm32/stderr
 #?     # . . call
 #?     e8/call  write/disp32
@@ -165,6 +212,52 @@ convert:  # infile : (address buffered-file), out : (address buffered-file) -> <
     e8/call  slurp/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+#?     # dump labels->write {{{
+#?     # . write(2/stderr, "labels->write after slurp: ")
+#?     # . . push args
+#?     68/push  "labels->write after slurp: "/imm32
+#?     68/push  2/imm32/stderr
+#?     # . . call
+#?     e8/call  write/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+#?     # . clear-stream(Stderr+4)
+#?     # . . save EAX
+#?     50/push-EAX
+#?     # . . push args
+#?     b8/copy-to-EAX  Stderr/imm32
+#?     05/add-to-EAX  4/imm32
+#?     50/push-EAX
+#?     # . . call
+#?     e8/call  clear-stream/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
+#?     # . . restore EAX
+#?     58/pop-to-EAX
+#?     # . print-int32-buffered(Stderr, labels->write)
+#?     # . . push args
+#?     ff          6/subop/push        0/mod/indirect  2/rm32/EDX    .           .             .           .           .               .                 # push *EDX
+#?     68/push  Stderr/imm32
+#?     # . . call
+#?     e8/call  print-int32-buffered/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+#?     # . flush(Stderr)
+#?     # . . push args
+#?     68/push  Stderr/imm32
+#?     # . . call
+#?     e8/call  flush/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
+#?     # . write(2/stderr, "\n")
+#?     # . . push args
+#?     68/push  "\n"/imm32
+#?     68/push  2/imm32/stderr
+#?     # . . call
+#?     e8/call  write/disp32
+#?     # . . discard args
+#?     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
+#?     # }}}
 #?     # dump in {{{
 #?     # . write(2/stderr, "in: ")
 #?     # . . push args