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