Subversion Repositories Kolibri OS

Rev

Rev 1041 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 1041 Rev 1199
1
;**************************************************************
1
;**************************************************************
2
; ScrollBar Macro for Kolibri OS
2
; ScrollBar Macro for Kolibri OS
3
; Copyright (c) 2009, Mario79
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  nor the
13
;	 * Neither the name of the  nor 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 Mario79 ''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  BE LIABLE FOR ANY
20
; DISCLAIMED. IN NO EVENT SHALL  BE LIABLE FOR ANY
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_all_redraw,dword 1
-
 
298
	mov   sb_delta,word 0
297
	mov   sb_delta,word 0
299
	call  .draw_1
298
	call  .draw_1
300
	mov   sb_all_redraw,dword 0
299
	mov   sb_all_redraw,dword 0
301
scroll_bar_exit
300
scroll_bar_exit
302
.draw_1:
301
.draw_1:
303
	pusha
302
	pusha
304
;*********************************
303
;*********************************
305
	xor   eax,eax
304
	xor   eax,eax
306
	mov   ax,sb_size_y
305
	mov   ax,sb_size_y
307
	mov   edx,sb_btn_high
306
	mov   edx,sb_btn_high
308
	shl   edx,1
307
	shl   edx,1
309
	sub   eax,edx
308
	sub   eax,edx
310
	mov   sb_work_size,eax
309
	mov   sb_work_size,eax
311
;*********************************
310
;*********************************
312
	mov   eax,sb_work_size   ;sb_max_area
311
	mov   eax,sb_work_size
313
	mov   ebx,sb_max_area
312
	mov   ebx,sb_max_area
314
	cmp   ebx,sb_cur_area
313
	cmp   ebx,sb_cur_area
315
	ja	@f
314
	ja	@f
316
 
315
 
317
	jmp   .no_size
316
	jmp   .no_size
318
 
317
 
319
@@: 
318
@@: 
320
	imul  eax,sb_cur_area
319
	imul  eax,sb_cur_area
321
	xor   edx,edx
320
	xor   edx,edx
322
	div   ebx
321
	div   ebx
323
	cmp   eax,10
322
	cmp   eax,10
324
	jae   @f
323
	jae   @f
325
	mov   eax,10
324
	mov   eax,10
326
@@:
325
@@:
327
.no_size:
326
.no_size:
328
	mov   sb_run_size,eax
327
	mov   sb_run_size,eax
329
;*********************************
328
;*********************************
330
	cmp   sb_delta,word 1
329
	cmp   sb_delta,word 1
331
	je	.@@_3
330
	je	.@@_3
332
	mov   eax,sb_work_size
331
	mov   eax,sb_work_size
333
	sub   eax,sb_run_size
332
	sub   eax,sb_run_size
334
	mov   ebx,sb_max_area
333
	mov   ebx,sb_max_area
335
	cmp   ebx,sb_cur_area
334
	cmp   ebx,sb_cur_area
336
	ja	@f
335
	ja	@f
337
	xor   eax,eax
336
	xor   eax,eax
338
	jmp   .@@_1
337
	jmp   .@@_1
339
@@:
338
@@:
340
	sub   ebx,sb_cur_area
339
	sub   ebx,sb_cur_area
341
	imul  eax,sb_position
340
	imul  eax,sb_position
342
	xor   edx,edx
341
	xor   edx,edx
343
	div   ebx
342
	div   ebx
344
.@@_1:
343
.@@_1:
345
	mov   sb_position2,eax
344
	mov   sb_position2,eax
346
	xor   edx,edx
345
	xor   edx,edx
347
	mov   dx,sb_size_y
346
	mov   dx,sb_size_y
348
	sub   edx,sb_btn_high
347
	sub   edx,sb_btn_high
349
	sub   edx,sb_btn_high
348
	sub   edx,sb_btn_high
350
	sub   edx,sb_run_size
349
	sub   edx,sb_run_size
351
	cmp   sb_position2,edx
350
	cmp   sb_position2,edx
352
	jbe   .@@_3
351
	jbe   .@@_3
353
	mov   sb_position2,edx
352
	mov   sb_position2,edx
354
.@@_3:
353
.@@_3:
355
;*********************************	
354
;*********************************	
356
	mov   ebx,sb_start_x
355
	mov   ebx,sb_start_x
357
	shl   ebx,16
356
	shl   ebx,16
358
	inc   ebx
357
	inc   ebx
359
	mov   ecx,sb_size_y
358
	mov   ecx,sb_size_y
360
	mov   edx,sb_line_col
359
	mov   edx,sb_line_col
361
	mov   eax,13
360
	mov   eax,13
362
	cmp  sb_all_redraw,dword 0
361
	cmp  sb_all_redraw,dword 0
363
	je   @f
362
	je   @f
364
	int   0x40   ; left extreme line
363
	int   0x40   ; left extreme line
365
@@:
364
@@:
366
	push  ebx
365
	push  ebx
367
	ror   ebx,16
366
	ror   ebx,16
368
	add   bx,sb_size_x
367
	add   bx,sb_size_x
369
	rol   ebx,16
368
	rol   ebx,16
370
	cmp  sb_all_redraw,dword 0
369
	cmp  sb_all_redraw,dword 0
371
	je   @f
370
	je   @f
372
	int   0x40   ; right extreme line
371
	int   0x40   ; right extreme line
373
@@:
372
@@:
374
	pop   ebx
373
	pop   ebx
375
 
374
 
376
	push  ecx
375
	push  ecx
377
	
376
	
378
	add   ebx,1 shl 16
377
	add   ebx,1 shl 16
379
	mov   bx,sb_size_x
378
	mov   bx,sb_size_x
380
	dec   ebx	
379
	dec   ebx	
381
	mov   cx,1
380
	mov   cx,1
382
	cmp  sb_all_redraw,dword 0
381
	cmp  sb_all_redraw,dword 0
383
	je   @f
382
	je   @f
384
	int   0x40   ; top button - extreme line
383
	int   0x40   ; top button - extreme line
385
@@:
384
@@:
386
	push  ecx
385
	push  ecx
387
	add   ecx,1 shl 16
386
	add   ecx,1 shl 16
388
	add   ecx,sb_btn_high
387
	add   ecx,sb_btn_high
389
	sub   ecx,2
388
	sub   ecx,2
390
	mov   edx,sb_frnt_col
389
	mov   edx,sb_frnt_col
391
	cmp  sb_all_redraw,dword 0
390
	cmp  sb_all_redraw,dword 0
392
	je   @f
391
	je   @f
393
	int   0x40   ; top button filling
392
	int   0x40   ; top button filling
394
;*********************************	
393
;*********************************	
395
draw_up_arrow_vertical
394
draw_up_arrow_vertical
396
;********************************* 
395
;********************************* 
397
@@:
396
@@:
398
	pop   ecx
397
	pop   ecx
399
	
398
	
400
	ror   ecx,16
399
	ror   ecx,16
401
	add   ecx,sb_btn_high  ;14 shl 16
400
	add   ecx,sb_btn_high  ;14 shl 16
402
	rol   ecx,16
401
	rol   ecx,16
403
	mov   edx,sb_line_col
402
	mov   edx,sb_line_col
404
	cmp  sb_all_redraw,dword 0
403
	cmp  sb_all_redraw,dword 0
405
	je   @f
404
	je   @f
406
	int   0x40   ;  top button - bottom line
405
	int   0x40   ;  top button - bottom line
407
@@:
406
@@:
408
	pop   ecx
407
	pop   ecx
409
;********************************* 
408
;********************************* 
410
	ror   ecx,16	
409
	ror   ecx,16	
411
	add   ecx,sb_btn_high  ;15 shl 16
410
	add   ecx,sb_btn_high  ;15 shl 16
412
	inc   ecx
411
	inc   ecx
413
	rol   ecx,16
412
	rol   ecx,16
414
	sub   ecx,sb_btn_high  ;30
413
	sub   ecx,sb_btn_high  ;30
415
	sub   ecx,sb_btn_high
414
	sub   ecx,sb_btn_high
416
	push  ecx
415
	push  ecx
417
	mov   cx,0
416
	mov   cx,0
418
	add   ecx,sb_position2
417
	add   ecx,sb_position2
419
	dec   cx
418
	dec   cx
420
	mov   eax,13
419
	mov   eax,13
421
	test  cx,0x8000
420
	test  cx,0x8000
422
	jnz   @f
421
	jnz   @f
423
	mov   edx,sb_bckg_col
422
	mov   edx,sb_bckg_col
424
	int   0x40	; top interval
423
	int   0x40	; top interval
425
@@:
424
@@:
426
;********************************* 
425
;********************************* 
427
	shr   ecx,16
426
	shr   ecx,16
428
	add   ecx,sb_position2
427
	add   ecx,sb_position2
429
	dec   ecx
428
	dec   ecx
430
	shl   ecx,16
429
	shl   ecx,16
431
	inc   ecx
430
	inc   ecx
432
	mov   edx,sb_line_col
431
	mov   edx,sb_line_col
433
	int   0x40	; runner - top extreme line
432
	int   0x40	; runner - top extreme line
434
	
433
	
435
	add   ecx,1 shl 16
434
	add   ecx,1 shl 16
436
	mov   cx,0
435
	mov   cx,0
437
	add   ecx,sb_run_size
436
	add   ecx,sb_run_size
438
	mov   sb_r_size_x,ebx
437
	mov   sb_r_size_x,ebx
439
	mov   sb_r_size_y,ecx
438
	mov   sb_r_size_y,ecx
440
	sub   ecx,2
439
	sub   ecx,2
441
	mov   edx,sb_frnt_col
440
	mov   edx,sb_frnt_col
442
	int   0x40   ; runner filling
441
	int   0x40   ; runner filling
443
;********************************* 
442
;********************************* 
444
draw_runner_center_vertical
443
draw_runner_center_vertical
445
;********************************* 
444
;********************************* 
446
	shr   ecx,16
445
	shr   ecx,16
447
	add   ecx,sb_run_size
446
	add   ecx,sb_run_size
448
	sub   ecx,2
447
	sub   ecx,2
449
	shl   ecx,16  
448
	shl   ecx,16  
450
	inc   ecx
449
	inc   ecx
451
	mov   edx,sb_line_col
450
	mov   edx,sb_line_col
452
	int   0x40   ; runner - bottom extreme line
451
	int   0x40   ; runner - bottom extreme line
453
	
452
	
454
	add   ecx,1 shl 16
453
	add   ecx,1 shl 16
455
	mov   cx,sb_start_y
454
	mov   cx,sb_start_y
456
	add   cx,sb_size_y
455
	add   cx,sb_size_y
457
	sub   ecx,sb_btn_high
456
	sub   ecx,sb_btn_high
458
	dec   ecx
457
	dec   ecx
459
	mov   eax,ecx
458
	mov   eax,ecx
460
	shr   eax,16
459
	shr   eax,16
461
	sub   cx,ax
460
	sub   cx,ax
462
	test  cx,0x8000
461
	test  cx,0x8000
463
	jnz	  @f
462
	jnz	  @f
464
	mov   edx,sb_bckg_col
463
	mov   edx,sb_bckg_col
465
	mov   eax,13
464
	mov   eax,13
466
	int   0x40   ; bottom interval
465
	int   0x40   ; bottom interval
467
@@:	
466
@@:	
468
	pop   ecx	
467
	pop   ecx	
469
;*********************************	
468
;*********************************	
470
	mov   ax,cx
469
	mov   ax,cx
471
	shr   ecx,16
470
	shr   ecx,16
472
	add   cx,ax
471
	add   cx,ax
473
	sub   ecx,2
472
	sub   ecx,2
474
	shl   ecx,16
473
	shl   ecx,16
475
	inc   ecx
474
	inc   ecx
476
	mov   edx,sb_line_col
475
	mov   edx,sb_line_col
477
	mov   eax,13
476
	mov   eax,13
478
	cmp  sb_all_redraw,dword 0
477
	cmp  sb_all_redraw,dword 0
479
	je   @f
478
	je   @f
480
	int   0x40   ; bottom button - top line
479
	int   0x40   ; bottom button - top line
481
@@:
480
@@:
482
	push  ecx
481
	push  ecx
483
	add   ecx,1 shl 16
482
	add   ecx,1 shl 16
484
	add   cx,sb_btn_high
483
	add   cx,sb_btn_high
485
	sub   ecx,2
484
	sub   ecx,2
486
	mov   edx,sb_frnt_col
485
	mov   edx,sb_frnt_col
487
	cmp  sb_all_redraw,dword 0
486
	cmp  sb_all_redraw,dword 0
488
	je   @f
487
	je   @f
489
	int   0x40   ; bottom button filling
488
	int   0x40   ; bottom button filling
490
;********************************* 
489
;********************************* 
491
draw_down_arrow_vertical
490
draw_down_arrow_vertical
492
;********************************* 
491
;********************************* 
493
@@:
492
@@:
494
	pop   ecx
493
	pop   ecx
495
	
494
	
496
	ror   ecx,16
495
	ror   ecx,16
497
	add   ecx,sb_btn_high  ;14 shl 16
496
	add   ecx,sb_btn_high
498
	rol   ecx,16
497
	rol   ecx,16
499
	
498
	
500
	mov   edx,sb_line_col
499
	mov   edx,sb_line_col
501
	mov   cx,1
500
	mov   cx,1
502
	cmp  sb_all_redraw,dword 0
501
	cmp  sb_all_redraw,dword 0
503
	je   @f
502
	je   @f
504
	int   0x40   ; bottom button - extreme line
503
	int   0x40   ; bottom button - extreme line
505
@@:
504
@@:
506
	popa
505
	popa
507
	ret
506
	ret
508
;*****************************************************************************
507
;*****************************************************************************
509
;*****************************************************************************
508
;*****************************************************************************
510
; mouse event
509
; mouse event
511
;*****************************************************************************
510
;*****************************************************************************
512
;*****************************************************************************
511
;*****************************************************************************
513
.mouse:
512
.mouse:
514
	pusha
513
	pusha
515
	mov	 edi,dword [esp+36]
514
	mov	 edi,dword [esp+36]
516
	mcall 37,1
515
	mcall 37,1
517
	mov   sb_m_pos,eax
516
	mov   sb_m_pos,eax
518
	cmp   sb_m_pos_2,dword 0
517
	cmp   sb_m_pos_2,dword 0
519
	jne   @f
518
	jne   @f
520
	
519
	
521
	mov   sb_m_pos_2,eax	
520
	mov   sb_m_pos_2,eax	
522
@@:
521
@@:
523
	mcall 37,2
522
	mcall 37,2
524
	mov   sb_m_keys,eax	
523
	mov   sb_m_keys,eax	
525
 
524
 
526
	cmp   sb_m_keys,eax
525
	cmp   sb_m_keys,eax
527
	je	  @f
526
	je	  @f
528
	
527
	
529
	mov   sb_m_keys,eax
528
	mov   sb_m_keys,eax
530
 
529
 
531
	mov   sb_delta,dword 0
530
	mov   sb_delta,dword 0
532
 
531
 
533
	mov   eax,sb_m_pos
532
	mov   eax,sb_m_pos
534
	mov   sb_m_pos_2,eax
533
	mov   sb_m_pos_2,eax
535
	jmp   .continue_2
534
	jmp   .continue_2
536
	
535
	
537
@@:
536
@@:
538
	cmp   sb_m_keys,dword 0
537
	cmp   sb_m_keys,dword 0
539
	jne	 @f   ;.continue_2
538
	jne	 @f
540
	mov   eax,sb_m_pos
539
	mov   eax,sb_m_pos
541
	mov   sb_m_pos_2,eax
540
	mov   sb_m_pos_2,eax
542
	jmp   .correct_1	;.exit_sb	
541
	jmp   .correct_1	;.exit_sb	
543
@@:
542
@@:
544
	mov   sb_delta,word 1
543
	mov   sb_delta,word 1
545
 
544
 
546
.continue_2:
545
.continue_2:
547
	mov   eax,sb_m_pos
546
	mov   eax,sb_m_pos
548
	test  eax,0x80000000
547
	test  eax,0x80000000
549
	jnz   .exit_sb
548
	jnz   .exit_sb
550
	
549
	
551
	test  eax,0x8000
550
	test  eax,0x8000
552
	jnz   .exit_sb
551
	jnz   .exit_sb
553
	
552
	
554
	mov   ebx,eax
553
	mov   ebx,eax
555
	shr   ebx,16   ; x position
554
	shr   ebx,16   ; x position
556
	shl   eax,16
555
	shl   eax,16
557
	shr   eax,16   ; y position
556
	shr   eax,16   ; y position
558
 
557
 
559
	mov   cx,sb_start_y
558
	mov   cx,sb_start_y
560
	cmp   ax,cx
559
	cmp   ax,cx
561
	jb	.exit_sb
560
	jb	.exit_sb
562
	
561
	
563
	cmp   sb_delta2,word 0
562
	cmp   sb_delta2,word 0
564
	je	@f
563
	je	@f
565
	push  ecx
564
	push  ecx
566
	add   cx,sb_btn_high
565
	add   cx,sb_btn_high
567
	cmp   ax,cx
566
	cmp   ax,cx
568
	pop   ecx
567
	pop   ecx
569
	jb	.exit_sb
568
	jb	.exit_sb
570
	
569
	
571
@@:
570
@@:
572
	add   cx,sb_size_y
571
	add   cx,sb_size_y
573
	cmp   ax,cx
572
	cmp   ax,cx
574
	ja	.exit_sb
573
	ja	.exit_sb
575
 
574
 
576
	cmp   sb_delta2,word 0
575
	cmp   sb_delta2,word 0
577
	je	@f
576
	je	@f
578
	sub   cx,sb_btn_high
577
	sub   cx,sb_btn_high
579
	cmp   ax,cx
578
	cmp   ax,cx
580
	ja	.exit_sb
579
	ja	.exit_sb
581
	
580
	
582
@@:
581
@@:
583
	cmp   sb_delta2,word 1
582
	cmp   sb_delta2,word 1
584
	je	@f
583
	je	@f
585
	
584
	
586
	cmp   sb_m_keys,dword 0
585
	cmp   sb_m_keys,dword 0
587
	je	.exit_sb
586
	je	.exit_sb
588
	
587
	
589
	mov   cx,sb_start_x
588
	mov   cx,sb_start_x
590
	cmp   bx,cx
589
	cmp   bx,cx
591
	jb	.exit_sb
590
	jb	.exit_sb
592
	
591
	
593
	add   cx,sb_size_x
592
	add   cx,sb_size_x
594
	cmp   bx,cx
593
	cmp   bx,cx
595
	ja	.exit_sb
594
	ja	.exit_sb
596
 
595
 
597
	mov   cx,sb_r_start_y
596
	mov   cx,sb_r_start_y
598
	cmp   ax,cx
597
	cmp   ax,cx
599
	jb	.no_runner
598
	jb	.no_runner
600
	
599
	
601
	add   cx,sb_r_size_y
600
	add   cx,sb_r_size_y
602
	cmp   ax,cx
601
	cmp   ax,cx
603
	ja	.no_runner
602
	ja	.no_runner
604
 
603
 
605
	mov   sb_delta2,word 1	
604
	mov   sb_delta2,word 1	
606
@@:
605
@@:
607
	push  eax
606
	push  eax
608
	mov   ax,sb_m_pos
607
	mov   ax,sb_m_pos
609
	cmp   ax,sb_m_pos_2
608
	cmp   ax,sb_m_pos_2
610
	je	.correct  ;.exit_sb	
609
	je	.correct	
611
	
610
	
612
	shl   eax,16
611
	shl   eax,16
613
	shr   eax,16
612
	shr   eax,16
614
	mov   ebx,sb_m_pos_2
613
	mov   ebx,sb_m_pos_2
615
	shl   ebx,16
614
	shl   ebx,16
616
	shr   ebx,16
615
	shr   ebx,16
617
	cmp   eax,ebx
616
	cmp   eax,ebx
618
	jb   .sub
617
	jb   .sub
619
	
618
	
620
	sub   eax,ebx
619
	sub   eax,ebx
621
	mov   ebx,eax
620
	mov   ebx,eax
622
	add   sb_position2,ebx
621
	add   sb_position2,ebx
623
	xor   eax,eax
622
	xor   eax,eax
624
	mov   ax,sb_size_y
623
	mov   ax,sb_size_y
625
	sub   eax,sb_btn_high
624
	sub   eax,sb_btn_high
626
	sub   eax,sb_btn_high
625
	sub   eax,sb_btn_high
627
	sub   eax,sb_run_size
626
	sub   eax,sb_run_size
628
	cmp   sb_position2,eax
627
	cmp   sb_position2,eax
629
	jbe   @f
628
	jbe   @f
630
	
629
	
631
	mov   sb_position2,eax
630
	mov   sb_position2,eax
632
@@:
631
@@:
633
	mov   eax,sb_m_pos
632
	mov   eax,sb_m_pos
634
	mov   sb_m_pos_2,eax
633
	mov   sb_m_pos_2,eax
635
	pop   eax
634
	pop   eax
636
	call  .draw_1
635
	call  .draw_1
637
	jmp   .no_runner_1
636
	jmp   .no_runner_1
638
	
637
	
639
.correct:
638
.correct:
640
	pop   eax
639
	pop   eax
641
	jmp   .exit_sb
640
	jmp   .exit_sb
642
.correct_1:
641
.correct_1:
643
	mov   sb_delta,dword 0
642
	mov   sb_delta,dword 0
644
	jmp   .exit_sb
643
	jmp   .exit_sb
645
 
644
 
646
.sub:
645
.sub:
647
	sub   ebx,eax
646
	sub   ebx,eax
648
	sub   sb_position2,ebx
647
	sub   sb_position2,ebx
649
	test  sb_position2,dword 0x80000000
648
	test  sb_position2,dword 0x80000000
650
	jz	  @f
649
	jz	  @f
651
	
650
	
652
	mov   sb_position2,dword 0
651
	mov   sb_position2,dword 0
653
@@:
652
@@:
654
	mov   eax,sb_m_pos
653
	mov   eax,sb_m_pos
655
	mov   sb_m_pos_2,eax
654
	mov   sb_m_pos_2,eax
656
	pop   eax
655
	pop   eax
657
	call  .draw_1
656
	call  .draw_1
658
	jmp   .no_runner_1
657
	jmp   .no_runner_1
659
 
658
 
660
;*****************************************************************************
659
;*****************************************************************************
661
.no_runner:
660
.no_runner:
662
	mov   sb_delta,dword 0
661
	mov   sb_delta,dword 0
663
.no_runner_1:
662
.no_runner_1:
664
	xor   ecx,ecx
663
	xor   ecx,ecx
665
	mov   cx,sb_start_y
664
	mov   cx,sb_start_y
666
	add   cx,sb_btn_high   ;15
665
	add   cx,sb_btn_high   ;15
667
	cmp   sb_delta,word 1
666
	cmp   sb_delta,word 1
668
	je	.scroll_sb
667
	je	.scroll_sb
669
	
668
	
670
	cmp   ax,cx
669
	cmp   ax,cx
671
	ja	.scroll_sb
670
	ja	.scroll_sb
672
	
671
	
673
	cmp   sb_m_keys,dword 0
672
	cmp   sb_m_keys,dword 0
674
	je   .exit_sb
673
	je   .exit_sb
675
	
674
	
676
	mov   eax,sb_ar_offset
675
	mov   eax,sb_ar_offset
677
	cmp   sb_position,eax  ;dword 0
676
	cmp   sb_position,eax  ;dword 0
678
;	je	.exit_sb
-
 
679
	jbe   @f
677
	jbe   @f
680
	
-
 
681
;	dec   dword sb_position
678
	
682
	sub   sb_position,eax
679
	sub   sb_position,eax
683
	jmp   .all_sb
680
	jmp   .all_sb
684
@@:
681
@@:
685
	xor   eax,eax
682
	xor   eax,eax
686
	mov   sb_position,eax ;dword 0
683
	mov   sb_position,eax ;dword 0
687
	mov   sb_position2,eax ;dword 0
684
	mov   sb_position2,eax ;dword 0
688
	jmp   .all_sb
685
	jmp   .all_sb
689
;*****************************************************************************
686
;*****************************************************************************
690
.scroll_sb:
687
.scroll_sb:
691
	add   cx,sb_size_y
688
	add   cx,sb_size_y
692
	sub   cx,sb_btn_high
689
	sub   cx,sb_btn_high
693
	sub   cx,sb_btn_high
690
	sub   cx,sb_btn_high
694
	cmp   sb_delta,word 1
691
	cmp   sb_delta,word 1
695
	je	@f
692
	je	@f
696
	
693
	
697
	cmp   ax,cx
694
	cmp   ax,cx
698
	ja	.down_sb
695
	ja	.down_sb
699
	
696
	
700
@@:
697
@@:
701
	mov   ebx,sb_btn_high   ;16  ;15
698
	mov   ebx,sb_btn_high   ;16  ;15
702
;	inc   ebx
-
 
703
	add   bx,sb_start_y
699
	add   bx,sb_start_y
704
	sub   cx,bx
700
	sub   cx,bx
705
	sub   ax,bx
701
	sub   ax,bx
706
	
702
	
707
.scroll_sb_1:	
703
.scroll_sb_1:	
708
	mov   ebx,sb_run_size
704
	mov   ebx,sb_run_size
709
;*****************************************************************************	
705
;*****************************************************************************	
710
	cmp   sb_delta,word 1
706
	cmp   sb_delta,word 1
711
	je	.continue
707
	je	.continue
712
	
708
	
713
@@:
709
@@:
714
	mov   edx,eax
710
	mov   edx,eax
715
;	sub   edx,sb_btn_high
-
 
716
	push  ebx
711
	push  ebx
717
	shr   ebx,1 
712
	shr   ebx,1 
718
	sub   edx,ebx
713
	sub   edx,ebx
719
	pop   ebx
714
	pop   ebx
720
	mov   sb_position2,edx
715
	mov   sb_position2,edx
721
	test  sb_position2,dword 0x80000000
716
	test  sb_position2,dword 0x80000000
722
	jz	 .test_1
717
	jz	 .test_1
723
	
718
	
724
	mov   sb_position2,dword 0
719
	mov   sb_position2,dword 0
725
	jmp   .continue
720
	jmp   .continue
726
	
721
	
727
.test_1: 
722
.test_1: 
728
	xor   edx,edx
723
	xor   edx,edx
729
	mov   dx,sb_size_y
724
	mov   dx,sb_size_y
730
	sub   edx,sb_btn_high
725
	sub   edx,sb_btn_high
731
	sub   edx,sb_btn_high
726
	sub   edx,sb_btn_high
732
	sub   edx,sb_run_size
727
	sub   edx,sb_run_size
733
	cmp   sb_position2,edx
728
	cmp   sb_position2,edx
734
	jbe   .continue
729
	jbe   .continue
735
	
730
	
736
	mov   sb_position2,edx
731
	mov   sb_position2,edx
737
;	jmp   .continue_1
-
 
738
	
732
 
739
.continue:   
733
.continue:   
740
	mov   eax,sb_position2
734
	mov   eax,sb_position2
741
	sub   ecx,ebx
735
	sub   ecx,ebx
742
.continue_1:
736
.continue_1:
743
;*****************************************************************************  
737
;*****************************************************************************  
744
	mov   ebx,eax
738
	mov   ebx,eax
745
 
739
 
746
	mov   eax,sb_max_area
740
	mov   eax,sb_max_area
747
	cmp   eax,sb_cur_area
741
	cmp   eax,sb_cur_area
748
	ja	@f
742
	ja	@f
749
 
743
 
750
	xor   eax,eax
744
	xor   eax,eax
751
	inc   eax
745
	inc   eax
752
	mov   sb_position2,eax
746
	mov   sb_position2,eax
753
	jmp   .all_sb   ;.store_position
747
	jmp   .all_sb
754
@@:
748
@@:
755
	sub   eax,sb_cur_area
749
	sub   eax,sb_cur_area
756
	inc   eax
750
	inc   eax
757
	shl   eax,10
751
	shl   eax,10
758
	xor   edx,edx
752
	xor   edx,edx
759
	div   ecx
753
	div   ecx
760
	shl   edx,1
754
	shl   edx,1
761
	cmp   edx,ecx
755
	cmp   edx,ecx
762
	jb	@f
756
	jb	@f
763
	
757
	
764
	inc   eax
758
	inc   eax
765
	
759
	
766
@@:
760
@@:
767
	imul  eax,ebx
761
	imul  eax,ebx
768
	shr   eax,10
762
	shr   eax,10
769
	
763
	
770
	cmp   sb_position,eax
764
	cmp   sb_position,eax
771
	je	.exit_sb
765
	je	.exit_sb
772
	
766
	
773
	cmp   eax,0
767
	cmp   eax,0
774
	ja	@f
768
	ja	@f
775
	
769
	
776
	xor   eax,eax
770
	xor   eax,eax
777
	
771
	
778
@@:
772
@@:
779
.store_position:
773
.store_position:
780
	mov   sb_position,eax
774
	mov   sb_position,eax
781
.all_sb:
775
.all_sb:
782
	mov   sb_redraw,dword 1
776
	mov   sb_redraw,dword 1
783
	call  .draw_1
777
	call  .draw_1
784
	mov   eax,sb_m_pos
778
	mov   eax,sb_m_pos
785
	mov   sb_m_pos_2,eax
779
	mov   sb_m_pos_2,eax
786
	jmp   .exit_sb
780
	jmp   .exit_sb
787
;*****************************************************************************
781
;*****************************************************************************
788
.down_sb:
782
.down_sb:
789
	cmp   sb_m_keys,dword 0
783
	cmp   sb_m_keys,dword 0
790
	je   .exit_sb
784
	je   .exit_sb
791
	
785
	
792
	mov   eax,sb_max_area
786
	mov   eax,sb_max_area
793
	mov   ebx,sb_ar_offset
787
	mov   ebx,sb_ar_offset
794
	sub   eax,sb_cur_area
788
	sub   eax,sb_cur_area
795
	push  eax
789
	push  eax
796
	sub   eax,ebx
790
	sub   eax,ebx
797
	cmp   sb_position,eax
791
	cmp   sb_position,eax
798
	pop   eax
792
	pop   eax
799
;	jae   .exit_sb
-
 
800
	jae   @f
793
	jae   @f
801
	
-
 
802
;	inc   dword sb_position
794
	
803
	add   sb_position,ebx
795
	add   sb_position,ebx
804
	jmp   .all_sb
796
	jmp   .all_sb
805
@@:
797
@@:
806
	mov   sb_position,eax
798
	mov   sb_position,eax
807
	xor   eax,eax
799
	xor   eax,eax
808
	mov   ax,sb_size_y
800
	mov   ax,sb_size_y
809
	sub   eax,sb_btn_high
801
	sub   eax,sb_btn_high
810
	sub   eax,sb_btn_high
802
	sub   eax,sb_btn_high
811
	sub   eax,sb_run_size
803
	sub   eax,sb_run_size
812
	mov   sb_position2,eax
804
	mov   sb_position2,eax
813
	jmp   .all_sb	
805
	jmp   .all_sb	
814
.exit_sb:	
806
.exit_sb:	
815
scroll_bar_exit
807
scroll_bar_exit
816
}
808
}
817
 
809
 
818
;*****************************************************************************
810
;*****************************************************************************
819
;*****************************************************************************
811
;*****************************************************************************
820
;*****************************************************************************
812
;*****************************************************************************
821
;*****************************************************************************
813
;*****************************************************************************
822
;*****************************************************************************
814
;*****************************************************************************
823
macro use_scroll_bar_horizontal
815
macro use_scroll_bar_horizontal
824
{
816
{
825
scroll_bar_horizontal:
817
scroll_bar_horizontal:
826
.draw:
818
.draw:
827
	pusha
819
	pusha
828
	mov   edi,dword [esp+36]
820
	mov   edi,dword [esp+36]
829
;	mov   sb_all_redraw,dword 1
-
 
830
	mov   sb_delta,word 0
821
	mov   sb_delta,word 0
831
	call  .draw_1
822
	call  .draw_1
832
	mov   sb_all_redraw,dword 0
823
	mov   sb_all_redraw,dword 0
833
scroll_bar_exit
824
scroll_bar_exit
834
.draw_1:
825
.draw_1:
835
	pusha
826
	pusha
836
;*********************************
827
;*********************************
837
	xor   eax,eax
828
	xor   eax,eax
838
	mov   ax,sb_size_x	;sb_size_y
829
	mov   ax,sb_size_x	;sb_size_y
839
	mov   edx,sb_btn_high
830
	mov   edx,sb_btn_high
840
	shl   edx,1
831
	shl   edx,1
841
	sub   eax,edx
832
	sub   eax,edx
842
	mov   sb_work_size,eax
833
	mov   sb_work_size,eax
843
;*********************************
834
;*********************************
844
	mov   eax,sb_work_size   ;sb_max_area
835
	mov   eax,sb_work_size   ;sb_max_area
845
	mov   ebx,sb_max_area
836
	mov   ebx,sb_max_area
846
	cmp   ebx,sb_cur_area
837
	cmp   ebx,sb_cur_area
847
	ja	@f
838
	ja	@f
848
 
839
 
849
	jmp   .no_size
840
	jmp   .no_size
850
 
841
 
851
@@: 
842
@@: 
852
	imul  eax,sb_cur_area
843
	imul  eax,sb_cur_area
853
	xor   edx,edx
844
	xor   edx,edx
854
	div   ebx
845
	div   ebx
855
	cmp   eax,10
846
	cmp   eax,10
856
	jae   @f
847
	jae   @f
857
	mov   eax,10
848
	mov   eax,10
858
@@:
849
@@:
859
.no_size:
850
.no_size:
860
	mov   sb_run_size,eax
851
	mov   sb_run_size,eax
861
;*********************************
852
;*********************************
862
	cmp   sb_delta,word 1
853
	cmp   sb_delta,word 1
863
	je	.@@_3
854
	je	.@@_3
864
	mov   eax,sb_work_size
855
	mov   eax,sb_work_size
865
	sub   eax,sb_run_size
856
	sub   eax,sb_run_size
866
	mov   ebx,sb_max_area
857
	mov   ebx,sb_max_area
867
	cmp   ebx,sb_cur_area
858
	cmp   ebx,sb_cur_area
868
	ja	@f
859
	ja	@f
869
	xor   eax,eax
860
	xor   eax,eax
870
	jmp   .@@_1
861
	jmp   .@@_1
871
@@:
862
@@:
872
	sub   ebx,sb_cur_area
863
	sub   ebx,sb_cur_area
873
	imul  eax,sb_position
864
	imul  eax,sb_position
874
	xor   edx,edx
865
	xor   edx,edx
875
	div   ebx
866
	div   ebx
876
.@@_1:
867
.@@_1:
877
	mov   sb_position2,eax
868
	mov   sb_position2,eax
878
	xor   edx,edx
869
	xor   edx,edx
879
	mov   dx,sb_size_x
870
	mov   dx,sb_size_x
880
	sub   edx,sb_btn_high
871
	sub   edx,sb_btn_high
881
	sub   edx,sb_btn_high
872
	sub   edx,sb_btn_high
882
	sub   edx,sb_run_size
873
	sub   edx,sb_run_size
883
	cmp   sb_position2,edx
874
	cmp   sb_position2,edx
884
	jbe   .@@_3
875
	jbe   .@@_3
885
	mov   sb_position2,edx
876
	mov   sb_position2,edx
886
.@@_3:
877
.@@_3:
887
;*********************************	
878
;*********************************	
888
	mov   ebx,sb_size_x
879
	mov   ebx,sb_size_x
889
	mov   ecx,sb_start_y
880
	mov   ecx,sb_start_y
890
	shl   ecx,16
881
	shl   ecx,16
891
	inc   ecx	
882
	inc   ecx	
892
	mov   edx,sb_line_col
883
	mov   edx,sb_line_col
893
	mov   eax,13
884
	mov   eax,13
894
	cmp  sb_all_redraw,dword 0
885
	cmp  sb_all_redraw,dword 0
895
	je   @f
886
	je   @f
896
	int   0x40   ; top extreme line
887
	int   0x40   ; top extreme line
897
@@:
888
@@:
898
	push  ecx
889
	push  ecx
899
	ror   ecx,16
890
	ror   ecx,16
900
	add   cx,sb_size_y
891
	add   cx,sb_size_y
901
	rol   ecx,16
892
	rol   ecx,16
902
	cmp  sb_all_redraw,dword 0
893
	cmp  sb_all_redraw,dword 0
903
	je   @f
894
	je   @f
904
	int   0x40   ; bottom extreme line
895
	int   0x40   ; bottom extreme line
905
@@:
896
@@:
906
	pop   ecx
897
	pop   ecx
907
 
898
 
908
	push  ebx
899
	push  ebx
909
	
900
	
910
	add   ecx,1 shl 16
901
	add   ecx,1 shl 16
911
	mov   cx,sb_size_y
902
	mov   cx,sb_size_y
912
	dec   ecx	
903
	dec   ecx	
913
	mov   bx,1
904
	mov   bx,1
914
	cmp  sb_all_redraw,dword 0
905
	cmp  sb_all_redraw,dword 0
915
	je   @f
906
	je   @f
916
	int   0x40   ; left button - extreme line
907
	int   0x40   ; left button - extreme line
917
@@:
908
@@:
918
	push  ebx
909
	push  ebx
919
	add   ebx,1 shl 16
910
	add   ebx,1 shl 16
920
	add   ebx,sb_btn_high
911
	add   ebx,sb_btn_high
921
	sub   ebx,2
912
	sub   ebx,2
922
	mov   edx,sb_frnt_col
913
	mov   edx,sb_frnt_col
923
	cmp  sb_all_redraw,dword 0
914
	cmp  sb_all_redraw,dword 0
924
	je   @f
915
	je   @f
925
	int   0x40   ; left  button filling
916
	int   0x40   ; left  button filling
926
;*********************************	
917
;*********************************	
927
draw_up_arrow_horizontal
918
draw_up_arrow_horizontal
928
;********************************* 
919
;********************************* 
929
@@:
920
@@:
930
	pop   ebx
921
	pop   ebx
931
	
922
	
932
	ror   ebx,16
923
	ror   ebx,16
933
	add   ebx,sb_btn_high  ;14 shl 16
924
	add   ebx,sb_btn_high  ;14 shl 16
934
	rol   ebx,16
925
	rol   ebx,16
935
	mov   edx,sb_line_col
926
	mov   edx,sb_line_col
936
	cmp  sb_all_redraw,dword 0
927
	cmp  sb_all_redraw,dword 0
937
	je   @f
928
	je   @f
938
	int   0x40   ;  left  button - right line
929
	int   0x40   ;  left  button - right line
939
@@:
930
@@:
940
	pop   ebx
931
	pop   ebx
941
;********************************* 
932
;********************************* 
942
	ror   ebx,16	
933
	ror   ebx,16	
943
	add   ebx,sb_btn_high  ;15 shl 16
934
	add   ebx,sb_btn_high  ;15 shl 16
944
	  inc   ebx
935
	  inc   ebx
945
	rol   ebx,16
936
	rol   ebx,16
946
	sub   ebx,sb_btn_high  ;30
937
	sub   ebx,sb_btn_high  ;30
947
	sub   ebx,sb_btn_high
938
	sub   ebx,sb_btn_high
948
	push  ebx
939
	push  ebx
949
	mov   bx,0
940
	mov   bx,0
950
	add   ebx,sb_position2
941
	add   ebx,sb_position2
951
	  dec   bx
942
	  dec   bx
952
	mov   eax,13
943
	mov   eax,13
953
	test  bx,0x8000
944
	test  bx,0x8000
954
	jnz   @f
945
	jnz   @f
955
	mov   edx,sb_bckg_col
946
	mov   edx,sb_bckg_col
956
	int   0x40	; left interval
947
	int   0x40	; left interval
957
@@:
948
@@:
958
;********************************* 
949
;********************************* 
959
	shr   ebx,16
950
	shr   ebx,16
960
	add   ebx,sb_position2
951
	add   ebx,sb_position2
961
	dec   ebx
952
	dec   ebx
962
	shl   ebx,16
953
	shl   ebx,16
963
	inc   ebx
954
	inc   ebx
964
	mov   edx,sb_line_col
955
	mov   edx,sb_line_col
965
	int   0x40	; runner - left extreme line
956
	int   0x40	; runner - left extreme line
966
	
957
	
967
	add   ebx,1 shl 16
958
	add   ebx,1 shl 16
968
	mov   bx,0
959
	mov   bx,0
969
	add   ebx,sb_run_size
960
	add   ebx,sb_run_size
970
	mov   sb_r_size_x,ebx
961
	mov   sb_r_size_x,ebx
971
	mov   sb_r_size_y,ecx
962
	mov   sb_r_size_y,ecx
972
	sub   ebx,2
963
	sub   ebx,2
973
	mov   edx,sb_frnt_col
964
	mov   edx,sb_frnt_col
974
	int   0x40   ; runner filling
965
	int   0x40   ; runner filling
975
;********************************* 
966
;********************************* 
976
draw_runner_center_horizontal
967
draw_runner_center_horizontal
977
;********************************* 
968
;********************************* 
978
	shr   ebx,16
969
	shr   ebx,16
979
	add   ebx,sb_run_size
970
	add   ebx,sb_run_size
980
	sub   ebx,2
971
	sub   ebx,2
981
	shl   ebx,16  
972
	shl   ebx,16  
982
	inc   ebx
973
	inc   ebx
983
	mov   edx,sb_line_col
974
	mov   edx,sb_line_col
984
	int   0x40   ; runner - bottom extreme line
975
	int   0x40   ; runner - bottom extreme line
985
	
976
	
986
	add   ebx,1 shl 16
977
	add   ebx,1 shl 16
987
	mov   bx,sb_start_x
978
	mov   bx,sb_start_x
988
	add   bx,sb_size_x
979
	add   bx,sb_size_x
989
	sub   ebx,sb_btn_high
980
	sub   ebx,sb_btn_high
990
	dec   ebx
981
	dec   ebx
991
	mov   eax,ebx
982
	mov   eax,ebx
992
	shr   eax,16
983
	shr   eax,16
993
	sub   bx,ax
984
	sub   bx,ax
994
	test  bx,0x8000
985
	test  bx,0x8000
995
	jnz   @f
986
	jnz   @f
996
	mov   edx,sb_bckg_col
987
	mov   edx,sb_bckg_col
997
	mov   eax,13
988
	mov   eax,13
998
	int   0x40   ; bottom interval
989
	int   0x40   ; bottom interval
999
@@:
990
@@:
1000
	pop   ebx	
991
	pop   ebx	
1001
;*********************************	
992
;*********************************	
1002
	mov   ax,bx
993
	mov   ax,bx
1003
	shr   ebx,16
994
	shr   ebx,16
1004
	add   bx,ax
995
	add   bx,ax
1005
	sub   ebx,2
996
	sub   ebx,2
1006
	shl   ebx,16
997
	shl   ebx,16
1007
	inc   ebx
998
	inc   ebx
1008
	mov   edx,sb_line_col
999
	mov   edx,sb_line_col
1009
	mov   eax,13
1000
	mov   eax,13
1010
	cmp  sb_all_redraw,dword 0
1001
	cmp  sb_all_redraw,dword 0
1011
	je   @f
1002
	je   @f
1012
	int   0x40	; bottom button - top line
1003
	int   0x40	; bottom button - top line
1013
@@:
1004
@@:
1014
	push  ebx
1005
	push  ebx
1015
	add   ebx,1 shl 16
1006
	add   ebx,1 shl 16
1016
	add   bx,sb_btn_high
1007
	add   bx,sb_btn_high
1017
	sub   ebx,2
1008
	sub   ebx,2
1018
	mov   edx,sb_frnt_col
1009
	mov   edx,sb_frnt_col
1019
	cmp  sb_all_redraw,dword 0
1010
	cmp  sb_all_redraw,dword 0
1020
	je   @f
1011
	je   @f
1021
	int   0x40   ; bottom button filling
1012
	int   0x40   ; bottom button filling
1022
;********************************* 
1013
;********************************* 
1023
draw_down_arrow_horizontal
1014
draw_down_arrow_horizontal
1024
;*********************************
1015
;*********************************
1025
@@: 
1016
@@: 
1026
	pop   ebx
1017
	pop   ebx
1027
	
1018
	
1028
	ror   ebx,16
1019
	ror   ebx,16
1029
	add   ebx,sb_btn_high  ;14 shl 16
1020
	add   ebx,sb_btn_high  ;14 shl 16
1030
	rol   ebx,16
1021
	rol   ebx,16
1031
	
1022
	
1032
	mov   edx,sb_line_col
1023
	mov   edx,sb_line_col
1033
	mov   bx,1
1024
	mov   bx,1
1034
	cmp  sb_all_redraw,dword 0
1025
	cmp  sb_all_redraw,dword 0
1035
	je   @f
1026
	je   @f
1036
	int   0x40   ; bottom button - extreme line
1027
	int   0x40   ; bottom button - extreme line
1037
@@:
1028
@@:
1038
	popa
1029
	popa
1039
	ret
1030
	ret
1040
;*****************************************************************************
1031
;*****************************************************************************
1041
; mouse event
1032
; mouse event
1042
;*****************************************************************************
1033
;*****************************************************************************
1043
.mouse:
1034
.mouse:
1044
	pusha
1035
	pusha
1045
	mov	 edi,dword [esp+36]
1036
	mov	 edi,dword [esp+36]
1046
	mcall 37,1
1037
	mcall 37,1
1047
	mov   sb_m_pos,eax
1038
	mov   sb_m_pos,eax
1048
	cmp   sb_m_pos_2,dword 0
1039
	cmp   sb_m_pos_2,dword 0
1049
	jne   @f
1040
	jne   @f
1050
	
1041
	
1051
	mov   sb_m_pos_2,eax	
1042
	mov   sb_m_pos_2,eax	
1052
@@:
1043
@@:
1053
	mcall 37,2
1044
	mcall 37,2
1054
	mov   sb_m_keys,eax	
1045
	mov   sb_m_keys,eax	
1055
 
1046
 
1056
	cmp   sb_m_keys,eax
1047
	cmp   sb_m_keys,eax
1057
	je	  @f
1048
	je	  @f
1058
	
1049
	
1059
	mov   sb_m_keys,eax
1050
	mov   sb_m_keys,eax
1060
 
1051
 
1061
	mov   sb_delta,dword 0
1052
	mov   sb_delta,dword 0
1062
	
1053
	
1063
	mov   eax,sb_m_pos
1054
	mov   eax,sb_m_pos
1064
	mov   sb_m_pos_2,eax
1055
	mov   sb_m_pos_2,eax
1065
	jmp   .continue_2
1056
	jmp   .continue_2
1066
	
1057
	
1067
@@:
1058
@@:
1068
	cmp   sb_m_keys,dword 0
1059
	cmp   sb_m_keys,dword 0
1069
	jne	 @f   ;.continue_2
1060
	jne	 @f
1070
	mov   eax,sb_m_pos
1061
	mov   eax,sb_m_pos
1071
	mov   sb_m_pos_2,eax
1062
	mov   sb_m_pos_2,eax
1072
	jmp   .correct_1	;.exit_sb
1063
	jmp   .correct_1	;.exit_sb
1073
@@:
1064
@@:
1074
	mov   sb_delta,word 1
1065
	mov   sb_delta,word 1
1075
 
1066
 
1076
.continue_2:
1067
.continue_2:
1077
	mov   eax,sb_m_pos
1068
	mov   eax,sb_m_pos
1078
	test  eax,0x80000000
1069
	test  eax,0x80000000
1079
	jnz   .exit_sb
1070
	jnz   .exit_sb
1080
	
1071
	
1081
	test  eax,0x8000
1072
	test  eax,0x8000
1082
	jnz   .exit_sb
1073
	jnz   .exit_sb
1083
	
1074
	
1084
	mov   ebx,eax
1075
	mov   ebx,eax
1085
	shr   eax,16   ; x position
1076
	shr   eax,16   ; x position
1086
	shl   ebx,16
1077
	shl   ebx,16
1087
	shr   ebx,16   ; y position
1078
	shr   ebx,16   ; y position
1088
 
1079
 
1089
	mov   cx,sb_start_x   ;y
1080
	mov   cx,sb_start_x   ;y
1090
	cmp   ax,cx
1081
	cmp   ax,cx
1091
	jb	.exit_sb
1082
	jb	.exit_sb
1092
	
1083
	
1093
	cmp   sb_delta2,word 0
1084
	cmp   sb_delta2,word 0
1094
	je	@f
1085
	je	@f
1095
	push  ecx
1086
	push  ecx
1096
	add   cx,sb_btn_high
1087
	add   cx,sb_btn_high
1097
	cmp   ax,cx
1088
	cmp   ax,cx
1098
	pop   ecx
1089
	pop   ecx
1099
	jb	.exit_sb
1090
	jb	.exit_sb
1100
	
1091
	
1101
@@:
1092
@@:
1102
	add   cx,sb_size_x	;y
1093
	add   cx,sb_size_x	;y
1103
	cmp   ax,cx
1094
	cmp   ax,cx
1104
	ja	.exit_sb
1095
	ja	.exit_sb
1105
 
1096
 
1106
	cmp   sb_delta2,word 0
1097
	cmp   sb_delta2,word 0
1107
	je	@f
1098
	je	@f
1108
	sub   cx,sb_btn_high
1099
	sub   cx,sb_btn_high
1109
	cmp   ax,cx
1100
	cmp   ax,cx
1110
	ja	.exit_sb
1101
	ja	.exit_sb
1111
	
1102
	
1112
@@:
1103
@@:
1113
	cmp   sb_delta2,word 1
1104
	cmp   sb_delta2,word 1
1114
	je	@f
1105
	je	@f
1115
	
1106
	
1116
	cmp   sb_m_keys,dword 0
1107
	cmp   sb_m_keys,dword 0
1117
	je	.exit_sb
1108
	je	.exit_sb
1118
	
1109
	
1119
	mov   cx,sb_start_y   ;x
1110
	mov   cx,sb_start_y   ;x
1120
	cmp   bx,cx
1111
	cmp   bx,cx
1121
	jb	.exit_sb
1112
	jb	.exit_sb
1122
	
1113
	
1123
	add   cx,sb_size_y	;x
1114
	add   cx,sb_size_y	;x
1124
	cmp   bx,cx
1115
	cmp   bx,cx
1125
	ja	.exit_sb
1116
	ja	.exit_sb
1126
	
1117
	
1127
	mov   cx,sb_r_start_x
1118
	mov   cx,sb_r_start_x
1128
	cmp   ax,cx
1119
	cmp   ax,cx
1129
	jb	.no_runner
1120
	jb	.no_runner
1130
	
1121
	
1131
	add   cx,sb_r_size_x
1122
	add   cx,sb_r_size_x
1132
	cmp   ax,cx
1123
	cmp   ax,cx
1133
	ja	.no_runner
1124
	ja	.no_runner
1134
 
1125
 
1135
	mov   sb_delta2,word 1
1126
	mov   sb_delta2,word 1
1136
@@:
1127
@@:
1137
	push  eax
1128
	push  eax
1138
	mov   eax,sb_m_pos
1129
	mov   eax,sb_m_pos
1139
	mov   ebx,sb_m_pos_2
1130
	mov   ebx,sb_m_pos_2
1140
	shr   eax,16
1131
	shr   eax,16
1141
	shr   ebx,16
1132
	shr   ebx,16
1142
	cmp   eax,ebx
1133
	cmp   eax,ebx
1143
	je	.correct  ;.exit_sb	
1134
	je	.correct	
1144
	
1135
	
1145
;	shl   eax,16
1136
;	shl   eax,16
1146
;	shr   eax,16
1137
;	shr   eax,16
1147
;	mov   ebx,sb_m_pos_2
1138
;	mov   ebx,sb_m_pos_2
1148
;	shl   ebx,16
1139
;	shl   ebx,16
1149
;	shr   ebx,16
1140
;	shr   ebx,16
1150
;	cmp   eax,ebx
1141
;	cmp   eax,ebx
1151
	jb   .sub
1142
	jb   .sub
1152
	
1143
	
1153
	sub   eax,ebx
1144
	sub   eax,ebx
1154
	mov   ebx,eax
1145
	mov   ebx,eax
1155
	add   sb_position2,ebx
1146
	add   sb_position2,ebx
1156
	xor   eax,eax
1147
	xor   eax,eax
1157
	mov   ax,sb_size_x	;y
1148
	mov   ax,sb_size_x	;y
1158
	sub   eax,sb_btn_high
1149
	sub   eax,sb_btn_high
1159
	sub   eax,sb_btn_high
1150
	sub   eax,sb_btn_high
1160
	sub   eax,sb_run_size
1151
	sub   eax,sb_run_size
1161
	cmp   sb_position2,eax
1152
	cmp   sb_position2,eax
1162
	jbe   @f
1153
	jbe   @f
1163
	
1154
	
1164
	mov   sb_position2,eax
1155
	mov   sb_position2,eax
1165
@@:
1156
@@:
1166
	mov   eax,sb_m_pos
1157
	mov   eax,sb_m_pos
1167
	mov   sb_m_pos_2,eax
1158
	mov   sb_m_pos_2,eax
1168
	pop   eax
1159
	pop   eax
1169
	call  .draw_1
1160
	call  .draw_1
1170
	jmp   .no_runner_1
1161
	jmp   .no_runner_1
1171
	
1162
	
1172
.correct:
1163
.correct:
1173
	pop   eax
1164
	pop   eax
1174
	jmp   .exit_sb
1165
	jmp   .exit_sb
1175
.correct_1:
1166
.correct_1:
1176
	mov   sb_delta,dword 0
1167
	mov   sb_delta,dword 0
1177
	jmp   .exit_sb
1168
	jmp   .exit_sb
1178
 
1169
 
1179
.sub:
1170
.sub:
1180
	sub   ebx,eax
1171
	sub   ebx,eax
1181
	sub   sb_position2,ebx
1172
	sub   sb_position2,ebx
1182
	test  sb_position2,dword 0x80000000
1173
	test  sb_position2,dword 0x80000000
1183
	jz	  @f
1174
	jz	  @f
1184
	
1175
	
1185
	mov   sb_position2,dword 0
1176
	mov   sb_position2,dword 0
1186
@@:
1177
@@:
1187
	mov   eax,sb_m_pos
1178
	mov   eax,sb_m_pos
1188
	mov   sb_m_pos_2,eax
1179
	mov   sb_m_pos_2,eax
1189
	pop   eax
1180
	pop   eax
1190
	call  .draw_1
1181
	call  .draw_1
1191
	jmp   .no_runner_1
1182
	jmp   .no_runner_1
1192
 
1183
 
1193
;*****************************************************************************
1184
;*****************************************************************************
1194
.no_runner:
1185
.no_runner:
1195
	mov   sb_delta,dword 0
1186
	mov   sb_delta,dword 0
1196
.no_runner_1:
1187
.no_runner_1:
1197
	xor   ecx,ecx
1188
	xor   ecx,ecx
1198
	mov   cx,sb_start_x   ;y
1189
	mov   cx,sb_start_x   ;y
1199
	add   cx,sb_btn_high   ;15
1190
	add   cx,sb_btn_high   ;15
1200
	cmp   sb_delta,word 1
1191
	cmp   sb_delta,word 1
1201
	je	.scroll_sb
1192
	je	.scroll_sb
1202
	
1193
	
1203
	cmp   ax,cx
1194
	cmp   ax,cx
1204
	ja	.scroll_sb
1195
	ja	.scroll_sb
1205
	
1196
	
1206
	cmp   sb_m_keys,dword 0
1197
	cmp   sb_m_keys,dword 0
1207
	je   .exit_sb
1198
	je   .exit_sb
1208
	
1199
	
1209
	mov   eax,sb_ar_offset
1200
	mov   eax,sb_ar_offset
1210
	cmp   sb_position,eax  ;dword 0
1201
	cmp   sb_position,eax  ;dword 0
1211
;	je	.exit_sb
-
 
1212
	jbe   @f
1202
	jbe   @f
1213
	
-
 
1214
;	dec   dword sb_position
1203
	
1215
	sub   sb_position,eax
1204
	sub   sb_position,eax
1216
	jmp   .all_sb
1205
	jmp   .all_sb
1217
@@:
1206
@@:
1218
	xor   eax,eax
1207
	xor   eax,eax
1219
	mov   sb_position,eax ;dword 0
1208
	mov   sb_position,eax ;dword 0
1220
	mov   sb_position2,eax  ;dword 0
1209
	mov   sb_position2,eax  ;dword 0
1221
	jmp   .all_sb
1210
	jmp   .all_sb
1222
;*****************************************************************************
1211
;*****************************************************************************
1223
.scroll_sb:
1212
.scroll_sb:
1224
	add   cx,sb_size_x	;y
1213
	add   cx,sb_size_x	;y
1225
	sub   cx,sb_btn_high
1214
	sub   cx,sb_btn_high
1226
	sub   cx,sb_btn_high
1215
	sub   cx,sb_btn_high
1227
	cmp   sb_delta,word 1
1216
	cmp   sb_delta,word 1
1228
	je	@f
1217
	je	@f
1229
	
1218
	
1230
	cmp   ax,cx
1219
	cmp   ax,cx
1231
	ja	.down_sb
1220
	ja	.down_sb
1232
	
1221
	
1233
@@:
1222
@@:
1234
	mov   ebx,sb_btn_high   ;16  ;15
1223
	mov   ebx,sb_btn_high   ;16  ;15
1235
;	inc   ebx
-
 
1236
	add   bx,sb_start_x	;y
1224
	add   bx,sb_start_x	;y
1237
	sub   cx,bx
1225
	sub   cx,bx
1238
	sub   ax,bx
1226
	sub   ax,bx
1239
	
1227
	
1240
.scroll_sb_1:	
1228
.scroll_sb_1:	
1241
	mov   ebx,sb_run_size
1229
	mov   ebx,sb_run_size
1242
;*****************************************************************************	
1230
;*****************************************************************************	
1243
	cmp   sb_delta,word 1
1231
	cmp   sb_delta,word 1
1244
	je	.continue
1232
	je	.continue
1245
	
1233
	
1246
@@:
1234
@@:
1247
	mov   edx,eax
1235
	mov   edx,eax
1248
;	sub   edx,sb_btn_high
-
 
-
 
1236
 
1249
	push  ebx
1237
	push  ebx
1250
	shr   ebx,1 
1238
	shr   ebx,1 
1251
	sub   edx,ebx
1239
	sub   edx,ebx
1252
	pop   ebx
1240
	pop   ebx
1253
	mov   sb_position2,edx
1241
	mov   sb_position2,edx
1254
	test  sb_position2,dword 0x80000000
1242
	test  sb_position2,dword 0x80000000
1255
	jz	 .test_1
1243
	jz	 .test_1
1256
	
1244
	
1257
	mov   sb_position2,dword 0
1245
	mov   sb_position2,dword 0
1258
	jmp   .continue
1246
	jmp   .continue
1259
	
1247
	
1260
.test_1: 
1248
.test_1: 
1261
	xor   edx,edx
1249
	xor   edx,edx
1262
	mov   dx,sb_size_x	 ;y
1250
	mov   dx,sb_size_x	 ;y
1263
	sub   edx,sb_btn_high
1251
	sub   edx,sb_btn_high
1264
	sub   edx,sb_btn_high
1252
	sub   edx,sb_btn_high
1265
	sub   edx,sb_run_size
1253
	sub   edx,sb_run_size
1266
	cmp   sb_position2,edx
1254
	cmp   sb_position2,edx
1267
	jbe   .continue
1255
	jbe   .continue
1268
	
1256
	
1269
	mov   sb_position2,edx
1257
	mov   sb_position2,edx
1270
;	jmp   .continue_1
-
 
1271
	
1258
 
1272
.continue:   
1259
.continue:   
1273
	mov   eax,sb_position2
1260
	mov   eax,sb_position2
1274
	sub   ecx,ebx
1261
	sub   ecx,ebx
1275
.continue_1:
1262
.continue_1:
1276
;*****************************************************************************  
1263
;*****************************************************************************  
1277
	mov   ebx,eax
1264
	mov   ebx,eax
1278
 
1265
 
1279
	mov   eax,sb_max_area
1266
	mov   eax,sb_max_area
1280
	cmp   eax,sb_cur_area
1267
	cmp   eax,sb_cur_area
1281
	ja	@f
1268
	ja	@f
1282
 
1269
 
1283
	xor   eax,eax
1270
	xor   eax,eax
1284
	inc   eax
1271
	inc   eax
1285
	mov   sb_position2,eax
1272
	mov   sb_position2,eax
1286
	jmp   .all_sb   ;.store_position
1273
	jmp   .all_sb
1287
@@:
1274
@@:
1288
	sub   eax,sb_cur_area
1275
	sub   eax,sb_cur_area
1289
	inc   eax
1276
	inc   eax
1290
	shl   eax,10
1277
	shl   eax,10
1291
	xor   edx,edx
1278
	xor   edx,edx
1292
	div   ecx
1279
	div   ecx
1293
	shl   edx,1
1280
	shl   edx,1
1294
	cmp   edx,ecx
1281
	cmp   edx,ecx
1295
	jb	@f
1282
	jb	@f
1296
	
1283
	
1297
	inc   eax
1284
	inc   eax
1298
	
1285
	
1299
@@:
1286
@@:
1300
	imul  eax,ebx
1287
	imul  eax,ebx
1301
	shr   eax,10
1288
	shr   eax,10
1302
	
1289
	
1303
	cmp   sb_position,eax
1290
	cmp   sb_position,eax
1304
	je	.exit_sb
1291
	je	.exit_sb
1305
	
1292
	
1306
	cmp   eax,0
1293
	cmp   eax,0
1307
	ja	@f
1294
	ja	@f
1308
	
1295
	
1309
	xor   eax,eax
1296
	xor   eax,eax
1310
	
1297
	
1311
@@:
1298
@@:
1312
.store_position:
1299
.store_position:
1313
	mov   sb_position,eax
1300
	mov   sb_position,eax
1314
.all_sb:
1301
.all_sb:
1315
	mov   sb_redraw,dword 1
1302
	mov   sb_redraw,dword 1
1316
	call  .draw_1
1303
	call  .draw_1
1317
	mov   eax,sb_m_pos
1304
	mov   eax,sb_m_pos
1318
	mov   sb_m_pos_2,eax
1305
	mov   sb_m_pos_2,eax
1319
	jmp   .exit_sb
1306
	jmp   .exit_sb
1320
;*****************************************************************************
1307
;*****************************************************************************
1321
.down_sb:
1308
.down_sb:
1322
	cmp   sb_m_keys,dword 0
1309
	cmp   sb_m_keys,dword 0
1323
	je   .exit_sb
1310
	je   .exit_sb
1324
	
1311
	
1325
	mov   eax,sb_max_area
1312
	mov   eax,sb_max_area
1326
	mov   ebx,sb_ar_offset
1313
	mov   ebx,sb_ar_offset
1327
	sub   eax,sb_cur_area
1314
	sub   eax,sb_cur_area
1328
	push  eax
1315
	push  eax
1329
	sub   eax,ebx
1316
	sub   eax,ebx
1330
	cmp   sb_position,eax
1317
	cmp   sb_position,eax
1331
	pop   eax
1318
	pop   eax
1332
;	jae   .exit_sb
-
 
1333
	jae   @f
1319
	jae   @f
1334
	
-
 
1335
;	inc   dword sb_position
1320
	
1336
	add   sb_position,ebx
1321
	add   sb_position,ebx
1337
	jmp   .all_sb
1322
	jmp   .all_sb
1338
@@:
1323
@@:
1339
	mov   sb_position,eax
1324
	mov   sb_position,eax
1340
	xor   eax,eax
1325
	xor   eax,eax
1341
	mov   ax,sb_size_x
1326
	mov   ax,sb_size_x
1342
	sub   eax,sb_btn_high
1327
	sub   eax,sb_btn_high
1343
	sub   eax,sb_btn_high
1328
	sub   eax,sb_btn_high
1344
	sub   eax,sb_run_size
1329
	sub   eax,sb_run_size
1345
	mov   sb_position2,eax
1330
	mov   sb_position2,eax
1346
	jmp   .all_sb
1331
	jmp   .all_sb
1347
.exit_sb:
1332
.exit_sb:
1348
scroll_bar_exit
1333
scroll_bar_exit
1349
}
1334
}