Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 134 → Rev 133

/programs/fs/sysxtree/trunk/ascl.inc
186,9 → 186,9
cld
;; mov esi,path
mov edi,path
xor eax,eax
mov ecx,(1024+16)/4
rep stosd
mov eax,0
mov ecx,200
rep stosb
 
;mov [get_loops],0
mov [dlg_pid_get],0
230,7 → 230,7
mov eax,60
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,1024+16 ; size
mov edx,150 ; size 150 bytes
int 0x40
 
; change wanted events list 7-bit IPC event
242,7 → 242,7
; STEP 3 run SYSTEM XTREE with parameters
;
 
mov eax,70
mov eax,58
mov ebx,run_fileinfo
int 0x40
 
253,15 → 253,16
mov eax,23
mov ebx,50 ;0.5 sec
int 0x40
dec eax
jz mred
dec eax
jz mkey
dec eax
jz mbutton
cmp al, 7-3
jz mgetmes
 
cmp eax,1
je mred
cmp eax,2
je mkey
cmp eax,3
je mbutton
cmp eax,7
je mgetmes
 
; Get number of procces
mov ebx,procinfo
mov ecx,-1
347,14 → 348,14
ready:
;
; The second message get
; Second message is 1024 bytes path to SAVE/OPEN file
; Second message is 100 bytes path to SAVE/OPEN file
; shl path string on 16 bytes
;
cld
mov esi,path+16
mov edi,path
mov ecx,1024/4
rep movsd
mov ecx,200
rep movsb
mov [edi],byte 0
 
jmp openoff
370,11 → 371,11
dd 0,0 ; Type of dialog
 
run_fileinfo:
dd 7
dd 16
dd 0
dd param
dd 0
dd 0
dd procinfo ; 0x10000
;run_filepath
db '/RD/1/SYSXTREE',0
 
397,9 → 398,9
cld
;; mov esi,path
mov edi,path
xor eax,eax
mov ecx,(1024+16)/4
rep stosd
mov eax,0
mov ecx,200
rep stosb
 
;mov [get_loops],0
mov [dlg_pid_get],0
441,7 → 442,7
mov eax,60
mov ebx,1 ; define IPC
mov ecx,path ; offset of area
mov edx,1024+16 ; size
mov edx,150 ; size 150 bytes
int 0x40
 
; change wanted events list 7-bit IPC event
453,7 → 454,7
; STEP 3 run SYSTEM XTREE with parameters
;
 
mov eax,70
mov eax,58
mov ebx,run_fileinfo
int 0x40
 
464,15 → 465,16
mov eax,23
mov ebx,50 ;0.5 sec
int 0x40
dec eax
jz mred
dec eax
jz mkey
dec eax
jz mbutton
cmp al, 7-3
jz mgetmes
 
cmp eax,1
je mred
cmp eax,2
je mkey
cmp eax,3
je mbutton
cmp eax,7
je mgetmes
 
; Get number of procces
mov ebx,procinfo
mov ecx,-1
558,14 → 560,14
ready:
;
; The second message get
; Second message is 1024 bytes path to SAVE/OPEN file
; Second message is 100 bytes path to SAVE/OPEN file
; shl path string on 16 bytes
;
cld
mov esi,path+16
mov edi,path
mov ecx,1024/4
rep movsd
mov ecx,200
rep movsb
mov [edi],byte 0
 
jmp openoff
581,11 → 583,11
dd 0,0 ; Type of dialog
 
run_fileinfo:
dd 7
dd 16
dd 0
dd param
dd 0
dd 0
dd procinfo
;run_filepath:
db '/RD/1/SYSXTREE',0
 
/programs/fs/sysxtree/trunk/sysxtree.asm
27,8 → 27,7
;79Ver Asko Vuori volume label add and "put in command line" bug fix
;80Ver prompt edit fatal bug deleted, antiflick when move list up/down
;81Ver Save Dialog bug deleted
;82Ver Rewritten to function 70. Corrected work with scrollbar.
;1560000 bytes memory!
;600000 bytes memory!
 
;******************************************************************************
use32
56,21 → 55,30
; int 0x40
; //// Willow
mcall 18,11,1,table_area
cmp [edx+2],byte 0
mov edi,hdimg+62*2
cmp [table_area+2],byte 0
je no_hdpartition_on_hd0
mov [hdimg1], aHD0
mov esi,hdimg1
mov ecx,62
rep movsb
no_hdpartition_on_hd0:
cmp [edx+3],byte 0
cmp [table_area+3],byte 0
je no_hdpartition_on_hd1
mov [hdimg2], aHD1
mov esi,hdimg2
mov ecx,62
rep movsb
no_hdpartition_on_hd1:
cmp [edx+4],byte 0
cmp [table_area+4],byte 0
je no_hdpartition_on_hd2
mov [hdimg3], aHD2
mov esi,hdimg3
mov ecx,62
rep movsb
no_hdpartition_on_hd2:
cmp [edx+5],byte 0
cmp [table_area+5],byte 0
je no_hdpartition_on_hd3
mov [hdimg4], aHD3
mov esi,hdimg4
mov ecx,62
rep movsb
no_hdpartition_on_hd3:
 
mov eax,40
79,10 → 87,12
 
cmp byte [param_area],0 ;test parameters line
jne no_brow ;it's dialog
mov [browser], 1 ;it's browser
jmp no_dlg
mov [browser],dword 1 ;it's browser
no_brow:
 
cmp [browser],dword 1
je no_dlg
 
mov al,byte [param_area+5]
mov [dlg_type],al
 
174,7 → 184,54
add eax,12
dec ebp
jnz loogetimg
jmp endgip
 
getimgproc:
pushad
mov dword [edx],esi ;xs
mov dword [edx+4],edi ;ys
 
mov ebp,eax
mov eax,dword [ecx] ;getx size
push edx
push ecx
lea ecx,[eax+2*eax]
 
mul ebx
add eax,ebp ;x
mov edx,ecx
lea eax,[eax+2*eax] ;eax=offset on imsrc
 
mov ecx,esi ;xs
mov ebx,edi ;ys
 
mov ebp,esi
 
pop edi
lea esi,[eax+8+edi]
 
pop edi
add edi,8
 
cld
cyc:
movsw
movsb
dec ecx
jne cyc
add esi,edx
mov ecx,ebp ;xs
sub esi,ecx
sub esi,ecx
sub esi,ecx
dec ebx
jne cyc
 
popad
ret
 
endgip:
 
call read_directory
; call convertation
red:
192,7 → 249,7
mov eax,37
mov ebx,2
int 0x40
dec eax
cmp eax,1
jne still
 
scrl:
199,55 → 256,88
mov eax,37
mov ebx,1
int 0x40
movzx ebx, ax ; y
mov ebx,eax
shr eax, 16 ; x
and ebx,0xffff ;y
 
mov ebp,eax
sub ebp,[listx] ;[procinfo.x_size]
sub ebp,[listxsize]
add ebp,[scrollsize]
cmp ebp,dword [scrollsize] ;8
jae menu_test ; still
ja menu_test ; still
 
lea ebp, [ebx-scrollbutsize]
sub ebp, [listy] ; up scroll
mov ebp,ebx
sub ebp,[listy] ;76 ;up scroll
sub ebp,[scrollbutsize]
cmp ebp,0
jl menu_test
mov ecx, [listysize]
sub ecx, 2*scrollbutsize
mov eax, [scroll_height]
cmp ebp, ecx
jge menu_test
sub ecx, eax
shr eax, 1
sub ebp, eax
jge @f
xor ebp, ebp
@@:
cmp ebp, ecx
jl @f
mov ebp, ecx
@@:
xor edx, edx
mov [mousey],ebp
 
push eax ebx edx
mov edx,0
mov eax, [listysize]
sub eax, 2
mov ebx, 10
mov ebx,dword 10
div ebx
 
mov [filelistsize],eax
mov ebx, eax
cmp ebx, [listsize]
jae notusescrl
cmp ebx,[listsize] ;filelistsize in ebx
ja notusescrl
 
mov edx,0
mov eax,[listysize]
sub eax,[scrollbutsize]
sub eax,[scrollbutsize]
 
shl eax,16+6
div dword [listsize]
mul ebx
shr eax,16+6
 
mov ebp,eax ; in ebp ysize of scroll
 
mov edx,0
mov eax, [listsize]
sub eax, ebx
mul ebp
div ecx
cmp eax, [filecursor]
jz still
 
mov ebx,[listysize]
sub ebx,[scrollbutsize]
sub ebx,[scrollbutsize]
shl eax,16
div ebx ;dword [listsize]
mul [mousey]
shr eax,16
 
mov ebx,[listsize]
sub ebx,[filelistsize]
cmp eax,ebx
jnae no_cor
mov eax,[listsize] ;correction for full dirs (1000 files)
sub eax,[filelistsize]
no_cor:
mov [filecursor], eax
 
jmp usescrl
notusescrl:
cmp [filecursor], 0
jz still
mov [filecursor],0 ;ebp
usescrl:
 
pop edx ebx eax
 
mov esi,[listy];[procinfo.y_size]
add esi,[listysize]
sub esi,[scrollbutsize]
 
cmp ebx,esi
jna oks ;menu_test ;still
 
sub esi,ebp
inc esi ;correction
cmp ebx,esi
ja menu_test ;still
oks:
 
mov [flick],1
jmp anti_flick ;red
 
289,7 → 379,9
jmp down
no_pgdown:
cmp ah,key_Enter
je kfad
jne no_k_ent
jmp kfad
no_k_ent:
cmp ah,key_Bspace
je back
cmp ah,key_F2
312,7 → 404,7
jne no_con_ent
not [focus]
jmp savetest
; jmp update
jmp update
no_con_ent:
cmp ah,key_Left
jne no_con_left
329,14 → 421,16
cmp ah,key_Bspace
jne no_con_bspace
 
mov ecx,[cursor]
cmp ecx,0
je still
dec ecx
mov ebp, [cursor]
test ebp, ebp
jz still
lobsp:
mov bl,byte [path+ebp]
mov byte [path+ebp-1],bl
inc ebp
cmp ebp,1024
cmp ebp,100
jne lobsp
dec [cursor]
mov [flick],2
345,18 → 439,18
 
mov ecx,[cursor]
dec ecx
mov ebp,1022
cmp byte [path+ebp], 0
jnz still
mov ebp,100 ;[cursor]
losx:
cmp ebp, ecx
jbe @f
mov bl,byte [path+ebp]
mov byte [path+ebp+1],bl
dec ebp
jmp losx
@@:
cmp ebp,ecx ;100
jne losx
 
mov ebp, [cursor]
cmp ebp,100
ja still
 
mov byte [path+ebp],ah
inc dword [cursor]
 
410,104 → 504,133
kfad:
mov eax,[filecursor]
no_kfad:
mov ebx,27
mov ebx,62
mul ebx
lea ebp,[convinfo+eax]
mov esi,[ebp]
cmp esi,-1
jz still
mov ebp,eax
 
mov edi,paramtest ;clear param string
mov ecx,1024/4
xor eax,eax
rep stosd
mov ecx,256
mov al,0
rep stosb
 
mov edi, path
mov ecx, 1024
repnz scasb
dec edi
cmp [ebp+15], dword 'FOL '
jnz openf
; open directory - append its name to path
cmp ecx, 2
jb still
push edi
mov al, '/'
stosb
dec ecx
@@:
lodsb
stosb
test al, al
jz @f
dec ecx
jnz @b
; name is too long - do not do anything
pop edi
xor eax, eax
mov ecx, path+1024
sub ecx, edi
rep stosb
jmp still
@@:
pop edi
; name appended, now read new directory
 
mov esi,0
lll2:
mov al,byte [path+esi]
cmp al,byte 0 ;' '; '/'
je fis2
cmp al,byte ' '; '/'
je fis2
inc esi
cmp esi,100
jna lll2
jmp fis2
 
fis2:
mov edi,ebp
cmp [convinfo+edi+26],dword 'FOL '
jne openf
mov [path+esi],byte '/'
inc esi
mov ebp,8
 
los: ;directory extension bug fix
mov al,[convinfo+edi]
cmp al,' '
jz skip_name_space
mov [path+esi],al
inc esi
skip_name_space:
inc edi
dec ebp
jnz los
 
cmp byte [convinfo+edi],'.'
jnz dir_name_end
cmp byte [convinfo+edi+1],' '
jz dir_name_end
mov ebp,4
dir_ext_char:
mov al,[convinfo+edi]
cmp al,' '
jz dir_name_end
mov [path+esi],al
inc esi
inc edi
dec ebp
jnz dir_ext_char
dir_name_end:
mov [filecursor],0
 
;los:
; mov al,[convinfo+edi]
; mov [path+esi],al
; inc esi
; inc edi
; dec ebp
; jnz los
; mov [filecursor],0
; cmp byte [dlg_type],'S'
; je savetest
;no_save:
 
call read_directory
;; call convertation
call draw_window
jmp still
; jmp still
 
;Savetest
savetest:
cmp byte [dlg_type],'S'
jne still
; always force open file - this is better
; because there exists files without extension and folders with extension
jmp openf
; mov ecx,100
;savetestloop:
; cmp [path+ecx],byte 0
; je next_byte
; cmp [path+ecx],byte 32
; je next_byte
; cmp [path+ecx],byte '.'
; je openf ;it's file
;; cmp [path+ecx],byte '/'
;; je no_save ;it's dir
;next_byte:
; dec ecx
; jnz savetestloop
; jmp still
je savetest_yes
jmp still
savetest_yes:
mov ecx,100
savetestloop:
cmp [path+ecx],byte 0
je next_byte
cmp [path+ecx],byte 32
je next_byte
cmp [path+ecx],byte '.'
je openf ;it's file
; cmp [path+ecx],byte '/'
; je no_save ;it's dir
next_byte:
dec ecx
jnz savetestloop
jmp still
 
;Open/Run file
 
openf:
push esi edi
mov esi, path
mov edi, paramtest
mov ecx, 1024/4
rep movsd
pop edi esi
add edi, paramtest-path
mov ecx,100
lopt:
mov al,[path+ecx]
mov [paramtest+ecx],al
dec ecx
jns lopt
 
; mov ebp,100
;loow:
; cmp [paramtest+ebp],byte '.'
; je file_set
; dec ebp
; jnz loow ;is file set not file add
 
cmp dword [focus],0 ;if prompt line with focus no add file name from frame
jne file_set
 
cmp edi, paramtest+1022
jae still
mov al, '/'
stosb
@@:
lodsb
stosb
test al, al
jz file_set
cmp edi, paramtest+1024
jb @b
jmp still
 
mov [paramtest+esi],byte '/'
inc esi
mov ebp,8+4
mov edx,edi
losf:
mov al,[convinfo+edi]
mov [paramtest+esi],al
inc esi
inc edi
dec ebp
jnz losf
file_set:
 
cmp [browser],0
532,7 → 655,7
mov eax,60
mov ebx,2
mov edx,paramtest
mov esi,1024
mov esi,100
int 0x40
 
jmp exit
542,79 → 665,101
; cmp [convinfo+edi+26],dword 'Fvol'
; je edit
 
; find extension
mov eax, paramtest+1023
@@:
dec eax
cmp byte [eax+1], 0
jz @b
@@:
cmp byte [eax], '/'
jz .noext
cmp byte [eax], '.'
jz .ext
dec eax
cmp eax, paramtest
jae @b
.noext:
; file has no extension
; xor ebx, ebx
mov eax,dword [convinfo+edx+8]
cmp eax,'. '
jne noexecute
mov ebx,0
jmp execute
.ext:
inc eax
; eax points to extension
cmp byte [eax], 0
jz .noext
mov ecx, dword [eax]
and ecx, not 0x20202020
noexecute:
 
cmp eax,'.JPG'
jne nojv
jpg_jpe:
mov ebx, jpgview
cmp ecx, 'JPG'
jz run
cmp ecx, 'JPEG' ; note that it will select also *.JPEG*
jz run
jmp run
nojv:
cmp eax,'.JPE'
je jpg_jpe
cmp eax,'.GIF'
jne nojv1
mov ebx, gifview
cmp ecx, 'GIF'
jz run
jmp run
nojv1:
cmp eax,'.WAV'
jne nojv12
mov ebx, ac97wav
cmp ecx, 'WAV'
jz run
jmp run
nojv12:
cmp eax,'.MID'
jne nojv13
mov ebx, midamp
cmp ecx, 'MID'
jz run
jmp run
nojv13:
cmp eax,'.BMP'
jne nobv
mov ebx, bmpview
cmp ecx, 'BMP'
jz run
jmp run
nobv:
; //// Willow
cmp eax,'.PNG'
jne nopngv
mov ebx, pngview
cmp ecx, 'PNG'
jz run
jmp run
nopngv:
; //// Willow
cmp eax,'.RTF'
jne nortf
mov ebx, rtfread
cmp ecx, 'RTF'
jz run
jmp run
nortf:
cmp eax,'.ASM'
je edit
cmp eax,'.TXT'
je edit
cmp eax,'.INC'
je edit
jmp still
edit:
mov ebx, editor
cmp ecx, 'ASM'
jz run
cmp ecx, 'TXT'
jz run
cmp ecx, 'INC'
jz run
jmp still
jmp run
 
execute:
mov ecx,0 ;200
loexe:
mov al,[paramtest+ecx]
; cmp al,0
; je setzr
; cmp al,' '
; je setzr
; je badl
cmp al,'.'
je setzr
; je badl
; jmp okl
;badl:
; mov al,0
okl:
mov [open_path+ecx],al
inc ecx
cmp ecx,200
jnae loexe
 
setzr:
; add ecx,3
; mov al,0
mov [open_path+ecx],byte 0 ;al
 
mov eax,58
mov ebx, fileinfo_start
and dword [ebx+8], 0 ; no parameters
mov dword [ebx+21], paramtest ; program name
.do:
mov eax, 70
int 0x40
 
jmp still
 
run:
mov [fileinfo_name], ebx ; program name
mov ebx, fileinfo_start
mov dword [ebx+8], paramtest ; parameters
jmp execute.do
mov ecx,paramtest
mov eax,19
int 0x40
jmp still
 
no_filelist:
 
645,37 → 790,53
cmp ah,9
jne no_textopen
textopen:
mov eax, 27
mul [filecursor]
cmp dword [eax+convinfo+15], 'FOL '
jz still
push eax
mov esi, path
mov edi, paramtest
@@:
lodsb
test al, al
jz @f
stosb
jmp @b
@@:
mov al, '/'
stosb
pop eax
mov esi, [eax+convinfo]
cmp esi, -1
jz still
@@:
lodsb
stosb
test al, al
jz @f
cmp edi, paramtest+1024
jb @b
mov esi,0
xlll2:
mov al,byte [path+esi]
cmp al,byte '/'
jne xfis2
inc esi
cmp esi,12*20
jnae xlll2
jmp still
@@:
xfis2:
mov al,byte [path+esi]
cmp al,byte ' '
je xaa2
inc esi
cmp esi,12*20
jnae xfis2
jmp still
xaa2:
mov eax,[filecursor]
mov ebx,62
mul ebx
mov edi,eax
cmp [convinfo+edi+26],dword 'FOL '
je still
mov ecx,12*20
xlopt:
mov al,[path+ecx]
mov [paramtest+ecx],al
dec ecx
jns xlopt
mov [paramtest+esi],byte '/'
inc esi
mov ebp,8+4
mov edx,edi
xlosf:
mov al,[convinfo+edi]
mov [paramtest+esi],al
inc esi
inc edi
dec ebp
jnz xlosf
mov [paramtest+esi],byte 0
mov ebx, editor
jmp run
mov ecx,paramtest
mov eax,19
int 0x40
jmp red ;still
 
no_textopen:
 
682,11 → 843,12
cmp ah,11
jne no_view
viewset:
inc [viewmode]
cmp [viewmode], 4
jb @f
; not dword [delflag]
inc dword [viewmode]
cmp dword [viewmode],8
jnae not_cm
mov [viewmode], 0
@@:
not_cm:
call read_directory
; call convertation
mov [filecursor],0
697,19 → 859,26
cmp ah,12 ;move back
jne no_back
back:
mov edi, path+1024
mov ecx, edi
@@:
dec edi
cmp byte [edi], '/'
jz @f
cmp edi, path
ja @b
mov esi,12*20
lll:
mov al,byte [path+esi]
cmp al,byte ' '
jne findsl
dec esi
jnz lll
jmp still
@@:
sub ecx, edi
xor eax, eax
rep stosb
findsl:
dec esi
fis:
mov al,byte [path+esi]
cmp al,byte '/'
je aa
mov [path+esi],byte 0 ;' '
dec esi
jnz fis
aa:
mov [path+esi],byte 0 ;' '
 
mov [filecursor],0
call read_directory
; call convertation
742,40 → 911,56
cmp ah,15
jne no_copyclip ;copy to clipboard
copy_to_clip:
mov eax, 27
mul [filecursor]
cmp dword [convinfo+eax+15], 'FOL '
jz still
push eax
mov esi, path
mov edi, paramtest
@@:
lodsb
test al, al
jz @f
stosb
jmp @b
@@:
pop eax
mov esi, [convinfo+eax]
cmp esi, -1
jz still
mov al, '/'
stosb
@@:
lodsb
stosb
test al, al
jz @f
cmp edi, paramtest+1024
jb @b
mov ebx,param_area ;clipfilp
mov eax,32
int 0x40
mov esi,0
wlll2:
mov al,byte [path+esi]
cmp al,byte '/'
jne wfis2
inc esi
cmp esi,12*20
jnae wlll2
jmp still
@@:
sub edi, paramtest+1
mov ebx, clipfile_info
mov byte [ebx], 2
mov [ebx+12], edi
mov eax, 70
wfis2:
mov al,byte [path+esi]
cmp al,byte ' '
je waa2
inc esi
cmp esi,12*20
jnae wfis2
jmp still
waa2:
mov eax,[filecursor]
mov ebx,62
mul ebx
mov edi,eax
cmp [convinfo+edi+26],dword 'FOL '
je still
mov ecx,12*20
wlopt:
mov al,[path+ecx]
mov [paramtest+ecx],al
dec ecx
jns wlopt
mov [paramtest+esi],byte '/'
inc esi
mov ebp,8+4
mov edx,edi
wlosf:
mov al,[convinfo+edi]
mov [paramtest+esi],al
inc esi
inc edi
dec ebp
jnz wlosf
mov [paramtest+esi],byte 0
mov ebx,param_area ;clipfile
mov ecx,paramtest
mov edx,100
mov esi,0
mov eax,33
int 0x40
jmp still
no_copyclip:
783,76 → 968,96
cmp ah,16
jne no_clippaste
paste_from_clip:
mov ebx, clipfile_info
mov byte [ebx], 0
mov dword [ebx+12], 1023
mov eax, 70
mov ebx,param_area ;clipfile
mov ecx,0
mov edx,-1
mov esi,sourcepath
mov eax,6
int 0x40
cmp ebx, 0
jle still
mov byte [paramtest+ebx], 0
; OS allows only 256 symbols in command line
cmp ebx, 250
jae still
; we use Pascal-style strings for /RD/1/COPYR
; source file
mov edi, copyr_param
mov al, bl
stosb
mov ecx, ebx
mov esi, paramtest
rep movsb
; destination path
 
mov ecx,99
cdestp:
mov al,[path+ecx]
mov [destpath+ecx],al
dec ecx
jns cdestp
 
mov esi,0
zlll2:
mov al,byte [destpath+esi]
cmp al,byte '/'
jne zfis2
inc esi
cmp esi,100
jnae zlll2
jmp still
zfis2:
mov al,byte [destpath+esi]
cmp al,byte ' '
je zaa2
inc esi
cmp esi,100
jnae zfis2
jmp still
zaa2:
mov byte [destpath+esi],'/'
inc esi
 
mov edi,0
qlll2:
mov al,byte [sourcepath+edi]
cmp al,byte '.'
je qfis2
inc edi
mov ebp, edi
mov esi, path
@@:
cmp edi, copyr_param+255
jae still
lodsb
test al, al
jz @f
stosb
jmp @b
; destination file name
@@:
dec ebx
jz still
cmp byte [paramtest+ebx], '/'
jnz @b
lea esi, [paramtest+ebx]
@@:
lodsb
test al, al
jz @f
stosb
cmp edi, copyr_param+255
jae still
jmp @b
@@:
mov byte [edi], 0
sub edi, ebp
mov eax, edi
mov [ebp-1], al
; display
cmp [browser], 1
cmp edi,100
jnae qlll2
jmp still
qfis2:
sub edi,8 ;.-8=start of file name
 
mov ecx,11 ;11 sybols
cfname:
mov al,[sourcepath+edi]
cmp al,byte ' '
je dar
mov [destpath+esi],al
inc esi
dar:
inc edi
dec ecx
jns cfname
 
; mov [destpath+esi],byte 0
 
mov ecx,199
cdestjp:
mov al,[sourcepath+ecx]
cmp al,byte 0
jne nor
mov al,byte 32
nor:
mov [sourcepath+ecx],al
dec ecx
jns cdestjp
 
cmp [browser],dword 1
jne no_outpath
mov eax,4 ; function 4 : write text to window
mov ebx,10*65536+67 ; [x start] *65536 + [y start]
mov ecx,0x00000000 ;[sc.grab_text] ; color of text RRGGBB
mov edx, copyr_param+1
movzx esi, byte [edx-1]
mov edx,sourcepath ; pointer to text beginning
mov esi,100 ;12*20 ; text length
int 0x40
mov ebx,250*65536+67 ; [x start] *65536 + [y start]
mov ecx,0x00000000 ;[sc.grab_text] ; color of text RRGGBB
mov edx, ebp
mov esi, edi
mov edx,destpath ; pointer to text beginning
mov esi,100 ;12*20 ; text length
int 0x40
no_outpath:
 
; run COPYR
mov eax, 70
mov ebx, copyr_run
mov ebx,copyrfile
mov ecx,sourcepath
mov eax,19
int 0x40
delay 50 ;wait recoed file
jmp update ;still
859,10 → 1064,30
no_clippaste:
 
cmp ah,19 ;Delete from floppy
delete_file:
jne no_delt
delete_file:
; OS now do not support file delete
jmp still
cmp dword [path],'/RD/'
jne no_delt
cmp byte [path+4],'1'
jne no_delt
 
mov eax,[filecursor]
mov ebx,62
mul ebx
mov edi,eax
add edi,convinfo
mov ebp,edi
mov eax,dword [edi]
mov dword [paramtest],eax
mov eax,dword [edi+4]
mov dword [paramtest+4],eax
mov eax,dword [edi+4+4+1]
mov dword [paramtest+4+4],eax
 
mov ebx,paramtest
mov eax,32
int 0x40
jmp update
no_delt:
 
cmp ah,20 ;I - Help
915,30 → 1140,45
je exit
 
;VIEW MENU
cmp ah,40 ;Sort by name
cmp ah,40 ;Sort by name show del
jne no_sn
mov [viewmode], 0
; mov dword [viewmode],0
and dword [viewmode],100b
jmp update
no_sn:
 
cmp ah,41 ;Sort by extension
cmp ah,41 ;Sort by extension show del
jne no_se
mov [viewmode], 1
and dword [viewmode],1101b
or dword [viewmode],0001b
jmp update
no_se:
 
cmp ah,42 ;Sort by size
cmp ah,42 ;Sort by size show del
jne no_ss
mov [viewmode], 2
and dword [viewmode],1110b
or dword [viewmode],0010b
jmp update
no_ss:
 
cmp ah,43 ;Sort by date
cmp ah,43 ;Sort by date show del
jne no_sd
mov [viewmode], 3
or dword [viewmode],0011b
jmp update
no_sd:
 
cmp ah,44 ;Show del files
jne no_ds
or dword [viewmode],0100b
jmp update
no_ds:
 
cmp ah,45 ;Fade del files
jne no_df
and dword [viewmode],11111011b
jmp update
no_df:
 
;HELP MENU
cmp ah,50 ;Help?
je help_scr
946,6 → 1186,20
cmp ah,51 ;Info?
je info_scr
 
cmp ah,83
ja no_hd_part
cmp ah,80
jb no_hd_part
mov ecx,0
sub ah,80
inc ah
mov cl,ah
mov eax,21
mov ebx,8 ;7
int 0x40
 
no_hd_part:
 
cmp ah,1 ; test on exit button
je exit
 
983,7 → 1237,7
jmp screen
 
screen:
cmp [browser], 1 ;it's browser?
cmp [browser],dword 1 ;it's browser?
jne dialogscr
 
mov eax,[procinfo.y_size]
1024,44 → 1278,6
 
jmp still
 
getimgproc:
pushad
mov dword [edx],esi ;xs
mov dword [edx+4],edi ;ys
 
mov ebp,eax
mov eax,dword [ecx] ;getx size
push edx
push ecx
lea ecx,[eax+2*eax]
 
mul ebx
add eax,ebp ;x
mov edx,ecx
lea eax,[eax+2*eax] ;eax=offset on imsrc
 
mov ebp,esi ;xs
mov ebx,edi ;ys
 
pop edi
lea esi,[eax+8+edi]
 
pop edi
add edi,8
 
cld
cyc:
push esi
lea ecx, [ebp+ebp*2]
rep movsb
pop esi
add esi,edx
dec ebx
jne cyc
 
popad
ret
 
;HELP TEXT
help_text:
;0123456789012345678901234567890123456789
1084,10 → 1300,10
 
info_text:
db ' ~~~~~ SYSTEM X-TREE ~~~~~ '
db ' INFO 82 Ver '
db ' INFO 81 Ver '
db ' '
db ' Create by Pavlushin Evgeni '
db 'with ASCL library special for Kolibri OS'
db ' with ASCL libary special for Menuet OS '
db ' www.deck4.narod.ru waptap@mail.ru '
 
 
1125,7 → 1341,7
 
xor eax,eax ; function 0 : define and draw window
 
cmp [browser], 1 ;it's browser
cmp [browser],dword 1 ;it's browser
jne nob1
mov ebx,140*65536+400 ; [x start] *65536 + [x size]
mov ecx,160*65536+280 ; [y start] *65536 + [y size]
1146,40 → 1362,39
 
mov eax,[procinfo.x_size]
cmp eax,66
jg @f
.ret:
jg temp12345
ret
@@:
cmp [procinfo.y_size], 0x70
jl .ret
temp12345:
 
cmp [browser], 1 ;it's browser
cmp [browser],dword 1 ;it's browser
jne nob9
mov [listx],120
; mov eax,[procinfo.x_size]
sub eax,127;[listx]+7
cmp eax,10
jl .ret
mov eax,[procinfo.x_size]
sub eax,[listx]
sub eax,7
mov [listxsize],eax
mov [listy],73
mov eax,[procinfo.y_size]
sub eax,73+7;[listy]+7
sub eax,[listy]
sub eax,7
mov [listysize],eax
jmp isb9
nob9:
mov [listx],10
; mov eax,[procinfo.x_size]
sub eax,17 ;[listx]+7
mov eax,[procinfo.x_size]
sub eax,[listx]
sub eax,7
mov [listxsize],eax
mov [listy],54
mov eax,[procinfo.y_size]
sub eax,54+34;[listy]+34
sub eax,[listy]
sub eax,34
mov [listysize],eax
isb9:
 
 
;Draw only browser components
cmp [browser], 1 ;it's browser
cmp [browser],dword 1 ;it's browser
jne nob2
 
mov eax,[sc.grab_text] ; color of text RRGGBB
1202,8 → 1417,27
dec edi
jnz nexthbut
 
;DRAW PARTITION BUTTONS
mov eax,8
mov ebx,340*65536+5 ;start pos x
mov ecx,24*65536+8 ;start pos y
mov edx,80;+1000000000000000000000000000000b ;spoke butt
mov edi,4 ;draw 13 button's
mov esi,0x00339933
int 0x40
dec edi
nextpbut:
add ebx,6*65536
inc edx
int 0x40
dec edi
jnz nextpbut
 
;DRAW PARTITON TEXT
glabel 341,25,'1234',cl_White;Black
 
;File STRING
glabel 8,25,' FILE VIEW INFO ', cl_White ;Black
glabel 8,25,' FILE VIEW INFO ', ;cl_White ;Black
 
;BlackLine
mov eax,[procinfo.x_size]
1224,12 → 1458,12
setimg 34,88,logoinfimg
glabel 20,165,'SYSTEM X-TREE',cl_Black
add ebx,10
glabel ,,'FOR KolibriOS',
glabel ,,'FOR MENUETOS',
 
add ebx,9*65536+20
glabel ,,'welcome to',cl_Green
add ebx,-15*65536+10
glabel ,,'www.kolibrios.org',cl_Green
glabel ,,'www.menuetos.org',cl_Green
 
; glabel ,,'Create by',cl_Green
; add ebx,10
1255,7 → 1489,7
mov ebx,(8+6*8)*65536+6*12 ;start pos x
mov ecx,35*65536+10 ;start pos y
mov edx,40 ;spoke butt
mov edi,4 ;draw 4 button's
mov edi,6 ;draw 4 button's
mov esi,cl_Grey
call menubutton
no_drawhv:
1275,7 → 1509,7
 
;Draw buttons instruments
mov eax,8
cmp [browser], 1 ;it's browser
cmp [browser],dword 1 ;it's browser
jne nob3
mov ebx,10*65536+16+5 ;start pos x
mov ecx,37*65536+15 ;start pos y
1297,7 → 1531,7
jnz nextbut
 
 
cmp [browser], 1 ;it's browser
cmp [browser],dword 1 ;it's browser
jne nob4
;But img browser
setimg 10,37,butimg
1312,7 → 1546,7
setimg 16,29,butimg
isb4:
 
cmp [browser], 1 ;it's browser
cmp [browser],dword 1 ;it's browser
jne nob5
 
mov [urlx],48
1325,8 → 1559,10
glabel 20,57,"URL:",cl_Black
 
;Out view mode info
movzx edx, [viewmode]
shl edx, 4
mov eax,[viewmode]
mov ebx,16
mul ebx
mov edx,eax
mov eax,4
mov ebx,180*65536+25
mov ecx,cl_Black
1499,10 → 1735,11
shl ebx,16
add ebx,dword [scrollsize]
mov ecx,[listy]
add ecx,scrollbutsize
add ecx,[scrollbutsize]
shl ecx,16
add ecx,[listysize]
sub ecx,scrollbutsize*2
sub ecx,[scrollbutsize]
sub ecx,[scrollbutsize]
mov edx,[scrollcolor] ;0x00006600
int 0x40
 
1513,45 → 1750,32
mov ebx,dword 10
div ebx
 
mov edx,0
mov ebx,eax
cmp ebx,[listsize] ;filelistsize in ebx
jae notusescroll
ja notusescroll
;usescroll
; calculate scroll size
mov eax, [listysize]
sub eax, 2*scrollbutsize
push eax
sub eax,[scrollbutsize]
sub eax,[scrollbutsize]
shl eax,16
div dword [listsize]
mul ebx
div [listsize]
cmp eax, 5
jae @f
mov al, 5
@@:
mov [scroll_height], eax
; calculate scroll pos
sub [esp], eax
mov eax, [listsize]
sub eax, ebx
mov ecx, eax
cmp eax, [filecursor]
jb @f
mov eax, [filecursor]
@@:
mul dword [esp]
div ecx
mov [scroll_pos], eax
pop ecx
; draw
lea ecx, [eax+scrollbutsize]
add ecx, [listy]
shl ecx, 16
mov cx, word [scroll_height]
shr eax,16
mov esi,[mousey]
shl esi,16
add esi,eax
 
mov eax, 13
mov ebx, [listx]
add ebx, [listxsize]
sub ebx, [scrollsize]
shl ebx, 16
mov bx, word [scrollsize]
add ebx,dword [scrollsize]
mov ecx,[listy]
add ecx,[scrollbutsize]
shl ecx,16
add ecx,esi
mov edx, [scrollboxcol]
int 0x40
notusescroll:
1584,7 → 1808,8
add ebx,[scrollsize]
mov ecx,[listy]
shl ecx,16
add ecx,scrollbutsize-1
add ecx,[scrollbutsize]
dec ecx ;correction
mov eax,8
mov edx,6+1000000000000000000000000000000b ;spoke butt
int 0x40
1611,7 → 1836,7
dec ecx ;correction
mov edx,7+1000000000000000000000000000000b ;spoke butt
mov eax,[listysize]
sub eax,scrollbutsize
sub eax,[scrollbutsize]
shl eax,16
add ecx,eax
 
1639,12 → 1864,10
 
; Draw text in file list
 
; mov eax,[listxsize]
; sub eax,40*6 ;leight of string
; shr eax,1
; add eax,[listx]
mov eax, [listx]
add eax, 12+4 ; for icons
mov eax,[listxsize]
sub eax,40*6 ;leight of string
shr eax,1
add eax,[listx]
shl eax,16
add eax,[listy]
add eax,2
1660,7 → 1883,7
 
; OUT FILE DATA
mov eax,[filecursor] ;calc cursor position
mov ebx,27
mov ebx,62
mul ebx
 
;OUT TEXT
1670,133 → 1893,81
add edx,eax
mov ebx,dword [filelistxy]
loo:
cmp dword [edx], -1
jz noout
mov ecx,0x00888888 ;for another file's color white
cmp [edx+15],dword 'FOL ' ;folder yellow
cmp [edx+26],dword 'FOL ' ;folder yellow
jne nb
mov ecx,0x00006666
jmp cset1
nb:
mov eax, [edx]
xor edi, edi
; find extension and set color
@@:
inc eax
cmp byte [eax-1], 0
jz @f
cmp byte [eax-1], '.'
jnz @b
mov edi, eax
jmp @b
@@:
test edi, edi
jz @f
mov edi, [edi]
and edi, not 0x20202020 ; toupper
@@:
mov eax,[edx+8]
;Color set
; text's blue
cmp eax,dword '.TXT' ;text's blue
je itx
cmp eax,dword '.INC'
je itx
cmp eax,dword '.ASM'
je itx
cmp eax,dword '.RTF'
je itx
jmp nt
itx:
mov ecx, 0x00446666
cmp edi, 'TXT'
jz cset
cmp edi, 'INC'
jz cset
cmp edi, 'ASM'
jz cset
cmp edi, 'RTF'
jz cset
; picture's pure
jmp cset
nt:
cmp eax,dword '.BMP' ;picture's pure
je ipic
cmp eax,dword '.JPG'
je ipic
cmp eax,dword '.JPE'
je ipic
cmp eax,dword '.GIF'
je ipic
; //// Willow
cmp eax,dword '.PNG'
je ipic
; //// Willow
cmp eax,dword '.WAV'
je ipic
cmp eax,dword '.MID'
je ipic
jmp np
ipic:
mov ecx, 0x00226688
cmp edi, 'BMP'
jz cset
cmp edi, 'JPG'
jz cset
cmp edi, 'JPEG'
jz cset
cmp edi, 'GIF'
jz cset
cmp edi, 'PNG'
jz cset
cmp edi, 'WAV'
jz cset
cmp edi, 'MID'
jz cset
; execute's green
jmp cset
np:
cmp eax,dword '. ' ;execute's green
jne nexec
mov ecx, 0x00008866
test edi, edi
jz cset
; for another file's color white
mov ecx, 0x00888888
jmp cset
nexec:
cset:
 
cset1:
push edx
mov edx,[edx]
push ebx edx
mov eax, [listxsize]
sub eax, [scrollsize]
sub eax, 12+4
xor edx, edx
mov ebx, 6
div ebx
pop edx ebx
sub eax, 25
xor esi, esi
@@:
cmp byte [edx+esi], 0
jz @f
inc esi
cmp esi, eax
jbe @b
dec esi
@@:
push eax
mov esi,40 ;symbols out 62 ;32
mov eax,4
int 0x40
cmp byte [edx+esi], 0
jz @f
pushad
mov edx, more_char
mov eax, esi
imul eax, 6*65536
add ebx, eax
mov esi, 1
mov eax, 4
int 0x40
popad
@@:
pop eax
pop edx
push ebx edx
inc eax
imul eax, 6*65536
add ebx, eax
add edx,4
mov esi,23
mov eax,4
int 0x40
pop edx ebx
; popad
 
pushad
cmp [edx+15],dword 'Fvol' ;volume label
; pushad
cmp [edx+26],dword 'Fvol' ;volume label
jne no_volico
push hdico+8
jmp out_ico
no_volico:
cmp [edx+15],dword 'FOL '
cmp [edx+26],dword 'FOL '
jne no_folico
cmp [edx+4],dword 'HARD'
cmp [edx+9],dword 'HARD'
jne no_hdico
push hdico+8
jmp out_ico
no_hdico:
cmp [edx+4],dword 'RAMD'
cmp [edx+9],dword 'RAMD'
jne no_rdico
push rdico+8
jmp out_ico
no_rdico:
cmp [edx+4],dword 'FLOP'
cmp [edx+9],dword 'FLOP'
jne no_fdico
push rdico+8
jmp out_ico
1804,21 → 1975,21
push folico+8
jmp out_ico
no_folico:
cmp edi,dword 'BMP'
cmp [edx+8],dword '.BMP'
je is_imgico
cmp edi,dword 'JPG'
cmp [edx+8],dword '.JPG'
je is_imgico
cmp edi,dword 'JPEG'
cmp [edx+8],dword '.JPE'
je is_imgico
cmp edi,dword 'GIF'
cmp [edx+8],dword '.GIF'
je is_imgico
; //// Willow
cmp edi,dword 'PNG'
cmp [edx+8],dword '.PNG'
je is_imgico
; //// Willow
cmp edi,dword 'WAV'
cmp [edx+8],dword '.WAV'
je is_imgico
cmp edi,dword 'MID'
cmp [edx+8],dword '.MID'
je is_imgico
jmp no_imgico
is_imgico:
1825,9 → 1996,9
push imgico+8
jmp out_ico
no_imgico:
cmp edi,dword 'ASM'
cmp [edx+8],dword '.ASM'
je is_asmincico
cmp edi,dword 'INC'
cmp [edx+8],dword '.INC'
je is_asmincico
jmp no_asmincico
is_asmincico:
1834,25 → 2005,25
push asmincico+8
jmp out_ico
no_asmincico:
cmp edi,dword 'RTF'
cmp [edx+8],dword '.RTF'
je @f
cmp edi,dword 'TXT'
cmp [edx+8],dword '.TXT'
jne no_txtico
@@:
push txtico+8
jmp out_ico
no_txtico:
test edi,edi
cmp [edx+8],dword '. '
jne no_execico
push execico+8
jmp out_ico
no_execico:
cmp [edx+15],dword 'DAT '
cmp [edx+26],dword 'DAT '
jne no_datico
push datico+8
jmp out_ico
no_datico:
cmp [edx+15],dword 'DEL '
cmp [edx+26],dword 'DEL '
jne no_out_ico
push delico+8
jmp out_ico
1871,10 → 2042,11
 
add ebx,10
noout:
add edx,27
add edx,62
 
dec [filelistsize]
jz extloo
cmp [filelistsize],dword 0
je extloo
 
dec ebp
jnz loo
1883,7 → 2055,7
 
extloo:
 
cmp [browser], 1 ;it's browser
cmp [browser],dword 1 ;it's browser
jne nob8
 
;Draw text for head->file buttons
1914,10 → 2086,10
;Draw text for head->view buttons
cmp [drawhv],1
jne no_drawhvtext
drawfbox (8+6*8),35,(6*12)+1,(11*4),0x00000000
drawfbox (9+6*8),36,(6*12)-1,(11*4)-2,0x00ffffff
drawfbox (8+6*8),35,(6*12)+1,(11*6),0x00000000
drawfbox (9+6*8),36,(6*12)-1,(11*6)-2,0x00ffffff
 
mov edi,4
mov edi,6 ;4
mov ebx,(9+6*8)*65536+37
mov ecx,cl_Black
mov edx,view_text_label
1929,6 → 2101,8
db ' Ext. sort '
db ' Size sort '
db ' Date sort '
db ' Show DEL '
db ' Fade DEL '
 
no_drawhvtext:
 
1979,7 → 2153,8
scrollcolor dd 0x778877
scrollboxcol dd 0x335533
scrollbutcol dd 0x224422
scrollbutsize = 9
scrollbutsize dd 9
usescroll dd 1
 
;URL LINE PARAMETRS
 
2016,35 → 2191,74
 
read_directory:
 
; STEP 0 SEt TYPE OF SORT
 
mov eax,[viewmode]
;with no show del files
and eax,0FFFFFFFBh
cmp eax,0
jnz no_sort_by_name
mov [start],0
mov [x0],12
mov [x1],99
mov [x2],99
mov [x3],99
jmp sortset
 
no_sort_by_name:
dec eax
jnz no_sort_by_ext
mov [start],9
mov [x0],9
mov [x1],99
mov [x2],99
mov [x3],12
jmp sortset
 
no_sort_by_ext:
dec eax
jnz no_sort_by_size
mov [start],30
mov [x0],12
mov [x1],99
mov [x2],99
mov [x3],38
jmp sortset
 
no_sort_by_size:
dec eax
mov [start],21
mov [x0],12
mov [x1],17
mov [x2],20
mov [x3],26
jmp sortset ;sort by date
 
;SORT VARILE
start dd 0
x0 dd 0
x1 dd 0
x2 dd 0
x3 dd 0
 
sortset:
 
;STEP 1 CLEAR CONVINFO
mov edi,convinfo
mov al,255
mov ecx,4096*27
mov ecx,4096*62 ;512
cld
push edi
rep stosb
pop edi
 
;STEP 2 TEST ON HD OR PARTITION
cmp [path],byte '/'
je nstep
; copy info on RD and FD
mov esi, hdimg
mov ecx, 2*27
rep movsb
; hard disks
mov eax, 4
.1:
mov ecx, 27
cmp dword [esi], 0
jz .2
rep movsb
jmp .3
.2:
add esi, ecx
.3:
dec eax
jnz .1
mov ecx,61+62*5
loxhd:
mov al,[hdimg+ecx]
mov [convinfo+ecx],al
dec ecx
jns loxhd
mov [listsize], 0
ret
nstep:
2054,66 → 2268,88
je nstep2
cmp [path+1],word 'RD'
jne nostep_RD
mov ecx,1
mov ecx,61
jmp loxpt
nostep_RD:
cmp [path+1],word 'FD'
jne nostep_FD
mov ecx,2
mov ecx,61+62
jmp loxpt
nostep_FD:
cmp [path+1],dword 'HD0'
jne nostep_HD0
movzx ecx,byte [table_area+2]
mov cl,[table_area+2]
movzx ecx,cl
imul ecx,62
dec ecx
jmp loxpt
nostep_HD0:
cmp [path+1],dword 'HD1'
jne nostep_HD1
movzx ecx,byte [table_area+3]
mov cl,[table_area+3]
movzx ecx,cl
imul ecx,62
dec ecx
jmp loxpt
nostep_HD1:
cmp [path+1],dword 'HD2'
jne nostep_HD2
movzx ecx,byte [table_area+4]
mov cl,[table_area+4]
movzx ecx,cl
imul ecx,62
dec ecx
jmp loxpt
nostep_HD2:
cmp [path+1],dword 'HD3'
jne nostep_HD3
movzx ecx,byte [table_area+5]
mov cl,[table_area+5]
movzx ecx,cl
imul ecx,62
dec ecx
jmp loxpt
nostep_HD3:
 
mov ecx,2
mov ecx,61+62 ;+496
 
loxpt:
cmp ecx, 20
jbe @f
mov ecx, 20
@@:
mov eax, a1
mov esi, ptimg
@@:
stosd
add eax, 3
push ecx esi
mov ecx, 23
rep movsb
pop esi ecx
loop @b
mov al,[ptimg+ecx]
mov [convinfo+ecx],al
dec ecx
jns loxpt
mov [listsize],0
ret
nstep2:
 
;STEP 3 was deleted
;STEP 3 CLEAR OUTINFO
mov edi,outinfo ;0x14000 ;0x20000
xor eax,eax
mov ecx,4096*32 ;512
cld
rep stosb
 
;STEP 4 READ DATA FROM HD
mov dword [farea],outinfo
mov dword [readblock],0
 
loorhd:
mov eax,70
mov eax,[readblock]
mov [fileinfoblock+4],eax
mov eax,58
mov ebx,fileinfoblock
int 0x40
cmp eax,0
jne hd_err
add dword [farea],512
inc dword [readblock]
cmp dword [readblock],4096/16
jna loorhd
 
cmp eax,6
hd_err:
mov ebx,dword [readblock]
shl ebx,4
mov dword [blocksread],ebx ; for quick resorting
 
cmp eax,5
je end_of_dir
 
; It's erorr's test is poor code
2125,63 → 2361,103
no_inv_part:
cmp eax,3
jne no_unk_fs
glabel 10,10,'Unknown file system',cl_Red+font_Big
glabel 10,10,'Unknow file system',cl_Red+font_Big
jmp end_of_dir
no_unk_fs:
 
end_of_dir:
; -1 -> 0
cmp ebx, -1
sbb ebx, -1
mov [dirlen],ebx
 
; command successful
; command succesful
 
mov esi, outinfo+32
and [listsize], 0
test ebx, ebx
jz nofiles
mov esi,outinfo ;data_area+1024
; mov edi,fileinfo+11
mov edx,0 ;4096 ;16
 
newlineb:
push ebx
 
mov edi, fileinfo
push edi
mov al, ' '
mov ecx, 27
mov edi,fileinfo+11
 
pushad ; clear
mov al,32
mov ecx,58
sub edi,11
cld
rep stosb
pop edi
push esi
add esi, 40
mov [edi], esi
pop esi
popad
 
mov eax, 'DAT ' ; data or ... ?
mov cl, [esi]
test cl, 0x10
jz @f
mov cl,[esi] ; end of entries ?
cmp cl,6
jnz noib0
 
mov [edi+26],dword 'EOE '
add esi,32
; add edi,62
jmp inf
 
noib0:
 
mov cl,[esi+0]
cmp cl,0xe5
je yesdelfil
 
mov cl,[esi+11] ; long fat32 name ?
cmp cl,0xf
jnz noib1
 
mov [edi+26],dword 'F32 '
add esi,32
; add edi,62
jmp inf
 
noib1:
 
mov eax,'DAT ' ; data or .. ?
 
mov cl,[esi+0] ; deleted file
cmp cl,0xe5
je yesdelfil
cmp cl,0x0
je yesdelfil
jmp nodelfil
yesdelfil:
mov eax,'DEL '
jmp ffile
 
nodelfil:
 
mov cl,[esi+11] ; folder
and cl,0x10
jz ffile
mov eax, 'FOL '
mov [edi+15], eax
mov [edi+26],eax
jmp nosize
@@:
test cl, 8
ffile:
 
; Asko patch for v79
mov cl,[esi+11] ; fold
and cl,0xf
cmp cl,0xf ; skip long filename
jz novol
test cl,0x8 ; is it fold label?
jz novol ; no
mov eax, 'Fvol'
mov [edi+15], eax
mov [edi+26],eax
jmp nosize
novol:
mov [edi+15], eax
 
; size
mov eax, [esi+32]
push esi
lea esi, [edi+26]
mov [edi+26],eax
 
pusha ; size
mov eax,[esi+28]
mov esi,edi
add esi,37
mov ebx, 10
mov ecx, 8
newnum:
xor edx, edx
div ebx
add dl, '0'
add dl,48
mov [esi], dl
test eax, eax
jz zernum
2188,219 → 2464,239
dec esi
loop newnum
zernum:
pop esi
popa
nosize:
 
; date
mov dword [edi+6], '. .'
; year
movzx eax, word [esi+28+2]
pusha ; date
mov [edi+17],dword '. .'
 
movzx eax,word [esi+24]
shr eax,9 ; year
add eax,1980
mov ecx, 4
newdel1:
dec ecx
xor edx, edx
mov ebx, 10
div ebx
add edx, '0'
mov [edi+ecx+9], dl
loop newdel1
; month
movzx eax, byte [esi+28+1]
add edx,48
mov [edi+ecx+21],dl
test ecx,ecx
jnz newdel1
 
movzx eax,word [esi+24]
shr eax,5 ; month
and eax,0x0f
mov ecx,2
newdel2:
dec ecx
xor edx, edx
mov ebx,10
div ebx
add al, '0'
add dl, '0'
mov [edi+7], al
mov [edi+8], dl
; day
movzx eax, byte [esi+28]
add edx,48
mov [edi+ecx+18],dl
test ecx,ecx
jnz newdel2
 
movzx eax,word [esi+24]
and eax,0x1f ; day
mov ecx,2
newdel3:
dec ecx
xor edx, edx
mov ebx,10
div ebx
add al, '0'
add dl, '0'
mov [edi+4], al
mov [edi+5], dl
add edx,48
mov [edi+ecx+15],dl
test ecx,ecx
jnz newdel3
 
popa
 
 
pusha ; number
mov eax,edx
sub eax,4096
neg eax
 
xor edx,edx
mov ebx,10
div ebx
add dl,48
mov [edi+43],dl ;0001
xor edx,edx
div ebx
add dl,48
mov [edi+42],dl ;0010
xor edx,edx
div ebx
add al,48
add dl,48
mov [edi+41],dl ;0100
mov [edi+40],byte 0 ;1000
popa
 
mov ecx,8 ; first 8
cld
rep movsb
mov [edi],byte '.'
inc edi
mov ecx,3 ; last 3
cld
rep movsb
 
add esi,(32-11)
; add edi,(60-12+2)
 
inf:
 
pushad
 
;STEP 5 Test on WRITE OR NOTWRITE
cmp word [esi+40], '.'
jz nextfl
cmp word [esi+40], '..'
jnz @f
cmp byte [esi+42], 0
jz nextfl
@@:
mov edx,fileinfo+11
looo:
 
; STEP 6 SORT ALGORYTHM
; Delete del, eoe, f32 and another head-names
cmp [viewmode],3 ;0-3 no outdel
ja del_out
cmp [edx+26],dword 'DEL '
je nextfl
del_out:
cmp [edx+26],dword 'DEL '
jne no_del
cmp [edx],dword 0 ;431 ;435 ;484 +10% speed
je nextfl
no_del:
cmp [edx+26],dword 'EOE '
je nextfl
cmp [edx+26],dword 'F32 ' ;F32 not useles
je nextfl
cmp [edx],dword '. '
je nextfl
cmp [edx],dword '.. '
je nextfl
cmp [edx],dword 'FIRS'
je nextfl
 
push esi
xor esi, esi
; ---------_______-------_______ --------_________-----------
; SORT by name and del deletet files or f32 headers from list
; _________-------_______ --------_______---------___________
 
; At first Fold after Dat
; STEP 6 UNIVERSAL SORT ALGORYTHM
 
xxx:
mov esi,0 ;[tekfilename] ;0
mov ebx,[start] ; 0
 
; At first Fold after Dat and Del
 
ftestname:
cmp dword [convinfo+esi], -1
jz writefile
cmp byte [fileinfo+15],'F'
cmp byte [fileinfo+11+26],'F'
je F
cmp byte [fileinfo+15],'D'
jne add_element
D: cmp byte [convinfo+esi+15],'D'
cmp byte [fileinfo+11+26],'D'
je D
jmp add_element
D: cmp byte [convinfo+esi+26],'D'
je add_element
cmp byte [convinfo+esi+15],'F'
cmp byte [convinfo+esi+26],'F'
je skipfile
jmp add_element
F: cmp byte [convinfo+esi+15],'D'
F: cmp byte [convinfo+esi+26],'D'
je writenow
; cmp byte [convinfo+esi+15],'F'
; cmp byte [convinfo+esi+26],'F'
; je add_element
; jmp add_element
 
add_element:
; compare items
movzx eax, [viewmode]
call [compare+eax*4]
mov al,[fileinfo+ebx+11]
cmp al,[convinfo+esi+ebx]
je equal
jb writenow
skipfile:
add esi,27
add esi,62
mov ebx,[start] ;0
jmp ftestname
 
equal:
inc ebx
cmp ebx,[x0]
je writefile
cmp ebx,[x1]
je x1p
cmp ebx,[x2]
je x2p
cmp ebx,[x3]
jae x3p
jmp add_element
 
x1p:
mov ebx,18
jmp add_element
x2p:
mov ebx,15
jmp add_element
x3p:
mov ebx,0
jmp add_element
 
writenow:
mov ecx,4096*27-1
mov ecx,4096*62
sub ecx,esi
ldloop:
mov al,[convinfo+ecx+esi]
mov [convinfo+ecx+esi+27],al
mov [convinfo+ecx+esi+62],al
dec ecx
jns ldloop
 
 
writefile:
mov ecx,26
mov ecx,61
wfloop:
mov al,[fileinfo+ecx]
mov al,[fileinfo+ecx+11]
mov [convinfo+ecx+esi],al
dec ecx
jns wfloop
inc [listsize]
pop esi
 
nextfile:
 
nextfl:
add esi, 304
pop ebx
dec ebx
jnz newlineb
; popad
; pushad
mov eax,edx
shl eax,26
cmp eax,0
jne no_outcnt
push edx
drawfbox 294,25,(4*6),10,cl_White
pop ebp
outcount ebp,294,25,cl_Black,4*65536
no_outcnt:
popad
 
nofiles:
ret
inc edx
cmp edx,4096
jnae newlineb
 
toupper:
cmp al, 'a'
jb .ret
cmp al, 'z'
ja @f
.sub20:
sub al, 0x20
.ret:
ret
@@:
cmp al, 0xA0
jb .ret
cmp al, 0xB0
jb .sub20
cmp al, 0xE0
jb .ret
cmp al, 0xF0
jae @f
sub al, 0xE0-0x90
ret
@@:
cmp al, 0xF1
jnz .ret
dec eax
ret
 
compare_date:
pushad
mov al, [fileinfo+10]
cmp al, [convinfo+esi+10]
jnz .ret
mov al, [fileinfo+11]
cmp al, [convinfo+esi+11]
jnz .ret
mov al, [fileinfo+12]
cmp al, [convinfo+esi+12]
jnz .ret
mov al, [fileinfo+13]
cmp al, [convinfo+esi+13]
jnz .ret
mov al, [fileinfo+7]
cmp al, [convinfo+esi+7]
jnz .ret
mov al, [fileinfo+8]
cmp al, [convinfo+esi+8]
jnz .ret
mov al, [fileinfo+4]
cmp al, [convinfo+esi+4]
jnz .ret
mov al, [fileinfo+5]
cmp al, [convinfo+esi+5]
jz compare_name.1
.ret:
popad
;STEP 8 GET SIZE OF RESORTING LIST
mov ecx,0
mov edi,0
mov eax,[blocksread]
mov ebx,62
mul ebx
mov edx,eax
loogs:
mov eax,dword [convinfo+edi+26]
cmp eax,dword 0xffffffff
je endgs
add edi,62
inc ecx
cmp edi,edx ;4096*62
jnae loogs
endgs:
mov [listsize],ecx
ret
compare_name:
pushad
.1:
mov edi, dword [convinfo+esi]
mov esi, dword [fileinfo]
call strcmpi
popad
ret
compare_ext:
pushad
mov esi, dword [convinfo+esi]
mov edi, dword [fileinfo]
call find_ext
xchg esi, edi
call find_ext
call strcmpi
popad
jz compare_name
ret
compare_size:
pushad
lea edi, [convinfo+esi+19]
lea esi, [fileinfo+19]
mov ecx, 8
repz cmpsb
popad
jz compare_name
ret
 
strcmpi:
lodsb
call toupper
push eax
mov al, [edi]
inc edi
call toupper
cmp [esp], al
pop eax
jnz @f
test al, al
jnz strcmpi
@@:
ret
 
find_ext:
lodsb
test al, al
jz .noext
cmp al, '.'
jnz find_ext
ret
.noext:
dec esi
ret
 
;******************************************************************************
 
; DATA AREA
2409,8 → 2705,10
drawhf dd 0 ;draw file menu?
drawhv dd 0 ;draw view menu?
drawhi dd 0 ;draw info menu?
browser dd 0 ;0-dialog, 1-browser
cursor dd 0 ;cursor in prompt line
focus dd 0 ;prompt edit or window?
viewmode dd 0 ;folder sort & not del
downstop dd 0
filecursor dd 0
mousex dd 0
2420,55 → 2718,40
temp dd 0
readblock dd 1
dlg_type db 0 ;S-save O-open
browser db 0 ;0-dialog, 1-browser
viewmode db 0 ;folder sort
 
compare dd compare_name
dd compare_ext
dd compare_size
dd compare_date
hdimg1 db 'HD0 HARDDISK FOL '
hdimg2 db 'HD1 HARDDISK FOL '
hdimg3 db 'HD2 HARDDISK FOL '
hdimg4 db 'HD3 HARDDISK FOL '
 
aRD db 'RD',0
aFD db 'FD',0
aHD0 db 'HD0',0
aHD1 db 'HD1',0
aHD2 db 'HD2',0
aHD3 db 'HD3',0
a1 db '1',0,0
a2 db '2',0,0
a3 db '3',0,0
a4 db '4',0,0
a5 db '5',0,0
a6 db '6',0,0
a7 db '7',0,0
a8 db '8',0,0
a9 db '9',0,0
a10 db '10',0
a11 db '11',0
a12 db '12',0
a13 db '13',0
a14 db '14',0
a15 db '15',0
a16 db '16',0
a17 db '17',0
a18 db '18',0
a19 db '19',0
a20 db '20',0
;01234567890123456789012345678901234567890123456789012345678912
hdimg db 'RD RAMDISK FOL '
db 'FD FLOPPYDISK FOL '
db ' '
db ' '
db ' '
db ' '
 
hdimg:
dd aRD
db 'RAMDISK FOL '
dd aFD
db 'FLOPPYDISK FOL '
hdimg1 dd 0
db 'HARDDISK FOL '
hdimg2 dd 0
db 'HARDDISK FOL '
hdimg3 dd 0
db 'HARDDISK FOL '
hdimg4 dd 0
db 'HARDDISK FOL '
ptimg db 'PARTITION FOL '
ptimg db '1 FIRST PARTITION FOL '
db '2 SECOND PARTITION FOL '
db '3 NEXT PARTITION FOL '
db '4 NEXT PARTITION FOL '
db '5 NEXT PARTITION FOL '
db '6 NEXT PARTITION FOL '
db '7 NEXT PARTITION FOL '
db '8 NEXT PARTITION FOL '
db '9 NEXT PARTITION FOL '
db '10 NEXT PARTITION FOL '
db '11 NEXT PARTITION FOL '
db '12 NEXT PARTITION FOL '
db '13 NEXT PARTITION FOL '
db '14 NEXT PARTITION FOL '
db '15 NEXT PARTITION FOL '
db '16 NEXT PARTITION FOL '
db '17 NEXT PARTITION FOL '
db '18 NEXT PARTITION FOL '
db '19 NEXT PARTITION FOL '
db '20 NEXT PARTITION FOL '
 
modetext:
;0123456789012345
2495,53 → 2778,36
; //// Willow
 
;Name of programs
editor db '/RD/1/TINYPAD',0
bmpview db '/RD/1/MV',0
jpgview db '/RD/1/JPEGVIEW',0
gifview db '/RD/1/GIFVIEW',0
ac97wav db '/RD/1/AC97WAV',0
rtfread db '/RD/1/RTFREAD',0
editor db 'TINYPAD '
bmpview db 'MV '
jpgview db 'JPEGVIEW '
gifview db 'GIFVIEW '
ac97wav db 'AC97WAV '
copyrfile db 'COPYR '
rtfread db 'RTFREAD '
; //// Willow
pngview db '/RD/1/@RCHER',0
pngview db '@RCHER '
; //// Willow
midamp db '/RD/1/MIDAMP',0
midamp db 'MIDAMP '
 
more_char db 10h
 
fileinfo_start:
dd 7
dd 16
dd 0
fileinfo_params:
dd 0 ;tempzone+1000;
dd 0
dd 0
dd 0
db 0
fileinfo_name:
dd 0
dd tempzone ;0x10000
open_path:
times 256 db 0 ;run app path
 
clipfile_info:
dd ?
dd 0
dd 0
dd ?
dd paramtest
db '/RD/1/CLIPFILE.TXT',0
copyr_run:
dd 7
dd 0
dd copyr_param
dd 0
dd 0
db '/RD/1/COPYR',0
 
fileinfoblock:
dd 0x1 ; read folder
dd 0x0 ; read
dd 0x0 ; first block
dd 0x0 ; flags (ANSI names)
dd 4095 ; number of blocks to read
dd 0x1 ; number of blocks to read
farea:
dd outinfo ; ret offset
dd tempzone ; work size of sytemram
path:
times 1024 db 0 ;path
times 256 db 0 ;path
 
table_area:
rb 10
2549,12 → 2815,6
;rb 256
but_file:
file 'systr12.GIF'
 
I_END:
 
scroll_height dd ?
scroll_pos dd ?
 
butimg:
rb 400*16*3+8 ;buttons (left pice of picture)
logoimg:
2592,16 → 2852,23
 
gif_hash:
rd 4096
tempzone: ;temp zone for 58 function
rb 4000
 
sourcepath rb 100
destpath rb 100
 
MYPID:
rd 8
 
I_END:
 
param_area:
rb 256
paramtest:
rb 1024
rb 256
filedir:
rb 1024
rb 256
 
procinfo process_information
sc system_colors
2609,14 → 2876,10
fileinfo:
rb 200 ;4096*62+1024
 
copyr_param rb 256
 
outinfo:
rb 32+4096*304
rb 4096*34+1024
 
convinfo:
rb 4096*27
; stack
align 4
rb 1024
rb 4096*62+1024
 
RAM_END:
/programs/fs/copyr/trunk/ascl.inc
1,3 → 1,5
lang equ ru ; ru en fr ge fi
 
;
; Assembler
; SMALL
/programs/fs/copyr/trunk/copyr.asm
19,7 → 19,7
dd 0x01 ; header version
dd START ; start of code
dd I_END ; size of image
dd 0x10000 ; memory for app
dd 0x20000 ; memory for app
dd 0x10000 ; esp
dd param_area , 0x0 ; I_Param , I_Icon
 
27,31 → 27,50
include 'macros.inc' ; very useful stuff for MeOS
include 'ascl.inc'
 
STRLEN = 48 ; maximal length of filename
 
 
START: ; start of execution
 
;  à ¬¥âàë:
; db n1 = ¤«¨­  ¯ã⨠ª ¨áâ®ç­¨ªã
; times n1 db ? = ¯ãâì ª ¨áâ®ç­¨ªã
; db n2 = ¤«¨­  ¯ã⨠ª ¯à¨ñ¬­¨ªã
; times n2 db ? = ¯ãâì ª ¯à¨ñ¬­¨ªã
; db 0
 
; ®â 0 ¤® 100 ¯ãâì ª ¨áâ®ç­¨ªã
; ®â 100 ¤® 200 ¯ãâì ª ¯à¨¥¬­¨ªã
;
;get param
mov eax, 15
lea esi, [param_area+1]
movzx ecx, byte [esi-1]
jecxz err_exit
mov edi, source
rep movsb
mov byte [edi], 0
inc eax
movzx ecx, byte [esi]
inc esi
jecxz err_exit
mov edi, destination
rep movsb
mov byte [edi], 0
cmp byte [param_area],0
je err_exit ;source not found
mov eax,16
cmp byte [param_area+100],0
je err_exit ;dest not found
 
mov ecx,199
cdf:
mov al,[param_area+ecx]
cmp al,byte 32
jne nor
mov al,byte 0
nor:
mov al,[param_area+ecx]
dec ecx
jns cdf
 
mov ecx,STRLEN - 4
copysp:
mov al,[param_area+ecx]
mov [source+ecx],al
dec ecx
jns copysp
mov [source+42],byte 0
 
mov ecx,STRLEN - 4
copydp:
mov al,[param_area+ecx+100]
mov [destination+ecx],al
dec ecx
jns copydp
mov [destination+42],byte 0
 
call draw_window
call copy_file
 
71,16 → 90,19
push eax
call draw_window
pop eax
; jmp copy_error
jmp copy_error
 
; print message now
copy_error:
imul ebp, eax, 43
mov ebp,43
mul ebp
mov ebp,eax
 
mov eax,4
mov ebx,20*65536+70
mov ecx,0x10ff0000
lea edx,[errors+ebp]
mov edx,errors ;*8]
add edx,ebp
mov esi,43 ;[errors+edi*8+4]
int 0x40
jmp dexit
100,9 → 122,9
;====================================================
copy_file:
; at first we must get the size of the source file
mov dword [source_attr+32], 0
mov eax, 70
mov ebx, source_attr_info
mov [source_info.blocks],1 ; load only 512 bytes
mov eax,58
mov ebx,source_info
int 0x40
 
; now eax contains error code
119,9 → 141,9
.ok_getsize:
 
; allocate memory
mov ebx,[source_attr+32]
push ebx ; save file size
lea ecx,[ebx+0x10000] ; size of memory needed = 0x10000+filesize
mov ecx,ebx
add ecx,0x20000 ; size of memory needed = 0x20000+filesize
mov eax,64 ; func 64
mov ebx,1 ; resize application memory
int 0x40
135,16 → 157,18
.ok_memory:
 
; save number of blocks to source_info
mov [source_info.bytes], ebx
shr ebx,9 ; divide by 512
inc ebx ; blocks++
mov [source_info.blocks],ebx
; read the source file
mov eax,70
mov eax,58
mov ebx,source_info
int 0x40
 
; ebx = number of read bytes = file size
; ebx = file size
; save loaded file
mov [dest_info.bytes],ebx ; file size in bytes
mov eax,70
mov [dest_info.bytes2write],ebx ; file size in bytes
mov eax,58
mov ebx,dest_info
int 0x40
 
161,13 → 185,32
; return to the initial amount of memory
mov eax,64
mov ebx,1
mov ecx,0x10000
mov ecx,0x20000
int 0x40
 
xor eax,eax ; eax = message number (0-OK)
jmp copy_error
 
; print strings (source & destination)
print_text:
mov eax,13
mov ebx,107*65536+STRLEN*6
mov ecx,[ya]
shl ecx,16
add ecx,9
mov edx,0xf2f2f2
int 0x40
 
mov eax,4
mov ebx,109*65536
add ebx,[ya]
xor ecx,ecx
mov edx,[addr]
mov esi,STRLEN
int 0x40
 
ret
 
 
; *********************************************
; ******* WINDOW DEFINITIONS AND DRAW ********
; *********************************************
208,23 → 251,23
 
mov esi,source
mov edi,text+14
mov ecx,47
mov ecx,STRLEN
rep movsb
 
mov esi,destination
mov edi,text+62+14
mov ecx,47
mov edi,text+STRLEN+59-45+14
mov ecx,STRLEN
rep movsb
 
mov ebx,25*65536+36 ; print filenames
xor ecx,ecx
mov edx,text
mov esi,62
mov esi,STRLEN+59-45
newline:
mov eax,4
int 0x40
add ebx,16
add edx,62
add edx,STRLEN+59-45
cmp [edx],byte 'x'
jnz newline
 
236,13 → 279,36
 
 
; DATA AREA
align 4
 
param_area:
times 256 db 0
 
source_info: ; SOURCE FILEINFO
.mode dd 0 ; read file
.start_block dd 0x0 ; block to read
.blocks dd 0x700 ; num of blocks
.address dd 0x20000
.workarea dd 0x10000
source:
times (STRLEN) db 32
db 0
 
dest_info: ; DESTINATION FILEINFO
.mode dd 1 ; write
.notused dd 0x0 ; not used
.bytes2write dd 0 ; bytes to write
.address dd 0x20000
.workarea dd 0x10000
destination:
times (STRLEN) db 32
db 0
 
align 4
addr dd 0x0
ya dd 0x0
temp dd 0
 
if lang eq ru
text:
db ' Ž’Š“„€: |®áá¨ï, ‘¥«ï⨭®, ŒŠ Œ®áª¢  , 1 Šãàá '
db ' Š“„€: |  ¢«î設 …¢£¥­¨©, waptap@mail.ru '
249,7 → 315,7
db ' '
db 'x' ; <- END MARKER, DONT DELETE
labelt:
db 'ŠŽˆŽ‚€ˆ… ”€‰‹€'
db 'ŠŽˆŽ‚€ˆ… ”€‰‹€'
labellen:
 
errors:
270,70 → 336,6
db "(§ ¯¨áì) ­¥¨§¢¥áâ­ ï ®è¨¡ª  "
db "ãâì ª ¨áâ®ç­¨ªã ¨ ¯à¨¥¬­¨ªã ­¥ 㪠§ ­ë!!! "
db "ãâì ª ¯à¨¥¬­¨ªã ­¥ 㪠§ ­!!! "
else
text:
db 'SOURCE: | '
db 'DESTINATION: | '
db ' '
db 'x' ; <- END MARKER, DONT DELETE
labelt:
db 'SYSTREE FILE COPIER'
labellen:
 
errors:
db "Success! "
db "(read) no hd base or partition defined "
db "(read) unsupported file system "
db "(read) unknown file system "
db "(read) hd partition not defined "
db "out of memory "
db "(read) end of file "
db "(read) unknown error "
db "(write) no hd base or partition defined "
db "(write) unsupported file system "
db "(write) unknown file system "
db "(write) hd partition not defined "
db "oh shit! "
db "(write) file not found "
db "(write) unknown error "
db "Path to source is not given!!! "
db "Path to destination is not given!!! "
end if
 
;0123456789012345678901234567890123456789012
 
source_attr_info:
dd 5
dd 0
dd 0
dd 0
dd source_attr
db 0
dd source
 
source_info:
dd 0
dd 0 ; start from 1st byte
dd 0
.bytes dd ?
dd 0x10000
db 0
dd source
 
dest_info: ; DESTINATION FILEINFO
dd 2
dd 0
dd 0
.bytes dd ?
dd 0x10000
 
I_END:
 
destination:
rb 256
source:
rb 256
source_attr:
rb 40
 
param_area rb 256
I_END: