https://github.com/akkartik/mu/blob/main/103glyph.subx
1
2
3
4
5
6
7
8
9
10
11
12 == code
13
14
15
16
17
18
19 draw-code-point-on-real-screen:
20
21 55/push-ebp
22 89/<- %ebp 4/r32/esp
23
24 (draw-code-point-on-screen-buffer *Video-memory-addr *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) 0 0x80 0x30)
25 $draw-code-point-on-real-screen:end:
26
27 89/<- %esp 5/r32/ebp
28 5d/pop-to-ebp
29 c3/return
30
31 overlay-code-point-on-real-screen:
32
33 55/push-ebp
34 89/<- %ebp 4/r32/esp
35
36 (draw-code-point-on-screen-buffer *Video-memory-addr *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) 1 0x80 0x30)
37 $overlay-code-point-on-real-screen:end:
38
39 89/<- %esp 5/r32/ebp
40 5d/pop-to-ebp
41 c3/return
42
43 draw-code-point-on-screen-array:
44
45 55/push-ebp
46 89/<- %ebp 4/r32/esp
47
48 51/push-ecx
49 52/push-edx
50
51 {
52
53 8b/-> *(ebp+8) 1/r32/ecx
54 8b/-> *ecx 1/r32/ecx
55
56 ba/copy-to-edx 0/imm32
57 8b/-> *(ebp+0x20) 0/r32/eax
58 f7 4/subop/multiply-into-eax *(ebp+0x24)
59 81 7/subop/compare %edx 0/imm32
60 0f 85/jump-if-!= $draw-code-point-on-screen-array:overflow/disp32
61
62 39/compare %eax 1/r32/ecx
63 0f 8f/jump-if-> $draw-code-point-on-screen-array:abort/disp32
64 }
65
66 8b/-> *(ebp+8) 0/r32/eax
67 05/add-to-eax 4/imm32
68
69 (draw-code-point-on-screen-buffer %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c) 1 *(ebp+0x20) *(ebp+0x24))
70 $draw-code-point-on-screen-array:end:
71
72 5a/pop-to-edx
73 59/pop-to-ecx
74
75 89/<- %esp 5/r32/ebp
76 5d/pop-to-ebp
77 c3/return
78
79 $draw-code-point-on-screen-array:overflow:
80 (abort "draw-code-point-on-screen-array: screen dimensions too large")
81
82 $draw-code-point-on-screen-array:abort:
83 (abort "draw-code-point-on-screen-array: coordinates are off the screen. Are the screen dimensions correct?")
84
85
86
87 draw-code-point-on-screen-buffer:
88
89 55/push-ebp
90 89/<- %ebp 4/r32/esp
91
92 56/push-esi
93
94 c1 4/subop/shift-left *(ebp+24) 3/imm8/log2-font-width
95 c1 4/subop/shift-left *(ebp+28) 4/imm8/log2-font-height
96
97 8b/-> *(ebp+0xc) 6/r32/esi
98
99
100 81 7/subop/compare %esi 0x1100/imm32/4352
101 0f 8d/jump-if->= $draw-code-point-on-screen-buffer:end/disp32
102
103 69/multiply %esi 0x22/imm32/glyph-size 6/r32/esi
104 81 0/subop/add %esi 0x0010000c/imm32/Font
105
106 b8/copy-to-eax 0/imm32
107 8a/byte-> *esi 0/r32/AL
108 46/increment-esi
109 46/increment-esi
110 3d/compare-eax-and 8/imm32
111 {
112 75/jump-if-!= break/disp8
113 (draw-narrow-code-point-on-screen-buffer *(ebp+8) %esi *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20) *(ebp+0x24) *(ebp+0x28))
114 b8/copy-to-eax 1/imm32
115 eb/jump $draw-code-point-on-screen-buffer:end/disp8
116 }
117 (draw-wide-code-point-on-screen-buffer *(ebp+8) %esi *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20) *(ebp+0x24) *(ebp+0x28))
118 b8/copy-to-eax 2/imm32
119 $draw-code-point-on-screen-buffer:end:
120
121 5e/pop-to-esi
122
123 89/<- %esp 5/r32/ebp
124 5d/pop-to-ebp
125 c3/return
126
127 wide-code-point?:
128
129 55/push-ebp
130 89/<- %ebp 4/r32/esp
131
132 8b/-> *(ebp+8) 0/r32/eax
133
134 3d/compare-eax-and 0x1100/imm32
135 0f 8d/jump-if->= $wide-code-point?:return-false/disp32
136
137 69/multiply %eax 0x22/imm32/glyph-size 0/r32/eax
138 05/add-to-eax 0x0010000c/imm32/Font
139
140 8a/byte-> *eax 0/r32/AL
141 25/and-eax-with 0xff/imm32
142 3d/compare-eax-and 8/imm32
143 0f 95/set-if-!= %eax
144 $wide-code-point?:end:
145
146 89/<- %esp 5/r32/ebp
147 5d/pop-to-ebp
148 c3/return
149
150 $wide-code-point?:return-false:
151 b8/copy-to-eax 0/imm32/false
152
153 89/<- %esp 5/r32/ebp
154 5d/pop-to-ebp
155 c3/return
156
157 combining-code-point?:
158
159 55/push-ebp
160 89/<- %ebp 4/r32/esp
161
162 8b/-> *(ebp+8) 0/r32/eax
163
164 3d/compare-eax-and 0x1100/imm32
165 0f 8d/jump-if->= $combining-code-point?:return-false/disp32
166
167 69/multiply %eax 0x22/imm32/glyph-size 0/r32/eax
168 05/add-to-eax 0x0010000c/imm32/Font
169
170 8a/byte-> *(eax+1) 0/r32/AL
171 25/and-eax-with 0xff/imm32
172 $combining-code-point?:end:
173
174 89/<- %esp 5/r32/ebp
175 5d/pop-to-ebp
176 c3/return
177
178 $combining-code-point?:return-false:
179 b8/copy-to-eax 0/imm32/false
180
181 89/<- %esp 5/r32/ebp
182 5d/pop-to-ebp
183 c3/return
184
185
186
187 draw-narrow-code-point-on-screen-buffer:
188
189 55/push-ebp
190 89/<- %ebp 4/r32/esp
191
192 52/push-edx
193 53/push-ebx
194 56/push-esi
195 57/push-edi
196
197 8b/-> *(ebp+0xc) 6/r32/esi
198
199 8b/-> *(ebp+0x14) 2/r32/edx
200 c1 4/subop/shift-left %edx 4/imm8
201
202 8b/-> *(ebp+0x14) 7/r32/edi
203 c1 4/subop/shift-left %edi 4/imm8
204 81 0/subop/add %edi 0x10/imm32
205 {
206
207 39/compare %edx 7/r32/edi
208 0f 8d/jump-if->= break/disp32
209
210 bb/copy-to-ebx 0/imm32
211 8a/byte-> *esi 3/r32/BL
212 (draw-run-of-pixels-from-glyph *(ebp+8) %ebx *(ebp+0x10) %edx *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20) *(ebp+0x24) *(ebp+0x28))
213
214 42/increment-edx
215
216 46/increment-esi
217
218 e9/jump loop/disp32
219 }
220 $draw-narrow-code-point-on-screen-buffer:end:
221
222 5f/pop-to-edi
223 5e/pop-to-esi
224 5b/pop-to-ebx
225 5a/pop-to-edx
226
227 89/<- %esp 5/r32/ebp
228 5d/pop-to-ebp
229 c3/return
230
231
232
233 draw-wide-code-point-on-screen-buffer:
234
235 55/push-ebp
236 89/<- %ebp 4/r32/esp
237
238 50/push-eax
239 51/push-ecx
240 52/push-edx
241 53/push-ebx
242 56/push-esi
243 57/push-edi
244
245 8b/-> *(ebp+0xc) 6/r32/esi
246
247 bb/copy-to-ebx 0/imm32
248
249 8b/-> *(ebp+0x14) 2/r32/edx
250 c1 4/subop/shift-left %edx 4/imm8
251
252 8b/-> *(ebp+0x14) 7/r32/edi
253 c1 4/subop/shift-left %edi 4/imm8
254 81 0/subop/add %edi 0x10/imm32
255 {
256
257 39/compare %edx 7/r32/edi
258 0f 8d/jump-if->= break/disp32
259
260 8a/byte-> *esi 3/r32/BL
261
262 8b/-> *(ebp+0x10) 1/r32/ecx
263
264 (draw-run-of-pixels-from-glyph *(ebp+8) %ebx %ecx %edx *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20) *(ebp+0x24) *(ebp+0x28))
265
266 8a/byte-> *(esi+1) 3/r32/BL
267 41/increment-ecx
268 (draw-run-of-pixels-from-glyph *(ebp+8) %ebx %ecx %edx *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20) *(ebp+0x24) *(ebp+0x28))
269
270 42/increment-edx
271
272 81 0/subop/add %esi 2/imm32
273
274 e9/jump loop/disp32
275 }
276 $draw-wide-code-point-on-screen-buffer:end:
277
278 5f/pop-to-edi
279 5e/pop-to-esi
280 5b/pop-to-ebx
281 5a/pop-to-edx
282 59/pop-to-ecx
283 58/pop-to-eax
284
285 89/<- %esp 5/r32/ebp
286 5d/pop-to-ebp
287 c3/return
288
289
290 draw-run-of-pixels-from-glyph:
291
292 55/push-ebp
293 89/<- %ebp 4/r32/esp
294
295 50/push-eax
296 51/push-ecx
297 56/push-esi
298
299 8b/-> *(ebp+0xc) 6/r32/esi
300
301 8b/-> *(ebp+0x10) 0/r32/eax
302 c1 4/subop/shift-left %eax 3/imm8
303 05/add-to-eax 7/imm32
304
305 8b/-> *(ebp+0x10) 1/r32/ecx
306 c1 4/subop/shift-left %ecx 3/imm8
307 {
308
309 39/compare %eax 1/r32/ecx
310 7c/jump-if-< break/disp8
311
312 c1 5/subop/shift-right-logical %esi 1/imm8
313
314 {
315 73/jump-if-not-CF break/disp8
316 (pixel-on-screen-buffer *(ebp+8) %eax *(ebp+0x14) *(ebp+0x18) *(ebp+0x24) *(ebp+0x28))
317 eb/jump $draw-code-point-on-screen-buffer:continue/disp8
318 }
319
320 {
321 81 7/subop/compare *(ebp+0x20) 0/imm32/false
322 75/jump-if-!= break/disp8
323 (pixel-on-screen-buffer *(ebp+8) %eax *(ebp+0x14) *(ebp+0x1c) *(ebp+0x24) *(ebp+0x28))
324 }
325 $draw-code-point-on-screen-buffer:continue:
326
327 48/decrement-eax
328
329 eb/jump loop/disp8
330 }
331 $draw-run-of-pixels-from-glyph:end:
332
333 5e/pop-to-esi
334 59/pop-to-ecx
335 58/pop-to-eax
336
337 89/<- %esp 5/r32/ebp
338 5d/pop-to-ebp
339 c3/return
340
341 cursor-position-on-real-screen:
342
343 55/push-ebp
344 89/<- %ebp 4/r32/esp
345
346 8b/-> *Real-screen-cursor-x 0/r32/eax
347 8b/-> *Real-screen-cursor-y 1/r32/ecx
348 $cursor-position-on-real-screen:end:
349
350 89/<- %esp 5/r32/ebp
351 5d/pop-to-ebp
352 c3/return
353
354 set-cursor-position-on-real-screen:
355
356 55/push-ebp
357 89/<- %ebp 4/r32/esp
358
359 50/push-eax
360
361 8b/-> *(ebp+8) 0/r32/eax
362 89/<- *Real-screen-cursor-x 0/r32/eax
363 8b/-> *(ebp+0xc) 0/r32/eax
364 89/<- *Real-screen-cursor-y 0/r32/eax
365 $set-cursor-position-on-real-screen:end:
366
367 58/pop-to-eax
368
369 89/<- %esp 5/r32/ebp
370 5d/pop-to-ebp
371 c3/return
372
373
374
375
376
377
378
379 draw-cursor-on-real-screen:
380
381 55/push-ebp
382 89/<- %ebp 4/r32/esp
383
384 50/push-eax
385 51/push-ecx
386
387 (cursor-position-on-real-screen)
388 (draw-code-point-on-real-screen *(ebp+8) %eax %ecx 0 7)
389 $draw-cursor-on-real-screen:end:
390
391 59/pop-to-ecx
392 58/pop-to-eax
393
394 89/<- %esp 5/r32/ebp
395 5d/pop-to-ebp
396 c3/return
397
398 == data
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415 Real-screen-cursor-x:
416 0/imm32
417 Real-screen-cursor-y:
418 0/imm32