https://github.com/akkartik/mu/blob/main/baremetal/106stream.subx
1
2
3
4
5
6
7
8
9
10
11
12 == code
13
14
15
16
17 clear-stream:
18
19 55/push-ebp
20 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
21
22 50/push-eax
23 51/push-ecx
24
25 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 0/r32/eax 8/disp8 .
26
27 8b/copy 1/mod/*+disp8 0/rm32/eax . . . 1/r32/ecx 8/disp8 .
28
29 8d/copy-address 1/mod/*+disp8 4/rm32/sib 0/base/eax 1/index/ecx . 1/r32/ecx 0xc/disp8 .
30
31 c7 0/subop/copy 0/mod/direct 0/rm32/eax . . . . . 0/imm32
32
33 c7 0/subop/copy 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 0/imm32
34
35
36
37 81 0/subop/add 3/mod/direct 0/rm32/eax . . . . . 0xc/imm32
38 $clear-stream:loop:
39
40 39/compare 3/mod/direct 0/rm32/eax . . . 1/r32/ecx . .
41 73/jump-if-addr>= $clear-stream:end/disp8
42
43 c6 0/subop/copy-byte 0/mod/direct 0/rm32/eax . . . . . 0/imm8
44
45 40/increment-eax
46 eb/jump $clear-stream:loop/disp8
47 $clear-stream:end:
48
49 59/pop-to-ecx
50 58/pop-to-eax
51
52 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
53 5d/pop-to-ebp
54 c3/return
55
56 rewind-stream:
57
58 55/push-ebp
59 89/copy 3/mod/direct 5/rm32/ebp . . . 4/r32/esp . .
60
61 50/push-eax
62
63 8b/copy 1/mod/*+disp8 5/rm32/ebp . . 0/r32/eax 8/disp8 .
64
65 c7 0/subop/copy 1/mod/*+disp8 0/rm32/eax . . . . 4/disp8 0/imm32
66 $rewind-stream:end:
67
68 58/pop-to-eax
69
70 89/copy 3/mod/direct 4/rm32/esp . . . 5/r32/ebp . .
71 5d/pop-to-ebp
72 c3/return
73
74