about summary refs log tree commit diff stats
path: root/js/games/nluqo.github.io/~bh/simply-toc.html
blob: f8af9e9569b5c85502eaadd3d31659cffe3da696 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
generated by cgit-pink 1.4.1-2-gfad0 (git 2.36.2.497.gbbea4dcf42) at 2025-01-18 10:01:36 +0000
 


n class="nt">span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              8/imm32           <span class="subxComment"># add to esp</span>
<span id="L60" class="LineNr"> 60 </span>    <span class="subxComment"># if (f-&gt;write == 0) break</span>
<span id="L61" class="LineNr"> 61 </span>    <span class="subxComment"># since f-&gt;read was initially 0, eax is the same as f-&gt;write</span>
<span id="L62" class="LineNr"> 62 </span>    <span class="subxS1Comment"># . if (eax == 0) return true</span>
<span id="L63" class="LineNr"> 63 </span>    3d/compare-eax-and  0/imm32
<span id="L64" class="LineNr"> 64 </span>    74/jump-if-=  $slurp:end/disp8
<span id="L65" class="LineNr"> 65 </span><span class="Constant">$slurp:from-stream</span>:
<span id="L66" class="LineNr"> 66 </span>    <span class="subxComment"># var c/eax: byte = f-&gt;data[f-&gt;read]</span>
<span id="L67" class="LineNr"> 67 </span>    31/xor                          3/mod/direct    0/rm32/eax   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>          0/r32/eax  <span class="Normal"> . </span>             <span class="Normal"> . </span>                <span class="subxComment"># clear eax</span>
<span id="L68" class="LineNr"> 68 </span>    8a/copy-byte                    1/mod/*+disp8   4/rm32/sib    6/base/esi  1/index/ecx  <span class="Normal"> . </span>          0/r32/AL    0x10/disp8     <span class="Normal"> . </span>                <span class="subxComment"># copy byte at *(esi+ecx+16) to AL</span>
<span id="L69" class="LineNr"> 69 </span>    <span class="subxComment"># s-&gt;data[s-&gt;write] = c</span>
<span id="L70" class="LineNr"> 70 </span>    88/copy-byte                    1/mod/*+disp8   4/rm32/sib    7/base/edi  2/index/edx  <span class="Normal"> . </span>          0/r32/AL    0xc/disp8      <span class="Normal"> . </span>                <span class="subxComment"># copy AL to *(edi+edx+12)</span>
<span id="L71" class="LineNr"> 71 </span>    <span class="subxComment"># ++f-&gt;read</span>
<span id="L72" class="LineNr"> 72 </span>    41/increment-ecx
<span id="L73" class="LineNr"> 73 </span>    <span class="subxComment"># ++s-&gt;write</span>
<span id="L74" class="LineNr"> 74 </span>    42/increment-edx
<span id="L75" class="LineNr"> 75 </span>    eb/jump  $slurp:<span class="Constant">loop</span>/disp8
<span id="L76" class="LineNr"> 76 </span><span class="Constant">$slurp:end</span>:
<span id="L77" class="LineNr"> 77 </span>    <span class="subxComment"># save f-&gt;read</span>
<span id="L78" class="LineNr"> 78 </span>    89/copy                         1/mod/*+disp8   6/rm32/esi   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>          1/r32/ecx   8/disp8        <span class="Normal"> . </span>                <span class="subxComment"># copy ecx to *(esi+8)</span>
<span id="L79" class="LineNr"> 79 </span>    <span class="subxComment"># save s-&gt;write</span>
<span id="L80" class="LineNr"> 80 </span>    89/copy                         0/mod/indirect  7/rm32/edi   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>          2/r32/edx  <span class="Normal"> . </span>             <span class="Normal"> . </span>                <span class="subxComment"># copy edx to *edi</span>
<span id="L81" class="LineNr"> 81 </span>    <span class="subxS1Comment"># . restore registers</span>
<span id="L82" class="LineNr"> 82 </span>    5f/pop-to-edi
<span id="L83" class="LineNr"> 83 </span>    5e/pop-to-esi
<span id="L84" class="LineNr"> 84 </span>    5a/pop-to-edx
<span id="L85" class="LineNr"> 85 </span>    59/pop-to-ecx
<span id="L86" class="LineNr"> 86 </span>    58/pop-to-eax
<span id="L87" class="LineNr"> 87 </span>    <span class="subxS1Comment"># . epilogue</span>
<span id="L88" class="LineNr"> 88 </span>    89/copy                         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>          5/r32/ebp  <span class="Normal"> . </span>             <span class="Normal"> . </span>                <span class="subxComment"># copy ebp to esp</span>
<span id="L89" class="LineNr"> 89 </span>    5d/pop-to-ebp
<span id="L90" class="LineNr"> 90 </span>    c3/return
<span id="L91" class="LineNr"> 91 </span>
<span id="L92" class="LineNr"> 92 </span><span class="Constant">$slurp:abort</span>:
<span id="L93" class="LineNr"> 93 </span>    <span class="subxS1Comment"># . _write(2/stderr, error)</span>
<span id="L94" class="LineNr"> 94 </span>    <span class="subxS2Comment"># . . push args</span>
<span id="L95" class="LineNr"> 95 </span>    68/push  <span class="Constant">&quot;slurp: destination too small\n&quot;</span>/imm32
<span id="L96" class="LineNr"> 96 </span>    68/push  2/imm32/stderr
<span id="L97" class="LineNr"> 97 </span>    <span class="subxS2Comment"># . . call</span>
<span id="L98" class="LineNr"> 98 </span>    e8/call  <a href='101_write.subx.html#L12'>_write</a>/disp32
<span id="L99" class="LineNr"> 99 </span>    <span class="subxS2Comment"># . . discard args</span>
<span id="L100" class="LineNr">100 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              8/imm32           <span class="subxComment"># add to esp</span>
<span id="L101" class="LineNr">101 </span>    <span class="subxS1Comment"># . syscall(exit, 1)</span>
<span id="L102" class="LineNr">102 </span>    bb/copy-to-ebx  1/imm32
<span id="L103" class="LineNr">103 </span>    e8/call  syscall_exit/disp32
<span id="L104" class="LineNr">104 </span>    <span class="subxComment"># never gets here</span>
<span id="L105" class="LineNr">105 </span>
<span id="L106" class="LineNr">106 </span><span class="subxTest">test-slurp</span>:
<span id="L107" class="LineNr">107 </span>    <span class="subxComment"># setup</span>
<span id="L108" class="LineNr">108 </span>    <span class="subxS1Comment"># . clear-stream(_test-stream)</span>
<span id="L109" class="LineNr">109 </span>    <span class="subxS2Comment"># . . push args</span>
<span id="L110" class="LineNr">110 </span>    68/push  <a href='108write.subx.html#L151'>_test-stream</a>/imm32
<span id="L111" class="LineNr">111 </span>    <span class="subxS2Comment"># . . call</span>
<span id="L112" class="LineNr">112 </span>    e8/call  <a href='106stream.subx.html#L17'>clear-stream</a>/disp32
<span id="L113" class="LineNr">113 </span>    <span class="subxS2Comment"># . . discard args</span>
<span id="L114" class="LineNr">114 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              4/imm32           <span class="subxComment"># add to esp</span>
<span id="L115" class="LineNr">115 </span>    <span class="subxS1Comment"># . clear-stream($_test-buffered-file-&gt;buffer)</span>
<span id="L116" class="LineNr">116 </span>    <span class="subxS2Comment"># . . push args</span>
<span id="L117" class="LineNr">117 </span>    68/push  $_test-buffered-file-&gt;buffer/imm32
<span id="L118" class="LineNr">118 </span>    <span class="subxS2Comment"># . . call</span>
<span id="L119" class="LineNr">119 </span>    e8/call  <a href='106stream.subx.html#L17'>clear-stream</a>/disp32
<span id="L120" class="LineNr">120 </span>    <span class="subxS2Comment"># . . discard args</span>
<span id="L121" class="LineNr">121 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              4/imm32           <span class="subxComment"># add to esp</span>
<span id="L122" class="LineNr">122 </span>    <span class="subxS1Comment"># . clear-stream(_test-tmp-stream)</span>
<span id="L123" class="LineNr">123 </span>    <span class="subxS2Comment"># . . push args</span>
<span id="L124" class="LineNr">124 </span>    68/push  <a href='111read.subx.html#L428'>_test-tmp-stream</a>/imm32
<span id="L125" class="LineNr">125 </span>    <span class="subxS2Comment"># . . call</span>
<span id="L126" class="LineNr">126 </span>    e8/call  <a href='106stream.subx.html#L17'>clear-stream</a>/disp32
<span id="L127" class="LineNr">127 </span>    <span class="subxS2Comment"># . . discard args</span>
<span id="L128" class="LineNr">128 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              4/imm32           <span class="subxComment"># add to esp</span>
<span id="L129" class="LineNr">129 </span>    <span class="subxComment"># write(_test-stream, &quot;ab\ncd&quot;)</span>
<span id="L130" class="LineNr">130 </span>    <span class="subxS2Comment"># . . push args</span>
<span id="L131" class="LineNr">131 </span>    68/push  <span class="Constant">&quot;ab\ncd&quot;</span>/imm32
<span id="L132" class="LineNr">132 </span>    68/push  <a href='108write.subx.html#L151'>_test-stream</a>/imm32
<span id="L133" class="LineNr">133 </span>    <span class="subxS2Comment"># . . call</span>
<span id="L134" class="LineNr">134 </span>    e8/call  <a href='108write.subx.html#L24'>write</a>/disp32
<span id="L135" class="LineNr">135 </span>    <span class="subxS2Comment"># . . discard args</span>
<span id="L136" class="LineNr">136 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              8/imm32           <span class="subxComment"># add to esp</span>
<span id="L137" class="LineNr">137 </span>    <span class="subxComment"># read a line from _test-stream (buffered by _test-buffered-file) into _test-tmp-stream</span>
<span id="L138" class="LineNr">138 </span>    <span class="subxS1Comment"># . eax = slurp(_test-buffered-file, _test-tmp-stream)</span>
<span id="L139" class="LineNr">139 </span>    <span class="subxS2Comment"># . . push args</span>
<span id="L140" class="LineNr">140 </span>    68/push  <a href='111read.subx.html#L428'>_test-tmp-stream</a>/imm32
<span id="L141" class="LineNr">141 </span>    68/push  <a href='112read-byte.subx.html#L318'>_test-buffered-file</a>/imm32
<span id="L142" class="LineNr">142 </span>    <span class="subxS2Comment"># . . call</span>
<span id="L143" class="LineNr">143 </span>    e8/call  <a href='132slurp.subx.html#L8'>slurp</a>/disp32
<span id="L144" class="LineNr">144 </span>    <span class="subxS2Comment"># . . discard args</span>
<span id="L145" class="LineNr">145 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              8/imm32           <span class="subxComment"># add to esp</span>
<span id="L146" class="LineNr">146 </span>    <span class="subxComment"># check-stream-equal(_test-tmp-stream, &quot;ab\ncd&quot;, msg)</span>
<span id="L147" class="LineNr">147 </span>    <span class="subxS2Comment"># . . push args</span>
<span id="L148" class="LineNr">148 </span>    68/push  <span class="Constant">&quot;F - test-slurp&quot;</span>/imm32
<span id="L149" class="LineNr">149 </span>    68/push  <span class="Constant">&quot;ab\ncd&quot;</span>/imm32
<span id="L150" class="LineNr">150 </span>    68/push  <a href='111read.subx.html#L428'>_test-tmp-stream</a>/imm32
<span id="L151" class="LineNr">151 </span>    <span class="subxS2Comment"># . . call</span>
<span id="L152" class="LineNr">152 </span>    e8/call  <a href='109stream-equal.subx.html#L194'>check-stream-equal</a>/disp32
<span id="L153" class="LineNr">153 </span>    <span class="subxS2Comment"># . . discard args</span>
<span id="L154" class="LineNr">154 </span>    81          0/subop/add         3/mod/direct    4/rm32/esp   <span class="Normal"> . </span>         <span class="Normal"> . </span>           <span class="Normal"> . </span>         <span class="Normal"> . </span>         <span class="Normal"> . </span>              0xc/imm32         <span class="subxComment"># add to esp</span>
<span id="L155" class="LineNr">155 </span>    <span class="subxComment"># end</span>
<span id="L156" class="LineNr">156 </span>    c3/return
<span id="L157" class="LineNr">157 </span>
<span id="L158" class="LineNr">158 </span><span class="subxS2Comment"># . . vim&#0058;nowrap:textwidth=0</span>
</pre>
</body>
</html>
<!-- vim: set foldmethod=manual : -->