about summary refs log tree commit diff stats
path: root/apps/dquotes.subx
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2020-04-03 22:33:34 -0700
committerKartik Agaram <vc@akkartik.com>2020-05-18 00:44:46 -0700
commitd4307787110dc72ddaf02b5e9259afcceca0d794 (patch)
treeaafc92e73e0e400a7c190e372ef71aab20a8c71f /apps/dquotes.subx
parent94fca7058a2e2bd62393758fbb98cd3f8ace4b2a (diff)
downloadmu-d4307787110dc72ddaf02b5e9259afcceca0d794.tar.gz
dquotes.subx now working
Diffstat (limited to 'apps/dquotes.subx')
-rw-r--r--apps/dquotes.subx27
1 files changed, 21 insertions, 6 deletions
diff --git a/apps/dquotes.subx b/apps/dquotes.subx
index 6f961e34..4abeeae5 100644
--- a/apps/dquotes.subx
+++ b/apps/dquotes.subx
@@ -85,7 +85,9 @@ $subx-dquotes-main:end:
 subx-dquotes:  # in: (addr buffered-file), out: (addr buffered-file)
     # pseudocode:
     #   var line: (stream byte 512)
-    #   var new-data-segment: (handle stream byte) = new-stream(Heap, Segment-size, 1)
+    #   var new-data-segment-handle: (handle stream byte)
+    #   new-stream(Heap, Segment-size, 1, new-data-segment-handle)
+    #   var new-data-segment: (addr stream byte) = lookup(new-data-segment-handle)
     #
     #   write(new-data-segment, "== data\n")
     #      # TODO: When it was originally written dquotes ran before assort, so
@@ -135,17 +137,30 @@ subx-dquotes:  # in: (addr buffered-file), out: (addr buffered-file)
     68/push  0/imm32/end
     68/push  0/imm32/start
     89/copy                         3/mod/direct    2/rm32/edx    .           .             .           4/r32/esp   .               .                 # copy esp to edx
-    # new-data-segment/edi = new-stream(Heap, Segment-size, 1)
-    # . eax = new-stream(Heap, Segment-size, 1)
+    # var new-data-segment-handle/edi: (handle stream byte)
+    68/push  0/imm32
+    68/push  0/imm32
+    89/copy                         3/mod/direct    7/rm32/edi    .           .             .           4/r32/esp   .               .                 # copy esp to edi
+    # new-stream(Heap, Segment-size, 1, new-data-segment-handle)
     # . . push args
+    57/push-edi
     68/push  1/imm32
     ff          6/subop/push        0/mod/indirect  5/rm32/.disp32            .             .           .           Segment-size/disp32               # push *Segment-size
     68/push  Heap/imm32
     # . . call
     e8/call  new-stream/disp32
     # . . discard args
-    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0xc/imm32         # add to esp
-    # . edi = eax
+    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x10/imm32        # add to esp
+    # var new-data-segment/edi: (addr stream byte) = lookup(*new-data-segment-handle)
+    # . eax = lookup(*new-data-segment-handle)
+    # . . push args
+    ff          6/subop/push        1/mod/*+disp8   7/rm32/edi    .           .             .           .           4/disp8         .                 # push *(edi+4)
+    ff          6/subop/push        0/mod/indirect  7/rm32/edi    .           .             .           .           .               .                 # push *edi
+    # . . call
+    e8/call  lookup/disp32
+    # . . discard args
+    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               8/imm32           # add to esp
+    # . new-data-segment = eax
     89/copy                         3/mod/direct    7/rm32/edi    .           .             .           0/r32/eax   .               .                 # copy eax to edi
     # write(new-data-segment, "== data\n")
     # . . push args
@@ -272,7 +287,7 @@ $subx-dquotes:break:
     81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               4/imm32           # add to esp
 $subx-dquotes:end:
     # . reclaim locals
-    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x214/imm32       # add to esp
+    81          0/subop/add         3/mod/direct    4/rm32/esp    .           .             .           .           .               0x21c/imm32       # add to esp
     # . restore registers
     5f/pop-to-edi
     5e/pop-to-esi