Rev 1199 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1199 | Rev 1666 | ||
---|---|---|---|
1 | ;************************************************************** |
1 | ;************************************************************** |
2 | ; ScrollBar Macro for Kolibri OS |
2 | ; ScrollBar Macro for Kolibri OS |
3 | ; Copyright (c) 2009, Marat Zakiyanov aka Mario79, aka Mario |
3 | ; Copyright (c) 2009, Marat Zakiyanov aka Mario79, aka Mario |
4 | ; All rights reserved. |
4 | ; All rights reserved. |
5 | ; |
5 | ; |
6 | ; Redistribution and use in source and binary forms, with or without |
6 | ; Redistribution and use in source and binary forms, with or without |
7 | ; modification, are permitted provided that the following conditions are met: |
7 | ; modification, are permitted provided that the following conditions are met: |
8 | ; * Redistributions of source code must retain the above copyright |
8 | ; * Redistributions of source code must retain the above copyright |
9 | ; notice, this list of conditions and the following disclaimer. |
9 | ; notice, this list of conditions and the following disclaimer. |
10 | ; * Redistributions in binary form must reproduce the above copyright |
10 | ; * Redistributions in binary form must reproduce the above copyright |
11 | ; notice, this list of conditions and the following disclaimer in the |
11 | ; notice, this list of conditions and the following disclaimer in the |
12 | ; documentation and/or other materials provided with the distribution. |
12 | ; documentation and/or other materials provided with the distribution. |
13 | ; * Neither the name of the |
13 | ; * Neither the name of the |
14 | ; names of its contributors may be used to endorse or promote products |
14 | ; names of its contributors may be used to endorse or promote products |
15 | ; derived from this software without specific prior written permission. |
15 | ; derived from this software without specific prior written permission. |
16 | ; |
16 | ; |
17 | ; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY |
17 | ; THIS SOFTWARE IS PROVIDED BY Marat Zakiyanov ''AS IS'' AND ANY |
18 | ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | ; EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
19 | ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | ; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
20 | ; DISCLAIMED. IN NO EVENT SHALL |
20 | ; DISCLAIMED. IN NO EVENT SHALL |
21 | ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | ; DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
22 | ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | ; (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
23 | ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | ; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
24 | ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | ; ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | ; (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
26 | ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | ; SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | ;***************************************************************************** |
27 | ;***************************************************************************** |
28 | macro scroll_bar_exit |
28 | macro scroll_bar_exit |
29 | { |
29 | { |
30 | popa |
30 | popa |
31 | ret 4 |
31 | ret 4 |
32 | } |
32 | } |
33 | ;***************************************************************************** |
33 | ;***************************************************************************** |
34 | macro draw_up_arrow_vertical |
34 | macro draw_up_arrow_vertical |
35 | { |
35 | { |
36 | push ebx |
36 | push ebx |
37 | 37 | ||
38 | xor eax,eax |
38 | xor eax,eax |
39 | mov ax,sb_size_x |
39 | mov ax,sb_size_x |
40 | shr eax,1 |
40 | shr eax,1 |
41 | shl eax,16 |
41 | shl eax,16 |
42 | add ebx,eax |
42 | add ebx,eax |
43 | 43 | ||
44 | xor eax,eax |
44 | xor eax,eax |
45 | mov ax,sb_btn_high |
45 | mov ax,sb_btn_high |
46 | shr eax,1 |
46 | shr eax,1 |
47 | shl eax,16 |
47 | shl eax,16 |
48 | add ecx,eax |
48 | add ecx,eax |
49 | 49 | ||
50 | mov edx,sb_line_col |
50 | mov edx,sb_line_col |
51 | sub ebx,4 shl 16 |
51 | sub ebx,4 shl 16 |
52 | mov bx,7 |
52 | mov bx,7 |
53 | mov cx,1 |
53 | mov cx,1 |
54 | mov eax,13 |
54 | mov eax,13 |
55 | int 0x40 |
55 | int 0x40 |
56 | sub ecx,1 shl 16 |
56 | sub ecx,1 shl 16 |
57 | add ebx,1 shl 16 |
57 | add ebx,1 shl 16 |
58 | mov bx,5 |
58 | mov bx,5 |
59 | int 0x40 |
59 | int 0x40 |
60 | sub ecx,1 shl 16 |
60 | sub ecx,1 shl 16 |
61 | add ebx,1 shl 16 |
61 | add ebx,1 shl 16 |
62 | mov bx,3 |
62 | mov bx,3 |
63 | int 0x40 |
63 | int 0x40 |
64 | sub ecx,1 shl 16 |
64 | sub ecx,1 shl 16 |
65 | add ebx,1 shl 16 |
65 | add ebx,1 shl 16 |
66 | mov bx,1 |
66 | mov bx,1 |
67 | int 0x40 |
67 | int 0x40 |
68 | pop ebx |
68 | pop ebx |
69 | } |
69 | } |
70 | ;***************************************************************************** |
70 | ;***************************************************************************** |
71 | macro draw_down_arrow_vertical |
71 | macro draw_down_arrow_vertical |
72 | { |
72 | { |
73 | push ebx |
73 | push ebx |
74 | 74 | ||
75 | xor eax,eax |
75 | xor eax,eax |
76 | mov ax,sb_size_x |
76 | mov ax,sb_size_x |
77 | shr eax,1 |
77 | shr eax,1 |
78 | shl eax,16 |
78 | shl eax,16 |
79 | add ebx,eax |
79 | add ebx,eax |
80 | 80 | ||
81 | xor eax,eax |
81 | xor eax,eax |
82 | mov ax,sb_btn_high |
82 | mov ax,sb_btn_high |
83 | shr eax,1 |
83 | shr eax,1 |
84 | shl eax,16 |
84 | shl eax,16 |
85 | add ecx,eax |
85 | add ecx,eax |
86 | 86 | ||
87 | mov edx,sb_line_col |
87 | mov edx,sb_line_col |
88 | sub ebx,4 shl 16 |
88 | sub ebx,4 shl 16 |
89 | mov bx,7 |
89 | mov bx,7 |
90 | sub ecx,2 shl 16 |
90 | sub ecx,2 shl 16 |
91 | mov cx,1 |
91 | mov cx,1 |
92 | mov eax,13 |
92 | mov eax,13 |
93 | int 0x40 |
93 | int 0x40 |
94 | add ecx,1 shl 16 |
94 | add ecx,1 shl 16 |
95 | add ebx,1 shl 16 |
95 | add ebx,1 shl 16 |
96 | mov bx,5 |
96 | mov bx,5 |
97 | int 0x40 |
97 | int 0x40 |
98 | add ecx,1 shl 16 |
98 | add ecx,1 shl 16 |
99 | add ebx,1 shl 16 |
99 | add ebx,1 shl 16 |
100 | mov bx,3 |
100 | mov bx,3 |
101 | int 0x40 |
101 | int 0x40 |
102 | add ecx,1 shl 16 |
102 | add ecx,1 shl 16 |
103 | add ebx,1 shl 16 |
103 | add ebx,1 shl 16 |
104 | mov bx,1 |
104 | mov bx,1 |
105 | int 0x40 |
105 | int 0x40 |
106 | pop ebx |
106 | pop ebx |
107 | } |
107 | } |
108 | ;***************************************************************************** |
108 | ;***************************************************************************** |
109 | macro draw_runner_center_vertical |
109 | macro draw_runner_center_vertical |
110 | { |
110 | { |
111 | push ebx |
111 | push ebx |
112 | push ecx |
112 | push ecx |
113 | 113 | ||
114 | xor eax,eax |
114 | xor eax,eax |
115 | mov ax,sb_size_x |
115 | mov ax,sb_size_x |
116 | shr eax,1 |
116 | shr eax,1 |
117 | shl eax,16 |
117 | shl eax,16 |
118 | add ebx,eax |
118 | add ebx,eax |
119 | 119 | ||
120 | mov edx,sb_run_size |
120 | mov edx,sb_run_size |
121 | shr edx,1 |
121 | shr edx,1 |
122 | shl edx,16 |
122 | shl edx,16 |
123 | add ecx,edx |
123 | add ecx,edx |
124 | mov edx,sb_line_col |
124 | mov edx,sb_line_col |
125 | sub ecx,8 shl 16 |
125 | sub ecx,8 shl 16 |
126 | sub ebx,5 shl 16 |
126 | sub ebx,5 shl 16 |
127 | mov bx,10 |
127 | mov bx,10 |
128 | add ecx,4 shl 16 |
128 | add ecx,4 shl 16 |
129 | mov cx,1 |
129 | mov cx,1 |
130 | mov eax,13 |
130 | mov eax,13 |
131 | int 0x40 |
131 | int 0x40 |
132 | add ecx,3 shl 16 |
132 | add ecx,3 shl 16 |
133 | sub ebx,1 shl 16 |
133 | sub ebx,1 shl 16 |
134 | mov bx,12 |
134 | mov bx,12 |
135 | int 0x40 |
135 | int 0x40 |
136 | add ebx,1 shl 16 |
136 | add ebx,1 shl 16 |
137 | mov bx,10 |
137 | mov bx,10 |
138 | add ecx,3 shl 16 |
138 | add ecx,3 shl 16 |
139 | int 0x40 |
139 | int 0x40 |
140 | pop ecx |
140 | pop ecx |
141 | pop ebx |
141 | pop ebx |
142 | } |
142 | } |
143 | ;***************************************************************************** |
143 | ;***************************************************************************** |
144 | macro draw_up_arrow_horizontal |
144 | macro draw_up_arrow_horizontal |
145 | { |
145 | { |
146 | push ecx |
146 | push ecx |
147 | 147 | ||
148 | xor eax,eax |
148 | xor eax,eax |
149 | mov ax,sb_btn_high |
149 | mov ax,sb_btn_high |
150 | shr eax,1 |
150 | shr eax,1 |
151 | shl eax,16 |
151 | shl eax,16 |
152 | add ebx,eax |
152 | add ebx,eax |
153 | 153 | ||
154 | xor eax,eax |
154 | xor eax,eax |
155 | mov ax,sb_size_y |
155 | mov ax,sb_size_y |
156 | shr eax,1 |
156 | shr eax,1 |
157 | shl eax,16 |
157 | shl eax,16 |
158 | add ecx,eax |
158 | add ecx,eax |
159 | 159 | ||
160 | mov edx,sb_line_col |
160 | mov edx,sb_line_col |
161 | sub ecx,4 shl 16 |
161 | sub ecx,4 shl 16 |
162 | mov cx,7 |
162 | mov cx,7 |
163 | mov bx,1 |
163 | mov bx,1 |
164 | 164 | ||
165 | mov eax,13 |
165 | mov eax,13 |
166 | int 0x40 |
166 | int 0x40 |
167 | sub ebx,1 shl 16 |
167 | sub ebx,1 shl 16 |
168 | add ecx,1 shl 16 |
168 | add ecx,1 shl 16 |
169 | mov cx,5 |
169 | mov cx,5 |
170 | int 0x40 |
170 | int 0x40 |
171 | sub ebx,1 shl 16 |
171 | sub ebx,1 shl 16 |
172 | add ecx,1 shl 16 |
172 | add ecx,1 shl 16 |
173 | mov cx,3 |
173 | mov cx,3 |
174 | int 0x40 |
174 | int 0x40 |
175 | sub ebx,1 shl 16 |
175 | sub ebx,1 shl 16 |
176 | add ecx,1 shl 16 |
176 | add ecx,1 shl 16 |
177 | mov cx,1 |
177 | mov cx,1 |
178 | int 0x40 |
178 | int 0x40 |
179 | pop ecx |
179 | pop ecx |
180 | } |
180 | } |
181 | ;***************************************************************************** |
181 | ;***************************************************************************** |
182 | macro draw_down_arrow_horizontal |
182 | macro draw_down_arrow_horizontal |
183 | { |
183 | { |
184 | push ecx |
184 | push ecx |
185 | 185 | ||
186 | xor eax,eax |
186 | xor eax,eax |
187 | mov ax,sb_btn_high |
187 | mov ax,sb_btn_high |
188 | shr eax,1 |
188 | shr eax,1 |
189 | shl eax,16 |
189 | shl eax,16 |
190 | add ebx,eax |
190 | add ebx,eax |
191 | 191 | ||
192 | xor eax,eax |
192 | xor eax,eax |
193 | mov ax,sb_size_y |
193 | mov ax,sb_size_y |
194 | shr eax,1 |
194 | shr eax,1 |
195 | shl eax,16 |
195 | shl eax,16 |
196 | add ecx,eax |
196 | add ecx,eax |
197 | 197 | ||
198 | mov edx,sb_line_col |
198 | mov edx,sb_line_col |
199 | sub ecx,4 shl 16 |
199 | sub ecx,4 shl 16 |
200 | mov cx,7 |
200 | mov cx,7 |
201 | sub ebx,2 shl 16 |
201 | sub ebx,2 shl 16 |
202 | mov bx,1 |
202 | mov bx,1 |
203 | mov eax,13 |
203 | mov eax,13 |
204 | int 0x40 |
204 | int 0x40 |
205 | add ebx,1 shl 16 |
205 | add ebx,1 shl 16 |
206 | add ecx,1 shl 16 |
206 | add ecx,1 shl 16 |
207 | mov cx,5 |
207 | mov cx,5 |
208 | int 0x40 |
208 | int 0x40 |
209 | add ebx,1 shl 16 |
209 | add ebx,1 shl 16 |
210 | add ecx,1 shl 16 |
210 | add ecx,1 shl 16 |
211 | mov cx,3 |
211 | mov cx,3 |
212 | int 0x40 |
212 | int 0x40 |
213 | add ecx,1 shl 16 |
213 | add ecx,1 shl 16 |
214 | add ebx,1 shl 16 |
214 | add ebx,1 shl 16 |
215 | mov cx,1 |
215 | mov cx,1 |
216 | int 0x40 |
216 | int 0x40 |
217 | pop ecx |
217 | pop ecx |
218 | } |
218 | } |
219 | ;***************************************************************************** |
219 | ;***************************************************************************** |
220 | macro draw_runner_center_horizontal |
220 | macro draw_runner_center_horizontal |
221 | { |
221 | { |
222 | push ebx |
222 | push ebx |
223 | push ecx |
223 | push ecx |
224 | 224 | ||
225 | xor eax,eax |
225 | xor eax,eax |
226 | mov ax,sb_size_y |
226 | mov ax,sb_size_y |
227 | shr eax,1 |
227 | shr eax,1 |
228 | shl eax,16 |
228 | shl eax,16 |
229 | add ecx,eax |
229 | add ecx,eax |
230 | 230 | ||
231 | mov edx,sb_run_size |
231 | mov edx,sb_run_size |
232 | shr edx,1 |
232 | shr edx,1 |
233 | shl edx,16 |
233 | shl edx,16 |
234 | add ebx,edx |
234 | add ebx,edx |
235 | mov edx,sb_line_col |
235 | mov edx,sb_line_col |
236 | sub ebx,8 shl 16 |
236 | sub ebx,8 shl 16 |
237 | sub ecx,5 shl 16 |
237 | sub ecx,5 shl 16 |
238 | mov cx,10 |
238 | mov cx,10 |
239 | add ebx,4 shl 16 |
239 | add ebx,4 shl 16 |
240 | mov bx,1 |
240 | mov bx,1 |
241 | mov eax,13 |
241 | mov eax,13 |
242 | int 0x40 |
242 | int 0x40 |
243 | add ebx,3 shl 16 |
243 | add ebx,3 shl 16 |
244 | sub ecx,1 shl 16 |
244 | sub ecx,1 shl 16 |
245 | mov cx,12 |
245 | mov cx,12 |
246 | int 0x40 |
246 | int 0x40 |
247 | add ecx,1 shl 16 |
247 | add ecx,1 shl 16 |
248 | mov cx,10 |
248 | mov cx,10 |
249 | add ebx,3 shl 16 |
249 | add ebx,3 shl 16 |
250 | int 0x40 |
250 | int 0x40 |
251 | pop ecx |
251 | pop ecx |
252 | pop ebx |
252 | pop ebx |
253 | } |
253 | } |
254 | ;***************************************************************************** |
254 | ;***************************************************************************** |
255 | macro use_scroll_bar |
255 | macro use_scroll_bar |
256 | { |
256 | { |
257 | scroll_bar: |
257 | scroll_bar: |
258 | sb_size_x equ [edi] |
258 | sb_size_x equ [edi] |
259 | sb_start_x equ [edi+2] |
259 | sb_start_x equ [edi+2] |
260 | sb_size_y equ [edi+4] |
260 | sb_size_y equ [edi+4] |
261 | sb_start_y equ [edi+6] |
261 | sb_start_y equ [edi+6] |
262 | sb_btn_high equ [edi+8] |
262 | sb_btn_high equ [edi+8] |
263 | sb_type equ [edi+12] |
263 | sb_type equ [edi+12] |
264 | sb_max_area equ [edi+16] |
264 | sb_max_area equ [edi+16] |
265 | sb_cur_area equ [edi+20] |
265 | sb_cur_area equ [edi+20] |
266 | sb_position equ [edi+24] |
266 | sb_position equ [edi+24] |
267 | sb_bckg_col equ [edi+28] |
267 | sb_bckg_col equ [edi+28] |
268 | sb_frnt_col equ [edi+32] |
268 | sb_frnt_col equ [edi+32] |
269 | sb_line_col equ [edi+36] |
269 | sb_line_col equ [edi+36] |
270 | sb_redraw equ [edi+40] |
270 | sb_redraw equ [edi+40] |
271 | sb_delta equ [edi+44] |
271 | sb_delta equ [edi+44] |
272 | sb_delta2 equ [edi+46] |
272 | sb_delta2 equ [edi+46] |
273 | sb_r_size_x equ [edi+48] |
273 | sb_r_size_x equ [edi+48] |
274 | sb_r_start_x equ [edi+50] |
274 | sb_r_start_x equ [edi+50] |
275 | sb_r_size_y equ [edi+52] |
275 | sb_r_size_y equ [edi+52] |
276 | sb_r_start_y equ [edi+54] |
276 | sb_r_start_y equ [edi+54] |
277 | sb_m_pos equ [edi+56] |
277 | sb_m_pos equ [edi+56] |
278 | sb_m_pos_2 equ [edi+60] |
278 | sb_m_pos_2 equ [edi+60] |
279 | sb_m_keys equ [edi+64] |
279 | sb_m_keys equ [edi+64] |
280 | sb_run_size equ [edi+68] |
280 | sb_run_size equ [edi+68] |
281 | sb_position2 equ [edi+72] |
281 | sb_position2 equ [edi+72] |
282 | sb_work_size equ [edi+76] |
282 | sb_work_size equ [edi+76] |
283 | sb_all_redraw equ [edi+80] |
283 | sb_all_redraw equ [edi+80] |
284 | sb_ar_offset equ [edi+84] |
284 | sb_ar_offset equ [edi+84] |
285 | } |
285 | } |
286 | ;***************************************************************************** |
286 | ;***************************************************************************** |
287 | ;***************************************************************************** |
287 | ;***************************************************************************** |
288 | ; draw event |
288 | ; draw event |
289 | ;***************************************************************************** |
289 | ;***************************************************************************** |
290 | ;***************************************************************************** |
290 | ;***************************************************************************** |
291 | macro use_scroll_bar_vertical |
291 | macro use_scroll_bar_vertical |
292 | { |
292 | { |
293 | scroll_bar_vertical: |
293 | scroll_bar_vertical: |
294 | .draw: |
294 | .draw: |
295 | pusha |
295 | pusha |
296 | mov edi,dword [esp+36] |
296 | mov edi,dword [esp+36] |
297 | mov sb_delta,word 0 |
297 | mov sb_delta,word 0 |
298 | call .draw_1 |
298 | call .draw_1 |
299 | mov sb_all_redraw,dword 0 |
299 | mov sb_all_redraw,dword 0 |
300 | scroll_bar_exit |
300 | scroll_bar_exit |
301 | .draw_1: |
301 | .draw_1: |
302 | pusha |
302 | pusha |
303 | ;********************************* |
303 | ;********************************* |
304 | xor eax,eax |
304 | xor eax,eax |
305 | mov ax,sb_size_y |
305 | mov ax,sb_size_y |
306 | mov edx,sb_btn_high |
306 | mov edx,sb_btn_high |
307 | shl edx,1 |
307 | shl edx,1 |
308 | sub eax,edx |
308 | sub eax,edx |
309 | mov sb_work_size,eax |
309 | mov sb_work_size,eax |
310 | ;********************************* |
310 | ;********************************* |
311 | mov eax,sb_work_size |
311 | mov eax,sb_work_size |
312 | mov ebx,sb_max_area |
312 | mov ebx,sb_max_area |
313 | cmp ebx,sb_cur_area |
313 | cmp ebx,sb_cur_area |
314 | ja @f |
314 | ja @f |
315 | 315 | ||
316 | jmp .no_size |
316 | jmp .no_size |
317 | 317 | ||
318 | @@: |
318 | @@: |
319 | imul eax,sb_cur_area |
319 | imul eax,sb_cur_area |
320 | xor edx,edx |
320 | xor edx,edx |
321 | div ebx |
321 | div ebx |
322 | cmp eax,10 |
322 | cmp eax,10 |
323 | jae @f |
323 | jae @f |
324 | mov eax,10 |
324 | mov eax,10 |
325 | @@: |
325 | @@: |
326 | .no_size: |
326 | .no_size: |
327 | mov sb_run_size,eax |
327 | mov sb_run_size,eax |
328 | ;********************************* |
328 | ;********************************* |
329 | cmp sb_delta,word 1 |
329 | cmp word sb_delta,1 |
330 | je .@@_3 |
330 | je .@@_3 |
331 | mov eax,sb_work_size |
331 | mov eax,sb_work_size |
332 | sub eax,sb_run_size |
332 | sub eax,sb_run_size |
333 | mov ebx,sb_max_area |
333 | mov ebx,sb_max_area |
334 | cmp ebx,sb_cur_area |
334 | cmp ebx,sb_cur_area |
335 | ja @f |
335 | ja @f |
336 | xor eax,eax |
336 | xor eax,eax |
337 | jmp .@@_1 |
337 | jmp .@@_1 |
338 | @@: |
338 | @@: |
339 | sub ebx,sb_cur_area |
339 | sub ebx,sb_cur_area |
340 | imul eax,sb_position |
340 | imul eax,sb_position |
341 | xor edx,edx |
341 | xor edx,edx |
342 | div ebx |
342 | div ebx |
343 | .@@_1: |
343 | .@@_1: |
344 | mov sb_position2,eax |
344 | mov sb_position2,eax |
345 | xor edx,edx |
345 | xor edx,edx |
346 | mov dx,sb_size_y |
346 | mov dx,sb_size_y |
347 | sub edx,sb_btn_high |
347 | sub edx,sb_btn_high |
348 | sub edx,sb_btn_high |
348 | sub edx,sb_btn_high |
349 | sub edx,sb_run_size |
349 | sub edx,sb_run_size |
350 | cmp sb_position2,edx |
350 | cmp sb_position2,edx |
351 | jbe .@@_3 |
351 | jbe .@@_3 |
352 | mov sb_position2,edx |
352 | mov sb_position2,edx |
353 | .@@_3: |
353 | .@@_3: |
354 | ;********************************* |
354 | ;********************************* |
355 | mov ebx,sb_start_x |
355 | mov ebx,sb_start_x |
356 | shl ebx,16 |
356 | shl ebx,16 |
357 | inc ebx |
357 | inc ebx |
358 | mov ecx,sb_size_y |
358 | mov ecx,sb_size_y |
359 | mov edx,sb_line_col |
359 | mov edx,sb_line_col |
360 | mov eax,13 |
360 | mov eax,13 |
361 | cmp sb_all_redraw,dword 0 |
361 | cmp dword sb_all_redraw,0 |
362 | je @f |
362 | je @f |
363 | int 0x40 ; left extreme line |
363 | int 0x40 ; left extreme line |
364 | @@: |
364 | @@: |
365 | push ebx |
365 | push ebx |
366 | ror ebx,16 |
366 | ror ebx,16 |
367 | add bx,sb_size_x |
367 | add bx,sb_size_x |
368 | rol ebx,16 |
368 | rol ebx,16 |
369 | cmp sb_all_redraw,dword 0 |
369 | cmp dword sb_all_redraw,0 |
370 | je @f |
370 | je @f |
371 | int 0x40 ; right extreme line |
371 | int 0x40 ; right extreme line |
372 | @@: |
372 | @@: |
373 | pop ebx |
373 | pop ebx |
374 | 374 | ||
375 | push ecx |
375 | push ecx |
376 | 376 | ||
377 | add ebx,1 shl 16 |
377 | add ebx,1 shl 16 |
378 | mov bx,sb_size_x |
378 | mov bx,sb_size_x |
379 | dec ebx |
379 | dec ebx |
380 | mov cx,1 |
380 | mov cx,1 |
381 | cmp sb_all_redraw,dword 0 |
381 | cmp dword sb_all_redraw,0 |
382 | je @f |
382 | je @f |
383 | int 0x40 ; top button - extreme line |
383 | int 0x40 ; top button - extreme line |
384 | @@: |
384 | @@: |
385 | push ecx |
385 | push ecx |
386 | add ecx,1 shl 16 |
386 | add ecx,1 shl 16 |
387 | add ecx,sb_btn_high |
387 | add ecx,sb_btn_high |
388 | sub ecx,2 |
388 | sub ecx,2 |
389 | mov edx,sb_frnt_col |
389 | mov edx,sb_frnt_col |
390 | cmp sb_all_redraw,dword 0 |
390 | cmp dword sb_all_redraw,0 |
391 | je @f |
391 | je @f |
392 | int 0x40 ; top button filling |
392 | int 0x40 ; top button filling |
393 | ;********************************* |
393 | ;********************************* |
394 | draw_up_arrow_vertical |
394 | draw_up_arrow_vertical |
395 | ;********************************* |
395 | ;********************************* |
396 | @@: |
396 | @@: |
397 | pop ecx |
397 | pop ecx |
398 | 398 | ||
399 | ror ecx,16 |
399 | ror ecx,16 |
400 | add ecx,sb_btn_high ;14 shl 16 |
400 | add ecx,sb_btn_high ;14 shl 16 |
401 | rol ecx,16 |
401 | rol ecx,16 |
402 | mov edx,sb_line_col |
402 | mov edx,sb_line_col |
403 | cmp sb_all_redraw,dword 0 |
403 | cmp dword sb_all_redraw,0 |
404 | je @f |
404 | je @f |
405 | int 0x40 ; top button - bottom line |
405 | int 0x40 ; top button - bottom line |
406 | @@: |
406 | @@: |
407 | pop ecx |
407 | pop ecx |
408 | ;********************************* |
408 | ;********************************* |
409 | ror ecx,16 |
409 | ror ecx,16 |
410 | add ecx,sb_btn_high ;15 shl 16 |
410 | add ecx,sb_btn_high ;15 shl 16 |
411 | inc ecx |
411 | inc ecx |
412 | rol ecx,16 |
412 | rol ecx,16 |
413 | sub ecx,sb_btn_high ;30 |
413 | sub ecx,sb_btn_high ;30 |
414 | sub ecx,sb_btn_high |
414 | sub ecx,sb_btn_high |
415 | push ecx |
415 | push ecx |
416 | mov cx,0 |
416 | mov cx,0 |
417 | add ecx,sb_position2 |
417 | add ecx,sb_position2 |
418 | dec cx |
418 | dec cx |
419 | mov eax,13 |
419 | mov eax,13 |
420 | test cx,0x8000 |
420 | test cx,0x8000 |
421 | jnz @f |
421 | jnz @f |
422 | mov edx,sb_bckg_col |
422 | mov edx,sb_bckg_col |
423 | int 0x40 ; top interval |
423 | int 0x40 ; top interval |
424 | @@: |
424 | @@: |
425 | ;********************************* |
425 | ;********************************* |
426 | shr ecx,16 |
426 | shr ecx,16 |
427 | add ecx,sb_position2 |
427 | add ecx,sb_position2 |
428 | dec ecx |
428 | dec ecx |
429 | shl ecx,16 |
429 | shl ecx,16 |
430 | inc ecx |
430 | inc ecx |
431 | mov edx,sb_line_col |
431 | mov edx,sb_line_col |
432 | int 0x40 ; runner - top extreme line |
432 | int 0x40 ; runner - top extreme line |
433 | 433 | ||
434 | add ecx,1 shl 16 |
434 | add ecx,1 shl 16 |
435 | mov cx,0 |
435 | mov cx,0 |
436 | add ecx,sb_run_size |
436 | add ecx,sb_run_size |
437 | mov sb_r_size_x,ebx |
437 | mov sb_r_size_x,ebx |
438 | mov sb_r_size_y,ecx |
438 | mov sb_r_size_y,ecx |
439 | sub ecx,2 |
439 | sub ecx,2 |
440 | mov edx,sb_frnt_col |
440 | mov edx,sb_frnt_col |
441 | int 0x40 ; runner filling |
441 | int 0x40 ; runner filling |
442 | ;********************************* |
442 | ;********************************* |
443 | draw_runner_center_vertical |
443 | draw_runner_center_vertical |
444 | ;********************************* |
444 | ;********************************* |
445 | shr ecx,16 |
445 | shr ecx,16 |
446 | add ecx,sb_run_size |
446 | add ecx,sb_run_size |
447 | sub ecx,2 |
447 | sub ecx,2 |
448 | shl ecx,16 |
448 | shl ecx,16 |
449 | inc ecx |
449 | inc ecx |
450 | mov edx,sb_line_col |
450 | mov edx,sb_line_col |
451 | int 0x40 ; runner - bottom extreme line |
451 | int 0x40 ; runner - bottom extreme line |
452 | 452 | ||
453 | add ecx,1 shl 16 |
453 | add ecx,1 shl 16 |
454 | mov cx,sb_start_y |
454 | mov cx,sb_start_y |
455 | add cx,sb_size_y |
455 | add cx,sb_size_y |
456 | sub ecx,sb_btn_high |
456 | sub ecx,sb_btn_high |
457 | dec ecx |
457 | dec ecx |
458 | mov eax,ecx |
458 | mov eax,ecx |
459 | shr eax,16 |
459 | shr eax,16 |
460 | sub cx,ax |
460 | sub cx,ax |
461 | test cx,0x8000 |
461 | test cx,0x8000 |
462 | jnz @f |
462 | jnz @f |
463 | mov edx,sb_bckg_col |
463 | mov edx,sb_bckg_col |
464 | mov eax,13 |
464 | mov eax,13 |
465 | int 0x40 ; bottom interval |
465 | int 0x40 ; bottom interval |
466 | @@: |
466 | @@: |
467 | pop ecx |
467 | pop ecx |
468 | ;********************************* |
468 | ;********************************* |
469 | mov ax,cx |
469 | mov ax,cx |
470 | shr ecx,16 |
470 | shr ecx,16 |
471 | add cx,ax |
471 | add cx,ax |
472 | sub ecx,2 |
472 | sub ecx,2 |
473 | shl ecx,16 |
473 | shl ecx,16 |
474 | inc ecx |
474 | inc ecx |
475 | mov edx,sb_line_col |
475 | mov edx,sb_line_col |
476 | mov eax,13 |
476 | mov eax,13 |
477 | cmp sb_all_redraw,dword 0 |
477 | cmp dword sb_all_redraw,0 |
478 | je @f |
478 | je @f |
479 | int 0x40 ; bottom button - top line |
479 | int 0x40 ; bottom button - top line |
480 | @@: |
480 | @@: |
481 | push ecx |
481 | push ecx |
482 | add ecx,1 shl 16 |
482 | add ecx,1 shl 16 |
483 | add cx,sb_btn_high |
483 | add cx,sb_btn_high |
484 | sub ecx,2 |
484 | sub ecx,2 |
485 | mov edx,sb_frnt_col |
485 | mov edx,sb_frnt_col |
486 | cmp sb_all_redraw,dword 0 |
486 | cmp dword sb_all_redraw,0 |
487 | je @f |
487 | je @f |
488 | int 0x40 ; bottom button filling |
488 | int 0x40 ; bottom button filling |
489 | ;********************************* |
489 | ;********************************* |
490 | draw_down_arrow_vertical |
490 | draw_down_arrow_vertical |
491 | ;********************************* |
491 | ;********************************* |
492 | @@: |
492 | @@: |
493 | pop ecx |
493 | pop ecx |
494 | 494 | ||
495 | ror ecx,16 |
495 | ror ecx,16 |
496 | add ecx,sb_btn_high |
496 | add ecx,sb_btn_high |
497 | rol ecx,16 |
497 | rol ecx,16 |
498 | 498 | ||
499 | mov edx,sb_line_col |
499 | mov edx,sb_line_col |
500 | mov cx,1 |
500 | mov cx,1 |
501 | cmp sb_all_redraw,dword 0 |
501 | cmp dword sb_all_redraw,0 |
502 | je @f |
502 | je @f |
503 | int 0x40 ; bottom button - extreme line |
503 | int 0x40 ; bottom button - extreme line |
504 | @@: |
504 | @@: |
505 | popa |
505 | popa |
506 | ret |
506 | ret |
507 | ;***************************************************************************** |
507 | ;***************************************************************************** |
508 | ;***************************************************************************** |
508 | ;***************************************************************************** |
509 | ; mouse event |
509 | ; mouse event |
510 | ;***************************************************************************** |
510 | ;***************************************************************************** |
511 | ;***************************************************************************** |
511 | ;***************************************************************************** |
512 | .mouse: |
512 | .mouse: |
513 | pusha |
513 | pusha |
514 | mov edi,dword [esp+36] |
514 | mov edi,dword [esp+36] |
515 | mcall 37,1 |
515 | mcall 37,1 |
516 | mov sb_m_pos,eax |
516 | mov sb_m_pos,eax |
517 | cmp sb_m_pos_2,dword 0 |
517 | cmp dword sb_m_pos_2,0 |
518 | jne @f |
518 | jne @f |
519 | 519 | ||
520 | mov sb_m_pos_2,eax |
520 | mov sb_m_pos_2,eax |
521 | @@: |
521 | @@: |
522 | mcall 37,2 |
522 | mcall 37,2 |
523 | mov sb_m_keys,eax |
523 | mov sb_m_keys,eax |
524 | 524 | ||
525 | cmp sb_m_keys,eax |
525 | cmp sb_m_keys,eax |
526 | je @f |
526 | je @f |
527 | 527 | ||
528 | mov sb_m_keys,eax |
528 | mov sb_m_keys,eax |
529 | 529 | ||
530 | mov sb_delta,dword 0 |
530 | mov sb_delta,dword 0 |
531 | 531 | ||
532 | mov eax,sb_m_pos |
532 | mov eax,sb_m_pos |
533 | mov sb_m_pos_2,eax |
533 | mov sb_m_pos_2,eax |
534 | jmp .continue_2 |
534 | jmp .continue_2 |
535 | 535 | ||
536 | @@: |
536 | @@: |
537 | cmp sb_m_keys,dword 0 |
537 | cmp dword sb_m_keys,0 |
538 | jne @f |
538 | jne @f |
539 | mov eax,sb_m_pos |
539 | mov eax,sb_m_pos |
540 | mov sb_m_pos_2,eax |
540 | mov sb_m_pos_2,eax |
541 | jmp .correct_1 ;.exit_sb |
541 | jmp .correct_1 ;.exit_sb |
542 | @@: |
542 | @@: |
543 | mov sb_delta,word 1 |
543 | mov sb_delta,word 1 |
544 | 544 | ||
545 | .continue_2: |
545 | .continue_2: |
546 | mov eax,sb_m_pos |
546 | mov eax,sb_m_pos |
547 | test eax,0x80000000 |
547 | test eax,0x80000000 |
548 | jnz .exit_sb |
548 | jnz .exit_sb |
549 | 549 | ||
550 | test eax,0x8000 |
550 | test eax,0x8000 |
551 | jnz .exit_sb |
551 | jnz .exit_sb |
552 | 552 | ||
553 | mov ebx,eax |
553 | mov ebx,eax |
554 | shr ebx,16 ; x position |
554 | shr ebx,16 ; x position |
555 | shl eax,16 |
555 | shl eax,16 |
556 | shr eax,16 ; y position |
556 | shr eax,16 ; y position |
557 | 557 | ||
558 | mov cx,sb_start_y |
558 | mov cx,sb_start_y |
559 | cmp ax,cx |
559 | cmp ax,cx |
560 | jb .exit_sb |
560 | jb .exit_sb |
561 | 561 | ||
562 | cmp sb_delta2,word 0 |
562 | cmp word sb_delta2,0 |
563 | je @f |
563 | je @f |
564 | push ecx |
564 | push ecx |
565 | add cx,sb_btn_high |
565 | add cx,sb_btn_high |
566 | cmp ax,cx |
566 | cmp ax,cx |
567 | pop ecx |
567 | pop ecx |
568 | jb .exit_sb |
568 | jb .exit_sb |
569 | 569 | ||
570 | @@: |
570 | @@: |
571 | add cx,sb_size_y |
571 | add cx,sb_size_y |
572 | cmp ax,cx |
572 | cmp ax,cx |
573 | ja .exit_sb |
573 | ja .exit_sb |
574 | 574 | ||
575 | cmp sb_delta2,word 0 |
575 | cmp word sb_delta2,0 |
576 | je @f |
576 | je @f |
577 | sub cx,sb_btn_high |
577 | sub cx,sb_btn_high |
578 | cmp ax,cx |
578 | cmp ax,cx |
579 | ja .exit_sb |
579 | ja .exit_sb |
580 | 580 | ||
581 | @@: |
581 | @@: |
582 | cmp sb_delta2,word 1 |
582 | cmp word sb_delta2,1 |
583 | je @f |
583 | je @f |
584 | 584 | ||
585 | cmp sb_m_keys,dword 0 |
585 | cmp dword sb_m_keys,0 |
586 | je .exit_sb |
586 | je .exit_sb |
587 | 587 | ||
588 | mov cx,sb_start_x |
588 | mov cx,sb_start_x |
589 | cmp bx,cx |
589 | cmp bx,cx |
590 | jb .exit_sb |
590 | jb .exit_sb |
591 | 591 | ||
592 | add cx,sb_size_x |
592 | add cx,sb_size_x |
593 | cmp bx,cx |
593 | cmp bx,cx |
594 | ja .exit_sb |
594 | ja .exit_sb |
595 | 595 | ||
596 | mov cx,sb_r_start_y |
596 | mov cx,sb_r_start_y |
597 | cmp ax,cx |
597 | cmp ax,cx |
598 | jb .no_runner |
598 | jb .no_runner |
599 | 599 | ||
600 | add cx,sb_r_size_y |
600 | add cx,sb_r_size_y |
601 | cmp ax,cx |
601 | cmp ax,cx |
602 | ja .no_runner |
602 | ja .no_runner |
603 | 603 | ||
604 | mov sb_delta2,word 1 |
604 | mov sb_delta2,word 1 |
605 | @@: |
605 | @@: |
606 | push eax |
606 | push eax |
607 | mov ax,sb_m_pos |
607 | mov ax,sb_m_pos |
608 | cmp ax,sb_m_pos_2 |
608 | cmp ax,sb_m_pos_2 |
609 | je .correct |
609 | je .correct |
610 | 610 | ||
611 | shl eax,16 |
611 | shl eax,16 |
612 | shr eax,16 |
612 | shr eax,16 |
613 | mov ebx,sb_m_pos_2 |
613 | mov ebx,sb_m_pos_2 |
614 | shl ebx,16 |
614 | shl ebx,16 |
615 | shr ebx,16 |
615 | shr ebx,16 |
616 | cmp eax,ebx |
616 | cmp eax,ebx |
617 | jb .sub |
617 | jb .sub |
618 | 618 | ||
619 | sub eax,ebx |
619 | sub eax,ebx |
620 | mov ebx,eax |
620 | mov ebx,eax |
621 | add sb_position2,ebx |
621 | add sb_position2,ebx |
622 | xor eax,eax |
622 | xor eax,eax |
623 | mov ax,sb_size_y |
623 | mov ax,sb_size_y |
624 | sub eax,sb_btn_high |
624 | sub eax,sb_btn_high |
625 | sub eax,sb_btn_high |
625 | sub eax,sb_btn_high |
626 | sub eax,sb_run_size |
626 | sub eax,sb_run_size |
627 | cmp sb_position2,eax |
627 | cmp sb_position2,eax |
628 | jbe @f |
628 | jbe @f |
629 | 629 | ||
630 | mov sb_position2,eax |
630 | mov sb_position2,eax |
631 | @@: |
631 | @@: |
632 | mov eax,sb_m_pos |
632 | mov eax,sb_m_pos |
633 | mov sb_m_pos_2,eax |
633 | mov sb_m_pos_2,eax |
634 | pop eax |
634 | pop eax |
635 | call .draw_1 |
635 | call .draw_1 |
636 | jmp .no_runner_1 |
636 | jmp .no_runner_1 |
637 | 637 | ||
638 | .correct: |
638 | .correct: |
639 | pop eax |
639 | pop eax |
640 | jmp .exit_sb |
640 | jmp .exit_sb |
641 | .correct_1: |
641 | .correct_1: |
642 | mov sb_delta,dword 0 |
642 | mov sb_delta,dword 0 |
643 | jmp .exit_sb |
643 | jmp .exit_sb |
644 | 644 | ||
645 | .sub: |
645 | .sub: |
646 | sub ebx,eax |
646 | sub ebx,eax |
647 | sub sb_position2,ebx |
647 | sub sb_position2,ebx |
648 | test sb_position2,dword 0x80000000 |
648 | test sb_position2,dword 0x80000000 |
649 | jz @f |
649 | jz @f |
650 | 650 | ||
651 | mov sb_position2,dword 0 |
651 | mov sb_position2,dword 0 |
652 | @@: |
652 | @@: |
653 | mov eax,sb_m_pos |
653 | mov eax,sb_m_pos |
654 | mov sb_m_pos_2,eax |
654 | mov sb_m_pos_2,eax |
655 | pop eax |
655 | pop eax |
656 | call .draw_1 |
656 | call .draw_1 |
657 | jmp .no_runner_1 |
657 | jmp .no_runner_1 |
658 | 658 | ||
659 | ;***************************************************************************** |
659 | ;***************************************************************************** |
660 | .no_runner: |
660 | .no_runner: |
661 | mov sb_delta,dword 0 |
661 | mov sb_delta,dword 0 |
662 | .no_runner_1: |
662 | .no_runner_1: |
663 | xor ecx,ecx |
663 | xor ecx,ecx |
664 | mov cx,sb_start_y |
664 | mov cx,sb_start_y |
665 | add cx,sb_btn_high ;15 |
665 | add cx,sb_btn_high ;15 |
666 | cmp sb_delta,word 1 |
666 | cmp word sb_delta,1 |
667 | je .scroll_sb |
667 | je .scroll_sb |
668 | 668 | ||
669 | cmp ax,cx |
669 | cmp ax,cx |
670 | ja .scroll_sb |
670 | ja .scroll_sb |
671 | 671 | ||
672 | cmp sb_m_keys,dword 0 |
672 | cmp dword sb_m_keys,0 |
673 | je .exit_sb |
673 | je .exit_sb |
674 | 674 | ||
675 | mov eax,sb_ar_offset |
675 | mov eax,sb_ar_offset |
676 | cmp sb_position,eax ;dword 0 |
676 | cmp sb_position,eax ;dword 0 |
677 | jbe @f |
677 | jbe @f |
678 | 678 | ||
679 | sub sb_position,eax |
679 | sub sb_position,eax |
680 | jmp .all_sb |
680 | jmp .all_sb |
681 | @@: |
681 | @@: |
682 | xor eax,eax |
682 | xor eax,eax |
683 | mov sb_position,eax ;dword 0 |
683 | mov sb_position,eax ;dword 0 |
684 | mov sb_position2,eax ;dword 0 |
684 | mov sb_position2,eax ;dword 0 |
685 | jmp .all_sb |
685 | jmp .all_sb |
686 | ;***************************************************************************** |
686 | ;***************************************************************************** |
687 | .scroll_sb: |
687 | .scroll_sb: |
688 | add cx,sb_size_y |
688 | add cx,sb_size_y |
689 | sub cx,sb_btn_high |
689 | sub cx,sb_btn_high |
690 | sub cx,sb_btn_high |
690 | sub cx,sb_btn_high |
691 | cmp sb_delta,word 1 |
691 | cmp word sb_delta,1 |
692 | je @f |
692 | je @f |
693 | 693 | ||
694 | cmp ax,cx |
694 | cmp ax,cx |
695 | ja .down_sb |
695 | ja .down_sb |
696 | 696 | ||
697 | @@: |
697 | @@: |
698 | mov ebx,sb_btn_high ;16 ;15 |
698 | mov ebx,sb_btn_high ;16 ;15 |
699 | add bx,sb_start_y |
699 | add bx,sb_start_y |
700 | sub cx,bx |
700 | sub cx,bx |
701 | sub ax,bx |
701 | sub ax,bx |
702 | 702 | ||
703 | .scroll_sb_1: |
703 | .scroll_sb_1: |
704 | mov ebx,sb_run_size |
704 | mov ebx,sb_run_size |
705 | ;***************************************************************************** |
705 | ;***************************************************************************** |
706 | cmp sb_delta,word 1 |
706 | cmp word sb_delta,1 |
707 | je .continue |
707 | je .continue |
708 | 708 | ||
709 | @@: |
709 | @@: |
710 | mov edx,eax |
710 | mov edx,eax |
711 | push ebx |
711 | push ebx |
712 | shr ebx,1 |
712 | shr ebx,1 |
713 | sub edx,ebx |
713 | sub edx,ebx |
714 | pop ebx |
714 | pop ebx |
715 | mov sb_position2,edx |
715 | mov sb_position2,edx |
716 | test sb_position2,dword 0x80000000 |
716 | test sb_position2,dword 0x80000000 |
717 | jz .test_1 |
717 | jz .test_1 |
718 | 718 | ||
719 | mov sb_position2,dword 0 |
719 | mov sb_position2,dword 0 |
720 | jmp .continue |
720 | jmp .continue |
721 | 721 | ||
722 | .test_1: |
722 | .test_1: |
723 | xor edx,edx |
723 | xor edx,edx |
724 | mov dx,sb_size_y |
724 | mov dx,sb_size_y |
725 | sub edx,sb_btn_high |
725 | sub edx,sb_btn_high |
726 | sub edx,sb_btn_high |
726 | sub edx,sb_btn_high |
727 | sub edx,sb_run_size |
727 | sub edx,sb_run_size |
728 | cmp sb_position2,edx |
728 | cmp sb_position2,edx |
729 | jbe .continue |
729 | jbe .continue |
730 | 730 | ||
731 | mov sb_position2,edx |
731 | mov sb_position2,edx |
732 | 732 | ||
733 | .continue: |
733 | .continue: |
734 | mov eax,sb_position2 |
734 | mov eax,sb_position2 |
735 | sub ecx,ebx |
735 | sub ecx,ebx |
736 | .continue_1: |
736 | .continue_1: |
737 | ;***************************************************************************** |
737 | ;***************************************************************************** |
738 | mov ebx,eax |
738 | mov ebx,eax |
739 | 739 | ||
740 | mov eax,sb_max_area |
740 | mov eax,sb_max_area |
741 | cmp eax,sb_cur_area |
741 | cmp eax,sb_cur_area |
742 | ja @f |
742 | ja @f |
743 | 743 | ||
744 | xor eax,eax |
744 | xor eax,eax |
745 | inc eax |
745 | inc eax |
746 | mov sb_position2,eax |
746 | mov sb_position2,eax |
747 | jmp .all_sb |
747 | jmp .all_sb |
748 | @@: |
748 | @@: |
749 | sub eax,sb_cur_area |
749 | sub eax,sb_cur_area |
750 | inc eax |
750 | inc eax |
751 | shl eax,10 |
751 | shl eax,10 |
752 | xor edx,edx |
752 | xor edx,edx |
753 | div ecx |
753 | div ecx |
754 | shl edx,1 |
754 | shl edx,1 |
755 | cmp edx,ecx |
755 | cmp edx,ecx |
756 | jb @f |
756 | jb @f |
757 | 757 | ||
758 | inc eax |
758 | inc eax |
759 | 759 | ||
760 | @@: |
760 | @@: |
761 | imul eax,ebx |
761 | imul eax,ebx |
762 | shr eax,10 |
762 | shr eax,10 |
763 | 763 | ||
764 | cmp sb_position,eax |
764 | cmp sb_position,eax |
765 | je .exit_sb |
765 | je .exit_sb |
766 | 766 | ||
767 | cmp eax,0 |
767 | cmp eax,0 |
768 | ja @f |
768 | ja @f |
769 | 769 | ||
770 | xor eax,eax |
770 | xor eax,eax |
771 | 771 | ||
772 | @@: |
772 | @@: |
773 | .store_position: |
773 | .store_position: |
774 | mov sb_position,eax |
774 | mov sb_position,eax |
775 | .all_sb: |
775 | .all_sb: |
776 | mov sb_redraw,dword 1 |
776 | mov sb_redraw,dword 1 |
777 | call .draw_1 |
777 | call .draw_1 |
778 | mov eax,sb_m_pos |
778 | mov eax,sb_m_pos |
779 | mov sb_m_pos_2,eax |
779 | mov sb_m_pos_2,eax |
780 | jmp .exit_sb |
780 | jmp .exit_sb |
781 | ;***************************************************************************** |
781 | ;***************************************************************************** |
782 | .down_sb: |
782 | .down_sb: |
783 | cmp sb_m_keys,dword 0 |
783 | cmp dword sb_m_keys,0 |
784 | je .exit_sb |
784 | je .exit_sb |
785 | 785 | ||
786 | mov eax,sb_max_area |
786 | mov eax,sb_max_area |
787 | mov ebx,sb_ar_offset |
787 | mov ebx,sb_ar_offset |
788 | sub eax,sb_cur_area |
788 | sub eax,sb_cur_area |
789 | push eax |
789 | push eax |
790 | sub eax,ebx |
790 | sub eax,ebx |
791 | cmp sb_position,eax |
791 | cmp sb_position,eax |
792 | pop eax |
792 | pop eax |
793 | jae @f |
793 | jae @f |
794 | 794 | ||
795 | add sb_position,ebx |
795 | add sb_position,ebx |
796 | jmp .all_sb |
796 | jmp .all_sb |
797 | @@: |
797 | @@: |
798 | mov sb_position,eax |
798 | mov sb_position,eax |
799 | xor eax,eax |
799 | xor eax,eax |
800 | mov ax,sb_size_y |
800 | mov ax,sb_size_y |
801 | sub eax,sb_btn_high |
801 | sub eax,sb_btn_high |
802 | sub eax,sb_btn_high |
802 | sub eax,sb_btn_high |
803 | sub eax,sb_run_size |
803 | sub eax,sb_run_size |
804 | mov sb_position2,eax |
804 | mov sb_position2,eax |
805 | jmp .all_sb |
805 | jmp .all_sb |
806 | .exit_sb: |
806 | .exit_sb: |
807 | scroll_bar_exit |
807 | scroll_bar_exit |
808 | } |
808 | } |
809 | 809 | ||
810 | ;***************************************************************************** |
810 | ;***************************************************************************** |
811 | ;***************************************************************************** |
811 | ;***************************************************************************** |
812 | ;***************************************************************************** |
812 | ;***************************************************************************** |
813 | ;***************************************************************************** |
813 | ;***************************************************************************** |
814 | ;***************************************************************************** |
814 | ;***************************************************************************** |
815 | macro use_scroll_bar_horizontal |
815 | macro use_scroll_bar_horizontal |
816 | { |
816 | { |
817 | scroll_bar_horizontal: |
817 | scroll_bar_horizontal: |
818 | .draw: |
818 | .draw: |
819 | pusha |
819 | pusha |
820 | mov edi,dword [esp+36] |
820 | mov edi,dword [esp+36] |
821 | mov sb_delta,word 0 |
821 | mov sb_delta,word 0 |
822 | call .draw_1 |
822 | call .draw_1 |
823 | mov sb_all_redraw,dword 0 |
823 | mov sb_all_redraw,dword 0 |
824 | scroll_bar_exit |
824 | scroll_bar_exit |
825 | .draw_1: |
825 | .draw_1: |
826 | pusha |
826 | pusha |
827 | ;********************************* |
827 | ;********************************* |
828 | xor eax,eax |
828 | xor eax,eax |
829 | mov ax,sb_size_x ;sb_size_y |
829 | mov ax,sb_size_x ;sb_size_y |
830 | mov edx,sb_btn_high |
830 | mov edx,sb_btn_high |
831 | shl edx,1 |
831 | shl edx,1 |
832 | sub eax,edx |
832 | sub eax,edx |
833 | mov sb_work_size,eax |
833 | mov sb_work_size,eax |
834 | ;********************************* |
834 | ;********************************* |
835 | mov eax,sb_work_size ;sb_max_area |
835 | mov eax,sb_work_size ;sb_max_area |
836 | mov ebx,sb_max_area |
836 | mov ebx,sb_max_area |
837 | cmp ebx,sb_cur_area |
837 | cmp ebx,sb_cur_area |
838 | ja @f |
838 | ja @f |
839 | 839 | ||
840 | jmp .no_size |
840 | jmp .no_size |
841 | 841 | ||
842 | @@: |
842 | @@: |
843 | imul eax,sb_cur_area |
843 | imul eax,sb_cur_area |
844 | xor edx,edx |
844 | xor edx,edx |
845 | div ebx |
845 | div ebx |
846 | cmp eax,10 |
846 | cmp eax,10 |
847 | jae @f |
847 | jae @f |
848 | mov eax,10 |
848 | mov eax,10 |
849 | @@: |
849 | @@: |
850 | .no_size: |
850 | .no_size: |
851 | mov sb_run_size,eax |
851 | mov sb_run_size,eax |
852 | ;********************************* |
852 | ;********************************* |
853 | cmp sb_delta,word 1 |
853 | cmp word sb_delta,1 |
854 | je .@@_3 |
854 | je .@@_3 |
855 | mov eax,sb_work_size |
855 | mov eax,sb_work_size |
856 | sub eax,sb_run_size |
856 | sub eax,sb_run_size |
857 | mov ebx,sb_max_area |
857 | mov ebx,sb_max_area |
858 | cmp ebx,sb_cur_area |
858 | cmp ebx,sb_cur_area |
859 | ja @f |
859 | ja @f |
860 | xor eax,eax |
860 | xor eax,eax |
861 | jmp .@@_1 |
861 | jmp .@@_1 |
862 | @@: |
862 | @@: |
863 | sub ebx,sb_cur_area |
863 | sub ebx,sb_cur_area |
864 | imul eax,sb_position |
864 | imul eax,sb_position |
865 | xor edx,edx |
865 | xor edx,edx |
866 | div ebx |
866 | div ebx |
867 | .@@_1: |
867 | .@@_1: |
868 | mov sb_position2,eax |
868 | mov sb_position2,eax |
869 | xor edx,edx |
869 | xor edx,edx |
870 | mov dx,sb_size_x |
870 | mov dx,sb_size_x |
871 | sub edx,sb_btn_high |
871 | sub edx,sb_btn_high |
872 | sub edx,sb_btn_high |
872 | sub edx,sb_btn_high |
873 | sub edx,sb_run_size |
873 | sub edx,sb_run_size |
874 | cmp sb_position2,edx |
874 | cmp sb_position2,edx |
875 | jbe .@@_3 |
875 | jbe .@@_3 |
876 | mov sb_position2,edx |
876 | mov sb_position2,edx |
877 | .@@_3: |
877 | .@@_3: |
878 | ;********************************* |
878 | ;********************************* |
879 | mov ebx,sb_size_x |
879 | mov ebx,sb_size_x |
880 | mov ecx,sb_start_y |
880 | mov ecx,sb_start_y |
881 | shl ecx,16 |
881 | shl ecx,16 |
882 | inc ecx |
882 | inc ecx |
883 | mov edx,sb_line_col |
883 | mov edx,sb_line_col |
884 | mov eax,13 |
884 | mov eax,13 |
885 | cmp sb_all_redraw,dword 0 |
885 | cmp dword sb_all_redraw,0 |
886 | je @f |
886 | je @f |
887 | int 0x40 ; top extreme line |
887 | int 0x40 ; top extreme line |
888 | @@: |
888 | @@: |
889 | push ecx |
889 | push ecx |
890 | ror ecx,16 |
890 | ror ecx,16 |
891 | add cx,sb_size_y |
891 | add cx,sb_size_y |
892 | rol ecx,16 |
892 | rol ecx,16 |
893 | cmp sb_all_redraw,dword 0 |
893 | cmp dword sb_all_redraw,0 |
894 | je @f |
894 | je @f |
895 | int 0x40 ; bottom extreme line |
895 | int 0x40 ; bottom extreme line |
896 | @@: |
896 | @@: |
897 | pop ecx |
897 | pop ecx |
898 | 898 | ||
899 | push ebx |
899 | push ebx |
900 | 900 | ||
901 | add ecx,1 shl 16 |
901 | add ecx,1 shl 16 |
902 | mov cx,sb_size_y |
902 | mov cx,sb_size_y |
903 | dec ecx |
903 | dec ecx |
904 | mov bx,1 |
904 | mov bx,1 |
905 | cmp sb_all_redraw,dword 0 |
905 | cmp dword sb_all_redraw,0 |
906 | je @f |
906 | je @f |
907 | int 0x40 ; left button - extreme line |
907 | int 0x40 ; left button - extreme line |
908 | @@: |
908 | @@: |
909 | push ebx |
909 | push ebx |
910 | add ebx,1 shl 16 |
910 | add ebx,1 shl 16 |
911 | add ebx,sb_btn_high |
911 | add ebx,sb_btn_high |
912 | sub ebx,2 |
912 | sub ebx,2 |
913 | mov edx,sb_frnt_col |
913 | mov edx,sb_frnt_col |
914 | cmp sb_all_redraw,dword 0 |
914 | cmp dword sb_all_redraw,0 |
915 | je @f |
915 | je @f |
916 | int 0x40 ; left button filling |
916 | int 0x40 ; left button filling |
917 | ;********************************* |
917 | ;********************************* |
918 | draw_up_arrow_horizontal |
918 | draw_up_arrow_horizontal |
919 | ;********************************* |
919 | ;********************************* |
920 | @@: |
920 | @@: |
921 | pop ebx |
921 | pop ebx |
922 | 922 | ||
923 | ror ebx,16 |
923 | ror ebx,16 |
924 | add ebx,sb_btn_high ;14 shl 16 |
924 | add ebx,sb_btn_high ;14 shl 16 |
925 | rol ebx,16 |
925 | rol ebx,16 |
926 | mov edx,sb_line_col |
926 | mov edx,sb_line_col |
927 | cmp sb_all_redraw,dword 0 |
927 | cmp dword sb_all_redraw,0 |
928 | je @f |
928 | je @f |
929 | int 0x40 ; left button - right line |
929 | int 0x40 ; left button - right line |
930 | @@: |
930 | @@: |
931 | pop ebx |
931 | pop ebx |
932 | ;********************************* |
932 | ;********************************* |
933 | ror ebx,16 |
933 | ror ebx,16 |
934 | add ebx,sb_btn_high ;15 shl 16 |
934 | add ebx,sb_btn_high ;15 shl 16 |
935 | inc ebx |
935 | inc ebx |
936 | rol ebx,16 |
936 | rol ebx,16 |
937 | sub ebx,sb_btn_high ;30 |
937 | sub ebx,sb_btn_high ;30 |
938 | sub ebx,sb_btn_high |
938 | sub ebx,sb_btn_high |
939 | push ebx |
939 | push ebx |
940 | mov bx,0 |
940 | mov bx,0 |
941 | add ebx,sb_position2 |
941 | add ebx,sb_position2 |
942 | dec bx |
942 | dec bx |
943 | mov eax,13 |
943 | mov eax,13 |
944 | test bx,0x8000 |
944 | test bx,0x8000 |
945 | jnz @f |
945 | jnz @f |
946 | mov edx,sb_bckg_col |
946 | mov edx,sb_bckg_col |
947 | int 0x40 ; left interval |
947 | int 0x40 ; left interval |
948 | @@: |
948 | @@: |
949 | ;********************************* |
949 | ;********************************* |
950 | shr ebx,16 |
950 | shr ebx,16 |
951 | add ebx,sb_position2 |
951 | add ebx,sb_position2 |
952 | dec ebx |
952 | dec ebx |
953 | shl ebx,16 |
953 | shl ebx,16 |
954 | inc ebx |
954 | inc ebx |
955 | mov edx,sb_line_col |
955 | mov edx,sb_line_col |
956 | int 0x40 ; runner - left extreme line |
956 | int 0x40 ; runner - left extreme line |
957 | 957 | ||
958 | add ebx,1 shl 16 |
958 | add ebx,1 shl 16 |
959 | mov bx,0 |
959 | mov bx,0 |
960 | add ebx,sb_run_size |
960 | add ebx,sb_run_size |
961 | mov sb_r_size_x,ebx |
961 | mov sb_r_size_x,ebx |
962 | mov sb_r_size_y,ecx |
962 | mov sb_r_size_y,ecx |
963 | sub ebx,2 |
963 | sub ebx,2 |
964 | mov edx,sb_frnt_col |
964 | mov edx,sb_frnt_col |
965 | int 0x40 ; runner filling |
965 | int 0x40 ; runner filling |
966 | ;********************************* |
966 | ;********************************* |
967 | draw_runner_center_horizontal |
967 | draw_runner_center_horizontal |
968 | ;********************************* |
968 | ;********************************* |
969 | shr ebx,16 |
969 | shr ebx,16 |
970 | add ebx,sb_run_size |
970 | add ebx,sb_run_size |
971 | sub ebx,2 |
971 | sub ebx,2 |
972 | shl ebx,16 |
972 | shl ebx,16 |
973 | inc ebx |
973 | inc ebx |
974 | mov edx,sb_line_col |
974 | mov edx,sb_line_col |
975 | int 0x40 ; runner - bottom extreme line |
975 | int 0x40 ; runner - bottom extreme line |
976 | 976 | ||
977 | add ebx,1 shl 16 |
977 | add ebx,1 shl 16 |
978 | mov bx,sb_start_x |
978 | mov bx,sb_start_x |
979 | add bx,sb_size_x |
979 | add bx,sb_size_x |
980 | sub ebx,sb_btn_high |
980 | sub ebx,sb_btn_high |
981 | dec ebx |
981 | dec ebx |
982 | mov eax,ebx |
982 | mov eax,ebx |
983 | shr eax,16 |
983 | shr eax,16 |
984 | sub bx,ax |
984 | sub bx,ax |
985 | test bx,0x8000 |
985 | test bx,0x8000 |
986 | jnz @f |
986 | jnz @f |
987 | mov edx,sb_bckg_col |
987 | mov edx,sb_bckg_col |
988 | mov eax,13 |
988 | mov eax,13 |
989 | int 0x40 ; bottom interval |
989 | int 0x40 ; bottom interval |
990 | @@: |
990 | @@: |
991 | pop ebx |
991 | pop ebx |
992 | ;********************************* |
992 | ;********************************* |
993 | mov ax,bx |
993 | mov ax,bx |
994 | shr ebx,16 |
994 | shr ebx,16 |
995 | add bx,ax |
995 | add bx,ax |
996 | sub ebx,2 |
996 | sub ebx,2 |
997 | shl ebx,16 |
997 | shl ebx,16 |
998 | inc ebx |
998 | inc ebx |
999 | mov edx,sb_line_col |
999 | mov edx,sb_line_col |
1000 | mov eax,13 |
1000 | mov eax,13 |
1001 | cmp sb_all_redraw,dword 0 |
1001 | cmp dword sb_all_redraw,0 |
1002 | je @f |
1002 | je @f |
1003 | int 0x40 ; bottom button - top line |
1003 | int 0x40 ; bottom button - top line |
1004 | @@: |
1004 | @@: |
1005 | push ebx |
1005 | push ebx |
1006 | add ebx,1 shl 16 |
1006 | add ebx,1 shl 16 |
1007 | add bx,sb_btn_high |
1007 | add bx,sb_btn_high |
1008 | sub ebx,2 |
1008 | sub ebx,2 |
1009 | mov edx,sb_frnt_col |
1009 | mov edx,sb_frnt_col |
1010 | cmp sb_all_redraw,dword 0 |
1010 | cmp dword sb_all_redraw,0 |
1011 | je @f |
1011 | je @f |
1012 | int 0x40 ; bottom button filling |
1012 | int 0x40 ; bottom button filling |
1013 | ;********************************* |
1013 | ;********************************* |
1014 | draw_down_arrow_horizontal |
1014 | draw_down_arrow_horizontal |
1015 | ;********************************* |
1015 | ;********************************* |
1016 | @@: |
1016 | @@: |
1017 | pop ebx |
1017 | pop ebx |
1018 | 1018 | ||
1019 | ror ebx,16 |
1019 | ror ebx,16 |
1020 | add ebx,sb_btn_high ;14 shl 16 |
1020 | add ebx,sb_btn_high ;14 shl 16 |
1021 | rol ebx,16 |
1021 | rol ebx,16 |
1022 | 1022 | ||
1023 | mov edx,sb_line_col |
1023 | mov edx,sb_line_col |
1024 | mov bx,1 |
1024 | mov bx,1 |
1025 | cmp sb_all_redraw,dword 0 |
1025 | cmp dword sb_all_redraw,0 |
1026 | je @f |
1026 | je @f |
1027 | int 0x40 ; bottom button - extreme line |
1027 | int 0x40 ; bottom button - extreme line |
1028 | @@: |
1028 | @@: |
1029 | popa |
1029 | popa |
1030 | ret |
1030 | ret |
1031 | ;***************************************************************************** |
1031 | ;***************************************************************************** |
1032 | ; mouse event |
1032 | ; mouse event |
1033 | ;***************************************************************************** |
1033 | ;***************************************************************************** |
1034 | .mouse: |
1034 | .mouse: |
1035 | pusha |
1035 | pusha |
1036 | mov edi,dword [esp+36] |
1036 | mov edi,dword [esp+36] |
1037 | mcall 37,1 |
1037 | mcall 37,1 |
1038 | mov sb_m_pos,eax |
1038 | mov sb_m_pos,eax |
1039 | cmp sb_m_pos_2,dword 0 |
1039 | cmp dword sb_m_pos_2,0 |
1040 | jne @f |
1040 | jne @f |
1041 | 1041 | ||
1042 | mov sb_m_pos_2,eax |
1042 | mov sb_m_pos_2,eax |
1043 | @@: |
1043 | @@: |
1044 | mcall 37,2 |
1044 | mcall 37,2 |
1045 | mov sb_m_keys,eax |
1045 | mov sb_m_keys,eax |
1046 | 1046 | ||
1047 | cmp sb_m_keys,eax |
1047 | cmp sb_m_keys,eax |
1048 | je @f |
1048 | je @f |
1049 | 1049 | ||
1050 | mov sb_m_keys,eax |
1050 | mov sb_m_keys,eax |
1051 | 1051 | ||
1052 | mov sb_delta,dword 0 |
1052 | mov sb_delta,dword 0 |
1053 | 1053 | ||
1054 | mov eax,sb_m_pos |
1054 | mov eax,sb_m_pos |
1055 | mov sb_m_pos_2,eax |
1055 | mov sb_m_pos_2,eax |
1056 | jmp .continue_2 |
1056 | jmp .continue_2 |
1057 | 1057 | ||
1058 | @@: |
1058 | @@: |
1059 | cmp sb_m_keys,dword 0 |
1059 | cmp dword sb_m_keys,0 |
1060 | jne @f |
1060 | jne @f |
1061 | mov eax,sb_m_pos |
1061 | mov eax,sb_m_pos |
1062 | mov sb_m_pos_2,eax |
1062 | mov sb_m_pos_2,eax |
1063 | jmp .correct_1 ;.exit_sb |
1063 | jmp .correct_1 ;.exit_sb |
1064 | @@: |
1064 | @@: |
1065 | mov sb_delta,word 1 |
1065 | mov sb_delta,word 1 |
1066 | 1066 | ||
1067 | .continue_2: |
1067 | .continue_2: |
1068 | mov eax,sb_m_pos |
1068 | mov eax,sb_m_pos |
1069 | test eax,0x80000000 |
1069 | test eax,0x80000000 |
1070 | jnz .exit_sb |
1070 | jnz .exit_sb |
1071 | 1071 | ||
1072 | test eax,0x8000 |
1072 | test eax,0x8000 |
1073 | jnz .exit_sb |
1073 | jnz .exit_sb |
1074 | 1074 | ||
1075 | mov ebx,eax |
1075 | mov ebx,eax |
1076 | shr eax,16 ; x position |
1076 | shr eax,16 ; x position |
1077 | shl ebx,16 |
1077 | shl ebx,16 |
1078 | shr ebx,16 ; y position |
1078 | shr ebx,16 ; y position |
1079 | 1079 | ||
1080 | mov cx,sb_start_x ;y |
1080 | mov cx,sb_start_x ;y |
1081 | cmp ax,cx |
1081 | cmp ax,cx |
1082 | jb .exit_sb |
1082 | jb .exit_sb |
1083 | 1083 | ||
1084 | cmp sb_delta2,word 0 |
1084 | cmp word sb_delta2,0 |
1085 | je @f |
1085 | je @f |
1086 | push ecx |
1086 | push ecx |
1087 | add cx,sb_btn_high |
1087 | add cx,sb_btn_high |
1088 | cmp ax,cx |
1088 | cmp ax,cx |
1089 | pop ecx |
1089 | pop ecx |
1090 | jb .exit_sb |
1090 | jb .exit_sb |
1091 | 1091 | ||
1092 | @@: |
1092 | @@: |
1093 | add cx,sb_size_x ;y |
1093 | add cx,sb_size_x ;y |
1094 | cmp ax,cx |
1094 | cmp ax,cx |
1095 | ja .exit_sb |
1095 | ja .exit_sb |
1096 | 1096 | ||
1097 | cmp sb_delta2,word 0 |
1097 | cmp word sb_delta2,0 |
1098 | je @f |
1098 | je @f |
1099 | sub cx,sb_btn_high |
1099 | sub cx,sb_btn_high |
1100 | cmp ax,cx |
1100 | cmp ax,cx |
1101 | ja .exit_sb |
1101 | ja .exit_sb |
1102 | 1102 | ||
1103 | @@: |
1103 | @@: |
1104 | cmp sb_delta2,word 1 |
1104 | cmp word sb_delta2,1 |
1105 | je @f |
1105 | je @f |
1106 | 1106 | ||
1107 | cmp sb_m_keys,dword 0 |
1107 | cmp dword sb_m_keys,0 |
1108 | je .exit_sb |
1108 | je .exit_sb |
1109 | 1109 | ||
1110 | mov cx,sb_start_y ;x |
1110 | mov cx,sb_start_y ;x |
1111 | cmp bx,cx |
1111 | cmp bx,cx |
1112 | jb .exit_sb |
1112 | jb .exit_sb |
1113 | 1113 | ||
1114 | add cx,sb_size_y ;x |
1114 | add cx,sb_size_y ;x |
1115 | cmp bx,cx |
1115 | cmp bx,cx |
1116 | ja .exit_sb |
1116 | ja .exit_sb |
1117 | 1117 | ||
1118 | mov cx,sb_r_start_x |
1118 | mov cx,sb_r_start_x |
1119 | cmp ax,cx |
1119 | cmp ax,cx |
1120 | jb .no_runner |
1120 | jb .no_runner |
1121 | 1121 | ||
1122 | add cx,sb_r_size_x |
1122 | add cx,sb_r_size_x |
1123 | cmp ax,cx |
1123 | cmp ax,cx |
1124 | ja .no_runner |
1124 | ja .no_runner |
1125 | 1125 | ||
1126 | mov sb_delta2,word 1 |
1126 | mov sb_delta2,word 1 |
1127 | @@: |
1127 | @@: |
1128 | push eax |
1128 | push eax |
1129 | mov eax,sb_m_pos |
1129 | mov eax,sb_m_pos |
1130 | mov ebx,sb_m_pos_2 |
1130 | mov ebx,sb_m_pos_2 |
1131 | shr eax,16 |
1131 | shr eax,16 |
1132 | shr ebx,16 |
1132 | shr ebx,16 |
1133 | cmp eax,ebx |
1133 | cmp eax,ebx |
1134 | je .correct |
1134 | je .correct |
1135 | 1135 | ||
1136 | ; shl eax,16 |
1136 | ; shl eax,16 |
1137 | ; shr eax,16 |
1137 | ; shr eax,16 |
1138 | ; mov ebx,sb_m_pos_2 |
1138 | ; mov ebx,sb_m_pos_2 |
1139 | ; shl ebx,16 |
1139 | ; shl ebx,16 |
1140 | ; shr ebx,16 |
1140 | ; shr ebx,16 |
1141 | ; cmp eax,ebx |
1141 | ; cmp eax,ebx |
1142 | jb .sub |
1142 | jb .sub |
1143 | 1143 | ||
1144 | sub eax,ebx |
1144 | sub eax,ebx |
1145 | mov ebx,eax |
1145 | mov ebx,eax |
1146 | add sb_position2,ebx |
1146 | add sb_position2,ebx |
1147 | xor eax,eax |
1147 | xor eax,eax |
1148 | mov ax,sb_size_x ;y |
1148 | mov ax,sb_size_x ;y |
1149 | sub eax,sb_btn_high |
1149 | sub eax,sb_btn_high |
1150 | sub eax,sb_btn_high |
1150 | sub eax,sb_btn_high |
1151 | sub eax,sb_run_size |
1151 | sub eax,sb_run_size |
1152 | cmp sb_position2,eax |
1152 | cmp sb_position2,eax |
1153 | jbe @f |
1153 | jbe @f |
1154 | 1154 | ||
1155 | mov sb_position2,eax |
1155 | mov sb_position2,eax |
1156 | @@: |
1156 | @@: |
1157 | mov eax,sb_m_pos |
1157 | mov eax,sb_m_pos |
1158 | mov sb_m_pos_2,eax |
1158 | mov sb_m_pos_2,eax |
1159 | pop eax |
1159 | pop eax |
1160 | call .draw_1 |
1160 | call .draw_1 |
1161 | jmp .no_runner_1 |
1161 | jmp .no_runner_1 |
1162 | 1162 | ||
1163 | .correct: |
1163 | .correct: |
1164 | pop eax |
1164 | pop eax |
1165 | jmp .exit_sb |
1165 | jmp .exit_sb |
1166 | .correct_1: |
1166 | .correct_1: |
1167 | mov sb_delta,dword 0 |
1167 | mov sb_delta,dword 0 |
1168 | jmp .exit_sb |
1168 | jmp .exit_sb |
1169 | 1169 | ||
1170 | .sub: |
1170 | .sub: |
1171 | sub ebx,eax |
1171 | sub ebx,eax |
1172 | sub sb_position2,ebx |
1172 | sub sb_position2,ebx |
1173 | test sb_position2,dword 0x80000000 |
1173 | test sb_position2,dword 0x80000000 |
1174 | jz @f |
1174 | jz @f |
1175 | 1175 | ||
1176 | mov sb_position2,dword 0 |
1176 | mov sb_position2,dword 0 |
1177 | @@: |
1177 | @@: |
1178 | mov eax,sb_m_pos |
1178 | mov eax,sb_m_pos |
1179 | mov sb_m_pos_2,eax |
1179 | mov sb_m_pos_2,eax |
1180 | pop eax |
1180 | pop eax |
1181 | call .draw_1 |
1181 | call .draw_1 |
1182 | jmp .no_runner_1 |
1182 | jmp .no_runner_1 |
1183 | 1183 | ||
1184 | ;***************************************************************************** |
1184 | ;***************************************************************************** |
1185 | .no_runner: |
1185 | .no_runner: |
1186 | mov sb_delta,dword 0 |
1186 | mov sb_delta,dword 0 |
1187 | .no_runner_1: |
1187 | .no_runner_1: |
1188 | xor ecx,ecx |
1188 | xor ecx,ecx |
1189 | mov cx,sb_start_x ;y |
1189 | mov cx,sb_start_x ;y |
1190 | add cx,sb_btn_high ;15 |
1190 | add cx,sb_btn_high ;15 |
1191 | cmp sb_delta,word 1 |
1191 | cmp word sb_delta,1 |
1192 | je .scroll_sb |
1192 | je .scroll_sb |
1193 | 1193 | ||
1194 | cmp ax,cx |
1194 | cmp ax,cx |
1195 | ja .scroll_sb |
1195 | ja .scroll_sb |
1196 | 1196 | ||
1197 | cmp sb_m_keys,dword 0 |
1197 | cmp dword sb_m_keys,0 |
1198 | je .exit_sb |
1198 | je .exit_sb |
1199 | 1199 | ||
1200 | mov eax,sb_ar_offset |
1200 | mov eax,sb_ar_offset |
1201 | cmp sb_position,eax ;dword 0 |
1201 | cmp sb_position,eax ;dword 0 |
1202 | jbe @f |
1202 | jbe @f |
1203 | 1203 | ||
1204 | sub sb_position,eax |
1204 | sub sb_position,eax |
1205 | jmp .all_sb |
1205 | jmp .all_sb |
1206 | @@: |
1206 | @@: |
1207 | xor eax,eax |
1207 | xor eax,eax |
1208 | mov sb_position,eax ;dword 0 |
1208 | mov sb_position,eax ;dword 0 |
1209 | mov sb_position2,eax ;dword 0 |
1209 | mov sb_position2,eax ;dword 0 |
1210 | jmp .all_sb |
1210 | jmp .all_sb |
1211 | ;***************************************************************************** |
1211 | ;***************************************************************************** |
1212 | .scroll_sb: |
1212 | .scroll_sb: |
1213 | add cx,sb_size_x ;y |
1213 | add cx,sb_size_x ;y |
1214 | sub cx,sb_btn_high |
1214 | sub cx,sb_btn_high |
1215 | sub cx,sb_btn_high |
1215 | sub cx,sb_btn_high |
1216 | cmp sb_delta,word 1 |
1216 | cmp word sb_delta,1 |
1217 | je @f |
1217 | je @f |
1218 | 1218 | ||
1219 | cmp ax,cx |
1219 | cmp ax,cx |
1220 | ja .down_sb |
1220 | ja .down_sb |
1221 | 1221 | ||
1222 | @@: |
1222 | @@: |
1223 | mov ebx,sb_btn_high ;16 ;15 |
1223 | mov ebx,sb_btn_high ;16 ;15 |
1224 | add bx,sb_start_x ;y |
1224 | add bx,sb_start_x ;y |
1225 | sub cx,bx |
1225 | sub cx,bx |
1226 | sub ax,bx |
1226 | sub ax,bx |
1227 | 1227 | ||
1228 | .scroll_sb_1: |
1228 | .scroll_sb_1: |
1229 | mov ebx,sb_run_size |
1229 | mov ebx,sb_run_size |
1230 | ;***************************************************************************** |
1230 | ;***************************************************************************** |
1231 | cmp sb_delta,word 1 |
1231 | cmp word sb_delta,1 |
1232 | je .continue |
1232 | je .continue |
1233 | 1233 | ||
1234 | @@: |
1234 | @@: |
1235 | mov edx,eax |
1235 | mov edx,eax |
1236 | 1236 | ||
1237 | push ebx |
1237 | push ebx |
1238 | shr ebx,1 |
1238 | shr ebx,1 |
1239 | sub edx,ebx |
1239 | sub edx,ebx |
1240 | pop ebx |
1240 | pop ebx |
1241 | mov sb_position2,edx |
1241 | mov sb_position2,edx |
1242 | test sb_position2,dword 0x80000000 |
1242 | test sb_position2,dword 0x80000000 |
1243 | jz .test_1 |
1243 | jz .test_1 |
1244 | 1244 | ||
1245 | mov sb_position2,dword 0 |
1245 | mov sb_position2,dword 0 |
1246 | jmp .continue |
1246 | jmp .continue |
1247 | 1247 | ||
1248 | .test_1: |
1248 | .test_1: |
1249 | xor edx,edx |
1249 | xor edx,edx |
1250 | mov dx,sb_size_x ;y |
1250 | mov dx,sb_size_x ;y |
1251 | sub edx,sb_btn_high |
1251 | sub edx,sb_btn_high |
1252 | sub edx,sb_btn_high |
1252 | sub edx,sb_btn_high |
1253 | sub edx,sb_run_size |
1253 | sub edx,sb_run_size |
1254 | cmp sb_position2,edx |
1254 | cmp sb_position2,edx |
1255 | jbe .continue |
1255 | jbe .continue |
1256 | 1256 | ||
1257 | mov sb_position2,edx |
1257 | mov sb_position2,edx |
1258 | 1258 | ||
1259 | .continue: |
1259 | .continue: |
1260 | mov eax,sb_position2 |
1260 | mov eax,sb_position2 |
1261 | sub ecx,ebx |
1261 | sub ecx,ebx |
1262 | .continue_1: |
1262 | .continue_1: |
1263 | ;***************************************************************************** |
1263 | ;***************************************************************************** |
1264 | mov ebx,eax |
1264 | mov ebx,eax |
1265 | 1265 | ||
1266 | mov eax,sb_max_area |
1266 | mov eax,sb_max_area |
1267 | cmp eax,sb_cur_area |
1267 | cmp eax,sb_cur_area |
1268 | ja @f |
1268 | ja @f |
1269 | 1269 | ||
1270 | xor eax,eax |
1270 | xor eax,eax |
1271 | inc eax |
1271 | inc eax |
1272 | mov sb_position2,eax |
1272 | mov sb_position2,eax |
1273 | jmp .all_sb |
1273 | jmp .all_sb |
1274 | @@: |
1274 | @@: |
1275 | sub eax,sb_cur_area |
1275 | sub eax,sb_cur_area |
1276 | inc eax |
1276 | inc eax |
1277 | shl eax,10 |
1277 | shl eax,10 |
1278 | xor edx,edx |
1278 | xor edx,edx |
1279 | div ecx |
1279 | div ecx |
1280 | shl edx,1 |
1280 | shl edx,1 |
1281 | cmp edx,ecx |
1281 | cmp edx,ecx |
1282 | jb @f |
1282 | jb @f |
1283 | 1283 | ||
1284 | inc eax |
1284 | inc eax |
1285 | 1285 | ||
1286 | @@: |
1286 | @@: |
1287 | imul eax,ebx |
1287 | imul eax,ebx |
1288 | shr eax,10 |
1288 | shr eax,10 |
1289 | 1289 | ||
1290 | cmp sb_position,eax |
1290 | cmp sb_position,eax |
1291 | je .exit_sb |
1291 | je .exit_sb |
1292 | 1292 | ||
1293 | cmp eax,0 |
1293 | cmp eax,0 |
1294 | ja @f |
1294 | ja @f |
1295 | 1295 | ||
1296 | xor eax,eax |
1296 | xor eax,eax |
1297 | 1297 | ||
1298 | @@: |
1298 | @@: |
1299 | .store_position: |
1299 | .store_position: |
1300 | mov sb_position,eax |
1300 | mov sb_position,eax |
1301 | .all_sb: |
1301 | .all_sb: |
1302 | mov sb_redraw,dword 1 |
1302 | mov sb_redraw,dword 1 |
1303 | call .draw_1 |
1303 | call .draw_1 |
1304 | mov eax,sb_m_pos |
1304 | mov eax,sb_m_pos |
1305 | mov sb_m_pos_2,eax |
1305 | mov sb_m_pos_2,eax |
1306 | jmp .exit_sb |
1306 | jmp .exit_sb |
1307 | ;***************************************************************************** |
1307 | ;***************************************************************************** |
1308 | .down_sb: |
1308 | .down_sb: |
1309 | cmp sb_m_keys,dword 0 |
1309 | cmp dword sb_m_keys,0 |
1310 | je .exit_sb |
1310 | je .exit_sb |
1311 | 1311 | ||
1312 | mov eax,sb_max_area |
1312 | mov eax,sb_max_area |
1313 | mov ebx,sb_ar_offset |
1313 | mov ebx,sb_ar_offset |
1314 | sub eax,sb_cur_area |
1314 | sub eax,sb_cur_area |
1315 | push eax |
1315 | push eax |
1316 | sub eax,ebx |
1316 | sub eax,ebx |
1317 | cmp sb_position,eax |
1317 | cmp sb_position,eax |
1318 | pop eax |
1318 | pop eax |
1319 | jae @f |
1319 | jae @f |
1320 | 1320 | ||
1321 | add sb_position,ebx |
1321 | add sb_position,ebx |
1322 | jmp .all_sb |
1322 | jmp .all_sb |
1323 | @@: |
1323 | @@: |
1324 | mov sb_position,eax |
1324 | mov sb_position,eax |
1325 | xor eax,eax |
1325 | xor eax,eax |
1326 | mov ax,sb_size_x |
1326 | mov ax,sb_size_x |
1327 | sub eax,sb_btn_high |
1327 | sub eax,sb_btn_high |
1328 | sub eax,sb_btn_high |
1328 | sub eax,sb_btn_high |
1329 | sub eax,sb_run_size |
1329 | sub eax,sb_run_size |
1330 | mov sb_position2,eax |
1330 | mov sb_position2,eax |
1331 | jmp .all_sb |
1331 | jmp .all_sb |
1332 | .exit_sb: |
1332 | .exit_sb: |
1333 | scroll_bar_exit |
1333 | scroll_bar_exit |
1334 | } |
1334 | } |