Subversion Repositories Kolibri OS

Rev

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

Rev 2697 Rev 3013
1
;********************************
1
;********************************
2
;*                              *
2
;*                              *
3
;*     DESKTOP ICON MANAGER     *
3
;*     DESKTOP ICON MANAGER     *
4
;*                              *
4
;*                              *
5
;*  Compile with flat assembler *
5
;*  Compile with flat assembler *
6
;*                              *
6
;*                              *
7
;********************************
7
;********************************
8
; version:	3.11
8
; version:	3.11
9
; last update:  28/05/2012
9
; last update:  28/05/2012
10
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
10
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
11
; changes:      Fixed crash when trying to select some of the icons.
11
; changes:      Fixed crash when trying to select some of the icons.
12
;               (bug 000013)
12
;               (bug 000013)
13
;---------------------------------------------------------------------
13
;---------------------------------------------------------------------
14
; version:	3.10
14
; version:	3.10
15
; last update:  03/04/2012
15
; last update:  03/04/2012
16
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
16
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
17
; changes:      Drawing selection rectangle.
17
; changes:      Drawing selection rectangle.
18
;               Using new kernel function: 15.9
18
;               Using new kernel function: 15.9
19
;---------------------------------------------------------------------
19
;---------------------------------------------------------------------
20
; version:	3.01
20
; version:	3.01
21
; last update:  02/04/2012
21
; last update:  02/04/2012
22
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
22
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
23
; changes:      Fix for previous revision - not drawed icons after
23
; changes:      Fix for previous revision - not drawed icons after
24
;               startup in certain cases.
24
;               startup in certain cases.
25
;---------------------------------------------------------------------
25
;---------------------------------------------------------------------
26
; version:	3.00
26
; version:	3.00
27
; last update:  02/04/2012
27
; last update:  02/04/2012
28
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
28
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
29
; changes:      Program use only 2 threads: draw and mouse
29
; changes:      Program use only 2 threads: draw and mouse
30
;               Using new kernel functions: 25, 34, 15.8, 4 (redirect).
30
;               Using new kernel functions: 25, 34, 15.8, 4 (redirect).
31
;               Using PNG icons with transparent.
31
;               Using PNG icons with transparent.
32
;---------------------------------------------------------------------
32
;---------------------------------------------------------------------
33
; version:	2.11
33
; version:	2.11
34
; last update:  19/03/2012
34
; last update:  19/03/2012
35
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
35
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
36
; changes:      The program uses only 140 Kb memory is now.
36
; changes:      The program uses only 140 Kb memory is now.
37
;               Some speedup.
37
;               Some speedup.
38
;---------------------------------------------------------------------
38
;---------------------------------------------------------------------
39
; version:	2.1
39
; version:	2.1
40
; last update:  17/03/2012
40
; last update:  17/03/2012
41
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
41
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
42
; changes:      Global optimization! The program uses
42
; changes:      Global optimization! The program uses
43
;               only 161 KB of memory instead of 603 kb is now.
43
;               only 161 KB of memory instead of 603 kb is now.
44
;---------------------------------------------------------------------
44
;---------------------------------------------------------------------
45
; version:	2.02
45
; version:	2.02
46
; last update:  15/03/2012
46
; last update:  15/03/2012
47
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
47
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
48
; changes:      some optimisations and code refactoring
48
; changes:      some optimisations and code refactoring
49
;---------------------------------------------------------------------
49
;---------------------------------------------------------------------
50
; version:	2.01
50
; version:	2.01
51
; last update:  27/09/2011
51
; last update:  27/09/2011
52
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
52
; changed by:   Marat Zakiyanov aka Mario79, aka Mario
53
; changes:      deactivate the window after click
53
; changes:      deactivate the window after click
54
;              (working to kernel r.2244 and above)
54
;              (working to kernel r.2244 and above)
55
;---------------------------------------------------------------------
55
;---------------------------------------------------------------------
56
; Many fix's and changes created by:
56
; Many fix's and changes created by:
57
;               Halyavin, Diamond, Heavyiron, 
57
;               Halyavin, Diamond, Heavyiron, 
58
;               SPraid, Dunkaist
58
;               SPraid, Dunkaist
59
;---------------------------------------------------------------------
59
;---------------------------------------------------------------------
60
; version:	2.00
60
; version:	2.00
61
; last update:  22/02/2005
61
; last update:  22/02/2005
62
; changed by:   Willow and Mario79
62
; changed by:   Willow and Mario79
63
; changes:      modified for work with new multi-thread ICON.
63
; changes:      modified for work with new multi-thread ICON.
64
;******************************************************************************
64
;******************************************************************************
65
ICON_SIZE equ 32*32*4
65
ICON_SIZE equ 32*32*4
66
REC_SIZE equ 80
66
REC_SIZE equ 80
67
ICONS_DAT equ '/sys/icons.dat'
67
ICONS_DAT equ '/sys/icons.dat'
68
ICON_APP equ '/sys/ICON'
68
ICON_APP equ '/sys/ICON'
69
ICON_STRIP equ '/rd/1/iconstrp.png'
69
ICON_STRIP equ '/rd/1/iconstrp.png'
70
;------------------------------------------------------------------------------
70
;------------------------------------------------------------------------------
71
	use32
71
	use32
72
	org 0x0
72
	org 0x0
73
	db 'MENUET01'	; 8 byte id
73
	db 'MENUET01'	; 8 byte id
74
	dd 0x01		; header version
74
	dd 0x01		; header version
75
	dd START	; start of code
75
	dd START	; start of code
76
	dd IM_END	; size of image
76
	dd IM_END	; size of image
77
	dd I_END	; memory for app
77
	dd I_END	; memory for app
78
	dd stack_area	; esp
78
	dd stack_area	; esp
79
	dd I_Param	; boot parameters
79
	dd I_Param	; boot parameters
80
	dd path		; path
80
	dd path		; path
81
;------------------------------------------------------------------------------
81
;------------------------------------------------------------------------------
82
include 'lang.inc'
82
include 'lang.inc'
83
include '../../../macros.inc'
83
include '../../../macros.inc'
84
include '../../../develop/libraries/box_lib/load_lib.mac'
84
include '../../../develop/libraries/box_lib/load_lib.mac'
85
;include 'debug.inc'
85
;include '../../../debug.inc'
86
;------------------------------------------------------------------------------
86
;------------------------------------------------------------------------------
87
        @use_library    ;use load lib macros
87
        @use_library    ;use load lib macros
88
;------------------------------------------------------------------------------
88
;------------------------------------------------------------------------------
89
START:		; start of execution
89
START:		; start of execution
90
	mcall	68,11
90
	mcall	68,11
91
;---------------------------------------------------------------------	
91
;---------------------------------------------------------------------	
92
load_libraries l_libs_start,end_l_libs
92
load_libraries l_libs_start,end_l_libs
93
	test	eax,eax
93
	test	eax,eax
94
	jnz	close
94
	jnz	close
95
	
95
	
96
; unpack deflate
96
; unpack deflate
97
	mov	eax,[unpack_DeflateUnpack2]
97
	mov	eax,[unpack_DeflateUnpack2]
98
	mov	[deflate_unpack],eax
98
	mov	[deflate_unpack],eax
99
;---------------------------------------------------------------------
99
;---------------------------------------------------------------------
100
; get size of file ICONSTRP.PNG
100
; get size of file ICONSTRP.PNG
101
	mcall	70,finfo
101
	mcall	70,finfo
102
	test	eax,eax
102
	test	eax,eax
103
	jnz	close
103
	jnz	close
104
; get memory for ICONSTRP.PNG
104
; get memory for ICONSTRP.PNG
105
	mov	ecx,[procinfo+32]
105
	mov	ecx,[procinfo+32]
106
	mov	[finfo.size],ecx
106
	mov	[finfo.size],ecx
107
	mov	[img_size],ecx
107
	mov	[img_size],ecx
108
	mcall	68,12
108
	mcall	68,12
109
	mov	[finfo.point],eax
109
	mov	[finfo.point],eax
110
	mov	[image_file],eax
110
	mov	[image_file],eax
111
; load ICONSTRP.PNG
111
; load ICONSTRP.PNG
112
	mov	[finfo],dword 0
112
	mov	[finfo],dword 0
113
	mcall	70,finfo
113
	mcall	70,finfo
114
	test	eax,eax
114
	test	eax,eax
115
	jnz	close
115
	jnz	close
116
; convert PNG to RAW
116
; convert PNG to RAW
117
	xor	eax,eax
117
	xor	eax,eax
118
	mov	[return_code],eax
118
	mov	[return_code],eax
119
 
119
 
120
	push	image_file
120
	push	image_file
121
	call	[cnv_png_import.Start]
121
	call	[cnv_png_import.Start]
122
 
122
 
123
	mov	eax,[raw_pointer]
123
	mov	eax,[raw_pointer]
124
	mov	ebx,[eax+32]
124
	mov	ebx,[eax+32]
125
	mov	[strip_file_size],ebx
125
	mov	[strip_file_size],ebx
126
	mov	eax,[eax+28]
126
	mov	eax,[eax+28]
127
	add	eax,[raw_pointer]
127
	add	eax,[raw_pointer]
128
	mov	[strip_file],eax
128
	mov	[strip_file],eax
129
; back memeory to system
129
; back memeory to system
130
	mcall	68,13,[finfo.point]
130
	mcall	68,13,[finfo.point]
131
	
131
	
132
	mov	eax,[raw_pointer]
132
	mov	eax,[raw_pointer]
133
	mov	eax,[eax+8]
133
	mov	eax,[eax+8]
134
	shr	eax,5
134
	shr	eax,5
135
	mov	[icon_count],eax
135
	mov	[icon_count],eax
136
 
136
 
137
	and	eax,0x7
137
	and	eax,0x7
138
	mov	[cur_band_compensation],eax
138
	mov	[cur_band_compensation],eax
139
; load ICON.DAT
139
; load ICON.DAT
140
	call	load_ic
140
	call	load_ic
141
boot_str:
141
boot_str:
142
	cmp	[I_Param],dword 'BOOT'
142
	cmp	[I_Param],dword 'BOOT'
143
	je	START2
143
	je	START2
144
;------------------------------------------------------------------------------	
144
;------------------------------------------------------------------------------	
145
; ICON EDITOR MODE - START1 entering label
145
; ICON EDITOR MODE - START1 entering label
146
;------------------------------------------------------------------------------	
146
;------------------------------------------------------------------------------	
147
START1:
147
START1:
148
	call	load_icon_list
148
	call	load_icon_list
149
;------------------------------------------------------------------------------
149
;------------------------------------------------------------------------------
150
align 4	
150
align 4	
151
red:
151
red:
152
	call	draw_window	; at first, draw the window
152
	call	draw_window	; at first, draw the window
153
	mov	esi,[current_icon]
153
	mov	esi,[current_icon]
154
	jmp	band
154
	jmp	band
155
;------------------------------------------------------------------------------
155
;------------------------------------------------------------------------------
156
align 4
156
align 4
157
still:
157
still:
158
	mcall	10	; wait here for event
158
	mcall	10	; wait here for event
159
	dec	eax	; redraw request ?
159
	dec	eax	; redraw request ?
160
	jz	red
160
	jz	red
161
	
161
	
162
	dec	eax	; key in buffer ?
162
	dec	eax	; key in buffer ?
163
	jz	key
163
	jz	key
164
;------------------------------------------------------------------------------
164
;------------------------------------------------------------------------------
165
align 4
165
align 4
166
button:
166
button:
167
	mcall	17	; get id
167
	mcall	17	; get id
168
	shr	eax,8
168
	shr	eax,8
169
 
169
 
170
	cmp	eax,1	; button id=1 ?
170
	cmp	eax,1	; button id=1 ?
171
	je	close
171
	je	close
172
	
172
	
173
	mov	esi,[current_icon]
173
	mov	esi,[current_icon]
174
	add	esi,12
174
	add	esi,12
175
	mov	ebx,[cur_band]
175
	mov	ebx,[cur_band]
176
	
176
	
177
	cmp	eax,11
177
	cmp	eax,11
178
	jb	@f
178
	jb	@f
179
	cmp	eax,13
179
	cmp	eax,13
180
	ja	@f
180
	ja	@f
181
	call	read_string
181
	call	read_string
182
	jmp	still
182
	jmp	still
183
;--------------------------------------
183
;--------------------------------------
184
align 4
184
align 4
185
@@:
185
@@:
186
	cmp	eax,21	; apply changes
186
	cmp	eax,21	; apply changes
187
	je	apply
187
	je	apply
188
	
188
	
189
	cmp	eax,22		; user pressed the 'add icon' button
189
	cmp	eax,22		; user pressed the 'add icon' button
190
	je	add_icon
190
	je	add_icon
191
	
191
	
192
	cmp	eax,23	; user pressed the remove icon button
192
	cmp	eax,23	; user pressed the remove icon button
193
	je	remove_icon
193
	je	remove_icon
194
 
194
 
195
	
195
	
196
	cmp	eax,30	; left arrow to icons bar
196
	cmp	eax,30	; left arrow to icons bar
197
	je	arrow.left
197
	je	arrow.left
198
	
198
	
199
	cmp	eax,31	; right arrow to icons bar
199
	cmp	eax,31	; right arrow to icons bar
200
	je	arrow.right
200
	je	arrow.right
201
	
201
	
202
	cmp	eax,32
202
	cmp	eax,32
203
	je	ico
203
	je	ico
204
 
204
 
205
	cmp	eax,40	; user pressed button for icon position
205
	cmp	eax,40	; user pressed button for icon position
206
	jae	press_button_for_icon_position
206
	jae	press_button_for_icon_position
207
	
207
	
208
	jmp	still
208
	jmp	still
209
;------------------------------------------------------------------------------
209
;------------------------------------------------------------------------------
210
align 4
210
align 4
211
arrow:
211
arrow:
212
.right:
212
.right:
213
 
213
 
214
	mov	eax,[icon_count]
214
	mov	eax,[icon_count]
215
	sub	eax,8
215
	sub	eax,8
216
	cmp	ebx,eax
216
	cmp	ebx,eax
217
	jae	still	;.drwic2
217
	jae	still	;.drwic2
218
 
218
 
219
	add	ebx,1
219
	add	ebx,1
220
	jmp	.drwic2
220
	jmp	.drwic2
221
;--------------------------------------
221
;--------------------------------------
222
align 4
222
align 4
223
.left:
223
.left:
224
	test	ebx,ebx
224
	test	ebx,ebx
225
	jz	still
225
	jz	still
226
 
226
 
227
	sub	ebx,1
227
	sub	ebx,1
228
;--------------------------------------
228
;--------------------------------------
229
align 4
229
align 4
230
.drwic2:
230
.drwic2:
231
	mov	[cur_band],ebx
231
	mov	[cur_band],ebx
232
;--------------------------------------
232
;--------------------------------------
233
align 4
233
align 4
234
.drwic1:
234
.drwic1:
235
	call	draw_icon
235
	call	draw_icon
236
	jmp	still
236
	jmp	still
237
;------------------------------------------------------------------------------
237
;------------------------------------------------------------------------------
238
align 4
238
align 4
239
ico:
239
ico:
240
	push	ebx
240
	push	ebx
241
	mcall	37,1
241
	mcall	37,1
242
	pop	ebx
242
	pop	ebx
243
	shr	eax,16
243
	shr	eax,16
244
	sub	eax,33-19
244
	sub	eax,33-19
245
	mov	edi,34
245
	mov	edi,34
246
	xor	edx,edx
246
	xor	edx,edx
247
	div	edi
247
	div	edi
248
	lea	ecx,[ebx+eax]
248
	lea	ecx,[ebx+eax]
249
	cmp	ecx,[icon_count]
249
	cmp	ecx,[icon_count]
250
	jae	still
250
	jae	still
251
 
251
 
252
	mov	ecx,eax
252
	mov	ecx,eax
253
	add	eax,ebx
253
	add	eax,ebx
254
	call	itoa
254
	call	itoa
255
	jmp	arrow.drwic1
255
	jmp	arrow.drwic1
256
;------------------------------------------------------------------------------
256
;------------------------------------------------------------------------------
257
align 4 
257
align 4 
258
apply:
258
apply:
259
	; (1) save list
259
	; (1) save list
260
	mov	ebx,finfo
260
	mov	ebx,finfo
261
	mov	dword[ebx],2
261
	mov	dword[ebx],2
262
	mov	edx,REC_SIZE
262
	mov	edx,REC_SIZE
263
	imul	edx,dword [icons]
263
	imul	edx,dword [icons]
264
	mov	[ebx+12],edx
264
	mov	[ebx+12],edx
265
	mov	esi,iconlst
265
	mov	esi,iconlst
266
	call	lst_path
266
	call	lst_path
267
	mcall	70
267
	mcall	70
268
	; (2) terminate all icons
268
	; (2) terminate all icons
269
	or	ecx,-1
269
	or	ecx,-1
270
	mcall	9,procinfo
270
	mcall	9,procinfo
271
	mov	edi,[ebx+30]
271
	mov	edi,[ebx+30]
272
;--------------------------------------
272
;--------------------------------------
273
align 4
273
align 4
274
newread2:
274
newread2:
275
	mov	esi,1
275
	mov	esi,1
276
;--------------------------------------
276
;--------------------------------------
277
align 4
277
align 4
278
newread:
278
newread:
279
	inc	esi
279
	inc	esi
280
	mov	ecx,esi
280
	mov	ecx,esi
281
	mcall	9,procinfo
281
	mcall	9,procinfo
282
 
282
 
283
	cmp	edi,[ebx+30]
283
	cmp	edi,[ebx+30]
284
	je	newread
284
	je	newread
285
 
285
 
286
	cmp	esi,eax
286
	cmp	esi,eax
287
	jg	.apply_changes
287
	jg	.apply_changes
288
 
288
 
289
	mov	eax,[ebx+10]
289
	mov	eax,[ebx+10]
290
	and	eax,not 20202020h
290
	and	eax,not 20202020h
291
	cmp	eax,'@ICO'
291
	cmp	eax,'@ICO'
292
	jz	@f
292
	jz	@f
293
	cmp	eax,'ICON'
293
	cmp	eax,'ICON'
294
	jne	newread
294
	jne	newread
295
;--------------------------------------
295
;--------------------------------------
296
align 4
296
align 4
297
@@:
297
@@:
298
	xor	eax,eax
298
	xor	eax,eax
299
	cmp	eax,[ebx+42]
299
	cmp	eax,[ebx+42]
300
	jne	newread
300
	jne	newread
301
 
301
 
302
	cmp	eax,[ebx+46]
302
	cmp	eax,[ebx+46]
303
	jne	newread
303
	jne	newread
304
 
304
 
305
	mov	ecx,esi
305
	mov	ecx,esi
306
	mcall	18,2
306
	mcall	18,2
307
 
307
 
308
	jmp	newread2
308
	jmp	newread2
309
;--------------------------------------
309
;--------------------------------------
310
align 4
310
align 4
311
.apply_changes:
311
.apply_changes:
312
	mov	ebx, finfo_start
312
	mov	ebx, finfo_start
313
	mov	dword [ebx+8], boot_str+6
313
	mov	dword [ebx+8], boot_str+6
314
	mov	esi, iconname
314
	mov	esi, iconname
315
	call	lst_path
315
	call	lst_path
316
	mcall	70
316
	mcall	70
317
	mcall	68,1
317
	mcall	68,1
318
	mcall	15,3
318
	mcall	15,3
319
	jmp	still
319
	jmp	still
320
;------------------------------------------------------------------------------
320
;------------------------------------------------------------------------------
321
align 4
321
align 4
322
add_icon:
322
add_icon:
323
	mov	ebx,24*65536+250+8*14
323
	mov	ebx,24*65536+250+8*14
324
	mcall	4,,0xc0ff0000,add_text,,0xffffff
324
	mcall	4,,0xc0ff0000,add_text,,0xffffff
325
 
325
 
326
	mcall	10
326
	mcall	10
327
	cmp	eax,3
327
	cmp	eax,3
328
	jne	still
328
	jne	still
329
 
329
 
330
	mcall	17
330
	mcall	17
331
	shr	eax,8
331
	shr	eax,8
332
	cmp	eax,40
332
	cmp	eax,40
333
	jb	no_f
333
	jb	no_f
334
	mov	edi,eax
334
	mov	edi,eax
335
	sub	eax,40
335
	sub	eax,40
336
	
336
	
337
	xor	edx,edx		; bcd -> 10
337
	xor	edx,edx		; bcd -> 10
338
	mov	ebx,16
338
	mov	ebx,16
339
	div	ebx
339
	div	ebx
340
; multiply x10
340
; multiply x10
341
	shl	eax,1		; multiply x2
341
	shl	eax,1		; multiply x2
342
	lea	eax,[eax+eax*4] ; multiply x5
342
	lea	eax,[eax+eax*4] ; multiply x5
343
	add	eax,edx
343
	add	eax,edx
344
	
344
	
345
	mov	ebx,eax
345
	mov	ebx,eax
346
	add	ebx,icons_reserved
346
	add	ebx,icons_reserved
347
	cmp	[ebx],byte 'x'
347
	cmp	[ebx],byte 'x'
348
	je	no_f
348
	je	no_f
349
	mov	[ebx],byte 'x'
349
	mov	[ebx],byte 'x'
350
	
350
	
351
	mov	[cur_btn],edi
351
	mov	[cur_btn],edi
352
	xor	edx,edx
352
	xor	edx,edx
353
	mov	ebx,10
353
	mov	ebx,10
354
	div	ebx
354
	div	ebx
355
	add	eax,65
355
	add	eax,65
356
	add	edx,65
356
	add	edx,65
357
	mov	[icon_default+0],dl
357
	mov	[icon_default+0],dl
358
	mov	[icon_default+1],al
358
	mov	[icon_default+1],al
359
	
359
	
360
	inc	dword [icons]
360
	inc	dword [icons]
361
	mov	edi,[icons]
361
	mov	edi,[icons]
362
	dec	edi
362
	dec	edi
363
	imul	edi,REC_SIZE
363
	imul	edi,REC_SIZE
364
	add	edi,icon_data
364
	add	edi,icon_data
365
	
365
	
366
	mov	[current_icon],edi
366
	mov	[current_icon],edi
367
 
367
 
368
	mov	esi,icon_default
368
	mov	esi,icon_default
369
	mov	ecx,REC_SIZE
369
	mov	ecx,REC_SIZE
370
	cld
370
	cld
371
	rep	movsb
371
	rep	movsb
372
	mov	esi,[current_icon]
372
	mov	esi,[current_icon]
373
	jmp	band
373
	jmp	band
374
;--------------------------------------
374
;--------------------------------------
375
align 4
375
align 4
376
no_f:
376
no_f:
377
	call	draw_btns	;draw_window
377
	call	draw_btns	;draw_window
378
	jmp	still
378
	jmp	still
379
;------------------------------------------------------------------------------
379
;------------------------------------------------------------------------------
380
align 4
380
align 4
381
remove_icon:
381
remove_icon:
382
	mov	ebx,24*65536+250+8*14
382
	mov	ebx,24*65536+250+8*14
383
	mcall	4,,0xc0ff0000,rem_text,,0xffffff
383
	mcall	4,,0xc0ff0000,rem_text,,0xffffff
384
	
384
	
385
	mcall	10
385
	mcall	10
386
	cmp	eax,3
386
	cmp	eax,3
387
	jne	no_f
387
	jne	no_f
388
 
388
 
389
	mcall	17
389
	mcall	17
390
	shr	eax,8
390
	shr	eax,8
391
	cmp	eax,40
391
	cmp	eax,40
392
	jb	red
392
	jb	red
393
	sub	eax,40
393
	sub	eax,40
394
	
394
	
395
	xor	edx,edx
395
	xor	edx,edx
396
	mov	ebx,16
396
	mov	ebx,16
397
	div	ebx
397
	div	ebx
398
; multiply x10
398
; multiply x10
399
	shl	eax,1		; multiply x2
399
	shl	eax,1		; multiply x2
400
	lea	eax,[eax+eax*4] ; multiply x5
400
	lea	eax,[eax+eax*4] ; multiply x5
401
	add	eax,edx
401
	add	eax,edx
402
	
402
	
403
	mov	ebx,eax
403
	mov	ebx,eax
404
	add	ebx,icons_reserved
404
	add	ebx,icons_reserved
405
	cmp	[ebx],byte 'x'
405
	cmp	[ebx],byte 'x'
406
	jne	red
406
	jne	red
407
	mov	[ebx],byte ' '
407
	mov	[ebx],byte ' '
408
	
408
	
409
	xor	edx,edx
409
	xor	edx,edx
410
	mov	ebx,10
410
	mov	ebx,10
411
	div	ebx
411
	div	ebx
412
	shl	eax,8
412
	shl	eax,8
413
	mov	al,dl
413
	mov	al,dl
414
	
414
	
415
	add	eax,65*256+65
415
	add	eax,65*256+65
416
	
416
	
417
	mov	esi,icon_data
417
	mov	esi,icon_data
418
	mov	edi,REC_SIZE
418
	mov	edi,REC_SIZE
419
	imul	edi,[icons]
419
	imul	edi,[icons]
420
	add	edi,icon_data
420
	add	edi,icon_data
421
;--------------------------------------
421
;--------------------------------------
422
align 4 
422
align 4 
423
news:
423
news:
424
	cmp	word [esi],ax
424
	cmp	word [esi],ax
425
	je	foundi
425
	je	foundi
426
	add	esi,REC_SIZE
426
	add	esi,REC_SIZE
427
	cmp	esi,edi
427
	cmp	esi,edi
428
	jb	news
428
	jb	news
429
	jmp	red
429
	jmp	red
430
;--------------------------------------
430
;--------------------------------------
431
align 4
431
align 4
432
foundi:
432
foundi:
433
	mov	ecx,edi
433
	mov	ecx,edi
434
	sub	ecx,esi
434
	sub	ecx,esi
435
	
435
	
436
	mov	edi,esi
436
	mov	edi,esi
437
	add	esi,REC_SIZE
437
	add	esi,REC_SIZE
438
	
438
	
439
	cld
439
	cld
440
	rep	movsb
440
	rep	movsb
441
	
441
	
442
	dec	[icons]
442
	dec	[icons]
443
	
443
	
444
	mov	eax,icon_data
444
	mov	eax,icon_data
445
	mov	[current_icon],eax
445
	mov	[current_icon],eax
446
	movzx	ebx,word[eax]
446
	movzx	ebx,word[eax]
447
	sub	bx,'AA'
447
	sub	bx,'AA'
448
	shl	bl,4
448
	shl	bl,4
449
	shr	ebx,4
449
	shr	ebx,4
450
	add	ebx,40
450
	add	ebx,40
451
	mov	[cur_btn],ebx
451
	mov	[cur_btn],ebx
452
	jmp	red
452
	jmp	red
453
;------------------------------------------------------------------------------
453
;------------------------------------------------------------------------------
454
align 4
454
align 4
455
press_button_for_icon_position:
455
press_button_for_icon_position:
456
	mov	edi,eax
456
	mov	edi,eax
457
	sub	eax,40
457
	sub	eax,40
458
	mov	edx,eax
458
	mov	edx,eax
459
	shl	eax,4
459
	shl	eax,4
460
	and	edx,0xf
460
	and	edx,0xf
461
	mov	dh,ah
461
	mov	dh,ah
462
	add	edx,65*256+65
462
	add	edx,65*256+65
463
	mov	esi,icon_data
463
	mov	esi,icon_data
464
	mov	ecx,[icons]
464
	mov	ecx,[icons]
465
	cld
465
	cld
466
;--------------------------------------
466
;--------------------------------------
467
align 4
467
align 4
468
findl1:
468
findl1:
469
	cmp	dx,[esi]
469
	cmp	dx,[esi]
470
	je	foundl1
470
	je	foundl1
471
	add	esi,REC_SIZE
471
	add	esi,REC_SIZE
472
	loop	findl1
472
	loop	findl1
473
	jmp	still
473
	jmp	still
474
;--------------------------------------
474
;--------------------------------------
475
align 4
475
align 4
476
foundl1:
476
foundl1:
477
	mov	[current_icon],esi
477
	mov	[current_icon],esi
478
	mov	[cur_btn],edi
478
	mov	[cur_btn],edi
479
;--------------------------------------
479
;--------------------------------------
480
align 4
480
align 4
481
band:
481
band:
482
	add	esi,12
482
	add	esi,12
483
	call	ASCII_to_icon_number
483
	call	ASCII_to_icon_number
484
;	and	eax,0xfffff8
484
;	and	eax,0xfffff8
485
	cmp	eax,[cur_band_compensation]
485
	cmp	eax,[cur_band_compensation]
486
	jb	@f
486
	jb	@f
487
 
487
 
488
	sub	eax,[cur_band_compensation]
488
	sub	eax,[cur_band_compensation]
489
;--------------------------------------
489
;--------------------------------------
490
align 4
490
align 4
491
@@:
491
@@:
492
	mov	[cur_band],eax
492
	mov	[cur_band],eax
493
	call	draw_btns
493
	call	draw_btns
494
	jmp	still
494
	jmp	still
495
;------------------------------------------------------------------------------
495
;------------------------------------------------------------------------------
496
align 4
496
align 4
497
print_strings:
497
print_strings:
498
	pusha
498
	pusha
499
	mcall	13,<100,180>,<278+12,40>,0xffffff	; clear text area
499
	mcall	13,<100,180>,<278+12,40>,0xffffff	; clear text area
500
	xor	edi,edi
500
	xor	edi,edi
501
	mov	eax,4		; icon text
501
	mov	eax,4		; icon text
502
	mov	ebx,100*65536+278+14
502
	mov	ebx,100*65536+278+14
503
	mov	ecx,3
503
	mov	ecx,3
504
;--------------------------------------
504
;--------------------------------------
505
align 4
505
align 4
506
.ll:
506
.ll:
507
	push	ecx
507
	push	ecx
508
	mov	ecx,0x000000
508
	mov	ecx,0x000000
509
	mov	edx,[current_icon]
509
	mov	edx,[current_icon]
510
	add	edx,[positions+edi*4]
510
	add	edx,[positions+edi*4]
511
	movzx	esi,byte[str_lens+edi]
511
	movzx	esi,byte[str_lens+edi]
512
	inc	edi
512
	inc	edi
513
	mcall
513
	mcall
514
	add	ebx,14
514
	add	ebx,14
515
	pop	ecx
515
	pop	ecx
516
	loop	.ll
516
	loop	.ll
517
 
517
 
518
	popa
518
	popa
519
	ret
519
	ret
520
;------------------------------------------------------------------------------
520
;------------------------------------------------------------------------------
521
align 4
521
align 4
522
load_icon_list:
522
load_icon_list:
523
	mov	edi,icons_reserved	; clear reserved area
523
	mov	edi,icons_reserved	; clear reserved area
524
	mov	eax,32
524
	mov	eax,32
525
	mov	ecx,10*9
525
	mov	ecx,10*9
526
	cld
526
	cld
527
	rep	stosb
527
	rep	stosb
528
 
528
 
529
	mov	ecx,[icons]	; set used icons to reserved area
529
	mov	ecx,[icons]	; set used icons to reserved area
530
	mov	esi,icon_data
530
	mov	esi,icon_data
531
;--------------------------------------
531
;--------------------------------------
532
align 4
532
align 4
533
ldl1:
533
ldl1:
534
	movzx	ebx,byte [esi+1]
534
	movzx	ebx,byte [esi+1]
535
	sub	ebx,65
535
	sub	ebx,65
536
; multiply x10
536
; multiply x10
537
	shl	ebx,1		; multiply x2
537
	shl	ebx,1		; multiply x2
538
	lea	ebx,[ebx+ebx*4] ; multiply x5
538
	lea	ebx,[ebx+ebx*4] ; multiply x5
539
	movzx	eax,byte [esi]
539
	movzx	eax,byte [esi]
540
	add	ebx,eax
540
	add	ebx,eax
541
	sub	ebx,65
541
	sub	ebx,65
542
	add	ebx,icons_reserved
542
	add	ebx,icons_reserved
543
	mov	[ebx],byte 'x'
543
	mov	[ebx],byte 'x'
544
	add	esi,REC_SIZE
544
	add	esi,REC_SIZE
545
	loop	ldl1
545
	loop	ldl1
546
	ret
546
	ret
547
;------------------------------------------------------------------------------
547
;------------------------------------------------------------------------------
548
align 4
548
align 4
549
lst_path:
549
lst_path:
550
	mov	ecx,30
550
	mov	ecx,30
551
	mov	edi,finfo.path
551
	mov	edi,finfo.path
552
	rep	movsb
552
	rep	movsb
553
	ret
553
	ret
554
;------------------------------------------------------------------------------
554
;------------------------------------------------------------------------------
555
align 4
555
align 4
556
load_ic:
556
load_ic:
557
	mov	ebx,finfo
557
	mov	ebx,finfo
558
	mov	dword[ebx+12],48*REC_SIZE
558
	mov	dword[ebx+12],48*REC_SIZE
559
	mov	dword[ebx+16],icon_data
559
	mov	dword[ebx+16],icon_data
560
	mov	esi,iconlst
560
	mov	esi,iconlst
561
	call	lst_path
561
	call	lst_path
562
	mcall	70
562
	mcall	70
563
	lea	eax,[ebx+10]
563
	lea	eax,[ebx+10]
564
	xor	edx,edx
564
	xor	edx,edx
565
	mov	ebx,REC_SIZE
565
	mov	ebx,REC_SIZE
566
	div	ebx
566
	div	ebx
567
	mov	[icons],eax
567
	mov	[icons],eax
568
	ret
568
	ret
569
;------------------------------------------------------------------------------
569
;------------------------------------------------------------------------------
570
align 4
570
align 4
571
read_string:
571
read_string:
572
	pusha
572
	pusha
573
	sub	eax,11
573
	sub	eax,11
574
	movzx	ecx,byte[str_lens+eax]
574
	movzx	ecx,byte[str_lens+eax]
575
	mov	[cur_str],ecx
575
	mov	[cur_str],ecx
576
	mov	eax,[positions+eax*4]
576
	mov	eax,[positions+eax*4]
577
	mov	edi,[current_icon]
577
	mov	edi,[current_icon]
578
	add	edi,eax
578
	add	edi,eax
579
	mov	[addr],edi
579
	mov	[addr],edi
580
	add	edi,ecx
580
	add	edi,ecx
581
;--------------------------------------
581
;--------------------------------------
582
align 4
582
align 4
583
.l1:
583
.l1:
584
	dec	edi
584
	dec	edi
585
	cmp	byte[edi],' '
585
	cmp	byte[edi],' '
586
	jne	.found
586
	jne	.found
587
 
587
 
588
	mov	byte[edi],'_'
588
	mov	byte[edi],'_'
589
	loop	.l1
589
	loop	.l1
590
 
590
 
591
	dec	edi
591
	dec	edi
592
;--------------------------------------
592
;--------------------------------------
593
align 4
593
align 4
594
.found:
594
.found:
595
	inc	edi
595
	inc	edi
596
	push	edi
596
	push	edi
597
	call	print_strings
597
	call	print_strings
598
	pop	edi
598
	pop	edi
599
;--------------------------------------
599
;--------------------------------------
600
align 4
600
align 4
601
f11:
601
f11:
602
	mcall	10
602
	mcall	10
603
	cmp	eax,2
603
	cmp	eax,2
604
	jz	fbu
604
	jz	fbu
605
	jmp	rs_done
605
	jmp	rs_done
606
;--------------------------------------
606
;--------------------------------------
607
align 4
607
align 4
608
fbu:
608
fbu:
609
	mcall	2
609
	mcall	2
610
	shr	eax,8
610
	shr	eax,8
611
	cmp	eax,13
611
	cmp	eax,13
612
	je	rs_done
612
	je	rs_done
613
	cmp	eax,8
613
	cmp	eax,8
614
	jnz	nobsl
614
	jnz	nobsl
615
	cmp	edi,[addr]
615
	cmp	edi,[addr]
616
	jz	f11
616
	jz	f11
617
	dec	edi
617
	dec	edi
618
	mov	[edi],byte '_'
618
	mov	[edi],byte '_'
619
	call	print_strings
619
	call	print_strings
620
	jmp	f11
620
	jmp	f11
621
;--------------------------------------
621
;--------------------------------------
622
align 4
622
align 4
623
nobsl:
623
nobsl:
624
	cmp	eax,31
624
	cmp	eax,31
625
	jbe	f11
625
	jbe	f11
626
	mov	[edi],al
626
	mov	[edi],al
627
	call	print_strings
627
	call	print_strings
628
	inc	edi
628
	inc	edi
629
	mov	esi,[addr]
629
	mov	esi,[addr]
630
	add	esi,[cur_str]
630
	add	esi,[cur_str]
631
	cmp	esi,edi
631
	cmp	esi,edi
632
	jnz	f11
632
	jnz	f11
633
;--------------------------------------
633
;--------------------------------------
634
align 4
634
align 4
635
rs_done:
635
rs_done:
636
	mov	ecx,[addr]
636
	mov	ecx,[addr]
637
	add	ecx,[cur_str]
637
	add	ecx,[cur_str]
638
	sub	ecx,edi
638
	sub	ecx,edi
639
	mov	eax,32
639
	mov	eax,32
640
	cld
640
	cld
641
	rep	stosb
641
	rep	stosb
642
	call	print_strings
642
	call	print_strings
643
	popa
643
	popa
644
	ret
644
	ret
645
;------------------------------------------------------------------------------
645
;------------------------------------------------------------------------------
646
align 4
646
align 4
647
key:
647
key:
648
	mcall	2	; just read it and ignore
648
	mcall	2	; just read it and ignore
649
	jmp	still
649
	jmp	still
650
;------------------------------------------------------------------------------
650
;------------------------------------------------------------------------------
651
;   *********************************************
651
;   *********************************************
652
;   *******  WINDOW DEFINITIONS AND DRAW ********
652
;   *******  WINDOW DEFINITIONS AND DRAW ********
653
;   *********************************************
653
;   *********************************************
654
align 4
654
align 4
655
draw_window:
655
draw_window:
656
	mcall	12,1
656
	mcall	12,1
657
	; DRAW WINDOW
657
	; DRAW WINDOW
658
	xor	eax,eax
658
	xor	eax,eax
659
	xor	esi,esi
659
	xor	esi,esi
660
	mcall	,<210,300>,<30,(390-14)>,0x14ffffff,,title
660
	mcall	,<210,300>,<30,(390-14)>,0x14ffffff,,title
661
 
661
 
662
	mcall	13,<20,260>,<35,200>,0x3366cc	; WINDOW AREA
662
	mcall	13,<20,260>,<35,200>,0x3366cc	; WINDOW AREA
663
 
663
 
664
	mcall	38,<150,150>,<35,235>,0xffffff	; VERTICAL LINE ON WINDOW AREA
664
	mcall	38,<150,150>,<35,235>,0xffffff	; VERTICAL LINE ON WINDOW AREA
665
 
665
 
666
	mcall	,<20,280>,<135,135>	; HOROZONTAL LINE ON WINDOW AREA
666
	mcall	,<20,280>,<135,135>	; HOROZONTAL LINE ON WINDOW AREA
667
 
667
 
668
	mcall	8,<20,72>,<(275+1+14),(13-2)>,11,[bcolor]	;id 11 TEXT ENTER BUTTONS
668
	mcall	8,<20,72>,<(275+1+14),(13-2)>,11,[bcolor]	;id 11 TEXT ENTER BUTTONS
669
	
669
	
670
	inc	edx
670
	inc	edx
671
	add	ecx,14*65536
671
	add	ecx,14*65536
672
	mcall			; id 12
672
	mcall			; id 12
673
	
673
	
674
	inc	edx
674
	inc	edx
675
	add	ecx,14*65536
675
	add	ecx,14*65536
676
	mcall			; id 13
676
	mcall			; id 13
677
 
677
 
678
	mcall	,<20,259>,<(329+2),(15-4)>,21	; id 21 APPLY AND SAVE CHANGES BUTTON
678
	mcall	,<20,259>,<(329+2),(15-4)>,21	; id 21 APPLY AND SAVE CHANGES BUTTON
679
 
679
 
680
	add	ecx,14*65536
680
	add	ecx,14*65536
681
	inc	edx
681
	inc	edx
682
	mcall	,<20,(129-2)>	; id 22 ADD ICON BUTTON
682
	mcall	,<20,(129-2)>	; id 22 ADD ICON BUTTON
683
 
683
 
684
	add	ebx,(130+2)*65536
684
	add	ebx,(130+2)*65536
685
	inc	edx
685
	inc	edx
686
	mcall			; id 23 REMOVE ICON BUTTON
686
	mcall			; id 23 REMOVE ICON BUTTON
687
 
687
 
688
	mcall	,<(20-14),8>,<(260-23),32>,30 + 1 shl 30	; id 30 IMAGE BUTTON
688
	mcall	,<(20-14),8>,<(260-23),32>,30 + 1 shl 30	; id 30 IMAGE BUTTON
689
 
689
 
690
	inc	edx
690
	inc	edx
691
	add	ebx,(36*7+26) shl 16
691
	add	ebx,(36*7+26) shl 16
692
	mcall		; id 31
692
	mcall		; id 31
693
 
693
 
694
	add	edx,1 + 1 shl 29
694
	add	edx,1 + 1 shl 29
695
	mcall	,<(33-19),(34*8)>	; id 32
695
	mcall	,<(33-19),(34*8)>	; id 32
696
	
696
	
697
	mcall	4,<(23-15),(273-24)>,0,arrows,1
697
	mcall	4,<(23-15),(273-24)>,0,arrows,1
698
 
698
 
699
	add	ebx,(36*7+27)shl 16
699
	add	ebx,(36*7+27)shl 16
700
	add	edx,2
700
	add	edx,2
701
	mcall
701
	mcall
702
 
702
 
703
	dec	edx
703
	dec	edx
704
	mcall	,<120,250>
704
	mcall	,<120,250>
705
 
705
 
706
	lea	edx,[ebx+8 shl 16]
706
	lea	edx,[ebx+8 shl 16]
707
	mcall	47,0x30000,[icon_count],,0
707
	mcall	47,0x30000,[icon_count],,0
708
 
708
 
709
	mov	eax,4
709
	mov	eax,4
710
	mov	ebx,24 shl 16+(250+14+14+14)
710
	mov	ebx,24 shl 16+(250+14+14+14)
711
	mov	ecx,0xffffff
711
	mov	ecx,0xffffff
712
	mov	edx,text
712
	mov	edx,text
713
	mov	esi,47
713
	mov	esi,47
714
;--------------------------------------
714
;--------------------------------------
715
align 4
715
align 4
716
.newline:
716
.newline:
717
	mov	ecx,[edx]
717
	mov	ecx,[edx]
718
	add	edx,4
718
	add	edx,4
719
	mcall
719
	mcall
720
	add	ebx,14
720
	add	ebx,14
721
	add	edx,47
721
	add	edx,47
722
	cmp	[edx],byte 'x'
722
	cmp	[edx],byte 'x'
723
	jne	.newline
723
	jne	.newline
724
;--------------------------------------
724
;--------------------------------------
725
align 4
725
align 4
726
draw_btns:
726
draw_btns:
727
	mov	eax,0	; DRAW BUTTONS ON WINDOW AREA
727
	mov	eax,0	; DRAW BUTTONS ON WINDOW AREA
728
	mov	ebx,20 shl 16+25
728
	mov	ebx,20 shl 16+25
729
	mov	ecx,35 shl 16+19
729
	mov	ecx,35 shl 16+19
730
	mov	edi,icon_table
730
	mov	edi,icon_table
731
	mov	edx,40
731
	mov	edx,40
732
;--------------------------------------
732
;--------------------------------------
733
align 4
733
align 4
734
newbline:
734
newbline:
735
	cmp	[edi],byte 'x'
735
	cmp	[edi],byte 'x'
736
	jne	no_button
736
	jne	no_button
737
 
737
 
738
	mov	esi,0x5577cc
738
	mov	esi,0x5577cc
739
	cmp	[edi+90],byte 'x'
739
	cmp	[edi+90],byte 'x'
740
	jne	nores
740
	jne	nores
741
 
741
 
742
	mov	esi,0xcc5555
742
	mov	esi,0xcc5555
743
	cmp	edx,[cur_btn]
743
	cmp	edx,[cur_btn]
744
	jne	nores
744
	jne	nores
745
 
745
 
746
	mov	esi,0xe7e05a
746
	mov	esi,0xe7e05a
747
;--------------------------------------
747
;--------------------------------------
748
align 4
748
align 4
749
nores:
749
nores:
750
	push	eax
750
	push	eax
751
	mcall	8
751
	mcall	8
752
	pop	eax
752
	pop	eax
753
;--------------------------------------
753
;--------------------------------------
754
align 4
754
align 4
755
no_button:
755
no_button:
756
	add	ebx,26 shl 16
756
	add	ebx,26 shl 16
757
 
757
 
758
	inc	edi
758
	inc	edi
759
	inc	edx
759
	inc	edx
760
	inc	al
760
	inc	al
761
	cmp	al,9
761
	cmp	al,9
762
	jbe	newbline
762
	jbe	newbline
763
	
763
	
764
	mov	al,0
764
	mov	al,0
765
	add	edx,6
765
	add	edx,6
766
	ror	ebx,16
766
	ror	ebx,16
767
	mov	bx,20
767
	mov	bx,20
768
	ror	ebx,16
768
	ror	ebx,16
769
	add	ecx,20 shl 16
769
	add	ecx,20 shl 16
770
	inc	ah
770
	inc	ah
771
	cmp	ah,8
771
	cmp	ah,8
772
	jbe	newbline
772
	jbe	newbline
773
 
773
 
774
	call	print_strings
774
	call	print_strings
775
	call	draw_icon
775
	call	draw_icon
776
	mcall	12,2
776
	mcall	12,2
777
	ret
777
	ret
778
;------------------------------------------------------------------------------
778
;------------------------------------------------------------------------------
779
align 4
779
align 4
780
draw_icon:
780
draw_icon:
781
	mcall	13,<(33-20),(34*8+2)>,<(260-24),(37+15-2)>,0xffffff
781
	mcall	13,<(33-20),(34*8+2)>,<(260-24),(37+15-2)>,0xffffff
782
	mov	esi,[current_icon]
782
	mov	esi,[current_icon]
783
	add	esi,12
783
	add	esi,12
784
	call	ASCII_to_icon_number
784
	call	ASCII_to_icon_number
785
	push	eax
785
	push	eax
786
	cmp	eax,[cur_band]
786
	cmp	eax,[cur_band]
787
	jb	.nou
787
	jb	.nou
788
	sub	eax,[cur_band]
788
	sub	eax,[cur_band]
789
	cmp	eax,7
789
	cmp	eax,7
790
	ja	.nou
790
	ja	.nou
791
	imul	eax,34 shl 16
791
	imul	eax,34 shl 16
792
	lea	ebx,[eax+(33-19) shl 16]
792
	lea	ebx,[eax+(33-19) shl 16]
793
	mov	bx,34
793
	mov	bx,34
794
	mcall	13,,<(236+35),3>,0xff0000
794
	mcall	13,,<(236+35),3>,0xff0000
795
	mov	eax,[esp]
795
	mov	eax,[esp]
796
;--------------------------------------
796
;--------------------------------------
797
align 4
797
align 4
798
.nou:
798
.nou:
799
	mov	eax,[cur_band]
799
	mov	eax,[cur_band]
800
	push	eax
800
	push	eax
801
	imul	eax,ICON_SIZE
801
	imul	eax,ICON_SIZE
802
	mov	ebx,[strip_file]
802
	mov	ebx,[strip_file]
803
	add	ebx,eax
803
	add	ebx,eax
804
	mov	ecx,8
804
	mov	ecx,8
805
	mov	edx,(33-18) shl 16+238
805
	mov	edx,(33-18) shl 16+238
806
;--------------------------------------
806
;--------------------------------------
807
align 4
807
align 4
808
.nxt:
808
.nxt:
809
	push	ecx
809
	push	ecx
810
	pusha
810
	pusha
811
	mov	ebp,0
811
	mov	ebp,0
812
	
812
	
813
	mov	eax,[strip_file_size]
813
	mov	eax,[strip_file_size]
814
	add	eax,[strip_file]
814
	add	eax,[strip_file]
815
	cmp	eax,ebx
815
	cmp	eax,ebx
816
	ja	@f
816
	ja	@f
817
; draw a rectangle if icon does not exist	
817
; draw a rectangle if icon does not exist	
818
	mov	ebx,edx	; X
818
	mov	ebx,edx	; X
819
	mov	ecx,edx	; Y
819
	mov	ecx,edx	; Y
820
	shl	ecx,16
820
	shl	ecx,16
821
	mov	bx,32
821
	mov	bx,32
822
	mov	cx,bx
822
	mov	cx,bx
823
	xor	edx,edx
823
	xor	edx,edx
824
	mcall	13
824
	mcall	13
825
	jmp	.draw_pict_end
825
	jmp	.draw_pict_end
826
;--------------------------------------
826
;--------------------------------------
827
align 4
827
align 4
828
@@:
828
@@:
829
	mcall	65,,<32,32>,,32
829
	mcall	65,,<32,32>,,32
830
;--------------------------------------
830
;--------------------------------------
831
align 4
831
align 4
832
.draw_pict_end:
832
.draw_pict_end:
833
	popa
833
	popa
834
	pop	ecx
834
	pop	ecx
835
	add	ebx,ICON_SIZE
835
	add	ebx,ICON_SIZE
836
	add	edx,34 shl 16
836
	add	edx,34 shl 16
837
 
837
 
838
	dec	ecx
838
	dec	ecx
839
	jnz	.nxt
839
	jnz	.nxt
840
 
840
 
841
	mcall	4,<45,280-2>,0,rep_text,rep_text_len-rep_text
841
	mcall	4,<45,280-2>,0,rep_text,rep_text_len-rep_text
842
	lea	edx,[ebx+(8*5)shl 16]
842
	lea	edx,[ebx+(8*5)shl 16]
843
	pop	ecx
843
	pop	ecx
844
	mcall	47,0x30000,,,0xff
844
	mcall	47,0x30000,,,0xff
845
	
845
	
846
	add	ecx,7
846
	add	ecx,7
847
	add	edx,(3*8+4)shl 16
847
	add	edx,(3*8+4)shl 16
848
	mcall
848
	mcall
849
	
849
	
850
	add	edx,(5*8+4)shl 16
850
	add	edx,(5*8+4)shl 16
851
	mcall	,,[icon_count]
851
	mcall	,,[icon_count]
852
	
852
	
853
	pop	ecx
853
	pop	ecx
854
	add	edx,(10*8+4)shl 16
854
	add	edx,(10*8+4)shl 16
855
	mcall	,,,,0xff0000
855
	mcall	,,,,0xff0000
856
	ret
856
	ret
857
;------------------------------------------------------------------------------
857
;------------------------------------------------------------------------------
858
align 4
858
align 4
859
close:
859
close:
860
	or	eax,-1
860
	or	eax,-1
861
	mcall
861
	mcall
862
;------------------------------------------------------------------------------
862
;------------------------------------------------------------------------------
863
; ICON PROCESSING MODE - START2 entering label
863
; ICON PROCESSING MODE - START2 entering label
864
;------------------------------------------------------------------------------
864
;------------------------------------------------------------------------------
865
align 4
865
align 4
866
START2:
866
START2:
867
	mcall	40,10000b	; only Event 5 - draw background
867
	mcall	40,10000b	; only Event 5 - draw background
868
	
868
	
869
	mcall	48,5
869
	mcall	48,5
870
	mov	[warea.by_x],eax
870
	mov	[warea.by_x],eax
871
	mov	[warea.by_y],ebx
871
	mov	[warea.by_y],ebx
872
	
872
	
873
	mcall	51,1,START_mouse_thread,stack_mouse_thread
873
	mcall	51,1,START_mouse_thread,stack_mouse_thread
874
	
874
	
875
	xor	eax,eax
875
	xor	eax,eax
876
	mov	[x_left],eax
876
	mov	[x_left],eax
877
	mov	[y_top],eax
877
	mov	[y_top],eax
878
	
878
	
879
	mcall	14
879
	mcall	14
880
	mov	ebx,eax
880
	mov	ebx,eax
881
	shr	eax,16
881
	shr	eax,16
882
	and	ebx,0xffff
882
	and	ebx,0xffff
883
	mov	[x_right],eax
883
	mov	[x_right],eax
884
	mov	[y_bottom],ebx
884
	mov	[y_bottom],ebx
885
	jmp	still2.1
885
	jmp	still2.1
886
;------------------------------------------------------------------------------
886
;------------------------------------------------------------------------------
887
align 4
887
align 4
888
still2:
888
still2:
889
	mcall	10
889
	mcall	10
890
 
890
 
891
	mcall	15,8
891
	mcall	15,8
892
 
892
 
893
	mov	ecx,eax
893
	mov	ecx,eax
894
	shr	ecx,16
894
	shr	ecx,16
895
	mov	[x_left],ecx
895
	mov	[x_left],ecx
896
	and	eax,0xffff
896
	and	eax,0xffff
897
	mov	[x_right],eax
897
	mov	[x_right],eax
898
 
898
 
899
	mov	ecx,ebx
899
	mov	ecx,ebx
900
	shr	ecx,16
900
	shr	ecx,16
901
	mov	[y_top],ecx
901
	mov	[y_top],ecx
902
	and	ebx,0xffff
902
	and	ebx,0xffff
903
	mov	[y_bottom],ebx
903
	mov	[y_bottom],ebx
904
 
904
 
905
	mcall	48,5
905
	mcall	48,5
906
	mov	[warea.by_x],eax
906
	mov	[warea.by_x],eax
907
	mov	[warea.by_y],ebx
907
	mov	[warea.by_y],ebx
908
.1:
908
.1:
909
	mov	ecx,[icons]
909
	mov	ecx,[icons]
910
	mov	ebx,icon_data
910
	mov	ebx,icon_data
911
;--------------------------------------
911
;--------------------------------------
912
align 4
912
align 4
913
.start_new:
913
.start_new:
914
	push	ebx ecx
914
	push	ebx ecx
915
	mov	[adress_of_icon_data],ebx
915
	mov	[adress_of_icon_data],ebx
916
	mov	eax,[ebx]
916
	mov	eax,[ebx]
917
	call	calc_icon_pos
917
	call	calc_icon_pos
918
	mov	[current_X],ebx
918
	mov	[current_X],ebx
919
	mov	[current_Y],eax
919
	mov	[current_Y],eax
920
 
920
 
921
	call	draw_picture
921
	call	draw_picture
922
	pop	ecx ebx
922
	pop	ecx ebx
923
	add	ebx,REC_SIZE
923
	add	ebx,REC_SIZE
924
	dec	ecx
924
	dec	ecx
925
	jnz	.start_new
925
	jnz	.start_new
926
	jmp	still2
926
	jmp	still2
927
;------------------------------------------------------------------------------	
927
;------------------------------------------------------------------------------	
928
align 4
928
align 4
929
draw_picture:
929
draw_picture:
930
	mov	eax,[current_X]
930
	mov	eax,[current_X]
931
	cmp	eax,[x_right]
931
	cmp	eax,[x_right]
932
	ja	.exit
932
	ja	.exit
933
 
933
 
934
	add	eax,52
934
	add	eax,52
935
	cmp	eax,[x_left]
935
	cmp	eax,[x_left]
936
	jb	.exit
936
	jb	.exit
937
 
937
 
938
	mov	eax,[current_Y]
938
	mov	eax,[current_Y]
939
	cmp	eax,[y_bottom]
939
	cmp	eax,[y_bottom]
940
	ja	.exit
940
	ja	.exit
941
 
941
 
942
	add	eax,52
942
	add	eax,52
943
	cmp	eax,[y_top]
943
	cmp	eax,[y_top]
944
	jb	.exit
944
	jb	.exit
945
;--------------------------------------
945
;--------------------------------------
946
align 4
946
align 4
947
@@:
947
@@:
948
	mov	edi,[adress_of_icon_data]
948
	mov	edi,[adress_of_icon_data]
949
	lea	esi,[edi+12]
949
	lea	esi,[edi+12]
950
	call	ASCII_to_icon_number
950
	call	ASCII_to_icon_number
951
; protect for icon area RAW size limit
951
; protect for icon area RAW size limit
952
	cmp	eax,[icon_count]
952
	cmp	eax,[icon_count]
953
	jbe	@f
953
	jbe	@f
954
;--------------------------------------
954
;--------------------------------------
955
align 4
955
align 4
956
.exit:
956
.exit:
957
	ret
957
	ret
958
;--------------------------------------
958
;--------------------------------------
959
align 4
959
align 4
960
@@:
960
@@:
961
	push	eax
961
	push	eax
962
	mcall	68,12,52*52*4+8
962
	mcall	68,12,52*52*4+8
963
	mov	[draw_area],eax
963
	mov	[draw_area],eax
964
	mov	ebx,52
964
	mov	ebx,52
965
	mov	[eax],ebx
965
	mov	[eax],ebx
966
	mov	[eax+4],ebx
966
	mov	[eax+4],ebx
967
	pop	eax
967
	pop	eax
968
 
968
 
969
	shl	eax,12		; multiply x4096
969
	shl	eax,12		; multiply x4096
970
	add	eax,[strip_file]
970
	add	eax,[strip_file]
971
	mov	esi,eax
971
	mov	esi,eax
972
 
972
 
973
	mov	edi,[draw_area]
973
	mov	edi,[draw_area]
974
	add	edi,(52-32)/2*4+8
974
	add	edi,(52-32)/2*4+8
975
	mov	ebx,32
975
	mov	ebx,32
976
	cld
976
	cld
977
;--------------------------------------
977
;--------------------------------------
978
align 4	
978
align 4	
979
.y:
979
.y:
980
	mov	ecx,32
980
	mov	ecx,32
981
	rep	movsd
981
	rep	movsd
982
	
982
	
983
	add	edi,(52-32)*4
983
	add	edi,(52-32)*4
984
	dec	ebx
984
	dec	ebx
985
	jnz	.y
985
	jnz	.y
986
 
986
 
987
	call	draw_text
987
	call	draw_text
988
	
988
	
989
	mov	edx,[current_X]
989
	mov	edx,[current_X]
990
	shl	edx,16
990
	shl	edx,16
991
	add	edx,[current_Y]
991
	add	edx,[current_Y]
992
	mov	ebx,[draw_area]
992
	mov	ebx,[draw_area]
993
	add	ebx,8
993
	add	ebx,8
994
	mcall	25,,<52,52>
994
	mcall	25,,<52,52>
995
	mcall	68,13,[draw_area]
995
	mcall	68,13,[draw_area]
996
	ret
996
	ret
997
;------------------------------------------------------------------------------
997
;------------------------------------------------------------------------------
998
align 4
998
align 4
999
draw_text:
999
draw_text:
1000
	mov	esi,[adress_of_icon_data]
1000
	mov	esi,[adress_of_icon_data]
1001
	add	esi,3
1001
	add	esi,3
1002
	push	edi
1002
	push	edi
1003
	mov	edi,title
1003
	mov	edi,title
1004
	mov	ecx,8/4
1004
	mov	ecx,8/4
1005
	cld
1005
	cld
1006
	rep	movsd
1006
	rep	movsd
1007
	pop	edi
1007
	pop	edi
1008
	mov	eax,title
1008
	mov	eax,title
1009
;--------------------------------------
1009
;--------------------------------------
1010
align 4
1010
align 4
1011
news2:
1011
news2:
1012
	cmp	[eax],byte 33
1012
	cmp	[eax],byte 33
1013
	jb	founde
1013
	jb	founde
1014
	inc	eax
1014
	inc	eax
1015
	cmp	eax,title+8	;11
1015
	cmp	eax,title+8	;11
1016
	jb	news2
1016
	jb	news2
1017
;--------------------------------------
1017
;--------------------------------------
1018
align 4
1018
align 4
1019
founde:
1019
founde:
1020
	sub	eax,title
1020
	sub	eax,title
1021
	mov	[tl],eax
1021
	mov	[tl],eax
1022
	
1022
	
1023
	mov	eax,[tl]
1023
	mov	eax,[tl]
1024
	lea	eax,[eax+eax*2]		; eax *= char_width/2
1024
	lea	eax,[eax+eax*2]		; eax *= char_width/2
1025
	shl	eax,16
1025
	shl	eax,16
1026
	
1026
	
1027
	mov	ebx,27 shl 16+40
1027
	mov	ebx,27 shl 16+40
1028
	sub	ebx,eax
1028
	sub	ebx,eax
1029
	
1029
	
1030
	xor	ecx,ecx		; black shade of text
1030
	xor	ecx,ecx		; black shade of text
1031
	or	ecx,0x08000000	; redirect the output to the user area
1031
	or	ecx,0x08000000	; redirect the output to the user area
1032
	add	ebx,1 shl 16	;*65536+1
1032
	add	ebx,1 shl 16	;*65536+1
1033
	
1033
	
1034
	mov	edi,[draw_area]
1034
	mov	edi,[draw_area]
1035
	mcall	4,,,title,[tl]
1035
	mcall	4,,,title,[tl]
1036
 
1036
 
1037
	inc	ebx
1037
	inc	ebx
1038
	mcall
1038
	mcall
1039
 
1039
 
1040
	add	ebx,1 shl 16
1040
	add	ebx,1 shl 16
1041
	mcall
1041
	mcall
1042
 
1042
 
1043
	inc	ebx
1043
	inc	ebx
1044
	mcall
1044
	mcall
1045
 
1045
 
1046
	sub	ebx,1 shl 16
1046
	sub	ebx,1 shl 16
1047
	mcall
1047
	mcall
1048
 
1048
 
1049
	dec	ebx
1049
	dec	ebx
1050
	sub	ebx,1 shl 16
1050
	sub	ebx,1 shl 16
1051
	mcall
1051
	mcall
1052
 
1052
 
1053
	sub	ebx,1 shl 16
1053
	sub	ebx,1 shl 16
1054
	dec	ebx
1054
	dec	ebx
1055
	mcall
1055
	mcall
1056
 
1056
 
1057
	dec	ebx
1057
	dec	ebx
1058
	add	ebx,1 shl 16
1058
	add	ebx,1 shl 16
1059
	mcall
1059
	mcall
1060
 
1060
 
1061
	inc	ebx
1061
	inc	ebx
1062
	mov	ecx,0xffffff		; white text
1062
	mov	ecx,0xffffff		; white text
1063
	or	ecx,0x08000000	; redirect the output to the user area
1063
	or	ecx,0x08000000	; redirect the output to the user area
1064
	mcall
1064
	mcall
1065
	ret
1065
	ret
1066
;------------------------------------------------------------------------------
1066
;------------------------------------------------------------------------------
1067
align 4
1067
align 4
1068
ASCII_to_icon_number:
1068
ASCII_to_icon_number:
1069
;
1069
;
1070
; in:
1070
; in:
1071
; esi - adress of icon ASCII text number (line start + 12)
1071
; esi - adress of icon ASCII text number (line start + 12)
1072
;
1072
;
1073
; out:
1073
; out:
1074
; eax - number of icon
1074
; eax - number of icon
1075
;
1075
;
1076
	push	esi
1076
	push	esi
1077
	xor	eax,eax
1077
	xor	eax,eax
1078
	xor	ebx,ebx
1078
	xor	ebx,ebx
1079
;--------------------------------------
1079
;--------------------------------------
1080
align 4
1080
align 4
1081
.next:
1081
.next:
1082
	lodsb
1082
	lodsb
1083
	cmp	al,'0'
1083
	cmp	al,'0'
1084
	jb	.done
1084
	jb	.done
1085
	cmp	al,'9'
1085
	cmp	al,'9'
1086
	ja	.done
1086
	ja	.done
1087
	sub	eax,'0'
1087
	sub	eax,'0'
1088
; multiply x10
1088
; multiply x10
1089
	shl	ebx,1		; multiply x2
1089
	shl	ebx,1		; multiply x2
1090
	lea	ebx,[ebx+ebx*4] ; multiply x5
1090
	lea	ebx,[ebx+ebx*4] ; multiply x5
1091
	add	ebx,eax
1091
	add	ebx,eax
1092
	jmp	.next
1092
	jmp	.next
1093
;--------------------------------------
1093
;--------------------------------------
1094
align 4
1094
align 4
1095
.done:
1095
.done:
1096
	pop	esi
1096
	pop	esi
1097
	mov	eax,ebx
1097
	mov	eax,ebx
1098
	ret
1098
	ret
1099
;------------------------------------------------------------------------------
1099
;------------------------------------------------------------------------------
1100
align 4
1100
align 4
1101
itoa:
1101
itoa:
1102
	add	esi,2
1102
	add	esi,2
1103
	mov	ebx,10
1103
	mov	ebx,10
1104
	mov	ecx,3
1104
	mov	ecx,3
1105
;--------------------------------------
1105
;--------------------------------------
1106
align 4
1106
align 4
1107
.l0:
1107
.l0:
1108
	xor	edx,edx
1108
	xor	edx,edx
1109
	div	ebx
1109
	div	ebx
1110
	add	dl,'0'
1110
	add	dl,'0'
1111
	mov	[esi],dl
1111
	mov	[esi],dl
1112
	dec	esi
1112
	dec	esi
1113
	loop	.l0
1113
	loop	.l0
1114
	ret
1114
	ret
1115
;------------------------------------------------------------------------------
1115
;------------------------------------------------------------------------------
1116
align 4
1116
align 4
1117
calc_icon_pos:
1117
calc_icon_pos:
1118
; in:
1118
; in:
1119
; eax - dword [icon_position]
1119
; eax - dword [icon_position]
1120
; out:
1120
; out:
1121
; eax - current Y
1121
; eax - current Y
1122
; ebx - current X
1122
; ebx - current X
1123
	push	eax
1123
	push	eax
1124
	movzx	eax,al
1124
	movzx	eax,al
1125
	sub	eax,'A'		;eax - number of letter
1125
	sub	eax,'A'		;eax - number of letter
1126
	cmp	eax,4
1126
	cmp	eax,4
1127
	jg	no_left
1127
	jg	no_left
1128
 
1128
 
1129
	shl	eax,6	;imul eax,64
1129
	shl	eax,6	;imul eax,64
1130
	add	eax,16
1130
	add	eax,16
1131
	movzx	ebx,[warea.left]
1131
	movzx	ebx,[warea.left]
1132
	add	eax,ebx
1132
	add	eax,ebx
1133
	jmp	x_done
1133
	jmp	x_done
1134
;--------------------------------------
1134
;--------------------------------------
1135
align 4
1135
align 4
1136
no_left:
1136
no_left:
1137
	sub	eax,9
1137
	sub	eax,9
1138
	sal	eax,6	;imul eax,64
1138
	sal	eax,6	;imul eax,64
1139
	sub	eax,16+52-1
1139
	sub	eax,16+52-1
1140
	movzx	ebx,[warea.right]
1140
	movzx	ebx,[warea.right]
1141
	add	eax,ebx
1141
	add	eax,ebx
1142
;--------------------------------------
1142
;--------------------------------------
1143
align 4
1143
align 4
1144
x_done:
1144
x_done:
1145
	mov	ebx,eax
1145
	mov	ebx,eax
1146
	pop	eax
1146
	pop	eax
1147
	push	ebx
1147
	push	ebx
1148
	movzx	eax,ah
1148
	movzx	eax,ah
1149
	sub	eax,'A'		; eax - number of letter
1149
	sub	eax,'A'		; eax - number of letter
1150
	cmp	eax,4
1150
	cmp	eax,4
1151
	jg	no_up
1151
	jg	no_up
1152
 
1152
 
1153
	shl	eax,6		;imul eax,80
1153
	shl	eax,6		;imul eax,80
1154
	add	eax,16
1154
	add	eax,16
1155
	movzx	ebx,[warea.top]
1155
	movzx	ebx,[warea.top]
1156
	add	eax,ebx
1156
	add	eax,ebx
1157
	jmp	y_done
1157
	jmp	y_done
1158
;--------------------------------------
1158
;--------------------------------------
1159
align 4
1159
align 4
1160
no_up:
1160
no_up:
1161
	sub	eax,9
1161
	sub	eax,9
1162
	shl	eax,6		;imul eax,80
1162
	shl	eax,6		;imul eax,80
1163
	sub	eax,16-1
1163
	sub	eax,16-1
1164
	movzx	ebx,[warea.bottom]
1164
	movzx	ebx,[warea.bottom]
1165
	add	eax,ebx
1165
	add	eax,ebx
1166
;--------------------------------------
1166
;--------------------------------------
1167
align 4
1167
align 4
1168
y_done:
1168
y_done:
1169
	pop	ebx
1169
	pop	ebx
1170
	ret
1170
	ret
1171
;------------------------------------------------------------------------------
1171
;------------------------------------------------------------------------------
1172
include 'mouse.inc'
1172
include 'mouse.inc'
1173
;------------------------------------------------------------------------------
1173
;------------------------------------------------------------------------------
1174
include 'data.inc'
1174
include 'data.inc'
1175
;------------------------------------------------------------------------------
1175
;------------------------------------------------------------------------------
1176
IM_END:
1176
IM_END:
1177
;------------------------------------------------------------------------------
1177
;------------------------------------------------------------------------------
1178
include 'dat_area.inc'
1178
include 'dat_area.inc'
1179
;------------------------------------------------------------------------------
1179
;------------------------------------------------------------------------------
1180
I_END:
1180
I_END:
1181
;------------------------------------------------------------------------------
1181
;------------------------------------------------------------------------------