https://github.com/akkartik/mu/blob/main/baremetal/103grapheme.subx
 1 draw-grapheme:  # screen: (addr screen), g: grapheme, x: int, y: int, color: int
 2     # . prologue
 3     55/push-ebp
 4     89/<- %ebp 4/r32/esp
 5     # . save registers
 6     50/push-eax
 7     51/push-ecx
 8     52/push-edx
 9     53/push-ebx
10     56/push-esi
11     # var letter-bitmap/esi = font[g]
12     8b/-> *(ebp+0xc) 6/r32/esi
13     c1 4/subop/shift-left %esi 4/imm8
14     8d/copy-address *(esi+0x8800) 6/r32/esi  # font-start
15     # if (letter-bitmap >= 0x9000) return  # characters beyond ASCII currently not supported
16     81 7/subop/compare %esi 0x9000/imm32
17     7d/jump-if->= $draw-grapheme:end/disp8
18     # edx = y
19     8b/-> *(ebp+0x14) 2/r32/edx
20     # var ymax/ebx: int = y + 16
21     8b/-> *(ebp+0x14) 3/r32/ebx
22     81 0/subop/add %ebx 0x10/imm32
23     {
24       # if (y >= ymax) break
25       39/compare %edx 3/r32/ebx
26       7d/jump-if->= break/disp8
27       # eax = x + 7
28       8b/-> *(ebp+0x10) 0/r32/eax
29       81 0/subop/add %eax 7/imm32
30       # var xmin/ecx: int = x
31       8b/-> *(ebp+0x10) 1/r32/ecx
32       # var row-bitmap/ebx: int = *letter-bitmap
33       53/push-ebx
34       8b/-> *esi 3/r32/ebx
35       {
36         # if (x < xmin) break
37         39/compare %eax 1/r32/ecx
38         7c/jump-if-< break/disp8
39         # shift LSB from row-bitmap into carry flag (CF)
40         c1 5/subop/shift-right-logical %ebx 1/imm8
41         # if LSB, draw a pixel
42         {
43           73/jump-if-not-CF break/disp8
44           (pixel *(ebp+8) %eax %edx *(ebp+0x18))
45         }
46         # --x
47         48/decrement-eax
48         #
49         eb/jump loop/disp8
50       }
51       # reclaim row-bitmap
52       5b/pop-to-ebx
53       # ++y
54       42/increment-edx
55       # next bitmap row
56       46/increment-esi
57       #
58       eb/jump loop/disp8
59     }
60 $draw-grapheme:end:
61     # . restore registers
62     5e/pop-to-esi
63     5b/pop-to-ebx
64     5a/pop-to-edx
65     59/pop-to-ecx
66     58/pop-to-eax
67     # . epilogue
68     89/<- %esp 5/r32/ebp
69     5d/pop-to-ebp
70     c3/return