https://github.com/akkartik/mu/blob/main/baremetal/115write-byte.subx
1 == code
2
3
4
5
6
7 append-byte:
8
9 55/push-ebp
10 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
11
12 51/push-ecx
13 57/push-edi
14
15 8b/copy 1/mod/*+disp8 5/rm32/ebp . . . 7/r32/edi 8/disp8 .
16
17 8b/copy 0/mod/indirect 7/rm32/edi . . . 1/r32/ecx . .
18
19 3b/compare 1/mod/*+disp8 7/rm32/edi . . . 1/r32/ecx 8/disp8 .
20 7d/jump-if->= $append-byte:end/disp8
21 $append-byte:to-stream:
22
23
24 31/xor 3/mod/direct 0/rm32/eax . . . 0/r32/eax . .
25 8a/copy-byte 1/mod/*+disp8 5/rm32/ebp . . . 0/r32/AL 0xc/disp8 .
26 88/copy-byte 1/mod/*+disp8 4/rm32/sib 7/base/edi 1/index/ecx . 0/r32/AL 0xc/disp8 .
27
28 ff 0/subop/increment 0/mod/indirect 7/rm32/edi . . . . . .
29 $append-byte:end:
30
31 5f/pop-to-edi
32 59/pop-to-ecx
33
34 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
35 5d/pop-to-ebp
36 c3/return
37
38