Subversion Repositories Kolibri OS

Rev

Go to most recent revision | Blame | Last modification | View Log | Download | RSS feed

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