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) *(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 0x80/imm32
135 0f 8d/jump-if->= $wide-code-point?:end/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 combining-code-point?:
151
152 55/push-ebp
153 89/<- %ebp 4/r32/esp
154
155 8b/-> *(ebp+8) 0/r32/eax
156
157 3d/compare-eax-and 0x80/imm32
158 0f 8d/jump-if->= $combining-code-point?:end/disp32
159
160 69/multiply %eax 0x22/imm32/glyph-size 0/r32/eax
161 05/add-to-eax 0x0010000c/imm32/Font
162
163 8a/byte-> *(eax+1) 0/r32/AL
164 25/and-eax-with 0xff/imm32
165 $combining-code-point?:end:
166
167 89/<- %esp 5/r32/ebp
168 5d/pop-to-ebp
169 c3/return
170
171
172
173 draw-narrow-code-point-on-screen-buffer:
174
175 55/push-ebp
176 89/<- %ebp 4/r32/esp
177
178 52/push-edx
179 53/push-ebx
180 56/push-esi
181 57/push-edi
182
183 8b/-> *(ebp+0xc) 6/r32/esi
184
185 8b/-> *(ebp+0x14) 2/r32/edx
186 c1 4/subop/shift-left %edx 4/imm8
187
188 8b/-> *(ebp+0x14) 7/r32/edi
189 c1 4/subop/shift-left %edi 4/imm8
190 81 0/subop/add %edi 0x10/imm32
191 {
192
193 39/compare %edx 7/r32/edi
194 0f 8d/jump-if->= break/disp32
195
196 bb/copy-to-ebx 0/imm32
197 8a/byte-> *esi 3/r32/BL
198 (draw-run-of-pixels-from-glyph *(ebp+8) %ebx *(ebp+0x10) %edx *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20) *(ebp+0x24) *(ebp+0x28))
199
200 42/increment-edx
201
202 46/increment-esi
203
204 e9/jump loop/disp32
205 }
206 $draw-narrow-code-point-on-screen-buffer:end:
207
208 5f/pop-to-edi
209 5e/pop-to-esi
210 5b/pop-to-ebx
211 5a/pop-to-edx
212
213 89/<- %esp 5/r32/ebp
214 5d/pop-to-ebp
215 c3/return
216
217
218
219 draw-wide-code-point-on-screen-buffer:
220
221 55/push-ebp
222 89/<- %ebp 4/r32/esp
223
224 50/push-eax
225 51/push-ecx
226 52/push-edx
227 53/push-ebx
228 56/push-esi
229 57/push-edi
230
231 8b/-> *(ebp+0xc) 6/r32/esi
232
233 bb/copy-to-ebx 0/imm32
234
235 8b/-> *(ebp+0x14) 2/r32/edx
236 c1 4/subop/shift-left %edx 4/imm8
237
238 8b/-> *(ebp+0x14) 7/r32/edi
239 c1 4/subop/shift-left %edi 4/imm8
240 81 0/subop/add %edi 0x10/imm32
241 {
242
243 39/compare %edx 7/r32/edi
244 0f 8d/jump-if->= break/disp32
245
246 8a/byte-> *esi 3/r32/BL
247
248 8b/-> *(ebp+0x10) 1/r32/ecx
249
250 (draw-run-of-pixels-from-glyph *(ebp+8) %ebx %ecx %edx *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20) *(ebp+0x24) *(ebp+0x28))
251
252 8a/byte-> *(esi+1) 3/r32/BL
253 41/increment-ecx
254 (draw-run-of-pixels-from-glyph *(ebp+8) %ebx %ecx %edx *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20) *(ebp+0x24) *(ebp+0x28))
255
256 42/increment-edx
257
258 81 0/subop/add %esi 2/imm32
259
260 e9/jump loop/disp32
261 }
262 $draw-wide-code-point-on-screen-buffer:end:
263
264 5f/pop-to-edi
265 5e/pop-to-esi
266 5b/pop-to-ebx
267 5a/pop-to-edx
268 59/pop-to-ecx
269 58/pop-to-eax
270
271 89/<- %esp 5/r32/ebp
272 5d/pop-to-ebp
273 c3/return
274
275
276 draw-run-of-pixels-from-glyph:
277
278 55/push-ebp
279 89/<- %ebp 4/r32/esp
280
281 50/push-eax
282 51/push-ecx
283 56/push-esi
284
285 8b/-> *(ebp+0xc) 6/r32/esi
286
287 8b/-> *(ebp+0x10) 0/r32/eax
288 c1 4/subop/shift-left %eax 3/imm8
289 05/add-to-eax 7/imm32
290
291 8b/-> *(ebp+0x10) 1/r32/ecx
292 c1 4/subop/shift-left %ecx 3/imm8
293 {
294
295 39/compare %eax 1/r32/ecx
296 7c/jump-if-< break/disp8
297
298 c1 5/subop/shift-right-logical %esi 1/imm8
299
300 {
301 73/jump-if-not-CF break/disp8
302 (pixel-on-screen-buffer *(ebp+8) %eax *(ebp+0x14) *(ebp+0x18) *(ebp+0x24) *(ebp+0x28))
303 eb/jump $draw-code-point-on-screen-buffer:continue/disp8
304 }
305
306 {
307 81 7/subop/compare *(ebp+0x20) 0/imm32/false
308 75/jump-if-!= break/disp8
309 (pixel-on-screen-buffer *(ebp+8) %eax *(ebp+0x14) *(ebp+0x1c) *(ebp+0x24) *(ebp+0x28))
310 }
311 $draw-code-point-on-screen-buffer:continue:
312
313 48/decrement-eax
314
315 eb/jump loop/disp8
316 }
317 $draw-run-of-pixels-from-glyph:end:
318
319 5e/pop-to-esi
320 59/pop-to-ecx
321 58/pop-to-eax
322
323 89/<- %esp 5/r32/ebp
324 5d/pop-to-ebp
325 c3/return
326
327 cursor-position-on-real-screen:
328
329 55/push-ebp
330 89/<- %ebp 4/r32/esp
331
332 8b/-> *Real-screen-cursor-x 0/r32/eax
333 8b/-> *Real-screen-cursor-y 1/r32/ecx
334 $cursor-position-on-real-screen:end:
335
336 89/<- %esp 5/r32/ebp
337 5d/pop-to-ebp
338 c3/return
339
340 set-cursor-position-on-real-screen:
341
342 55/push-ebp
343 89/<- %ebp 4/r32/esp
344
345 50/push-eax
346
347 8b/-> *(ebp+8) 0/r32/eax
348 89/<- *Real-screen-cursor-x 0/r32/eax
349 8b/-> *(ebp+0xc) 0/r32/eax
350 89/<- *Real-screen-cursor-y 0/r32/eax
351 $set-cursor-position-on-real-screen:end:
352
353 58/pop-to-eax
354
355 89/<- %esp 5/r32/ebp
356 5d/pop-to-ebp
357 c3/return
358
359
360
361
362
363
364
365 draw-cursor-on-real-screen:
366
367 55/push-ebp
368 89/<- %ebp 4/r32/esp
369
370 50/push-eax
371 51/push-ecx
372
373 (cursor-position-on-real-screen)
374 (draw-code-point-on-real-screen *(ebp+8) %eax %ecx 0 7)
375 $draw-cursor-on-real-screen:end:
376
377 59/pop-to-ecx
378 58/pop-to-eax
379
380 89/<- %esp 5/r32/ebp
381 5d/pop-to-ebp
382 c3/return
383
384 == data
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401 Real-screen-cursor-x:
402 0/imm32
403 Real-screen-cursor-y:
404 0/imm32