Subversion Repositories Kolibri OS

Rev

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

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