Rev 987 | Rev 8589 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
824 | mikedld | 1 | diff16 'tp-common.asm',0,$ |
2 | |||
258 | mikedld | 3 | ;----------------------------------------------------------------------------- |
617 | mikedld | 4 | proc clear_selection ;//////////////////////////////////////////////////////// |
258 | mikedld | 5 | ;----------------------------------------------------------------------------- |
6 | push eax ebx |
||
297 | mikedld | 7 | mov eax,[cur_editor.SelStart.Y] |
8 | mov ebx,[cur_editor.Caret.Y] |
||
258 | mikedld | 9 | cmp eax,ebx |
10 | jle @f |
||
11 | xchg eax,ebx |
||
297 | mikedld | 12 | @@: push [cur_editor.Caret.X] [cur_editor.Caret.Y] |
13 | pop [cur_editor.SelStart.Y] [cur_editor.SelStart.X] |
||
258 | mikedld | 14 | pop ebx eax |
15 | ret |
||
617 | mikedld | 16 | endp |
258 | mikedld | 17 | |
18 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 19 | proc pt_in_rect ;///////////////////////////////////////////////////////////// |
258 | mikedld | 20 | ;----------------------------------------------------------------------------- |
21 | cmp eax,[ecx+0x0] |
||
22 | jl @f |
||
23 | cmp ebx,[ecx+0x4] |
||
24 | jl @f |
||
25 | cmp eax,[ecx+0x8] |
||
26 | jg @f |
||
27 | cmp ebx,[ecx+0xC] |
||
28 | jg @f |
||
29 | stc |
||
30 | ret |
||
31 | @@: clc |
||
32 | ret |
||
617 | mikedld | 33 | endp |
258 | mikedld | 34 | |
35 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 36 | proc check_bottom_right ;///////////////////////////////////////////////////// |
258 | mikedld | 37 | ;----------------------------------------------------------------------------- |
38 | push eax |
||
297 | mikedld | 39 | mov eax,[cur_editor.TopLeft.Y] |
617 | mikedld | 40 | or eax,eax |
41 | jns @f |
||
42 | xor eax,eax |
||
43 | mov [cur_editor.TopLeft.Y],eax |
||
44 | @@: add eax,[lines.scr] |
||
297 | mikedld | 45 | cmp eax,[cur_editor.Lines.Count] |
258 | mikedld | 46 | jbe .lp1 |
297 | mikedld | 47 | mov eax,[cur_editor.Lines.Count] |
258 | mikedld | 48 | sub eax,[lines.scr] |
49 | jns @f |
||
50 | xor eax,eax |
||
297 | mikedld | 51 | @@: mov [cur_editor.TopLeft.Y],eax |
52 | .lp1: mov eax,[cur_editor.TopLeft.X] |
||
617 | mikedld | 53 | or eax,eax |
54 | jns @f |
||
55 | xor eax,eax |
||
56 | mov [cur_editor.TopLeft.X],eax |
||
57 | @@: add eax,[columns.scr] |
||
297 | mikedld | 58 | cmp eax,[cur_editor.Columns.Count] |
258 | mikedld | 59 | jbe .exit |
297 | mikedld | 60 | mov eax,[cur_editor.Columns.Count] |
258 | mikedld | 61 | sub eax,[columns.scr] |
62 | jns @f |
||
63 | xor eax,eax |
||
297 | mikedld | 64 | @@: mov [cur_editor.TopLeft.X],eax |
258 | mikedld | 65 | .exit: |
66 | pop eax |
||
67 | ret |
||
617 | mikedld | 68 | endp |
258 | mikedld | 69 | |
70 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 71 | proc get_real_length ;//////////////////////////////////////////////////////// |
258 | mikedld | 72 | ;----------------------------------------------------------------------------- |
987 | mikedld | 73 | mov eax,[esi+EDITOR_LINE_DATA.Size] |
74 | @@: cmp byte[esi+eax+sizeof.EDITOR_LINE_DATA-1],' ' |
||
258 | mikedld | 75 | jne @f |
76 | dec eax |
||
77 | jnz @b |
||
78 | @@: ret |
||
617 | mikedld | 79 | endp |
258 | mikedld | 80 | |
81 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 82 | proc get_line_offset ;//////////////////////////////////////////////////////// |
258 | mikedld | 83 | ;----------------------------------------------------------------------------- |
84 | ; Input: |
||
85 | ; ECX = line number |
||
86 | ; Output: |
||
87 | ; ESI = line data offset |
||
88 | ;----------------------------------------------------------------------------- |
||
89 | push eax ecx |
||
297 | mikedld | 90 | mov esi,[cur_editor.Lines] |
259 | mikedld | 91 | @@: dec ecx |
92 | js .exit |
||
987 | mikedld | 93 | mov eax,[esi+EDITOR_LINE_DATA.Size] |
94 | lea esi,[esi+eax+sizeof.EDITOR_LINE_DATA] |
||
259 | mikedld | 95 | jmp @b |
258 | mikedld | 96 | .exit: |
97 | pop ecx eax |
||
98 | ret |
||
617 | mikedld | 99 | endp |
258 | mikedld | 100 | |
101 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 102 | proc init_sel_vars ;////////////////////////////////////////////////////////// |
258 | mikedld | 103 | ;----------------------------------------------------------------------------- |
104 | pushad |
||
105 | mov [sel.selected],1 |
||
297 | mikedld | 106 | mov eax,[ebp+EDITOR.SelStart.X] |
107 | mov ebx,[ebp+EDITOR.SelStart.Y] |
||
108 | mov ecx,[ebp+EDITOR.Caret.X] |
||
109 | mov edx,[ebp+EDITOR.Caret.Y] |
||
258 | mikedld | 110 | cmp ebx,edx |
111 | jl .lp2 |
||
112 | jne @f |
||
113 | cmp eax,ecx |
||
114 | jl .lp2 |
||
115 | jne .lp1 |
||
116 | dec [sel.selected] |
||
117 | jmp .lp2 |
||
118 | @@: xchg ebx,edx |
||
119 | .lp1: xchg eax,ecx |
||
120 | .lp2: mov [sel.begin.x],eax |
||
121 | mov [sel.begin.y],ebx |
||
122 | mov [sel.end.x],ecx |
||
123 | mov [sel.end.y],edx |
||
124 | popad |
||
125 | ret |
||
617 | mikedld | 126 | endp |
258 | mikedld | 127 | |
128 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 129 | proc get_scroll_vars ;//////////////////////////////////////////////////////// |
258 | mikedld | 130 | ;----------------------------------------------------------------------------- |
131 | ; Input: |
||
132 | ; EAX = maximum data size (units) |
||
133 | ; EBX = visible data size (units) |
||
134 | ; ECX = current data position (units) |
||
135 | ; EDX = scrolling area size (pixels) |
||
136 | ; Output: |
||
137 | ; EAX = srcoller offset (pixels) |
||
138 | ; EBX = scroller size (pixels) |
||
139 | ;----------------------------------------------------------------------------- |
||
140 | push eax ebx edx |
||
141 | ; sub eax,ebx |
||
142 | mov esi,eax |
||
143 | mov eax,edx |
||
144 | imul ebx |
||
145 | idiv esi |
||
146 | cmp eax,[esp] |
||
147 | jge .null |
||
148 | cmp eax,AMINS |
||
149 | jge @f |
||
150 | neg eax |
||
151 | add eax,AMINS |
||
152 | sub [esp],eax |
||
153 | mov eax,AMINS |
||
154 | @@: mov [esp+4],eax ; scroller size |
||
155 | mov eax,[esp] |
||
156 | imul ecx |
||
157 | idiv esi |
||
158 | or eax,eax |
||
159 | jns @f |
||
160 | xor eax,eax |
||
297 | mikedld | 161 | @@: mov [esp+8],eax ; scroller offset |
258 | mikedld | 162 | add eax,[esp+4] |
163 | cmp eax,[esp] |
||
164 | jle @f |
||
165 | @@: |
||
166 | pop edx ebx eax |
||
167 | ret |
||
168 | .null: |
||
169 | mov dword[esp+4],0 |
||
170 | mov dword[esp+8],0 |
||
171 | jmp @b |
||
617 | mikedld | 172 | endp |
258 | mikedld | 173 | |
174 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 175 | proc uint2strz ;////////////////////////////////////////////////////////////// |
258 | mikedld | 176 | ;----------------------------------------------------------------------------- |
177 | dec ebx |
||
178 | jz @f |
||
179 | xor edx,edx |
||
180 | div ecx |
||
181 | push edx |
||
182 | call uint2strz |
||
183 | pop eax |
||
184 | @@: cmp al,10 |
||
185 | sbb al,$69 |
||
186 | das |
||
187 | stosb |
||
188 | ret |
||
617 | mikedld | 189 | endp |
258 | mikedld | 190 | |
191 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 192 | proc uint2str ;/////////////////////////////////////////////////////////////// |
258 | mikedld | 193 | ;----------------------------------------------------------------------------- |
194 | cmp eax,ecx |
||
195 | jb @f |
||
196 | xor edx,edx |
||
197 | div ecx |
||
198 | push edx |
||
199 | call uint2str |
||
200 | pop eax |
||
201 | @@: cmp al,10 |
||
202 | sbb al,$69 |
||
203 | das |
||
204 | stosb |
||
205 | ret |
||
617 | mikedld | 206 | endp |
258 | mikedld | 207 | |
208 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 209 | proc strlen ;///////////////////////////////////////////////////////////////// |
259 | mikedld | 210 | ;----------------------------------------------------------------------------- |
211 | push ebx |
||
212 | mov ebx,eax |
||
213 | xor eax,eax |
||
214 | @@: cmp byte[ebx+eax],0 |
||
215 | je @f |
||
216 | inc eax |
||
217 | jmp @b |
||
218 | @@: pop ebx |
||
219 | ret |
||
617 | mikedld | 220 | endp |
259 | mikedld | 221 | |
222 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 223 | proc rgb_to_gray ;//////////////////////////////////////////////////////////// |
258 | mikedld | 224 | ;----------------------------------------------------------------------------- |
225 | push 0 eax |
||
226 | and dword[esp],0x000000FF |
||
227 | fild dword[esp] |
||
228 | fmul [float_gray_b] |
||
229 | shr eax,8 |
||
230 | mov [esp],eax |
||
231 | and dword[esp],0x000000FF |
||
232 | fild dword[esp] |
||
233 | fmul [float_gray_g] |
||
234 | faddp |
||
235 | shr eax,8 |
||
236 | and eax,0x000000FF |
||
237 | mov [esp],eax |
||
238 | fild dword[esp] |
||
239 | fmul [float_gray_r] |
||
240 | faddp |
||
241 | frndint |
||
242 | fist dword[esp] |
||
243 | fist dword[esp+1] |
||
244 | fistp dword[esp+2] |
||
245 | pop eax |
||
246 | add esp,4 |
||
247 | ret |
||
617 | mikedld | 248 | endp |
258 | mikedld | 249 | |
250 | ;float_gray_r dd 0.30f |
||
251 | ;float_gray_g dd 0.59f |
||
252 | ;float_gray_b dd 0.11f |
||
253 | |||
254 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 255 | proc get_active_menu_item ;/////////////////////////////////////////////////// |
258 | mikedld | 256 | ;----------------------------------------------------------------------------- |
257 | pushad |
||
258 | mov [mi_cur],0 |
||
259 | mcall 37,1 |
||
260 | movsx ebx,ax |
||
261 | sar eax,16 |
||
262 | mov ecx,__rc |
||
263 | pushd 2 0 (main_menu.width+7) (ATOPH-2) |
||
264 | popd [__rc+0xC] [__rc+0x8] [__rc+0x4] [__rc+0x0] |
||
265 | ; add [__rc+0xC],ATOPH-2 |
||
266 | call pt_in_rect |
||
267 | jnc .outside_menu |
||
268 | m2m dword[ecx+0x8],dword[ecx+0x0] |
||
269 | mov edx,main_menu |
||
270 | @@: inc [mi_cur] |
||
271 | movzx esi,word[edx+0] |
||
272 | add [ecx+0x8],esi |
||
273 | call pt_in_rect |
||
274 | jc .exit |
||
275 | m2m dword[ecx+0x0],dword[ecx+0x8] |
||
276 | add edx,8+1 |
||
277 | movzx esi,byte[edx-1] |
||
278 | add edx,esi |
||
279 | cmp byte[edx+8],0 |
||
280 | jne @b |
||
281 | mov [mi_cur],0 |
||
282 | .exit: |
||
283 | popad |
||
284 | ret |
||
285 | .outside_menu: |
||
286 | or [mi_cur],-1 |
||
287 | @@: popad |
||
288 | ret |
||
617 | mikedld | 289 | endp |
258 | mikedld | 290 | |
291 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 292 | proc get_active_popup_item ;////////////////////////////////////////////////// |
258 | mikedld | 293 | ;----------------------------------------------------------------------------- |
294 | pushad |
||
295 | mov [pi_cur],0 |
||
296 | mcall 37,1 |
||
297 | movsx ebx,ax |
||
298 | sar eax,16 |
||
299 | mov ecx,__rc |
||
300 | mov dword[ecx+0x0],0 |
||
301 | mov dword[ecx+0x4],0 |
||
302 | movzx edx,[ebp+POPUP.width] |
||
297 | mikedld | 303 | mov dword[ecx+0x8],edx |
258 | mikedld | 304 | movzx edx,[ebp+POPUP.height] |
297 | mikedld | 305 | mov dword[ecx+0xC],edx |
258 | mikedld | 306 | call pt_in_rect |
307 | jnc .outside_window |
||
308 | inc dword[ecx+0x0] |
||
617 | mikedld | 309 | mov dword[ecx+0x4],2 |
258 | mikedld | 310 | dec dword[ecx+0x8] |
617 | mikedld | 311 | mov dword[ecx+0xC],2+POP_IHEIGHT-1 |
297 | mikedld | 312 | mov edx,[ebp+POPUP.data] |
258 | mikedld | 313 | @@: inc [pi_cur] |
314 | inc edx |
||
315 | movzx esi,byte[edx-1] |
||
316 | cmp byte[edx],'-' |
||
317 | jne .lp1 |
||
318 | pushd [ecx+0xC] |
||
617 | mikedld | 319 | sub dword[ecx+0xC],POP_IHEIGHT-POP_SHEIGHT |
258 | mikedld | 320 | call pt_in_rect |
321 | popd [ecx+0xC] |
||
322 | jc .separator |
||
617 | mikedld | 323 | add dword[ecx+0x4],POP_SHEIGHT |
324 | add dword[ecx+0xC],POP_SHEIGHT |
||
258 | mikedld | 325 | jmp .lp3 |
326 | .lp1: call pt_in_rect |
||
327 | jnc .lp2 |
||
328 | mov eax,[pi_cur] |
||
297 | mikedld | 329 | test byte[ebp+eax-1],1 |
258 | mikedld | 330 | jnz .exit |
331 | jmp .separator |
||
332 | .lp2: add dword[ecx+0x4],POP_IHEIGHT |
||
333 | add dword[ecx+0xC],POP_IHEIGHT |
||
334 | add edx,esi |
||
335 | inc edx |
||
336 | movzx esi,byte[edx-1] |
||
337 | .lp3: add edx,esi |
||
338 | cmp byte[edx],0 |
||
339 | jne @b |
||
340 | .separator: |
||
341 | mov [pi_cur],0 |
||
342 | .exit: |
||
343 | popad |
||
344 | ret |
||
345 | .outside_window: |
||
346 | or [pi_cur],-1 |
||
347 | jmp .exit |
||
617 | mikedld | 348 | endp |
258 | mikedld | 349 | |
350 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 351 | proc line_add_spaces ;//////////////////////////////////////////////////////// |
258 | mikedld | 352 | ;----------------------------------------------------------------------------- |
280 | mikedld | 353 | ; Input: |
354 | ; ESI = line offset |
||
355 | ; ECX = needed line length |
||
356 | ; Output: |
||
357 | ; EAX = delta |
||
258 | mikedld | 358 | ;----------------------------------------------------------------------------- |
280 | mikedld | 359 | xor eax,eax |
258 | mikedld | 360 | pushad |
987 | mikedld | 361 | mov edx,[esi+EDITOR_LINE_DATA.Size] |
258 | mikedld | 362 | cmp ecx,edx |
363 | jbe .exit |
||
364 | sub ecx,edx |
||
987 | mikedld | 365 | lea eax,[ecx+sizeof.EDITOR_LINE_DATA] |
280 | mikedld | 366 | call editor_realloc_lines |
367 | mov [esp+4*7],eax |
||
368 | add esi,eax |
||
258 | mikedld | 369 | push ecx |
297 | mikedld | 370 | mov edi,[cur_editor.Lines] |
987 | mikedld | 371 | add edi,[cur_editor.Lines.Size] ; !!! CHECK THIS!!! add edi,[edi-4] |
259 | mikedld | 372 | dec edi |
258 | mikedld | 373 | mov eax,esi |
374 | mov esi,edi |
||
375 | sub esi,ecx |
||
987 | mikedld | 376 | lea ecx,[eax+sizeof.EDITOR_LINE_DATA] |
297 | mikedld | 377 | add ecx,edx |
258 | mikedld | 378 | push ecx |
379 | neg ecx |
||
380 | lea ecx,[esi+ecx+1] |
||
381 | std |
||
382 | rep movsb |
||
383 | pop edi ecx |
||
987 | mikedld | 384 | add [eax+EDITOR_LINE_DATA.Size],ecx |
258 | mikedld | 385 | mov al,' ' |
386 | cld |
||
387 | rep stosb |
||
388 | .exit: |
||
389 | popad |
||
390 | ret |
||
617 | mikedld | 391 | endp |
258 | mikedld | 392 | |
393 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 394 | proc delete_selection ;/////////////////////////////////////////////////////// |
258 | mikedld | 395 | ;----------------------------------------------------------------------------- |
259 | mikedld | 396 | ; call init_sel_vars |
397 | |||
258 | mikedld | 398 | cmp [sel.selected],0 |
399 | je .exit.2 |
||
400 | |||
401 | pushad |
||
402 | mov ecx,[sel.begin.y] |
||
403 | cmp ecx,[sel.end.y] |
||
404 | je .single_line |
||
405 | call get_line_offset |
||
987 | mikedld | 406 | and [esi+EDITOR_LINE_DATA.Flags],not EDITOR_LINE_FLAG_SAVED |
407 | or [esi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED |
||
258 | mikedld | 408 | mov ecx,[sel.begin.x] |
409 | call line_add_spaces |
||
280 | mikedld | 410 | add esi,eax |
987 | mikedld | 411 | lea edi,[esi+sizeof.EDITOR_LINE_DATA] |
258 | mikedld | 412 | mov ecx,[sel.end.y] |
413 | call get_line_offset |
||
414 | call get_real_length |
||
415 | cmp eax,[sel.end.x] |
||
416 | jbe @f |
||
417 | mov eax,[sel.end.x] |
||
987 | mikedld | 418 | @@: mov ecx,[esi+EDITOR_LINE_DATA.Size] |
258 | mikedld | 419 | sub ecx,eax |
420 | mov ebx,[sel.begin.x] |
||
421 | add ebx,ecx |
||
987 | mikedld | 422 | mov [edi-sizeof.EDITOR_LINE_DATA+EDITOR_LINE_DATA.Size],ebx |
258 | mikedld | 423 | add edi,[sel.begin.x] |
987 | mikedld | 424 | lea esi,[esi+eax+sizeof.EDITOR_LINE_DATA] |
297 | mikedld | 425 | mov ecx,[cur_editor.Lines] |
824 | mikedld | 426 | add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4] |
258 | mikedld | 427 | sub ecx,esi |
428 | cld |
||
429 | rep movsb |
||
430 | mov eax,[sel.end.y] |
||
431 | sub eax,[sel.begin.y] |
||
297 | mikedld | 432 | sub [cur_editor.Lines.Count],eax |
258 | mikedld | 433 | jmp .exit |
434 | |||
435 | .single_line: |
||
436 | call get_line_offset |
||
987 | mikedld | 437 | and [esi+EDITOR_LINE_DATA.Flags],not EDITOR_LINE_FLAG_SAVED |
438 | or [esi+EDITOR_LINE_DATA.Flags],EDITOR_LINE_FLAG_MOFIFIED |
||
258 | mikedld | 439 | call get_real_length |
440 | cmp eax,[sel.begin.x] |
||
441 | jbe .exit |
||
442 | mov ecx,[sel.end.x] |
||
443 | cmp ecx,eax |
||
444 | jbe @f |
||
445 | mov ecx,eax |
||
446 | @@: sub ecx,[sel.begin.x] |
||
987 | mikedld | 447 | sub [esi+EDITOR_LINE_DATA.Size],ecx |
448 | lea edi,[esi+sizeof.EDITOR_LINE_DATA] |
||
258 | mikedld | 449 | add edi,[sel.begin.x] |
450 | lea esi,[edi+ecx] |
||
297 | mikedld | 451 | mov ecx,[cur_editor.Lines] |
824 | mikedld | 452 | add ecx,[cur_editor.Lines.Size] ;*** add ecx,[ecx-4] |
258 | mikedld | 453 | sub ecx,esi |
454 | cld |
||
455 | rep movsb |
||
456 | |||
457 | .exit: |
||
458 | mov eax,[sel.begin.x] |
||
297 | mikedld | 459 | mov [cur_editor.Caret.X],eax |
460 | mov [cur_editor.SelStart.X],eax |
||
258 | mikedld | 461 | mov eax,[sel.begin.y] |
297 | mikedld | 462 | mov [cur_editor.Caret.Y],eax |
463 | mov [cur_editor.SelStart.Y],eax |
||
280 | mikedld | 464 | |
465 | mov ecx,[cur_editor.Lines.Count] |
||
466 | call get_line_offset |
||
987 | mikedld | 467 | mov eax,[esi+EDITOR_LINE_DATA.Size] |
468 | lea esi,[esi+eax+sizeof.EDITOR_LINE_DATA] |
||
280 | mikedld | 469 | mov eax,[cur_editor.Lines] |
824 | mikedld | 470 | add eax,[cur_editor.Lines.Size] ;*** add eax,[eax-4] |
280 | mikedld | 471 | sub esi,eax |
472 | lea eax,[esi+4096] |
||
473 | call editor_realloc_lines |
||
474 | |||
258 | mikedld | 475 | popad |
297 | mikedld | 476 | mov [cur_editor.Modified],1 |
258 | mikedld | 477 | clc |
478 | ret |
||
479 | |||
480 | .exit.2: |
||
481 | stc |
||
482 | ret |
||
617 | mikedld | 483 | endp |
259 | mikedld | 484 | |
485 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 486 | proc get_selection_size ;///////////////////////////////////////////////////// |
259 | mikedld | 487 | ;----------------------------------------------------------------------------- |
488 | push ecx esi |
||
489 | mov ecx,[sel.end.y] |
||
490 | inc ecx |
||
491 | call get_line_offset |
||
492 | mov eax,esi |
||
493 | mov ecx,[sel.begin.y] |
||
494 | call get_line_offset |
||
495 | sub eax,esi |
||
496 | pop esi ecx |
||
497 | ret |
||
617 | mikedld | 498 | endp |
259 | mikedld | 499 | |
500 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 501 | proc get_lines_in_file ;////////////////////////////////////////////////////// |
259 | mikedld | 502 | ;----------------------------------------------------------------------------- |
280 | mikedld | 503 | ; Input: |
504 | ; ESI = data pointer |
||
505 | ; ECX = data length |
||
506 | ; Output: |
||
507 | ; EAX = lines number |
||
508 | ; EBX = extra length after tabs expansion |
||
259 | mikedld | 509 | ;----------------------------------------------------------------------------- |
280 | mikedld | 510 | push ecx edx esi 0 |
259 | mikedld | 511 | or ebx,-1 |
280 | mikedld | 512 | xor edx,edx |
259 | mikedld | 513 | .lp0: inc ebx |
514 | .lp1: dec ecx |
||
515 | jle .lp2 |
||
516 | lodsb |
||
280 | mikedld | 517 | cmp al,0 |
518 | je .lp2 |
||
519 | cmp al,9 |
||
520 | je .TB |
||
259 | mikedld | 521 | cmp al,10 |
522 | je .LF |
||
523 | cmp al,13 |
||
524 | je .CR |
||
280 | mikedld | 525 | inc edx |
259 | mikedld | 526 | jmp .lp1 |
280 | mikedld | 527 | .lp2: lea eax,[ebx+1] |
528 | pop ebx esi edx ecx |
||
259 | mikedld | 529 | ret |
530 | |||
531 | .CR: cmp byte[esi],10 |
||
280 | mikedld | 532 | jne .LF |
259 | mikedld | 533 | lodsb |
280 | mikedld | 534 | .LF: xor edx,edx |
535 | jmp .lp0 |
||
536 | .TB: and edx,00000111b |
||
537 | add dword[esp],ATABW |
||
538 | sub [esp],edx |
||
539 | xor edx,edx |
||
540 | jmp .lp1 |
||
617 | mikedld | 541 | endp |
259 | mikedld | 542 | |
543 | ;----------------------------------------------------------------------------- |
||
617 | mikedld | 544 | proc update_caption ;///////////////////////////////////////////////////////// |
297 | mikedld | 545 | ;----------------------------------------------------------------------------- |
546 | lea esi,[cur_editor.FilePath] |
||
547 | mov edi,s_title |
||
548 | |||
327 | mikedld | 549 | xor ecx,ecx |
297 | mikedld | 550 | @@: lodsb |
551 | cmp al,0 |
||
552 | je @f |
||
553 | stosb |
||
327 | mikedld | 554 | inc ecx |
297 | mikedld | 555 | jmp @b |
556 | @@: |
||
327 | mikedld | 557 | push ecx |
297 | mikedld | 558 | mov dword[edi],' - ' |
559 | add edi,3 |
||
327 | mikedld | 560 | mov esi,htext |
297 | mikedld | 561 | mov ecx,htext.size |
562 | cld |
||
563 | rep movsb |
||
564 | |||
565 | mov al,0 |
||
566 | stosb |
||
567 | |||
568 | mcall 71,1,s_title |
||
569 | |||
327 | mikedld | 570 | cmp [do_not_draw],0 |
571 | jne @f |
||
572 | lea esi,[cur_editor.FilePath] |
||
573 | mov edi,tb_opensave.text |
||
574 | mov ecx,[esp] |
||
575 | cld |
||
576 | rep movsb |
||
577 | pop ecx |
||
578 | mov [tb_opensave.length],cl |
||
297 | mikedld | 579 | clc |
580 | ret |
||
327 | mikedld | 581 | @@: |
582 | add esp,4 |
||
583 | clc |
||
584 | ret |
||
617 | mikedld | 585 | endp |
297 | mikedld | 586 |