https://github.com/akkartik/mu/blob/main/baremetal/120allocate.subx
 1 == code
 2 #   instruction                     effective address                                                   register    displacement    immediate
 3 # . op          subop               mod             rm32          base        index         scale       r32
 4 # . 1-3 bytes   3 bits              2 bits          3 bits        3 bits      3 bits        2 bits      2 bits      0/1/2/4 bytes   0/1/2/4 bytes
 5 
 6 # Fill a region of memory with zeroes.
 7 zero-out:  # start: (addr byte), size: int
 8     # pseudocode:
 9     #   curr/esi = start
10     #   i/ecx = 0
11     #   while true
12     #     if (i >= size) break
13     #     *curr = 0
14     #     ++curr
15     #     ++i
16     #
17     # . prologue
18     55/push-ebp
19     89/copy                         3/mod/direct    5/rm32/ebp    .           .             .           4/r32/esp   .               .                 # copy esp to ebp
20     # . save registers
21     50/push-eax
22     51/push-ecx
23     52/push-edx
24     56/push-esi
25     # curr/esi = start
26     8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           6/r32/esi   8/disp8         .                 # copy *(ebp+8) to esi
27     # var i/ecx: int = 0
28     31/xor                          3/mod/direct    1/rm32/ecx    .           .             .           1/r32/ecx   .               .                 # clear ecx
29     # edx = size
30     8b/copy                         1/mod/*+disp8   5/rm32/ebp    .           .             .           2/r32/edx   0xc/disp8       .                 # copy *(ebp+12) to edx
31 $zero-out:loop:
32     # if (i >= size) break
33     39/compare                      3/mod/direct    1/rm32/ecx    .           .             .           2/r32/edx   .               .                 # compare ecx with edx
34     7d/jump-if->=  $zero-out:end/disp8
35     # *curr = 0
36     c6          0/subop/copy-byte   0/mod/direct    6/rm32/esi    .           .             .           .           .               0/imm8            # copy byte to *esi
37     # ++curr
38     46/increment-esi
39     # ++i
40     41/increment-ecx
41     eb/jump  $zero-out:loop/disp8
42 $zero-out:end:
43     # . restore registers
44     5e/pop-to-esi
45     5a/pop-to-edx
46     59/pop-to-ecx
47     58/pop-to-eax
48     # . epilogue
49     89/copy                         3/mod/direct    4/rm32/esp    .           .             .           5/r32/ebp   .               .                 # copy ebp to esp
50     5d/pop-to-ebp
51     c3/return
52 
53 # . . vim:nowrap:textwidth=0