Subversion Repositories Kolibri OS

Rev

Rev 539 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
31 halyavin 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;                                              ;
3
;   SYSTEM X-TREE BROWSER                      ;
4
;                                              ;
5
;   Author: Pavlushin Evgeni waptap@mail.ru    ;
6
;                   site: www.deck4.narod.ru   ;
7
;                                              ;
8
;   Compile with FASM for MenuetOS             ;
9
;                                              ;
10
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
11
 
12
;Bug report +bug deleted  -bug not deleted
13
;show/fade del notwork+
14
;64Ver Run file from HD bug deleted.
15
;65Ver The bad scroll realization
16
;66Ver The good scroll realization, url line anti-flick
17
;67Ver Url line monolith procedure
18
;68Ver Mini icon on left of file name
19
;69Ver Getimg proc size minus 900 bytes
20
;70Ver Del data area ramsize minus 140000 bytes
21
;72Ver Quick sort, ramsize minus 200000 bytes
22
;73Ver Url flick and out bugs delete
23
;74Ver scroll bug deleted
24
;75Ver hd partition fast change button. Add bmp,txt,exec,asm and inc icons.
25
; sort type in headmenu bug del
26
;78Ver directory extension bug fix by Asko Vuori
27
;79Ver Asko Vuori volume label add and "put in command line" bug fix
28
;80Ver prompt edit fatal bug deleted, antiflick when move list up/down
29
;81Ver Save Dialog bug deleted
134 diamond 30
;82Ver Rewritten to function 70. Corrected work with scrollbar.
156 diamond 31
;83Ver CD-ROM support
32
;84Ver URL line editor corrected
134 diamond 33
;1560000 bytes memory!
31 halyavin 34
 
35
;******************************************************************************
36
  use32
131 diamond 37
  org	   0x0
38
  db	 'MENUET01'   ; 8 byte id
39
  dd	 0x01		; header version
40
  dd	 START	      ; program start
41
  dd	 I_END	      ; program image size
42
  dd	 RAM_END      ; memory
43
  dd	 RAM_END      ; stack
44
  dd	 param_area ,0x0   ; param,icon
31 halyavin 45
;  dd 0,0
46
 
47
;******************************************************************************
485 heavyiron 48
include '..\..\..\macros.inc'
31 halyavin 49
include 'ascl.inc'
50
include 'ascgl.inc'
131 diamond 51
 
52
START:		    ; start of execution
31 halyavin 53
; //// Willow
131 diamond 54
;    mov eax,58
55
;    mov ebx,MRUfile
485 heavyiron 56
;    mcall
31 halyavin 57
; //// Willow
131 diamond 58
    mcall 18,11,1,table_area
134 diamond 59
    cmp [edx+2],byte 0
131 diamond 60
    je	  no_hdpartition_on_hd0
134 diamond 61
    mov [hdimg1], aHD0
131 diamond 62
 no_hdpartition_on_hd0:
134 diamond 63
    cmp [edx+3],byte 0
131 diamond 64
    je	  no_hdpartition_on_hd1
134 diamond 65
    mov [hdimg2], aHD1
131 diamond 66
 no_hdpartition_on_hd1:
134 diamond 67
    cmp [edx+4],byte 0
131 diamond 68
    je	  no_hdpartition_on_hd2
134 diamond 69
    mov [hdimg3], aHD2
131 diamond 70
 no_hdpartition_on_hd2:
134 diamond 71
    cmp [edx+5],byte 0
131 diamond 72
    je	  no_hdpartition_on_hd3
134 diamond 73
    mov [hdimg4], aHD3
131 diamond 74
 no_hdpartition_on_hd3:
156 diamond 75
        test    byte [edx+1], 80h
76
        jz      @f
77
        mov     [hdimg1], aCD0
78
        mov     [hdimg1+4], 'CD-R'
79
        mov     [hdimg1+8], 'OM  '
80
@@:
81
        test    byte [edx+1], 20h
82
        jz      @f
83
        mov     [hdimg2], aCD1
84
        mov     [hdimg2+4], 'CD-R'
85
        mov     [hdimg2+8], 'OM  '
86
@@:
87
        test    byte [edx+1], 8
88
        jz      @f
89
        mov     [hdimg3], aCD2
90
        mov     [hdimg3+4], 'CD-R'
91
        mov     [hdimg3+8], 'OM  '
92
@@:
93
        test    byte [edx+1], 2
94
        jz      @f
95
        mov     [hdimg4], aCD3
96
        mov     [hdimg4+4], 'CD-R'
97
        mov     [hdimg4+8], 'OM  '
98
@@:
31 halyavin 99
 
100
    mov eax,40
101
    mov ebx,0100111b
485 heavyiron 102
    mcall
31 halyavin 103
 
104
    cmp byte [param_area],0 ;test parameters line
131 diamond 105
    jne no_brow     ;it's dialog
134 diamond 106
    mov [browser], 1   ;it's browser
107
    jmp no_dlg
31 halyavin 108
no_brow:
109
 
110
    mov al,byte [param_area+5]
111
    mov [dlg_type],al
112
 
113
    mov eax,9
114
    mov ebx,procinfo
115
    mov ecx,-1
485 heavyiron 116
    mcall
31 halyavin 117
 
118
    mov eax,dword [procinfo+30]
119
    mov edi,MYPID+4-1
120
    mov ecx,4
121
    mov ebx,10
122
    cld
123
 
124
new_d:
125
    xor edx,edx
126
    div ebx
127
    add dl,'0'
128
    mov [edi],dl
129
    dec edi
130
    loop new_d
131
 
132
    movzx eax,byte [param_area]
133
    sub eax,48
134
    imul eax,10
135
    movzx ebx,byte [param_area+1]
136
    add eax,ebx
137
    sub eax,48
138
    imul eax,10
139
    movzx ebx,byte [param_area+2]
140
    add eax,ebx
141
    sub eax,48
142
    imul eax,10
143
    movzx ebx,byte [param_area+3]
144
    add eax,ebx
145
    sub eax,48
146
 
147
    mov ecx,eax ;pid to ecx
148
    mov eax,60
149
    mov ebx,2
150
    mov edx,MYPID
151
    mov esi,4
485 heavyiron 152
    mcall
31 halyavin 153
no_dlg:
154
 
155
    giftoimg but_file,tempimg
156
 
157
;************************
158
;      Get images
159
;************************
160
 
161
    mov eax,0  ;x
131 diamond 162
    mov ebx,0	    ;y
31 halyavin 163
    mov esi,286     ;xs
131 diamond 164
    mov edi,16		;ys
31 halyavin 165
    mov ecx,tempimg ;src
166
    mov edx,butimg   ;dest
167
    call getimgproc
168
    mov eax,288
169
    mov esi,60
170
    mov edx,logoimg  ;dest
171
    call getimgproc
172
    mov eax,0  ;x
131 diamond 173
    mov ebx,16	       ;y
174
    mov esi,51	       ;xs
31 halyavin 175
    mov edi,esi      ;ys
131 diamond 176
    mov edx,logoinfimg	     ;dest
31 halyavin 177
    call getimgproc
131 diamond 178
    mov eax,51	    ;x
179
    mov esi,8	    ;xs
180
    mov edi,9	     ;ys
31 halyavin 181
    mov edx,upsb   ;dest
182
    call getimgproc
183
    mov eax,51+8  ;x
184
    mov edx,dnsb   ;dest
185
    call getimgproc
186
 
187
    mov eax,51+16  ;x
131 diamond 188
    mov ebx,16	       ;y
189
    mov esi,12	       ;xs
190
    mov edi,9	     ;ys
31 halyavin 191
 
192
    mov ecx,tempimg ;src
193
    mov edx,hdico   ;dest
156 diamond 194
    mov ebp,10
31 halyavin 195
loogetimg:
196
    call getimgproc
197
    add edx,9*12*3+8
198
    add eax,12
199
    dec ebp
200
    jnz loogetimg
201
 
202
    call read_directory
203
;    call convertation
204
red:
131 diamond 205
    call draw_window	    ; at first, draw the window
31 halyavin 206
 
207
still:
208
    mov eax,9
209
    mov ebx,procinfo
210
    mov ecx,-1
485 heavyiron 211
    mcall
31 halyavin 212
 
213
    wtevent red,key,button
214
 
215
scrolltest:
216
    mov eax,37
217
    mov ebx,2
485 heavyiron 218
    mcall
134 diamond 219
    dec eax
31 halyavin 220
    jne still
221
 
222
scrl:
223
    mov eax,37
224
    mov ebx,1
485 heavyiron 225
    mcall
134 diamond 226
        movzx   ebx, ax         ; y
227
        shr     eax, 16         ; x
31 halyavin 228
    mov ebp,eax
502 heavyiron 229
    sub ebp,[listx] ;[procinfo.box.width]
31 halyavin 230
    sub ebp,[listxsize]
231
    add ebp,[scrollsize]
232
    cmp ebp,dword [scrollsize] ;8
134 diamond 233
    jae menu_test ; still
31 halyavin 234
 
134 diamond 235
        lea     ebp, [ebx-scrollbutsize]
236
        sub     ebp, [listy]    ; up scroll
237
        jl      menu_test
238
        mov     ecx, [listysize]
239
        sub     ecx, 2*scrollbutsize
240
        mov     eax, [scroll_height]
241
        cmp     ebp, ecx
242
        jge     menu_test
243
        sub     ecx, eax
244
        shr     eax, 1
245
        sub     ebp, eax
246
        jge     @f
247
        xor     ebp, ebp
248
@@:
249
        cmp     ebp, ecx
250
        jl      @f
251
        mov     ebp, ecx
252
@@:
253
        xor     edx, edx
254
        mov     eax, [listysize]
255
        sub     eax, 2
256
        mov     ebx, 10
257
        div     ebx
258
        mov     ebx, eax
259
        cmp     ebx, [listsize]
260
        jae     notusescrl
261
        mov     eax, [listsize]
262
        sub     eax, ebx
263
        mul     ebp
264
        div     ecx
265
        cmp     eax, [filecursor]
266
        jz      still
267
        mov     [filecursor], eax
268
        jmp     usescrl
31 halyavin 269
notusescrl:
134 diamond 270
        cmp     [filecursor], 0
271
        jz      still
31 halyavin 272
    mov [filecursor],0 ;ebp
273
usescrl:
274
 
275
    mov [flick],1
276
    jmp anti_flick ;red
277
 
278
menu_test:
279
    cmp [pmenu_draw],1 ;if menu is show, update all
280
    jne still
281
    mov [pmenu_draw],0
131 diamond 282
    jmp red	     ;update all window
31 halyavin 283
 
284
;this function not use in dialog when poup menu's is not used
285
;in dialog's
286
 
287
;===================
288
; Test keyboard
289
;===================
131 diamond 290
key:		  ; key
31 halyavin 291
    mov  eax,2
485 heavyiron 292
    mcall
31 halyavin 293
    cmp dword [focus],0
294
    jne con_edit
295
    cmp  ah,key_Up
296
    jne  no_upk
297
    mov  ebx,1
298
    jmp  up
299
no_upk:
300
    cmp  ah,key_Down
301
    jne  no_downk
302
    mov  ebx,1
303
    jmp  down
304
no_downk:
305
    cmp  ah,key_PgUp
306
    jne  no_pgup
307
    mov  ebx,10
308
    jmp  up
309
no_pgup:
310
    cmp  ah,key_PgDown
311
    jne  no_pgdown
312
    mov  ebx,10
313
    jmp  down
314
no_pgdown:
315
    cmp  ah,key_Enter
134 diamond 316
    je   kfad
31 halyavin 317
    cmp  ah,key_Bspace
131 diamond 318
    je	     back
31 halyavin 319
    cmp  ah,key_F2
131 diamond 320
    je	     viewset
31 halyavin 321
    cmp  ah,key_F3
131 diamond 322
    je	     textopen
31 halyavin 323
    cmp  ah,key_F5
131 diamond 324
    je	     copy_to_clip
31 halyavin 325
    cmp  ah,key_F6
131 diamond 326
    je	     paste_from_clip
31 halyavin 327
    cmp  ah,key_F11
131 diamond 328
    je	     edit_prompt
31 halyavin 329
    cmp  ah,key_F12
131 diamond 330
    je	     update
31 halyavin 331
    jmp  still
332
 
333
; test input string
334
con_edit:
335
    cmp  ah,key_Enter
336
    jne  no_con_ent
337
    not  [focus]
338
    jmp  savetest
134 diamond 339
;    jmp  update
31 halyavin 340
no_con_ent:
341
    cmp  ah,key_Left
342
    jne  no_con_left
156 diamond 343
        cmp     [cursor], 0
344
        jz      still
31 halyavin 345
    dec  [cursor]
346
    mov  [flick],2
347
    jmp  anti_flick ;red
348
no_con_left:
349
    cmp  ah,key_Right
350
    jne  no_con_right
156 diamond 351
        mov     eax, [cursor]
352
        cmp     byte [path+eax], 0
353
        jz      still
31 halyavin 354
    inc  [cursor]
355
    mov  [flick],2
356
    jmp  anti_flick ;red
357
no_con_right:
358
    cmp  ah,key_Bspace
359
    jne  no_con_bspace
360
 
134 diamond 361
        mov     ebp, [cursor]
362
        test    ebp, ebp
363
        jz      still
31 halyavin 364
lobsp:
365
    mov  bl,byte [path+ebp]
366
    mov  byte [path+ebp-1],bl
367
    inc  ebp
134 diamond 368
    cmp  ebp,1024
31 halyavin 369
    jne  lobsp
370
    dec  [cursor]
371
    mov  [flick],2
372
    jmp  anti_flick ;red
373
no_con_bspace:
374
 
375
    mov  ecx,[cursor]
134 diamond 376
    mov  ebp,1022
377
        cmp     byte [path+ebp], 0
378
        jnz     still
31 halyavin 379
losx:
134 diamond 380
        cmp     ebp, ecx
381
        jbe     @f
31 halyavin 382
    mov  bl,byte [path+ebp]
383
    mov  byte [path+ebp+1],bl
384
    dec  ebp
134 diamond 385
    jmp  losx
386
@@:
31 halyavin 387
 
388
    mov  byte [path+ebp],ah
389
    inc  dword [cursor]
390
 
391
    mov  [flick],2
392
    jmp  anti_flick
393
 
394
 
395
;----------------------------
396
;Test on mouse button
397
;-----------------------------
398
 
131 diamond 399
  button:	  ; button
31 halyavin 400
    mov eax,17
485 heavyiron 401
    mcall
31 halyavin 402
 
131 diamond 403
    cmp ah,2	       ;Edit prompt line?
404
    je	    edit_prompt
31 halyavin 405
 
406
    cmp ah,4
407
    jne no_filelist
408
 
409
mousetest:
410
    mov eax,37
411
    mov ebx,1
485 heavyiron 412
    mcall
31 halyavin 413
    mov ebx,eax
131 diamond 414
    shr eax,16		 ;x
31 halyavin 415
    and ebx,0xffff   ;y
416
 
417
    sub ebx,[listy] ;80
418
    mov [mousey],ebx
419
 
420
    mov ecx,[listx]
421
    cmp eax,ecx
131 diamond 422
    jl	    still
31 halyavin 423
    add ecx,[listxsize]
424
    cmp eax,ecx
131 diamond 425
    jg	    still
31 halyavin 426
 
427
filexadd:
428
 
429
; Enter in directory
430
file_add:
431
    mov edx,0  ;for div correct work div
432
    mov eax,dword [mousey]
433
    mov ebx,10
434
    div ebx
435
 
436
    add eax,[filecursor]
437
    jmp no_kfad
438
kfad:
439
    mov eax,[filecursor]
440
no_kfad:
134 diamond 441
    mov ebx,27
31 halyavin 442
    mul ebx
134 diamond 443
    lea ebp,[convinfo+eax]
444
    mov esi,[ebp]
445
    cmp esi,-1
446
    jz  still
31 halyavin 447
 
448
    mov edi,paramtest ;clear param string
134 diamond 449
    mov ecx,1024/4
450
    xor eax,eax
451
    rep stosd
31 halyavin 452
 
134 diamond 453
        mov     edi, path
454
        mov     ecx, 1024
455
        repnz   scasb
456
        dec     edi
457
        cmp     [ebp+15], dword 'FOL '
458
        jnz     openf
459
; open directory - append its name to path
460
        cmp     ecx, 2
461
        jb      still
462
        push    edi
463
        mov     al, '/'
464
        stosb
465
        dec     ecx
466
@@:
467
        lodsb
468
        stosb
469
        test    al, al
470
        jz      @f
471
        dec     ecx
472
        jnz     @b
473
; name is too long - do not do anything
474
        pop     edi
475
        xor     eax, eax
476
        mov     ecx, path+1024
477
        sub     ecx, edi
478
        rep     stosb
479
        jmp     still
480
@@:
156 diamond 481
        sub     edi, path+1
482
        mov     [cursor], edi
134 diamond 483
        pop     edi
484
; name appended, now read new directory
31 halyavin 485
    mov [filecursor],0
486
 
487
    call read_directory
488
;;    call convertation
489
    call draw_window
134 diamond 490
    jmp still
31 halyavin 491
 
492
;Savetest
493
savetest:
494
    cmp byte [dlg_type],'S'
134 diamond 495
    jne still
496
; always force open file - this is better
497
; because there exists files without extension and folders with extension
498
        jmp     openf
499
;    mov ecx,100
500
;savetestloop:
501
;    cmp [path+ecx],byte 0
502
;    je	    next_byte
503
;    cmp [path+ecx],byte 32
504
;    je	    next_byte
505
;    cmp [path+ecx],byte '.'
506
;    je	    openf  ;it's file
507
;;    cmp [path+ecx],byte '/'
508
;;    je  no_save  ;it's dir
509
;next_byte:
510
;    dec ecx
511
;    jnz savetestloop
512
;    jmp still
31 halyavin 513
 
514
;Open/Run file
515
 
516
openf:
134 diamond 517
        push    esi edi
518
        mov     esi, path
519
        mov     edi, paramtest
520
        mov     ecx, 1024/4
521
        rep     movsd
522
        pop     edi esi
523
        add     edi, paramtest-path
31 halyavin 524
 
525
    cmp dword [focus],0 ;if prompt line with focus no add file name from frame
526
    jne file_set
527
 
134 diamond 528
        cmp     edi, paramtest+1022
529
        jae     still
530
        mov     al, '/'
531
        stosb
532
@@:
533
        lodsb
534
        stosb
535
        test    al, al
536
        jz      file_set
537
        cmp     edi, paramtest+1024
538
        jb      @b
539
        jmp     still
540
 
31 halyavin 541
file_set:
542
 
543
    cmp [browser],0
544
    jne is_brow
545
 
546
    movzx eax,byte [param_area]
547
    sub eax,48
548
    imul eax,10
549
    movzx ebx,byte [param_area+1]
550
    add eax,ebx
551
    sub eax,48
552
    imul eax,10
553
    movzx ebx,byte [param_area+2]
554
    add eax,ebx
555
    sub eax,48
556
    imul eax,10
557
    movzx ebx,byte [param_area+3]
558
    add eax,ebx
559
    sub eax,48
560
 
561
    mov ecx,eax ;pid to ecx
562
    mov eax,60
563
    mov ebx,2
564
    mov edx,paramtest
134 diamond 565
    mov esi,1024
485 heavyiron 566
    mcall
31 halyavin 567
 
568
    jmp exit
569
 
570
is_brow:
571
 
572
;    cmp [convinfo+edi+26],dword 'Fvol'
573
;    je  edit
574
 
134 diamond 575
; find extension
576
        mov     eax, paramtest+1023
577
@@:
578
        dec     eax
579
        cmp     byte [eax+1], 0
580
        jz      @b
581
@@:
582
        cmp     byte [eax], '/'
583
        jz      .noext
584
        cmp     byte [eax], '.'
585
        jz      .ext
586
        dec     eax
587
        cmp     eax, paramtest
588
        jae     @b
589
.noext:
590
; file has no extension
591
;        xor     ebx, ebx
592
        jmp     execute
593
.ext:
594
        inc     eax
595
; eax points to extension
596
        cmp     byte [eax], 0
597
        jz      .noext
598
        mov     ecx, dword [eax]
599
        and     ecx, not 0x20202020
600
        mov     ebx, jpgview
601
        cmp     ecx, 'JPG'
602
        jz      run
603
        cmp     ecx, 'JPEG'     ; note that it will select also *.JPEG*
604
        jz      run
605
        mov     ebx, gifview
606
        cmp     ecx, 'GIF'
607
        jz      run
205 heavyiron 608
        mov     ebx, ac97
134 diamond 609
        cmp     ecx, 'WAV'
610
        jz      run
205 heavyiron 611
        cmp     ecx, 'MP3'
612
        jz      run
134 diamond 613
        mov     ebx, midamp
614
        cmp     ecx, 'MID'
615
        jz      run
616
        mov     ebx, bmpview
617
        cmp     ecx, 'BMP'
618
        jz      run
31 halyavin 619
; //// Willow
134 diamond 620
        mov     ebx, pngview
621
        cmp     ecx, 'PNG'
622
        jz      run
31 halyavin 623
; //// Willow
134 diamond 624
        mov     ebx, rtfread
625
        cmp     ecx, 'RTF'
626
        jz      run
627
        mov     ebx, editor
628
        cmp     ecx, 'ASM'
629
        jz      run
630
        cmp     ecx, 'TXT'
631
        jz      run
632
        cmp     ecx, 'INC'
633
        jz      run
205 heavyiron 634
        mov     ebx, life2
635
        cmp     ecx, 'LIF'
636
        jz      run
637
        mov     ebx, view3ds
638
        cmp     ecx, '3DS' and not 0x20202020
639
        jz      run
134 diamond 640
        jmp     still
31 halyavin 641
 
642
execute:
134 diamond 643
        mov     ebx, fileinfo_start
644
        and     dword [ebx+8], 0                ; no parameters
645
        mov     dword [ebx+21], paramtest       ; program name
646
.do:
647
        mov     eax, 70
485 heavyiron 648
        mcall
134 diamond 649
        jmp     still
31 halyavin 650
 
651
run:
134 diamond 652
        mov     [fileinfo_name], ebx            ; program name
653
        mov     ebx, fileinfo_start
654
        mov     dword [ebx+8], paramtest        ; parameters
655
        jmp     execute.do
31 halyavin 656
 
657
no_filelist:
658
 
131 diamond 659
    cmp ah,5	;OPEN/SAVE button
660
    je	    kfad
31 halyavin 661
 
131 diamond 662
    cmp ah,6	;Scroll up
31 halyavin 663
    jne no_scrlup
664
    mov ebx,1
665
    jmp up
666
no_scrlup:
667
 
131 diamond 668
    cmp ah,7	;Scroll down
31 halyavin 669
    jne no_scrldown
670
    mov ebx,1
671
    jmp down
672
no_scrldown:
673
 
674
    cmp ah,8
675
    jne no_update
676
update:
677
    call read_directory
678
;    call convertation
679
;    mov [filecursor],0
680
    call draw_window
681
no_update:
682
 
683
    cmp ah,9
684
    jne no_textopen
685
textopen:
134 diamond 686
        mov     eax, 27
687
        mul     [filecursor]
688
        cmp     dword [eax+convinfo+15], 'FOL '
689
        jz      still
690
        push    eax
691
        mov     esi, path
692
        mov     edi, paramtest
693
@@:
694
        lodsb
695
        test    al, al
696
        jz      @f
697
        stosb
698
        jmp     @b
699
@@:
700
        mov     al, '/'
701
        stosb
702
        pop     eax
703
        mov     esi, [eax+convinfo]
704
        cmp     esi, -1
705
        jz      still
706
@@:
707
        lodsb
708
        stosb
709
        test    al, al
710
        jz      @f
711
        cmp     edi, paramtest+1024
712
        jb      @b
713
        jmp     still
714
@@:
715
        mov     ebx, editor
716
        jmp     run
31 halyavin 717
 
718
no_textopen:
719
 
720
    cmp  ah,11
721
    jne  no_view
722
viewset:
134 diamond 723
        inc     [viewmode]
724
        cmp     [viewmode], 4
725
        jb      @f
726
        mov     [viewmode], 0
727
@@:
31 halyavin 728
    call read_directory
729
;    call convertation
730
    mov [filecursor],0
731
    call draw_window
732
    jmp still
733
no_view:
734
 
131 diamond 735
    cmp  ah,12	      ;move back
31 halyavin 736
    jne  no_back
737
back:
134 diamond 738
        mov     edi, path+1024
739
        mov     ecx, edi
740
@@:
741
        dec     edi
742
        cmp     byte [edi], '/'
743
        jz      @f
744
        cmp     edi, path
745
        ja      @b
746
        jmp     still
747
@@:
748
        sub     ecx, edi
156 diamond 749
        lea     eax, [edi-path]
750
        mov     [cursor], eax
134 diamond 751
        xor     eax, eax
752
        rep     stosb
31 halyavin 753
    mov [filecursor],0
754
    call read_directory
755
;    call convertation
756
    call draw_window
757
    jmp still
758
 
759
no_back:
131 diamond 760
    cmp  ah,13	      ;string up?
31 halyavin 761
    jne  no_up
131 diamond 762
    mov  ebx,1	      ;step
31 halyavin 763
up:
764
    mov  [downstop],0
765
    sub  [filecursor],ebx
766
    cmp  [filecursor],0
767
    jnl  cr_ok
768
    mov  [filecursor],0
769
cr_ok:
770
    jmp  draw_wd
771
no_up:
131 diamond 772
    cmp  ah,14		 ;string down?
31 halyavin 773
    jne  no_dn
131 diamond 774
    mov  ebx,1		 ;step
31 halyavin 775
down:
776
    cmp  [downstop],1
131 diamond 777
    je	     no_dn
31 halyavin 778
    add  [filecursor],ebx
779
    jmp  draw_wd
780
no_dn:
781
 
782
    cmp  ah,15
131 diamond 783
    jne  no_copyclip	;copy to clipboard
31 halyavin 784
copy_to_clip:
134 diamond 785
        mov     eax, 27
786
        mul     [filecursor]
787
        cmp     dword [convinfo+eax+15], 'FOL '
788
        jz      still
789
        push    eax
790
        mov     esi, path
791
        mov     edi, paramtest
792
@@:
793
        lodsb
794
        test    al, al
795
        jz      @f
796
        stosb
797
        jmp     @b
798
@@:
799
        pop     eax
800
        mov     esi, [convinfo+eax]
801
        cmp     esi, -1
802
        jz      still
803
        mov     al, '/'
804
        stosb
805
@@:
806
        lodsb
807
        stosb
808
        test    al, al
809
        jz      @f
810
        cmp     edi, paramtest+1024
811
        jb      @b
812
        jmp     still
813
@@:
814
        sub     edi, paramtest+1
815
        mov     ebx, clipfile_info
816
        mov     byte [ebx], 2
817
        mov     [ebx+12], edi
818
        mov     eax, 70
485 heavyiron 819
        mcall
134 diamond 820
        jmp     still
31 halyavin 821
no_copyclip:
822
 
823
    cmp ah,16
824
    jne no_clippaste
825
paste_from_clip:
134 diamond 826
        mov     ebx, clipfile_info
827
        mov     byte [ebx], 0
828
        mov     dword [ebx+12], 1023
829
        mov     eax, 70
485 heavyiron 830
        mcall
134 diamond 831
        cmp     ebx, 0
832
        jle     still
833
        mov     byte [paramtest+ebx], 0
834
; OS allows only 256 symbols in command line
835
        cmp     ebx, 250
836
        jae     still
837
; we use Pascal-style strings for /RD/1/COPYR
838
; source file
839
        mov     edi, copyr_param
840
        mov     al, bl
841
        stosb
842
        mov     ecx, ebx
843
        mov     esi, paramtest
844
        rep     movsb
845
; destination path
846
        inc     edi
847
        mov     ebp, edi
848
        mov     esi, path
849
@@:
850
        cmp     edi, copyr_param+255
851
        jae     still
852
        lodsb
853
        test    al, al
854
        jz      @f
855
        stosb
856
        jmp     @b
857
; destination file name
858
@@:
859
        dec     ebx
860
        jz      still
861
        cmp     byte [paramtest+ebx], '/'
862
        jnz     @b
863
        lea     esi, [paramtest+ebx]
864
@@:
865
        lodsb
866
        test    al, al
867
        jz      @f
868
        stosb
869
        cmp     edi, copyr_param+255
870
        jae     still
871
        jmp     @b
872
@@:
873
        mov     byte [edi], 0
874
        sub     edi, ebp
875
        mov     eax, edi
876
        mov     [ebp-1], al
877
; display
878
    cmp [browser], 1
31 halyavin 879
    jne no_outpath
131 diamond 880
    mov  eax,4		   ; function 4 : write text to window
881
    mov  ebx,10*65536+67     ; [x start] *65536 + [y start]
31 halyavin 882
    mov  ecx,0x00000000 ;[sc.grab_text] ; color of text RRGGBB
134 diamond 883
        mov     edx, copyr_param+1
884
        movzx   esi, byte [edx-1]
485 heavyiron 885
    mcall
131 diamond 886
    mov  ebx,250*65536+67	; [x start] *65536 + [y start]
31 halyavin 887
    mov  ecx,0x00000000 ;[sc.grab_text] ; color of text RRGGBB
134 diamond 888
        mov     edx, ebp
889
        mov     esi, edi
485 heavyiron 890
    mcall
31 halyavin 891
no_outpath:
892
 
134 diamond 893
; run COPYR
894
        mov     eax, 70
895
        mov     ebx, copyr_run
485 heavyiron 896
        mcall
31 halyavin 897
    delay 50   ;wait recoed file
898
    jmp update ;still
899
no_clippaste:
900
 
131 diamond 901
    cmp ah,19		;Delete from floppy
134 diamond 902
    jne no_delt
31 halyavin 903
delete_file:
134 diamond 904
; OS now do not support file delete
905
        jmp     still
31 halyavin 906
no_delt:
907
 
131 diamond 908
    cmp ah,20		;I - Help
909
    je	    help_scr
31 halyavin 910
 
911
    cmp ah,22
912
    jne no_headfile
913
    mov [drawhf],1
914
    call draw_window
915
    mov [drawhf],0
916
    mov [pmenu_draw],1
917
    jmp still
918
no_headfile:
919
 
920
    cmp ah,23
921
    jne no_headview
922
    mov [drawhv],1
923
    call draw_window
924
    mov [drawhv],0
925
    mov [pmenu_draw],1
926
    jmp still
927
no_headview:
928
 
929
    cmp ah,24
930
    jne no_headinfo
931
    mov [drawhi],1
932
    call draw_window
933
    mov [drawhi],0
934
    mov [pmenu_draw],1
935
    jmp still
936
no_headinfo:
937
 
938
;FILE MENU
939
    cmp ah,30
940
    je kfad
941
 
942
    cmp ah,31
131 diamond 943
    je	    copy_to_clip      ;Copy
31 halyavin 944
 
945
    cmp ah,32
131 diamond 946
    je	    paste_from_clip ;Paste
31 halyavin 947
 
948
    cmp ah,33
131 diamond 949
    je	    delete_file     ;Delte
31 halyavin 950
 
951
    cmp ah,34
131 diamond 952
    je	    textopen	;Edit in Tinypad
31 halyavin 953
 
954
    cmp ah,37
131 diamond 955
    je	    exit
31 halyavin 956
 
957
;VIEW MENU
134 diamond 958
    cmp ah,40		;Sort by name
31 halyavin 959
    jne no_sn
134 diamond 960
        mov     [viewmode], 0
31 halyavin 961
    jmp update
962
no_sn:
963
 
134 diamond 964
    cmp ah,41		;Sort by extension
31 halyavin 965
    jne no_se
134 diamond 966
        mov     [viewmode], 1
31 halyavin 967
    jmp update
968
no_se:
969
 
134 diamond 970
    cmp ah,42		;Sort by size
31 halyavin 971
    jne no_ss
134 diamond 972
        mov     [viewmode], 2
31 halyavin 973
    jmp update
974
no_ss:
975
 
134 diamond 976
    cmp ah,43		;Sort by date
31 halyavin 977
    jne no_sd
134 diamond 978
        mov     [viewmode], 3
31 halyavin 979
    jmp update
980
no_sd:
981
 
982
;HELP MENU
131 diamond 983
    cmp ah,50		;Help?
984
    je	    help_scr
31 halyavin 985
 
131 diamond 986
    cmp ah,51		;Info?
987
    je	    info_scr
31 halyavin 988
 
131 diamond 989
    cmp ah,1	       ; test on exit button
990
    je	    exit
31 halyavin 991
 
992
    jmp still
993
 
994
exit:
995
; //// Willow
131 diamond 996
;    mov eax,58
997
;    mov ebx,MRUfile
998
;    mov dword[ebx+8],255
999
;    inc dword[ebx]
485 heavyiron 1000
;    mcall
31 halyavin 1001
; //// Willow
1002
    mov eax,-1
485 heavyiron 1003
    mcall
31 halyavin 1004
 
1005
draw_wd:
1006
;    call draw_window
1007
;    jmp still
1008
    mov [flick],1
1009
    jmp anti_flick
1010
 
1011
edit_prompt:
1012
    not  [focus]
1013
    jmp  red
1014
 
1015
help_scr:
1016
    mov esi,14
1017
    mov ebp,help_text
1018
    jmp screen
1019
 
1020
info_scr:
1021
    mov esi,6
1022
    mov ebp,info_text
1023
    jmp screen
1024
 
1025
screen:
134 diamond 1026
    cmp [browser], 1 ;it's browser?
31 halyavin 1027
    jne dialogscr
1028
 
502 heavyiron 1029
    mov eax,[procinfo.box.height]
31 halyavin 1030
    sub eax,90
1031
    drawfbox 40,76,300,eax,0x00000000
502 heavyiron 1032
    mov eax,[procinfo.box.height]
31 halyavin 1033
    sub eax,92
1034
    drawfbox 41,77,298,eax,0x00ffffff
1035
    mov edi,esi ;14
1036
    mov ebx,(41+26)*65536+(77+20)
1037
    mov ecx,cl_Black
1038
    mov edx,ebp ;help_text
1039
    jmp outlab
1040
 
1041
dialogscr:
502 heavyiron 1042
    mov eax,[procinfo.box.height]
31 halyavin 1043
    sub eax,84
1044
    drawfbox 16,54,270,eax,0x00000000
502 heavyiron 1045
    mov eax,[procinfo.box.height]
31 halyavin 1046
    sub eax,86
1047
    drawfbox 17,55,268,eax,0x00ffffff
1048
    mov edi,esi ;14
1049
    mov ebx,(17+10)*65536+(55+1)
1050
    mov ecx,cl_Black
1051
    mov edx,ebp ;help_text
1052
 
131 diamond 1053
outlab:     ;out labels
31 halyavin 1054
    mov eax,4
1055
    mov esi,40
1056
helploo:
485 heavyiron 1057
    mcall
31 halyavin 1058
    add ebx,11
1059
    add edx,40
1060
    dec edi
1061
    jnz helploo
1062
 
1063
    setimg 48,84,logoinfimg
1064
 
1065
    jmp still
1066
 
134 diamond 1067
getimgproc:
1068
    pushad
1069
    mov dword [edx],esi ;xs
1070
    mov dword [edx+4],edi ;ys
1071
 
1072
    mov ebp,eax
1073
    mov eax,dword [ecx] ;getx size
1074
    push edx
1075
    push ecx
1076
    lea ecx,[eax+2*eax]
1077
 
1078
    mul ebx
1079
    add eax,ebp ;x
1080
    mov edx,ecx
1081
    lea eax,[eax+2*eax]  ;eax=offset on imsrc
1082
 
1083
    mov ebp,esi ;xs
1084
    mov ebx,edi ;ys
1085
 
1086
    pop edi
1087
    lea esi,[eax+8+edi]
1088
 
1089
    pop edi
1090
    add edi,8
1091
 
1092
    cld
1093
cyc:
1094
        push    esi
1095
        lea     ecx, [ebp+ebp*2]
1096
        rep     movsb
1097
        pop     esi
1098
    add esi,edx
1099
    dec ebx
1100
    jne cyc
1101
 
1102
    popad
1103
    ret
1104
 
552 diamond 1105
iglobal
31 halyavin 1106
;HELP TEXT
1107
help_text:
1108
       ;0123456789012345678901234567890123456789
1109
    db '        ~~~~~ SYSTEM X-TREE ~~~~~       '
1110
    db '                   HELP                 '
1111
    db '                                        '
1112
    db '                                        '
1113
    db 'F2 - CHANGE SORTMODE (name,ext,size,dat)'
1114
    db 'F3 - VIEW file in tinypad               '
1115
 
1116
    db 'F5 - COPY FILE to clipboard             '
1117
    db 'F6 - PASTE FILE from clipboard          '
1118
    db 'F11- EDIT PROMPT string                 '
1119
    db 'F12- UPDATE directory sources           '
1120
    db '                                        '
1121
 
1122
    db 'Enter - input to directory              '
1123
    db 'Backspace - back to previos directory   '
1124
    db 'PageDn/PageUp, Up/Down - move cursor    '
1125
 
1126
info_text:
1127
    db '        ~~~~~ SYSTEM X-TREE ~~~~~       '
156 diamond 1128
    db '               INFO 84 Ver              '
31 halyavin 1129
    db '                                        '
1130
    db '        Create by Pavlushin Evgeni      '
134 diamond 1131
    db 'with ASCL library special for Kolibri OS'
31 halyavin 1132
    db ' www.deck4.narod.ru      waptap@mail.ru '
552 diamond 1133
endg
31 halyavin 1134
 
1135
;   *********************************************
1136
;   *******  WINDOW DEFINITIONS AND DRAW ********
1137
;   ********    FILE BROWSER / DIALOG   *********
1138
 
1139
;draw_browser_window:
1140
 
1141
draw_window:
1142
 
1143
;    mov eax,9
1144
;    mov ebx,procinfo
1145
;    mov ecx,-1
485 heavyiron 1146
;    mcall
502 heavyiron 1147
;    mov  eax,[procinfo.box.width]
31 halyavin 1148
;    cmp  eax,66
1149
;    jg  temp12345
1150
;    ret
1151
; temp12345:
1152
    mov  eax,48
1153
    mov  ebx,3
1154
    mov  ecx,sc
1155
    mov  edx,sizeof.system_colors
485 heavyiron 1156
    mcall
31 halyavin 1157
 
1158
    mov  eax,[sc.work_button]
1159
    mov  [b_color],eax
1160
 
131 diamond 1161
    mov  eax,12        ; function 12:tell os about windowdraw
1162
    mov  ebx,1		   ; 1, start of draw
485 heavyiron 1163
    mcall
31 halyavin 1164
 
1165
;Window
1166
 
131 diamond 1167
    xor  eax,eax       ; function 0 : define and draw window
31 halyavin 1168
 
134 diamond 1169
    cmp  [browser], 1 ;it's browser
31 halyavin 1170
    jne  nob1
131 diamond 1171
    mov  ebx,140*65536+400     ; [x start] *65536 + [x size]
1172
    mov  ecx,160*65536+280     ; [y start] *65536 + [y size]
31 halyavin 1173
    jmp  isb1
1174
nob1:
131 diamond 1175
    mov  ebx,140*65536+320     ; [x start] *65536 + [x size]
1176
    mov  ecx,260*65536+240     ; [y start] *65536 + [y size]
31 halyavin 1177
isb1:
1178
;    mov  edx,[sc.work]             ; color of work area RRGGBB
131 diamond 1179
    or	     edx,0x03ffffff;000000
485 heavyiron 1180
    mcall
31 halyavin 1181
 
1182
;Get proc info
1183
    mov eax,9
1184
    mov ebx,procinfo
1185
    mov ecx,-1
485 heavyiron 1186
    mcall
31 halyavin 1187
 
502 heavyiron 1188
    mov  eax,[procinfo.box.width]
31 halyavin 1189
    cmp  eax,66
134 diamond 1190
    jg	 @f
1191
.ret:
31 halyavin 1192
    ret
134 diamond 1193
 @@:
502 heavyiron 1194
    cmp  [procinfo.box.height], 0x70
134 diamond 1195
    jl  .ret
31 halyavin 1196
 
134 diamond 1197
    cmp  [browser], 1 ;it's browser
31 halyavin 1198
    jne  nob9
1199
    mov  [listx],120
502 heavyiron 1200
;    mov  eax,[procinfo.box.width]
134 diamond 1201
    sub  eax,127;[listx]+7
1202
    cmp  eax,10
1203
    jl   .ret
31 halyavin 1204
    mov  [listxsize],eax
1205
    mov  [listy],73
502 heavyiron 1206
    mov  eax,[procinfo.box.height]
134 diamond 1207
    sub  eax,73+7;[listy]+7
31 halyavin 1208
    mov  [listysize],eax
1209
    jmp isb9
1210
nob9:
1211
    mov  [listx],10
502 heavyiron 1212
;    mov  eax,[procinfo.box.width]
134 diamond 1213
    sub  eax,17 ;[listx]+7
31 halyavin 1214
    mov  [listxsize],eax
1215
    mov  [listy],54
502 heavyiron 1216
    mov  eax,[procinfo.box.height]
134 diamond 1217
    sub  eax,54+34;[listy]+34
31 halyavin 1218
    mov  [listysize],eax
1219
isb9:
1220
 
1221
 
1222
;Draw only browser components
134 diamond 1223
    cmp  [browser], 1 ;it's browser
31 halyavin 1224
    jne  nob2
1225
 
131 diamond 1226
    mov  eax,[sc.grab_text]	 ; color of text RRGGBB
1227
    or	     eax,0x10000000
1228
    glabel 8,8,'SYSTEM X-TREE FILE BROWSER',eax
31 halyavin 1229
 
1230
;Draw buttons headers
1231
    mov  eax,8
1232
    mov  ebx,8*65536+(6*8-1) ;start pos x
1233
    mov  ecx,23*65536+10      ;start pos y
1234
    mov  edx,22;+1000000000000000000000000000000b  ;spoke butt
131 diamond 1235
    mov  edi,3		  ;draw 13 button's
31 halyavin 1236
    mov  esi,0x00339933
485 heavyiron 1237
    mcall
31 halyavin 1238
    dec edi
1239
nexthbut:
1240
    add  ebx,(6*8)*65536
1241
    inc  edx
485 heavyiron 1242
    mcall
31 halyavin 1243
    dec  edi
1244
    jnz  nexthbut
1245
 
1246
;File STRING
134 diamond 1247
    glabel 8,25,'  FILE    VIEW    INFO  ',  cl_White ;Black
31 halyavin 1248
 
1249
;BlackLine
502 heavyiron 1250
    mov eax,[procinfo.box.width]
31 halyavin 1251
    sub eax,10
1252
    drawfbox 5,35, eax, 1, cl_Black
1253
 
1254
;BlackLine2
502 heavyiron 1255
    mov eax,[procinfo.box.width]
31 halyavin 1256
    sub eax,10
1257
    drawfbox 5,68, eax, 1, cl_Black
1258
 
1259
;BlackLine2 vertical
502 heavyiron 1260
;    mov eax,[procinfo.box.height]
31 halyavin 1261
;    sub eax,69+4
1262
;    drawfbox 115, 69, 1, eax, cl_Black
1263
 
1264
;Set logo img
1265
    setimg 34,88,logoinfimg
131 diamond 1266
    glabel 20,165,'SYSTEM X-TREE',cl_Black
31 halyavin 1267
    add  ebx,10
134 diamond 1268
    glabel ,,'FOR KolibriOS',
31 halyavin 1269
 
1270
    add  ebx,9*65536+20
131 diamond 1271
    glabel ,,'welcome to',cl_Green
31 halyavin 1272
    add  ebx,-15*65536+10
134 diamond 1273
    glabel ,,'www.kolibrios.org',cl_Green
31 halyavin 1274
 
131 diamond 1275
;    glabel ,,'Create by',cl_Green
31 halyavin 1276
;    add  ebx,10
131 diamond 1277
;    glabel ,,'   Pavlushin',
31 halyavin 1278
;    add  ebx,10
131 diamond 1279
;    glabel ,,'       Evgeni',
31 halyavin 1280
 
1281
 
1282
;Draw head->file buttons
1283
    cmp [drawhf],1
1284
    jne  no_drawhf
1285
    mov  ebx,8*65536+6*12 ;start pos x
1286
    mov  ecx,35*65536+10      ;start pos y
1287
    mov  edx,30  ;spoke butt
131 diamond 1288
    mov  edi,8		  ;draw 4 button's
31 halyavin 1289
    mov  esi,cl_Grey
1290
    call menubutton
1291
no_drawhf:
1292
 
1293
;Draw head->view buttons
1294
    cmp [drawhv],1
1295
    jne  no_drawhv
1296
    mov  ebx,(8+6*8)*65536+6*12 ;start pos x
1297
    mov  ecx,35*65536+10      ;start pos y
1298
    mov  edx,40  ;spoke butt
134 diamond 1299
    mov  edi,4		  ;draw 4 button's
31 halyavin 1300
    mov  esi,cl_Grey
1301
    call menubutton
1302
no_drawhv:
1303
 
1304
;Draw head->info buttons
1305
    cmp [drawhi],1
1306
    jne  no_drawhi
1307
    mov  ebx,(8+12*8)*65536+6*12 ;start pos x
1308
    mov  ecx,35*65536+10      ;start pos y
1309
    mov  edx,50  ;spoke butt
131 diamond 1310
    mov  edi,2		  ;draw 2 button's
31 halyavin 1311
    mov  esi,cl_Grey
1312
    call menubutton
1313
no_drawhi:
1314
 
1315
nob2:
1316
 
1317
;Draw buttons instruments
1318
    mov  eax,8
134 diamond 1319
    cmp  [browser], 1 ;it's browser
31 halyavin 1320
    jne  nob3
1321
    mov  ebx,10*65536+16+5 ;start pos x
1322
    mov  ecx,37*65536+15      ;start pos y
1323
    jmp isb3
1324
nob3:
1325
    mov  ebx,16*65536+16+5 ;start pos x
1326
    mov  ecx,29*65536+15      ;start pos y
1327
isb3:
1328
    mov  edx,8;+1000000000000000000000000000000b  ;spoke butt
131 diamond 1329
    mov  edi,13        ;draw 13 button's
31 halyavin 1330
    mov  esi,cl_Grey
485 heavyiron 1331
    mcall
31 halyavin 1332
    dec edi
1333
nextbut:
1334
    add  ebx,(16+6)*65536
1335
    inc  edx
485 heavyiron 1336
    mcall
31 halyavin 1337
    dec  edi
1338
    jnz  nextbut
1339
 
1340
 
134 diamond 1341
    cmp  [browser], 1 ;it's browser
31 halyavin 1342
    jne  nob4
1343
;But img browser
1344
    setimg 10,37,butimg
1345
;left logo
502 heavyiron 1346
    add eax,[procinfo.box.width]
31 halyavin 1347
    sub eax,80
1348
    mov [temp],eax
1349
    setimg [temp],37,logoimg
1350
    jmp isb4
1351
nob4:
1352
;But img dialog
1353
    setimg 16,29,butimg
1354
isb4:
1355
 
134 diamond 1356
    cmp  [browser], 1 ;it's browser
31 halyavin 1357
    jne  nob5
1358
 
1359
    mov [urlx],48
1360
    mov [urly],55
502 heavyiron 1361
    mov eax,[procinfo.box.width]
31 halyavin 1362
    sub eax,48+10
1363
    mov [urlxsize],eax
1364
    mov [urlysize],12
1365
 
131 diamond 1366
    glabel 20,57,"URL:",cl_Black
31 halyavin 1367
 
1368
;Out view mode info
134 diamond 1369
        movzx   edx, [viewmode]
1370
        shl     edx, 4
31 halyavin 1371
    mov eax,4
1372
    mov ebx,180*65536+25
1373
    mov ecx,cl_Black
1374
    add edx,modetext
1375
    mov esi,16
485 heavyiron 1376
    mcall
31 halyavin 1377
 
1378
;List size
1379
    outcount [listsize],294,25,cl_Black,4*65536
1380
    jmp isb5
1381
 
552 diamond 1382
iglobal
31 halyavin 1383
head_dlg: db 'OPEN FILE'
131 diamond 1384
      db 'SAVE FILE'
31 halyavin 1385
but_dlg:  db 'OPEN'
131 diamond 1386
      db 'SAVE'
552 diamond 1387
endg
31 halyavin 1388
 
1389
nob5:
1390
 
1391
    mov [urlx],10
502 heavyiron 1392
    mov eax,[procinfo.box.height]
31 halyavin 1393
    sub eax,24
1394
    mov [urly],eax
502 heavyiron 1395
    mov eax,[procinfo.box.width]
31 halyavin 1396
    sub eax,80
1397
    mov [urlxsize],eax
1398
    mov [urlysize],12
1399
 
131 diamond 1400
    cmp byte [dlg_type],'O'    ;if byte O - is Open dialog
31 halyavin 1401
    jne no_openh
131 diamond 1402
    mov edx,head_dlg	      ;draw in head OPEN FILE
31 halyavin 1403
    jmp out_laby
1404
no_openh:
131 diamond 1405
    cmp byte [dlg_type],'S'    ;if byte S - is Save dialog
31 halyavin 1406
    jne no_saveh
131 diamond 1407
    mov edx,head_dlg+9	      ;draw in head SAVE FILE
31 halyavin 1408
out_laby:
1409
    mov ebx,8*65536+8
131 diamond 1410
    mov ecx,[sc.grab_text]    ; color of text RRGGBB
1411
    or	    ecx,0x10000000
31 halyavin 1412
    mov esi,9
1413
    mov eax,4
485 heavyiron 1414
    mcall
31 halyavin 1415
no_saveh:
1416
 
1417
 
1418
;Draw OPEN\SAVE button
1419
    mov ebx,0*65536+50
1420
    mov ecx,0*65536+12
502 heavyiron 1421
    mov eax,[procinfo.box.width]
31 halyavin 1422
    sub eax,63
1423
    shl eax,16
1424
    add ebx,eax
502 heavyiron 1425
    mov eax,[procinfo.box.height]
31 halyavin 1426
    sub eax,25
1427
    shl eax,16
1428
    add ecx,eax
1429
    mov  eax,8
1430
    mov  edx,5 ;button ID
1431
    mov  esi,0x006699aa  ;gradient!!!
485 heavyiron 1432
    mcall
31 halyavin 1433
 
1434
; label OPEN or SAVE
502 heavyiron 1435
    mov ebx,[procinfo.box.width]
31 halyavin 1436
    sub ebx,48
502 heavyiron 1437
    mov eax,[procinfo.box.height]
31 halyavin 1438
    sub eax,22
1439
    shl ebx,16
1440
    add ebx,eax
1441
 
131 diamond 1442
    cmp byte [dlg_type],'O'    ;if byte O - is Open dialog
31 halyavin 1443
    jne no_openb
131 diamond 1444
    mov edx,but_dlg	   ;draw in head OPEN FILE
31 halyavin 1445
    jmp out_labx
1446
no_openb:
131 diamond 1447
    cmp byte [dlg_type],'S'    ;if byte S - is Save dialog
31 halyavin 1448
    jne no_saveb
131 diamond 1449
    mov edx,but_dlg+4	       ;draw in head SAVE FILE
31 halyavin 1450
out_labx:
1451
    mov ecx,cl_White
1452
    mov esi,4
1453
    mov eax,4
485 heavyiron 1454
    mcall
31 halyavin 1455
no_saveb:
1456
 
1457
isb5:
1458
 
1459
anti_flick:
1460
 
1461
    cmp [flick],2
1462
    je draw_url
1463
    cmp [flick],0
1464
    jne no_flick_url
1465
 
1466
;***************************
1467
;    DRAW URL LINE
1468
;***************************
1469
draw_url:
1470
 
1471
;Draw URL focus button
1472
    mov ebx,[urlx]
1473
    shl ebx,16
1474
    add ebx,[urlxsize]
1475
    mov ecx,[urly]
1476
    shl ecx,16
1477
    add ecx,[urlysize]
1478
    dec ebx
1479
    dec ecx
1480
    mov  eax,8
1481
    mov  edx,2 ;button ID
1482
    mov  esi,0x00aaaaaa  ;gradient!!!
485 heavyiron 1483
    mcall
31 halyavin 1484
 
1485
;Draw URL String
1486
    mov eax,13
1487
    mov edx,cl_Black
485 heavyiron 1488
    mcall
31 halyavin 1489
    add ebx,1*65536-2+1
1490
    add ecx,1*65536-2+1
1491
    mov edx,cl_White
485 heavyiron 1492
    mcall
31 halyavin 1493
 
1494
;Draw URL Cursor
1495
    mov eax,6
1496
    mul [cursor]
1497
    mov ebx,[urlx]
1498
    add ebx,eax
1499
    shl ebx,16
1500
    add ebx,2*65536+1
1501
    mov ecx,[urly]
1502
    shl ecx,16
1503
    add ecx,[urlysize]
1504
    add ecx,2*65536-4
1505
    mov eax,13
1506
    mov edx,cl_Black
485 heavyiron 1507
    mcall
31 halyavin 1508
 
1509
; OUT TEXT
131 diamond 1510
    mov eax,[urlxsize]	    ;calculating text leight
31 halyavin 1511
    sub eax,8
1512
    mov ebx,6
1513
    div ebx
1514
    mov esi,eax
1515
 
1516
    mov  ebx,[urlx]
1517
    shl  ebx,16
1518
    add  ebx,[urly]
1519
    add  ebx,3*65536+2
131 diamond 1520
    mov  eax,4		   ; function 4 : write text to window
31 halyavin 1521
    mov  ecx,0x00000000 ;[sc.grab_text] ; color of text RRGGBB
131 diamond 1522
    mov  edx,path	 ; pointer to text beginning
485 heavyiron 1523
    mcall
31 halyavin 1524
 
1525
    cmp  [flick],2
1526
    jne  no_flick_url
1527
    mov  [flick],0
1528
    jmp  still
1529
no_flick_url:
1530
 
1531
 
1532
;***************************
1533
;    DRAW FILE LIST
1534
;***************************
1535
 
1536
;Draw Scroll Line
1537
    mov eax,13
1538
 
1539
    mov ebx,[listx]
1540
    add ebx,[listxsize]
1541
    sub ebx,[scrollsize]
1542
    shl ebx,16
1543
    add ebx,dword [scrollsize]
1544
    mov ecx,[listy]
134 diamond 1545
    add ecx,scrollbutsize
31 halyavin 1546
    shl ecx,16
1547
    add ecx,[listysize]
134 diamond 1548
    sub ecx,scrollbutsize*2
31 halyavin 1549
    mov edx,[scrollcolor] ;0x00006600
485 heavyiron 1550
    mcall
31 halyavin 1551
 
1552
;Draw Scroll Box
1553
    mov  edx,0
1554
    mov  eax,[listysize]
1555
    sub  eax,2
1556
    mov  ebx,dword 10
1557
    div  ebx
1558
 
1559
    mov ebx,eax
131 diamond 1560
    cmp ebx,[listsize]	    ;filelistsize in ebx
134 diamond 1561
    jae    notusescroll
31 halyavin 1562
;usescroll
134 diamond 1563
; calculate scroll size
1564
        mov     eax, [listysize]
1565
        sub     eax, 2*scrollbutsize
1566
        push    eax
1567
        mul     ebx
1568
        div     [listsize]
1569
        cmp     eax, 5
1570
        jae     @f
1571
        mov     al, 5
1572
@@:
1573
        mov     [scroll_height], eax
1574
; calculate scroll pos
1575
        sub     [esp], eax
1576
        mov     eax, [listsize]
1577
        sub     eax, ebx
1578
        mov     ecx, eax
1579
        cmp     eax, [filecursor]
1580
        jb      @f
1581
        mov     eax, [filecursor]
1582
@@:
1583
        mul     dword [esp]
1584
        div     ecx
1585
        mov     [scroll_pos], eax
1586
        pop     ecx
1587
; draw
1588
        lea     ecx, [eax+scrollbutsize]
1589
        add     ecx, [listy]
1590
        shl     ecx, 16
1591
        mov     cx, word [scroll_height]
1592
        mov     eax, 13
1593
        mov     ebx, [listx]
1594
        add     ebx, [listxsize]
1595
        sub     ebx, [scrollsize]
1596
        shl     ebx, 16
1597
        mov     bx, word [scrollsize]
1598
        mov     edx, [scrollboxcol]
485 heavyiron 1599
        mcall
31 halyavin 1600
notusescroll:
1601
 
1602
 
1603
;Draw list button for get file name
1604
    mov  ebx,[listx]
1605
    shl  ebx,16
1606
    add  ebx,[listxsize]
131 diamond 1607
    sub  ebx,15      ;right free zone
31 halyavin 1608
    sub  ebx,[scrollsize]
1609
    mov  ecx,[listy]
1610
    shl  ecx,16
1611
    add  ecx,[listysize]
1612
 
1613
    mov  eax,8
1614
    mov  edx,4+1000000000000000000000000000000b  ;spoke butt
485 heavyiron 1615
    mcall
31 halyavin 1616
 
1617
    add  ebx,15
1618
    mov  eax,13
1619
    mov  edx,[listcolor] ;ffffff
485 heavyiron 1620
    mcall
31 halyavin 1621
 
1622
;Draw up/down buttons
1623
    mov  ebx,[listx]
1624
    add  ebx,[listxsize]
1625
    sub  ebx,[scrollsize]
1626
    shl  ebx,16
1627
    add  ebx,[scrollsize]
1628
    mov  ecx,[listy]
1629
    shl  ecx,16
134 diamond 1630
    add  ecx,scrollbutsize-1
31 halyavin 1631
    mov  eax,8
1632
    mov  edx,6+1000000000000000000000000000000b  ;spoke butt
485 heavyiron 1633
    mcall
31 halyavin 1634
 
1635
    inc  ecx
1636
    mov  eax,13
1637
    mov  edx,[scrollbutcol] ;ffffff
485 heavyiron 1638
    mcall
31 halyavin 1639
 
1640
; Draw image on up button
1641
    pushad
1642
    shr  ebx,16
1643
    mov  edx,ebx
1644
    shl  edx,16
1645
    shr  ecx,16
1646
    add  edx,ecx
1647
    mov  ecx,8*65536+9
1648
    mov  ebx,upsb+8
1649
    mov  eax,7
485 heavyiron 1650
    mcall
31 halyavin 1651
    popad
1652
 
1653
 
131 diamond 1654
    dec  ecx	 ;correction
31 halyavin 1655
    mov  edx,7+1000000000000000000000000000000b  ;spoke butt
1656
    mov  eax,[listysize]
134 diamond 1657
    sub  eax,scrollbutsize
31 halyavin 1658
    shl  eax,16
1659
    add  ecx,eax
1660
 
1661
    mov  eax,8
485 heavyiron 1662
    mcall
31 halyavin 1663
 
1664
    inc  ecx
1665
    mov  eax,13
1666
    mov  edx,[scrollbutcol] ;ffffff
485 heavyiron 1667
    mcall
31 halyavin 1668
 
1669
; Draw image on down button
1670
    pushad
1671
    shr  ebx,16
1672
    mov  edx,ebx
1673
    shl  edx,16
1674
    shr  ecx,16
1675
    add  edx,ecx
1676
    mov  ecx,8*65536+9
1677
    mov  ebx,dnsb+8
1678
    mov  eax,7
485 heavyiron 1679
    mcall
31 halyavin 1680
    popad
1681
 
1682
 
1683
; Draw text in file list
1684
 
134 diamond 1685
;    mov  eax,[listxsize]
1686
;    sub  eax,40*6  ;leight of string
1687
;    shr  eax,1
1688
;    add  eax,[listx]
1689
        mov     eax, [listx]
1690
        add     eax, 12+4 ; for icons
31 halyavin 1691
    shl  eax,16
1692
    add  eax,[listy]
1693
    add  eax,2
1694
 
1695
    mov  [filelistxy],eax ;dword 19*65536+58
1696
 
1697
    mov  edx,0
1698
    mov  eax,[listysize]
1699
    sub  eax,2
1700
    mov  ebx,dword 10
1701
    div  ebx
1702
    mov  [filelistsize],eax  ;dword 40
1703
 
1704
; OUT FILE DATA
131 diamond 1705
    mov  eax,[filecursor]     ;calc cursor position
134 diamond 1706
    mov  ebx,27
31 halyavin 1707
    mul  ebx
1708
 
1709
;OUT TEXT
1710
    mov  ebp,4096 ; 16             ;out strings process
1711
    sub  ebp,[filecursor]
1712
    mov  edx,convinfo ;fileinfo+11
1713
    add  edx,eax
1714
    mov  ebx,dword [filelistxy]
1715
loo:
134 diamond 1716
        cmp     dword [edx], -1
1717
        jz      noout
31 halyavin 1718
    mov  ecx,0x00888888        ;for another file's color white
134 diamond 1719
    cmp  [edx+15],dword 'FOL ' ;folder yellow
31 halyavin 1720
    jne  nb
1721
    mov  ecx,0x00006666
1722
    jmp cset1
1723
nb:
134 diamond 1724
        mov     eax, [edx]
1725
        xor     edi, edi
1726
; find extension and set color
1727
@@:
1728
        inc     eax
1729
        cmp     byte [eax-1], 0
1730
        jz      @f
1731
        cmp     byte [eax-1], '.'
1732
        jnz     @b
1733
        mov     edi, eax
1734
        jmp     @b
1735
@@:
1736
        test    edi, edi
1737
        jz      @f
1738
        mov     edi, [edi]
1739
        and     edi, not 0x20202020     ; toupper
1740
@@:
31 halyavin 1741
;Color set
134 diamond 1742
; text's blue
1743
        mov     ecx, 0x00446666
1744
        cmp     edi, 'TXT'
1745
        jz      cset
1746
        cmp     edi, 'INC'
1747
        jz      cset
1748
        cmp     edi, 'ASM'
1749
        jz      cset
1750
        cmp     edi, 'RTF'
1751
        jz      cset
1752
; picture's pure
1753
        mov     ecx, 0x00226688
1754
        cmp     edi, 'BMP'
1755
        jz      cset
1756
        cmp     edi, 'JPG'
1757
        jz      cset
1758
        cmp     edi, 'JPEG'
1759
        jz      cset
1760
        cmp     edi, 'GIF'
1761
        jz      cset
1762
        cmp     edi, 'PNG'
1763
        jz      cset
1764
        cmp     edi, 'WAV'
1765
        jz      cset
1766
        cmp     edi, 'MID'
1767
        jz      cset
1768
; execute's green
1769
        mov     ecx, 0x00008866
1770
        test    edi, edi
1771
        jz      cset
1772
; for another file's color white
1773
        mov     ecx, 0x00888888
31 halyavin 1774
cset:
1775
 
1776
cset1:
134 diamond 1777
    push edx
1778
    mov  edx,[edx]
1779
        push    ebx edx
1780
        mov     eax, [listxsize]
1781
        sub     eax, [scrollsize]
1782
        sub     eax, 12+4
1783
        xor     edx, edx
1784
        mov     ebx, 6
1785
        div     ebx
1786
        pop     edx ebx
1787
        sub     eax, 25
1788
        xor     esi, esi
1789
@@:
1790
        cmp     byte [edx+esi], 0
1791
        jz      @f
1792
        inc     esi
1793
        cmp     esi, eax
1794
        jbe     @b
1795
        dec     esi
1796
@@:
1797
        push    eax
31 halyavin 1798
    mov  eax,4
485 heavyiron 1799
    mcall
134 diamond 1800
        cmp     byte [edx+esi], 0
1801
        jz      @f
1802
        pushad
1803
        mov     edx, more_char
1804
        mov     eax, esi
1805
        imul    eax, 6*65536
1806
        add     ebx, eax
1807
        mov     esi, 1
1808
        mov     eax, 4
485 heavyiron 1809
        mcall
134 diamond 1810
        popad
1811
@@:
1812
        pop     eax
1813
    pop  edx
1814
    push ebx edx
1815
        inc     eax
1816
        imul    eax, 6*65536
1817
        add     ebx, eax
1818
    add  edx,4
1819
    mov  esi,23
1820
    mov  eax,4
485 heavyiron 1821
    mcall
134 diamond 1822
    pop  edx ebx
31 halyavin 1823
 
134 diamond 1824
    pushad
1825
    cmp  [edx+15],dword 'Fvol' ;volume label
31 halyavin 1826
    jne  no_volico
1827
    push hdico+8
1828
    jmp out_ico
1829
no_volico:
134 diamond 1830
    cmp  [edx+15],dword 'FOL '
31 halyavin 1831
    jne  no_folico
134 diamond 1832
    cmp  [edx+4],dword 'HARD'
31 halyavin 1833
    jne  no_hdico
1834
    push hdico+8
1835
    jmp out_ico
1836
no_hdico:
134 diamond 1837
    cmp  [edx+4],dword 'RAMD'
31 halyavin 1838
    jne  no_rdico
1839
    push rdico+8
1840
    jmp out_ico
1841
no_rdico:
134 diamond 1842
    cmp  [edx+4],dword 'FLOP'
131 diamond 1843
    jne  no_fdico
1844
    push rdico+8
1845
    jmp out_ico
1846
no_fdico:
156 diamond 1847
    cmp  [edx+4],dword 'CD-R'
1848
    jne  no_cdico
1849
    push cdico+8
1850
    jmp out_ico
1851
no_cdico:
31 halyavin 1852
    push folico+8
1853
    jmp out_ico
1854
no_folico:
134 diamond 1855
    cmp  edi,dword 'BMP'
131 diamond 1856
    je	     is_imgico
134 diamond 1857
    cmp  edi,dword 'JPG'
131 diamond 1858
    je	     is_imgico
134 diamond 1859
    cmp  edi,dword 'JPEG'
131 diamond 1860
    je	     is_imgico
134 diamond 1861
    cmp  edi,dword 'GIF'
131 diamond 1862
    je	     is_imgico
31 halyavin 1863
; //// Willow
134 diamond 1864
    cmp  edi,dword 'PNG'
131 diamond 1865
    je	 is_imgico
31 halyavin 1866
; //// Willow
134 diamond 1867
    cmp  edi,dword 'WAV'
131 diamond 1868
    je	     is_imgico
134 diamond 1869
    cmp  edi,dword 'MID'
131 diamond 1870
    je	     is_imgico
31 halyavin 1871
    jmp  no_imgico
1872
is_imgico:
1873
    push imgico+8
1874
    jmp out_ico
1875
no_imgico:
134 diamond 1876
    cmp  edi,dword 'ASM'
131 diamond 1877
    je	     is_asmincico
134 diamond 1878
    cmp  edi,dword 'INC'
131 diamond 1879
    je	     is_asmincico
31 halyavin 1880
    jmp  no_asmincico
1881
is_asmincico:
1882
    push asmincico+8
1883
    jmp out_ico
1884
no_asmincico:
134 diamond 1885
    cmp  edi,dword 'RTF'
131 diamond 1886
    je	 @f
134 diamond 1887
    cmp  edi,dword 'TXT'
31 halyavin 1888
    jne  no_txtico
131 diamond 1889
 @@:
31 halyavin 1890
    push txtico+8
1891
    jmp out_ico
1892
no_txtico:
134 diamond 1893
    test edi,edi
31 halyavin 1894
    jne  no_execico
1895
    push execico+8
1896
    jmp out_ico
1897
no_execico:
134 diamond 1898
    cmp  [edx+15],dword 'DAT '
31 halyavin 1899
    jne  no_datico
1900
    push datico+8
1901
    jmp out_ico
1902
no_datico:
134 diamond 1903
    cmp  [edx+15],dword 'DEL '
31 halyavin 1904
    jne  no_out_ico
1905
    push delico+8
1906
    jmp out_ico
1907
out_ico:
1908
 
1909
    mov  edx,ebx
1910
    sub  edx,14*65536+1
1911
    mov  ecx,12*65536+9
1912
;    mov  ebx,upsb+8
1913
    pop  ebx
1914
    mov  eax,7
485 heavyiron 1915
    mcall
31 halyavin 1916
no_out_ico:
1917
    popad
1918
 
1919
 
1920
    add  ebx,10
1921
noout:
134 diamond 1922
    add  edx,27
31 halyavin 1923
 
1924
    dec  [filelistsize]
134 diamond 1925
    jz	     extloo
31 halyavin 1926
 
1927
    dec  ebp
1928
    jnz  loo
1929
dext:
1930
    mov [downstop],1
1931
 
1932
extloo:
1933
 
134 diamond 1934
    cmp  [browser], 1 ;it's browser
31 halyavin 1935
    jne  nob8
1936
 
1937
;Draw text for head->file buttons
1938
    cmp [drawhf],1
1939
    jne  no_drawhftext
1940
    drawfbox 8,35,(6*12)+1,11*8,0x00000000
1941
    drawfbox 9,36,(6*12)-1,(11*8)-2,0x00ffffff
1942
 
1943
    mov edi,8
1944
    mov ebx,9*65536+37
1945
    mov ecx,cl_Black
1946
    mov edx,file_text_label
1947
    call drawmenu
1948
 
552 diamond 1949
iglobal
31 halyavin 1950
file_text_label:
131 diamond 1951
    db	     '    Open    '
1952
    db	     '    Copy    '
1953
    db	     '    Paste   '
1954
    db	     '   Delete   '
1955
    db	     '   Tinypad  '
1956
    db	     '    Edit    '
1957
    db	     '            '
1958
    db	     '    Exit    '
552 diamond 1959
endg
31 halyavin 1960
 
1961
no_drawhftext:
1962
 
1963
;Draw text for head->view buttons
1964
    cmp [drawhv],1
1965
    jne  no_drawhvtext
134 diamond 1966
    drawfbox (8+6*8),35,(6*12)+1,(11*4),0x00000000
1967
    drawfbox (9+6*8),36,(6*12)-1,(11*4)-2,0x00ffffff
31 halyavin 1968
 
134 diamond 1969
    mov edi,4
31 halyavin 1970
    mov ebx,(9+6*8)*65536+37
1971
    mov ecx,cl_Black
1972
    mov edx,view_text_label
1973
    call drawmenu
1974
 
552 diamond 1975
iglobal
31 halyavin 1976
view_text_label:
131 diamond 1977
    db	     '  Name sort '
1978
    db	     '  Ext. sort '
1979
    db	     '  Size sort '
1980
    db	     '  Date sort '
552 diamond 1981
endg
31 halyavin 1982
 
1983
no_drawhvtext:
1984
 
1985
;Draw text for head->info buttons
1986
    cmp [drawhi],1
1987
    jne  no_drawhitext
1988
    drawfbox (8+12*8),35,(6*12)+1,(11*2),0x00000000
1989
    drawfbox (9+12*8),36,(6*12)-1,(11*2)-2,0x00ffffff
1990
 
1991
    mov edi,2
1992
    mov eax,4
1993
    mov ebx,(9+12*8)*65536+37
1994
    mov ecx,cl_Black
1995
    mov edx,info_text_label
1996
    call drawmenu
1997
 
552 diamond 1998
iglobal
31 halyavin 1999
info_text_label:
131 diamond 2000
    db	     '   Help     '
2001
    db	     '   About    '
552 diamond 2002
endg
31 halyavin 2003
 
2004
no_drawhitext:
2005
 
2006
nob8:
2007
    cmp  [flick],1
2008
    jne  no_flick
2009
    mov  [flick],0
2010
    jmp  still
2011
no_flick:
2012
 
131 diamond 2013
    mov  eax,12        ; function 12:tell os about windowdraw
2014
    mov  ebx,2		   ; 2, end of draw
485 heavyiron 2015
    mcall
31 halyavin 2016
 
2017
    ret
2018
 
2019
;FILE LIST PARAMETRS
2020
 
552 diamond 2021
iglobal
131 diamond 2022
listx	    dd 15
2023
listy	    dd 72
31 halyavin 2024
listxsize dd 350
2025
listysize dd 41
2026
 
2027
filelistxy    dd 0
2028
filelistsize  dd 0
2029
scrollsize    dd 8
2030
listcolor     dd 0xffffff ;0xeeeeee
2031
scrollcolor   dd 0x778877
2032
scrollboxcol  dd 0x335533
2033
scrollbutcol  dd 0x224422
134 diamond 2034
scrollbutsize = 9
31 halyavin 2035
 
2036
;URL LINE PARAMETRS
2037
 
131 diamond 2038
urlx	 dd 10
2039
urly	 dd 20
31 halyavin 2040
urlxsize dd 350
2041
urlysize dd 12
552 diamond 2042
endg
31 halyavin 2043
 
2044
drawmenu:
2045
    mov eax,4
2046
    mov esi,12
2047
menuloo:
485 heavyiron 2048
    mcall
31 halyavin 2049
    add ebx,11
2050
    add edx,12
2051
    dec edi
2052
    jnz menuloo
2053
    ret
2054
 
2055
menubutton:
2056
    mov  eax,8
2057
nextmenubut:
485 heavyiron 2058
    mcall
31 halyavin 2059
    add  ecx,11*65536
2060
    inc  edx
2061
    dec  edi
2062
    jnz  nextmenubut
2063
    ret
2064
 
2065
;*****************************
2066
; READ FILE STRUCTURE PROC
2067
;*****************************
2068
 
2069
read_directory:
2070
 
2071
;STEP 1 CLEAR CONVINFO
2072
    mov  edi,convinfo
2073
    mov  al,255
134 diamond 2074
    mov  ecx,4096*27
31 halyavin 2075
    cld
134 diamond 2076
    push edi
31 halyavin 2077
    rep  stosb
134 diamond 2078
    pop  edi
31 halyavin 2079
 
2080
;STEP 2 TEST ON HD OR PARTITION
2081
    cmp [path],byte '/'
2082
    je nstep
134 diamond 2083
; copy info on RD and FD
2084
        mov     esi, hdimg
2085
        mov     ecx, 2*27
2086
        rep     movsb
2087
; hard disks
2088
        mov     eax, 4
2089
.1:
2090
        mov     ecx, 27
2091
        cmp     dword [esi], 0
2092
        jz      .2
2093
        rep     movsb
2094
        jmp     .3
2095
.2:
2096
        add     esi, ecx
2097
.3:
2098
        dec     eax
2099
        jnz     .1
2100
        mov     [listsize], 0
2101
        ret
31 halyavin 2102
nstep:
2103
    cmp [path+3],byte '/'
2104
    je nstep2
131 diamond 2105
    cmp [path+4],byte '/'
2106
    je nstep2
156 diamond 2107
    mov ecx,1
131 diamond 2108
    cmp [path+1],word 'RD'
156 diamond 2109
    jz  loxpt
2110
    cmp [path+1],word 'CD'
2111
    jz  loxpt
2112
    mov ecx,2
131 diamond 2113
    cmp [path+1],word 'FD'
156 diamond 2114
    jz  loxpt
131 diamond 2115
    cmp [path+1],dword 'HD0'
2116
    jne nostep_HD0
134 diamond 2117
    movzx ecx,byte [table_area+2]
131 diamond 2118
    jmp loxpt
2119
nostep_HD0:
2120
    cmp [path+1],dword 'HD1'
2121
    jne nostep_HD1
134 diamond 2122
    movzx ecx,byte [table_area+3]
131 diamond 2123
    jmp loxpt
2124
nostep_HD1:
2125
    cmp [path+1],dword 'HD2'
2126
    jne nostep_HD2
134 diamond 2127
    movzx ecx,byte [table_area+4]
131 diamond 2128
    jmp loxpt
2129
nostep_HD2:
2130
    cmp [path+1],dword 'HD3'
2131
    jne nostep_HD3
134 diamond 2132
    movzx ecx,byte [table_area+5]
131 diamond 2133
    jmp loxpt
2134
nostep_HD3:
2135
 
134 diamond 2136
    mov ecx,2
131 diamond 2137
 
31 halyavin 2138
loxpt:
134 diamond 2139
        cmp     ecx, 20
2140
        jbe     @f
2141
        mov     ecx, 20
2142
@@:
2143
        mov     eax, a1
2144
        mov     esi, ptimg
2145
@@:
2146
        stosd
2147
        add     eax, 3
2148
        push    ecx esi
2149
        mov     ecx, 23
2150
        rep     movsb
2151
        pop     esi ecx
2152
        loop    @b
31 halyavin 2153
    mov [listsize],0
2154
    ret
2155
nstep2:
2156
 
134 diamond 2157
;STEP 3 was deleted
31 halyavin 2158
 
2159
;STEP 4 READ DATA FROM HD
2160
 
2161
loorhd:
134 diamond 2162
    mov  eax,70
31 halyavin 2163
    mov  ebx,fileinfoblock
485 heavyiron 2164
    mcall
31 halyavin 2165
 
134 diamond 2166
    cmp eax,6
131 diamond 2167
    je	    end_of_dir
31 halyavin 2168
 
2169
;  It's erorr's test is poor code
2170
 
2171
    cmp eax,1
2172
    jne no_inv_part
131 diamond 2173
    glabel 10,10,'Invalid partition or hd base',cl_Red+font_Big
31 halyavin 2174
    jmp end_of_dir
2175
no_inv_part:
2176
    cmp eax,3
2177
    jne no_unk_fs
134 diamond 2178
    glabel 10,10,'Unknown file system',cl_Red+font_Big
31 halyavin 2179
    jmp end_of_dir
2180
no_unk_fs:
2181
 
2182
end_of_dir:
134 diamond 2183
; -1 -> 0
2184
        cmp     ebx, -1
2185
        sbb     ebx, -1
31 halyavin 2186
    mov  [dirlen],ebx
2187
 
134 diamond 2188
    ; command successful
31 halyavin 2189
 
134 diamond 2190
        mov     esi, outinfo+32
2191
        and     [listsize], 0
2192
        test    ebx, ebx
2193
        jz      nofiles
31 halyavin 2194
 
2195
  newlineb:
134 diamond 2196
        push    ebx
31 halyavin 2197
 
134 diamond 2198
        mov     edi, fileinfo
2199
        push    edi
2200
        mov     al, ' '
2201
        mov     ecx, 27
2202
        rep     stosb
2203
        pop     edi
2204
        push    esi
2205
        add     esi, 40
2206
        mov     [edi], esi
2207
        pop     esi
31 halyavin 2208
 
134 diamond 2209
        mov     eax, 'DAT '     ; data or ... ?
2210
        mov     cl, [esi]
2211
        test    cl, 0x10
2212
        jz      @f
2213
        mov     eax, 'FOL '
2214
        mov     [edi+15], eax
2215
        jmp     nosize
2216
@@:
2217
        test    cl, 8
2218
        jz      novol
2219
        mov     eax, 'Fvol'
2220
        mov     [edi+15], eax
2221
        jmp     nosize
2222
novol:
2223
        mov     [edi+15], eax
31 halyavin 2224
 
134 diamond 2225
; size
2226
        mov     eax, [esi+32]
2227
        push    esi
2228
        lea     esi, [edi+26]
2229
        mov     ebx, 10
2230
        mov     ecx, 8
2231
newnum:
2232
        xor     edx, edx
2233
        div     ebx
2234
        add     dl, '0'
2235
        mov     [esi], dl
2236
        test    eax, eax
2237
        jz      zernum
2238
        dec     esi
2239
        loop    newnum
2240
zernum:
2241
        pop     esi
2242
nosize:
31 halyavin 2243
 
134 diamond 2244
; date
2245
        mov     dword [edi+6], '.  .'
2246
; year
2247
        movzx   eax, word [esi+28+2]
2248
        mov     ecx, 4
2249
newdel1:
2250
        xor     edx, edx
2251
        mov     ebx, 10
2252
        div     ebx
2253
        add     edx, '0'
2254
        mov     [edi+ecx+9], dl
2255
        loop    newdel1
2256
; month
2257
        movzx   eax, byte [esi+28+1]
2258
        xor     edx, edx
2259
        div     ebx
2260
        add     al, '0'
2261
        add     dl, '0'
2262
        mov     [edi+7], al
2263
        mov     [edi+8], dl
2264
; day
2265
        movzx   eax, byte [esi+28]
2266
        xor     edx, edx
2267
        div     ebx
2268
        add     al, '0'
2269
        add     dl, '0'
2270
        mov     [edi+4], al
2271
        mov     [edi+5], dl
31 halyavin 2272
 
2273
;STEP 5 Test on WRITE OR NOTWRITE
134 diamond 2274
        cmp     word [esi+40], '.'
2275
        jz      nextfl
2276
        cmp     word [esi+40], '..'
2277
        jnz     @f
2278
        cmp     byte [esi+42], 0
2279
        jz      nextfl
2280
@@:
31 halyavin 2281
 
134 diamond 2282
; STEP 6 SORT ALGORYTHM
31 halyavin 2283
 
134 diamond 2284
        push    esi
2285
        xor     esi, esi
31 halyavin 2286
 
134 diamond 2287
; At first Fold after Dat
31 halyavin 2288
 
2289
ftestname:
134 diamond 2290
        cmp     dword [convinfo+esi], -1
2291
        jz      writefile
2292
    cmp byte [fileinfo+15],'F'
131 diamond 2293
    je	    F
134 diamond 2294
    cmp byte [fileinfo+15],'D'
2295
    jne add_element
2296
D:  cmp byte [convinfo+esi+15],'D'
131 diamond 2297
    je	    add_element
134 diamond 2298
    cmp byte [convinfo+esi+15],'F'
131 diamond 2299
    je	    skipfile
31 halyavin 2300
    jmp add_element
134 diamond 2301
F:  cmp byte [convinfo+esi+15],'D'
31 halyavin 2302
    je writenow
134 diamond 2303
;    cmp byte [convinfo+esi+15],'F'
31 halyavin 2304
;    je  add_element
2305
;    jmp add_element
2306
 
2307
add_element:
134 diamond 2308
; compare items
2309
        movzx   eax, [viewmode]
2310
        call    [compare+eax*4]
2311
        jb      writenow
31 halyavin 2312
skipfile:
134 diamond 2313
    add esi,27
31 halyavin 2314
    jmp ftestname
2315
 
2316
writenow:
134 diamond 2317
    mov ecx,4096*27-1
31 halyavin 2318
    sub ecx,esi
2319
ldloop:
2320
    mov al,[convinfo+ecx+esi]
134 diamond 2321
    mov [convinfo+ecx+esi+27],al
31 halyavin 2322
    dec ecx
2323
    jns ldloop
2324
 
2325
writefile:
134 diamond 2326
    mov ecx,26
31 halyavin 2327
wfloop:
134 diamond 2328
    mov al,[fileinfo+ecx]
31 halyavin 2329
    mov [convinfo+ecx+esi],al
2330
    dec ecx
2331
    jns wfloop
134 diamond 2332
        inc     [listsize]
2333
        pop     esi
31 halyavin 2334
 
2335
nextfl:
134 diamond 2336
        add     esi, 304
2337
        pop     ebx
2338
        dec     ebx
2339
        jnz     newlineb
31 halyavin 2340
 
134 diamond 2341
nofiles:
2342
        ret
31 halyavin 2343
 
134 diamond 2344
toupper:
2345
        cmp     al, 'a'
2346
        jb      .ret
2347
        cmp     al, 'z'
2348
        ja      @f
2349
.sub20:
2350
        sub     al, 0x20
2351
.ret:
2352
        ret
2353
@@:
2354
        cmp     al, 0xA0
2355
        jb      .ret
2356
        cmp     al, 0xB0
2357
        jb      .sub20
2358
        cmp     al, 0xE0
2359
        jb      .ret
2360
        cmp     al, 0xF0
2361
        jae     @f
2362
        sub     al, 0xE0-0x90
2363
        ret
2364
@@:
2365
        cmp     al, 0xF1
2366
        jnz     .ret
2367
        dec     eax
2368
        ret
31 halyavin 2369
 
134 diamond 2370
compare_date:
2371
        pushad
2372
        mov     al, [fileinfo+10]
2373
        cmp     al, [convinfo+esi+10]
2374
        jnz     .ret
2375
        mov     al, [fileinfo+11]
2376
        cmp     al, [convinfo+esi+11]
2377
        jnz     .ret
2378
        mov     al, [fileinfo+12]
2379
        cmp     al, [convinfo+esi+12]
2380
        jnz     .ret
2381
        mov     al, [fileinfo+13]
2382
        cmp     al, [convinfo+esi+13]
2383
        jnz     .ret
2384
        mov     al, [fileinfo+7]
2385
        cmp     al, [convinfo+esi+7]
2386
        jnz     .ret
2387
        mov     al, [fileinfo+8]
2388
        cmp     al, [convinfo+esi+8]
2389
        jnz     .ret
2390
        mov     al, [fileinfo+4]
2391
        cmp     al, [convinfo+esi+4]
2392
        jnz     .ret
2393
        mov     al, [fileinfo+5]
2394
        cmp     al, [convinfo+esi+5]
2395
        jz      compare_name.1
2396
.ret:
2397
        popad
2398
        ret
2399
compare_name:
2400
        pushad
2401
.1:
2402
        mov     edi, dword [convinfo+esi]
2403
        mov     esi, dword [fileinfo]
2404
        call    strcmpi
2405
        popad
2406
        ret
2407
compare_ext:
2408
        pushad
2409
        mov     esi, dword [convinfo+esi]
2410
        mov     edi, dword [fileinfo]
2411
        call    find_ext
2412
        xchg    esi, edi
2413
        call    find_ext
2414
        call    strcmpi
2415
        popad
2416
        jz      compare_name
2417
        ret
2418
compare_size:
2419
        pushad
2420
        lea     edi, [convinfo+esi+19]
2421
        lea     esi, [fileinfo+19]
2422
        mov     ecx, 8
2423
        repz    cmpsb
2424
        popad
2425
        jz      compare_name
2426
        ret
31 halyavin 2427
 
134 diamond 2428
strcmpi:
2429
        lodsb
2430
        call    toupper
2431
        push    eax
2432
        mov     al, [edi]
2433
        inc     edi
2434
        call    toupper
2435
        cmp     [esp], al
2436
        pop     eax
2437
        jnz     @f
2438
        test    al, al
2439
        jnz     strcmpi
2440
@@:
2441
        ret
2442
 
2443
find_ext:
2444
        lodsb
2445
        test    al, al
2446
        jz      .noext
2447
        cmp     al, '.'
2448
        jnz     find_ext
2449
        ret
2450
.noext:
2451
        dec     esi
2452
        ret
2453
 
31 halyavin 2454
;******************************************************************************
2455
 
2456
; DATA AREA
2457
pmenu_draw dd 0  ;if poup menu is draw,update all window
131 diamond 2458
flick	     dd 0  ;anti flick on ?
2459
drawhf	       dd 0  ;draw file menu?
2460
drawhv	       dd 0  ;draw view menu?
2461
drawhi	       dd 0  ;draw info menu?
2462
cursor	       dd 0  ;cursor in prompt line
2463
focus	     dd 0  ;prompt edit or window?
31 halyavin 2464
downstop   dd 0
2465
filecursor dd 0
131 diamond 2466
mousex	       dd 0
2467
mousey	       dd 0
31 halyavin 2468
blocksread dd 0
2469
listsize   dd 0  ;num of files in directory
131 diamond 2470
temp	   dd 0
31 halyavin 2471
readblock  dd 1
2472
dlg_type   db 0 ;S-save O-open
134 diamond 2473
browser    db 0  ;0-dialog, 1-browser
2474
viewmode   db 0  ;folder sort
31 halyavin 2475
 
134 diamond 2476
compare dd      compare_name
2477
        dd      compare_ext
2478
        dd      compare_size
2479
        dd      compare_date
31 halyavin 2480
 
134 diamond 2481
aRD     db      'RD',0
2482
aFD     db      'FD',0
2483
aHD0    db      'HD0',0
2484
aHD1    db      'HD1',0
2485
aHD2    db      'HD2',0
2486
aHD3    db      'HD3',0
156 diamond 2487
aCD0    db      'CD0',0
2488
aCD1    db      'CD1',0
2489
aCD2    db      'CD2',0
2490
aCD3    db      'CD3',0
134 diamond 2491
a1      db      '1',0,0
2492
a2      db      '2',0,0
2493
a3      db      '3',0,0
2494
a4      db      '4',0,0
2495
a5      db      '5',0,0
2496
a6      db      '6',0,0
2497
a7      db      '7',0,0
2498
a8      db      '8',0,0
2499
a9      db      '9',0,0
2500
a10     db      '10',0
2501
a11     db      '11',0
2502
a12     db      '12',0
2503
a13     db      '13',0
2504
a14     db      '14',0
2505
a15     db      '15',0
2506
a16     db      '16',0
2507
a17     db      '17',0
2508
a18     db      '18',0
2509
a19     db      '19',0
2510
a20     db      '20',0
131 diamond 2511
 
134 diamond 2512
hdimg:
2513
        dd      aRD
2514
        db      'RAMDISK    FOL         '
2515
        dd      aFD
2516
        db      'FLOPPYDISK FOL         '
2517
hdimg1  dd      0
2518
        db      'HARDDISK   FOL         '
2519
hdimg2  dd      0
2520
        db      'HARDDISK   FOL         '
2521
hdimg3  dd      0
2522
        db      'HARDDISK   FOL         '
2523
hdimg4  dd      0
2524
        db      'HARDDISK   FOL         '
2525
ptimg   db      'PARTITION  FOL         '
31 halyavin 2526
 
2527
modetext:
2528
      ;0123456789012345
2529
   db 'SORT BY NAME   0'
2530
   db 'SORT BY EXT.   1'
2531
   db 'SORT BY SIZE   2' ;type sort
2532
   db 'SORT BY DATE   3'
2533
   db 'DEL SORT NAME  4'
2534
   db 'DEL SORT EXT.  5'
2535
   db 'DEL SORT SIZE  6' ;type sort
2536
   db 'DEL SORT DATE  7'
2537
 
131 diamond 2538
dirlen	      dd     0x1
31 halyavin 2539
b_color   dd   0x6677cc
2540
 
2541
; //// Willow
131 diamond 2542
;MRUfile:
2543
;   dd 0x0
2544
;   dd 0x0
2545
;   dd 0x1
2546
;   dd path
2547
;   dd tempzone
2548
;   db '/RD/1/MRU.LST',0
31 halyavin 2549
; //// Willow
2550
 
2551
;Name of programs
539 spraid 2552
editor	      db '/sys/TINYPAD',0
529 spraid 2553
bmpview   db '/sys/MV',0
2554
jpgview   db '/sys/JPEGVIEW',0
2555
gifview   db '/sys/GIFVIEW',0
539 spraid 2556
ac97      db '/sys/AC97SND',0
2557
rtfread   db '/sys/RTFREAD',0
31 halyavin 2558
; //// Willow
529 spraid 2559
pngview   db '/sys/@RCHER',0
31 halyavin 2560
; //// Willow
539 spraid 2561
midamp	  db '/sys/MIDAMP',0
2562
view3ds   db '/sys/3D/VIEW3DS',0
2563
life2     db '/sys/DEMOS/LIFE2',0
31 halyavin 2564
 
134 diamond 2565
more_char db 10h
2566
 
552 diamond 2567
IncludeIGlobals
2568
 
31 halyavin 2569
fileinfo_start:
134 diamond 2570
        dd      7
2571
        dd      0
2572
fileinfo_params:
2573
        dd      0
2574
        dd      0
2575
        dd      0
2576
        db      0
2577
fileinfo_name:
2578
        dd      0
31 halyavin 2579
 
134 diamond 2580
clipfile_info:
2581
        dd      ?
2582
        dd      0
2583
        dd      0
2584
        dd      ?
2585
        dd      paramtest
552 diamond 2586
        db      '/SYS/CLIPFILE.TXT',0
134 diamond 2587
copyr_run:
2588
        dd      7
2589
        dd      0
2590
        dd      copyr_param
2591
        dd      0
2592
        dd      0
552 diamond 2593
        db      '/SYS/COPYR',0
134 diamond 2594
 
31 halyavin 2595
fileinfoblock:
134 diamond 2596
   dd 0x1    ; read folder
131 diamond 2597
   dd 0x0    ; first block
134 diamond 2598
   dd 0x0    ; flags (ANSI names)
2599
   dd 4095   ; number of blocks to read
131 diamond 2600
   dd outinfo	  ; ret offset
31 halyavin 2601
path:
134 diamond 2602
times 1024 db 0	    ;path
131 diamond 2603
 
2604
table_area:
2605
rb 10
2606
 
31 halyavin 2607
;rb 256
2608
but_file:
2609
file 'systr12.GIF'
134 diamond 2610
 
2611
I_END:
2612
 
2613
scroll_height dd ?
2614
scroll_pos dd ?
2615
 
31 halyavin 2616
butimg:
131 diamond 2617
rb 400*16*3+8	  ;buttons (left pice of picture)
31 halyavin 2618
logoimg:
131 diamond 2619
rb 70*16*3+8	;logo (right pice of picture)
31 halyavin 2620
logoinfimg:
131 diamond 2621
rb 60*60*3+8	;logoinfo (right pice of picture)
31 halyavin 2622
upsb:
131 diamond 2623
rb 8*9*3+8    ;up scroll button
31 halyavin 2624
dnsb:
131 diamond 2625
rb 8*9*3+8    ;down scroll button
31 halyavin 2626
 
2627
;ICONS RESERVE AREA
2628
hdico:
2629
rb 12*9*3+8
2630
rdico:
2631
rb 12*9*3+8
2632
folico:
2633
rb 12*9*3+8
2634
datico:
2635
rb 12*9*3+8
2636
delico:
2637
rb 12*9*3+8
2638
imgico:
2639
rb 12*9*3+8
2640
txtico:
2641
rb 12*9*3+8
2642
asmincico:
2643
rb 12*9*3+8
2644
execico:
2645
rb 12*9*3+8
156 diamond 2646
cdico:
2647
rb 12*9*3+8
31 halyavin 2648
 
131 diamond 2649
tempimg:    ;reserve ram for images
2650
rb 400*100*3+8	     ;for picture
31 halyavin 2651
rb 8000
2652
 
2653
MYPID:
2654
rd 8
2655
 
2656
param_area:
2657
rb 256
2658
paramtest:
134 diamond 2659
rb 1024
31 halyavin 2660
filedir:
134 diamond 2661
rb 1024
31 halyavin 2662
 
552 diamond 2663
IncludeUGlobals
2664
 
31 halyavin 2665
procinfo process_information
2666
sc system_colors
2667
 
2668
fileinfo:
2669
rb 200 ;4096*62+1024
2670
 
134 diamond 2671
copyr_param     rb      256
2672
 
31 halyavin 2673
outinfo:
134 diamond 2674
rb 32+4096*304
31 halyavin 2675
 
2676
convinfo:
134 diamond 2677
rb 4096*27
2678
; stack
2679
        align 4
2680
        rb      1024
31 halyavin 2681
RAM_END: