Rev 178 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 178 | Rev 259 | ||
---|---|---|---|
Line 8... | Line 8... | ||
8 | mov [f_info.length],ecx |
8 | mov [f_info.length],ecx |
9 | cld |
9 | cld |
10 | rep movsb |
10 | rep movsb |
11 | mov byte[edi],0 |
11 | mov byte[edi],0 |
Line 12... | Line 12... | ||
12 | 12 | ||
13 | mov esi,AREA_EDIT ; 0x70000 = 448 Kbytes (maximum) |
13 | mov esi,[cur_tab.Editor.Data] ;! AREA_EDIT ; 0x70000 = 448 Kbytes (maximum) |
Line 14... | Line 14... | ||
14 | mov edi,AREA_TEMP |
14 | mov edi,0 ;!!! AREA_TEMP |
15 | 15 | ||
16 | .new_string: |
16 | .new_string: |
17 | call save_string |
17 | call save_string |
18 | cmp dword[esi],0 |
18 | cmp dword[esi],0 |
19 | jne .new_string |
19 | jne .new_string |
20 | sub edi,AREA_TEMP+2 ; minus last CRLF |
20 | sub edi,0 ;!!! AREA_TEMP+2 ; minus last CRLF |
21 | ;! mov [filelen],edi |
21 | ;! mov [filelen],edi |
22 | cmp byte[f_info.path],'/' |
22 | cmp byte[f_info.path],'/' |
23 | je .systree_save |
23 | je .systree_save |
24 | mcall 33,f_info.path,AREA_TEMP,edi,0;[filelen],0 |
24 | mcall 33,f_info.path,0,edi,0 ;!!! AREA_TEMP,edi,0;[filelen],0 |
25 | or eax,eax |
25 | or eax,eax |
26 | jz .exit |
26 | jz .exit |
Line 38... | Line 38... | ||
38 | ; rep movsb |
38 | ; rep movsb |
39 | ;mcall 58,f_info |
39 | ;mcall 58,f_info |
Line 40... | Line 40... | ||
40 | 40 | ||
41 | mov [f_info70+0],2 |
41 | mov [f_info70+0],2 |
42 | mov [f_info70+12],edi |
42 | mov [f_info70+12],edi |
43 | mov [f_info70+16],AREA_TEMP |
43 | mov [f_info70+16],0 ;!!! AREA_TEMP |
44 | mov byte[f_info70+20],0 |
44 | mov byte[f_info70+20],0 |
45 | mov [f_info70+21],f_info.path |
45 | mov [f_info70+21],f_info.path |
Line 46... | Line 46... | ||
46 | mcall 70,f_info70 |
46 | mcall 70,f_info70 |
Line 47... | Line 47... | ||
47 | 47 | ||
48 | call set_status_fs_error |
48 | call set_status_fs_error |
Line 49... | Line 49... | ||
49 | 49 | ||
50 | or eax,eax |
50 | or eax,eax |
51 | jnz .exit.2 |
51 | jnz .exit.2 |
52 | 52 | ||
Line 53... | Line 53... | ||
53 | .exit: |
53 | .exit: |
54 | mov [modified],0 |
54 | mov [cur_tab.Editor.Modified],0 ;! [modified],0 |
Line 143... | Line 143... | ||
143 | lea esi,[esi+ecx+1] |
143 | lea esi,[esi+ecx+1] |
144 | jmp @b |
144 | jmp @b |
145 | @@: inc esi |
145 | @@: inc esi |
146 | mov [s_status],esi |
146 | mov [s_status],esi |
147 | pop eax |
147 | pop eax |
148 | call writepos |
148 | call draw_statusbar |
149 | ret |
149 | ret |
150 | endf |
150 | endf |
Line 151... | Line 151... | ||
151 | 151 | ||
152 | ;----------------------------------------------------------------------------- |
152 | ;----------------------------------------------------------------------------- |
153 | func load_hd_file ;/////////////////////////////////////////////////////////// |
153 | func load_file ;////////////////////////////////////////////////////////////// |
154 | ;----------------------------------------------------------------------------- |
154 | ;----------------------------------------------------------------------------- |
155 | mov [f_info+0],0 |
155 | mov esi,tb_opensave.text |
156 | mov [f_info+8],300000/512 |
156 | mov edi,f_info.path |
157 | ; mov esi,s_fname |
157 | movzx ecx,[tb_opensave.length] |
158 | ; mov edi,f_info.path;pathfile_read |
- | |
159 | ; mov ecx,PATHL |
158 | mov [f_info.length],ecx |
160 | ; cld |
159 | cld |
161 | ; rep movsb |
160 | rep movsb |
Line -... | Line 161... | ||
- | 161 | mov byte[edi],0 |
|
162 | ;mcall 58,f_info ; fileinfo_read |
162 | |
163 | 163 | xor eax,eax |
|
164 | mov [f_info70+0],0 |
164 | mov [f_info70+0],5 |
165 | mov [f_info70+4],0 |
165 | mov [f_info70+4],eax |
166 | mov [f_info70+8],0 |
166 | mov [f_info70+8],eax |
167 | mov [f_info70+12],300000;/512 |
167 | mov [f_info70+12],eax |
168 | mov [f_info70+16],AREA_TEMP |
168 | mov [f_info70+16],file_info |
169 | mov byte[f_info70+20],0 |
169 | mov byte[f_info70+20],al |
- | 170 | mov [f_info70+21],f_info.path |
|
- | 171 | mcall 70,f_info70 |
|
- | 172 | mov [f_info70+0],0 |
|
- | 173 | mov eax,dword[file_info.Size] |
|
- | 174 | mov [f_info70+12],eax |
|
- | 175 | call mem.Alloc |
|
Line 170... | Line 176... | ||
170 | mov [f_info70+21],f_info.path |
176 | mov [f_info70+16],eax |
Line -... | Line 177... | ||
- | 177 | mcall 70,f_info70 |
|
- | 178 | ||
171 | mcall 70,f_info70 |
179 | call set_status_fs_error |
172 | - | ||
173 | call set_status_fs_error |
180 | |
174 | 181 | mov esi,[f_info70+16] |
|
175 | xchg eax,ebx |
182 | |
176 | inc eax |
183 | xchg eax,ebx |
- | 184 | test ebx,ebx |
|
177 | test ebx,ebx |
185 | je .file_found |
- | 186 | cmp ebx,6 ;// ATV driver fix (6 instead of 5) |
|
178 | je load_file.file_found |
187 | je .file_found |
179 | cmp ebx,6 ;// ATV driver fix (6 instead of 5) |
188 | |
180 | je load_file.file_found |
- | |
181 | ; jmp file_not_found |
- | |
182 | stc |
- | |
183 | ret |
- | |
184 | endf |
- | |
Line -... | Line 189... | ||
- | 189 | mov eax,[f_info70+16] |
|
- | 190 | call mem.Free |
|
- | 191 | stc |
|
- | 192 | ret |
|
185 | 193 | ||
- | 194 | .file_found: |
|
186 | ;----------------------------------------------------------------------------- |
195 | mov ecx,eax |
187 | func load_file ;////////////////////////////////////////////////////////////// |
196 | call create_tab |
188 | ;----------------------------------------------------------------------------- |
- | |
189 | - | ||
190 | mov esi,tb_opensave.text |
197 | push ecx esi edi |
191 | mov edi,f_info.path |
198 | mov esi,tb_opensave.text |
192 | movzx ecx,[tb_opensave.length] |
- | |
- | 199 | lea edi,[ebp+TABITEM.Editor.FilePath] |
|
- | 200 | ;mov ecx,[f_info.length] |
|
193 | mov [f_info.length],ecx |
201 | movzx ecx,[tb_opensave.length] |
194 | cld |
202 | rep movsb |
- | 203 | mov byte[edi],0 |
|
195 | rep movsb |
204 | lea edi,[ebp+TABITEM.Editor.FilePath] |
196 | mov byte[edi],0 |
205 | movzx ecx,[tb_opensave.length] |
197 | 206 | @@: cmp byte[edi+ecx-1],'/' |
|
198 | cmp byte[f_info.path],'/' |
207 | je @f |
199 | je load_hd_file |
208 | dec ecx |
- | 209 | jmp @b |
|
- | 210 | @@: mov [ebp+TABITEM.Editor.FileName],ecx |
|
200 | 211 | call flush_cur_tab |
|
201 | mcall 6,f_info.path,0,16800,AREA_TEMP ; 6 = open file |
212 | pop edi esi ecx |
- | 213 | call load_from_memory |
|
Line -... | Line 214... | ||
- | 214 | mov eax,[f_info70+16] |
|
- | 215 | call mem.Free |
|
- | 216 | clc |
|
- | 217 | ret |
|
202 | inc eax ; eax = -1 -> file not found |
218 | endf |
- | 219 | ||
- | 220 | ;----------------------------------------------------------------------------- |
|
- | 221 | func load_from_memory ;/////////////////////////////////////////////////////// |
|
- | 222 | ;----------------------------------------------------------------------------- |
|
- | 223 | ; ECX = data length |
|
203 | jnz .file_found |
224 | ; ESI = data pointer |
204 | ; jmp file_not_found |
225 | ; EBP = EDITOR* |
205 | stc |
226 | ;----------------------------------------------------------------------------- |
206 | ret |
227 | call get_lines_in_file |
- | 228 | mov [ebp+EDITOR.Lines],eax |
|
207 | 229 | imul ebx,eax,14 |
|
208 | .file_found: |
230 | add ebx,ecx |
209 | dec eax |
231 | mov eax,[ebp+EDITOR.Data] |
Line 210... | Line 232... | ||
210 | mov [filesize],eax |
232 | call mem.ReAlloc |
211 | mov [lines],1 |
233 | mov [ebp+EDITOR.Data],eax |
212 | mov [columns],0 |
234 | |
213 | mov esi,AREA_TEMP |
235 | mov [ebp+EDITOR.Columns],0 |
Line 242... | Line 264... | ||
242 | mov [ebx],eax |
264 | mov [ebx],eax |
243 | mov dword[ebx+eax+4],0 |
265 | mov dword[ebx+eax+4],0 |
244 | sub eax,10 |
266 | sub eax,10 |
245 | jnz @f |
267 | jnz @f |
246 | inc eax |
268 | inc eax |
247 | @@: cmp eax,[columns] |
269 | @@: cmp eax,[ebp+EDITOR.Columns] ;! eax,[columns] |
248 | jbe @f |
270 | jbe @f |
249 | mov [columns],eax |
271 | mov [ebp+EDITOR.Columns],eax ;! [columns],eax |
250 | @@: mov [modified],0 |
272 | @@: mov [ebp+EDITOR.Modified],0 ;! [modified],0 |
251 | clc |
- | |
252 | ret |
273 | ret |
Line 253... | Line 274... | ||
253 | 274 | ||
254 | .CR: cmp byte[esi],10 |
275 | .CR: cmp byte[esi],10 |
255 | jne .LF |
276 | jne .LF |
Line 259... | Line 280... | ||
259 | mov al,' ' |
280 | mov al,' ' |
260 | rep stosb |
281 | rep stosb |
261 | lea eax,[edi-4] |
282 | lea eax,[edi-4] |
262 | sub eax,ebx |
283 | sub eax,ebx |
263 | mov [ebx],eax |
284 | mov [ebx],eax |
264 | inc [lines] |
285 | ;inc [cur_tab.Editor.Lines] ;! [lines] |
265 | add eax,-10 |
286 | add eax,-10 |
266 | cmp eax,[columns] |
287 | cmp eax,[ebp+EDITOR.Columns] ;! eax,[columns] |
267 | jbe .next_line |
288 | jbe .next_line |
268 | mov [columns],eax |
289 | mov [ebp+EDITOR.Columns],eax ;! [columns],eax |
269 | jmp .next_line |
290 | jmp .next_line |
Line 270... | Line 291... | ||
270 | 291 | ||
271 | .TB: lea eax,[edi-4] |
292 | .TB: lea eax,[edi-4] |
272 | sub eax,ebx |
293 | sub eax,ebx |
Line 276... | Line 297... | ||
276 | sub ecx,eax |
297 | sub ecx,eax |
277 | mov al,' ' |
298 | mov al,' ' |
278 | rep stosb |
299 | rep stosb |
279 | jmp .next_char |
300 | jmp .next_char |
280 | endf |
301 | endf |
281 | - | ||
282 | ;----------------------------------------------------------------------------- |
- | |
283 | func new_file ;/////////////////////////////////////////////////////////////// |
- | |
284 | ;----------------------------------------------------------------------------- |
- | |
285 | ; mcall 55,eax,error_beep ; beep |
- | |
286 | mov [lines],1 ; open empty document |
- | |
287 | mov [columns],1 |
- | |
288 | xor eax,eax |
- | |
289 | mov [top_line],eax |
- | |
290 | mov [pos.x],eax |
- | |
291 | mov [pos.y],eax |
- | |
292 | mov edi,AREA_EDIT+4 |
- | |
293 | mov ecx,10 |
- | |
294 | mov [edi-4],ecx |
- | |
295 | mov [edi+10],eax |
- | |
296 | mov al,' ' |
- | |
297 | cld |
- | |
298 | rep stosb |
- | |
299 | - | ||
300 | mov [f_info.length],0 |
- | |
301 | mov [modified],0 |
- | |
302 | mov [asm_mode],0 |
- | |
303 | call update_caption |
- | |
304 | call drawwindow |
- | |
305 | - | ||
306 | ret |
- | |
307 | endf |
- | |
308 | 302 |