Subversion Repositories Kolibri OS

Rev

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