Rev 258 | Rev 267 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 258 | Rev 259 | ||
---|---|---|---|
Line 2... | Line 2... | ||
2 | func check_cur_vis_inv ;////////////////////////////////////////////////////// |
2 | func check_cur_vis_inv ;////////////////////////////////////////////////////// |
3 | ;----------------------------------------------------------------------------- |
3 | ;----------------------------------------------------------------------------- |
4 | push eax ebx |
4 | push eax ebx |
5 | xor bl,bl |
5 | xor bl,bl |
6 | .chk_y: |
6 | .chk_y: |
7 | mov eax,[pos.y] |
7 | mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] |
8 | or eax,eax |
8 | or eax,eax |
9 | jge @f |
9 | jge @f |
10 | mov [pos.y],0 |
10 | mov [cur_tab.Editor.Caret.Y],0 ;! [pos.y],0 |
11 | jmp .chk_dy |
11 | jmp .chk_dy |
12 | @@: cmp eax,[lines] |
12 | @@: cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines] |
13 | jl .chk_dy |
13 | jl .chk_dy |
14 | mov eax,[lines] |
14 | mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] |
15 | dec eax |
15 | dec eax |
16 | mov [pos.y],eax |
16 | mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax |
17 | .chk_dy: |
17 | .chk_dy: |
18 | mov eax,[top_line] |
18 | mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] |
19 | cmp eax,[pos.y] |
19 | cmp eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] |
20 | jle @f |
20 | jle @f |
- | 21 | m2m [cur_tab.Editor.TopLeft.Y],[cur_tab.Editor.Caret.Y] |
|
21 | push [pos.y] |
22 | ;! push [pos.y] |
22 | pop [top_line] |
23 | ;! pop [top_line] |
23 | inc bl |
24 | inc bl |
24 | @@: add eax,[lines.scr] |
25 | @@: add eax,[lines.scr] |
25 | cmp eax,[pos.y] |
26 | cmp eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] |
26 | jg .chk_x |
27 | jg .chk_x |
27 | mov eax,[pos.y] |
28 | mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] |
28 | sub eax,[lines.scr] |
29 | sub eax,[lines.scr] |
29 | inc eax |
30 | inc eax |
30 | mov [top_line],eax |
31 | mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax |
31 | inc bl |
32 | inc bl |
32 | .chk_x: |
33 | .chk_x: |
33 | mov eax,[pos.x] |
34 | mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] |
34 | or eax,eax |
35 | or eax,eax |
35 | jge @f |
36 | jge @f |
36 | mov [pos.x],0 |
37 | mov [cur_tab.Editor.Caret.X],0 ;! [pos.x],0 |
37 | jmp .chk_dx |
38 | jmp .chk_dx |
38 | @@: cmp eax,[columns] |
39 | @@: cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] |
39 | jl .chk_dx |
40 | jl .chk_dx |
40 | mov eax,[columns] |
41 | mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] |
41 | mov [pos.x],eax |
42 | mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax |
42 | .chk_dx: |
43 | .chk_dx: |
43 | mov eax,[left_col] |
44 | mov eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] |
44 | cmp eax,[pos.x] |
45 | cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] |
45 | jle @f |
46 | jle @f |
- | 47 | m2m [cur_tab.Editor.TopLeft.X],[cur_tab.Editor.Caret.X] |
|
46 | push [pos.x] |
48 | ;! push [pos.x] |
47 | pop [left_col] |
49 | ;! pop [left_col] |
48 | inc bl |
50 | inc bl |
49 | @@: add eax,[columns.scr] |
51 | @@: add eax,[columns.scr] |
50 | cmp eax,[pos.x] |
52 | cmp eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] |
51 | jg @f |
53 | jg @f |
52 | mov eax,[pos.x] |
54 | mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] |
53 | sub eax,[columns.scr] |
55 | sub eax,[columns.scr] |
54 | inc eax |
56 | inc eax |
55 | mov [left_col],eax |
57 | mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax |
56 | inc bl |
58 | inc bl |
57 | @@: cmp [mev],MEV_LDOWN |
59 | @@: cmp [mev],MEV_LDOWN |
58 | jne .exit |
60 | jne .exit |
59 | push [pos.x] [pos.y] |
61 | push [cur_tab.Editor.Caret.X] [cur_tab.Editor.Caret.Y] ;! [pos.x] [pos.y] |
60 | pop [sel.y] [sel.x] |
62 | pop [cur_tab.Editor.SelStart.Y] [cur_tab.Editor.SelStart.X] ;! [sel.y] [sel.x] |
61 | .exit: |
63 | .exit: |
62 | or bl,bl |
64 | or bl,bl |
63 | clc |
65 | clc |
64 | jz @f |
66 | jz @f |
65 | call draw_file |
67 | call draw_file |
Line 70... | Line 72... | ||
70 | 72 | ||
71 | ;----------------------------------------------------------------------------- |
73 | ;----------------------------------------------------------------------------- |
72 | func clear_selection ;//////////////////////////////////////////////////////// |
74 | func clear_selection ;//////////////////////////////////////////////////////// |
73 | ;----------------------------------------------------------------------------- |
75 | ;----------------------------------------------------------------------------- |
74 | push eax ebx |
76 | push eax ebx |
75 | mov eax,[sel.y] |
77 | mov eax,[cur_tab.Editor.SelStart.Y] ;! eax,[sel.y] |
76 | mov ebx,[pos.y] |
78 | mov ebx,[cur_tab.Editor.Caret.Y] ;! ebx,[pos.y] |
77 | cmp eax,ebx |
79 | cmp eax,ebx |
78 | jle @f |
80 | jle @f |
79 | xchg eax,ebx |
81 | xchg eax,ebx |
80 | @@: push [pos.x] [pos.y] |
82 | @@: push [cur_tab.Editor.Caret.X] [cur_tab.Editor.Caret.Y] ;! [pos.x] [pos.y] |
81 | pop [sel.y] [sel.x] |
83 | pop [cur_tab.Editor.SelStart.Y] [cur_tab.Editor.SelStart.X] ;! [sel.y] [sel.x] |
82 | call draw_file.ex |
84 | call draw_file.ex |
83 | pop ebx eax |
85 | pop ebx eax |
84 | ret |
86 | ret |
Line 103... | Line 105... | ||
103 | 105 | ||
104 | ;----------------------------------------------------------------------------- |
106 | ;----------------------------------------------------------------------------- |
105 | func check_bottom_right ;///////////////////////////////////////////////////// |
107 | func check_bottom_right ;///////////////////////////////////////////////////// |
106 | ;----------------------------------------------------------------------------- |
108 | ;----------------------------------------------------------------------------- |
107 | push eax |
109 | push eax |
108 | mov eax,[top_line] |
110 | mov eax,[cur_tab.Editor.TopLeft.Y] ;! eax,[top_line] |
109 | add eax,[lines.scr] |
111 | add eax,[lines.scr] |
110 | cmp eax,[lines] |
112 | cmp eax,[cur_tab.Editor.Lines] ;! eax,[lines] |
111 | jbe .lp1 |
113 | jbe .lp1 |
112 | mov eax,[lines] |
114 | mov eax,[cur_tab.Editor.Lines] ;! eax,[lines] |
113 | sub eax,[lines.scr] |
115 | sub eax,[lines.scr] |
114 | jns @f |
116 | jns @f |
115 | xor eax,eax |
117 | xor eax,eax |
116 | @@: mov [top_line],eax |
118 | @@: mov [cur_tab.Editor.TopLeft.Y],eax ;! [top_line],eax |
117 | .lp1: mov eax,[left_col] |
119 | .lp1: mov eax,[cur_tab.Editor.TopLeft.X] ;! eax,[left_col] |
118 | add eax,[columns.scr] |
120 | add eax,[columns.scr] |
119 | cmp eax,[columns] |
121 | cmp eax,[cur_tab.Editor.Columns] ;! eax,[columns] |
120 | jbe .exit |
122 | jbe .exit |
121 | mov eax,[columns] |
123 | mov eax,[cur_tab.Editor.Columns] ;! eax,[columns] |
122 | sub eax,[columns.scr] |
124 | sub eax,[columns.scr] |
123 | jns @f |
125 | jns @f |
124 | xor eax,eax |
126 | xor eax,eax |
125 | @@: mov [left_col],eax |
127 | @@: mov [cur_tab.Editor.TopLeft.X],eax ;! [left_col],eax |
126 | .exit: |
128 | .exit: |
127 | pop eax |
129 | pop eax |
128 | ret |
130 | ret |
Line 146... | Line 148... | ||
146 | endf |
148 | endf |
Line 147... | Line 149... | ||
147 | 149 | ||
148 | ;----------------------------------------------------------------------------- |
150 | ;----------------------------------------------------------------------------- |
149 | func check_inv_all ;////////////////////////////////////////////////////////// |
151 | func check_inv_all ;////////////////////////////////////////////////////////// |
150 | ;----------------------------------------------------------------------------- |
152 | ;----------------------------------------------------------------------------- |
151 | mov eax,[pos.y] |
153 | mov eax,[cur_tab.Editor.Caret.Y] ;! eax,[pos.y] |
152 | mov ecx,[top_line] |
154 | mov ecx,[cur_tab.Editor.TopLeft.Y] ;! ecx,[top_line] |
153 | .skip_init: |
155 | .skip_init: |
154 | call check_cur_vis |
156 | call check_cur_vis |
155 | mov [pos.y],eax |
157 | mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax |
156 | mov [top_line],ecx |
158 | mov [cur_tab.Editor.TopLeft.Y],ecx ;! [top_line],ecx |
157 | .skip_check: |
159 | .skip_check: |
158 | ; call clear_screen |
160 | ; call clear_screen |
159 | call draw_file |
161 | call draw_file |
160 | ret |
162 | ret |
Line 165... | Line 167... | ||
165 | ;----------------------------------------------------------------------------- |
167 | ;----------------------------------------------------------------------------- |
166 | cmp eax,ecx |
168 | cmp eax,ecx |
167 | jb .low |
169 | jb .low |
168 | mov edx,ecx |
170 | mov edx,ecx |
169 | add edx,[lines.scr] |
171 | add edx,[lines.scr] |
170 | cmp edx,[lines] |
172 | cmp edx,[cur_tab.Editor.Lines] ;! edx,[lines] |
171 | jbe @f |
173 | jbe @f |
172 | mov edx,[lines] |
174 | mov edx,[cur_tab.Editor.Lines] ;! edx,[lines] |
173 | @@: cmp eax,edx |
175 | @@: cmp eax,edx |
174 | jb @f |
176 | jb @f |
175 | lea ecx,[eax+1] |
177 | lea ecx,[eax+1] |
176 | sub ecx,[lines.scr] |
178 | sub ecx,[lines.scr] |
177 | jns @f |
179 | jns @f |
178 | xor ecx,ecx |
180 | xor ecx,ecx |
179 | jmp @f |
181 | jmp @f |
180 | .low: mov ecx,eax |
182 | .low: mov ecx,eax |
181 | @@: mov edx,ecx |
183 | @@: mov edx,ecx |
182 | add edx,[lines.scr] |
184 | add edx,[lines.scr] |
183 | cmp edx,[lines] |
185 | cmp edx,[cur_tab.Editor.Lines] ;! edx,[lines] |
184 | jbe @f |
186 | jbe @f |
185 | mov ecx,[lines] |
187 | mov ecx,[cur_tab.Editor.Lines] ;! ecx,[lines] |
186 | sub ecx,[lines.scr] |
188 | sub ecx,[lines.scr] |
187 | jns @f |
189 | jns @f |
188 | xor ecx,ecx |
190 | xor ecx,ecx |
189 | @@:;mov [top_line],ecx |
191 | @@:;mov [top_line],ecx |
Line 190... | Line 192... | ||
190 | 192 | ||
191 | pushad |
193 | pushad |
192 | mov eax,[pos.x] |
194 | mov eax,[cur_tab.Editor.Caret.X] ;! eax,[pos.x] |
193 | mov ebx,[left_col] |
195 | mov ebx,[cur_tab.Editor.TopLeft.X] ;! ebx,[left_col] |
194 | mov ecx,ebx |
196 | mov ecx,ebx |
195 | add ecx,[columns.scr] |
197 | add ecx,[columns.scr] |
196 | cmp eax,ebx |
198 | cmp eax,ebx |
197 | jb .lp1 |
199 | jb .lp1 |
198 | cmp eax,ecx |
200 | cmp eax,ecx |
199 | jb .exit |
201 | jb .exit |
200 | lea ebx,[eax] |
202 | lea ebx,[eax] |
201 | sub ebx,[columns.scr] |
203 | sub ebx,[columns.scr] |
202 | jmp @f |
204 | jmp @f |
203 | .lp1: mov ebx,eax |
205 | .lp1: mov ebx,eax |
Line 204... | Line 206... | ||
204 | @@: mov [left_col],ebx |
206 | @@: mov [cur_tab.Editor.TopLeft.X],ebx ;! [left_col],ebx |
205 | 207 | ||
206 | .exit: |
208 | .exit: |
Line 207... | Line 209... | ||
207 | mov [pos.x],eax |
209 | mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax |
208 | popad |
210 | popad |
Line 228... | Line 230... | ||
228 | ; ECX = line number |
230 | ; ECX = line number |
229 | ; Output: |
231 | ; Output: |
230 | ; ESI = line data offset |
232 | ; ESI = line data offset |
231 | ;----------------------------------------------------------------------------- |
233 | ;----------------------------------------------------------------------------- |
232 | push eax ecx |
234 | push eax ecx |
233 | mov esi,AREA_EDIT |
235 | mov esi,[cur_tab.Editor.Data] ;! AREA_EDIT |
- | 236 | @@: dec ecx |
|
234 | jecxz .exit |
237 | js .exit |
235 | @@: movzx eax,word[esi] |
238 | movzx eax,word[esi] |
236 | dec ecx |
- | |
237 | lea esi,[esi+eax+4] |
239 | lea esi,[esi+eax+4] |
238 | jnz @b |
240 | jmp @b |
239 | .exit: |
241 | .exit: |
240 | pop ecx eax |
242 | pop ecx eax |
241 | ret |
243 | ret |
242 | endf |
244 | endf |
Line 243... | Line 245... | ||
243 | 245 | ||
244 | ;----------------------------------------------------------------------------- |
246 | ;----------------------------------------------------------------------------- |
245 | func init_sel_vars ;////////////////////////////////////////////////////////// |
247 | func init_sel_vars ;////////////////////////////////////////////////////////// |
246 | ;----------------------------------------------------------------------------- |
248 | ;----------------------------------------------------------------------------- |
247 | pushad |
249 | pushad |
248 | mov [sel.selected],1 |
250 | mov [sel.selected],1 |
249 | mov eax,[sel.x] |
251 | mov eax,[cur_tab.Editor.SelStart.X] ;! eax,[sel.x] |
250 | mov ebx,[sel.y] |
252 | mov ebx,[cur_tab.Editor.SelStart.Y] ;! ebx,[sel.y] |
251 | mov ecx,[pos.x] |
253 | mov ecx,[cur_tab.Editor.Caret.X] ;! ecx,[pos.x] |
252 | mov edx,[pos.y] |
254 | mov edx,[cur_tab.Editor.Caret.Y] ;! edx,[pos.y] |
253 | cmp ebx,edx |
255 | cmp ebx,edx |
254 | jl .lp2 |
256 | jl .lp2 |
255 | jne @f |
257 | jne @f |
256 | cmp eax,ecx |
258 | cmp eax,ecx |
Line 351... | Line 353... | ||
351 | stosb |
353 | stosb |
352 | ret |
354 | ret |
353 | endf |
355 | endf |
Line 354... | Line 356... | ||
354 | 356 | ||
- | 357 | ;----------------------------------------------------------------------------- |
|
- | 358 | func strlen ;///////////////////////////////////////////////////////////////// |
|
- | 359 | ;----------------------------------------------------------------------------- |
|
- | 360 | push ebx |
|
- | 361 | mov ebx,eax |
|
- | 362 | xor eax,eax |
|
- | 363 | @@: cmp byte[ebx+eax],0 |
|
- | 364 | je @f |
|
- | 365 | inc eax |
|
- | 366 | jmp @b |
|
- | 367 | @@: pop ebx |
|
- | 368 | ret |
|
- | 369 | endf |
|
- | 370 | ||
355 | ;----------------------------------------------------------------------------- |
371 | ;----------------------------------------------------------------------------- |
356 | func rgb_to_gray ;//////////////////////////////////////////////////////////// |
372 | func rgb_to_gray ;//////////////////////////////////////////////////////////// |
357 | ;----------------------------------------------------------------------------- |
373 | ;----------------------------------------------------------------------------- |
358 | push 0 eax |
374 | push 0 eax |
359 | and dword[esp],0x000000FF |
375 | and dword[esp],0x000000FF |
Line 490... | Line 506... | ||
490 | movzx edx,word[esi] |
506 | movzx edx,word[esi] |
491 | cmp ecx,edx |
507 | cmp ecx,edx |
492 | jbe .exit |
508 | jbe .exit |
493 | sub ecx,edx |
509 | sub ecx,edx |
494 | push ecx |
510 | push ecx |
- | 511 | mov edi,[cur_tab.Editor.Data] ;! AREA_TEMP2 |
|
495 | mov edi,AREA_TEMP2 |
512 | add edi,[edi-4] |
- | 513 | dec edi |
|
496 | mov eax,esi |
514 | mov eax,esi |
497 | mov esi,edi |
515 | mov esi,edi |
498 | sub esi,ecx |
516 | sub esi,ecx |
499 | lea ecx,[eax+4] |
517 | lea ecx,[eax+4] |
500 | add ecx,edx;[eax] |
518 | add ecx,edx;[eax] |
501 | push ecx |
519 | push ecx |
502 | neg ecx |
520 | neg ecx |
503 | lea ecx,[esi+ecx+1] |
521 | lea ecx,[esi+ecx+1] |
504 | std |
522 | std |
- | 523 | diff16 '32DC',0,$ |
|
505 | rep movsb |
524 | rep movsb |
506 | pop edi ecx |
525 | pop edi ecx |
507 | add [eax],cx |
526 | add [eax],cx |
508 | mov al,' ' |
527 | mov al,' ' |
509 | cld |
528 | cld |
Line 514... | Line 533... | ||
514 | endf |
533 | endf |
Line 515... | Line 534... | ||
515 | 534 | ||
516 | ;----------------------------------------------------------------------------- |
535 | ;----------------------------------------------------------------------------- |
517 | func delete_selection ;/////////////////////////////////////////////////////// |
536 | func delete_selection ;/////////////////////////////////////////////////////// |
- | 537 | ;----------------------------------------------------------------------------- |
|
- | 538 | ; call init_sel_vars |
|
518 | ;----------------------------------------------------------------------------- |
539 | |
519 | cmp [sel.selected],0 |
540 | cmp [sel.selected],0 |
Line 520... | Line 541... | ||
520 | je .exit.2 |
541 | je .exit.2 |
521 | 542 | ||
Line 540... | Line 561... | ||
540 | mov ebx,[sel.begin.x] |
561 | mov ebx,[sel.begin.x] |
541 | add ebx,ecx |
562 | add ebx,ecx |
542 | mov [edi-4],bx |
563 | mov [edi-4],bx |
543 | add edi,[sel.begin.x] |
564 | add edi,[sel.begin.x] |
544 | lea esi,[esi+eax+4] |
565 | lea esi,[esi+eax+4] |
- | 566 | mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2 |
|
545 | mov ecx,AREA_TEMP2 |
567 | add ecx,[ecx-4] |
546 | sub ecx,esi |
568 | sub ecx,esi |
547 | cld |
569 | cld |
548 | rep movsb |
570 | rep movsb |
549 | mov eax,[sel.end.y] |
571 | mov eax,[sel.end.y] |
550 | sub eax,[sel.begin.y] |
572 | sub eax,[sel.begin.y] |
551 | sub [lines],eax |
573 | sub [cur_tab.Editor.Lines],eax ;! [lines],eax |
552 | jmp .exit |
574 | jmp .exit |
Line 553... | Line 575... | ||
553 | 575 | ||
554 | .single_line: |
576 | .single_line: |
555 | call get_line_offset |
577 | call get_line_offset |
Line 565... | Line 587... | ||
565 | @@: sub ecx,[sel.begin.x] |
587 | @@: sub ecx,[sel.begin.x] |
566 | sub [esi],cx |
588 | sub [esi],cx |
567 | lea edi,[esi+4] |
589 | lea edi,[esi+4] |
568 | add edi,[sel.begin.x] |
590 | add edi,[sel.begin.x] |
569 | lea esi,[edi+ecx] |
591 | lea esi,[edi+ecx] |
- | 592 | mov ecx,[cur_tab.Editor.Data] ;! AREA_TEMP2 |
|
570 | mov ecx,AREA_TEMP2 |
593 | add ecx,[ecx-4] |
571 | sub ecx,esi |
594 | sub ecx,esi |
572 | cld |
595 | cld |
573 | rep movsb |
596 | rep movsb |
Line 574... | Line 597... | ||
574 | 597 | ||
575 | .exit: |
598 | .exit: |
576 | mov eax,[sel.begin.x] |
599 | mov eax,[sel.begin.x] |
577 | mov [pos.x],eax |
600 | mov [cur_tab.Editor.Caret.X],eax ;! [pos.x],eax |
578 | mov [sel.x],eax |
601 | mov [cur_tab.Editor.SelStart.X],eax ;! [sel.x],eax |
579 | mov eax,[sel.begin.y] |
602 | mov eax,[sel.begin.y] |
580 | mov [pos.y],eax |
603 | mov [cur_tab.Editor.Caret.Y],eax ;! [pos.y],eax |
581 | mov [sel.y],eax |
604 | mov [cur_tab.Editor.SelStart.Y],eax ;! [sel.y],eax |
582 | popad |
605 | popad |
583 | mov [modified],1 |
606 | mov [cur_tab.Editor.Modified],1 ;! [modified],1 |
584 | clc |
607 | clc |
Line 585... | Line 608... | ||
585 | ret |
608 | ret |
586 | 609 | ||
587 | .exit.2: |
610 | .exit.2: |
588 | stc |
611 | stc |
- | 612 | ret |
|
- | 613 | endf |
|
- | 614 | ||
- | 615 | ;----------------------------------------------------------------------------- |
|
- | 616 | func get_selection_size ;///////////////////////////////////////////////////// |
|
- | 617 | ;----------------------------------------------------------------------------- |
|
- | 618 | push ecx esi |
|
- | 619 | mov ecx,[sel.end.y] |
|
- | 620 | inc ecx |
|
- | 621 | call get_line_offset |
|
- | 622 | mov eax,esi |
|
- | 623 | mov ecx,[sel.begin.y] |
|
- | 624 | call get_line_offset |
|
- | 625 | sub eax,esi |
|
- | 626 | pop esi ecx |
|
- | 627 | ret |
|
- | 628 | endf |
|
- | 629 | ||
- | 630 | ;----------------------------------------------------------------------------- |
|
- | 631 | func get_lines_in_file ;////////////////////////////////////////////////////// |
|
- | 632 | ;----------------------------------------------------------------------------- |
|
- | 633 | ; ESI = data pointer |
|
- | 634 | ; ECX = data length |
|
- | 635 | ;----------------------------------------------------------------------------- |
|
- | 636 | push ebx ecx esi |
|
- | 637 | or ebx,-1 |
|
- | 638 | .lp0: inc ebx |
|
- | 639 | .lp1: dec ecx |
|
- | 640 | jle .lp2 |
|
- | 641 | lodsb |
|
- | 642 | cmp al,10 |
|
- | 643 | je .LF |
|
- | 644 | cmp al,13 |
|
- | 645 | je .CR |
|
- | 646 | jmp .lp1 |
|
- | 647 | .lp2: mov eax,ebx |
|
- | 648 | pop esi ecx ebx |
|
- | 649 | ret |
|
- | 650 | ||
- | 651 | .CR: cmp byte[esi],10 |
|
- | 652 | jne .lp0 |
|
- | 653 | lodsb |
|
- | 654 | .LF: jmp .lp0 |
|
- | 655 | endf |
|
- | 656 | ||
- | 657 | ;----------------------------------------------------------------------------- |
|
- | 658 | func mem.Alloc ;////////////////////////////////////////////////////////////// |
|
- | 659 | ;----------------------------------------------------------------------------- |
|
- | 660 | push ebx ecx |
|
- | 661 | lea ecx,[eax+4+4095] |
|
- | 662 | and ecx,not 4095 |
|
- | 663 | mcall 68,12 |
|
- | 664 | add ecx,-4 |
|
- | 665 | mov [eax],ecx |
|
- | 666 | add eax,4 |
|
- | 667 | pop ecx ebx |
|
- | 668 | ret |
|
- | 669 | endf |
|
- | 670 | ||
- | 671 | ;----------------------------------------------------------------------------- |
|
- | 672 | func mem.ReAlloc ;//////////////////////////////////////////////////////////// |
|
- | 673 | ;----------------------------------------------------------------------------- |
|
- | 674 | push ebx ecx esi edi eax |
|
- | 675 | or eax,eax |
|
- | 676 | jz @f |
|
- | 677 | lea ecx,[ebx+4+4095] |
|
- | 678 | and ecx,not 4095 |
|
- | 679 | add ecx,-4 |
|
- | 680 | cmp ecx,[eax-4] |
|
- | 681 | je .exit |
|
- | 682 | @@: mov eax,ebx |
|
- | 683 | call mem.Alloc |
|
- | 684 | xchg eax,[esp] |
|
- | 685 | or eax,eax |
|
- | 686 | jz .exit |
|
- | 687 | mov esi,eax |
|
- | 688 | xchg eax,[esp] |
|
- | 689 | mov edi,eax |
|
- | 690 | mov ecx,[esi-4] |
|
- | 691 | cmp ecx,[edi-4] |
|
- | 692 | jbe @f |
|
- | 693 | mov ecx,[edi-4] |
|
- | 694 | @@: add ecx,3 |
|
- | 695 | shr ecx,2 |
|
- | 696 | cld |
|
- | 697 | rep movsd |
|
- | 698 | xchg eax,[esp] |
|
- | 699 | call mem.Free |
|
- | 700 | .exit: |
|
- | 701 | pop eax edi esi ecx ebx |
|
- | 702 | ret |
|
- | 703 | endf |
|
- | 704 | ||
- | 705 | ;----------------------------------------------------------------------------- |
|
- | 706 | func mem.Free ;/////////////////////////////////////////////////////////////// |
|
- | 707 | ;----------------------------------------------------------------------------- |
|
- | 708 | push ebx ecx |
|
- | 709 | lea ecx,[eax-4] |
|
- | 710 | mcall 68,13 |
|
- | 711 | pop ecx ebx |