https://github.com/akkartik/mu/blob/main/103grapheme.subx
1
2
3
4
5
6
7
8
9
10 == code
11
12
13
14
15
16
17 draw-grapheme-on-real-screen:
18
19 55/push-ebp
20 89/<- %ebp 4/r32/esp
21
22 (draw-grapheme-on-screen-buffer *Video-memory-addr *(ebp+8) *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) 0x80 0x30)
23 $draw-grapheme-on-real-screen:end:
24
25 89/<- %esp 5/r32/ebp
26 5d/pop-to-ebp
27 c3/return
28
29 draw-grapheme-on-screen-array:
30
31 55/push-ebp
32 89/<- %ebp 4/r32/esp
33
34 50/push-eax
35 51/push-ecx
36 52/push-edx
37
38 {
39
40 8b/-> *(ebp+8) 1/r32/ecx
41 8b/-> *ecx 1/r32/ecx
42
43 ba/copy-to-edx 0/imm32
44 8b/-> *(ebp+0x20) 0/r32/eax
45 f7 4/subop/multiply-into-eax *(ebp+0x24)
46 81 7/subop/compare %edx 0/imm32
47 0f 85/jump-if-!= $draw-grapheme-on-screen-array:overflow/disp32
48
49 39/compare %eax 1/r32/ecx
50 0f 8f/jump-if-> $draw-grapheme-on-screen-array:abort/disp32
51 }
52
53 8b/-> *(ebp+8) 0/r32/eax
54 05/add-to-eax 4/imm32
55
56 (draw-grapheme-on-screen-buffer %eax *(ebp+0xc) *(ebp+0x10) *(ebp+0x14) *(ebp+0x18) *(ebp+0x1c) *(ebp+0x20) *(ebp+0x24))
57 $draw-grapheme-on-screen-array:end:
58
59 5a/pop-to-edx
60 59/pop-to-ecx
61 58/pop-to-eax
62
63 89/<- %esp 5/r32/ebp
64 5d/pop-to-ebp
65 c3/return
66
67 $draw-grapheme-on-screen-array:overflow:
68 (abort "draw-grapheme-on-screen-array: screen dimensions too large")
69
70 $draw-grapheme-on-screen-array:abort:
71 (abort "draw-grapheme-on-screen-array: coordinates are off the screen. Are the screen dimensions correct?")
72
73
74 draw-grapheme-on-screen-buffer:
75
76 55/push-ebp
77 89/<- %ebp 4/r32/esp
78
79 50/push-eax
80 51/push-ecx
81 52/push-edx
82 53/push-ebx
83 56/push-esi
84
85 c1 4/subop/shift-left *(ebp+20) 3/imm8/log2-font-width
86 c1 4/subop/shift-left *(ebp+24) 4/imm8/log2-font-height
87
88 8b/-> *(ebp+0xc) 6/r32/esi
89
90 81 7/subop/compare %esi 0x80/imm32
91 0f 8d/jump-if->= $draw-grapheme-on-screen-buffer:end/disp32
92
93 c1 4/subop/shift-left %esi 4/imm8
94 81 0/subop/add %esi Font/imm32
95
96 8b/-> *(ebp+0x14) 2/r32/edx
97 c1 4/subop/shift-left %edx 4/imm8
98
99 8b/-> *(ebp+0x14) 3/r32/ebx
100 c1 4/subop/shift-left %ebx 4/imm8
101 81 0/subop/add %ebx 0x10/imm32
102 {
103
104 39/compare %edx 3/r32/ebx
105 0f 8d/jump-if->= break/disp32
106
107 8b/-> *(ebp+0x10) 0/r32/eax
108 c1 4/subop/shift-left %eax 3/imm8
109 05/add-to-eax 7/imm32
110
111 8b/-> *(ebp+0x10) 1/r32/ecx
112 c1 4/subop/shift-left %ecx 3/imm8
113
114 53/push-ebx
115 8b/-> *esi 3/r32/ebx
116 {
117
118 39/compare %eax 1/r32/ecx
119 7c/jump-if-< break/disp8
120
121 c1 5/subop/shift-right-logical %ebx 1/imm8
122
123 {
124 73/jump-if-not-CF break/disp8
125 (pixel-on-screen-buffer *(ebp+8) %eax %edx *(ebp+0x18) *(ebp+0x20) *(ebp+0x24))
126 eb/jump $draw-grapheme-on-screen-buffer:continue/disp8
127 }
128
129 (pixel-on-screen-buffer *(ebp+8) %eax %edx *(ebp+0x1c) *(ebp+0x20) *(ebp+0x24))
130 $draw-grapheme-on-screen-buffer:continue:
131
132 48/decrement-eax
133
134 eb/jump loop/disp8
135 }
136
137 5b/pop-to-ebx
138
139 42/increment-edx
140
141 46/increment-esi
142
143 e9/jump loop/disp32
144 }
145 $draw-grapheme-on-screen-buffer:end:
146
147 5e/pop-to-esi
148 5b/pop-to-ebx
149 5a/pop-to-edx
150 59/pop-to-ecx
151 58/pop-to-eax
152
153 89/<- %esp 5/r32/ebp
154 5d/pop-to-ebp
155 c3/return
156
157 cursor-position-on-real-screen:
158
159 55/push-ebp
160 89/<- %ebp 4/r32/esp
161
162 8b/-> *Real-screen-cursor-x 0/r32/eax
163 8b/-> *Real-screen-cursor-y 1/r32/ecx
164 $cursor-position-on-real-screen:end:
165
166 89/<- %esp 5/r32/ebp
167 5d/pop-to-ebp
168 c3/return
169
170 set-cursor-position-on-real-screen:
171
172 55/push-ebp
173 89/<- %ebp 4/r32/esp
174
175 50/push-eax
176
177 8b/-> *(ebp+8) 0/r32/eax
178 89/<- *Real-screen-cursor-x 0/r32/eax
179 8b/-> *(ebp+0xc) 0/r32/eax
180 89/<- *Real-screen-cursor-y 0/r32/eax
181 $set-cursor-position-on-real-screen:end:
182
183 58/pop-to-eax
184
185 89/<- %esp 5/r32/ebp
186 5d/pop-to-ebp
187 c3/return
188
189
190
191
192
193
194
195 draw-cursor-on-real-screen:
196
197 55/push-ebp
198 89/<- %ebp 4/r32/esp
199
200 50/push-eax
201 51/push-ecx
202
203 (cursor-position-on-real-screen)
204 (draw-grapheme-on-real-screen *(ebp+8) %eax %ecx 0 7)
205 $draw-cursor-on-real-screen:end:
206
207 59/pop-to-ecx
208 58/pop-to-eax
209
210 89/<- %esp 5/r32/ebp
211 5d/pop-to-ebp
212 c3/return
213
214 == data
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231 Real-screen-cursor-x:
232 0/imm32
233 Real-screen-cursor-y:
234 0/imm32