Subversion Repositories Kolibri OS

Rev

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