about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
Diffstat (limited to 'apps')
-rwxr-xr-xapps/desugarbin34521 -> 34532 bytes
-rw-r--r--apps/desugar.subx60
-rw-r--r--apps/survey.subx1
3 files changed, 54 insertions, 7 deletions
diff --git a/apps/desugar b/apps/desugar
index 2edf32a3..d9d4a821 100755
--- a/apps/desugar
+++ b/apps/desugar
Binary files differdiff --git a/apps/desugar.subx b/apps/desugar.subx
index a982a5c6..ae921caf 100644
--- a/apps/desugar.subx
+++ b/apps/desugar.subx
@@ -14,15 +14,16 @@
 
 Entry:  # run tests if necessary, convert stdin if not
     # initialize heap
-    # . Heap = new-segment(64KB)
+    # . Heap = new-segment(Heap-size)
     # . . push args
     68/push  Heap/imm32
-    68/push  0x10000/imm32/64KB
+    ff          6/subop/push        0/mod/indirect  5/rm32/.disp32            .             .           .           Heap-size/disp32                  # push *Heap-size
     # . . call
     e8/call  new-segment/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
 
+    # run tests if necessary, convert stdin if not
     # . prolog
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
     # - if argc > 1 and argv[1] == "test", then return run_tests()
@@ -46,7 +47,7 @@ Entry:  # run tests if necessary, convert stdin if not
     eb/jump  $main:end/disp8
 $run-main:
     # - otherwise convert stdin
-    # return convert(Stdin, Stdout)
+    # convert(Stdin, Stdout)
     # . . push args
     68/push  Stdout/imm32
     68/push  Stdin/imm32
@@ -155,17 +156,64 @@ $convert:check-for-register-literal:
     3d/compare-EAX-and  0x25/imm32/percent
     75/jump-if-not-equal  $convert:regular-word/disp8
 $convert:register-literal:
+#?     # dump word-slice {{{
+#?     # . write(2/stderr, "w: ")
+#?     # . . push args
+#?     68/push  "w: "/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
+#?     # . write-slice-buffered(Stderr, word-slice)
+#?     # . . push args
+#?     52/push-EDX
+#?     68/push  Stderr/imm32
+#?     # . . call
+#?     e8/call  write-slice-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
+#?     # }}}
     # ++word-slice->start
-    4b/increment-EBX
+    ff          0/subop/increment   0/mod/indirect  2/rm32/EDX    .           .             .           .           .               .                 # increment *EDX
     # desugar-register(word-slice, out)
     # . . push args
+    ff          6/subop/push        1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0xc/disp8       .                 # push *(EBP+12)
     52/push-EDX
     # . . call
     e8/call  desugar-register/disp32
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               4/imm32           # add to ESP
     # continue
-    eb/jump  $convert:next-word/disp8
+    e9/jump  $convert:next-word/disp32
 $convert:regular-word:
     # write-slice-buffered(out, word-slice)
     # . . push args
@@ -186,7 +234,7 @@ $convert:next-word:
     # . . discard args
     81          0/subop/add         3/mod/direct    4/rm32/ESP    .           .             .           .           .               8/imm32           # add to ESP
     # loop
-    eb/jump  $convert:word-loop/disp8
+    e9/jump  $convert:word-loop/disp32
 $convert:next-line:
     # write-buffered(out, "\n")
     # . . push args
diff --git a/apps/survey.subx b/apps/survey.subx
index 4345b3ec..a7ff618b 100644
--- a/apps/survey.subx
+++ b/apps/survey.subx
@@ -61,7 +61,6 @@ Entry:
     # run tests if necessary, convert stdin if not
     # . prolog
     89/copy                         3/mod/direct    5/rm32/EBP    .           .             .           4/r32/ESP   .               .                 # copy ESP to EBP
-    # initialize heap
     # - if argc > 1 and argv[1] == "test", then return run_tests()
     # . argc > 1
     81          7/subop/compare     1/mod/*+disp8   5/rm32/EBP    .           .             .           .           0/disp8         1/imm32           # compare *EBP
e='Blame the previous revision' href='/danisanti/profani-tty/blame/src/config/scripts.c?id=0769fc6b1b0ec22d4e45f6cc033a642e25923930'>^
a3a73cf0 ^
a35cbea7 ^

a3a73cf0 ^

a35cbea7 ^










904a5a81 ^

eca73909 ^


a3a73cf0 ^



eca73909 ^





























904a5a81 ^


a3a73cf0 ^



904a5a81 ^










eca73909 ^
904a5a81 ^





0649aad8 ^
904a5a81 ^








1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164