Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
122 | diamond | 1 | ; SYSTEM HEADER: |
111 | heavyiron | 2 | use32 |
3 | org 0x0 |
||
4 | db 'MENUET01' ; identifier |
||
5 | dd 0x01 ; version |
||
6 | dd START ; pointer to start |
||
7 | dd TINYPAD_END ; size of file |
||
8 | dd 0x300f00 ;0x500000; 0x3fff00;0x300000 ; size of memory |
||
9 | dd 0xeff0 ;0x4fffff ;0x3ff000;0xeff0 ; esp |
||
10 | dd I_PARAM ; parameters |
||
11 | dd 0 ; reserved |
||
122 | diamond | 12 | include 'ascl.inc' |
111 | heavyiron | 13 | include 'lang.inc' |
14 | include 'macros.inc' ; useful stuff |
||
15 | include 'dialogs1.inc' |
||
16 | include 'scroll.inc' |
||
122 | diamond | 17 | include 'debug.inc' |
111 | heavyiron | 18 | purge mov ; SPEED |
19 | ;****************************************************************************** |
||
20 | ; INITIALIZING |
||
21 | START: |
||
22 | ;debug_print_hex TINYPAD_END |
||
23 | call mask_events |
||
24 | |||
25 | cmp [I_PARAM],byte 0 |
||
26 | jz noparams |
||
27 | |||
122 | diamond | 28 | ;//Willow |
29 | cmp byte[I_PARAM],'*' |
||
30 | jne .noipc |
||
31 | ; convert size from decimal representation to dword |
||
32 | mov esi, I_PARAM+1 |
||
33 | xor edx, edx |
||
34 | xor eax, eax |
||
35 | @@: |
||
36 | lodsb |
||
37 | test al, al |
||
38 | jz @f |
||
39 | lea edx, [edx*4+edx] |
||
40 | lea edx, [edx*2+eax] |
||
41 | jmp @b |
||
42 | @@: |
||
43 | add edx,20 |
||
44 | mcall 60,1,0x10000-16 |
||
45 | mov dword[0x10000+-16+4],8 |
||
46 | mcall 40,1000000b |
||
47 | mcall 23,200 |
||
48 | ; dpd eax |
||
49 | cmp eax,7 |
||
50 | jne exit_now |
||
51 | mov esi,0x10000-16 |
||
52 | mov byte[esi],1 |
||
53 | call mask_events |
||
54 | mov eax,[esi+12] |
||
55 | inc eax |
||
56 | call file_found |
||
57 | jmp do_load_file.restorecursor |
||
58 | .noipc: |
||
59 | ;//Willow |
||
111 | heavyiron | 60 | ; parameters are at I_PARAM |
61 | mov esi,I_PARAM |
||
62 | mov edi,filename |
||
63 | mov ecx,50 |
||
64 | cld |
||
65 | rep movsb |
||
66 | |||
67 | mov edi,filename |
||
68 | mov ecx,50 |
||
69 | xor eax,eax |
||
70 | repne scasb |
||
71 | sub edi,filename |
||
72 | dec edi |
||
73 | mov [filename_len],edi |
||
74 | jmp do_load_file |
||
75 | noparams: |
||
76 | jmp newfile |
||
77 | ;****************************************************************************** |
||
78 | ; MAIN LOOP |
||
79 | still: |
||
80 | call writepos ; write current position & number of strings |
||
81 | call mouse_info |
||
82 | |||
83 | mov eax,10 ; wait here until event |
||
84 | int 0x40 |
||
85 | |||
86 | cmp eax,1 |
||
87 | je red |
||
88 | cmp eax,2 |
||
89 | je key |
||
90 | cmp eax,3 |
||
91 | je button |
||
92 | cmp eax,6 |
||
93 | je mouse |
||
94 | jmp still |
||
95 | ;****************************************************************************** |
||
96 | ; ********************************* |
||
97 | ; * MOUSE * |
||
98 | ; ********************************* |
||
99 | mouse: |
||
100 | mov eax,37 ;mouse click |
||
101 | mov ebx,2 |
||
102 | int 0x40 |
||
103 | cmp eax,0 |
||
104 | je .leave_now |
||
105 | ;if exit window is on |
||
106 | cmp [exit_wnd_on],1 |
||
107 | jne @f |
||
108 | mov [exit_wnd_on],0 |
||
109 | jmp red |
||
110 | ;else |
||
111 | @@: |
||
112 | cmp eax,1 ;mouse 1 |
||
113 | jne .leave_now |
||
114 | |||
115 | mov eax,37 ;mouse position |
||
116 | mov ebx,1 |
||
117 | int 0x40 |
||
118 | |||
119 | mov word[mouse_y],ax |
||
120 | shr eax,16 |
||
121 | mov word[mouse_x],ax |
||
122 | |||
123 | |||
124 | cmp [mouse_x],7 |
||
125 | jb .leave_now ;.leave_now ;if < |
||
126 | cmp [mouse_x],485;487 |
||
127 | ja .leave_now ;.leave_now ;if > |
||
128 | |||
129 | cmp [mouse_y],45 |
||
130 | jb .leave_now ;.leave_now ;if < |
||
131 | cmp [mouse_y],342 ;345 |
||
132 | ja .leave_now ;.leave_now ;if > |
||
133 | |||
134 | call main_cursor_move |
||
135 | |||
136 | .leave_now: |
||
137 | jmp still |
||
138 | |||
139 | ; ********************************* |
||
140 | ; * BUTTON HANDLER * |
||
141 | ; ********************************* |
||
142 | |||
143 | button: |
||
144 | |||
145 | mov eax,17 |
||
146 | int 0x40 |
||
147 | ;;;;;;;;;;;;;;;exit dialog box check;;;;;;;;;;;;; |
||
148 | cmp ah,49 |
||
149 | je save_and_exit |
||
150 | cmp ah,48 |
||
151 | je exit_now |
||
152 | cmp ah,47 |
||
153 | mov [exit_wnd_on],0 |
||
154 | je red |
||
155 | cmp ah,46 |
||
156 | jne @f |
||
157 | |||
158 | call save_file |
||
159 | jmp newfile |
||
160 | @@: |
||
161 | cmp ah,45 |
||
162 | je newfile |
||
163 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
164 | ;;;;;;;;;;;;;;;;MENU CHECK;;;;;;;;;;;;;;;;;;;;;;; |
||
165 | cmp ah,15 |
||
166 | jne no_d_w |
||
167 | call draw_window_for_dialogs |
||
168 | jmp still |
||
169 | no_d_w: |
||
170 | cmp ah,97 |
||
171 | je draw_win_menu_file |
||
172 | cmp ah,98 |
||
173 | je draw_win_menu_code |
||
174 | cmp ah,96 |
||
175 | je draw_win_menu_text |
||
176 | cmp ah,95 |
||
177 | je goto_string |
||
178 | cmp ah,92 |
||
179 | je search_window |
||
180 | cmp ah,94 |
||
181 | je red |
||
182 | cmp ah,99 |
||
183 | je help_wnd |
||
184 | cmp ah,100 |
||
185 | je new_pad_wnd |
||
186 | cmp ah,101 |
||
187 | je doyouwannasave |
||
188 | cmp ah,102 |
||
189 | jne nosavenow |
||
190 | for_key_save: |
||
191 | savedialog draw_window_for_dialogs,copy_fpath_s,saveerror,mypath |
||
192 | nosavenow: |
||
193 | cmp ah,103 |
||
194 | jne noopennow |
||
195 | for_key_open: |
||
196 | opendialog draw_window_for_dialogs,copy_fpath,openerror,mypath |
||
197 | noopennow: |
||
198 | cmp ah,104 |
||
199 | je exit |
||
200 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
201 | shr eax,8 |
||
202 | |||
203 | cmp al,50 |
||
204 | jne no_search |
||
205 | |||
206 | ; SEARCH { |
||
207 | search: |
||
208 | |||
209 | cmp [lines],1 ;something like bug fix |
||
210 | je red ;still |
||
211 | |||
212 | xor esi,esi |
||
213 | mov edi,[post] |
||
214 | add edi,80 |
||
215 | imul ecx,[lines],80 |
||
216 | sub ecx,edi ; ecx (loop counter) = lines*80-(post+80) |
||
217 | news: |
||
218 | push edi |
||
219 | news2: |
||
220 | |||
221 | ; 1) LOAD BYTES |
||
222 | mov al,[esi+search_string] |
||
223 | mov bl,[edi+0x80000] |
||
224 | |||
225 | ; 2) COMPARE BYTES |
||
226 | cmp al,bl |
||
227 | je yes_char |
||
228 | |||
229 | ; 3) LETTER? |
||
230 | cmp al,'A' |
||
231 | jb notequal |
||
232 | cmp al,'z' |
||
233 | ja notequal |
||
234 | |||
235 | ; 4) A->a OR a->A |
||
236 | cmp al,'a' |
||
237 | jb @f |
||
238 | add al,-32 |
||
239 | jmp compare_bytes |
||
240 | @@: |
||
241 | cmp al,'Z' |
||
242 | ja notequal |
||
243 | add al,32 |
||
244 | |||
245 | compare_bytes: |
||
246 | cmp al,bl |
||
247 | jne notequal |
||
248 | |||
249 | yes_char: |
||
250 | inc edi |
||
251 | inc esi |
||
252 | cmp esi,[search_len] |
||
253 | jge sfound |
||
254 | jmp news2 |
||
255 | |||
256 | notequal: |
||
257 | pop edi |
||
258 | xor esi,esi |
||
259 | inc edi |
||
260 | loop news |
||
261 | call string_not_found |
||
262 | jmp still |
||
263 | |||
264 | sfound: |
||
265 | mov eax,edi |
||
266 | cdq ; edx = 0; |
||
267 | mov ebx,80 |
||
268 | div ebx |
||
269 | ;;;;; imul eax,80 |
||
270 | ; lea eax,[eax+eax*4] ; eax *= 5; |
||
271 | ; shl eax,4 ; eax *= 16; |
||
272 | |||
273 | ; mov [post],eax |
||
274 | mov [posy],0 |
||
275 | ;--------------- |
||
276 | ; mov ebx,80 |
||
277 | ; div ebx |
||
278 | call goto_pos |
||
279 | call draw_vertical_scroll |
||
280 | jmp still |
||
281 | ; SEARCH } |
||
282 | |||
283 | no_search: |
||
284 | |||
285 | ; TOOLBAR { |
||
286 | cmp eax,10000 |
||
287 | jb no_toolbar |
||
288 | |||
289 | add eax,-10000 |
||
290 | jne @f |
||
291 | lbl_compile_file: |
||
292 | mov [run_outfile],0 |
||
293 | call start_fasm |
||
294 | jmp still |
||
295 | @@: |
||
296 | dec eax |
||
297 | jnz @f |
||
298 | lbl_run_outfile: |
||
299 | mov [run_outfile],1 |
||
300 | call start_fasm |
||
301 | jmp still |
||
302 | @@: |
||
303 | dec eax |
||
304 | jnz @f |
||
305 | call open_debug_board |
||
306 | jmp still |
||
307 | @@: |
||
308 | dec eax |
||
309 | jnz still |
||
310 | call open_sysfuncs_txt |
||
311 | jmp still |
||
312 | ; TOOLBAR } |
||
313 | |||
314 | no_toolbar: |
||
315 | |||
316 | cmp al,4 |
||
317 | jne noid4 |
||
318 | |||
319 | ; LOAD_FILE { |
||
320 | do_load_file: |
||
321 | mov [modified],0 |
||
322 | |||
323 | call empty_work_space |
||
324 | |||
325 | |||
326 | cmp [filename],'/' |
||
327 | jne @f |
||
328 | |||
329 | call loadhdfile |
||
330 | jmp .restorecursor |
||
331 | @@: |
||
332 | call loadfile1 |
||
333 | .restorecursor: |
||
334 | mov edi,0x78000 |
||
335 | mov ecx,80*80/4 |
||
336 | mov eax,0x01010101 |
||
337 | cld |
||
338 | rep stosd |
||
339 | xor eax,eax |
||
340 | mov [post],eax |
||
341 | mov [posx],eax |
||
342 | mov [posy],eax |
||
343 | |||
344 | ; enable color syntax for ASM and INC files: |
||
345 | mov [asm_mode], 0 |
||
346 | |||
347 | mov eax, [filename_len] |
||
348 | add eax, filename |
||
349 | cmp word [eax-3],'AS' |
||
350 | jne @f |
||
351 | cmp byte [eax-1],'M' |
||
352 | jne @f |
||
353 | mov [asm_mode], 1 |
||
354 | jmp .nocol |
||
355 | @@: |
||
356 | cmp word [eax-3],'IN' |
||
357 | jne @f |
||
358 | cmp byte [eax-1],'C' |
||
359 | jne @f |
||
360 | mov [asm_mode], 1 |
||
361 | @@: |
||
362 | .nocol: |
||
363 | |||
364 | ; if the header is the same as the previous, |
||
365 | ; just redraw the text area |
||
366 | ; else redraw the window |
||
367 | |||
368 | ;------pos00=filename_len |
||
369 | mov eax,[filename_len] |
||
370 | mov [pos00],eax |
||
371 | ;------------------------- |
||
372 | mov ecx, [filename_len] |
||
373 | add ecx, 10 ; strlen(" - TINYPAD"); |
||
374 | cmp ecx, [headlen] |
||
375 | jne @f |
||
376 | add ecx, -10 |
||
377 | mov esi, filename ; strcmp(filename,header); |
||
378 | mov edi, header |
||
379 | rep cmpsb |
||
380 | jne @f |
||
381 | call drawfile |
||
382 | call draw_window_for_dialogs ;redraw, because it's needed |
||
383 | cmp [to_return],0 |
||
384 | je still |
||
385 | ret |
||
386 | ;jmp still |
||
387 | @@: |
||
388 | call set_title |
||
389 | cmp [to_return],0 |
||
390 | je still |
||
391 | ret |
||
392 | ; jmp still |
||
393 | ; LOAD_FILE } |
||
394 | |||
395 | noid4: |
||
396 | |||
397 | cmp al, 2 |
||
398 | jz yessave |
||
399 | |||
400 | dec al ; close if butid == 0 |
||
401 | jnz nosave |
||
402 | ; EXIT: |
||
403 | exit: |
||
404 | cmp [modified],0 |
||
405 | je exit_now |
||
406 | |||
407 | mov eax,55 ; beep |
||
408 | mov ebx,eax |
||
409 | mov esi,save_beep1 |
||
410 | int 0x40 |
||
411 | delay 4 |
||
412 | mov eax,55 ; beep |
||
413 | mov ebx,eax |
||
414 | mov esi,save_beep2 |
||
415 | int 0x40 |
||
416 | |||
417 | ;---------"EXIT" dialog box |
||
418 | |||
419 | mov eax,13 |
||
420 | mov ebx,150*65536+200 |
||
421 | mov ecx,100*65536+70 |
||
422 | mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512 |
||
423 | int 0x40 |
||
424 | |||
425 | |||
426 | mov eax,38 |
||
427 | mov ebx,150*65536+350 |
||
428 | mov ecx,100*65536+100 |
||
429 | mov edx,cl_White |
||
430 | int 0x40 |
||
431 | mov eax,38 |
||
432 | mov ebx,150*65536+350 |
||
433 | mov ecx,170*65536+170 |
||
434 | mov edx,cl_White |
||
435 | int 0x40 |
||
436 | mov eax,38 |
||
437 | mov ebx,150*65536+150 |
||
438 | mov ecx,100*65536+170 |
||
439 | mov edx,cl_White |
||
440 | int 0x40 |
||
441 | mov eax,38 |
||
442 | mov ebx,350*65536+350 |
||
443 | mov ecx,100*65536+170 |
||
444 | mov edx,cl_White |
||
445 | int 0x40 |
||
446 | |||
447 | |||
122 | diamond | 448 | if lang eq ru |
111 | heavyiron | 449 | putlabel 190,120,'Сохранить документ?',cl_White |
450 | |||
451 | drawlbut 170,140,30,15,'Да',49,[sc.work_button],cl_White |
||
452 | drawlbut 230,140,30,15,'Нет',48,[sc.work_button],cl_White |
||
453 | drawlbut 290,140,45,15,'Отмена',47,[sc.work_button],cl_White |
||
122 | diamond | 454 | else |
455 | putlabel 190,120,'Save the document?',cl_White |
||
111 | heavyiron | 456 | |
122 | diamond | 457 | drawlbut 170,140,30,15,'Yes',49,[sc.work_button],cl_White |
458 | drawlbut 230,140,30,15,'No',48,[sc.work_button],cl_White |
||
459 | drawlbut 290,140,45,15,'Cancel',47,[sc.work_button],cl_White |
||
460 | end if |
||
461 | |||
111 | heavyiron | 462 | mov [exit_wnd_on],1 |
463 | ;---------------- |
||
464 | |||
465 | jmp still |
||
466 | |||
467 | exit_now: |
||
468 | mov [MainWndClosed], 1 |
||
469 | or eax, -1 |
||
470 | int 0x40 |
||
471 | |||
472 | save_and_exit: |
||
473 | call save_file |
||
474 | jmp exit_now |
||
475 | ; mov [MainWndClosed], 1 |
||
476 | ; or eax, -1 |
||
477 | ; int 0x40 |
||
478 | |||
479 | ; SAVE_FILE { |
||
480 | yessave: |
||
481 | call clear_screen |
||
482 | call drawwindow |
||
483 | call save_file |
||
484 | ; call clear_screen |
||
485 | ; call drawwindow |
||
486 | mov [modified],0 |
||
487 | |||
488 | jmp still |
||
489 | ; SAVE_FILE } |
||
490 | |||
491 | nosave: |
||
492 | |||
493 | inc al |
||
494 | call read_string |
||
495 | |||
496 | jmp still |
||
497 | |||
498 | ;********************************** |
||
499 | ;* REDRAW HANDLER * |
||
500 | ;********************************** |
||
501 | |||
502 | red: |
||
503 | ; перерисовка окна |
||
504 | call clear_screen |
||
505 | call drawwindow |
||
506 | jmp still |
||
507 | |||
508 | |||
509 | |||
510 | ;********************************** |
||
511 | ;* KEY HANDLER * |
||
512 | ;********************************** |
||
513 | |||
514 | key: |
||
515 | mov eax, 2 ; GET KEY |
||
516 | int 0x40 |
||
517 | |||
518 | cmp [exit_wnd_on],1 ;exit window is ON? |
||
519 | jne no_exit_wnd ; no - goto other checks |
||
520 | |||
521 | ; cmp eax,13 ;enter - save n exit |
||
522 | ; je save_and_exit |
||
523 | |||
524 | ; cmp eax,173 ;ctrl+enter - exit |
||
525 | ; je exit_now |
||
526 | mov [exit_wnd_on],0 ;other keys - cancel |
||
527 | ; call draw_window_for_dialogs |
||
528 | |||
529 | jmp red ;redraw and still |
||
530 | |||
531 | |||
532 | no_exit_wnd: |
||
533 | shr eax, 8 |
||
534 | |||
535 | ; HELP_TEXT { |
||
536 | cmp al, 210 ; Ctrl + F1 |
||
537 | jne no_help_text |
||
538 | help_wnd: |
||
539 | call clear_screen |
||
540 | call drawwindow |
||
541 | mov eax, 51 |
||
542 | mov ebx, 1 |
||
543 | mov ecx, help_thread_start |
||
544 | mov edx, 0xfff0 |
||
545 | int 0x40 |
||
546 | jmp still |
||
547 | |||
548 | help_thread_start: |
||
549 | call draw_help_wnd |
||
550 | |||
551 | still_hw: |
||
552 | cmp [MainWndClosed], 1 |
||
553 | je exit_hw |
||
554 | mov eax, 10 |
||
555 | int 0x40 |
||
556 | cmp eax, 1 |
||
557 | je red_hw |
||
558 | cmp eax, 2 |
||
559 | je key_hw |
||
560 | cmp eax, 3 |
||
561 | je button_hw |
||
562 | jmp still_hw |
||
563 | |||
564 | red_hw: |
||
565 | call draw_help_wnd |
||
566 | jmp still_hw |
||
567 | |||
568 | key_hw: |
||
569 | ; mov eax, 2 |
||
570 | int 0x40 |
||
571 | cmp ah, 27 |
||
572 | jne still_hw |
||
573 | |||
574 | button_hw: |
||
575 | mov eax, 17 |
||
576 | int 0x40 |
||
577 | exit_hw: |
||
578 | or eax, -1 |
||
579 | int 0x40 |
||
580 | |||
581 | ; draw help window |
||
582 | draw_help_wnd: |
||
583 | mov eax, 12 |
||
584 | mov ebx, 1 |
||
585 | int 0x40 |
||
586 | |||
587 | xor eax, eax |
||
588 | mov ebx, 200 shl 16 + 320 |
||
589 | mov ecx, 200 shl 16 + 260 |
||
590 | mov edx, 0x03e0e0e0 ; work |
||
591 | mov esi, [sc.grab] |
||
592 | or esi, 0x80000000 ; grab |
||
593 | mov edi, [sc.frame] ; frame |
||
594 | int 0x40 |
||
595 | |||
596 | mov eax, 4 |
||
597 | mov ebx, 8 shl 16 + 8 |
||
598 | mov ecx, 0xffffff |
||
599 | mov edx, help_wnd_header |
||
600 | mov esi, hlphead_len |
||
601 | int 0x40 |
||
602 | |||
603 | mov eax, 4 |
||
604 | mov ebx, 8 shl 16 + 34 |
||
605 | xor ecx, ecx |
||
606 | mov esi, 51 |
||
607 | mov edx, help_text |
||
608 | .new_help_line: |
||
609 | int 0x40 |
||
610 | add ebx, 10 |
||
611 | add edx, esi |
||
612 | cmp [edx], byte 'x' |
||
613 | jne .new_help_line |
||
614 | |||
615 | mov eax, 12 |
||
616 | mov ebx, 2 |
||
617 | int 0x40 |
||
618 | ret |
||
619 | ; HELP_TEXT } |
||
620 | |||
621 | no_help_text: |
||
622 | ; LOAD_FILE { |
||
623 | cmp al, 211 ; Ctrl + F2 |
||
624 | je for_key_open ;do_load_file |
||
625 | ; LOAD_FILE } |
||
626 | |||
627 | ; SEARCH { |
||
628 | cmp al, 212 ; Ctrl + F3 |
||
629 | je search |
||
630 | ; SEARCH } |
||
631 | |||
632 | ; SAVE_FILE { |
||
633 | cmp al, 213 ; Ctrl + F4 |
||
634 | je yessave |
||
635 | ; SAVE_FILE } |
||
636 | |||
637 | ; ENTER_FILENAME { |
||
638 | cmp al, 214 ; Ctrl + F5 |
||
639 | jne @f |
||
640 | jmp for_key_save |
||
641 | @@: |
||
642 | ; ENTER_FILENAME } |
||
643 | |||
644 | ; ENTER_SEARCH { |
||
645 | cmp al, 215 ; Ctrl + F6 |
||
646 | jne @f |
||
647 | ; mov al, 51 |
||
648 | ; call read_string |
||
649 | ; jmp still |
||
650 | jmp search_window |
||
651 | @@: |
||
652 | ; ENTER_SEARCH } |
||
653 | |||
654 | ; CHANGE_LAYOUT { |
||
655 | cmp al, 217 ; Ctrl + F8 |
||
656 | jne @f |
||
657 | call layout |
||
658 | jmp still |
||
659 | @@: |
||
660 | ; CHANGE_LAYOUT } |
||
661 | |||
662 | ; COMPILE_FILE { |
||
663 | cmp al, 208 |
||
664 | je lbl_compile_file |
||
665 | ; COMPILE_FILE } |
||
666 | |||
667 | ; RUN_OUTFILE { |
||
668 | cmp al, 209 |
||
669 | je lbl_run_outfile |
||
670 | |||
671 | ; RUN_OUTFILE } |
||
672 | |||
673 | ;run debug board { ----- |
||
674 | cmp al,255 |
||
675 | jne @f |
||
676 | call open_debug_board |
||
677 | call activate_me |
||
678 | jmp still |
||
679 | ;} |
||
680 | @@: |
||
681 | ;open sysfuncR { ----- |
||
682 | ; cmp al,228 |
||
683 | ; jne @f |
||
684 | ; call open_sysfuncs_txt |
||
685 | ; jmp still |
||
686 | ; @@: |
||
687 | |||
688 | ;fast_save_and_open { |
||
689 | cmp al,216 |
||
690 | jne @f |
||
691 | call make_fast_so |
||
692 | jmp still |
||
693 | ;} |
||
694 | @@: |
||
695 | ; 3 times english -> русский |
||
696 | ; 2 times русский -> english |
||
697 | |||
698 | ; COPY START { |
||
699 | cmp al, 19 |
||
700 | jne no_copy_start |
||
701 | mov eax, [post] |
||
702 | imul ebx, [posy], 80 |
||
703 | add eax, ebx |
||
704 | mov [copy_start], eax |
||
705 | jmp still |
||
706 | ; COPY START } |
||
707 | |||
708 | no_copy_start: |
||
709 | ; COPY END { |
||
710 | cmp al, 5 |
||
711 | jne no_copy_end |
||
712 | cmp [copy_start], 0 |
||
713 | je still |
||
714 | mov ecx, [post] |
||
715 | imul ebx, [posy], 80 |
||
716 | add ecx, ebx |
||
717 | add ecx, 80 |
||
718 | cmp ecx, [copy_count] |
||
719 | jb still |
||
720 | sub ecx, [copy_start] |
||
721 | mov [copy_count], ecx |
||
722 | mov esi, [copy_start] |
||
723 | add esi, 0x80000 |
||
724 | mov edi, 0x2f0000 |
||
725 | cld |
||
726 | rep movsb |
||
727 | jmp still |
||
728 | ; COPY END } |
||
729 | |||
730 | no_copy_end: |
||
731 | |||
732 | ; PASTE { |
||
733 | cmp al, 16 |
||
734 | jne no_copy_paste |
||
735 | cmp [copy_count], 0 |
||
736 | je still |
||
737 | mov eax,[copy_count] |
||
738 | cdq |
||
739 | mov ebx, 80 |
||
740 | div ebx |
||
741 | add [lines], eax |
||
742 | mov ecx, 0x2e0000 |
||
743 | mov eax, [post] |
||
744 | imul ebx, [posy], 80 |
||
745 | add eax, ebx |
||
746 | add eax, 0x80000 |
||
747 | sub ecx, eax |
||
748 | mov esi, 0x2e0000 |
||
749 | sub esi, [copy_count] |
||
750 | mov edi, 0x2e0000 |
||
751 | std |
||
752 | rep movsb |
||
753 | mov esi, 0x2f0000 |
||
754 | mov edi, [post] |
||
755 | imul eax, [posy], 80 |
||
756 | add edi, eax |
||
757 | add edi, 0x80000 |
||
758 | mov ecx, [copy_count] |
||
759 | cld |
||
760 | rep movsb |
||
761 | |||
762 | call clear_screen |
||
763 | call drawfile |
||
764 | call draw_vertical_scroll |
||
765 | mov [modified],1 |
||
766 | |||
767 | jmp still |
||
768 | ; PASTE } |
||
769 | |||
770 | |||
771 | no_copy_paste: |
||
772 | |||
773 | |||
774 | ; INSERT_SEPARATOR { |
||
775 | cmp al,0xc ; Ctrl+L |
||
776 | jne no_insert_separator |
||
777 | |||
778 | imul eax,[posy],80 |
||
779 | add eax,[post] |
||
780 | add eax,0x80000 |
||
781 | mov ebx,eax |
||
782 | |||
783 | imul eax,[lines],80 |
||
784 | add eax,0x80000 ; теперь указывает на конец файла |
||
785 | |||
786 | mov ecx,eax ; size |
||
787 | sub ecx,ebx |
||
788 | inc ecx |
||
789 | |||
790 | mov esi,eax ; from |
||
791 | mov edi,eax |
||
792 | add edi,80 ; to |
||
793 | |||
794 | std |
||
795 | rep movsb |
||
796 | |||
797 | mov ecx,80/4 |
||
798 | mov esi,comment_string |
||
799 | mov edi,ebx |
||
800 | cld |
||
801 | rep movsd |
||
802 | |||
803 | inc [lines] |
||
804 | |||
805 | call clear_screen |
||
806 | call drawfile |
||
807 | ;call calc_scroll_size_and_pos |
||
808 | call draw_vertical_scroll |
||
809 | mov [modified],1 |
||
810 | |||
811 | jmp still |
||
812 | ; INSERT_SEPARATOR } |
||
813 | |||
814 | |||
815 | no_insert_separator: |
||
816 | |||
817 | |||
818 | ; DEL_LINE { |
||
819 | cmp al,4 |
||
820 | jne no_delete_line |
||
821 | mov eax,[post] |
||
822 | cdq |
||
823 | mov ebx,80 |
||
824 | div ebx |
||
825 | add eax,[posy] |
||
826 | inc eax |
||
827 | cmp eax,[lines] |
||
828 | jge still |
||
829 | dec dword [lines] |
||
830 | imul edi,[posy],80 |
||
831 | add edi,[post] |
||
832 | add edi,0x80000 |
||
833 | mov esi,edi |
||
834 | add esi,80 |
||
835 | mov ecx,0x2e0000 |
||
836 | sub ecx,esi |
||
837 | shr ecx,4 |
||
838 | cld |
||
839 | rep movsd |
||
840 | call clear_screen |
||
841 | call drawfile |
||
842 | ;call calc_scroll_size_and_pos |
||
843 | call draw_vertical_scroll |
||
844 | mov [modified],1 |
||
845 | |||
846 | jmp still |
||
847 | ; DEL_LINE } |
||
848 | |||
849 | no_delete_line: |
||
850 | |||
851 | ; ENTER { |
||
852 | cmp al,13 |
||
853 | jnz noenter |
||
854 | |||
855 | ; lines down |
||
856 | mov eax,[posy] |
||
857 | inc eax |
||
858 | ; imul eax,80 |
||
859 | lea eax,[eax+eax*4] ; eax *= 5 |
||
860 | shl eax,4 ; eax *= 16 |
||
861 | add eax,0x80000 |
||
862 | add eax,[post] |
||
863 | mov ebx,eax |
||
864 | |||
865 | ; ebx = ([posy]+1)*80 + 0x80000 + [post] |
||
866 | ; ebx -> first byte of next string |
||
867 | |||
868 | imul eax,[lines],80 |
||
869 | add eax,0x80000 |
||
870 | mov ecx,eax |
||
871 | |||
872 | ; ecx = [lines]*80 + 0x80000 |
||
873 | ; ecx -> end of the document |
||
874 | |||
875 | cmp ebx,ecx |
||
876 | jz .bug_fixed |
||
877 | |||
878 | @@: |
||
879 | dec ecx |
||
880 | mov dl,[ecx] |
||
881 | mov [ecx+80],dl |
||
882 | |||
883 | cmp ecx,ebx |
||
884 | jnz @b |
||
885 | |||
886 | .bug_fixed: |
||
887 | |||
888 | ; save for later |
||
889 | imul eax,[posy],80 |
||
890 | add eax,0x80000 |
||
891 | add eax,[post] |
||
892 | mov ebx,eax |
||
893 | add eax,[posx] |
||
894 | ; eax = 0x80000 + [post] + [posy]*80 + [posx] |
||
895 | |||
896 | push eax |
||
897 | |||
898 | dec ebx |
||
899 | xor ecx,ecx |
||
900 | @@: |
||
901 | cmp ecx,80 |
||
902 | je @f |
||
903 | inc ecx |
||
904 | inc ebx |
||
905 | cmp byte [ebx],' ' |
||
906 | je @b |
||
907 | @@: |
||
908 | dec ecx |
||
909 | |||
910 | cmp ecx,80-1 |
||
911 | jne @f |
||
912 | ; mov [posx],0 |
||
913 | jmp .lbl |
||
914 | @@: |
||
915 | |||
916 | cmp [posx],ecx |
||
917 | jbe @f |
||
918 | mov [posx],ecx |
||
919 | jmp .lbl |
||
920 | @@: |
||
921 | mov [posx],0 |
||
922 | |||
923 | .lbl: |
||
924 | inc [posy] |
||
925 | |||
926 | ;clear line |
||
927 | imul eax,[posy],80 |
||
928 | add eax,0x80000 |
||
929 | add eax,[post] |
||
930 | |||
931 | mov edi,eax |
||
932 | mov eax,' ' |
||
933 | mov ecx,80/4 |
||
934 | cld |
||
935 | rep stosd |
||
936 | |||
937 | |||
938 | ; end of line to next line beginning |
||
939 | imul eax,[posy],80 |
||
940 | add eax,0x80000 |
||
941 | add eax,[post] |
||
942 | ; add eax,[posx] |
||
943 | mov ebx,eax |
||
944 | ; ebx -> beginning of this line |
||
945 | |||
946 | pop esi |
||
947 | mov edi,eax |
||
948 | |||
949 | @@: |
||
950 | mov al,[esi] |
||
951 | mov [ebx],al |
||
952 | mov [esi],byte ' ' |
||
953 | |||
954 | inc esi |
||
955 | inc ebx |
||
956 | |||
957 | cmp esi,edi |
||
958 | jb @b |
||
959 | |||
960 | inc [lines] |
||
961 | |||
962 | mov ecx,[posy] |
||
963 | cmp ecx,[slines] |
||
964 | jne @f |
||
965 | |||
966 | dec [posy] |
||
967 | add [post],80 |
||
968 | |||
969 | @@: |
||
970 | call clear_screen |
||
971 | call drawfile |
||
972 | ;call calc_scroll_size_and_pos |
||
973 | |||
974 | call draw_vertical_scroll |
||
975 | mov [modified],1 |
||
976 | |||
977 | jmp still |
||
978 | ; ENTER } |
||
979 | |||
980 | |||
981 | noenter: |
||
982 | |||
983 | |||
984 | ; UP { |
||
985 | cmp al,130+48 |
||
986 | jnz noup |
||
987 | mov ecx,[posy] |
||
988 | test ecx,ecx |
||
989 | jnz .up1 |
||
990 | mov ecx,[post] |
||
991 | test ecx,ecx |
||
992 | jz still |
||
993 | add ecx,-80 |
||
994 | mov [post],ecx |
||
995 | call clear_screen |
||
996 | jmp .finish |
||
997 | .up1: |
||
998 | dec ecx |
||
999 | mov [posy],ecx |
||
1000 | .finish: |
||
1001 | call drawfile |
||
1002 | call draw_vertical_scroll |
||
1003 | ;call calc_scroll_size_and_pos |
||
1004 | |||
1005 | jmp still |
||
1006 | ; UP } |
||
1007 | |||
1008 | noup: |
||
1009 | |||
1010 | ; DOWN { |
||
1011 | cmp al,129+48 |
||
1012 | jnz nodown |
||
1013 | |||
1014 | mov ecx,[posy] |
||
1015 | mov eax,[slines] |
||
1016 | dec eax |
||
1017 | cmp ecx,eax |
||
1018 | jb .do1 ; goto do1 if [posy] < [slines]-1 |
||
1019 | |||
1020 | mov eax,[lines] |
||
1021 | sub eax,[slines] |
||
1022 | dec eax |
||
1023 | jb still ; goto still if [lines] < [slines]-1 |
||
1024 | ; imul eax,80 |
||
1025 | lea eax,[eax+eax*4] |
||
1026 | shl eax,4 |
||
1027 | cmp [post],eax |
||
1028 | jg still ; goto still if [post] > ([lines]-[slines]-1)*80 |
||
1029 | |||
1030 | add [post],80 |
||
1031 | call clear_screen |
||
1032 | call drawfile |
||
1033 | call draw_vertical_scroll |
||
1034 | ;call calc_scroll_size_and_pos |
||
1035 | |||
1036 | jmp still |
||
1037 | |||
1038 | .do1: |
||
1039 | pusha |
||
1040 | mov eax,[post] |
||
1041 | cdq |
||
1042 | mov ebx,80 |
||
1043 | div ebx |
||
1044 | add eax,[posy] |
||
1045 | inc eax |
||
1046 | cmp eax,[lines] |
||
1047 | jb .do10 |
||
1048 | popa |
||
1049 | jmp still |
||
1050 | |||
1051 | .do10: |
||
1052 | popa |
||
1053 | inc ecx |
||
1054 | mov [posy],ecx |
||
1055 | call drawfile |
||
1056 | call draw_vertical_scroll |
||
1057 | ;call calc_scroll_size_and_pos |
||
1058 | |||
1059 | jmp still |
||
1060 | ; DOWN } |
||
1061 | |||
1062 | |||
1063 | nodown: |
||
1064 | |||
1065 | |||
1066 | ; LEFT { |
||
1067 | cmp al,128+48 |
||
1068 | jnz noleft |
||
1069 | cmp [posx],0 |
||
1070 | je still |
||
1071 | dec [posx] |
||
1072 | call drawfile |
||
1073 | jmp still |
||
1074 | ; LEFT } |
||
1075 | |||
1076 | |||
1077 | noleft: |
||
1078 | |||
1079 | |||
1080 | ; RIGHT { |
||
1081 | cmp al,131+48 |
||
1082 | jnz noright |
||
1083 | cmp [posx],79 |
||
1084 | je still |
||
1085 | inc [posx] |
||
1086 | call drawfile |
||
1087 | jmp still |
||
1088 | ; RIGHT } |
||
1089 | |||
1090 | |||
1091 | noright: |
||
1092 | |||
1093 | |||
1094 | ; PAGE_UP { |
||
1095 | page_up: |
||
1096 | cmp al,136+48 |
||
1097 | jnz nopu |
||
1098 | scrl_up: |
||
1099 | mov eax,[slines] |
||
1100 | dec eax |
||
1101 | ; imul eax,80 |
||
1102 | lea eax,[eax+eax*4] |
||
1103 | shl eax,4 |
||
1104 | mov ecx,[post] |
||
1105 | cmp eax,ecx |
||
1106 | jbe pu1 |
||
1107 | mov ecx,eax |
||
1108 | pu1: |
||
1109 | sub ecx,eax |
||
1110 | mov [post],ecx |
||
1111 | |||
1112 | call clear_screen |
||
1113 | call drawfile |
||
1114 | call draw_vertical_scroll |
||
1115 | ;call calc_scroll_size_and_pos |
||
1116 | jmp still |
||
1117 | ; PAGE_UP } |
||
1118 | |||
1119 | |||
1120 | nopu: |
||
1121 | |||
1122 | |||
1123 | ; PAGE_DOWN { |
||
1124 | page_down: |
||
1125 | cmp al,135+48 |
||
1126 | jnz nopd |
||
1127 | scrl_down: |
||
1128 | mov eax,[lines] |
||
1129 | cmp eax,[slines] |
||
1130 | jb still |
||
1131 | |||
1132 | mov eax,[post] ; eax = offset |
||
1133 | cdq |
||
1134 | mov ebx,80 |
||
1135 | div ebx ; eax /= 80 |
||
1136 | mov ecx,[lines] ; ecx = lines in the file |
||
1137 | cmp eax,ecx ; if eax < ecx goto pfok |
||
1138 | jnb still |
||
1139 | mov eax,[slines] ; eax = lines on the screen |
||
1140 | dec eax ; eax-- |
||
1141 | ; imul eax,80 ; eax *= 80 |
||
1142 | lea eax,[eax+eax*4] |
||
1143 | shl eax,4 |
||
1144 | add [post],eax ; offset += eax |
||
1145 | |||
1146 | mov eax,[lines] ; eax = lines in the file |
||
1147 | sub eax,[slines] ; eax -= lines on the screen |
||
1148 | ; imul eax,80 ; eax *= 80 |
||
1149 | lea eax,[eax+eax*4] |
||
1150 | shl eax,4 |
||
1151 | cmp [post],eax |
||
1152 | jb @f |
||
1153 | mov [post],eax |
||
1154 | @@: |
||
1155 | |||
1156 | call clear_screen |
||
1157 | call drawfile |
||
1158 | call draw_vertical_scroll |
||
1159 | ;call calc_scroll_size_and_pos |
||
1160 | |||
1161 | jmp still |
||
1162 | ; PAGE_DOWN } |
||
1163 | |||
1164 | nopd: |
||
1165 | |||
1166 | ; HOME { |
||
1167 | cmp al,132+48 |
||
1168 | jnz nohome |
||
1169 | |||
1170 | push 0 |
||
1171 | pop [posx] |
||
1172 | |||
1173 | call drawfile |
||
1174 | jmp still |
||
1175 | ; HOME } |
||
1176 | |||
1177 | |||
1178 | nohome: |
||
1179 | |||
1180 | |||
1181 | ; END { |
||
1182 | end_key: |
||
1183 | cmp al,133+48 |
||
1184 | jnz noend |
||
1185 | |||
1186 | imul eax,[posy],80 |
||
1187 | add eax,0x80000 |
||
1188 | add eax,[post] |
||
1189 | |||
1190 | mov esi,eax |
||
1191 | add eax,80+1 |
||
1192 | |||
1193 | @@: dec eax |
||
1194 | cmp eax,esi |
||
1195 | je @f |
||
1196 | cmp byte [eax-1],' ' |
||
1197 | jbe @b |
||
1198 | @@: |
||
1199 | sub eax,esi |
||
1200 | cmp eax,80-1 |
||
1201 | jbe @f |
||
1202 | dec eax |
||
1203 | @@: |
||
1204 | mov [posx],eax |
||
1205 | |||
1206 | call drawfile |
||
1207 | jmp still |
||
1208 | ; END } |
||
1209 | |||
1210 | |||
1211 | noend: |
||
1212 | |||
1213 | |||
1214 | ; GO_START { |
||
1215 | cmp al,251 ; Ctrl + [ |
||
1216 | jnz no_go_to_start |
||
1217 | |||
1218 | push 0 |
||
1219 | pop [post] ; offset = 0 |
||
1220 | |||
1221 | call clear_screen |
||
1222 | call drawfile ; draw file |
||
1223 | call draw_vertical_scroll |
||
1224 | ;call calc_scroll_size_and_pos |
||
1225 | jmp still ; go to still |
||
1226 | ; GO_START } |
||
1227 | |||
1228 | |||
1229 | no_go_to_start: |
||
1230 | |||
1231 | |||
1232 | ; GO_END { |
||
1233 | cmp al,253 ; Ctrl + ] |
||
1234 | jnz no_go_to_end |
||
1235 | cmp [lines],30 ;to fix ctrl+] bug |
||
1236 | jb @f |
||
1237 | mov eax,[lines] ; eax = lines in the file |
||
1238 | sub eax,[slines] ; eax -= lines on the screen |
||
1239 | ; imul eax,80 ; eax *= 80 (length of line) |
||
1240 | lea eax,[eax+eax*4] |
||
1241 | shl eax,4 |
||
1242 | mov [post],eax ; offset in the file |
||
1243 | |||
1244 | call clear_screen |
||
1245 | call drawfile ; draw file |
||
1246 | call draw_vertical_scroll |
||
1247 | @@: |
||
1248 | jmp still ; go to still |
||
1249 | ; GO_END } |
||
1250 | |||
1251 | |||
1252 | no_go_to_end: |
||
1253 | |||
1254 | |||
1255 | ; DELETE { |
||
1256 | cmp al,134+48 |
||
1257 | jne nodel |
||
1258 | |||
1259 | imul eax,[posy],80 |
||
1260 | add eax,0x80000 |
||
1261 | add eax,[post] |
||
1262 | add eax,[posx] |
||
1263 | mov ecx,eax |
||
1264 | |||
1265 | imul eax,[posy],80 |
||
1266 | add eax,0x80000+79 |
||
1267 | add eax,[post] |
||
1268 | mov ebx,eax |
||
1269 | |||
1270 | push ebx |
||
1271 | |||
1272 | dec ecx |
||
1273 | dec ebx |
||
1274 | |||
1275 | |||
1276 | push ecx ebx |
||
1277 | |||
1278 | push ebx |
||
1279 | |||
1280 | imul eax,[posy],80 |
||
1281 | add eax,0x80000 |
||
1282 | add eax,[post] |
||
1283 | mov ecx,eax |
||
1284 | |||
1285 | xor eax,eax |
||
1286 | cdq |
||
1287 | |||
1288 | pop ebx |
||
1289 | |||
1290 | dec ecx |
||
1291 | @@: |
||
1292 | inc ecx |
||
1293 | mov dh,[ecx] |
||
1294 | cmp dh,33 |
||
1295 | jb .nok |
||
1296 | xor eax,eax |
||
1297 | inc eax |
||
1298 | .nok: |
||
1299 | cmp ecx,ebx |
||
1300 | jb @b |
||
1301 | |||
1302 | pop ebx ecx |
||
1303 | |||
1304 | @@: |
||
1305 | inc ecx |
||
1306 | mov dl,[ecx+1] |
||
1307 | mov [ecx],dl |
||
1308 | cmp ecx,ebx |
||
1309 | jb @b |
||
1310 | |||
1311 | |||
1312 | pop ebx |
||
1313 | mov [ebx],byte 32 |
||
1314 | |||
1315 | test eax,eax |
||
1316 | jz dellinesup |
||
1317 | |||
1318 | call clear_screen |
||
1319 | call drawfile |
||
1320 | mov [modified],1 |
||
1321 | |||
1322 | jmp still |
||
1323 | |||
1324 | dellinesup: |
||
1325 | |||
1326 | ; lines -1 |
||
1327 | |||
1328 | pusha |
||
1329 | |||
1330 | mov eax,[post] |
||
1331 | cdq |
||
1332 | mov ebx,80 |
||
1333 | div ebx |
||
1334 | add eax,[posy] |
||
1335 | inc eax |
||
1336 | |||
1337 | cmp eax,[lines] |
||
1338 | jb @f |
||
1339 | |||
1340 | popa |
||
1341 | mov [modified],1 |
||
1342 | |||
1343 | jmp still |
||
1344 | |||
1345 | @@: |
||
1346 | |||
1347 | popa |
||
1348 | |||
1349 | dec [lines] |
||
1350 | |||
1351 | ; lines up |
||
1352 | |||
1353 | mov [posx],dword 0 |
||
1354 | |||
1355 | imul eax,[posy],80 |
||
1356 | add eax,0x80000-1 |
||
1357 | add eax,[post] |
||
1358 | mov ebx,eax |
||
1359 | |||
1360 | push ebx |
||
1361 | |||
1362 | imul eax,[lines],80 |
||
1363 | add eax,0x80000-1 |
||
1364 | add eax,[post] |
||
1365 | mov ecx,eax |
||
1366 | |||
1367 | pop ebx |
||
1368 | |||
1369 | @@: |
||
1370 | mov dl,[ebx+80] |
||
1371 | mov [ebx],dl |
||
1372 | inc ebx |
||
1373 | |||
1374 | cmp ecx,ebx |
||
1375 | jnz @b |
||
1376 | |||
1377 | call clear_screen |
||
1378 | call drawfile |
||
1379 | mov [modified],1 |
||
1380 | |||
1381 | jmp still |
||
1382 | ; DELETE } |
||
1383 | |||
1384 | |||
1385 | nodel: |
||
1386 | |||
1387 | |||
1388 | ; INSERT { |
||
1389 | cmp al,137+48 |
||
1390 | jnz noins |
||
1391 | |||
1392 | imul eax,[posy],80 |
||
1393 | add eax,0x80000 |
||
1394 | add eax,[post] |
||
1395 | add eax,[posx] |
||
1396 | mov ecx,eax |
||
1397 | ; ecx = [posy]*80+0x80000+[post]+[posx] |
||
1398 | |||
1399 | imul eax,[posy],80 |
||
1400 | add eax,0x80000+79 |
||
1401 | add eax,[post] |
||
1402 | mov ebx,eax |
||
1403 | ; ebx = [posy]*80+0x80000+79+[post] |
||
1404 | |||
1405 | .movstr: |
||
1406 | dec ebx |
||
1407 | mov dl,[ebx] |
||
1408 | mov [ebx+1],dl |
||
1409 | cmp ecx,ebx |
||
1410 | jb .movstr |
||
1411 | |||
1412 | mov [ecx],byte ' ' |
||
1413 | |||
1414 | call invalidate_string |
||
1415 | call drawfile |
||
1416 | mov [modified],1 |
||
1417 | |||
1418 | jmp still |
||
1419 | ; INSERT } |
||
1420 | |||
1421 | |||
1422 | noins: |
||
1423 | |||
1424 | |||
1425 | ; BACKSPACE { |
||
1426 | cmp al,8 |
||
1427 | jnz nobs |
||
1428 | mov ecx,[posx] |
||
1429 | test ecx,ecx |
||
1430 | jz still |
||
1431 | dec ecx |
||
1432 | mov [posx],ecx |
||
1433 | |||
1434 | imul eax,[posy],80 |
||
1435 | add eax,0x80000 |
||
1436 | add eax,[post] |
||
1437 | add eax,[posx] |
||
1438 | mov ebx,eax |
||
1439 | |||
1440 | push ebx |
||
1441 | |||
1442 | imul eax,[posy],80 |
||
1443 | add eax,0x80000+79 |
||
1444 | add eax,[post] |
||
1445 | mov ebx,eax |
||
1446 | |||
1447 | pop ecx |
||
1448 | |||
1449 | push ebx |
||
1450 | |||
1451 | dec ecx |
||
1452 | .movleft: |
||
1453 | inc ecx |
||
1454 | mov dl,[ecx+1] |
||
1455 | mov [ecx],dl |
||
1456 | cmp ecx,ebx |
||
1457 | jb .movleft |
||
1458 | |||
1459 | pop ebx |
||
1460 | mov [ebx],byte ' ' |
||
1461 | |||
1462 | call invalidate_string |
||
1463 | call drawfile |
||
1464 | mov [modified],1 |
||
1465 | |||
1466 | jmp still |
||
1467 | ; BACKSPACE } |
||
1468 | |||
1469 | |||
1470 | nobs: |
||
1471 | |||
1472 | |||
1473 | ; TAB { |
||
1474 | cmp eax,9 ; Tab |
||
1475 | jne notab |
||
1476 | |||
1477 | mov eax,[posx] |
||
1478 | cmp eax,80-1 |
||
1479 | jae still |
||
1480 | add eax,5 ; 9 5 3 |
||
1481 | and eax,11111100b ; ...1000b, ...100b, ...10b |
||
1482 | dec eax |
||
1483 | mov [posx], eax |
||
1484 | |||
1485 | call drawfile |
||
1486 | mov [modified],1 |
||
1487 | |||
1488 | jmp still |
||
1489 | ; TAB } |
||
1490 | |||
1491 | |||
1492 | notab: |
||
1493 | |||
1494 | |||
1495 | ; ADD_KEY { |
||
1496 | push eax ; add key |
||
1497 | |||
1498 | imul eax,[posy],80 |
||
1499 | add eax,0x80000 |
||
1500 | add eax,[post] |
||
1501 | add eax,[posx] |
||
1502 | mov ecx,eax |
||
1503 | |||
1504 | push ecx |
||
1505 | |||
1506 | imul eax,[posy],80 |
||
1507 | add eax,0x80000+79 |
||
1508 | add eax,[post] |
||
1509 | mov ebx,eax |
||
1510 | |||
1511 | .movright: |
||
1512 | dec ebx |
||
1513 | mov al,[ebx] |
||
1514 | mov [ebx+1],al |
||
1515 | cmp ecx,ebx |
||
1516 | jbe .movright |
||
1517 | |||
1518 | pop ebx |
||
1519 | |||
1520 | pop eax |
||
1521 | |||
1522 | mov [ebx],al |
||
1523 | mov edx,78 |
||
1524 | mov ecx,[posx] |
||
1525 | cmp edx,ecx |
||
1526 | jb noxp |
||
1527 | inc ecx |
||
1528 | mov [posx],ecx |
||
1529 | noxp: |
||
1530 | |||
1531 | call invalidate_string |
||
1532 | call drawfile |
||
1533 | mov [modified],1 |
||
1534 | ; call draw_vertical_scroll |
||
1535 | jmp still |
||
1536 | ; ADD_KEY } |
||
1537 | |||
1538 | |||
1539 | ;****************************************************************************** |
||
1540 | |||
1541 | start_fasm: |
||
1542 | cmp [asm_mode],1 |
||
1543 | je @f |
||
1544 | ret |
||
1545 | @@: |
||
1546 | mov esi,filename |
||
1547 | mov edi,fasm_parameters |
||
1548 | |||
1549 | cmp byte [esi],'/' |
||
1550 | je .yes_systree |
||
1551 | |||
1552 | mov ecx,[filename_len] |
||
1553 | rep movsb |
||
1554 | |||
1555 | mov al,',' |
||
1556 | stosb |
||
1557 | |||
1558 | mov ecx,[filename_len] |
||
1559 | add ecx,-4 |
||
1560 | mov esi,filename |
||
1561 | rep movsb |
||
1562 | |||
1563 | mov al,',' |
||
1564 | stosb |
||
1565 | |||
1566 | mov [edi],dword '/RD/' |
||
1567 | add edi,4 |
||
1568 | mov [edi],word '1/' |
||
1569 | inc edi |
||
1570 | inc edi |
||
1571 | |||
1572 | mov al,0 |
||
1573 | stosb |
||
1574 | |||
1575 | jmp .run |
||
1576 | |||
1577 | .yes_systree: |
||
1578 | add esi,[filename_len] |
||
1579 | dec esi |
||
1580 | |||
1581 | xor ecx,ecx |
||
1582 | mov al,'/' |
||
1583 | @@: |
||
1584 | cmp [esi],al |
||
1585 | je @f |
||
1586 | dec esi |
||
1587 | inc ecx |
||
1588 | jmp @b |
||
1589 | @@: |
||
1590 | inc esi |
||
1591 | |||
1592 | push esi |
||
1593 | push esi |
||
1594 | push ecx |
||
1595 | |||
1596 | rep movsb |
||
1597 | |||
1598 | mov al,',' |
||
1599 | stosb |
||
1600 | |||
1601 | pop ecx |
||
1602 | pop esi |
||
1603 | |||
1604 | add ecx,-4 |
||
1605 | rep movsb |
||
1606 | |||
1607 | mov al,',' |
||
1608 | stosb |
||
1609 | |||
1610 | pop ecx |
||
1611 | sub ecx,filename |
||
1612 | mov esi,filename |
||
1613 | |||
1614 | rep movsb |
||
1615 | |||
1616 | mov al,0 |
||
1617 | stosb |
||
1618 | |||
1619 | .run: |
||
1620 | cmp [run_outfile],1 |
||
1621 | jne @f |
||
1622 | dec edi |
||
1623 | mov eax,',run' |
||
1624 | stosd |
||
1625 | mov al,0 |
||
1626 | stosb |
||
1627 | @@: |
||
1628 | |||
1629 | mov eax,19 |
||
1630 | mov ebx,fasm_filename |
||
1631 | mov ecx,fasm_parameters |
||
1632 | int 0x40 |
||
1633 | ret |
||
1634 | |||
1635 | open_debug_board: |
||
1636 | mov eax,19 |
||
1637 | mov ebx,debug_filename |
||
1638 | xor ecx,ecx |
||
1639 | int 0x40 |
||
1640 | ret |
||
1641 | |||
1642 | open_sysfuncs_txt: |
||
1643 | mov eax,19 |
||
1644 | mov ebx,tinypad_filename |
||
1645 | mov ecx,sysfuncs_filename |
||
1646 | int 0x40 |
||
1647 | ret |
||
1648 | |||
1649 | |||
1650 | empty_work_space: |
||
1651 | ; очистить все |
||
1652 | mov eax,' ' |
||
1653 | mov edi,0x80000 |
||
1654 | mov ecx,(0x300000-0x90000)/4 |
||
1655 | cld |
||
1656 | rep stosd |
||
1657 | mov edi,0x10000 |
||
1658 | mov ecx,0x60000/4 |
||
1659 | rep stosd |
||
1660 | ret |
||
1661 | |||
1662 | |||
1663 | clear_screen: |
||
1664 | ; очистить экран |
||
1665 | mov ecx,80*40 |
||
1666 | mov edi,0x78000 |
||
1667 | xor eax,eax |
||
1668 | @@: |
||
1669 | mov [edi],eax |
||
1670 | add edi,4 |
||
1671 | dec ecx |
||
1672 | jnz @b |
||
1673 | ret |
||
1674 | |||
1675 | invalidate_string: |
||
1676 | imul eax,[posy],80 |
||
1677 | add eax,0x78000 |
||
1678 | mov edi,eax |
||
1679 | mov al,1 |
||
1680 | mov ecx,80/4 |
||
1681 | rep stosd |
||
1682 | ret |
||
1683 | |||
1684 | layout: |
||
1685 | ; сменить раскладку клавиатуры |
||
1686 | mov eax,19 |
||
1687 | mov ebx,setup |
||
1688 | mov ecx,param_setup |
||
1689 | int 0x40 |
||
1690 | mov eax,5 |
||
1691 | mov ebx,eax |
||
1692 | int 0x40 |
||
1693 | call activate_me |
||
1694 | ret |
||
1695 | |||
1696 | |||
1697 | activate_me: |
||
1698 | ; 1) get info about me |
||
1699 | mov eax,9 |
||
1700 | mov ebx,procinfo |
||
1701 | mov ecx,-1 |
||
1702 | int 0x40 |
||
1703 | ; eax = number of processes |
||
1704 | |||
1705 | ; save process counter |
||
1706 | inc eax |
||
1707 | inc eax |
||
1708 | mov [proccount],eax |
||
1709 | |||
1710 | mov eax,[procinfo.PID] |
||
1711 | mov [PID],eax |
||
1712 | |||
1713 | ; 2) get my process number |
||
1714 | mov eax,9 |
||
1715 | mov ebx,procinfo |
||
1716 | mov ecx,[proccount] |
||
1717 | @@: |
||
1718 | dec ecx |
||
1719 | jz @f ; counter=0 => not found? => return |
||
1720 | mov eax,9 |
||
1721 | int 0x40 |
||
1722 | mov edx,[procinfo.PID] |
||
1723 | cmp edx,[PID] |
||
1724 | jne @b |
||
1725 | |||
1726 | ;found: ecx = process_number |
||
1727 | mov eax,18 |
||
1728 | mov ebx,3 |
||
1729 | int 0x40 |
||
1730 | |||
1731 | mov eax,5 |
||
1732 | mov ebx,eax |
||
1733 | int 0x40 |
||
1734 | |||
1735 | @@: |
||
1736 | ret |
||
1737 | |||
1738 | |||
1739 | |||
1740 | |||
1741 | ; ******************************************************************* |
||
1742 | ; ************************** DRAW WINDOW ************************** |
||
1743 | ; ******************************************************************* |
||
1744 | |||
1745 | align 4 |
||
1746 | drawwindow: |
||
1747 | |||
1748 | mov eax,12 ; WINDOW DRAW START |
||
1749 | mov ebx,1 |
||
1750 | int 0x40 |
||
1751 | mov [menu_is_on],0 |
||
1752 | mov eax,48 ; get system colors |
||
1753 | mov ebx,3 |
||
1754 | mov ecx,sc |
||
1755 | mov edx,sizeof.system_colors |
||
1756 | int 0x40 |
||
1757 | |||
1758 | mov [sc.work],0xe0e0e0 |
||
1759 | |||
1760 | xor eax,eax ; DEFINE WINDOW |
||
1761 | mov ebx,100*65536+506 ; 496 |
||
1762 | mov ecx,75*65536+400 ;385;400 ; sum < 480 for 640x480 |
||
1763 | mov edx,[sc.work] |
||
1764 | add edx,0x03000000 |
||
1765 | mov esi,[sc.grab] |
||
1766 | or esi,0x80000000 |
||
1767 | mov edi,[sc.frame] |
||
1768 | int 0x40 |
||
1769 | |||
1770 | ; header string |
||
1771 | mov eax,4 |
||
1772 | mov ebx,10*65536+8 |
||
1773 | mov ecx,[sc.grab_text] |
||
1774 | mov edx,header |
||
1775 | mov esi,[headlen] |
||
1776 | int 0x40 |
||
1777 | |||
1778 | mov eax,9 ; get info about me |
||
1779 | mov ebx,procinfo |
||
1780 | or ecx,-1 |
||
1781 | int 0x40 |
||
1782 | |||
1783 | mov eax,[procinfo.y_size] |
||
1784 | |||
1785 | mov [do_not_draw],1 ; do_not_draw = true |
||
1786 | cmp eax,100 |
||
1787 | jb .no_draw ; do not draw text & buttons if height < 100 |
||
1788 | mov [do_not_draw],0 ; do_not_draw = false |
||
1789 | add eax,-(46+47) ; 46 = y offs |
||
1790 | cdq |
||
1791 | mov ebx,10 |
||
1792 | div ebx |
||
1793 | mov [slines],eax |
||
1794 | |||
1795 | cmp eax,[posy] |
||
1796 | jnb @f |
||
1797 | dec eax |
||
1798 | mov [posy],eax |
||
1799 | @@: |
||
1800 | |||
1801 | mov eax,[procinfo.y_size] ; calculate buttons position |
||
1802 | add eax,-47 |
||
1803 | mov [dstart],eax |
||
1804 | |||
1805 | ; mov eax,8 ; STRING BUTTON |
||
1806 | ; mov ebx,5*65536+57 |
||
1807 | ; mov ecx,[dstart] |
||
1808 | ; add ecx,29 |
||
1809 | ; shl ecx,16 |
||
1810 | ; add ecx,13 |
||
1811 | ; mov edx,51 ;;;;;-----string button ID=51 |
||
1812 | ; mov esi,[sc.work_button] |
||
1813 | ; int 0x40 |
||
1814 | ; SEARCH BUTTON |
||
1815 | ; mov ebx,(505-129)*65536+125 |
||
1816 | ; mov edx,50 |
||
1817 | ; mov esi,[sc.work_button] |
||
1818 | ; int 0x40 |
||
1819 | |||
1820 | ; mov eax,4 ; SEARCH TEXT |
||
1821 | ; mov ebx,[dstart] |
||
1822 | ; add ebx,7*65536+32 |
||
1823 | ; mov ecx,[sc.work_button_text] |
||
1824 | ; mov edx,searcht |
||
1825 | ; mov esi,searchtl-searcht |
||
1826 | ; int 0x40 |
||
1827 | |||
1828 | |||
1829 | mov eax,13 ; BAR STRIPE |
||
1830 | mov ebx,5*65536+497 |
||
1831 | mov ecx,[dstart] |
||
1832 | shl ecx,16 |
||
1833 | add ecx,30 ;15 |
||
1834 | |||
1835 | mov edx,0x00aaaaaa |
||
1836 | int 0x40 |
||
1837 | |||
1838 | ; mov eax,4 ; FIRST TEXT LINE (POSITION...) |
||
1839 | ; mov ebx,12*65536 |
||
1840 | ; add ebx,[dstart] |
||
1841 | ; add ebx,38 ;18 |
||
1842 | ; mov ecx,[sc.work_button_text] |
||
1843 | ; mov edx,htext2 |
||
1844 | ; mov esi,htextlen2-htext2 |
||
1845 | ; int 0x40 |
||
1846 | |||
1847 | |||
1848 | call drawfile |
||
1849 | |||
1850 | ; mov eax,[dstart] |
||
1851 | |||
1852 | ; add eax,31 |
||
1853 | ; mov [ya],eax |
||
1854 | ; mov [addr],search_string |
||
1855 | ; call print_text |
||
1856 | |||
1857 | .no_draw: |
||
1858 | call draw_win_menu |
||
1859 | |||
1860 | call draw_vertical_scroll |
||
1861 | |||
1862 | mov eax,12 ; WINDOW DRAW END |
||
1863 | mov ebx,2 |
||
1864 | int 0x40 |
||
1865 | |||
1866 | ret |
||
1867 | |||
1868 | |||
1869 | |||
1870 | |||
1871 | ; ********************************** |
||
1872 | ; *********** DRAWFILE *********** |
||
1873 | ; ********************************** |
||
1874 | |||
1875 | drawfile: |
||
1876 | ;--------------- |
||
1877 | cmp [menu_is_on],1 |
||
1878 | jne .ff |
||
1879 | call drawwindow |
||
1880 | .ff: |
||
1881 | ;--------------- |
||
1882 | mov [next_not_quote],1 |
||
1883 | mov [next_not_quote2],1 |
||
1884 | |||
1885 | mov eax,[post] ; print from position |
||
1886 | |||
1887 | pusha |
||
1888 | |||
1889 | mov edi,[post] |
||
1890 | mov [posl],edi |
||
1891 | |||
1892 | mov ebx,8*65536+46 ; letters (46 = y offs) |
||
1893 | xor ecx,ecx |
||
1894 | |||
1895 | mov edx,0x80000 |
||
1896 | add edx,eax |
||
1897 | mov edi,edx |
||
1898 | |||
1899 | imul esi,[slines],80 |
||
1900 | add edi,esi |
||
1901 | |||
1902 | |||
1903 | nd: |
||
1904 | |||
1905 | pusha |
||
1906 | |||
1907 | mov edx,ebx |
||
1908 | mov edi,ebx |
||
1909 | add edi,(6*65536)*80 |
||
1910 | |||
1911 | wi1: |
||
1912 | |||
1913 | |||
1914 | ; draw ? |
||
1915 | |||
1916 | |||
1917 | pusha |
||
1918 | |||
1919 | push ecx |
||
1920 | |||
1921 | imul eax,[posx],6 |
||
1922 | add eax,8 |
||
1923 | shl eax,16 |
||
1924 | mov ecx,eax |
||
1925 | |||
1926 | ; ecx = ([posx]*6+8)<<16 |
||
1927 | |||
1928 | imul eax,[posy],10 |
||
1929 | add eax,46 ; y offs |
||
1930 | add eax,ecx |
||
1931 | |||
1932 | ; eax = [posy]*10+46+ecx |
||
1933 | |||
1934 | pop ecx |
||
1935 | |||
1936 | cmp edx,eax |
||
1937 | jnz drwa |
||
1938 | |||
1939 | mov eax,0x7ffff |
||
1940 | call check_pos |
||
1941 | jmp drlet |
||
1942 | |||
1943 | drwa: |
||
1944 | |||
1945 | popa |
||
1946 | |||
1947 | |||
1948 | pusha |
||
1949 | |||
1950 | imul eax,[posxm],6 |
||
1951 | add eax,8 |
||
1952 | shl eax,16 |
||
1953 | mov ecx,eax |
||
1954 | |||
1955 | imul eax,[posym],10 |
||
1956 | add eax,46 ; y offs |
||
1957 | add eax,ecx |
||
1958 | |||
1959 | cmp edx,eax |
||
1960 | jnz drwa2 |
||
1961 | |||
1962 | mov eax,0x7ffff |
||
1963 | call check_pos |
||
1964 | jmp drlet |
||
1965 | |||
1966 | drwa2: |
||
1967 | |||
1968 | popa |
||
1969 | |||
1970 | pusha |
||
1971 | |||
1972 | mov eax,0x78000 ; screen |
||
1973 | add eax,[posl] ; screen+abs |
||
1974 | sub eax,[post] ; eax = screen+abs-base = y*80+x + screen |
||
1975 | |||
1976 | mov edx,0x80000 ; file |
||
1977 | add edx,[posl] ; edx = absolute |
||
1978 | mov bl,[edx] ; in the file |
||
1979 | |||
1980 | call check_pos |
||
1981 | |||
1982 | mov cl,[eax] ; on the screen |
||
1983 | cmp bl,cl |
||
1984 | jnz drlet |
||
1985 | |||
1986 | popa |
||
1987 | |||
1988 | jmp nodraw |
||
1989 | |||
1990 | |||
1991 | ; draw letter |
||
1992 | |||
1993 | |||
1994 | drlet: |
||
1995 | |||
1996 | mov [eax],bl ; mov byte to the screen |
||
1997 | mov [tmpabc],bl |
||
1998 | popa ; restore regs |
||
1999 | |||
2000 | ;!!!!!!!!!!!! |
||
2001 | |||
2002 | cmp [tmpabc],' ' |
||
2003 | je @f |
||
2004 | call draw_letter |
||
2005 | jmp nodraw |
||
2006 | @@: |
||
2007 | call clear_char |
||
2008 | |||
2009 | nodraw: |
||
2010 | |||
2011 | inc [posl] |
||
2012 | |||
2013 | add edx,6*65536 |
||
2014 | cmp edx,edi |
||
2015 | jz wi3 |
||
2016 | jmp wi1 |
||
2017 | |||
2018 | wi3: |
||
2019 | |||
2020 | popa |
||
2021 | |||
2022 | add ebx,10 |
||
2023 | add edx,80 |
||
2024 | cmp edi,edx |
||
2025 | jbe nde |
||
2026 | jmp nd |
||
2027 | |||
2028 | nde: |
||
2029 | |||
2030 | mov eax,[posx] |
||
2031 | mov ebx,[posy] |
||
2032 | |||
2033 | mov [posxm],eax |
||
2034 | mov [posym],ebx |
||
2035 | |||
2036 | popa |
||
2037 | |||
2038 | ret |
||
2039 | |||
2040 | stText = 0 |
||
2041 | stInstr = 1 |
||
2042 | stReg = 2 |
||
2043 | stNum = 3 |
||
2044 | stQuote = 4 |
||
2045 | stComment = 5 |
||
2046 | stSymbol = 6 |
||
2047 | |||
2048 | align 4 |
||
2049 | |||
2050 | clear_char: |
||
2051 | |||
2052 | pusha |
||
2053 | mov ebx,[sc.work] |
||
2054 | |||
2055 | push ecx |
||
2056 | |||
2057 | imul eax,[posx],6 |
||
2058 | add eax,8 |
||
2059 | shl eax,16 |
||
2060 | mov ecx,eax |
||
2061 | |||
2062 | imul eax,[posy],10 |
||
2063 | add eax,46 ; 26 |
||
2064 | add eax,ecx |
||
2065 | |||
2066 | pop ecx |
||
2067 | cmp edx,eax |
||
2068 | jnz @f |
||
2069 | mov ebx,0xffffff ; light blue 0x00ffff |
||
2070 | @@: |
||
2071 | |||
2072 | ; draw bar |
||
2073 | push ebx |
||
2074 | mov eax,13 |
||
2075 | mov ebx,edx |
||
2076 | mov bx,6 |
||
2077 | mov ecx,edx |
||
2078 | shl ecx,16 |
||
2079 | add ecx,10 |
||
2080 | pop edx |
||
2081 | int 0x40 |
||
2082 | popa |
||
2083 | ret |
||
2084 | |||
2085 | align 4 |
||
2086 | |||
2087 | ; CHECK_POSITION { |
||
2088 | check_pos: |
||
2089 | cmp [asm_mode],1 |
||
2090 | je @f |
||
2091 | |||
2092 | mov [d_status],stText |
||
2093 | ret |
||
2094 | |||
2095 | @@: |
||
2096 | pushad |
||
2097 | |||
2098 | ; COMMENT TERMINATOR |
||
2099 | cmp [d_status],stComment |
||
2100 | jnz @f |
||
2101 | mov eax,[posl] |
||
2102 | sub eax,[post] |
||
2103 | cdq |
||
2104 | mov ebx,80 |
||
2105 | div ebx |
||
2106 | test edx,edx |
||
2107 | jnz end_check_pos |
||
2108 | mov [d_status],stText |
||
2109 | @@: |
||
2110 | |||
2111 | ; QUOTE TERMINATOR B |
||
2112 | cmp [next_not_quote],1 |
||
2113 | jne @f |
||
2114 | mov [d_status],stText |
||
2115 | @@: |
||
2116 | |||
2117 | mov eax,[posl] |
||
2118 | add eax,0x80000 |
||
2119 | mov edx,eax |
||
2120 | mov al,[eax] |
||
2121 | |||
2122 | ; QUOTE TERMINATOR A |
||
2123 | cmp [d_status],stQuote |
||
2124 | jnz @f |
||
2125 | cmp al,[quote] |
||
2126 | jne end_check_pos |
||
2127 | mov [next_not_quote],1 |
||
2128 | jmp end_check_pos |
||
2129 | @@: |
||
2130 | mov [next_not_quote],0 |
||
2131 | |||
2132 | ; START QUOTE 1 |
||
2133 | cmp al,"'" |
||
2134 | jne @f |
||
2135 | mov [d_status],stQuote |
||
2136 | mov [quote],al |
||
2137 | jmp end_check_pos |
||
2138 | @@: |
||
2139 | |||
2140 | ; START QUOTE 2 |
||
2141 | cmp al,'"' |
||
2142 | jne @f |
||
2143 | mov [d_status],stQuote |
||
2144 | mov [quote],al |
||
2145 | jmp end_check_pos |
||
2146 | @@: |
||
2147 | |||
2148 | ; START COMMENT |
||
2149 | cmp al,';' |
||
2150 | jne @f |
||
2151 | mov [d_status],stComment |
||
2152 | jmp end_check_pos |
||
2153 | @@: |
||
2154 | |||
2155 | ; NUMBER TERMINATOR |
||
2156 | cmp [d_status],stNum |
||
2157 | jne nonumt |
||
2158 | mov ecx,23 |
||
2159 | @@: |
||
2160 | dec ecx |
||
2161 | jz nonumt |
||
2162 | cmp al,[symbols+ecx] |
||
2163 | jne @b |
||
2164 | |||
2165 | nonumt1: |
||
2166 | mov [d_status],stText |
||
2167 | nonumt: |
||
2168 | |||
2169 | ; START NUMBER |
||
2170 | cmp [d_status],stNum |
||
2171 | je end_check_pos |
||
2172 | cmp al,'0' |
||
2173 | jb nonum |
||
2174 | cmp al,'9' |
||
2175 | ja nonum |
||
2176 | mov bl,[edx-1] |
||
2177 | mov ecx,23 |
||
2178 | @@: |
||
2179 | dec ecx |
||
2180 | jz nonum |
||
2181 | cmp bl,[symbols+ecx] |
||
2182 | jne @b |
||
2183 | @@: |
||
2184 | mov [d_status],stNum |
||
2185 | jmp end_check_pos |
||
2186 | nonum: |
||
2187 | |||
2188 | ; SYMBOL |
||
2189 | mov esi,symbols |
||
2190 | mov ecx,21 |
||
2191 | @@: |
||
2192 | cmp byte [esi],al |
||
2193 | je @f |
||
2194 | dec ecx |
||
2195 | jz nosymbol |
||
2196 | inc esi |
||
2197 | jmp @b |
||
2198 | @@: |
||
2199 | mov [d_status],stSymbol |
||
2200 | jmp end_check_pos |
||
2201 | |||
2202 | nosymbol: |
||
2203 | mov [d_status],stText |
||
2204 | |||
2205 | end_check_pos: |
||
2206 | popad |
||
2207 | ret |
||
2208 | ; CHECK_POSITION } |
||
2209 | |||
2210 | |||
2211 | ;;;;;;;;;;;;;;;;; |
||
2212 | ;; DRAW LETTER ;; |
||
2213 | ;;;;;;;;;;;;;;;;; |
||
2214 | draw_letter: |
||
2215 | |||
2216 | call clear_char |
||
2217 | |||
2218 | pusha |
||
2219 | |||
2220 | mov ebx,edx ; x & y |
||
2221 | |||
2222 | mov eax,[d_status] |
||
2223 | mov ecx,[eax*4+color_tbl] |
||
2224 | mov eax,4 |
||
2225 | |||
2226 | xor esi,esi |
||
2227 | inc esi |
||
2228 | mov edx,0x80000 |
||
2229 | mov edi,[posl] |
||
2230 | add edx,edi |
||
2231 | int 0x40 |
||
2232 | |||
2233 | popa |
||
2234 | |||
2235 | ret |
||
2236 | |||
2237 | |||
2238 | ; ******************************************** |
||
2239 | ; **************** SAVEFILE **************** |
||
2240 | ; ******************************************** |
||
2241 | save_file: |
||
2242 | mov esi,0x80000 |
||
2243 | mov edi,0x10000 |
||
2244 | or ecx,-1 |
||
2245 | .new_string: |
||
2246 | inc ecx |
||
2247 | call save_string |
||
2248 | cmp ecx,[lines] |
||
2249 | jb .new_string |
||
2250 | |||
2251 | sub edi,0x10004 ; why??? |
||
2252 | mov [filelen],edi |
||
2253 | |||
2254 | cmp byte [filename],'/' |
||
2255 | je .systree_save |
||
2256 | |||
2257 | mov eax,33 |
||
2258 | mov ebx,filename |
||
2259 | mov ecx,0x10000 |
||
2260 | mov edx,[filelen] |
||
2261 | xor esi,esi |
||
2262 | int 0x40 |
||
2263 | |||
2264 | test eax,eax |
||
2265 | je .finish |
||
2266 | ; call file_not_found |
||
2267 | call disk_is_full |
||
2268 | ;============================== |
||
2269 | jmp .finish |
||
2270 | |||
2271 | .systree_save: |
||
2272 | mov eax,[filelen] |
||
2273 | mov [fileinfo_write+8],eax |
||
2274 | |||
2275 | mov esi,filename |
||
2276 | mov edi,pathfile_write |
||
2277 | mov ecx,50 |
||
2278 | cld |
||
2279 | rep movsb |
||
2280 | |||
2281 | mov eax,58 |
||
2282 | mov ebx,fileinfo_write |
||
2283 | int 0x40 |
||
2284 | cmp eax,0 |
||
2285 | je .finish |
||
2286 | call disk_is_full |
||
2287 | .finish: |
||
2288 | call draw_window_for_dialogs |
||
2289 | mov [modified],0 |
||
2290 | ret |
||
2291 | |||
2292 | save_string: |
||
2293 | push ecx |
||
2294 | push esi |
||
2295 | mov eax,esi |
||
2296 | mov ebx,eax |
||
2297 | add ebx,79 |
||
2298 | .countlen: |
||
2299 | cmp ebx,eax |
||
2300 | jb .endcount |
||
2301 | cmp byte [ebx],' ' |
||
2302 | jne .endcount |
||
2303 | dec ebx |
||
2304 | jmp .countlen |
||
2305 | .endcount: |
||
2306 | inc ebx |
||
2307 | sub ebx,eax |
||
2308 | |||
2309 | mov ecx,ebx |
||
2310 | jecxz .endcopy |
||
2311 | .copystr: |
||
2312 | mov al,[esi] |
||
2313 | mov [edi],al |
||
2314 | inc esi |
||
2315 | inc edi |
||
2316 | dec ecx |
||
2317 | jnz .copystr |
||
2318 | .endcopy: |
||
2319 | |||
2320 | mov eax,0x0a0d |
||
2321 | stosw |
||
2322 | |||
2323 | pop esi |
||
2324 | add esi,80 |
||
2325 | pop ecx |
||
2326 | ret |
||
2327 | |||
2328 | |||
2329 | |||
2330 | ; ******************************************** |
||
2331 | ; **************** LOADFILE **************** |
||
2332 | ; ******************************************** |
||
2333 | |||
2334 | loadhdfile: |
||
2335 | |||
2336 | mov esi,filename |
||
2337 | mov edi,pathfile_read |
||
2338 | mov ecx,250 ;50 |
||
2339 | cld |
||
2340 | rep movsb |
||
2341 | |||
2342 | mov eax,58 |
||
2343 | mov ebx,fileinfo_read |
||
2344 | int 0x40 |
||
2345 | |||
2346 | xchg eax,ebx |
||
2347 | inc eax |
||
2348 | test ebx,ebx ;errorcode=0 - ok |
||
2349 | je file_found |
||
2350 | cmp ebx,6 ;errorcode=5 - ok |
||
2351 | je file_found |
||
2352 | call file_not_found |
||
2353 | ret |
||
2354 | |||
2355 | |||
2356 | loadfile1: |
||
2357 | |||
2358 | mov eax,6 ; 6 = open file |
||
2359 | mov ebx,filename |
||
2360 | xor ecx,ecx |
||
2361 | mov edx,16800 |
||
2362 | mov esi,0x10000 |
||
2363 | int 0x40 |
||
2364 | |||
2365 | inc eax ; eax = -1 -> file not found |
||
2366 | jnz file_found ;strannaya proverka (Ed) |
||
2367 | |||
2368 | call file_not_found |
||
2369 | ret |
||
2370 | |||
2371 | |||
2372 | file_found: |
||
2373 | dec eax |
||
2374 | ; eax = file size |
||
2375 | jz .finish |
||
2376 | mov [filesize],eax |
||
2377 | |||
2378 | mov edi,0x80000 ; clear all |
||
2379 | @@: |
||
2380 | mov [edi],byte ' ' |
||
2381 | inc edi |
||
2382 | cmp edi,0x2effff |
||
2383 | jnz @b |
||
2384 | |||
2385 | mov [lines],0 |
||
2386 | mov edi,0x10000 |
||
2387 | mov ebx,0x80000 |
||
2388 | |||
2389 | ; edi = from |
||
2390 | ; ebx = to |
||
2391 | ; eax = filesize |
||
2392 | |||
2393 | .new_char: |
||
2394 | mov cl,[edi] ; get_char(); |
||
2395 | cmp cl,13 ; if (char==13) |
||
2396 | je .new_str1 ; goto .new_str1; |
||
2397 | cmp cl,10 ; if (char==10) |
||
2398 | je .new_str2 ; goto .new_str2; |
||
2399 | mov [ebx],cl ; store_char(); |
||
2400 | inc ebx ; dest++; |
||
2401 | .back: |
||
2402 | inc edi ; src++; |
||
2403 | dec eax ; counter--; |
||
2404 | jnz .new_char ; if (counter!=0) goto .new_char; |
||
2405 | |||
2406 | .finish: |
||
2407 | inc [lines] ; [lines]++; |
||
2408 | ret |
||
2409 | |||
2410 | .new_str1: |
||
2411 | pusha |
||
2412 | mov eax,ebx ; eax = destination |
||
2413 | add eax,-0x80000 ; eax = offset |
||
2414 | cdq |
||
2415 | mov ecx,80 |
||
2416 | div ecx ; offset /= 80; |
||
2417 | test edx,edx ; if not the first char in the string |
||
2418 | jne @f ; go forward |
||
2419 | test eax,eax ; if first line |
||
2420 | je @f ; go forward |
||
2421 | cmp [edi-1],byte 10; if previous char != 10 continue without line feed |
||
2422 | jne .contin |
||
2423 | @@: |
||
2424 | inc eax ; offset++; |
||
2425 | imul eax,80 ; offset *= 80; |
||
2426 | add eax,0x80000 |
||
2427 | mov [esp+4*4],eax ; to ebx |
||
2428 | .contin: |
||
2429 | popa |
||
2430 | inc edi ; do not look on the next char (10) |
||
2431 | dec eax ; counter--; |
||
2432 | inc [lines] ; [lines]++; |
||
2433 | jmp .back |
||
2434 | |||
2435 | |||
2436 | .new_str2: |
||
2437 | pusha |
||
2438 | mov eax,ebx |
||
2439 | add eax,-0x80000 |
||
2440 | cdq |
||
2441 | mov ecx,80 |
||
2442 | div ecx |
||
2443 | inc eax |
||
2444 | imul eax,80 |
||
2445 | add eax,0x80000 |
||
2446 | mov [esp+4*4],eax ; to ebx |
||
2447 | popa |
||
2448 | inc [lines] |
||
2449 | jmp .back |
||
2450 | |||
2451 | |||
2452 | file_not_found: |
||
2453 | mov eax,55 ; beep |
||
2454 | mov ebx,eax |
||
2455 | mov esi,error_beep |
||
2456 | int 0x40 |
||
2457 | mov [lines],1 ; open empty document |
||
2458 | |||
2459 | mov [to_return2],1 |
||
2460 | call openerror |
||
2461 | |||
2462 | ret |
||
2463 | |||
2464 | disk_is_full: |
||
2465 | mov eax,55 ; beep |
||
2466 | mov ebx,eax |
||
2467 | mov esi,error_beep |
||
2468 | int 0x40 |
||
2469 | mov [to_return2],1 |
||
2470 | call saveerror |
||
2471 | mov [error2_found],1 |
||
2472 | ret |
||
2473 | |||
2474 | |||
2475 | ; ***************************** |
||
2476 | ; ****** WRITE POSITION ****** |
||
2477 | ; ***************************** |
||
2478 | |||
2479 | writepos: |
||
2480 | |||
2481 | cmp [do_not_draw],1 ; return if drawing is not permitted |
||
2482 | jne @f |
||
2483 | ret |
||
2484 | @@: |
||
2485 | |||
2486 | pusha |
||
2487 | |||
2488 | mov eax,[posx] |
||
2489 | inc eax |
||
2490 | cdq |
||
2491 | mov ebx,10 |
||
2492 | div ebx |
||
2493 | add al,'0' |
||
2494 | add dl,'0' |
||
2495 | mov [htext2+ 9],al |
||
2496 | mov [htext2+10],dl |
||
2497 | |||
2498 | mov eax,[post] |
||
2499 | cdq |
||
2500 | mov ebx,80 |
||
2501 | div ebx |
||
2502 | mov [real_posy],eax ;=====!!!!!!!!! |
||
2503 | |||
2504 | add eax,[posy] |
||
2505 | inc eax |
||
2506 | mov ebx,10 |
||
2507 | cdq |
||
2508 | div ebx |
||
2509 | add dl,'0' |
||
2510 | mov [htext2+16],dl ; 00001 |
||
2511 | cdq |
||
2512 | div ebx |
||
2513 | add dl,'0' |
||
2514 | mov [htext2+15],dl ; 00010 |
||
2515 | cdq |
||
2516 | div ebx |
||
2517 | add dl,'0' |
||
2518 | mov [htext2+14],dl ; 00100 |
||
2519 | cdq |
||
2520 | div ebx |
||
2521 | add dl,'0' |
||
2522 | add al,'0' |
||
2523 | mov [htext2+13],dl ; 01000 |
||
2524 | mov [htext2+12],al ; 10000 |
||
2525 | |||
2526 | |||
2527 | mov eax,[lines] ; number of lines |
||
2528 | cdq |
||
2529 | mov ebx,10 |
||
2530 | div ebx |
||
2531 | add dl,'0' |
||
2532 | mov [htext2+31],dl ; 0001 |
||
2533 | cdq |
||
2534 | div ebx |
||
2535 | add dl,'0' |
||
2536 | mov [htext2+30],dl ; 0010 |
||
2537 | cdq |
||
2538 | div ebx |
||
2539 | add dl,'0' |
||
2540 | mov [htext2+29],dl ; 0100 |
||
2541 | cdq |
||
2542 | div ebx |
||
2543 | add dl,'0' |
||
2544 | add al,'0' |
||
2545 | mov [htext2+28],dl |
||
2546 | mov [htext2+27],al ; 10000 |
||
2547 | |||
2548 | ; НАДО БЫ ОТОБРАЖАТЬ РАСКЛАДКУ КЛАВИАТУРЫ! |
||
2549 | ; mov [htext2+42], word 'RU' |
||
2550 | |||
2551 | ; mov eax,13 ; draw bar |
||
2552 | ; mov ebx,5*65536+38*6 |
||
2553 | ; mov ecx,[dstart] |
||
2554 | ; shl ecx,16 |
||
2555 | ; add ecx,15 |
||
2556 | ; mov edx,[sc.work_graph] |
||
2557 | ; int 0x40 |
||
2558 | |||
2559 | mov eax,13 ; BAR STRIPE |
||
2560 | mov ebx,5*65536+497 |
||
2561 | mov ecx,[dstart] |
||
2562 | add ecx,29;30 ;15 |
||
2563 | shl ecx,16 |
||
2564 | add ecx,14 |
||
2565 | mov edx,[sc.work_graph] |
||
2566 | int 0x40 |
||
2567 | |||
2568 | mov eax,4 ; write position |
||
2569 | mov ebx,12*65536 |
||
2570 | mov bx,word [dstart] |
||
2571 | add ebx,33 ;18 |
||
2572 | mov ecx,[sc.work_button_text] |
||
2573 | mov edx,htext2 |
||
2574 | mov esi,38 |
||
2575 | int 0x40 |
||
2576 | |||
2577 | cmp [modified],1 |
||
2578 | jne no_mod |
||
122 | diamond | 2579 | if lang eq ru |
111 | heavyiron | 2580 | putlabel 270,386,'ИЗМЕНЕН',[sc.work_button_text] |
122 | diamond | 2581 | else |
2582 | putlabel 270,386,'MODIFIED',[sc.work_button_text] |
||
2583 | end if |
||
111 | heavyiron | 2584 | no_mod: |
2585 | popa |
||
2586 | |||
2587 | ret |
||
2588 | |||
2589 | ;----------------------------- |
||
2590 | ; search window |
||
2591 | ;----------------------------- |
||
2592 | search_window: |
||
2593 | |||
2594 | mov eax,13 |
||
2595 | mov ebx,55*65536+380 |
||
2596 | mov ecx,100*65536+60 |
||
2597 | mov edx,[sc.work_graph] |
||
2598 | int 0x40 |
||
2599 | |||
2600 | mov eax,38 |
||
2601 | mov ebx,55*65536+435 |
||
2602 | mov ecx,100*65536+100 |
||
2603 | mov edx,cl_White |
||
2604 | int 0x40 |
||
2605 | mov eax,38 |
||
2606 | mov ebx,55*65536+55 |
||
2607 | mov ecx,100*65536+160 |
||
2608 | mov edx,cl_White |
||
2609 | int 0x40 |
||
2610 | mov eax,38 |
||
2611 | mov ebx,435*65536+435 |
||
2612 | mov ecx,100*65536+160 |
||
2613 | mov edx,cl_White |
||
2614 | int 0x40 |
||
2615 | mov eax,38 |
||
2616 | mov ebx,55*65536+435 |
||
2617 | mov ecx,160*65536+160 |
||
2618 | mov edx,cl_White |
||
2619 | int 0x40 |
||
2620 | |||
122 | diamond | 2621 | if lang eq ru |
111 | heavyiron | 2622 | drawlbut 375,110,50,15,'Поиск',50,[sc.work_button],[sc.work_button_text] |
2623 | drawlbut 375,130,50,15,'Отмена',94,[sc.work_button],[sc.work_button_text] |
||
122 | diamond | 2624 | else |
2625 | drawlbut 375,110,50,15,'Search',50,[sc.work_button],[sc.work_button_text] |
||
2626 | drawlbut 375,130,50,15,'Cancel',94,[sc.work_button],[sc.work_button_text] |
||
2627 | end if |
||
111 | heavyiron | 2628 | |
2629 | call read_string |
||
2630 | |||
2631 | ; add eax,31 |
||
2632 | ; mov [ya],eax |
||
2633 | ; mov [addr],search_string |
||
2634 | ; call print_text |
||
2635 | |||
2636 | |||
2637 | |||
2638 | jmp search |
||
2639 | |||
2640 | string_not_found: |
||
2641 | mov eax,13 |
||
2642 | mov ebx,150*65536+200 |
||
2643 | mov ecx,100*65536+70 |
||
2644 | mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512 |
||
2645 | int 0x40 |
||
2646 | |||
2647 | mov eax,38 |
||
2648 | mov ebx,150*65536+350 |
||
2649 | mov ecx,100*65536+100 |
||
2650 | mov edx,cl_White |
||
2651 | int 0x40 |
||
2652 | mov eax,38 |
||
2653 | mov ebx,150*65536+350 |
||
2654 | mov ecx,170*65536+170 |
||
2655 | mov edx,cl_White |
||
2656 | int 0x40 |
||
2657 | mov eax,38 |
||
2658 | mov ebx,150*65536+150 |
||
2659 | mov ecx,100*65536+170 |
||
2660 | mov edx,cl_White |
||
2661 | int 0x40 |
||
2662 | mov eax,38 |
||
2663 | mov ebx,350*65536+350 |
||
2664 | mov ecx,100*65536+170 |
||
2665 | mov edx,cl_White |
||
2666 | int 0x40 |
||
2667 | |||
122 | diamond | 2668 | if lang eq ru |
2669 | putlabel 195,120,'Строка не найдена!',cl_White |
||
2670 | else |
||
2671 | putlabel 195,120,'String not found!',cl_White |
||
2672 | end if |
||
111 | heavyiron | 2673 | |
2674 | drawlbut 235,140,30,15,'Ок',94,[sc.work_button],cl_White |
||
2675 | |||
2676 | ret |
||
2677 | |||
2678 | read_string: |
||
2679 | |||
2680 | push eax |
||
2681 | ;---------------- |
||
2682 | mov eax,40 |
||
2683 | mov ebx,00000000000000000000000000000111b |
||
2684 | int 0x40 |
||
2685 | ;---------------- |
||
2686 | pop eax |
||
2687 | |||
2688 | ; cmp al,51 |
||
2689 | ; jz .f2 |
||
2690 | ; ret |
||
2691 | |||
2692 | .f2: |
||
2693 | mov [addr],dword search_string |
||
2694 | mov eax,[dstart] |
||
2695 | add eax,17+14 |
||
2696 | mov [ya],eax |
||
2697 | mov [case_sens],1 |
||
2698 | |||
2699 | .rk: |
||
2700 | |||
2701 | mov edi,[addr] |
||
2702 | |||
2703 | mov eax,[addr] |
||
2704 | mov eax,[eax-4] |
||
2705 | mov [temp],eax |
||
2706 | |||
2707 | add edi,eax |
||
2708 | |||
2709 | call print_text |
||
2710 | |||
2711 | .waitev: |
||
2712 | mov eax, 10 |
||
2713 | int 0x40 |
||
2714 | cmp eax, 2 |
||
2715 | jne .read_done |
||
2716 | int 0x40 |
||
2717 | shr eax, 8 |
||
2718 | |||
2719 | cmp al, 13 ; enter |
||
2720 | je .read_done |
||
2721 | |||
2722 | cmp al,27 |
||
2723 | jne ._f |
||
2724 | jmp red |
||
2725 | ._f: |
||
2726 | cmp al, 192 ; Ctrl + space |
||
2727 | jne .noclear |
||
2728 | |||
2729 | xor eax, eax |
||
2730 | mov [temp], eax |
||
2731 | mov edi, [addr] |
||
2732 | mov [edi-4], eax |
||
2733 | mov ecx, 49 |
||
2734 | cld |
||
2735 | rep stosb |
||
2736 | mov edi, [addr] |
||
2737 | call print_text |
||
2738 | jmp .waitev |
||
2739 | |||
2740 | .noclear: |
||
2741 | |||
2742 | cmp al, 8 ; backspace |
||
2743 | jnz .nobsl |
||
2744 | cmp [temp], 0 |
||
2745 | jz .waitev |
||
2746 | dec [temp] |
||
2747 | mov edi, [addr] |
||
2748 | add edi, [temp] |
||
2749 | mov [edi], byte 0 |
||
2750 | |||
2751 | mov eax,[addr] |
||
2752 | dec dword [eax-4] |
||
2753 | |||
2754 | call print_text |
||
2755 | jmp .waitev |
||
2756 | |||
2757 | .nobsl: |
||
2758 | cmp [temp],50 |
||
2759 | jae .read_done |
||
2760 | |||
2761 | ; CONVERT CHAR TO UPPER CASE: |
||
2762 | cmp al, ' ' ; below "space" - ignore |
||
2763 | jb .waitev |
||
2764 | cmp [case_sens], 1 ; case sensitive? |
||
2765 | je .keyok |
||
2766 | cmp al, 'a' |
||
2767 | jb .keyok |
||
2768 | cmp al, 'z' |
||
2769 | ja .keyok |
||
2770 | sub al, 32 |
||
2771 | .keyok: |
||
2772 | |||
2773 | mov edi,[addr] |
||
2774 | add edi,[temp] |
||
2775 | mov [edi],al |
||
2776 | |||
2777 | inc [temp] |
||
2778 | |||
2779 | mov eax,[addr] |
||
2780 | inc dword [eax-4] |
||
2781 | call print_text |
||
2782 | |||
2783 | cmp [temp],50 |
||
2784 | jbe .waitev |
||
2785 | |||
2786 | .read_done: |
||
2787 | mov ecx,50 |
||
2788 | sub ecx,[temp] |
||
2789 | mov edi,[addr] |
||
2790 | add edi,[temp] |
||
2791 | xor eax,eax |
||
2792 | cld |
||
2793 | rep stosb |
||
2794 | |||
2795 | mov [temp],987 |
||
2796 | |||
2797 | call print_text |
||
2798 | call mask_events |
||
2799 | ret |
||
2800 | |||
2801 | |||
2802 | print_text: |
||
2803 | |||
2804 | pusha |
||
2805 | |||
2806 | mov eax,13 |
||
2807 | mov ebx,64*65536+50*6+2 |
||
2808 | ; mov ecx,[ya] |
||
2809 | ; shl ecx,16 |
||
2810 | ; add ecx,12 |
||
2811 | mov ecx,110*65536+12 |
||
2812 | mov edx,[sc.work] |
||
2813 | int 0x40 |
||
2814 | |||
2815 | mov edx,[addr] |
||
2816 | mov esi,[edx-4] |
||
2817 | mov eax,4 |
||
2818 | mov ebx,65*65536+112 ;2 |
||
2819 | ; add ebx,[ya] |
||
2820 | mov ecx,[color_tbl+0] |
||
2821 | int 0x40 |
||
2822 | |||
2823 | cmp [temp],50 |
||
2824 | ja @f |
||
2825 | |||
2826 | ; draw cursor |
||
2827 | ; { |
||
2828 | ; mov eax,[ya] |
||
2829 | mov eax,18*65536+102 ;65 |
||
2830 | mov ebx,eax |
||
2831 | shl eax,16 |
||
2832 | add eax,ebx |
||
2833 | add eax,10 |
||
2834 | mov ecx,eax |
||
2835 | |||
2836 | mov eax,[temp] |
||
2837 | ; imul eax,6 |
||
2838 | lea eax,[eax+eax*2] |
||
2839 | shl eax,1 |
||
2840 | add eax,65 |
||
2841 | mov ebx,eax |
||
2842 | shl eax,16 |
||
2843 | add ebx,eax |
||
2844 | |||
2845 | mov eax,38 |
||
2846 | mov edx,[color_tbl+0] |
||
2847 | int 0x40 |
||
2848 | ; } |
||
2849 | |||
2850 | @@: |
||
2851 | popa |
||
2852 | |||
2853 | ret |
||
2854 | |||
2855 | |||
2856 | |||
2857 | ; mov eax,8 ; STRING BUTTON |
||
2858 | ; mov ebx,5*65536+57 |
||
2859 | ; mov ecx,[dstart] |
||
2860 | ; add ecx,29 |
||
2861 | ; shl ecx,16 |
||
2862 | ; add ecx,13 |
||
2863 | ; mov edx,51 ;;;;;-----string button ID=51 |
||
2864 | ; mov esi,[sc.work_button] |
||
2865 | ; int 0x40 |
||
2866 | ; SEARCH BUTTON |
||
2867 | ; mov ebx,(505-129)*65536+125 |
||
2868 | ; mov edx,50 |
||
2869 | ; mov esi,[sc.work_button] |
||
2870 | ; int 0x40 |
||
2871 | |||
2872 | ; mov eax,4 ; SEARCH TEXT |
||
2873 | ; mov ebx,[dstart] |
||
2874 | ; add ebx,7*65536+32 |
||
2875 | ; mov ecx,[sc.work_button_text] |
||
2876 | ; mov edx,searcht |
||
2877 | ; mov esi,searchtl-searcht |
||
2878 | ; int 0x40 |
||
2879 | |||
2880 | |||
2881 | |||
2882 | ; **************************** |
||
2883 | ; ******* READ STRING ******** |
||
2884 | ; **************************** |
||
2885 | goto_string: |
||
2886 | |||
2887 | mov [num_goto_string],0 |
||
2888 | call read_str_num |
||
2889 | mov eax,[num_goto_string] |
||
2890 | cmp eax,[lines] |
||
2891 | ja .leave |
||
2892 | |||
2893 | ;--------------- |
||
2894 | mov [posy],0 |
||
2895 | call goto_pos |
||
2896 | |||
2897 | .leave: |
||
2898 | call draw_window_for_dialogs |
||
2899 | call mask_events |
||
2900 | |||
2901 | jmp still |
||
2902 | |||
2903 | |||
2904 | read_str_num: |
||
2905 | push eax |
||
2906 | ;---------------- |
||
2907 | mov eax,40 |
||
2908 | mov ebx,00000000000000000000000000000111b |
||
2909 | int 0x40 |
||
2910 | ;---------------- |
||
2911 | pop eax |
||
2912 | |||
2913 | mov eax,13 |
||
2914 | mov ebx,100*65536+100 |
||
2915 | mov ecx,70*65536+60 |
||
2916 | mov edx,[sc.work_button] |
||
2917 | int 0x40 |
||
2918 | |||
2919 | |||
2920 | mov eax,38 |
||
2921 | mov ebx,100*65536+200 |
||
2922 | mov ecx,70*65536+70 |
||
2923 | mov edx,cl_White |
||
2924 | int 0x40 |
||
2925 | mov eax,38 |
||
2926 | mov ebx,100*65536+200 |
||
2927 | mov ecx,130*65536+130 |
||
2928 | mov edx,cl_White |
||
2929 | int 0x40 |
||
2930 | mov eax,38 |
||
2931 | mov ebx,100*65536+100 |
||
2932 | mov ecx,70*65536+130 |
||
2933 | mov edx,cl_White |
||
2934 | int 0x40 |
||
2935 | mov eax,38 |
||
2936 | mov ebx,200*65536+200 |
||
2937 | mov ecx,70*65536+130 |
||
2938 | mov edx,cl_White |
||
2939 | int 0x40 |
||
2940 | |||
2941 | |||
2942 | |||
2943 | putlabel 105,75,'GoTo Line #',cl_White |
||
2944 | mov eax,13 |
||
2945 | mov ebx,110*65536+40 |
||
2946 | mov ecx,90*65536+12;[ya] |
||
2947 | mov edx,[sc.work] |
||
2948 | int 0x40 |
||
2949 | |||
2950 | outcount [num_goto_string],112,92,cl_Black,6*65536 |
||
2951 | drawlbut 110,105,40,15,'GoTo',93,cl_Grey,cl_Black |
||
2952 | drawlbut 153,105,40,15,'Cancel',94,cl_Grey,cl_Black |
||
2953 | .waitev: |
||
2954 | mov eax, 10 |
||
2955 | int 0x40 |
||
2956 | ; cmp eax,6 |
||
2957 | ; je .mouse |
||
2958 | cmp eax,3 |
||
2959 | je .but |
||
2960 | cmp eax, 2 |
||
2961 | ; jne .read_done |
||
2962 | jne .waitev |
||
2963 | int 0x40 |
||
2964 | shr eax, 8 |
||
2965 | |||
2966 | cmp al, 13 ; enter |
||
2967 | je .read_done |
||
2968 | cmp al,27 |
||
2969 | je goto_string.leave |
||
2970 | cmp al, 8 ; backspace |
||
2971 | jnz .nobsl |
||
2972 | |||
2973 | xor edx,edx |
||
2974 | |||
2975 | mov eax,[num_goto_string] |
||
2976 | mov ebx,dword 10 |
||
2977 | div ebx |
||
2978 | mov [num_goto_string],eax |
||
2979 | call print_text2 |
||
2980 | jmp .waitev |
||
2981 | |||
2982 | ;.mouse: |
||
2983 | ;mov eax,37 |
||
2984 | ;mov ebx,2 |
||
2985 | ;int 0x40 |
||
2986 | ;cmp eax,2 |
||
2987 | ;je goto_string.leave |
||
2988 | ;jmp .waitev |
||
2989 | |||
2990 | .but: |
||
2991 | mov eax,17 |
||
2992 | int 0x40 |
||
2993 | cmp ah,94 |
||
2994 | je goto_string.leave |
||
2995 | cmp ah,93 |
||
2996 | je .read_done |
||
2997 | jmp .waitev |
||
2998 | |||
2999 | |||
3000 | .nobsl: |
||
3001 | xor ecx,ecx |
||
3002 | xor edx,edx |
||
3003 | |||
3004 | sub al,48 |
||
3005 | mov cl,al |
||
3006 | |||
3007 | mov eax,[num_goto_string] |
||
3008 | cmp eax,99999 |
||
3009 | ja .read_done |
||
3010 | mov ebx,10 |
||
3011 | mul ebx |
||
3012 | add eax,ecx |
||
3013 | mov [num_goto_string],eax |
||
3014 | |||
3015 | call print_text2 |
||
3016 | jmp .waitev |
||
3017 | |||
3018 | .read_done: |
||
3019 | mov eax,[num_goto_string] |
||
3020 | dec eax |
||
3021 | mov [num_goto_string],eax |
||
3022 | call print_text2 |
||
3023 | ret |
||
3024 | |||
3025 | |||
3026 | print_text2: |
||
3027 | |||
3028 | pusha |
||
3029 | |||
3030 | mov eax,13 |
||
3031 | mov ebx,110*65536+40 |
||
3032 | mov ecx,90*65536+12;[ya] |
||
3033 | mov edx,[sc.work] |
||
3034 | int 0x40 |
||
3035 | |||
3036 | outcount [num_goto_string],112,92,cl_Black,6*65536 |
||
3037 | popa |
||
3038 | |||
3039 | ret |
||
3040 | |||
3041 | ;****************************************************************************** |
||
3042 | calc_scroll_size_and_pos: |
||
3043 | |||
3044 | ;cmp [menu_is_on],0 |
||
3045 | ;je ._ff |
||
3046 | ;call drawwindow |
||
3047 | ;mov [menu_is_on],0 |
||
3048 | ;._ff: |
||
3049 | |||
3050 | cmp [lines],30 |
||
3051 | jbe .lines_less_30 |
||
3052 | |||
3053 | xor edx,edx |
||
3054 | mov eax,[post] |
||
3055 | mov ebx,80 |
||
3056 | div ebx |
||
3057 | add eax,[posy] |
||
3058 | ;add eax,[slines] |
||
3059 | |||
3060 | ;checking for bug |
||
3061 | mov ebx,[lines] |
||
3062 | sub ebx,30 |
||
3063 | |||
3064 | cmp eax,ebx |
||
3065 | ja .f |
||
3066 | mov [VScroll_1+16],eax |
||
3067 | jmp .ff |
||
3068 | .f: |
||
3069 | mov [VScroll_1+16],ebx |
||
3070 | |||
3071 | .ff: |
||
3072 | ;--------------------- |
||
3073 | mov eax,[lines] |
||
3074 | sub eax,30 ;---max=lines-30 |
||
3075 | mov [VScroll_1+12],eax |
||
3076 | jmp .leave |
||
3077 | |||
3078 | .lines_less_30: |
||
3079 | |||
3080 | mov [VScroll_1+16],dword 0 |
||
3081 | mov [VScroll_1+12],dword 1 |
||
3082 | |||
3083 | .leave: |
||
3084 | |||
3085 | ret |
||
3086 | ;============Draw vertical scroll bar========= |
||
3087 | draw_vertical_scroll: |
||
3088 | call calc_scroll_size_and_pos |
||
3089 | ;======================== |
||
3090 | xor ecx,ecx ;start at top of controls list |
||
3091 | Draw_Controls_Loop: ;Redraw Controls Loop |
||
3092 | mov ebp, [App_Controls+ecx] ;get controls data location |
||
3093 | or ebp,ebp ;is this the last control? |
||
3094 | jz Draw_Controls_Done ; |
||
3095 | call dword [App_Controls+ecx+4] ;call controls draw function |
||
3096 | add ecx, 12 ;get next control |
||
3097 | jmp Draw_Controls_Loop ;loop till done |
||
3098 | Draw_Controls_Done: ;all done |
||
3099 | ;======================== |
||
3100 | |||
3101 | mov eax,38 |
||
3102 | mov ebx,488*65536+488 |
||
3103 | mov ecx,43*65536+388 |
||
3104 | mov edx,0x00000000 |
||
3105 | int 0x40 |
||
3106 | ret |
||
3107 | |||
3108 | mouse_info: |
||
3109 | ;call |
||
3110 | mov eax, 37 ;get mouse cordinates |
||
3111 | mov ebx, 1 ; |
||
3112 | int 0x40 ; |
||
3113 | mov ecx, eax ; |
||
3114 | push ecx ; |
||
3115 | mov eax, 37 ;get mouse buttons |
||
3116 | mov ebx, 2 ; |
||
3117 | int 0x40 ; |
||
3118 | ;------------------ |
||
3119 | ; if menu is on - then we need to redraw window before continue |
||
3120 | cmp eax,1 |
||
3121 | jne ._f1 |
||
3122 | |||
3123 | pusha |
||
3124 | cmp [menu_is_on],0 |
||
3125 | je ._ff |
||
3126 | call drawwindow |
||
3127 | mov [menu_is_on],0 |
||
3128 | ._ff: |
||
3129 | popa |
||
3130 | |||
3131 | ._f1: |
||
3132 | ;------------------ |
||
3133 | cmp [mouseb], eax ;compare old mouse states to new states |
||
3134 | jne redraw_mouse_info ; |
||
3135 | cmp [mousey], cx ; |
||
3136 | jne redraw_mouse_info ; |
||
3137 | shr ecx, 16 ; |
||
3138 | cmp [mousex], cx ; |
||
3139 | jne redraw_mouse_info ; |
||
3140 | pop ecx ; |
||
3141 | ret ;return if no change in states |
||
3142 | redraw_mouse_info: |
||
3143 | pop ecx |
||
3144 | mov [mouseb], eax ;save new mouse states |
||
3145 | mov dword [mousey], ecx |
||
3146 | xor ecx, ecx |
||
3147 | Check_Mouse_Over_Controls_Loop: |
||
3148 | mov ebp, [App_Controls+ecx] |
||
3149 | or ebp, ebp |
||
3150 | jz Check_Mouse_Over_Controls_Loop_done |
||
3151 | |||
3152 | movzx eax,word [ebp+2] |
||
3153 | cmp ax, [mousex] |
||
3154 | ja mouse_not_on_control |
||
3155 | movzx eax,word [ebp+6] |
||
3156 | cmp ax, [mousey] |
||
3157 | ja mouse_not_on_control |
||
3158 | movzx eax,word [ebp] |
||
3159 | add ax, [ebp+2] |
||
3160 | cmp ax, [mousex] |
||
3161 | jb mouse_not_on_control |
||
3162 | movzx eax,word [ebp+4] |
||
3163 | add ax, [ebp+6] |
||
3164 | cmp ax, [mousey] |
||
3165 | jb mouse_not_on_control |
||
3166 | call dword [App_Controls+ecx+8] |
||
3167 | ;------------------------------ |
||
3168 | cmp [mouseb],1 |
||
3169 | jne mouse_not_on_control |
||
3170 | mov eax,[VScroll_1+16] |
||
3171 | call goto_pos |
||
3172 | ;------------------------------ |
||
3173 | |||
3174 | mouse_not_on_control: |
||
3175 | add ecx, 12 |
||
3176 | jmp Check_Mouse_Over_Controls_Loop |
||
3177 | Check_Mouse_Over_Controls_Loop_done: |
||
3178 | |||
3179 | ret |
||
3180 | ;****************************************************************************** |
||
3181 | goto_pos: |
||
3182 | ;pusha |
||
3183 | |||
3184 | mov ecx,eax ;save new position number in ecx for future |
||
3185 | |||
3186 | cmp [lines],30 ;check for 'cursor' bug |
||
3187 | jbe .lines_less_30 |
||
3188 | ;--------------- |
||
3189 | |||
3190 | mov edx,[lines] ;if new pos is > than (lines-30) |
||
3191 | sub edx,30 |
||
3192 | |||
3193 | cmp eax,edx |
||
3194 | ja .f1 |
||
3195 | jmp .ff |
||
3196 | |||
3197 | .f1: |
||
3198 | mov eax,edx ;than newpos is = (lines-30) |
||
3199 | |||
3200 | sub ecx,edx ;and posY=newpos-(lines-30) |
||
3201 | mov [posy],ecx |
||
3202 | |||
3203 | .ff: |
||
3204 | |||
3205 | ;----------------------- |
||
3206 | ;in eax must be string number |
||
3207 | mov ecx,80 |
||
3208 | mul ecx |
||
3209 | |||
3210 | ; add eax,[slines] |
||
3211 | ; sub |
||
3212 | ;------------------------ |
||
3213 | mov [post],eax |
||
3214 | |||
3215 | .lines_less_30: |
||
3216 | call clear_screen |
||
3217 | call drawfile |
||
3218 | ;popa |
||
3219 | ret |
||
3220 | ;****************************************************************************** |
||
3221 | mask_events: |
||
3222 | mov eax,40 |
||
3223 | mov ebx,00100111b |
||
3224 | int 0x40 |
||
3225 | ret |
||
3226 | ;****************************************************************************** |
||
3227 | main_cursor_move: |
||
3228 | ;call drawwindow |
||
3229 | sub [mouse_x],7 |
||
3230 | sub [mouse_y],45 |
||
3231 | |||
3232 | xor edx,edx |
||
3233 | mov eax,[mouse_x] |
||
3234 | mov ebx,6 |
||
3235 | div ebx ;eax=result |
||
3236 | mov [posx],eax |
||
3237 | |||
3238 | xor edx,edx |
||
3239 | mov eax,dword [mouse_y] |
||
3240 | mov ebx,dword 10 |
||
3241 | div ebx ;eax=result=new posY |
||
3242 | |||
3243 | ;error checking ------ |
||
3244 | cmp [lines],dword 1 ;for "1st line" bug |
||
3245 | je ._do_nothing |
||
3246 | |||
3247 | mov ebx,[lines] |
||
3248 | sub ebx,dword 1 |
||
3249 | |||
3250 | cmp eax,ebx ;[lines] |
||
3251 | ja ._do_nothing |
||
3252 | |||
3253 | ;---------------------- |
||
3254 | mov [posy],eax |
||
3255 | |||
3256 | ._do_nothing: |
||
3257 | call clear_screen |
||
3258 | call drawfile |
||
3259 | call draw_vertical_scroll |
||
3260 | ret |
||
3261 | |||
3262 | ;****************************************************************************** |
||
3263 | make_fast_so: |
||
3264 | ;=========================== |
||
3265 | ; 1) get info about me |
||
3266 | mov eax,9 |
||
3267 | mov ebx,procinfo |
||
3268 | mov ecx,-1 |
||
3269 | int 0x40 |
||
3270 | ; eax = number of processes |
||
3271 | |||
3272 | ; save process counter |
||
3273 | inc eax |
||
3274 | inc eax |
||
3275 | mov [proccount],eax |
||
3276 | |||
3277 | mov eax,[procinfo.PID] |
||
3278 | mov [PID],eax |
||
3279 | ;========================== |
||
3280 | |||
3281 | |||
3282 | mov eax,51 |
||
3283 | mov ebx,1 |
||
3284 | mov ecx,fast_so_thread_start |
||
3285 | mov edx,so_stack |
||
3286 | int 0x40 |
||
3287 | ret |
||
3288 | ;****************************************************************************** |
||
3289 | |||
3290 | ;fast save & fast open |
||
3291 | draw_fastso_window: |
||
3292 | startwd |
||
3293 | colorwindow 120,100,454,70,window_Type1+0x00cccccc,0x00cccccc,cl_Black |
||
3294 | |||
3295 | call draw_string00 |
||
3296 | drawlbut 10,40,30,20,'Save',17,cl_Grey,cl_Black |
||
3297 | |||
3298 | drawlbut 50,40,30,20,'Open',18,cl_Grey,cl_Black |
||
3299 | |||
3300 | drawlbut 90,40,37,20,'Close',19,cl_Grey,cl_Black |
||
3301 | endwd |
||
3302 | ret |
||
3303 | |||
3304 | draw_string00: |
||
3305 | mov ebx,10*65536+433 |
||
3306 | mov ecx,10*65536+20 |
||
3307 | mov edx,0x00ffffff |
||
3308 | mov eax,13 |
||
3309 | int 0x40 |
||
3310 | |||
3311 | push eax |
||
3312 | mov eax,6*65536 |
||
3313 | mul dword [pos00] |
||
3314 | add eax,10*65536+6 |
||
3315 | mov ebx,eax |
||
3316 | pop eax |
||
3317 | mov edx,0x6a73d0 |
||
3318 | int 0x40 |
||
3319 | |||
3320 | mov eax,4 |
||
3321 | mov ebx,12*65536+17 |
||
3322 | mov ecx,cl_Black ;0x00000000 |
||
3323 | mov edx,mypath ;filename ;path |
||
3324 | mov esi,71 ;200 |
||
3325 | int 0x40 |
||
3326 | ret |
||
3327 | |||
3328 | fast_so_thread_start: |
||
3329 | ;copy filename to mypath |
||
3330 | cld |
||
3331 | mov esi,filename |
||
3332 | mov edi,mypath |
||
3333 | mov ecx,71 ;200 |
||
3334 | rep movsb |
||
3335 | mov edi,mypath |
||
3336 | mov ecx,71 ;200 |
||
3337 | xor eax,eax |
||
3338 | repne scasb |
||
3339 | ;end copy |
||
3340 | call draw_fastso_window |
||
3341 | |||
3342 | fastso_still: |
||
3343 | wtevent fred,fkey,fbut |
||
3344 | jmp fastso_still |
||
3345 | |||
3346 | fred: |
||
3347 | call draw_fastso_window |
||
3348 | jmp fastso_still |
||
3349 | |||
3350 | ;====KEY |
||
3351 | fkey: |
||
3352 | |||
3353 | mov eax,2 |
||
3354 | int 0x40 |
||
3355 | |||
3356 | cmp ah,179 |
||
3357 | jne noright00 |
||
3358 | mov eax,[pos00] |
||
3359 | cmp eax,70 ;41 |
||
3360 | ja fastso_still |
||
3361 | inc eax |
||
3362 | mov [pos00],eax |
||
3363 | call draw_string00 |
||
3364 | jmp fastso_still |
||
3365 | noright00: |
||
3366 | cmp ah,176 |
||
3367 | jne noleft00 |
||
3368 | mov eax,[pos00] |
||
3369 | test eax,eax |
||
3370 | je fastso_still |
||
3371 | dec eax |
||
3372 | mov [pos00],eax |
||
3373 | call draw_string00 |
||
3374 | jmp fastso_still |
||
3375 | noleft00: |
||
3376 | cmp ah,182 |
||
3377 | jne nodelete00 |
||
3378 | call shiftback00 |
||
3379 | call draw_string00 |
||
3380 | jmp fastso_still |
||
3381 | nodelete00: |
||
3382 | cmp ah,8 |
||
3383 | jne noback00 |
||
3384 | mov eax,[pos00] |
||
3385 | test eax,eax |
||
3386 | je fastso_still |
||
3387 | dec eax |
||
3388 | mov [pos00],eax |
||
3389 | call shiftback00 |
||
3390 | call draw_string00 |
||
3391 | jmp fastso_still |
||
3392 | noback00: |
||
3393 | enter00: |
||
3394 | |||
3395 | cmp ah,19 ;ctrl+s |
||
3396 | je fast_save |
||
3397 | cmp ah,15 ;ctrl+o |
||
3398 | je fast_open |
||
3399 | |||
3400 | cmp ah,27 ;esli escape |
||
3401 | jne noesc00 |
||
3402 | jmp closethis ;to zakrivaem okno i nifiga ne delayem |
||
3403 | |||
3404 | noesc00: |
||
3405 | cmp dword [pos00],71 ;200 ;42 |
||
3406 | jae fastso_still ;if pos>71 then jump to still |
||
3407 | |||
3408 | ;============letters================== |
||
3409 | ;~~~~~~~TEST CODE~~~~~~~~~ |
||
3410 | ; upper case |
||
3411 | shr eax,8 |
||
3412 | cmp eax,dword 31 |
||
3413 | jbe no_lit |
||
3414 | cmp eax,dword 95 |
||
3415 | jb capital |
||
3416 | sub eax,32 |
||
3417 | capital: |
||
3418 | ;~~~~~~~~~~~~~~~~~~~~~~~~~ |
||
3419 | mov edi,mypath ;filename ;mypath ;**************PATHNAME |
||
3420 | add edi,71 ;200 ;count of letters |
||
3421 | mov esi,edi |
||
3422 | dec esi |
||
3423 | mov ecx,71 ;200 ;again??? |
||
3424 | sub ecx,[pos00] |
||
3425 | std |
||
3426 | rep movsb |
||
3427 | |||
3428 | ;shr eax,8 |
||
3429 | mov esi,mypath ;filename ;*************PATH AGAIN |
||
3430 | add esi,[pos00] |
||
3431 | mov byte [esi],al |
||
3432 | inc dword [pos00] |
||
3433 | call draw_string00 |
||
3434 | |||
3435 | no_lit: |
||
3436 | jmp fastso_still |
||
3437 | ;=============================== |
||
3438 | shiftback00: |
||
3439 | mov edi,mypath ;filename ;******PATH |
||
3440 | add edi,[pos00] |
||
3441 | mov esi,edi |
||
3442 | inc esi |
||
3443 | mov ecx,71 ;200 ; count??? |
||
3444 | sub ecx,[pos00] |
||
3445 | cld |
||
3446 | rep movsb |
||
3447 | ret |
||
3448 | |||
3449 | ;****************************************************************************** |
||
3450 | |||
3451 | ;====button |
||
3452 | fbut: |
||
3453 | mov eax,17 |
||
3454 | int 0x40 |
||
3455 | cmp ah,17 |
||
3456 | je fast_save |
||
3457 | cmp ah,18 |
||
3458 | je fast_open |
||
3459 | cmp ah,19 |
||
3460 | je closethis |
||
3461 | jmp fastso_still |
||
3462 | ;****************************************************************************** |
||
3463 | ;****************************************************************************** |
||
3464 | |||
3465 | fast_open: |
||
3466 | call path_copy |
||
3467 | call set_title |
||
3468 | mov [to_return],1 |
||
3469 | call do_load_file |
||
3470 | jmp closethis |
||
3471 | fast_save: |
||
3472 | call path_copy |
||
3473 | call save_file |
||
3474 | call set_title |
||
3475 | ;call copy_fpath_s |
||
3476 | closethis: |
||
3477 | mov [to_return],0 |
||
3478 | cmp [error_found],1 |
||
3479 | je @f |
||
3480 | call activate_main |
||
3481 | @@: |
||
3482 | mov [error_found],0 |
||
3483 | close |
||
3484 | |||
3485 | |||
3486 | activate_main: |
||
3487 | mov eax,9 |
||
3488 | mov ebx,procinfo |
||
3489 | mov ecx,[proccount] |
||
3490 | @@: |
||
3491 | dec ecx |
||
3492 | jz @f ; counter=0 => not found? => return |
||
3493 | mov eax,9 |
||
3494 | int 0x40 |
||
3495 | mov edx,[procinfo.PID] |
||
3496 | cmp edx,[PID] |
||
3497 | jne @b |
||
3498 | |||
3499 | ;found: ecx = process_number |
||
3500 | mov eax,18 |
||
3501 | mov ebx,3 |
||
3502 | int 0x40 |
||
3503 | |||
3504 | mov eax,5 |
||
3505 | mov ebx,eax |
||
3506 | int 0x40 |
||
3507 | |||
3508 | @@: |
||
3509 | ret |
||
3510 | |||
3511 | |||
3512 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
3513 | doyouwannasave: |
||
3514 | ;****************************************************************************** |
||
3515 | cmp [modified],0 |
||
3516 | je newfile |
||
3517 | mov eax,55 ; beep |
||
3518 | mov ebx,eax |
||
3519 | mov esi,save_beep1 |
||
3520 | int 0x40 |
||
3521 | delay 4 |
||
3522 | mov eax,55 ; beep |
||
3523 | mov ebx,eax |
||
3524 | mov esi,save_beep2 |
||
3525 | int 0x40 |
||
3526 | |||
3527 | mov eax,13 |
||
3528 | mov ebx,150*65536+200 |
||
3529 | mov ecx,100*65536+70 |
||
3530 | mov edx,[sc.work_graph] ;0x00dd9438 ;0x00ff7512 |
||
3531 | int 0x40 |
||
3532 | |||
3533 | mov eax,38 |
||
3534 | mov ebx,150*65536+350 |
||
3535 | mov ecx,100*65536+100 |
||
3536 | mov edx,cl_White |
||
3537 | int 0x40 |
||
3538 | mov eax,38 |
||
3539 | mov ebx,150*65536+350 |
||
3540 | mov ecx,170*65536+170 |
||
3541 | mov edx,cl_White |
||
3542 | int 0x40 |
||
3543 | mov eax,38 |
||
3544 | mov ebx,150*65536+150 |
||
3545 | mov ecx,100*65536+170 |
||
3546 | mov edx,cl_White |
||
3547 | int 0x40 |
||
3548 | mov eax,38 |
||
3549 | mov ebx,350*65536+350 |
||
3550 | mov ecx,100*65536+170 |
||
3551 | mov edx,cl_White |
||
3552 | int 0x40 |
||
3553 | |||
122 | diamond | 3554 | if lang eq ru |
111 | heavyiron | 3555 | putlabel 190,120,'Сохранить документ?',cl_White |
3556 | |||
3557 | drawlbut 170,140,30,15,'Да',46,[sc.work_button],cl_White |
||
3558 | drawlbut 230,140,30,15,'Нет',45,[sc.work_button],cl_White |
||
3559 | drawlbut 290,140,45,15,'Отмена',47,[sc.work_button],cl_White |
||
122 | diamond | 3560 | else |
3561 | putlabel 190,120,'Save document?',cl_White |
||
111 | heavyiron | 3562 | |
122 | diamond | 3563 | drawlbut 170,140,30,15,'Yes',46,[sc.work_button],cl_White |
3564 | drawlbut 230,140,30,15,'No',45,[sc.work_button],cl_White |
||
3565 | drawlbut 290,140,45,15,'Cancel',47,[sc.work_button],cl_White |
||
3566 | end if |
||
3567 | |||
111 | heavyiron | 3568 | mov [exit_wnd_on],1 |
3569 | jmp still |
||
3570 | ;------------- |
||
3571 | newfile: |
||
3572 | ;if filename is not NEWDOC## than change it to it! |
||
3573 | mov eax,dword [orig_filename] |
||
3574 | cmp dword [filename],eax ;[orig_filename] |
||
3575 | je @f |
||
3576 | cld |
||
3577 | mov esi,orig_filename |
||
3578 | mov edi,filename |
||
3579 | mov ecx,71 ;50 |
||
3580 | rep movsb |
||
3581 | mov edi,filename |
||
3582 | mov ecx,71 ;50 |
||
3583 | xor eax,eax |
||
3584 | repne scasb |
||
3585 | sub edi,filename |
||
3586 | dec edi |
||
3587 | mov [filename_len],edi |
||
3588 | |||
3589 | @@: |
||
3590 | |||
3591 | call change_fname |
||
3592 | call set_title |
||
3593 | call draw_window_for_dialogs |
||
3594 | call empty_work_space |
||
3595 | mov [lines],1 |
||
3596 | jmp do_load_file.restorecursor |
||
3597 | |||
3598 | change_fname: |
||
3599 | cmp [filename+7],'9' |
||
3600 | jne addfname |
||
3601 | cmp [filename+6],'9' |
||
3602 | je error_creating_new_file |
||
3603 | mov [filename+7],'0' |
||
3604 | add [filename+6],0x1 |
||
3605 | jmp leavenow |
||
3606 | addfname: |
||
3607 | add [filename+7],0x1 |
||
3608 | leavenow: |
||
3609 | ret |
||
3610 | |||
3611 | set_title: |
||
3612 | cmp [error2_found],1 |
||
3613 | je no_set_title |
||
3614 | mov esi, filename |
||
3615 | mov edi, header |
||
3616 | mov ecx, [filename_len] |
||
3617 | mov eax, ecx |
||
3618 | add eax, 10 |
||
3619 | mov [headlen], eax |
||
3620 | cld |
||
3621 | rep movsb |
||
3622 | |||
3623 | mov [edi], dword ' - ' |
||
3624 | add edi, 3 |
||
3625 | mov esi, htext |
||
3626 | mov ecx, htext.size |
||
3627 | rep movsb |
||
3628 | |||
3629 | call drawwindow |
||
3630 | no_set_title: |
||
3631 | mov [error2_found],0 |
||
3632 | ret |
||
3633 | |||
3634 | draw_window_for_dialogs: |
||
3635 | call clear_screen |
||
3636 | call drawwindow |
||
3637 | ret |
||
3638 | |||
3639 | copy_fpath: |
||
3640 | call mask_events |
||
3641 | call path_copy |
||
3642 | call set_title |
||
3643 | call draw_window_for_dialogs |
||
3644 | jmp do_load_file |
||
3645 | |||
3646 | copy_fpath_s: |
||
3647 | call mask_events |
||
3648 | call path_copy |
||
3649 | call save_file |
||
3650 | call set_title |
||
3651 | call draw_window_for_dialogs |
||
3652 | jmp still |
||
3653 | |||
3654 | path_copy: |
||
3655 | cld |
||
3656 | mov esi,mypath |
||
3657 | mov edi,filename |
||
3658 | mov ecx,250 ;71 ;50 |
||
3659 | rep movsb |
||
3660 | mov edi,filename |
||
3661 | mov ecx,250 ;71 ;50 |
||
3662 | xor eax,eax |
||
3663 | repne scasb |
||
3664 | sub edi,filename |
||
3665 | dec edi |
||
3666 | mov [filename_len],edi |
||
3667 | ret |
||
3668 | |||
3669 | openerror: |
||
3670 | mov eax,360 |
||
3671 | mov ebx,openerrtext |
||
3672 | mov ecx,1 |
||
3673 | call alert_box |
||
3674 | |||
3675 | cmp [to_return2],1 |
||
3676 | jne jmp_to_still |
||
3677 | mov [to_return2],0 |
||
3678 | mov [error_found],1 |
||
3679 | call mask_events |
||
3680 | |||
3681 | ret |
||
3682 | |||
3683 | saveerror: |
||
3684 | mov eax,390 |
||
3685 | mov ebx,saveerrtext |
||
3686 | mov ecx,1 |
||
3687 | call alert_box |
||
3688 | cmp [to_return2],0 |
||
3689 | je jmp_to_still |
||
3690 | mov [to_return2],0 |
||
3691 | mov [error_found],1 |
||
3692 | call mask_events |
||
3693 | ret |
||
3694 | ;jmp still |
||
3695 | jmp_to_still: |
||
3696 | call mask_events |
||
3697 | jmp still |
||
3698 | |||
3699 | error_creating_new_file: |
||
3700 | mov eax,200 |
||
3701 | mov ebx,newfileerror |
||
3702 | mov ecx,1 |
||
3703 | call alert_box |
||
3704 | jmp still |
||
3705 | |||
3706 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
3707 | ;;;;;;;;;;;;;;MENU;;;;;;;;;;;;;;;;;;;;;; |
||
3708 | draw_win_menu: |
||
3709 | |||
3710 | ;mov eax,8 |
||
3711 | ;mov ebx,145*65536+276 |
||
3712 | ;mov ecx,22*65536+15 |
||
3713 | ;mov edx,00100000000000000000000000001111b |
||
3714 | ;mov esi,0x00aaaaaa |
||
3715 | ;int 0x40 |
||
3716 | |||
3717 | mov eax,13 |
||
3718 | mov ebx,5*65536+497 |
||
3719 | mov ecx,22*65536+17 |
||
3720 | mov edx,[sc.work_graph] ;0x00999999 |
||
3721 | int 0x40 |
||
3722 | mov ecx,39*65536+5 |
||
3723 | mov edx,0x00aaaaaa |
||
3724 | int 0x40 |
||
3725 | |||
122 | diamond | 3726 | if lang eq ru |
111 | heavyiron | 3727 | drawlbut 5,22,70,15,'Файл',97,[sc.work_button],[sc.work_button_text] |
3728 | drawlbut 75,22,70,15,'Код',98,[sc.work_button],[sc.work_button_text] |
||
3729 | drawlbut 145,22,70,15,'Текст',96,[sc.work_button],[sc.work_button_text] |
||
3730 | drawlbut 431,22,70,15,'Справка',99,[sc.work_button],[sc.work_button_text] |
||
122 | diamond | 3731 | else |
3732 | drawlbut 5,22,70,15,'File',97,[sc.work_button],[sc.work_button_text] |
||
3733 | drawlbut 75,22,70,15,'Code',98,[sc.work_button],[sc.work_button_text] |
||
3734 | drawlbut 145,22,70,15,'Text',96,[sc.work_button],[sc.work_button_text] |
||
3735 | drawlbut 431,22,70,15,'Help',99,[sc.work_button],[sc.work_button_text] |
||
3736 | end if |
||
111 | heavyiron | 3737 | |
3738 | ret |
||
3739 | |||
3740 | draw_win_menu_file: |
||
3741 | call clear_screen |
||
3742 | call drawwindow |
||
3743 | ;mov eax,13 |
||
3744 | ;mov ebx,5*65536+71 |
||
3745 | ;mov ecx,35*65536+90 |
||
3746 | ;mov edx,[sc.grab_button];0x00999999 |
||
3747 | ;int 0x40 |
||
3748 | ;mov eax,38 |
||
3749 | ;mov ebx,5*65536+35 |
||
3750 | ;mov ecx,40*65536+47 |
||
3751 | ;mov edx,0x00ff0000 |
||
3752 | ;int 0x40 |
||
3753 | mov [menu_is_on],1 |
||
3754 | |||
122 | diamond | 3755 | if lang eq ru |
111 | heavyiron | 3756 | drawlbut 5,38,70,15,'Новое окно',100,[sc.grab_button],[sc.grab_button_text] |
3757 | drawlbut 5,53,70,15,'Новый',101,[sc.grab_button],[sc.grab_button_text] |
||
3758 | drawlbut 5,68,70,15,'Сохранить',2,[sc.grab_button],[sc.grab_button_text] |
||
3759 | drawlbut 5,83,70,15,'Сохр. как',102,[sc.grab_button],[sc.grab_button_text] |
||
3760 | drawlbut 5,98,70,15,'Открыть',103,[sc.grab_button],[sc.grab_button_text] |
||
3761 | drawlbut 5,113,70,15,'Выход',104,[sc.grab_button],[sc.grab_button_text] |
||
122 | diamond | 3762 | else |
3763 | drawlbut 5,38,70,15,'New window',100,[sc.grab_button],[sc.grab_button_text] |
||
3764 | drawlbut 5,53,70,15,'New',101,[sc.grab_button],[sc.grab_button_text] |
||
3765 | drawlbut 5,68,70,15,'Save',2,[sc.grab_button],[sc.grab_button_text] |
||
3766 | drawlbut 5,83,70,15,'Save as',102,[sc.grab_button],[sc.grab_button_text] |
||
3767 | drawlbut 5,98,70,15,'Open',103,[sc.grab_button],[sc.grab_button_text] |
||
3768 | drawlbut 5,113,70,15,'Exit',104,[sc.grab_button],[sc.grab_button_text] |
||
3769 | end if |
||
111 | heavyiron | 3770 | jmp still |
3771 | |||
3772 | draw_win_menu_code: |
||
3773 | call clear_screen |
||
3774 | call drawwindow |
||
122 | diamond | 3775 | if lang eq ru |
111 | heavyiron | 3776 | drawlbut 75,38,70,15,'Компил.',10000,[sc.grab_button],[sc.grab_button_text] |
3777 | drawlbut 75,53,70,15,'Запустить',10001,[sc.grab_button],[sc.grab_button_text] |
||
3778 | drawlbut 75,68,70,15,'Доска отл.',10002,[sc.grab_button],[sc.grab_button_text] |
||
3779 | drawlbut 75,83,70,15,'SysFunc',10003,[sc.grab_button],[sc.grab_button_text] |
||
122 | diamond | 3780 | else |
3781 | drawlbut 75,38,70,15,'Compile',10000,[sc.grab_button],[sc.grab_button_text] |
||
3782 | drawlbut 75,53,70,15,'Run',10001,[sc.grab_button],[sc.grab_button_text] |
||
3783 | drawlbut 75,68,70,15,'Debug board',10002,[sc.grab_button],[sc.grab_button_text] |
||
3784 | drawlbut 75,83,70,15,'SysFunc',10003,[sc.grab_button],[sc.grab_button_text] |
||
3785 | end if |
||
111 | heavyiron | 3786 | mov [menu_is_on],1 |
3787 | jmp still |
||
3788 | |||
3789 | draw_win_menu_text: |
||
3790 | call clear_screen |
||
3791 | call drawwindow |
||
122 | diamond | 3792 | if lang eq ru |
111 | heavyiron | 3793 | drawlbut 145,38,70,15,'GoTo Line#',95,[sc.grab_button],[sc.grab_button_text] |
3794 | drawlbut 145,53,70,15,'Найти',92,[sc.grab_button],[sc.grab_button_text] |
||
3795 | drawlbut 145,68,70,15,'Найти далее',50,[sc.grab_button],[sc.grab_button_text] |
||
122 | diamond | 3796 | else |
3797 | drawlbut 145,38,70,15,'GoTo Line#',95,[sc.grab_button],[sc.grab_button_text] |
||
3798 | drawlbut 145,53,70,15,'Find',92,[sc.grab_button],[sc.grab_button_text] |
||
3799 | drawlbut 145,68,70,15,'Find next',50,[sc.grab_button],[sc.grab_button_text] |
||
3800 | end if |
||
111 | heavyiron | 3801 | mov [menu_is_on],1 |
3802 | jmp still |
||
3803 | |||
3804 | new_pad_wnd: |
||
3805 | mov eax,19 |
||
3806 | mov ebx,tinypad_filename |
||
3807 | mov ecx,0 |
||
3808 | int 0x40 |
||
3809 | jmp still |
||
3810 | |||
3811 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
3812 | ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; |
||
122 | diamond | 3813 | if lang eq ru |
111 | heavyiron | 3814 | openerrtext db 'Ошибка открытия файла или открытие отменено!',0 |
3815 | saveerrtext db 'Ошибка сохранения файла или сохранение отменено!',0 |
||
122 | diamond | 3816 | newfileerror db 'Невозможно создать новый файл',0 |
3817 | else |
||
3818 | openerrtext db 'Error while opening file or opening canceled!',0 |
||
3819 | saveerrtext db 'Error while saving file or saving canceled!',0 |
||
3820 | newfileerror db 'Cannot create new file',0 |
||
3821 | end if |
||
111 | heavyiron | 3822 | ; ******************** |
3823 | ; ****** DATA ****** |
||
3824 | ; ******************** |
||
3825 | sz fasm_filename, 'FASM ' |
||
3826 | sz debug_filename, 'BOARD ' |
||
3827 | sz tinypad_filename, 'TINYPAD ' |
||
3828 | |||
3829 | lsz sysfuncs_filename,\ |
||
3830 | ru, <'SYSFUNCR.TXT',0>,\ |
||
3831 | en, <'SYSFUNCS.TXT',0> |
||
3832 | |||
3833 | sz setup, 'SETUP ' ; we need to run SETUP to change keyboard layout |
||
3834 | param_setup db 'LANG',0 ; parameter for SETUP |
||
3835 | |||
3836 | |||
3837 | addr dd filename ; address of input string |
||
3838 | |||
3839 | filename_len dd 12 |
||
3840 | filename db 'NEWDOC00.TXT' |
||
3841 | times 256 db 0;51-12 db 0 |
||
3842 | ;times db 0 ; я не знаю почему Вилл не поставил эту строчку |
||
3843 | orig_filename db 'NEWDOC00.TXT' |
||
3844 | rb 256 |
||
3845 | search_len dd 5 |
||
3846 | search_string db 'still' |
||
3847 | times 51-5 db 0 |
||
3848 | |||
3849 | case_sens db 0 ; for search function |
||
3850 | |||
3851 | align 4 |
||
3852 | comment_string: |
||
3853 | db ';***************************************' |
||
3854 | db '*************************************** ' |
||
3855 | |||
3856 | |||
3857 | |||
3858 | ; INTERFACE DATA: |
||
3859 | |||
3860 | |||
3861 | sz htext, 'TINYPAD' |
||
3862 | ;sz toolbar_btn_text, 'COMPILE RUN BOARD SYSFUNC' |
||
3863 | |||
3864 | |||
3865 | searcht: |
||
3866 | if lang eq ru |
||
3867 | db ' СТРОКА > ' |
||
3868 | db ' ПОИСК ' |
||
3869 | else |
||
3870 | db ' STRING > ' |
||
3871 | db ' SEARCH ' |
||
3872 | end if |
||
3873 | searchtl: |
||
3874 | |||
3875 | |||
3876 | htext2: |
||
3877 | if lang eq ru |
||
3878 | db ' ПОЗИЦИЯ 00:00000 ДЛИНА 00000 СТРОК ' |
||
3879 | else |
||
3880 | db 'POSITION 00:00000 LENGTH 00000 LINES ' |
||
3881 | end if |
||
3882 | htextlen2: |
||
3883 | |||
3884 | help_text: |
||
3885 | if lang eq ru |
||
3886 | db ' КОМАНДЫ: ' |
||
3887 | db ' ' |
||
3888 | db ' CTRL+F1 : Это окно ' |
||
3889 | db ' CTRL+S : Первая строка для копирования ' |
||
3890 | db ' CTRL+E : Последняя строка для копирования ' |
||
3891 | db ' CTRL+P : Вставить выбранное на текущую позицию ' |
||
3892 | db ' CTRL+D : Удалить строку ' |
||
3893 | db ' CTRL+L : Вставить строку-разделитель ' |
||
3894 | db ' CTRL+[ : Перейти в начало файла ' |
||
3895 | db ' CTRL+] : Перейти в конец файла ' |
||
3896 | db ' CTRL+F2 : Загрузить файл ' |
||
3897 | db ' CTRL+F3 : Поиск ' |
||
3898 | db ' CTRL+F4 : Сохранить файл ' |
||
3899 | db ' CTRL+F5 : Сохранить файл как... ' |
||
3900 | db ' CTRL+F6 : Ввести строку для поиска ' |
||
3901 | db ' CTRL+F7 : "Окно быстрого сохранения и загрузки" ' |
||
3902 | db ' CTRL+F8 : Сменить раскладку клавиатуры ' |
||
3903 | db ' CTRL+F9 : Компилировать файл ' |
||
3904 | db ' CTRL+F10 : Компилировать и запустить ' |
||
3905 | db ' F12 : Запустить доску отладки ' |
||
3906 | db 'x' |
||
3907 | else |
||
3908 | db ' COMMANDS: ' |
||
3909 | db ' ' |
||
3910 | db ' CTRL+F1 : SHOW THIS WINDOW ' |
||
3911 | db ' CTRL+S : SELECT FIRST STRING TO COPY ' |
||
3912 | db ' CTRL+E : SELECT LAST STRING TO COPY ' |
||
3913 | db ' CTRL+P : PASTE SELECTED TO CURRENT POSITION ' |
||
3914 | db ' CTRL+D : DELETE CURRENT LINE ' |
||
3915 | db ' CTRL+L : INSERT SEPARATOR LINE ' |
||
3916 | db ' CTRL+[ : GO TO THE BEGINNING OF FILE ' |
||
3917 | db ' CTRL+] : GO TO THE END OF FILE ' |
||
3918 | db ' CTRL+F2 : LOAD FILE ' |
||
3919 | db ' CTRL+F3 : SEARCH ' |
||
3920 | db ' CTRL+F4 : SAVE FILE ' |
||
3921 | db ' CTRL+F5 : SAVE FILE AS... ' |
||
3922 | db ' CTRL+F6 : ENTER SEARCH STRING ' |
||
3923 | db ' CTRL+F7 : DRAW "FAST SAVE AND OPEN" WINDOW ' |
||
3924 | db ' CTRL+F8 : CHANGE KEYBOARD LAYOUT ' |
||
3925 | db ' CTRL+F9 : COMPILE FILE ' |
||
3926 | db ' CTRL+F10 : RUN OUTFILE ' |
||
3927 | db ' F12 : OPEN DEBUG BOARD ' |
||
3928 | db 'x' |
||
3929 | end if |
||
3930 | |||
3931 | help_wnd_header: |
||
3932 | if lang eq ru |
||
3933 | db 'ПОМОЩЬ',0 |
||
3934 | else |
||
3935 | db 'TINYPAD HELP',0 |
||
3936 | end if |
||
3937 | |||
3938 | hlphead_len = $ - help_wnd_header |
||
3939 | |||
3940 | save_yes_no: |
||
3941 | if lang eq ru |
||
3942 | db 'Сохранить файл перед выходом?',0 |
||
3943 | else |
||
3944 | db 'Save file before exit?',0 |
||
3945 | end if |
||
3946 | |||
3947 | VScroll_1: |
||
3948 | dw 13 ;width +0 |
||
3949 | dw 489 ;x +2 |
||
3950 | dw 341 ;326 ;height +4 |
||
3951 | dw 43 ;y +6 |
||
3952 | dd 0 ;min +8 |
||
3953 | dd 100 ;scrl_max ;lines ;max +12 |
||
3954 | dd 0 ;cur_pos ;current +16 |
||
3955 | dd 1 ;small change +20 |
||
3956 | dd 10 ;big change +24 |
||
3957 | |||
3958 | App_Controls: |
||
3959 | dd VScroll_1 , drawvscroll, VScroll_mouse_over ; |
||
3960 | dd 0,0,0 ;last control do not delete |
||
3961 | |||
3962 | ; END OF INTERFACE DATA |
||
3963 | |||
3964 | symbols db '%#&*\:/<>|{}()[]=+-,. ' |
||
3965 | |||
3966 | error_beep: |
||
3967 | db 0xA0,0x30,0 |
||
3968 | save_beep1: |
||
3969 | db 0x84,0x43,0 |
||
3970 | save_beep2: |
||
3971 | db 0x84,0x48,0 |
||
3972 | |||
3973 | |||
3974 | align 4 |
||
3975 | fileinfo_read: |
||
3976 | dd 0 |
||
3977 | dd 0 |
||
3978 | dd 300000/512 |
||
3979 | dd 0x10000 |
||
3980 | dd 0x70000 |
||
3981 | pathfile_read: |
||
3982 | times 250 db 0 ;51 db 0 |
||
3983 | |||
3984 | align 4 |
||
3985 | fileinfo_write: |
||
3986 | dd 1 |
||
3987 | dd 0 |
||
3988 | dd 0 |
||
3989 | dd 0x10000 |
||
3990 | dd 0x70000 |
||
3991 | pathfile_write: |
||
3992 | times 250 db 0 ; 51 db 0 |
||
3993 | |||
3994 | align 4 |
||
3995 | |||
3996 | temp dd 0xabc ; used in read_string |
||
3997 | d_status dd 0 |
||
3998 | |||
3999 | color_tbl: |
||
4000 | dd 0x00000000 ; text |
||
4001 | dd 0x00000000 ; instruction |
||
4002 | dd 0x00000000 ; register |
||
4003 | dd 0x00009000 ; number |
||
4004 | dd 0x00a00000 ; quote |
||
4005 | dd 0x00909090 ; comment |
||
4006 | dd 0x003030f0 ; symbol |
||
4007 | |||
4008 | |||
4009 | next_not_quote2 db 0 ; " |
||
4010 | next_not_quote db 0 ; ' |
||
4011 | quote db 0 |
||
4012 | asm_mode db 0 ; ASM highlight? |
||
4013 | tmpabc db 0 |
||
4014 | |||
4015 | |||
4016 | I_PARAM db 0 ; parameters are HERE - параметры будут начинаться ЗДЕСЬ! |
||
4017 | TINYPAD_END: ; end of file |
||
4018 | |||
4019 | |||
4020 | ; Uninitialised data |
||
4021 | ; Неинициализированные данные |
||
4022 | align 4 |
||
4023 | |||
4024 | posx dd ? ; x на экране (on the screen) |
||
4025 | posy dd ? ; y на экране |
||
4026 | post dd ? ; смещение от начала - offset |
||
4027 | posl dd ? |
||
4028 | lines dd ? ; количество строк в документе |
||
4029 | posxm dd ? |
||
4030 | posym dd ? |
||
4031 | |||
4032 | dstart dd ? ; смещение по оси y для отрисовки кнопок и др. |
||
4033 | |||
4034 | filelen dd ? ; длина файла |
||
4035 | |||
4036 | PID dd ? ; идентификатор процесса |
||
4037 | proccount dd ? ; количество процессов |
||
4038 | |||
4039 | filesize dd ? ; размер файла |
||
4040 | ya dd ? ; для read_string |
||
4041 | slines dd ? ; number of strings on the screen - количество строк на экране |
||
4042 | |||
4043 | run_outfile dd ? ; for FASM |
||
4044 | copy_start dd ? ; Ctrl+S |
||
4045 | copy_count dd ? ; Ctrl+E |
||
4046 | headlen dd ? ; header length |
||
4047 | do_not_draw dd ? ; to draw or not to draw - this is a serious question ;) |
||
4048 | |||
4049 | MainWndClosed dd ? |
||
4050 | sc system_colors |
||
4051 | |||
4052 | to_return db 0 |
||
4053 | to_return2 db 0 |
||
4054 | error_found db 0 |
||
4055 | error2_found db 0 |
||
4056 | |||
4057 | header: ; window header - заголовок окна |
||
4058 | rb 256 |
||
4059 | |||
4060 | ; информация о процессе записывается в эту структуру |
||
4061 | procinfo process_information |
||
4062 | |||
4063 | virtual at procinfo |
||
4064 | fasm_parameters rb 256 |
||
4065 | end virtual |
||
4066 | pos00 dd 0 |
||
4067 | newdoc db ? |
||
4068 | mypath: |
||
4069 | times 258 db 0 |
||
4070 | real_posy dd 0 |
||
4071 | vscroll_size dd 0 |
||
4072 | vscroll_pos dd 0 |
||
4073 | cur_pos dd 0 |
||
4074 | scrl_max dd 100 |
||
4075 | |||
4076 | mouse_x dd 0 |
||
4077 | mouse_y dd 0 |
||
4078 | mousey dw 0 |
||
4079 | mousex dw 0 |
||
4080 | mouseb dd 0 |
||
4081 | |||
4082 | num_goto_string dd 0 |
||
4083 | |||
4084 | menu_is_on db 0 |
||
4085 | exit_wnd_on db 0 |
||
4086 | modified db 0 |
||
4087 | ;fast save n open stack |
||
4088 | rb 1024 |
||
4089 | so_stack: |
||
4090 | ;growing down |
||
4091 | ; the end!>'SYSFUNCS.TXT',0>'SYSFUNCR.TXT',0>16 |
||
4092 | |||
4093 |