Rev 131 | Rev 1429 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
31 | halyavin | 1 | ;constants |
2 | ;for keys |
||
3 | KEY_ESC equ 27 |
||
4 | KEY_PGDN equ 183 |
||
5 | KEY_PGUP equ 184 |
||
6 | KEY_LNDN equ 177 |
||
7 | KEY_LNUP equ 178 |
||
8 | KEY_RIGHT equ 179 |
||
9 | KEY_LEFT equ 176 |
||
10 | KEY_HOME equ 180 |
||
11 | KEY_END equ 181 |
||
12 | KEY_HOMETOP equ 251 ;Ctrl + '[' |
||
13 | KEY_ENDBOTTOM equ 253 ;Ctrl + ']' |
||
14 | |||
15 | use32 |
||
16 | org 0x0 |
||
17 | db 'MENUET01' ; 8 byte id |
||
18 | dd 0x01 ; header version |
||
19 | dd START ; start of code |
||
20 | dd I_END ; size of image |
||
21 | dd 0x80000 ; memory for app |
||
22 | dd 0x80000 ; esp |
||
23 | dd 0x0 , 0x0 ; I_Param , I_Icon |
||
24 | |||
25 | include 'lang.inc' |
||
485 | heavyiron | 26 | include '..\..\..\macros.inc' |
31 | halyavin | 27 | |
28 | |||
29 | START: ; start of execution |
||
30 | |||
31 | mov eax,40 |
||
32 | mov ebx,100111b ;event mouse |
||
485 | heavyiron | 33 | mcall |
31 | halyavin | 34 | mov dword [process_info+42],540 |
35 | mov dword [process_info+46],414 |
||
485 | heavyiron | 36 | |
37 | red: |
||
31 | halyavin | 38 | call draw_window |
39 | |||
40 | still: |
||
41 | mov eax,10 ; wait here for event |
||
485 | heavyiron | 42 | mcall |
31 | halyavin | 43 | dec al ; redraw request ? |
44 | je red |
||
45 | dec al ; key in buffer ? |
||
46 | je key |
||
47 | dec al ; button in buffer ? |
||
48 | je button |
||
49 | ; mouse event received |
||
50 | mouse: |
||
51 | mov eax,37 |
||
52 | mov ebx,2 |
||
485 | heavyiron | 53 | mcall |
31 | halyavin | 54 | or eax,eax |
55 | jz still |
||
56 | cmp [menu_opened],1 |
||
57 | jne still |
||
58 | mov [menu_opened],0 |
||
59 | |||
60 | |||
61 | key: ; key |
||
62 | mov eax,2 |
||
485 | heavyiron | 63 | mcall |
31 | halyavin | 64 | ; test al,al |
65 | ; jnz still |
||
66 | cmp ah,KEY_ESC |
||
67 | jz close |
||
68 | mov al,[o_s_flag] |
||
69 | and al,8 ;set bit 3? |
||
70 | jz edit_keys ;not - no output to filename area |
||
71 | cmp ah,8 ;BACKSPACE |
||
72 | jnz no_backspace |
||
73 | dec [name_l] |
||
74 | cmp [name_l],0 |
||
75 | mov edx,filename |
||
76 | je A1 |
||
77 | jg @f |
||
78 | mov [name_l],0 |
||
79 | jmp A1 |
||
80 | @@: |
||
81 | add dl,[name_l] |
||
82 | A1: |
||
83 | sub [x_cursor],0x60000 |
||
84 | mov [edx],byte 0 |
||
85 | cmp [x_cursor],0xb0005 |
||
86 | jge @f |
||
87 | mov [x_cursor],0xb0005 |
||
88 | @@: |
||
89 | call redraw_window |
||
90 | jmp still ;END BACKSPACE |
||
91 | |||
92 | no_backspace: |
||
93 | cmp ah,0x30 ;'0' |
||
94 | jl A2 |
||
95 | cmp ah,0x39 ;'9' |
||
96 | jle bigsym |
||
97 | cmp ah,65 ;'A' |
||
98 | jbe bigsym |
||
99 | cmp ah,90 ;'Z' |
||
100 | jle bigsym |
||
101 | cmp ah,97 ;'a' |
||
102 | jbe smsym |
||
103 | cmp ah,122;'z' |
||
104 | jle smsym |
||
105 | jmp still |
||
106 | A2: |
||
107 | cmp ah,46 ;'.' |
||
108 | jz bigsym |
||
109 | cmp ah,0x20 |
||
110 | jz bigsym |
||
111 | jmp still |
||
112 | smsym: |
||
113 | sub ah,32 |
||
114 | bigsym: |
||
115 | cmp [name_l],13 ;yes. filename length <13 |
||
116 | jl @f |
||
117 | sub [o_s_flag],8 ;not - disable output to filename area |
||
118 | mov [x_cursor],0x680005; - set x-base & x-size |
||
119 | jmp _end_keys |
||
120 | @@: |
||
121 | mov edx,filename ; |
||
122 | add dl,[name_l] |
||
123 | mov [edx],ah |
||
124 | inc [name_l] |
||
125 | add [x_cursor],0x60000 |
||
126 | _end_keys: |
||
127 | call redraw_window |
||
128 | jmp still |
||
129 | edit_keys: |
||
130 | cmp ah,KEY_PGDN |
||
131 | jnz @f |
||
132 | call PgDn |
||
133 | jmp still |
||
134 | @@: |
||
135 | cmp ah,KEY_PGUP |
||
136 | jnz @f |
||
137 | call PgUp |
||
138 | jmp still |
||
139 | @@: |
||
140 | cmp ah,KEY_HOME ;Home |
||
141 | jnz @f |
||
142 | call Home |
||
143 | jmp still |
||
144 | @@: |
||
145 | cmp ah,KEY_END ;Home |
||
146 | jnz @f |
||
147 | call _End |
||
148 | jmp still |
||
149 | @@: |
||
150 | cmp ah,KEY_HOMETOP |
||
151 | jnz @f |
||
152 | call CtrlHome |
||
153 | jmp still |
||
154 | @@: |
||
155 | cmp ah,KEY_ENDBOTTOM |
||
156 | jnz @f |
||
157 | call CtrlEnd |
||
158 | jmp still |
||
159 | @@: |
||
160 | cmp ah,KEY_LNDN |
||
161 | jnz @f |
||
162 | call LnDn |
||
163 | jmp still |
||
164 | @@: |
||
165 | cmp ah,KEY_LNUP |
||
166 | jnz @f |
||
167 | call LnUp |
||
168 | jmp still |
||
169 | @@: |
||
170 | cmp ah,KEY_RIGHT ;Right |
||
171 | jnz @f |
||
172 | call Right |
||
173 | jmp still |
||
174 | @@: |
||
175 | cmp ah,KEY_LEFT ;Left |
||
176 | jnz @f |
||
177 | call Left |
||
178 | @@: |
||
179 | ;редактирование строки в hex-представлении |
||
180 | mov esi,[current] |
||
181 | mov bl,[posx] |
||
182 | add esi,0x10000 ;0x80000 |
||
183 | cmp ah,0x30 |
||
184 | jl still ;ah<'0' |
||
185 | cmp ah,0x39 |
||
186 | jle A23 ;ah='0'...'9' - перевод из символов в hex |
||
187 | ;проверка на коды старших hex-цифр |
||
188 | cmp ah,0x61 ;ah<'a' |
||
189 | jl A27 ;может быть вводятся большие буквы? |
||
190 | cmp ah,0x66 ;ah>'f' |
||
191 | jg still |
||
192 | sub ah,0x20 ;конвертируем в большие буквы |
||
193 | jmp A24 |
||
194 | A27: |
||
195 | cmp ah,0x41 |
||
196 | jl still ;ah<'A' |
||
197 | cmp ah,0x46 |
||
198 | jg still ;ah>'F' |
||
199 | A24: |
||
200 | add ah,9 |
||
201 | A23: |
||
202 | mov dl,[esi];оригинальный байт |
||
203 | and bl,1 ;если нечет - редактируется младший полубайт, чет - старший |
||
204 | jz hi_half_byte |
||
205 | ;младший полубайт |
||
206 | and ah,0x0f ;обнуляем старший полубайт введенной цифры |
||
207 | ;если ah = 0x30...0x39, то все нормально |
||
208 | ;если ah = 0x41...0x46, то на метке А24 получим |
||
209 | ;ah = 0x4A...0x4F и тоже все нормально |
||
210 | and dl,0xf0 ;обнуляем младший полубайт у оригинального байта |
||
211 | jmp patch_byte |
||
212 | hi_half_byte: |
||
213 | ;старший полубайт |
||
214 | shl ah,4 ;одновременно сдвигаем нужное значение в старший полубайт |
||
215 | ;и обнуляем младший |
||
216 | and dl,0x0f ;обнуляем старший полубайт у оригинального байта |
||
217 | patch_byte: |
||
218 | or ah,dl ;объединяем полубайты |
||
219 | mov [esi],ah;патчим в памяти |
||
220 | mov ebx,0x20100 |
||
221 | movzx ecx,ah ;для функции вывода числа |
||
222 | ;теперь надо расчитать координаты вывода для числа |
||
223 | ;edx = x shl 16 + y |
||
224 | mov edx,[x_cursor] |
||
225 | mov edi,[y_cursor] |
||
226 | and edx,0xffff0000 |
||
227 | shr edi,0x10 |
||
228 | xor esi,esi |
||
229 | or edx,edi |
||
230 | mov eax,47 |
||
231 | add edx,8 |
||
485 | heavyiron | 232 | mcall |
31 | halyavin | 233 | call redraw_window |
234 | jmp still |
||
235 | |||
236 | button: ; button |
||
237 | mov eax,17 ; get id |
||
485 | heavyiron | 238 | mcall |
31 | halyavin | 239 | dec ah ;close programm button |
240 | jne @f |
||
241 | close: |
||
242 | mov eax,-1 ; close this program |
||
485 | heavyiron | 243 | mcall |
31 | halyavin | 244 | @@: |
245 | dec ah |
||
246 | jne @f |
||
247 | call redraw_window |
||
248 | call menufile |
||
249 | jmp still |
||
250 | @@: |
||
251 | dec ah ;menu 'coding' button |
||
252 | jne @f |
||
253 | call redraw_window |
||
254 | call menucoding |
||
255 | jmp still |
||
256 | @@: |
||
257 | dec ah ;menu 'Help' button |
||
258 | jne @f |
||
259 | call redraw_window |
||
260 | call menuhelp |
||
261 | jmp still |
||
262 | @@: |
||
263 | ;now processed low_level menu buttons |
||
264 | ;id m_open = 5 |
||
265 | ;id m_save = 6 |
||
266 | ;id m_exit = 7 |
||
267 | ;id m_win2dos 8 |
||
268 | ;id m_win2koi 9 |
||
269 | ;id m_win2iso 10 |
||
270 | ;id m_dos2win 11 |
||
271 | ;id m_dos2koi 12 |
||
272 | ;id m_dos2iso 13 |
||
273 | ;id m_help 14 |
||
274 | ;id m_about 15 |
||
275 | dec ah ;open? |
||
276 | jne @f |
||
277 | cmp [o_s_flag],0 ;disable 'Open' if flag !=0 |
||
278 | jnz no_open |
||
279 | ; call redraw_window |
||
280 | mov [color],0x0072b9fc |
||
281 | call f2 ;set x_cursor & y_cursor for input filename |
||
282 | mov [o_s_flag],8 ;for output to filename area |
||
283 | no_open: |
||
284 | call redraw_window |
||
285 | jmp still |
||
286 | @@: |
||
287 | dec ah ;save? |
||
288 | jne @f |
||
289 | cmp [o_s_flag],1 ;enable save if flag = 1 |
||
290 | jnz no_save |
||
291 | movzx ecx,[name_l] ;begin clear filename string |
||
292 | mov edi,filename |
||
293 | xor al,al |
||
294 | jecxz no_clear |
||
295 | clear: |
||
296 | mov [edi+ecx],al |
||
297 | loop clear |
||
298 | mov [name_l],al ;set filename length = 0 |
||
299 | no_clear: ;ebd clear |
||
300 | call f2 ;set x_cursor & y_cursor for input filename |
||
301 | mov [o_s_flag],9 ;for output to filename area |
||
302 | no_save: |
||
303 | call redraw_window |
||
304 | jmp still |
||
305 | @@: |
||
306 | dec ah ;exit? |
||
307 | jne @f |
||
308 | jmp close |
||
309 | @@: |
||
310 | dec ah ;m_win2dos? |
||
311 | jne @f |
||
312 | push dword WIN_TABLE |
||
313 | push dword DOS_TABLE |
||
314 | call coding |
||
315 | call redraw_window |
||
316 | jmp still |
||
317 | @@: |
||
318 | dec ah ;m_win2koi? |
||
319 | jne @f |
||
320 | push WIN_TABLE |
||
321 | push KOI_TABLE |
||
322 | call coding |
||
323 | call redraw_window |
||
324 | jmp still |
||
325 | @@: |
||
326 | dec ah ;m_win2iso? |
||
327 | jne @f |
||
328 | push WIN_TABLE |
||
329 | push ISO_TABLE |
||
330 | call coding |
||
331 | call redraw_window |
||
332 | jmp still |
||
333 | @@: |
||
334 | dec ah ;m_dos2win? |
||
335 | jne @f |
||
336 | push DOS_TABLE |
||
337 | push WIN_TABLE |
||
338 | call coding |
||
339 | call redraw_window |
||
340 | jmp still |
||
341 | @@: |
||
342 | dec ah ;m_dos2koi? |
||
343 | jne @f |
||
344 | push DOS_TABLE |
||
345 | push KOI_TABLE |
||
346 | call coding |
||
347 | call redraw_window |
||
348 | jmp still |
||
349 | @@: |
||
350 | dec ah ;dos2iso? |
||
351 | jne @f |
||
352 | push DOS_TABLE |
||
353 | push ISO_TABLE |
||
354 | call coding |
||
355 | call redraw_window |
||
356 | jmp still |
||
357 | @@: |
||
358 | dec ah ;m_help? |
||
359 | jne @f |
||
360 | ;create new thread for output help info |
||
361 | ;parameter: address for entry_point thread |
||
362 | push help_thread |
||
363 | call create_process |
||
364 | call redraw_window |
||
365 | jmp still |
||
366 | @@: |
||
367 | dec ah ;m_about? |
||
368 | jne @f |
||
369 | ;create new thread for output about info |
||
370 | ;parameter: address for entry_point thread |
||
371 | push about_thread |
||
372 | call create_process |
||
373 | call redraw_window |
||
374 | jmp still |
||
375 | @@: |
||
376 | ;button 'Go' |
||
377 | and [o_s_flag],1 |
||
378 | jnz _savefile |
||
379 | ;open file |
||
380 | mov eax,6 |
||
381 | mov ebx,filename |
||
382 | xor ecx,ecx |
||
383 | or edx,-1 |
||
384 | mov esi,0x10000 |
||
485 | heavyiron | 385 | mcall |
31 | halyavin | 386 | inc [o_s_flag] |
387 | mov [sizefile],eax |
||
388 | jmp end_Go |
||
389 | _savefile: |
||
390 | ;save file |
||
391 | mov ebx,filename |
||
392 | mov ecx,0x10000 |
||
393 | mov edx,[sizefile] |
||
394 | xor esi,esi |
||
395 | dec edx |
||
396 | mov eax,33 |
||
485 | heavyiron | 397 | mcall |
31 | halyavin | 398 | end_Go: |
399 | call CtrlHome |
||
400 | jmp still |
||
401 | |||
402 | Right: |
||
403 | pushad |
||
404 | mov al,[posx] |
||
405 | inc al |
||
406 | cmp al,0x20 |
||
407 | jl @f |
||
408 | mov [posx],0 |
||
409 | mov [x_cursor],0x680005 |
||
410 | mov [text_cursor],0x01200000 |
||
411 | sub [current],0xf ;because [current] add 0x10 in LnDn |
||
412 | call LnDn |
||
413 | popad |
||
414 | ret |
||
415 | @@: |
||
416 | mov [posx],al |
||
417 | and al,1 |
||
418 | jnz @f ;not increment [current] |
||
419 | ;increment |
||
420 | add [x_cursor],0xa0000 |
||
421 | sub [text_cursor],0x40000 |
||
422 | inc [current] |
||
423 | jmp end_r |
||
424 | @@: |
||
425 | add [x_cursor],0x60000 |
||
426 | sub [text_cursor],0x60000 |
||
427 | end_r: |
||
428 | call redraw_window |
||
429 | popad |
||
430 | ret |
||
431 | |||
432 | Left: |
||
433 | pushad |
||
434 | mov al,[posx] |
||
435 | dec al |
||
436 | jge @f |
||
437 | mov [posx],0x1f |
||
438 | mov [x_cursor],0x015e0005 |
||
439 | mov [text_cursor],0x00840000 |
||
440 | add [current],0x0f |
||
441 | call LnUp |
||
442 | popad |
||
443 | ret |
||
444 | @@: |
||
445 | mov [posx],al |
||
446 | and al,1 |
||
447 | jnz @f ;decrement [current] |
||
448 | ;not decrement |
||
449 | sub [x_cursor],0x60000 |
||
450 | add [text_cursor],0x60000 |
||
451 | jmp end_l |
||
452 | @@: |
||
453 | cmp [current],0 |
||
454 | jle end_l |
||
455 | sub [x_cursor],0xa0000 |
||
456 | add [text_cursor],0x40000 |
||
457 | dec [current] |
||
458 | end_l: |
||
459 | call redraw_window |
||
460 | popad |
||
461 | ret |
||
462 | |||
463 | LnDn: |
||
464 | pushad |
||
465 | add [current],0x10 |
||
466 | movzx ecx,[lines] |
||
467 | cmp cl,[posy] |
||
468 | jl @f ;when counter strings >= number strings in window |
||
469 | add [y_cursor],0xa0000 |
||
470 | inc [posy] |
||
471 | call redraw_window |
||
472 | popad |
||
473 | ret |
||
474 | @@: |
||
475 | mov eax,0x10 |
||
476 | xor edx,edx |
||
477 | imul ecx |
||
478 | sub eax,0x10 |
||
479 | sub [end_str],eax |
||
480 | ; mov eax,[sizefile] |
||
481 | ; add eax,0x80000 |
||
482 | ; cmp eax,[end_str] |
||
483 | ; jge @f |
||
484 | ; mov [end_str],eax |
||
485 | ; @@: |
||
486 | call draw_window |
||
487 | popad |
||
488 | ret |
||
489 | |||
490 | LnUp: |
||
491 | pushad |
||
492 | sub [current],0x10 |
||
493 | cmp [current],0 |
||
494 | jge @f |
||
495 | mov [current],0 |
||
496 | @@: |
||
497 | cmp [posy],3 |
||
498 | jle @f ;when counter strings < number top string |
||
499 | sub [y_cursor],0xa0000 |
||
500 | dec [posy] |
||
501 | call redraw_window |
||
502 | popad |
||
503 | ret |
||
504 | @@: |
||
505 | ; movzx ecx,[lines] |
||
506 | ; mov eax,0x10 |
||
507 | ; xor edx,edx |
||
508 | ; imul ecx |
||
509 | ; add eax,0x10 |
||
510 | sub [end_str],0x10 |
||
511 | cmp [end_str],0x10000 |
||
512 | jge @f |
||
513 | mov [end_str],0x10000 |
||
514 | @@: |
||
515 | call redraw_window |
||
516 | popad |
||
517 | ret |
||
518 | |||
519 | CtrlEnd: |
||
520 | pushad |
||
521 | popad |
||
522 | ret |
||
523 | |||
524 | CtrlHome: |
||
525 | pushad |
||
526 | mov [x_cursor],0x00680005 ;устанавливаются значения, как при открытии |
||
527 | mov [y_cursor],0x00280008 |
||
528 | mov [text_cursor],0x01200000 |
||
529 | mov [posx],0 |
||
530 | mov [posy],3 |
||
531 | call b_in_screen |
||
532 | mov [end_str],0x10000 |
||
533 | mov [current],0 |
||
534 | call redraw_window |
||
535 | popad |
||
536 | ret |
||
537 | |||
538 | _End: |
||
539 | pushad |
||
540 | mov [x_cursor],0x015e0005 |
||
541 | mov [posx],0x1f |
||
542 | mov [text_cursor],0x00840000 |
||
543 | or [current],0xf |
||
544 | call b_in_screen |
||
545 | call redraw_window |
||
546 | popad |
||
547 | ret |
||
548 | |||
549 | Home: |
||
550 | pushad |
||
551 | mov [x_cursor],0x00680005 ;устанавливаются значения для начала строки |
||
552 | mov [posx],0 |
||
553 | mov [text_cursor],0x01200000 |
||
554 | and [current],0xfffffff0 |
||
555 | call b_in_screen |
||
556 | call redraw_window |
||
557 | popad |
||
558 | ret |
||
559 | |||
560 | PgDn: |
||
561 | pushad |
||
562 | xor edx,edx |
||
563 | movzx ecx,[lines] |
||
564 | mov eax,0x10 |
||
565 | imul ecx |
||
566 | add [current],eax |
||
567 | add [end_str],eax |
||
568 | call redraw_window |
||
569 | popad |
||
570 | ret |
||
571 | |||
572 | PgUp: |
||
573 | pushad |
||
574 | xor edx,edx |
||
575 | movzx ecx,[lines] |
||
576 | mov eax,0x10 |
||
577 | imul ecx |
||
578 | sub [current],eax |
||
579 | cmp [current],0 |
||
580 | jge @f |
||
581 | mov [current],0 |
||
582 | @@: |
||
583 | sub [end_str],eax |
||
584 | cmp [end_str],0x10000 |
||
585 | jge @f |
||
586 | ; call CtrlHome |
||
587 | mov [end_str],0x10000 |
||
588 | @@: |
||
589 | call redraw_window |
||
590 | popad |
||
591 | ret |
||
592 | |||
593 | b_in_screen: |
||
594 | pushad |
||
595 | call get_process_info |
||
596 | mov eax,[process_info+0x2e] |
||
597 | mov ebx,0x0a |
||
598 | sub eax,0x3c |
||
599 | cmp eax,0x10 ;now |
||
600 | jg @f ;now |
||
601 | mov [lines],0 ;now |
||
602 | jmp C1 ;now |
||
603 | @@: |
||
604 | xor edx,edx |
||
605 | div ebx |
||
606 | mov [lines],al |
||
607 | C1: |
||
608 | popad |
||
609 | ret |
||
610 | |||
611 | |||
612 | |||
613 | output_screen: |
||
614 | pushad |
||
615 | movzx ecx,[lines] |
||
616 | jecxz no_out ;now |
||
617 | cmp [rflag],1 |
||
618 | jz _redraw |
||
619 | mov eax,[end_str] |
||
620 | sub eax,0x80001 |
||
621 | cmp eax,[sizefile] |
||
622 | jl @f |
||
623 | _redraw: |
||
624 | xor edx,edx |
||
625 | mov eax,0x10 |
||
626 | imul ecx |
||
627 | sub [end_str],eax |
||
628 | cmp [end_str],0x10000 |
||
629 | jge A3 |
||
630 | mov [end_str],0x10000 |
||
631 | A3: |
||
632 | mov [rflag],0 |
||
633 | @@: |
||
634 | mov eax,0x28 |
||
635 | @@: |
||
636 | push ecx |
||
637 | push eax |
||
638 | call form_str |
||
639 | mov ebx,0x01880000 |
||
640 | add ebx,eax |
||
641 | mov ecx,0x00ffffff |
||
642 | add eax,10 |
||
643 | mov edx,[end_str] |
||
644 | push eax |
||
645 | sub edx,0x10 |
||
646 | mov esi,0x10 |
||
647 | mov eax,4 |
||
485 | heavyiron | 648 | mcall |
31 | halyavin | 649 | pop eax |
650 | pop ecx |
||
651 | loop @b |
||
652 | no_out: |
||
653 | popad |
||
654 | ret |
||
655 | |||
656 | |||
657 | |||
658 | form_str: |
||
659 | pushad |
||
660 | mov ebp,[end_str] ;последний выведенный байт |
||
661 | xor edi,edi ;счетчик байт <= 16 |
||
662 | ;вывести адрес |
||
663 | mov ecx,ebp |
||
664 | mov ebx,0x80100 ;8 цифр, 16-ричные, число в ecx |
||
665 | sub ecx,0x10000 ;нормализация адреса |
||
666 | mov edx,0x80000 ;начало по Х |
||
667 | add edx,[esp+0x24] ;начало по У |
||
668 | mov esi,0x00ffffff ;цвет |
||
669 | mov eax,47 ;вывести число |
||
485 | heavyiron | 670 | mcall |
31 | halyavin | 671 | add edx,0x600000 ;0x40 - 8chars + 0x20 - space |
672 | mov ebx,0x20100 ;2 цифры, 16-ричные, число в ecx |
||
673 | @@: |
||
674 | mov ecx,[ebp+edi] ;число в ecx |
||
675 | inc edi |
||
676 | and ecx,0xff |
||
677 | cmp edi,0x11 |
||
678 | jz endstr |
||
485 | heavyiron | 679 | mcall |
31 | halyavin | 680 | add edx,0x100000 |
681 | jmp @b |
||
682 | endstr: |
||
683 | dec edi |
||
684 | add ebp,edi |
||
685 | mov [end_str],ebp |
||
686 | popad |
||
687 | ret 4 |
||
688 | |||
689 | |||
690 | |||
691 | draw_cursor: |
||
692 | pushad |
||
693 | mov ebx,[x_cursor] |
||
694 | mov ecx,[esp+0x24] |
||
695 | mov edx,[color] |
||
696 | mov eax,13 |
||
485 | heavyiron | 697 | mcall |
31 | halyavin | 698 | movzx edi,[o_s_flag] |
699 | and edi,8 |
||
700 | jnz @f |
||
701 | add ebx,[text_cursor] |
||
485 | heavyiron | 702 | mcall |
31 | halyavin | 703 | @@: |
704 | popad |
||
705 | ret 4 |
||
706 | |||
707 | f2: |
||
708 | mov eax,[process_info+46] |
||
709 | mov [x_cursor],0xb0005 |
||
710 | sub eax,0x11 |
||
711 | ; mov [text_cursor],-1 |
||
712 | shl eax,0x10 |
||
713 | |||
714 | mov [y_filename_area],eax |
||
715 | ret |
||
716 | |||
717 | menufile: |
||
718 | mov [menu_opened],1 |
||
719 | mov ebx,[xf_menu];x-base+x_size for hi-level menu button |
||
720 | mov edx,5;first id button for this group |
||
721 | mov edi,3;counter buttons |
||
722 | call f1 |
||
723 | ;output text for menu |
||
724 | shr ecx,0x10 ;y-base button |
||
725 | and ebx,0xffff0000 |
||
726 | add ecx,0x6000f ;for y-base text |
||
727 | mov esi,4 ;length text |
||
728 | add ebx,ecx ;full base text |
||
729 | mov edx,m_open |
||
730 | mov ecx,[sc.work_button_text] |
||
731 | or ecx,0x10000000 |
||
732 | sub eax,4 |
||
485 | heavyiron | 733 | mcall |
31 | halyavin | 734 | add ebx,0x0c ;next full base text |
735 | add edx,4 ;next string |
||
485 | heavyiron | 736 | mcall |
31 | halyavin | 737 | add ebx,0x0c |
738 | add edx,4 |
||
485 | heavyiron | 739 | mcall |
31 | halyavin | 740 | ret |
741 | |||
742 | menucoding: |
||
743 | mov [menu_opened],1 |
||
744 | mov ebx,[xe_menu] |
||
745 | mov edx,8 ;first id |
||
746 | mov edi,6 ;counter |
||
747 | add ebx,0x10 ;add width buttons |
||
748 | push edi |
||
749 | call f1 |
||
750 | pop edi |
||
751 | shr ecx,0x10 |
||
752 | and ebx,0xffff0000 |
||
753 | add ecx,0x8000f |
||
754 | mov esi,8 ;length text |
||
755 | add ebx,ecx |
||
756 | mov edx,m_win2dos |
||
757 | mov ecx,[sc.work_button_text] |
||
758 | or ecx,0x10000000 |
||
759 | sub eax,4 |
||
760 | @@: |
||
485 | heavyiron | 761 | mcall |
31 | halyavin | 762 | add ebx,0x0c |
763 | add edx,8 ;next string |
||
764 | dec edi |
||
765 | jnz @b |
||
766 | ret |
||
767 | |||
768 | menuhelp: |
||
769 | mov [menu_opened],1 |
||
770 | mov ebx,[xh_menu] |
||
771 | mov edx,14 ;first id |
||
772 | add ebx,6 ;add width buttons |
||
773 | mov edi,2 ;counter |
||
774 | call f1 |
||
775 | shr ecx,0x10 |
||
776 | and ebx,0xffff0000 |
||
777 | add ecx,0x8000f |
||
778 | mov esi,4 ;length text |
||
779 | add ebx,ecx |
||
780 | mov edx,m_help |
||
781 | mov ecx,[sc.work_button_text] |
||
782 | or ecx,0x10000000 |
||
783 | sub eax,4 |
||
485 | heavyiron | 784 | mcall |
31 | halyavin | 785 | add ebx,0x0c |
786 | inc esi ;add lebgth output text |
||
787 | add edx,4 |
||
485 | heavyiron | 788 | mcall |
31 | halyavin | 789 | ret |
790 | |||
791 | f1:;uses for drawing low-level menu buttons |
||
792 | ;counter buttons get into |
||
793 | ;menufile,menucoding,menuhelp funcs. |
||
794 | mov ecx,[y_menu] ;y-base+y_size for hi-level menu button |
||
795 | mov esi,[sc.work_button] ;color buttons |
||
796 | mov eax,8 |
||
797 | push ecx ;for output text |
||
798 | @@: |
||
799 | add ecx,0xc0000 |
||
485 | heavyiron | 800 | mcall |
31 | halyavin | 801 | inc edx ;id |
802 | dec edi ;counter |
||
803 | jnz @b |
||
804 | pop ecx ;for output text |
||
805 | ret |
||
806 | |||
807 | redraw_window: |
||
808 | call get_process_info |
||
809 | mov [rflag],1 |
||
810 | call draw_window |
||
811 | ret |
||
812 | |||
813 | ;this is debug func |
||
814 | debug: |
||
815 | pushad |
||
816 | mov ecx,[esp+0x24] |
||
817 | mov ebx,0x80100 |
||
818 | mov edx,0x10000a0 |
||
819 | mov eax,47 |
||
820 | mov esi,0x00ffffff |
||
485 | heavyiron | 821 | mcall |
31 | halyavin | 822 | popad |
823 | ret 4 |
||
824 | |||
825 | ; ********************************************* |
||
826 | ; ******* WINDOW DEFINITIONS AND DRAW ******** |
||
827 | ; ********************************************* |
||
828 | |||
829 | draw_window: |
||
830 | pushad |
||
831 | mov eax,48 |
||
832 | mov ebx,3 |
||
833 | mov ecx,sc |
||
834 | mov edx,sizeof.system_colors |
||
485 | heavyiron | 835 | mcall |
31 | halyavin | 836 | |
837 | mov eax,12 ; function 12:tell os about windowdraw |
||
838 | mov ebx,1 ; 1, start of draw |
||
485 | heavyiron | 839 | mcall |
31 | halyavin | 840 | ; DRAW WINDOW |
841 | mov eax,0 ; function 0 : define and draw window |
||
842 | ; [x start] *65536 + [x size] |
||
843 | mov ebx,[process_info+42] |
||
844 | ; [y start] *65536 + [y size] |
||
845 | mov ecx,[process_info+46] |
||
846 | mov edx,0x03000000 ; color of work area RRGGBB,8->color gl |
||
485 | heavyiron | 847 | mcall |
31 | halyavin | 848 | ; WINDOW LABEL |
849 | mov eax,4 ; function 4 : write text to window |
||
850 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
||
851 | mov ecx,[sc.grab_text] |
||
852 | or ecx,0x10000000 ; font 1 & color ( 0xF0RRGGBB ) |
||
853 | mov edx,labelt ; pointer to text beginning |
||
854 | mov esi,labellen-labelt ; text length |
||
485 | heavyiron | 855 | mcall |
31 | halyavin | 856 | ;check for only header window output |
857 | cmp dword [process_info+46],25 |
||
858 | jle minimaze_view |
||
859 | |||
860 | ;MENU AREA |
||
861 | mov eax,[process_info+42] ;x-size window |
||
862 | mov ecx,[process_info+46] ;y-size window |
||
863 | push ecx ;for using done |
||
864 | mov ebx,0x40000 |
||
865 | sub eax,8 |
||
866 | mov edi,ecx |
||
867 | add ebx,eax ;x-base + x-size |
||
868 | sub edi,22 ;temporary value for menu area |
||
869 | push ebx ;for drawing buttons area |
||
870 | sub ecx,edi ;y-base menu area |
||
871 | mov edx,[sc.work_graph] |
||
872 | shl ecx,0x10 |
||
873 | mov eax,13 |
||
874 | add ecx,0x10 |
||
485 | heavyiron | 875 | mcall |
31 | halyavin | 876 | ;MENU BUTTONS |
877 | ;now in hi-half ecx register begin Y-coord. menu area |
||
878 | ;in hi-half ebx begin X-coord. |
||
879 | ;menu 'File' |
||
880 | mov esi,edx ;color |
||
881 | and ecx,0xffff0000 |
||
882 | and ebx,0xffff0000 |
||
883 | add ecx,0x1000c |
||
884 | add ebx,0x20028 ;40x12 |
||
885 | mov edx,2 ;menu 'File' id = 2 |
||
886 | mov [y_menu],ecx ;for low-level menus func. |
||
887 | mov [xf_menu],ebx;for low-level menus func. |
||
888 | mov eax,8 |
||
889 | push ebx ;for output buttons texts |
||
485 | heavyiron | 890 | mcall |
31 | halyavin | 891 | ;registers is't change |
892 | ;menu 'Coding' |
||
893 | add ebx,0x290018 ;80x12 |
||
894 | inc edx ;menu 'coding' id = 3 |
||
895 | mov [xe_menu],ebx;for low-level menus func. |
||
485 | heavyiron | 896 | mcall |
31 | halyavin | 897 | ;menu 'Help' |
898 | add ebx,0x40ffe8 ;+0x280000 - 0x28, 40x12 |
||
899 | inc edx ;menu 'Help' id = 4 |
||
900 | mov [xh_menu],ebx;for low-level menus func. |
||
485 | heavyiron | 901 | mcall |
31 | halyavin | 902 | ;MENU BUTTONS TEXTS |
903 | ;'File' |
||
904 | pop ebx |
||
905 | shr ecx,0x10 |
||
906 | and ebx,0xffff0000 |
||
907 | add ecx,3 |
||
908 | mov eax,4 ; function 4 : write text to window |
||
909 | add ebx,0x80000 |
||
910 | mov edx,f_menu |
||
911 | add ebx,ecx ; [x start] *65536 + [y start] |
||
912 | mov esi,4 |
||
913 | mov ecx,[sc.work_button_text] |
||
914 | or ecx,0x10000000 ; font 1 & color ( 0xF0RRGGBB ) |
||
915 | push esi ;for 'Help' menu text |
||
485 | heavyiron | 916 | mcall |
31 | halyavin | 917 | ;'coding' |
918 | ;registers is't change |
||
919 | add ebx,0x2d0000 |
||
920 | ;mov esi,6 |
||
921 | add esi,2 |
||
922 | ; mov edx,e_menu |
||
923 | add edx,4 |
||
485 | heavyiron | 924 | mcall |
31 | halyavin | 925 | ;'Help' |
926 | add ebx,0x3b0000 |
||
927 | ; mov esi,4 |
||
928 | pop esi |
||
929 | ; mov edx,h_menu |
||
930 | add edx,6 |
||
485 | heavyiron | 931 | mcall |
31 | halyavin | 932 | ;LOW_LEVEL MENU |
933 | ;for every hi-level menu exists one procedure |
||
934 | ;in begin programm they are not calls, |
||
935 | ;but when user click on one item hi-level menu |
||
936 | ;or press hot keys, call one func. and after |
||
937 | ;end work this func. she is redraw window - |
||
938 | ;low-level menu is hide. Functions: |
||
939 | ;menufile,menucoding,menuhelp. |
||
940 | ;Thay uses global virables, top-left corner every |
||
941 | ;hi-level menu buttons: [xf_menu],[xe_menu],[xh_menu],[y_menu] |
||
942 | |||
943 | ;DRAW BUTTONS AREA |
||
944 | pop ebx ;for push ebx into processed menu area: x-bzse + x-size |
||
945 | ; mov ecx,[process_info+46] |
||
946 | pop ecx |
||
947 | push ecx |
||
948 | sub ecx,24 |
||
949 | mov edx,[sc.work_graph] |
||
950 | shl ecx,16 ;y start |
||
951 | mov eax,13 |
||
952 | add ecx,20 |
||
485 | heavyiron | 953 | mcall |
31 | halyavin | 954 | |
955 | ;filename input area |
||
956 | ; mov ecx,[process_info+46] |
||
957 | pop ecx |
||
958 | push ecx ;for info strings |
||
959 | mov ebx,0x0008005a |
||
960 | sub ecx,21 |
||
961 | xor edx,edx |
||
962 | shl ecx,16 |
||
963 | mov [y_filename_area],ecx |
||
964 | dec edx |
||
965 | add ecx,16 |
||
966 | mov eax,13 |
||
967 | push ecx ;for button 'Go' |
||
485 | heavyiron | 968 | mcall |
31 | halyavin | 969 | |
970 | ;button 'Go', press in case open/save if filename input complete |
||
971 | ;button size = 24x16 |
||
972 | mov eax,8 |
||
973 | pop ecx ;y-base+y-size |
||
974 | mov ebx,0x00680018;x-base+x-size |
||
975 | dec ecx |
||
976 | mov edx,0xff ;id |
||
977 | mov esi,[sc.work_button] |
||
485 | heavyiron | 978 | mcall |
31 | halyavin | 979 | shr ecx,0x10 |
980 | and ebx,0xffff0000 |
||
981 | add ecx,0x50004 |
||
982 | mov edx,b_go |
||
983 | add ebx,ecx |
||
984 | mov esi,2 |
||
985 | mov ecx,[sc.work_button_text] |
||
986 | or ecx,0x10000000 |
||
987 | sub eax,4 |
||
485 | heavyiron | 988 | mcall |
31 | halyavin | 989 | |
990 | ;where output cursor? |
||
991 | mov al,[o_s_flag] |
||
992 | and al,8 |
||
993 | je @f |
||
994 | mov ecx,[y_filename_area] |
||
995 | add ecx,0x40008 |
||
996 | jmp cursor |
||
997 | @@: ;o_s_flag<0 - not output cursor into filename area |
||
998 | mov ecx,[y_cursor] |
||
999 | cursor: |
||
1000 | push ecx |
||
1001 | call draw_cursor |
||
1002 | |||
1003 | mov eax,[y_filename_area] |
||
1004 | mov ebx,0xa0000 |
||
1005 | mov edx,filename |
||
1006 | shr eax,0x10 |
||
1007 | and ebx,0xffff0000 |
||
1008 | add eax,4 |
||
1009 | xor ecx,ecx |
||
1010 | add ebx,eax |
||
1011 | movzx esi,[name_l] |
||
1012 | mov eax,4 |
||
485 | heavyiron | 1013 | mcall |
31 | halyavin | 1014 | |
1015 | ;info strings |
||
1016 | ; sizefile text |
||
1017 | ; mov eax,[process_info+46] |
||
1018 | pop eax |
||
1019 | mov ebx,0x00840000 |
||
1020 | sub eax,18 |
||
1021 | xor ecx,ecx |
||
1022 | add ebx,eax |
||
1023 | mov edx,sizestr ; pointer to text beginning |
||
1024 | mov eax,4 |
||
1025 | mov esi,5 |
||
485 | heavyiron | 1026 | mcall |
31 | halyavin | 1027 | add ebx,0x00530000 |
1028 | inc esi |
||
1029 | ; mov edx,offst |
||
1030 | add edx,5 |
||
1031 | inc esi |
||
485 | heavyiron | 1032 | mcall |
31 | halyavin | 1033 | ;sizefile |
1034 | mov ecx,[sizefile] |
||
1035 | mov edx,ebx |
||
1036 | xor esi,esi |
||
1037 | sub edx,0x00350000 |
||
1038 | mov eax,47 |
||
1039 | mov ebx,0x80100 |
||
485 | heavyiron | 1040 | mcall |
31 | halyavin | 1041 | mov ecx,[current] |
1042 | add edx,0x005f0000 |
||
485 | heavyiron | 1043 | mcall |
31 | halyavin | 1044 | |
1045 | push [text_cursor] ;это позиция курсора в текстовой строке |
||
1046 | call draw_cursor |
||
1047 | mov ecx,[sizefile] |
||
1048 | jecxz minimaze_view |
||
1049 | call output_screen |
||
1050 | |||
1051 | minimaze_view: |
||
1052 | mov eax,12 ; function 12:tell os about windowdraw |
||
1053 | mov ebx,2 ; 2, end of draw |
||
485 | heavyiron | 1054 | mcall |
31 | halyavin | 1055 | popad |
1056 | ret |
||
1057 | |||
1058 | |||
1059 | |||
1060 | |||
1061 | |||
1062 | get_process_info: |
||
1063 | pushad |
||
1064 | mov eax,9 |
||
1065 | mov ebx,process_info |
||
1066 | xor ecx,ecx |
||
1067 | dec ecx |
||
485 | heavyiron | 1068 | mcall |
31 | halyavin | 1069 | popad |
1070 | ret |
||
1071 | |||
1072 | coding: |
||
1073 | pushad |
||
1074 | mov ebp,0x10000 ;0x80000 |
||
1075 | mov edi,[esp+0x28] ;source table |
||
1076 | mov esi,[esp+0x24] ;destination table |
||
1077 | xor ecx,ecx ;index in file |
||
1078 | new_char: |
||
1079 | xor ebx,ebx ;index in tables |
||
1080 | not_c: |
||
1081 | mov ah,[ebp+ecx] ;load char |
||
1082 | cmp ah,[edi+ebx] ; |
||
1083 | jz @f |
||
1084 | inc ebx |
||
1085 | cmp ebx,0x40 |
||
1086 | jge end_table |
||
1087 | jmp not_c |
||
1088 | @@: |
||
1089 | mov al,[esi+ebx] |
||
1090 | inc ebx |
||
1091 | mov [ebp+ecx],al |
||
1092 | end_table: |
||
1093 | inc ecx |
||
1094 | cmp ecx,[sizefile] |
||
1095 | jle new_char |
||
1096 | popad |
||
1097 | ret 8 |
||
1098 | |||
1099 | create_process: |
||
1100 | pushad |
||
1101 | mov eax,51 |
||
1102 | xor ebx,ebx |
||
1103 | mov ecx,[esp+0x24] |
||
1104 | inc ebx |
||
1105 | mov edx,0x7E000 ;0x1000 |
||
485 | heavyiron | 1106 | mcall |
31 | halyavin | 1107 | popad |
1108 | ret 4 |
||
1109 | |||
1110 | help_thread: |
||
1111 | call help_window |
||
1112 | help_still: |
||
1113 | mov eax,10 |
||
485 | heavyiron | 1114 | mcall |
31 | halyavin | 1115 | dec eax |
1116 | jz help_red |
||
1117 | dec eax |
||
1118 | jz help_key |
||
1119 | dec eax |
||
1120 | jz help_button |
||
1121 | jmp help_still |
||
1122 | help_red: |
||
1123 | call help_window |
||
1124 | jmp help_still |
||
1125 | help_key: |
||
1126 | inc eax |
||
1127 | inc eax |
||
485 | heavyiron | 1128 | mcall |
31 | halyavin | 1129 | jmp help_still |
1130 | help_button: |
||
1131 | mov eax,17 |
||
485 | heavyiron | 1132 | mcall |
31 | halyavin | 1133 | dec ah |
1134 | jne help_still |
||
1135 | shr eax,8 |
||
1136 | dec eax |
||
485 | heavyiron | 1137 | mcall |
31 | halyavin | 1138 | |
1139 | help_window: |
||
1140 | pushad |
||
1141 | mov eax,12 ; function 12:tell os about windowdraw |
||
1142 | mov ebx,1 ; 1, start of draw |
||
485 | heavyiron | 1143 | mcall |
31 | halyavin | 1144 | ; DRAW WINDOW |
1145 | mov eax,0 ; function 0 : define and draw window |
||
1146 | mov ebx,0x500140 ; [x start] *65536 + [x size] |
||
1147 | mov ecx,0x700110 ; [y start] *65536 + [y size] |
||
1148 | mov edx,0x03000000 ; color of work area RRGGBB,8->color gl |
||
485 | heavyiron | 1149 | mcall |
31 | halyavin | 1150 | ; WINDOW LABEL |
1151 | mov eax,4 ; function 4 : write text to window |
||
1152 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
||
1153 | mov ecx,0x10ffffff ; font 1 & color ( 0xF0RRGGBB ) |
||
1154 | mov edx,help_label ; pointer to text beginning |
||
1155 | mov esi,14 ; text length |
||
485 | heavyiron | 1156 | mcall |
31 | halyavin | 1157 | ; HELP TEXT |
1158 | add edx,14 ;help_text addr. |
||
1159 | add esi,37 ; = 51 - length 1 line |
||
1160 | mov ecx,0x00ffffff |
||
131 | diamond | 1161 | mov edi,(help_end-help_text)/51 |
31 | halyavin | 1162 | @@: |
1163 | add ebx,0x10 |
||
485 | heavyiron | 1164 | mcall |
31 | halyavin | 1165 | add edx,51 |
1166 | dec edi |
||
1167 | jnz @b |
||
1168 | |||
1169 | |||
1170 | mov eax,12 ; function 12:tell os about windowdraw |
||
1171 | mov ebx,2 ; 2, end of draw |
||
485 | heavyiron | 1172 | mcall |
31 | halyavin | 1173 | popad |
1174 | ret |
||
1175 | |||
1176 | about_thread: |
||
1177 | call about_window |
||
1178 | about_still: |
||
1179 | mov eax,10 |
||
485 | heavyiron | 1180 | mcall |
31 | halyavin | 1181 | dec eax |
1182 | jz about_red |
||
1183 | dec eax |
||
1184 | jz about_key |
||
1185 | dec eax |
||
1186 | jz about_button |
||
1187 | jmp about_still |
||
1188 | about_red: |
||
1189 | call about_window |
||
1190 | jmp about_still |
||
1191 | about_key: |
||
1192 | inc eax |
||
1193 | inc eax |
||
485 | heavyiron | 1194 | mcall |
31 | halyavin | 1195 | jmp about_still |
1196 | about_button: |
||
1197 | mov eax,17 |
||
485 | heavyiron | 1198 | mcall |
31 | halyavin | 1199 | dec ah |
1200 | jne about_still |
||
1201 | shr eax,8 |
||
1202 | dec eax |
||
485 | heavyiron | 1203 | mcall |
31 | halyavin | 1204 | |
1205 | about_window: |
||
1206 | pushad |
||
1207 | mov eax,12 ; function 12:tell os about windowdraw |
||
1208 | mov ebx,1 ; 1, start of draw |
||
485 | heavyiron | 1209 | mcall |
31 | halyavin | 1210 | ; DRAW WINDOW |
1211 | mov eax,0 ; function 0 : define and draw window |
||
1212 | mov ebx,0x500140 ; [x start] *65536 + [x size] |
||
1213 | mov ecx,0x700110 ; [y start] *65536 + [y size] |
||
1214 | mov edx,0x03000000 ; color of work area RRGGBB,8->color gl |
||
485 | heavyiron | 1215 | mcall |
31 | halyavin | 1216 | ; WINDOW LABEL |
1217 | mov eax,4 ; function 4 : write text to window |
||
1218 | mov ebx,8*65536+8 ; [x start] *65536 + [y start] |
||
1219 | mov ecx,[sc.work_button_text] |
||
1220 | or ecx,0x10000000 ; font 1 & color ( 0xF0RRGGBB ) |
||
1221 | mov edx,about_label ; pointer to text beginning |
||
1222 | mov esi,17 ; text length |
||
485 | heavyiron | 1223 | mcall |
31 | halyavin | 1224 | ; ABOUT TEXT |
1225 | add edx,17 ;about_text addr. |
||
1226 | add esi,34 ; = 51 - length 1 line |
||
1227 | mov ecx,0x00ddeeff |
||
1228 | mov edi,15 |
||
1229 | @@: |
||
1230 | add ebx,0x10 |
||
485 | heavyiron | 1231 | mcall |
31 | halyavin | 1232 | add edx,51 |
1233 | dec edi |
||
1234 | jnz @b |
||
1235 | |||
1236 | mov eax,12 ; function 12:tell os about windowdraw |
||
1237 | mov ebx,2 ; 2, end of draw |
||
485 | heavyiron | 1238 | mcall |
31 | halyavin | 1239 | popad |
1240 | ret |
||
1241 | |||
1242 | ; DATA AREA |
||
1243 | sizefile dd 0 |
||
1244 | current dd 0 ;current offset relative begin file. Uses as offset for patch. |
||
1245 | ;Coordinates left hi-level menu buttons |
||
1246 | ;Uses into low-level menu output. |
||
1247 | xf_menu dd 0 |
||
1248 | xe_menu dd 0 |
||
1249 | xh_menu dd 0 |
||
1250 | y_menu dd 0 ;top coord. menu |
||
1251 | y_filename_area dd 0 ;top coord. filename input area |
||
1252 | color dd 0 |
||
1253 | y_cursor dd 0x280008 ;y coord. shl 16 + y size for cursor |
||
1254 | x_cursor dd 0x680005 ;x coord. shl 16 + x size for cursor |
||
1255 | name_l db 0 ;counter chars into filename |
||
1256 | o_s_flag db 0 ; |
||
1257 | rflag dd 0; |
||
1258 | posx db 0 |
||
1259 | posy db 3 |
||
1260 | lines db 0 |
||
1261 | end_str dd 0x10000 ;addr. first byte for output |
||
1262 | text_cursor dd 0x01200000 |
||
1263 | |||
1264 | filename: rb 13 |
||
1265 | |||
1266 | b_go: db 'Go' |
||
1267 | |||
1268 | sizestr: db 'SIZE:' |
||
1269 | |||
1270 | offst: db 'OFFSET:' |
||
1271 | |||
1272 | labelt: db 'HeEd' |
||
1273 | labellen: |
||
1274 | |||
1275 | ;text for hi-level menu buttons |
||
1276 | f_menu: db 'File' |
||
1277 | e_menu: db 'Coding' |
||
1278 | h_menu: db 'Help' |
||
1279 | ;text for low-level menu buttons |
||
1280 | ;menu File |
||
1281 | m_open: db 'Open' |
||
1282 | m_save: db 'Save' |
||
1283 | m_exit: db 'Exit' |
||
1284 | ;menu coding |
||
1285 | m_win2dos: db 'Win->Dos' |
||
1286 | m_win2koi: db 'Win->Koi' |
||
1287 | m_win2iso: db 'Win->Iso' |
||
1288 | m_dos2win: db 'Dos->Win' |
||
1289 | m_dos2koi: db 'Dos->Koi' |
||
1290 | m_dos2iso: db 'Dos->Iso' |
||
1291 | ;menu Help |
||
1292 | m_help: db 'Help' |
||
1293 | m_about: db 'About' |
||
1294 | ;tables for coding |
||
1295 | WIN_TABLE: |
||
1296 | db 0xC0,0xC1,0xC2,0xC3,0xC4,0xC5,0xC6,0xC7,0xC8,0xC9 |
||
1297 | db 0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD1,0xD2,0xD3 |
||
1298 | db 0xD4,0xD5,0xD6,0xD7,0xD8,0xD9,0xDA,0xDB,0xDC,0xDD |
||
1299 | db 0xDE,0xDF,0xE0,0xE1,0xE2,0xE3,0xE4,0xE5,0xE6,0xE7 |
||
1300 | db 0xE8,0xE9,0xEA,0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF1 |
||
1301 | db 0xF2,0xF3,0xF4,0xF5,0xF6,0xF7,0xF8,0xF9,0xFA,0xFB |
||
1302 | db 0xFC,0xFD,0xFE,0xFF |
||
1303 | DOS_TABLE: |
||
1304 | db 0x80,0x81,0x82,0x83,0x84,0x85,0x86,0x87,0x88,0x89 |
||
1305 | db 0x8A,0x8B,0x8C,0x8D,0x8E,0x8F,0x90,0x91,0x92,0x93 |
||
1306 | db 0x94,0x95,0x96,0x97,0x98,0x99,0x9A,0x9B,0x9C,0x9D |
||
1307 | db 0x9E,0x9F,0xA0,0xA1,0xA2,0xA3,0xA4,0xA5,0xA6,0xA7 |
||
1308 | db 0xA8,0xA9,0xAA,0xAB,0xAC,0xAD,0xAE,0xAF,0xE0,0xE1 |
||
1309 | db 0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB |
||
1310 | db 0xEC,0xED,0xEE,0xEF |
||
1311 | KOI_TABLE: |
||
1312 | db 0xE1,0xE2,0xF7,0xE7,0xE4,0xE5,0xF6,0xFA,0xE9,0xEA |
||
1313 | db 0xEB,0xEC,0xED,0xEE,0xEF,0xF0,0xF2,0xF3,0xF4,0xF5 |
||
1314 | db 0xE6,0xE8,0xE3,0xFE,0xFB,0xFD,0xFF,0xF9,0xF8,0xFC |
||
1315 | db 0xE0,0xF1,0xC1,0xC2,0xD7,0xC7,0xC4,0xC5,0xD6,0xDA |
||
1316 | db 0xC9,0xCA,0xCB,0xCC,0xCD,0xCE,0xCF,0xD0,0xD2,0xD3 |
||
1317 | db 0xD4,0xD5,0xC6,0xC8,0xC3,0xDE,0xDB,0xDD,0xDF,0xD9 |
||
1318 | db 0xD8,0xDC,0xC0,0xD1 |
||
1319 | ISO_TABLE: |
||
1320 | db 0xB0,0xB1,0xB2,0xB3,0xB4,0xB5,0xB6,0xB7,0xB8,0xB9 |
||
1321 | db 0xBA,0xBB,0xBC,0xBD,0xBE,0xBF,0xC0,0xC1,0xC2,0xC3 |
||
1322 | db 0xC4,0xC5,0xC6,0xC7,0xC8,0xC9,0xCA,0xCB,0xCC,0xCD |
||
1323 | db 0xCE,0xCF,0xD0,0xD1,0xD2,0xD3,0xD4,0xD5,0xD6,0xD7 |
||
1324 | db 0xD8,0xD9,0xDA,0xDB,0xDC,0xDD,0xDE,0xDF,0xE0,0xE1 |
||
1325 | db 0xE2,0xE3,0xE4,0xE5,0xE6,0xE7,0xE8,0xE9,0xEA,0xEB |
||
1326 | db 0xEC,0xED,0xEE,0xEF |
||
1327 | |||
1328 | ;text for help_window |
||
1329 | help_label: db 'Help for HeEd.' |
||
1330 | help_text: |
||
131 | diamond | 1331 | if lang eq ru |
31 | halyavin | 1332 | db '1.HeEd в состоянии открыть файл только один раз и ' |
1333 | db ' нужное число раз сохранить его. ' |
||
1334 | db '2.При открытии файла без расширения надо это расши-' |
||
1335 | db ' ширение все равно указывать как три пробела после' |
||
1336 | db ' точки. ' |
||
1337 | db '3.Само открытие файла происходит при нажатии кнопки' |
||
1338 | db ' "Go". ' |
||
1339 | db '4.Создание новых файлов в меню не предусмотрено, но' |
||
1340 | db ' можно же редактировать... ' |
||
1341 | db '5.В файл записывается только количество байт, кото-' |
||
1342 | db ' рое было размером файла до открытия. ' |
||
1343 | db '6.При нажатии "Go" с пустым полем имени файла выво-' |
||
1344 | db ' дится память с адреса 0х80000, но размер файла ' |
||
1345 | db ' равен 0xFFFFFFFF. ' |
||
1346 | db ' (см. инфо "About") ' |
||
131 | diamond | 1347 | else |
1348 | db '1.HeEd can once open file and many times save it. ' |
||
1349 | db '2.To open file without extension it is required to ' |
||
1350 | db ' specify anyway as three spaces after a dot. ' |
||
1351 | db '3.File is opened when the button "Go" is pressed. ' |
||
1352 | db '4.Creation of new files in the menu is not provided' |
||
1353 | db ' but you can edit... ' |
||
1354 | db '5.Only number of bytes which was file size when ' |
||
1355 | db ' opening is written to file. ' |
||
1356 | db '6.If you press "Go" with empty filename field, ' |
||
1357 | db ' memory starting from address 0x80000 is output, ' |
||
1358 | db ' but file size equals to 0xFFFFFFFF. ' |
||
1359 | db ' (see info "About") ' |
||
1360 | end if |
||
31 | halyavin | 1361 | help_end: |
1362 | ;text for about_window |
||
1363 | about_label: db 'About this funny.' |
||
1364 | about_text: |
||
131 | diamond | 1365 | if lang eq ru |
31 | halyavin | 1366 | db 'Некоторая информация для тех, кто захочет дописать ' |
131 | diamond | 1367 | db 'сюда что-то свое: код практически не оптимизирован,' |
31 | halyavin | 1368 | db 'так что разобраться будет не так уж сложно. Строки ' |
1369 | db 'для кнопок меню должны идти прямо друг за другом, ' |
||
1370 | db 'т. к. я при выводе использую не mov esi,размер и ' |
||
1371 | db 'mov edx,адрес а просто прибавляю смещения. Что ка-' |
||
1372 | db 'сается кодировок и размеров файла для сохранения, ' |
||
1373 | db 'то остается только добавить кнопки меню с текстом ' |
||
1374 | db '(при добавлении надо учитывать, что ID кнопки опоз-' |
||
1375 | db 'наются dec ah, а не как cmp ah,ID). Если все же бу-' |
||
1376 | db 'дет неприятно разбираться, то можете написать и ' |
||
1377 | db 'спросить. Эта программа была написана в ходе разбо-' |
||
1378 | db 'рок с GUI MeOS и поэтому не претендует на что-то ' |
||
1379 | db 'большее, чем пример. Просто надоела эта тема, а вы-' |
||
1380 | db 'кинуть жалко. mailto:babalbes@yandex.ru ' |
||
131 | diamond | 1381 | else |
1382 | db 'Some information for those who want add to this ' |
||
1383 | db 'something their own: the code is practically not ' |
||
1384 | db 'optimized, so investigation is not complicated. ' |
||
1385 | db 'Strings for menu buttons must rank after each other' |
||
1386 | db 'as I use not mov esi,size and mov edx,address when ' |
||
1387 | db 'output but simply add offsets. For encodins and ' |
||
1388 | db 'file sizes for save, it remains only add buttons ' |
||
1389 | db 'with text in menu (at addition one should take into' |
||
1390 | db 'account that buttons ID are recognized as dec ah ' |
||
1391 | db 'rather than cmp ah,ID). Nevertheless if study is ' |
||
1392 | db 'unpleasant, you can write and ask. This program has' |
||
1393 | db 'been written in course of study GUI MeOS and does ' |
||
1394 | db 'not therefore pretend on some more than example. ' |
||
1395 | db 'Just this theme bothers, but I regret to delete. ' |
||
1396 | db ' mailto:babalbes@yandex.ru ' |
||
1397 | end if |
||
31 | halyavin | 1398 | about_end: |
1399 | |||
1400 | I_END: |
||
1401 | |||
1402 | sc system_colors |
||
1403 | |||
1404 | process_info: |
||
1405 | rb 1024 |
||
1406 | menu_opened db ? |
||
1407 | m_text:0>=>>'A' |