Subversion Repositories Kolibri OS

Rev

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

Rev 529 Rev 539
1
;
1
;
2
;   DESKTOP ICON MANAGER
2
;   DESKTOP ICON MANAGER
3
;
3
;
4
;   Compile with FASM for Menuet
4
;   Compile with FASM for Menuet
5
;
5
;
6
 
6
 
7
use32
7
use32
8
 
8
 
9
               org    0x0
9
               org    0x0
10
 
10
 
11
               db     'MENUET01'              ; 8 byte id
11
               db     'MENUET01'              ; 8 byte id
12
               dd     0x01                    ; header version
12
               dd     0x01                    ; header version
13
               dd     START                   ; start of code
13
               dd     START                   ; start of code
14
               dd     I_END                   ; size of image
14
               dd     I_END                   ; size of image
15
               dd     0x4000                  ; memory for app
15
               dd     0x4000                  ; memory for app
16
               dd     0x4000                  ; esp
16
               dd     0x4000                  ; esp
17
               dd     I_Param , 0x0           ; I_Param , I_Icon
17
               dd     I_Param , 0x0           ; I_Param , I_Icon
18
 
18
 
19
include  '..\..\..\macros.inc'
19
include  '..\..\..\macros.inc'
20
include  'lang.inc'
20
include  'lang.inc'
21
 
21
 
22
START:                          ; start of execution
22
START:                          ; start of execution
23
 
23
 
24
    call load_icon_list
24
    call load_icon_list
25
 
25
 
26
    call check_parameters
26
    call check_parameters
27
 
27
 
28
  red:                          ; redraw
28
  red:                          ; redraw
29
    call draw_window            ; at first, draw the window
29
    call draw_window            ; at first, draw the window
30
 
30
 
31
still:
31
still:
32
 
32
 
33
    mov  eax,10                 ; wait here for event
33
    mov  eax,10                 ; wait here for event
34
    mcall
34
    mcall
35
 
35
 
36
    dec  eax                    ; redraw request ?
36
    dec  eax                    ; redraw request ?
37
    jz   red
37
    jz   red
38
    dec  eax                    ; key in buffer ?
38
    dec  eax                    ; key in buffer ?
39
    jz   key
39
    jz   key
40
 
40
 
41
  button:                       ; button
41
  button:                       ; button
42
    mov  al,17                  ; get id
42
    mov  al,17                  ; get id
43
    mcall
43
    mcall
44
 
44
 
45
    shr  eax,8
45
    shr  eax,8
46
 
46
 
47
    cmp  eax,1                  ; button id=1 ?
47
    cmp  eax,1                  ; button id=1 ?
48
    jne  noclose
48
    jne  noclose
49
    or   eax,-1                 ; close this program
49
    or   eax,-1                 ; close this program
50
    mcall
50
    mcall
51
  noclose:
51
  noclose:
52
 
52
 
53
    cmp  eax,11
53
    cmp  eax,11
54
    jb   no_str
54
    jb   no_str
55
    cmp  eax,13
55
    cmp  eax,13
56
    jg   no_str
56
    jg   no_str
57
    call read_string
57
    call read_string
58
    jmp  still
58
    jmp  still
59
  no_str:
59
  no_str:
60
 
60
 
61
 
61
 
62
    cmp  eax,21                 ; apply changes
62
    cmp  eax,21                 ; apply changes
63
    jne  no_apply
63
    jne  no_apply
64
 
64
 
65
    ; (1) save list
65
    ; (1) save list
66
 
66
 
67
    mov  eax,70
67
    mov  eax,70
68
    mov  ebx,finfo
68
    mov  ebx,finfo
69
    mov  dword[ebx],2
69
    mov  dword[ebx],2
70
    mov  edx,78
70
    mov  edx,78
71
    imul edx,dword [icons]
71
    imul edx,dword [icons]
72
    mov  dword[ebx+12],edx
72
    mov  dword[ebx+12],edx
73
    mcall
73
    mcall
74
 
74
 
75
 
75
 
76
    ; (2) terminate all icons
76
    ; (2) terminate all icons
77
 
77
 
78
    mov  esi,1
78
    mov  esi,1
79
  newread:
79
  newread:
80
    inc  esi
80
    inc  esi
81
    mov  eax,9
81
    mov  eax,9
82
    mov  ebx,I_END
82
    mov  ebx,I_END
83
    mov  ecx,esi
83
    mov  ecx,esi
84
    mcall
84
    mcall
85
    cmp  esi,eax
85
    cmp  esi,eax
86
    jg   all_terminated
86
    jg   all_terminated
87
 
87
 
88
    cmp  [I_END+10],dword '@ICO'
88
    cmp  [I_END+10],dword '@ICO'
89
    jne  newread
89
    jne  newread
90
 
90
 
91
    mov  eax,18
91
    mov  eax,18
92
    mov  ebx,2
92
    mov  ebx,2
93
    mov  ecx,esi
93
    mov  ecx,esi
94
    mcall
94
    mcall
95
 
95
 
96
    mov  esi,1
96
    mov  esi,1
97
 
97
 
98
    jmp  newread
98
    jmp  newread
99
 
99
 
100
   all_terminated:
100
   all_terminated:
101
 
101
 
102
   apply_changes:
102
   apply_changes:
103
 
103
 
104
    ; (3)  start icons from icon_data
104
    ; (3)  start icons from icon_data
105
 
105
 
106
    mov  edi,[icons]
106
    mov  edi,[icons]
107
    mov  esi,icon_data
107
    mov  esi,icon_data
108
  start_new:
108
  start_new:
109
 
109
 
110
    push edi
110
    push edi
111
    push esi
111
    push esi
112
 
112
 
113
    movzx eax,byte [esi]    ; x position
113
    movzx eax,byte [esi]    ; x position
114
    cmp  eax,'E'
114
    cmp  eax,'E'
115
    jg   no_left
115
    jg   no_left
116
    sub  eax,65
116
    sub  eax,65
117
    imul eax,70
117
    imul eax,70
118
    add  eax,15
118
    add  eax,15
119
    jmp  x_done
119
    jmp  x_done
120
  no_left:
120
  no_left:
121
    sub  eax,65
121
    sub  eax,65
122
    mov  ebx,9
122
    mov  ebx,9
123
    sub  ebx,eax
123
    sub  ebx,eax
124
    imul ebx,70
124
    imul ebx,70
125
    push ebx
125
    push ebx
126
    mov  eax,14
126
    mov  eax,14
127
    mcall
127
    mcall
128
    pop  ebx
128
    pop  ebx
129
    shr  eax,16
129
    shr  eax,16
130
    sub  eax,51+15
130
    sub  eax,51+15
131
    sub  eax,ebx
131
    sub  eax,ebx
132
  x_done:
132
  x_done:
133
    add  eax,0x01010101
133
    add  eax,0x01010101
134
    mov  [icon_start_parameters],eax
134
    mov  [icon_start_parameters],eax
135
 
135
 
136
    movzx eax,byte [esi+1]  ; y position
136
    movzx eax,byte [esi+1]  ; y position
137
    cmp  eax,'E'
137
    cmp  eax,'E'
138
    jg   no_up
138
    jg   no_up
139
    sub  eax,65
139
    sub  eax,65
140
    imul eax,80
140
    imul eax,80
141
    add  eax,12
141
    add  eax,12
142
    jmp  y_done
142
    jmp  y_done
143
  no_up:
143
  no_up:
144
    sub  eax,65
144
    sub  eax,65
145
    mov  ebx,9
145
    mov  ebx,9
146
    sub  ebx,eax
146
    sub  ebx,eax
147
    imul ebx,80
147
    imul ebx,80
148
    push ebx
148
    push ebx
149
    mov  eax,14
149
    mov  eax,14
150
    mcall
150
    mcall
151
    pop  ebx
151
    pop  ebx
152
    and  eax,0xffff
152
    and  eax,0xffff
153
    sub  eax,-1+20
153
    sub  eax,-1+20
154
    sub  eax,ebx
154
    sub  eax,ebx
155
  y_done:
155
  y_done:
156
    add  eax,0x01010101
156
    add  eax,0x01010101
157
    mov  [icon_start_parameters+4],eax
157
    mov  [icon_start_parameters+4],eax
158
 
158
 
159
    mov  esi,[esp]          ; icon picture
159
    mov  esi,[esp]          ; icon picture
160
    add  esi,3
160
    add  esi,3
161
    mov  edi,icon_start_parameters+8
161
    mov  edi,icon_start_parameters+8
162
    mov  ecx,30
162
    mov  ecx,30
163
    cld
163
    cld
164
    rep  movsb
164
    rep  movsb
165
 
165
 
166
    mov  esi,[esp]          ; icon application
166
    mov  esi,[esp]          ; icon application
167
    add  esi,34
167
    add  esi,34
168
    mov  edi,icon_start_parameters+8+30
168
    mov  edi,icon_start_parameters+8+30
169
    mov  ecx,30
169
    mov  ecx,30
170
    cld
170
    cld
171
    rep  movsb
171
    rep  movsb
172
 
172
 
173
    mov  esi,[esp]          ; icon text
173
    mov  esi,[esp]          ; icon text
174
    add  esi,65
174
    add  esi,65
175
    mov  edi,icon_start_parameters+8+30+30
175
    mov  edi,icon_start_parameters+8+30+30
176
    mov  ecx,10
176
    mov  ecx,10
177
    cld
177
    cld
178
    rep  movsb
178
    rep  movsb
179
 
179
 
180
    mov byte[edi],0          ; ASCII -> ASCIIZ
180
    mov byte[edi],0          ; ASCII -> ASCIIZ
181
 
181
 
182
    mov  eax,70
182
    mov  eax,70
183
    mov  ebx,finfo_start
183
    mov  ebx,finfo_start
184
    mcall
184
    mcall
185
 
185
 
186
    pop  esi edi
186
    pop  esi edi
187
 
187
 
188
    add  esi,76+2
188
    add  esi,76+2
189
 
189
 
190
    dec  edi
190
    dec  edi
191
    jnz  start_new
191
    jnz  start_new
192
 
192
 
193
    cmp  [I_Param],byte 0
193
    cmp  [I_Param],byte 0
194
    je   still
194
    je   still
195
 
195
 
196
    or   eax,-1
196
    or   eax,-1
197
    mcall
197
    mcall
198
 
198
 
199
  no_apply:
199
  no_apply:
200
 
200
 
201
 
201
 
202
    cmp  eax,22                 ; user pressed the 'add icon' button
202
    cmp  eax,22                 ; user pressed the 'add icon' button
203
    jne  no_add_icon
203
    jne  no_add_icon
204
 
204
 
205
    mov  eax,13
205
    mov  eax,13
206
    mov  ebx,19*65536+260
206
    mov  ebx,19*65536+260
207
    mov  ecx,225*65536+10
207
    mov  ecx,225*65536+10
208
    mov  edx,0xffffff
208
    mov  edx,0xffffff
209
    mcall
209
    mcall
210
    mov  eax,4
210
    mov  eax,4
211
    mov  ebx,19*65536+225
211
    mov  ebx,19*65536+225
212
    mov  ecx,0xc0ff0000
212
    mov  ecx,0xc0ff0000
213
    mov  edx,add_text
213
    mov  edx,add_text
214
    mov  edi,0xffffff
214
    mov  edi,0xffffff
215
    mcall
215
    mcall
216
 
216
 
217
    mov  eax,10
217
    mov  eax,10
218
    mcall
218
    mcall
219
    cmp  eax,3
219
    cmp  eax,3
220
    jne  still
220
    jne  still
221
    mov  al,17
221
    mov  al,17
222
    mcall
222
    mcall
223
    shr  eax,8
223
    shr  eax,8
224
    cmp  eax,40
224
    cmp  eax,40
225
    jb   no_f
225
    jb   no_f
226
    sub  eax,40
226
    sub  eax,40
227
 
227
 
228
    xor  edx,edx  ; bcd -> 10
228
    xor  edx,edx  ; bcd -> 10
229
    mov  ebx,16
229
    mov  ebx,16
230
    div  ebx
230
    div  ebx
231
    imul eax,10
231
    imul eax,10
232
    add  eax,edx
232
    add  eax,edx
233
 
233
 
234
    mov  ebx,eax
234
    mov  ebx,eax
235
    add  ebx,icons_reserved
235
    add  ebx,icons_reserved
236
    cmp  [ebx],byte 'x'
236
    cmp  [ebx],byte 'x'
237
    je   no_f
237
    je   no_f
238
    mov  [ebx],byte 'x'
238
    mov  [ebx],byte 'x'
239
 
239
 
240
    xor  edx,edx
240
    xor  edx,edx
241
    mov  ebx,10
241
    mov  ebx,10
242
    div  ebx
242
    div  ebx
243
    add  eax,65
243
    add  eax,65
244
    add  edx,65
244
    add  edx,65
245
    mov  [icon_default+0],dl
245
    mov  [icon_default+0],dl
246
    mov  [icon_default+1],al
246
    mov  [icon_default+1],al
247
 
247
 
248
    inc  dword [icons]
248
    inc  dword [icons]
249
    mov  edi,[icons]
249
    mov  edi,[icons]
250
    dec  edi
250
    dec  edi
251
    imul edi,76+2
251
    imul edi,76+2
252
    add  edi,icon_data
252
    add  edi,icon_data
253
 
253
 
254
    mov  [current_icon],edi
254
    mov  [current_icon],edi
255
 
255
 
256
    mov  esi,icon_default
256
    mov  esi,icon_default
257
    mov  ecx,76+2
257
    mov  ecx,76+2
258
    cld
258
    cld
259
    rep  movsb
259
    rep  movsb
260
 
260
 
261
  no_f:
261
  no_f:
262
 
262
 
263
    call draw_window
263
    call draw_window
264
 
264
 
265
    jmp  still
265
    jmp  still
266
 
266
 
267
  no_add_icon:
267
  no_add_icon:
268
 
268
 
269
 
269
 
270
    cmp  eax,23                     ; user pressed the remove icon button
270
    cmp  eax,23                     ; user pressed the remove icon button
271
    jne  no_remove_icon
271
    jne  no_remove_icon
272
 
272
 
273
    mov  eax,13
273
    mov  eax,13
274
    mov  ebx,19*65536+260
274
    mov  ebx,19*65536+260
275
    mov  ecx,225*65536+10
275
    mov  ecx,225*65536+10
276
    mov  edx,0xffffff
276
    mov  edx,0xffffff
277
    mcall
277
    mcall
278
    mov  eax,4
278
    mov  eax,4
279
    mov  ebx,19*65536+225
279
    mov  ebx,19*65536+225
280
    mov  ecx,0xc0ff0000
280
    mov  ecx,0xc0ff0000
281
    mov  edx,rem_text
281
    mov  edx,rem_text
282
    mov  edi,0xffffff
282
    mov  edi,0xffffff
283
    mcall
283
    mcall
284
 
284
 
285
    mov  eax,10
285
    mov  eax,10
286
    mcall
286
    mcall
287
    cmp  eax,3
287
    cmp  eax,3
288
    jne  no_found
288
    jne  no_found
289
    mov  al,17
289
    mov  al,17
290
    mcall
290
    mcall
291
    shr  eax,8
291
    shr  eax,8
292
    cmp  eax,40
292
    cmp  eax,40
293
    jb   no_found
293
    jb   no_found
294
    sub  eax,40
294
    sub  eax,40
295
 
295
 
296
    xor  edx,edx
296
    xor  edx,edx
297
    mov  ebx,16
297
    mov  ebx,16
298
    div  ebx
298
    div  ebx
299
    imul eax,10
299
    imul eax,10
300
    add  eax,edx
300
    add  eax,edx
301
 
301
 
302
    mov  ebx,eax
302
    mov  ebx,eax
303
    add  ebx,icons_reserved
303
    add  ebx,icons_reserved
304
    cmp  [ebx],byte 'x'
304
    cmp  [ebx],byte 'x'
305
    jne  no_found
305
    jne  no_found
306
    mov  [ebx],byte ' '
306
    mov  [ebx],byte ' '
307
 
307
 
308
    xor  edx,edx
308
    xor  edx,edx
309
    mov  ebx,10
309
    mov  ebx,10
310
    div  ebx
310
    div  ebx
311
    shl  eax,8
311
    shl  eax,8
312
    mov  al,dl
312
    mov  al,dl
313
 
313
 
314
    add  eax,65*256+65
314
    add  eax,65*256+65
315
 
315
 
316
    mov  esi,icon_data
316
    mov  esi,icon_data
317
    mov  edi,76+2
317
    mov  edi,76+2
318
    imul edi,[icons]
318
    imul edi,[icons]
319
    add  edi,icon_data
319
    add  edi,icon_data
320
  news:
320
  news:
321
    cmp  word [esi],ax
321
    cmp  word [esi],ax
322
    je   foundi
322
    je   foundi
323
    add  esi,76+2
323
    add  esi,76+2
324
    cmp  esi,edi
324
    cmp  esi,edi
325
    jb   news
325
    jb   news
326
    jmp  no_found
326
    jmp  no_found
327
 
327
 
328
  foundi:
328
  foundi:
329
 
329
 
330
    mov  ecx,edi
330
    mov  ecx,edi
331
    sub  ecx,esi
331
    sub  ecx,esi
332
 
332
 
333
    mov  edi,esi
333
    mov  edi,esi
334
    add  esi,76+2
334
    add  esi,76+2
335
 
335
 
336
    cld
336
    cld
337
    rep  movsb
337
    rep  movsb
338
 
338
 
339
    dec  [icons]
339
    dec  [icons]
340
 
340
 
341
    mov  eax,icon_data
341
    mov  eax,icon_data
342
    mov  [current_icon],eax
342
    mov  [current_icon],eax
343
 
343
 
344
  no_found:
344
  no_found:
345
 
345
 
346
    call draw_window
346
    call draw_window
347
 
347
 
348
    jmp  still
348
    jmp  still
349
 
349
 
350
 
350
 
351
 
351
 
352
  no_remove_icon:
352
  no_remove_icon:
353
 
353
 
354
 
354
 
355
    cmp  eax,40                 ; user pressed button for icon position
355
    cmp  eax,40                 ; user pressed button for icon position
356
    jb   no_on_screen_button
356
    jb   no_on_screen_button
357
 
357
 
358
    sub  eax,40
358
    sub  eax,40
359
    mov  edx,eax
359
    mov  edx,eax
360
    shl  eax,4
360
    shl  eax,4
361
    and  edx,0xf
361
    and  edx,0xf
362
    mov  dh,ah
362
    mov  dh,ah
363
    add  edx,65*256+65
363
    add  edx,65*256+65
364
 
364
 
365
    mov  esi,icon_data
365
    mov  esi,icon_data
366
    mov  ecx,[icons]
366
    mov  ecx,[icons]
367
    cld
367
    cld
368
   findl1:
368
   findl1:
369
    cmp  dx,[esi]
369
    cmp  dx,[esi]
370
    je   foundl1
370
    je   foundl1
371
    add  esi,76+2
371
    add  esi,76+2
372
    loop findl1
372
    loop findl1
373
    jmp  still
373
    jmp  still
374
 
374
 
375
   foundl1:
375
   foundl1:
376
 
376
 
377
    mov  [current_icon],esi
377
    mov  [current_icon],esi
378
 
378
 
379
    call print_strings
379
    call print_strings
380
 
380
 
381
    jmp  still
381
    jmp  still
382
 
382
 
383
  no_on_screen_button:
383
  no_on_screen_button:
384
 
384
 
385
 
385
 
386
    jmp  still
386
    jmp  still
387
 
387
 
388
 
388
 
389
  key:                          ; key
389
  key:                          ; key
390
    mov  al,2                   ; just read it and ignore
390
    mov  al,2                   ; just read it and ignore
391
    mcall
391
    mcall
392
    jmp  still
392
    jmp  still
393
 
393
 
394
current_icon dd icon_data
394
current_icon dd icon_data
395
 
395
 
396
 
396
 
397
print_strings:
397
print_strings:
398
 
398
 
399
    pusha
399
    pusha
400
 
400
 
401
    mov  eax,13              ; clear text area
401
    mov  eax,13              ; clear text area
402
    mov  ebx,95*65536+180
402
    mov  ebx,95*65536+180
403
    mov  ecx,253*65536+40
403
    mov  ecx,253*65536+40
404
    mov  edx,0xffffff
404
    mov  edx,0xffffff
405
    mcall
405
    mcall
406
 
406
 
407
    mov  eax,4               ; icon text
407
    mov  eax,4               ; icon text
408
    mov  ebx,95*65536+253
408
    mov  ebx,95*65536+253
409
    mov  ecx,0x000000
409
    mov  ecx,0x000000
410
    mov  edx,[current_icon]
410
    mov  edx,[current_icon]
411
    add  edx,65
411
    add  edx,65
412
    mov  esi,10
412
    mov  esi,10
413
    mcall
413
    mcall
414
 
414
 
415
    ;mov  eax,4               ; icon application
415
    ;mov  eax,4               ; icon application
416
    add  ebx,14
416
    add  ebx,14
417
    mov  edx,[current_icon]
417
    mov  edx,[current_icon]
418
    add  edx,34
418
    add  edx,34
419
    mov  esi,30
419
    mov  esi,30
420
    mcall
420
    mcall
421
 
421
 
422
    ;mov  eax,4               ; icon file
422
    ;mov  eax,4               ; icon file
423
    add  ebx,14
423
    add  ebx,14
424
    mov  edx,[current_icon]
424
    mov  edx,[current_icon]
425
    add  edx,3
425
    add  edx,3
426
    mov  esi,30
426
    mov  esi,30
427
    mcall
427
    mcall
428
 
428
 
429
    popa
429
    popa
430
 
430
 
431
    ret
431
    ret
432
 
432
 
433
 
433
 
434
load_icon_list:
434
load_icon_list:
435
 
435
 
436
    ;pusha
436
    ;pusha
437
 
437
 
438
    mov   eax,70
438
    mov   eax,70
439
    mov   ebx,finfo
439
    mov   ebx,finfo
440
    mov   dword[ebx],0
440
    mov   dword[ebx],0
441
    mov   dword[ebx+12],4096   ; max size of icons.dat (in current format) is 4 kb
441
    mov   dword[ebx+12],4096   ; max size of icons.dat (in current format) is 4 kb
442
    mcall
442
    mcall
443
 
443
 
444
    mov   eax,ebx
444
    mov   eax,ebx
445
    add   eax,2
445
    add   eax,2
446
    xor   edx,edx
446
    xor   edx,edx
447
    mov   ebx,76+2
447
    mov   ebx,76+2
448
    div   ebx
448
    div   ebx
449
    mov   [icons],eax
449
    mov   [icons],eax
450
 
450
 
451
    mov   edi,icons_reserved   ; clear reserved area
451
    mov   edi,icons_reserved   ; clear reserved area
452
    mov   eax,32
452
    mov   eax,32
453
    mov   ecx,10*10
453
    mov   ecx,10*10
454
    cld
454
    cld
455
    rep   stosb
455
    rep   stosb
456
 
456
 
457
    mov   ecx,[icons]          ; set used icons to reserved area
457
    mov   ecx,[icons]          ; set used icons to reserved area
458
    mov   esi,icon_data
458
    mov   esi,icon_data
459
    cld
459
    cld
460
  ldl1:
460
  ldl1:
461
    movzx ebx,byte [esi+1]
461
    movzx ebx,byte [esi+1]
462
    sub   ebx,65
462
    sub   ebx,65
463
    imul  ebx,10
463
    imul  ebx,10
464
    movzx eax,byte [esi]
464
    movzx eax,byte [esi]
465
    add   ebx,eax
465
    add   ebx,eax
466
    sub   ebx,65
466
    sub   ebx,65
467
    add   ebx,icons_reserved
467
    add   ebx,icons_reserved
468
    mov   [ebx],byte 'x'
468
    mov   [ebx],byte 'x'
469
    add   esi,76+2
469
    add   esi,76+2
470
    loop  ldl1
470
    loop  ldl1
471
 
471
 
472
    ret
472
    ret
473
 
473
 
474
 
474
 
475
check_parameters:
475
check_parameters:
476
 
476
 
477
    cmp   [I_Param],dword 'BOOT'
477
    cmp   [I_Param],dword 'BOOT'
478
    je    chpl1
478
    je    chpl1
479
    ret
479
    ret
480
 
480
 
481
   chpl1:
481
   chpl1:
482
    mov   eax,21
482
    mov   eax,21
483
    jmp   apply_changes
483
    jmp   apply_changes
484
 
484
 
485
 
485
 
486
positions dd 65,34,3
486
positions dd 65,34,3
487
 
487
 
488
read_string:
488
read_string:
489
 
489
 
490
    sub  eax,11
490
    sub  eax,11
491
    shl  eax,2
491
    shl  eax,2
492
    add  eax,positions
492
    add  eax,positions
493
    mov  eax,[eax]
493
    mov  eax,[eax]
494
 
494
 
495
    mov  esi,[current_icon]
495
    mov  esi,[current_icon]
496
    add  esi,eax
496
    add  esi,eax
497
    mov  [addr],esi
497
    mov  [addr],esi
498
 
498
 
499
    mov  edi,[addr]
499
    mov  edi,[addr]
500
    mov  eax,'_'
500
    mov  eax,'_'
501
    mov  ecx,30
501
    mov  ecx,30
502
    cld
502
    cld
503
    rep  stosb
503
    rep  stosb
504
 
504
 
505
    call print_strings
505
    call print_strings
506
 
506
 
507
    mov  edi,[addr]
507
    mov  edi,[addr]
508
  f11:
508
  f11:
509
    mov  eax,10
509
    mov  eax,10
510
    mcall
510
    mcall
511
    cmp  eax,2
511
    cmp  eax,2
512
    jz   fbu
512
    jz   fbu
513
    jmp  rs_done
513
    jmp  rs_done
514
  fbu:
514
  fbu:
515
    mov  eax,2
515
    mov  eax,2
516
    mcall
516
    mcall
517
    shr  eax,8
517
    shr  eax,8
518
    cmp  eax,13
518
    cmp  eax,13
519
    je   rs_done
519
    je   rs_done
520
    cmp  eax,8
520
    cmp  eax,8
521
    jnz  nobsl
521
    jnz  nobsl
522
    cmp  edi,[addr]
522
    cmp  edi,[addr]
523
    jz   f11
523
    jz   f11
524
    dec  edi
524
    dec  edi
525
    mov  [edi],byte ' '
525
    mov  [edi],byte ' '
526
    call print_strings
526
    call print_strings
527
    jmp  f11
527
    jmp  f11
528
  nobsl:
528
  nobsl:
529
    cmp  eax,31
529
    cmp  eax,31
530
    jbe  f11
530
    jbe  f11
531
    mov  [edi],al
531
    mov  [edi],al
532
    call print_strings
532
    call print_strings
533
 
533
 
534
    add  edi,1
534
    add  edi,1
535
    mov  esi,[addr]
535
    mov  esi,[addr]
536
    add  esi,30
536
    add  esi,30
537
    cmp  esi,edi
537
    cmp  esi,edi
538
    jnz  f11
538
    jnz  f11
539
 
539
 
540
   rs_done:
540
   rs_done:
541
 
541
 
542
    mov  ecx,[addr]
542
    mov  ecx,[addr]
543
    add  ecx,30
543
    add  ecx,30
544
    sub  ecx,edi
544
    sub  ecx,edi
545
    mov  eax,32
545
    mov  eax,32
546
    cld
546
    cld
547
    rep  stosb
547
    rep  stosb
548
 
548
 
549
    call print_strings
549
    call print_strings
550
 
550
 
551
    ret
551
    ret
552
 
552
 
553
 
553
 
554
 
554
 
555
;   *********************************************
555
;   *********************************************
556
;   *******  WINDOW DEFINITIONS AND DRAW ********
556
;   *******  WINDOW DEFINITIONS AND DRAW ********
557
;   *********************************************
557
;   *********************************************
558
 
558
 
559
 
559
 
560
draw_window:
560
draw_window:
561
 
561
 
562
    mov  eax,12                    ; function 12:tell os about windowdraw
562
    mov  eax,12                    ; function 12:tell os about windowdraw
563
    mov  ebx,1                     ; 1, start of draw
563
    mov  ebx,1                     ; 1, start of draw
564
    mcall
564
    mcall
565
 
565
 
566
                                   ; DRAW WINDOW
566
                                   ; DRAW WINDOW
567
    xor  eax,eax
567
    xor  eax,eax
568
    mov  ebx,210*65536+300
568
    mov  ebx,210*65536+300
569
    mov  ecx,30*65536+390
569
    mov  ecx,30*65536+390
570
    mov  edx,0x33ffffff
570
    mov  edx,0x33ffffff
571
    mov  edi,title
571
    mov  edi,title
572
    mcall
572
    mcall
573
 
573
 
574
    mov  eax,13                    ; WINDOW AREA
574
    mov  eax,13                    ; WINDOW AREA
575
    mov  ebx,15*65536+260
575
    mov  ebx,15*65536+260
576
    mov  ecx,10*65536+200
576
    mov  ecx,10*65536+200
577
    mov  edx,0x3366cc
577
    mov  edx,0x3366cc
578
    mcall
578
    mcall
579
 
579
 
580
    mov  eax,38                    ; VERTICAL LINE ON WINDOW AREA
580
    mov  eax,38                    ; VERTICAL LINE ON WINDOW AREA
581
    mov  ebx,145*65536+145
581
    mov  ebx,145*65536+145
582
    mov  ecx,10*65536+235
582
    mov  ecx,10*65536+235
583
    mov  edx,0xffffff
583
    mov  edx,0xffffff
584
    mcall
584
    mcall
585
 
585
 
586
    ;mov  eax,38                    ; HOROZONTAL LINE ON WINDOW AREA
586
    ;mov  eax,38                    ; HOROZONTAL LINE ON WINDOW AREA
587
    mov  ebx,15*65536+280
587
    mov  ebx,15*65536+280
588
    mov  ecx,110*65536+110
588
    mov  ecx,110*65536+110
589
    mov  edx,0xffffff
589
    mov  edx,0xffffff
590
    mcall
590
    mcall
591
 
591
 
592
    mov  eax,8                     ; TEXT ENTER BUTTONS
592
    mov  eax,8                     ; TEXT ENTER BUTTONS
593
    mov  ebx,15*65536+72
593
    mov  ebx,15*65536+72
594
    mov  ecx,250*65536+13
594
    mov  ecx,250*65536+13
595
    mov  edx,11
595
    mov  edx,11
596
    mov  esi,[bcolor]
596
    mov  esi,[bcolor]
597
    mcall
597
    mcall
598
    inc  edx
598
    inc  edx
599
    add  ecx,14*65536
599
    add  ecx,14*65536
600
    mcall
600
    mcall
601
    inc  edx
601
    inc  edx
602
    add  ecx,14*65536
602
    add  ecx,14*65536
603
    mcall
603
    mcall
604
 
604
 
605
    ;mov  eax,8                     ; APPLY AND SAVE CHANGES BUTTON
605
    ;mov  eax,8                     ; APPLY AND SAVE CHANGES BUTTON
606
    mov  ebx,15*65536+259
606
    mov  ebx,15*65536+259
607
    mov  ecx,304*65536+15
607
    mov  ecx,304*65536+15
608
    mov  edx,21
608
    mov  edx,21
609
    mov  esi,[bcolor]
609
    mov  esi,[bcolor]
610
    mcall
610
    mcall
611
 
611
 
612
    ;mov  eax,8                     ; ADD ICON BUTTON
612
    ;mov  eax,8                     ; ADD ICON BUTTON
613
    mov  ebx,15*65536+129
613
    mov  ebx,15*65536+129
614
    add  ecx,14*2*65536
614
    add  ecx,14*2*65536
615
    inc  edx
615
    inc  edx
616
    mcall
616
    mcall
617
 
617
 
618
    ;mov  eax,8                     ; REMOVE ICON BUTTON
618
    ;mov  eax,8                     ; REMOVE ICON BUTTON
619
    add  ebx,130*65536
619
    add  ebx,130*65536
620
    inc  edx
620
    inc  edx
621
    mcall
621
    mcall
622
 
622
 
623
    xor  eax,eax                    ; DRAW BUTTONS ON WINDOW AREA
623
    xor  eax,eax                    ; DRAW BUTTONS ON WINDOW AREA
624
    mov  ebx,15*65536+25
624
    mov  ebx,15*65536+25
625
    mov  ecx,10*65536+19
625
    mov  ecx,10*65536+19
626
    mov  edi,icon_table
626
    mov  edi,icon_table
627
    mov  edx,40
627
    mov  edx,40
628
   newbline:
628
   newbline:
629
 
629
 
630
    cmp  [edi],byte 'x'
630
    cmp  [edi],byte 'x'
631
    jne  no_button
631
    jne  no_button
632
 
632
 
633
    mov  esi,0x5577cc
633
    mov  esi,0x5577cc
634
    cmp  [edi+100],byte 'x'
634
    cmp  [edi+100],byte 'x'
635
    jne  nores
635
    jne  nores
636
    mov  esi,0xcc5555
636
    mov  esi,0xcc5555
637
  nores:
637
  nores:
638
 
638
 
639
    push eax
639
    push eax
640
    mov  eax,8
640
    mov  eax,8
641
    mcall
641
    mcall
642
    pop  eax
642
    pop  eax
643
 
643
 
644
  no_button:
644
  no_button:
645
 
645
 
646
    add  ebx,26*65536
646
    add  ebx,26*65536
647
 
647
 
648
    inc  edi
648
    inc  edi
649
    inc  edx
649
    inc  edx
650
 
650
 
651
    inc  al
651
    inc  al
652
    cmp  al,9
652
    cmp  al,9
653
    jbe  newbline
653
    jbe  newbline
654
    mov  al,0
654
    mov  al,0
655
 
655
 
656
    add  edx,6
656
    add  edx,6
657
 
657
 
658
    ror  ebx,16
658
    ror  ebx,16
659
    mov  bx,15
659
    mov  bx,15
660
    ror  ebx,16
660
    ror  ebx,16
661
    add  ecx,20*65536
661
    add  ecx,20*65536
662
 
662
 
663
    inc  ah
663
    inc  ah
664
    cmp  ah,9
664
    cmp  ah,9
665
    jbe  newbline
665
    jbe  newbline
666
 
666
 
667
    mov  ebx,24*65536+225
667
    mov  ebx,24*65536+225
668
    mov  ecx,0xffffff
668
    mov  ecx,0xffffff
669
    mov  edx,text
669
    mov  edx,text
670
    mov  esi,36
670
    mov  esi,36
671
    mov  eax,4
671
    mov  eax,4
672
  newline:
672
  newline:
673
    mov  ecx,[edx]
673
    mov  ecx,[edx]
674
    add  edx,4
674
    add  edx,4
675
    mcall
675
    mcall
676
    add  ebx,14
676
    add  ebx,14
677
    add  edx,36
677
    add  edx,36
678
    cmp  [edx],byte 'x'
678
    cmp  [edx],byte 'x'
679
    jne  newline
679
    jne  newline
680
 
680
 
681
    call print_strings
681
    call print_strings
682
 
682
 
683
    mov  eax,12                    ; function 12:tell os about windowdraw
683
    mov  eax,12                    ; function 12:tell os about windowdraw
684
    mov  ebx,2                     ; 2, end of draw
684
    mov  ebx,2                     ; 2, end of draw
685
    mcall
685
    mcall
686
 
686
 
687
    ret
687
    ret
688
 
688
 
689
 
689
 
690
; DATA AREA
690
; DATA AREA
691
 
691
 
692
bcolor dd 0x335599
692
bcolor dd 0x335599
693
 
693
 
694
icon_table:
694
icon_table:
695
 
695
 
696
    times 4  db  'xxxx  xxxx'
696
    times 4  db  'xxxx  xxxx'
697
    times 2  db  '          '
697
    times 2  db  '          '
698
    times 3  db  'xxxx  xxxx'
698
    times 3  db  'xxxx  xxxx'
699
    times 1  db  '          '
699
    times 1  db  '          '
700
 
700
 
701
icons_reserved:
701
icons_reserved:
702
 
702
 
703
    times 10  db  '          '
703
    times 10  db  '          '
704
 
704
 
705
 
705
 
706
text:
706
text:
707
    db 0,0,0,0,         'Click on icon position to edit      '
707
    db 0,0,0,0,         'Click on icon position to edit      '
708
    db 0,0,0,0,         '                                    '
708
    db 0,0,0,0,         '                                    '
709
    db 255,255,255,0  , 'Icon text                           '
709
    db 255,255,255,0  , 'Icon text                           '
710
    db 255,255,255,0  , 'Icon app                            '
710
    db 255,255,255,0  , 'Icon app                            '
711
    db 255,255,255,0  , 'Icon file                           '
711
    db 255,255,255,0  , 'Icon file                           '
712
    db 0,0,0,0,         '                                    '
712
    db 0,0,0,0,         '                                    '
713
    db 255,255,255,0,   '       Save and apply all changes   '
713
    db 255,255,255,0,   '       Save and apply all changes   '
714
    db 0,0,0,0,         '                                    '
714
    db 0,0,0,0,         '                                    '
715
    db 255,255,255,0,   '     Add icon            Remove icon'
715
    db 255,255,255,0,   '     Add icon            Remove icon'
716
    db                  'x' ; <- End marker, dont delete
716
    db                  'x' ; <- End marker, dont delete
717
 
717
 
718
 
718
 
719
title    db 'Icon manager',0
719
title    db 'Icon manager',0
720
 
720
 
721
icons dd 0
721
icons dd 0
722
 
722
 
723
addr  dd 0
723
addr  dd 0
724
ya    dd 0
724
ya    dd 0
725
 
725
 
726
add_text    db 'Press button of unused icon position',0
726
add_text    db 'Press button of unused icon position',0
727
 
727
 
728
rem_text    db 'Press button of used icon           ',0
728
rem_text    db 'Press button of used icon           ',0
729
 
729
 
730
finfo_start:
730
finfo_start:
731
          dd 7
731
          dd 7
732
          dd 0
732
          dd 0
733
          dd icon_start_parameters
733
          dd icon_start_parameters
734
          dd 0
734
          dd 0
735
          dd 0
735
          dd 0
736
          db 0
736
          db 0
737
          dd icon_path
737
          dd icon_path
738
 
738
 
739
icon_path db '/sys/@ICON',0
739
icon_path db '/sys/@ICON',0
740
 
740
 
741
finfo:
741
finfo:
742
          dd 0
742
          dd 0
743
          dd 0
743
          dd 0
744
          dd 0
744
          dd 0
745
          dd 0
745
          dd 0
746
          dd icon_data
746
          dd icon_data
747
          db 0
747
          db 0
748
          dd icon_list
748
          dd icon_list
749
 
749
 
750
icon_list db '/sys/icons.dat',0
750
icon_list db '/sys/icons.dat',0
751
 
751
 
752
icon_start_parameters:
752
icon_start_parameters:
753
      db   25,1,1,1
753
      db   25,1,1,1
754
      db   35,1,1,1
754
      db   35,1,1,1
755
      db   '/rd/1/icons/fs.ico',0
755
      db   '/sys/icons/fs.ico',0
756
      rb   12
756
      rb   12
757
      db   '/rd/1/kfar',0
757
      db   '/sys/kfar',0
758
      rb   20
758
      rb   20
759
      db   'KFAR      '
759
      db   'KFAR      '
760
 
760
 
761
icon_default:
761
icon_default:
762
      db   'AA-/rd/1/icons/fs.ico            -/rd/1/kfar                    -KFAR      *',13,10
762
      db   'AA-/sys/icons/fs.ico             -/sys/kfar                     -KFAR      *',13,10
763
 
763
 
764
icon_data:   ; data length 76+2
764
icon_data:   ; data length 76+2
765
 
765
 
766
rb 4096
766
rb 4096
767
 
767
 
768
I_Param:
768
I_Param:
769
 
769
 
770
I_END:
770
I_END: