https://github.com/akkartik/mu/blob/master/057write.subx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 == code
19
20
21
22
23
24 write:
25
26 55/push-EBP
27 89/copy 3/mod/direct 5/rm32/EBP . . . 4/r32/ESP . .
28
29 81 7/subop/compare 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 0x08000000/imm32
30 73/jump-if-greater-unsigned-or-equal $write:fake/disp8
31
32 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
33 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 8/disp8 .
34
35 e8/call _write/disp32
36
37 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
38 eb/jump $write:end/disp8
39 $write:fake:
40
41
42 50/push-EAX
43 51/push-ECX
44 52/push-EDX
45 53/push-EBX
46
47 8b/copy 1/mod/*+disp8 5/rm32/EBP . . 1/r32/ECX 8/disp8 .
48
49 8b/copy 0/mod/indirect 1/rm32/ECX . . . 2/r32/EDX . .
50
51 8b/copy 1/mod/*+disp8 1/rm32/ECX . . . 3/r32/EBX 8/disp8 .
52
53
54 ff 6/subop/push 1/mod/*+disp8 5/rm32/EBP . . . . 0xc/disp8 .
55
56 8d/copy-address 1/mod/*+disp8 4/rm32/sib 1/base/ECX 3/index/EBX . 3/r32/EBX 0xc/disp8 .
57 53/push-EBX
58
59 8d/copy-address 1/mod/*+disp8 4/rm32/sib 1/base/ECX 2/index/EDX . 3/r32/EBX 0xc/disp8 .
60 53/push-EBX
61
62 e8/call _append-3/disp32
63
64 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
65
66 01/add 0/mod/indirect 1/rm32/ECX . . . 0/r32/EAX . .
67
68 5b/pop-to-EBX
69 5a/pop-to-EDX
70 59/pop-to-ECX
71 58/pop-to-EAX
72 $write:end:
73
74 89/copy 3/mod/direct 4/rm32/ESP . . . 5/r32/EBP . .
75 5d/pop-to-EBP
76 c3/return
77
78 test-write-single:
79
80
81 68/push _test-stream/imm32
82
83 e8/call clear-stream/disp32
84
85 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
86
87
88 68/push "Ab"/imm32
89 68/push _test-stream/imm32
90
91 e8/call write/disp32
92
93 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
94
95
96 68/push "F - test-write-single"/imm32
97 68/push 0x006241/imm32/Ab
98
99 b8/copy-to-EAX _test-stream/imm32
100 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 .
101
102 e8/call check-ints-equal/disp32
103
104 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
105
106 c3/return
107
108 test-write-appends:
109
110
111 68/push _test-stream/imm32
112
113 e8/call clear-stream/disp32
114
115 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 4/imm32
116
117
118 68/push "C"/imm32
119 68/push _test-stream/imm32
120
121 e8/call write/disp32
122
123 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
124
125
126 68/push "D"/imm32
127 68/push _test-stream/imm32
128
129 e8/call write/disp32
130
131 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 8/imm32
132
133
134 68/push "F - test-write-appends"/imm32
135 68/push 0x00004443/imm32/C-D
136
137 b8/copy-to-EAX _test-stream/imm32
138 ff 6/subop/push 1/mod/*+disp8 0/rm32/EAX . . . . 0xc/disp8 .
139
140 e8/call check-ints-equal/disp32
141
142 81 0/subop/add 3/mod/direct 4/rm32/ESP . . . . . 0xc/imm32
143
144 c3/return
145
146 == data
147
148 _test-stream:
149
150 0/imm32
151
152 0/imm32
153
154 0x10/imm32
155
156 00 00 00 00 00 00 00 00
157 00 00 00 00 00 00 00 00
158
159