Subversion Repositories Kolibri OS

Rev

Rev 7184 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
647 andrew_pro 1
format ELF
2
 
3
section '.text' executable
4
 
7855 Boppan 5
include '../proc32.inc'
647 andrew_pro 6
public _ksys_get_filesize
7
public _ksys_readfile
8
public _ksys_rewritefile
9
public _ksys_appendtofile
10
 
11
align 4
12
proc _ksys_get_filesize stdcall, filename:dword
13
 
14
        xor eax,eax
15
        mov ebx,[filename]
16
        mov [fileinfo.subproc],dword 5
17
        mov [fileinfo.offset_l],eax
18
        mov [fileinfo.offset_h],eax
19
        mov [fileinfo.size],eax
20
        mov [fileinfo.data],dword buffer_for_info
21
        mov [fileinfo.letter],al
22
        mov [fileinfo.filename],ebx
23
 
24
        mov eax,70
25
        mov ebx,fileinfo
26
        int 0x40
27
 
28
        test eax,eax
29
        jnz error_for_file_size
30
 
7172 siemargl 31
        mov eax,[buffer_for_info+32] ;file size
32
        ret
647 andrew_pro 33
 
34
        error_for_file_size:
7172 siemargl 35
	neg eax
647 andrew_pro 36
 
37
        ret
38
endp
39
 
40
 
41
align 4
7184 siemargl 42
proc _ksys_readfile stdcall,filename:dword,position:dword,sizeblock:dword,buffer:dword, preadbytes:dword
647 andrew_pro 43
 
44
        xor eax,eax
45
        mov ebx,[position]
46
        mov ecx,[sizeblock]
47
        mov edx,[buffer]
48
        mov esi,[filename]
49
        mov [fileinfo.subproc],eax
50
        mov [fileinfo.offset_l],ebx
51
        mov [fileinfo.offset_h],eax
52
        mov [fileinfo.size],ecx
53
        mov [fileinfo.data],edx
54
        mov [fileinfo.letter],al
55
        mov [fileinfo.filename],esi
56
 
57
        mov eax,70
58
        mov ebx,fileinfo
59
        int 0x40
60
 
7184 siemargl 61
	mov esi, [preadbytes]
62
	mov [esi], ebx
63
 
647 andrew_pro 64
        ret
65
endp
66
 
67
align 4
68
proc _ksys_rewritefile stdcall,filename:dword,sizeblock:dword,data_write:dword
69
 
70
        xor eax,eax
71
        mov ebx,[sizeblock]
72
        mov ecx,[data_write]
73
        mov edx,[filename]
74
        mov [fileinfo.subproc],dword 2
75
        mov [fileinfo.offset_l],eax
76
        mov [fileinfo.offset_h],eax
77
        mov [fileinfo.size],ebx
78
        mov [fileinfo.data],ecx
79
        mov [fileinfo.letter],al
80
        mov [fileinfo.filename],edx
81
 
82
        mov eax,70
83
        mov ebx,fileinfo
84
        int 0x40
85
 
86
        ret
87
endp
88
 
89
align 4
90
proc _ksys_appendtofile stdcall,filename:dword,pos:dword,sizeblock:dword,data_append:dword
91
 
92
        xor eax,eax
93
        mov ebx,[pos]
94
        mov ecx,[sizeblock]
95
        mov edx,[data_append]
96
        mov esi,[filename]
97
        mov [fileinfo.subproc],dword 3
98
        mov [fileinfo.offset_l],ebx
99
        mov [fileinfo.offset_h],eax
100
        mov [fileinfo.size],ecx
101
        mov [fileinfo.data],edx
102
        mov [fileinfo.letter],al
103
        mov [fileinfo.filename],esi
104
 
105
        mov eax,70
106
        mov ebx,fileinfo
107
        int 0x40
108
 
109
        ret
110
endp
111
 
112
struc FILEIO
113
{
114
 .subproc          rd 1
115
 .offset_l         rd 1
116
 .offset_h         rd 1
117
 .size             rd 1
118
 .data             rd 1
119
 .letter           rb 1
120
 .filename         rd 1
121
}
122
 
123
fileinfo           FILEIO
124
buffer_for_info    rd 11