about summary refs log tree commit diff stats
path: root/apps
diff options
context:
space:
mode:
authorKartik Agaram <vc@akkartik.com>2019-11-18 17:36:59 -0800
committerKartik Agaram <vc@akkartik.com>2019-11-18 17:36:59 -0800
commit49ffb0308470b03249452120c4945ccbb642a71b (patch)
tree519248f97ce99a546e61b059a677478876e0cf86 /apps
parentdd6c5fff9edaf95c2c3393fc76ea276e4939a7c6 (diff)
downloadmu-49ffb0308470b03249452120c4945ccbb642a71b.tar.gz
5756
Diffstat (limited to 'apps')
-rwxr-xr-xapps/mubin52483 -> 52519 bytes
-rw-r--r--apps/mu.subx42
2 files changed, 30 insertions, 12 deletions
diff --git a/apps/mu b/apps/mu
index e337b555..afe0c3ec 100755
--- a/apps/mu
+++ b/apps/mu
Binary files differdiff --git a/apps/mu.subx b/apps/mu.subx
index 9f4daec1..1612e9ce 100644
--- a/apps/mu.subx
+++ b/apps/mu.subx
@@ -1056,7 +1056,7 @@ emit-subx-rm32:  # out : (address buffered-file), l : arg-location, stmt : (addr
     74/jump-if-equal $emit-subx-rm32:end/disp8
     #
     (get-stmt-operand-from-arg-location *(ebp+0x10) *(ebp+0xc))  # stmt, l => var/eax
-    (emit-subx-call-operand *(ebp+8) %eax)  # out, var
+    (emit-subx-var-as-rm32 *(ebp+8) %eax)  # out, var
 $emit-subx-rm32:end:
     # . restore registers
     58/pop-to-eax
@@ -1218,11 +1218,37 @@ emit-subx-call-operand:  # out : (address buffered-file), operand : (address var
     50/push-eax
     # eax = operand
     8b/-> *(ebp+0xc) 0/r32/eax
+    # if non-literal, emit appropriately
+    (emit-subx-var-as-rm32 *(ebp+8) %eax)
+    # else if (operand->type == literal) emit "__"
+    {
+      81 7/subop/compare *(eax+4) 0/imm32  # Var-type
+      75/jump-if-not-equal break/disp8
+$emit-subx-call-operand:literal:
+      (write-buffered *(ebp+8) Space)
+      (write-buffered *(ebp+8) *eax)
+    }
+$emit-subx-call-operand:end:
+    # . restore registers
+    58/pop-to-eax
+    # . epilogue
+    89/<- %esp 5/r32/ebp
+    5d/pop-to-ebp
+    c3/return
+
+emit-subx-var-as-rm32:  # out : (address buffered-file), operand : (address variable)
+    # . prologue
+    55/push-ebp
+    89/<- %ebp 4/r32/esp
+    # . save registers
+    50/push-eax
+    # eax = operand
+    8b/-> *(ebp+0xc) 0/r32/eax
     # if (operand->register) emit "%__"
     {
       81 7/subop/compare *(eax+0x10) 0/imm32  # Var-register
       74/jump-if-equal break/disp8
-$emit-subx-call-operand:register:
+$emit-subx-var-as-rm32:register:
       (write-buffered *(ebp+8) " %")
       (write-buffered *(ebp+8) *(eax+0x10))  # Var-register
     }
@@ -1230,22 +1256,14 @@ $emit-subx-call-operand:register:
     {
       81 7/subop/compare *(eax+0xc) 0/imm32  # Var-stack-offset
       74/jump-if-equal break/disp8
-$emit-subx-call-operand:stack:
+$emit-subx-var-as-rm32:stack:
       (write-buffered *(ebp+8) Space)
       (write-buffered *(ebp+8) "*(ebp+")
       8b/-> *(ebp+0xc) 0/r32/eax
       (print-int32-buffered *(ebp+8) *(eax+0xc))  # Var-stack-offset
       (write-buffered *(ebp+8) ")")
     }
-    # else if (operand->type == literal) emit "__"
-    {
-      81 7/subop/compare *(eax+4) 0/imm32  # Var-type
-      75/jump-if-not-equal break/disp8
-$emit-subx-call-operand:literal:
-      (write-buffered *(ebp+8) Space)
-      (write-buffered *(ebp+8) *eax)
-    }
-$emit-subx-call-operand:end:
+$emit-subx-var-as-rm32:end:
     # . restore registers
     58/pop-to-eax
     # . epilogue
>
e6dfc442 ^



cc952d63 ^
e6dfc442 ^


cc952d63 ^
e6dfc442 ^








cc952d63 ^
d88232a3 ^
cc952d63 ^

e6dfc442 ^





22449efd ^
e6dfc442 ^








d88232a3 ^
e6dfc442 ^
e6dfc442 ^

d88232a3 ^
e6dfc442 ^
d88232a3 ^
e6dfc442 ^




22449efd ^
d88232a3 ^
e6dfc442 ^


























22449efd ^








e6dfc442 ^

cc952d63 ^

e6dfc442 ^




22449efd ^
cc952d63 ^
22449efd ^
cc952d63 ^

e6dfc442 ^



22449efd ^
ffec67de ^
22449efd ^
ffec67de ^

22449efd ^


ffec67de ^

cc952d63 ^
22449efd ^
cc952d63 ^

22449efd ^
cc952d63 ^
22449efd ^
cc952d63 ^
22449efd ^
cc952d63 ^
22449efd ^

cc952d63 ^




22449efd ^
cc952d63 ^

22449efd ^
cc952d63 ^


65cb1a32 ^






cc952d63 ^








































































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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249