https://github.com/akkartik/mu/blob/master/309stream.subx
1
2
3
4 write-to-stream:
5
6 55/push-ebp
7 89/<- %ebp 4/r32/esp
8
9 50/push-eax
10 51/push-ecx
11 52/push-edx
12 53/push-ebx
13 57/push-edi
14
15 8b/-> *(ebp+8) 7/r32/edi
16
17 8b/-> *edi 2/r32/edx
18
19 8b/-> *(ebp+0x10) 1/r32/ecx
20 01/add-to %ecx 2/r32/edx
21 3b/compare 1/r32/ecx *(edi+8)
22 0f 8f/jump-if-> $write-to-stream:abort/disp32
23
24 8d/copy-address *(edi+edx+0xc) 2/r32/edx
25
26 8b/-> *(ebp+0x10) 3/r32/ebx
27 8d/copy-address *(edx+ebx) 3/r32/ebx
28
29 8b/-> *(ebp+0xc) 0/r32/eax
30
31 8b/-> *(ebp+0x10) 1/r32/ecx
32 8d/copy-address *(eax+ecx) 1/r32/ecx
33
34 (_append-4 %edx %ebx %eax %ecx)
35
36 8b/-> *(ebp+0x10) 1/r32/ecx
37 01/add-to *edi 1/r32/ecx
38 $write-to-stream:end:
39
40 5f/pop-to-edi
41 5b/pop-to-ebx
42 5a/pop-to-edx
43 59/pop-to-ecx
44 58/pop-to-eax
45
46 89/<- %esp 5/r32/ebp
47 5d/pop-to-ebp
48 c3/return
49
50 $write-to-stream:abort:
51 (write-buffered Stderr "write-to-stream: stream full\n")
52 (flush Stderr)
53 bb/copy-to-ebx 1/imm32
54 (syscall_exit)
55
56
57 read-from-stream:
58
59 55/push-ebp
60 89/<- %ebp 4/r32/esp
61
62 50/push-eax
63 51/push-ecx
64 52/push-edx
65 53/push-ebx
66 56/push-esi
67
68 8b/-> *(ebp+8) 6/r32/esi
69
70 8b/-> *(esi+4) 2/r32/edx
71
72 8b/-> *(ebp+0x10) 1/r32/ecx
73 01/add-to %ecx 2/r32/edx
74 3b/compare 1/r32/ecx *esi
75 0f 8f/jump-if-> $read-from-stream:abort/disp32
76
77 8d/copy-address *(esi+edx+0xc) 2/r32/edx
78
79 8b/-> *(ebp+0x10) 3/r32/ebx
80 8d/copy-address *(edx+ebx) 3/r32/ebx
81
82 8b/-> *(ebp+0xc) 0/r32/eax
83
84 8b/-> *(ebp+0x10) 1/r32/ecx
85 8d/copy-address *(eax+ecx) 1/r32/ecx
86
87 (_append-4 %eax %ecx %edx %ebx)
88
89 8b/-> *(ebp+0x10) 1/r32/ecx
90 01/add-to *(esi+4) 1/r32/ecx
91 $read-from-stream:end:
92
93 5e/pop-to-esi
94 5b/pop-to-ebx
95 5a/pop-to-edx
96 59/pop-to-ecx
97 58/pop-to-eax
98
99 89/<- %esp 5/r32/ebp
100 5d/pop-to-ebp
101 c3/return
102
103 $read-from-stream:abort:
104 (write-buffered Stderr "read-from-stream: stream empty\n")
105 (flush Stderr)
106 bb/copy-to-ebx 1/imm32
107 (syscall_exit)
108