Rev 1304 | Rev 1378 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 1304 | Rev 1305 | ||
---|---|---|---|
Line 3... | Line 3... | ||
3 | ;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;; |
3 | ;; Copyright (C) KolibriOS team 2004-2009. All rights reserved. ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
4 | ;; Distributed under terms of the GNU General Public License ;; |
5 | ;; ;; |
5 | ;; ;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
6 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
Line 7... | Line 7... | ||
7 | 7 | ||
Line 8... | Line 8... | ||
8 | $Revision: 1304 $ |
8 | $Revision: 1305 $ |
9 | 9 | ||
Line 969... | Line 969... | ||
969 | sys_current_directory: |
969 | sys_current_directory: |
970 | ; mov esi, [current_slot] |
970 | ; mov esi, [current_slot] |
971 | ; mov esi, [esi+APPDATA.cur_dir] |
971 | ; mov esi, [esi+APPDATA.cur_dir] |
972 | ; mov edx, esi |
972 | ; mov edx, esi |
Line 973... | Line 973... | ||
973 | 973 | ||
974 | ;get lenght string of appdata.cur_dir |
974 | ;get length string of appdata.cur_dir |
975 | ; mov eax, [current_slot] |
975 | mov eax, [current_slot] |
Line 976... | Line 976... | ||
976 | ; mov edi, [eax+APPDATA.cur_dir] |
976 | mov edi, [eax+APPDATA.cur_dir] |
977 | 977 | ||
978 | dec ebx |
978 | dec ebx |
979 | jz .set |
979 | jz .set |
980 | dec ebx |
980 | dec ebx |
981 | jz .get |
981 | jz .get |
982 | ret |
982 | ret |
983 | .get: |
983 | .get: |
984 | ; sysfunction 30.2: [for app] eax=30,ebx=2,ecx->buffer,edx=len |
984 | ; sysfunction 30.2: [for app] eax=30,ebx=2,ecx->buffer,edx=len |
985 | ; for our code: ebx->buffer,ecx=len |
- | |
986 | max_cur_dir equ 0x1000 |
- | |
987 | ;get lenght string of appdata.cur_dir |
- | |
Line 988... | Line 985... | ||
988 | mov eax, [current_slot] |
985 | ; for our code: ebx->buffer,ecx=len |
Line 989... | Line 986... | ||
989 | mov edi, [eax+APPDATA.cur_dir] |
986 | max_cur_dir equ 0x1000 |
990 | 987 | ||
Line 991... | Line 988... | ||
991 | mov ebx,edi |
988 | mov ebx,edi |
992 | 989 | ||
Line 993... | Line 990... | ||
993 | push ecx |
990 | push ecx |
994 | push edi |
991 | push edi |
Line 995... | Line 992... | ||
995 | 992 | ||
996 | xor eax,eax |
993 | xor eax,eax |
997 | mov ecx,max_cur_dir |
994 | mov ecx,max_cur_dir |
Line 998... | Line 995... | ||
998 | 995 | ||
- | 996 | repne scasb ;find zerro at and string |
|
- | 997 | jnz .error ; no zero in cur_dir: internal error, should not happen |
|
- | 998 | ||
999 | repne scasb ;find zerro at and string |
999 | sub edi,ebx ;lenght for copy |
1000 | jcxz .error ;ecx=0 and destination buffer is too small. |
1000 | inc edi |
1001 | 1001 | mov [esp+32+8],edi ;return in eax |
|
1002 | sub edi,ebx ;lenght for copy |
1002 | |
- | 1003 | cmp edx, edi |
|
1003 | inc edi |
1004 | jbe @f |
Line 1004... | Line 1005... | ||
1004 | mov [esp+32+8],edi ;return in eax |
1005 | mov edx, edi |
1005 | 1006 | @@: |
|
1006 | cmp edx,edi ;edi must have more than 2 (for / and 0x0) |
1007 | ;source string |
1007 | ;sourse string |
1008 | pop esi |
1008 | pop esi |
- | |
1009 | ;destination string |
- | |
1010 | pop edi |
1009 | ;destination string |
Line 1011... | Line 1010... | ||
1011 | jb .ret |
1010 | pop edi |
1012 | 1011 | cmp edx, 1 |
|
1013 | mov al,'/' ;start string with '/' |
1012 | jbe .ret |