Rev 9096 | Rev 9125 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
836 | diamond | 1 | ; Функции работы с консолью для программ КолибриОС |
852 | diamond | 2 | ; diamond, 2006-2008 |
836 | diamond | 3 | |
4 | |||
5 | format MS COFF |
||
6 | |||
7 | public EXPORTS |
||
8 | |||
9 | section '.flat' code readable align 16 |
||
10 | include 'font.inc' |
||
11 | include 'conscrl.inc' |
||
12 | |||
9105 | hidnplayr | 13 | struc process_info |
14 | { |
||
15 | .cpu_usage dd ? ; +0 |
||
16 | .window_stack_position dw ? ; +4 |
||
17 | .window_stack_value dw ? ; +6 |
||
18 | dw ? ; +8 |
||
19 | .process_name rb 12 ; +10 |
||
20 | .memory_start dd ? ; +22 |
||
21 | .used_memory dd ? ; +26 |
||
22 | .PID dd ? ; +30 |
||
23 | .box.x dd ? ; +34 |
||
24 | .box.y dd ? ; +38 |
||
25 | .box.width dd ? ; +42 |
||
26 | .box.height dd ? ; +46 |
||
27 | .slot_state dw ? ; +50 |
||
28 | dw ? ; +52 |
||
29 | .client_box.x dd ? ; +54 |
||
30 | .client_box.y dd ? ; +58 |
||
31 | .client_box.width dd ? ; +62 |
||
32 | .client_box.height dd ? ; +66 |
||
33 | .wnd_state db ? ; +70 |
||
34 | rb (1024-71) |
||
35 | } |
||
36 | |||
37 | OP_EXIT = 1 |
||
38 | OP_SET_TITLE = 2 |
||
39 | OP_REDRAW = 3 |
||
40 | OP_GETCH = 4 |
||
41 | OP_RESIZE = 5 |
||
42 | |||
836 | diamond | 43 | ;void __stdcall START(dword state); |
44 | START: |
||
45 | ; N.B. The current kernel implementation does not require |
||
46 | ; evident heap initialization, because if DLL is loaded, heap is already initialized |
||
47 | ; (if heap was not initialized, loader does this implicitly). |
||
48 | ; So this action does nothing useful, but nothing harmful. |
||
6067 | serge | 49 | push ebx |
836 | diamond | 50 | push 68 |
51 | pop eax |
||
52 | push 11 |
||
53 | pop ebx |
||
54 | int 0x40 |
||
6067 | serge | 55 | pop ebx |
836 | diamond | 56 | or eax, -1 |
57 | ret 4 |
||
58 | |||
59 | ; Инициализация консоли |
||
60 | ; void __stdcall con_init(dword wnd_width, dword wnd_height, |
||
61 | ; dword scr_width, dword scr_height, const char* title); |
||
62 | |||
63 | align 4 |
||
64 | con_init: |
||
6067 | serge | 65 | |
836 | diamond | 66 | pop eax |
67 | pop [con.wnd_width] |
||
68 | pop [con.wnd_height] |
||
9105 | hidnplayr | 69 | pop [con.main_scr_width] |
70 | pop [con.main_scr_height] |
||
836 | diamond | 71 | pop [con.title] |
72 | push eax |
||
2170 | serge | 73 | |
9105 | hidnplayr | 74 | push ebx |
2170 | serge | 75 | |
9105 | hidnplayr | 76 | mov [con.init_cmd],1 |
6067 | serge | 77 | |
836 | diamond | 78 | mov ecx, 4 |
79 | mov eax, con.wnd_width |
||
2170 | serge | 80 | mov edx, con.def_wnd_width |
9105 | hidnplayr | 81 | .1: |
836 | diamond | 82 | cmp dword [eax], -1 |
83 | jnz @f |
||
2170 | serge | 84 | mov ebx, [edx] |
836 | diamond | 85 | mov [eax], ebx |
9105 | hidnplayr | 86 | @@: |
836 | diamond | 87 | add eax, 4 |
2170 | serge | 88 | add edx, 4 |
836 | diamond | 89 | loop .1 |
9105 | hidnplayr | 90 | |
91 | ; Allocate memory for console data & bitmap data |
||
92 | ; First, calculate required amount of bytes |
||
93 | |||
94 | ; Main buffer |
||
95 | mov eax, [con.main_scr_width] |
||
96 | mul [con.main_scr_height] |
||
97 | ; 2 bytes per on-screen character (1 flags and 1 ascii) |
||
836 | diamond | 98 | lea ecx, [eax+eax] |
9105 | hidnplayr | 99 | |
100 | ; Alternate buffer |
||
101 | mov [con.altbuffer], ecx |
||
836 | diamond | 102 | mov eax, [con.wnd_width] |
103 | mul [con.wnd_height] |
||
9105 | hidnplayr | 104 | ; 2 bytes per on-screen character (1 flags and 1 ascii) |
105 | lea ecx, [ecx+2*eax] |
||
106 | |||
107 | ; Bitmap data |
||
108 | mov eax, [con.wnd_width] |
||
109 | mul [con.wnd_height] |
||
836 | diamond | 110 | imul eax, font_width*font_height |
111 | mov ebx, eax |
||
112 | push ebx ecx |
||
113 | add ecx, eax |
||
9105 | hidnplayr | 114 | |
115 | ; malloc |
||
836 | diamond | 116 | push 68 |
117 | pop eax |
||
118 | push 12 |
||
119 | pop ebx |
||
120 | int 0x40 |
||
121 | pop ecx ebx |
||
122 | mov edx, con.nomem_err |
||
123 | test eax, eax |
||
9105 | hidnplayr | 124 | jz .fatal |
125 | |||
126 | ; Set pointers to the buffers |
||
127 | mov [con.mainbuffer], eax |
||
128 | add [con.altbuffer], eax |
||
129 | |||
130 | ; Set active buffer pointer and dimensions |
||
836 | diamond | 131 | mov [con.data], eax |
9105 | hidnplayr | 132 | |
133 | push [con.main_scr_width] |
||
134 | pop [con.scr_width] |
||
135 | |||
136 | push [con.main_scr_height] |
||
137 | pop [con.scr_height] |
||
138 | |||
139 | ; Clear text buffers |
||
836 | diamond | 140 | push edi |
141 | mov edi, eax |
||
142 | shr ecx, 1 |
||
143 | mov ax, 0x0720 |
||
144 | rep stosw |
||
9105 | hidnplayr | 145 | |
146 | ; Clear bitmap buffer |
||
836 | diamond | 147 | mov ecx, ebx |
148 | mov [con.image], edi |
||
149 | xor eax, eax |
||
150 | rep stosb |
||
151 | pop edi |
||
1133 | diamond | 152 | and byte [con_flags+1], not 2 |
9105 | hidnplayr | 153 | |
836 | diamond | 154 | ; create console thread |
155 | push 51 |
||
156 | pop eax |
||
157 | xor ebx, ebx |
||
158 | inc ebx |
||
159 | mov ecx, con.thread |
||
160 | mov edx, con.stack_top |
||
161 | int 0x40 |
||
162 | mov edx, con.thread_err |
||
163 | test eax, eax |
||
9105 | hidnplayr | 164 | js .fatal |
836 | diamond | 165 | mov [con.console_tid], eax |
166 | pop ebx |
||
167 | ret |
||
9105 | hidnplayr | 168 | |
169 | .fatal: |
||
836 | diamond | 170 | ; output string to debug board and die |
171 | mov cl, [edx] |
||
172 | test cl, cl |
||
173 | jz @f |
||
174 | push 63 |
||
175 | pop eax |
||
176 | xor ebx, ebx |
||
177 | inc ebx |
||
178 | int 0x40 |
||
179 | inc edx |
||
9105 | hidnplayr | 180 | jmp .fatal |
181 | @@: |
||
836 | diamond | 182 | or eax, -1 |
183 | int 0x40 |
||
184 | |||
185 | ; dword __stdcall con_get_flags(void); |
||
186 | con_get_flags: |
||
187 | mov eax, [con_flags] |
||
188 | ret |
||
189 | |||
190 | ; dword __stdcall con_set_flags(dword flags); |
||
191 | con_set_flags: |
||
192 | mov eax, [esp+4] |
||
1133 | diamond | 193 | and ah, not 2 |
836 | diamond | 194 | xchg eax, [con_flags] |
195 | ret 4 |
||
196 | |||
197 | ; dword __stdcall con_get_font_height(void); |
||
198 | con_get_font_height: |
||
199 | mov eax, font_height |
||
200 | ret |
||
201 | |||
202 | ; int __stdcall con_get_cursor_height(void); |
||
203 | con_get_cursor_height: |
||
204 | mov eax, [con.cursor_height] |
||
205 | ret |
||
206 | |||
207 | ; int __stdcall con_set_cursor_height(int new_height); |
||
208 | con_set_cursor_height: |
||
209 | mov eax, [esp+4] |
||
210 | cmp eax, font_height |
||
211 | jae @f |
||
212 | xchg eax, [con.cursor_height] |
||
213 | ret 4 |
||
9105 | hidnplayr | 214 | @@: |
836 | diamond | 215 | mov eax, [con.cursor_height] |
216 | ret 4 |
||
217 | |||
5835 | pavelyakov | 218 | con_init_check: |
9105 | hidnplayr | 219 | mov ah, [con.init_cmd] |
220 | test ah, ah |
||
221 | jne .yes |
||
6067 | serge | 222 | |
9105 | hidnplayr | 223 | push con.title_init_console |
224 | push -1 |
||
225 | push -1 |
||
226 | push -1 |
||
227 | push -1 |
||
6067 | serge | 228 | |
9105 | hidnplayr | 229 | call con_init |
230 | .yes: |
||
231 | ret |
||
6067 | serge | 232 | |
836 | diamond | 233 | ; void __stdcall con_write_asciiz(const char* string); |
234 | con_write_asciiz: |
||
9105 | hidnplayr | 235 | |
236 | call con_init_check |
||
237 | |||
836 | diamond | 238 | push ebx esi |
239 | or ebx, -1 |
||
240 | mov esi, [esp+12] |
||
241 | call con.write |
||
242 | pop esi ebx |
||
243 | ret 4 |
||
244 | |||
245 | ; void __stdcall con_write_string(const char* string, dword length); |
||
246 | con_write_length: |
||
9105 | hidnplayr | 247 | |
836 | diamond | 248 | push ebx esi |
249 | mov esi, [esp+12] |
||
250 | mov ebx, [esp+16] |
||
251 | call con.write |
||
252 | pop esi ebx |
||
253 | ret 8 |
||
254 | |||
255 | ; Каждый символ классифицируется как один из |
||
256 | con.printfc.normal = 0 ; нормальный символ |
||
257 | con.printfc.percent = 1 ; '%' |
||
258 | con.printfc.dot = 2 ; '.' |
||
259 | con.printfc.asterisk = 3 ; '*' |
||
260 | con.printfc.zero = 4 ; '0' |
||
261 | con.printfc.digit = 5 ; ненулевая цифра |
||
262 | con.printfc.plus = 6 ; '+' |
||
263 | con.printfc.minus = 7 ; '-' |
||
264 | con.printfc.sharp = 8 ; '#' |
||
265 | con.printfc.space = 9 ; ' ' |
||
266 | con.printfc.long = 10 ; 'l' for 'long' |
||
267 | con.printfc.short = 11 ; 'h' for 'short' |
||
268 | con.printfc.dec = 12 ; 'd' = print decimal |
||
269 | con.printfc.oct = 13 ; 'o' = print octal |
||
270 | con.printfc.unsigned = 14 ; 'u' = print unsigned decimal |
||
271 | con.printfc.hex = 15 ; 'x' = print hexadecimal |
||
272 | con.printfc.pointer = 16 ; 'p' = print pointer |
||
273 | con.printfc.char = 17 ; 'c' = print char |
||
274 | con.printfc.string = 18 ; 's' = print string |
||
275 | |||
276 | macro set char,type |
||
277 | {store byte con.printfc.#type at con.charcodes + char - ' '} |
||
278 | |||
279 | con.charcodes: |
||
280 | times 'x'-' '+1 db con.printfc.normal |
||
281 | set '%', percent |
||
282 | set '.', dot |
||
283 | set '*', asterisk |
||
284 | set '0', zero |
||
285 | set '1', digit |
||
286 | set '2', digit |
||
287 | set '3', digit |
||
288 | set '4', digit |
||
289 | set '5', digit |
||
290 | set '6', digit |
||
291 | set '7', digit |
||
292 | set '8', digit |
||
293 | set '9', digit |
||
294 | set ' ', space |
||
295 | set '#', sharp |
||
296 | set '+', plus |
||
297 | set '-', minus |
||
298 | set 'X', hex |
||
299 | set 'x', hex |
||
300 | set 'c', char |
||
301 | set 'd', dec |
||
302 | set 'h', short |
||
303 | set 'i', dec |
||
304 | set 'l', long |
||
305 | set 'o', oct |
||
306 | set 'p', pointer |
||
307 | set 's', string |
||
308 | set 'u', unsigned |
||
309 | purge set |
||
310 | align 4 |
||
3690 | hidnplayr | 311 | con.charjump: |
312 | dd con_printf.normal |
||
836 | diamond | 313 | dd con_printf.percent |
314 | dd con_printf.dot |
||
315 | dd con_printf.asterisk |
||
316 | dd con_printf.zero |
||
317 | dd con_printf.digit |
||
318 | dd con_printf.plus |
||
319 | dd con_printf.minus |
||
320 | dd con_printf.sharp |
||
321 | dd con_printf.space |
||
322 | dd con_printf.long |
||
323 | dd con_printf.short |
||
324 | dd con_printf.dec |
||
325 | dd con_printf.oct |
||
326 | dd con_printf.unsigned |
||
327 | dd con_printf.hex |
||
328 | dd con_printf.pointer |
||
329 | dd con_printf.char |
||
330 | dd con_printf.string |
||
331 | |||
332 | ; int __cdecl con_printf(const char* format, ...) |
||
333 | con_printf: |
||
9105 | hidnplayr | 334 | |
335 | call con_init_check |
||
336 | |||
836 | diamond | 337 | xor eax, eax |
338 | pushad |
||
339 | call con.get_data_ptr |
||
340 | lea ebp, [esp+20h+8] |
||
341 | mov esi, [ebp-4] |
||
342 | sub esp, 64 ; reserve space for buffer |
||
9105 | hidnplayr | 343 | .loop: |
836 | diamond | 344 | xor eax, eax |
345 | lodsb |
||
346 | test al, al |
||
347 | jz .done |
||
348 | cmp al, '%' |
||
349 | jz .spec_begin |
||
9105 | hidnplayr | 350 | .normal: |
836 | diamond | 351 | call con.write_char_ex |
352 | inc dword [esp+64+28] |
||
353 | jmp .loop |
||
9105 | hidnplayr | 354 | .errspec: |
355 | .percent: |
||
836 | diamond | 356 | add esp, 12 |
357 | jmp .normal |
||
9105 | hidnplayr | 358 | .spec_begin: |
836 | diamond | 359 | xor ebx, ebx |
360 | ; bl = тип позиции: |
||
361 | ; 0 = начало |
||
362 | ; 1 = прочитан ведущий 0 в спецификации формата |
||
363 | ; 2 = читаем поле ширины |
||
364 | ; 3 = читаем поле точности |
||
365 | ; 4 = прочитано поле размера аргумента |
||
366 | ; 5 = читаем поле типа |
||
367 | ; bh = флаги: |
||
368 | ; 1 = флаг '#', выводить 0/0x/0X |
||
369 | ; 2 = флаг '-', выравнивание влево |
||
370 | ; 4 = флаг '0', дополнение нулями |
||
371 | ; 8 = флаг 'h', короткий аргумент |
||
372 | push -1 |
||
373 | ; dword [esp+8] = precision |
||
374 | push -1 |
||
375 | ; dword [esp+4] = width |
||
376 | push 0 |
||
377 | ; byte [esp] = флаг 0/'+'/' ' |
||
9105 | hidnplayr | 378 | .spec: |
836 | diamond | 379 | xor eax, eax |
380 | lodsb |
||
381 | test al, al |
||
382 | jz .done |
||
383 | cmp al, ' ' |
||
384 | jb .normal |
||
385 | cmp al, 'x' |
||
386 | ja .normal |
||
387 | movzx ecx, byte [con.charcodes + eax - ' '] |
||
3690 | hidnplayr | 388 | jmp dword[con.charjump + ecx*4] |
836 | diamond | 389 | |
9105 | hidnplayr | 390 | .sharp: |
836 | diamond | 391 | test bl, bl |
392 | jnz .errspec |
||
393 | or bh, 1 |
||
394 | jmp .spec |
||
9105 | hidnplayr | 395 | .minus: |
836 | diamond | 396 | test bl, bl |
397 | jnz .errspec |
||
398 | or bh, 2 |
||
399 | jmp .spec |
||
9105 | hidnplayr | 400 | .plus: |
401 | .space: |
||
836 | diamond | 402 | test bl, bl |
403 | jnz .errspec |
||
404 | cmp byte [esp], '+' |
||
405 | jz .spec |
||
406 | mov byte [esp], al |
||
407 | jmp .spec |
||
9105 | hidnplayr | 408 | .zero: |
836 | diamond | 409 | test bl, bl |
410 | jnz .digit |
||
411 | test bh, 2 |
||
412 | jnz .spec |
||
413 | or bh, 4 |
||
414 | inc ebx |
||
415 | jmp .spec |
||
9105 | hidnplayr | 416 | .digit: |
836 | diamond | 417 | sub al, '0' |
418 | cmp bl, 2 |
||
419 | ja .precision |
||
420 | mov bl, 2 |
||
421 | xchg eax, [esp+4] |
||
422 | test eax, eax |
||
423 | js .spec |
||
424 | lea eax, [eax*5] |
||
425 | add eax, eax |
||
426 | add [esp+4], eax |
||
427 | jmp .spec |
||
9105 | hidnplayr | 428 | .precision: |
836 | diamond | 429 | cmp bl, 3 |
430 | jnz .errspec |
||
431 | xchg eax, [esp+8] |
||
432 | lea eax, [eax*5] |
||
433 | add eax, eax |
||
434 | add [esp+8], eax |
||
435 | jmp .spec |
||
9105 | hidnplayr | 436 | .asterisk: |
836 | diamond | 437 | mov eax, [ebp] |
438 | add ebp, 4 |
||
439 | cmp bl, 2 |
||
440 | ja .asterisk_precision |
||
441 | test eax, eax |
||
442 | jns @f |
||
443 | neg eax |
||
444 | or bh, 2 |
||
9105 | hidnplayr | 445 | @@: |
836 | diamond | 446 | mov [esp+4], eax |
447 | mov bl, 3 |
||
448 | jmp .spec |
||
9105 | hidnplayr | 449 | .asterisk_precision: |
836 | diamond | 450 | cmp bl, 3 |
451 | jnz .errspec |
||
452 | mov [esp+8], eax |
||
453 | inc ebx |
||
454 | jmp .spec |
||
9105 | hidnplayr | 455 | .dot: |
836 | diamond | 456 | cmp bl, 2 |
457 | ja .errspec |
||
458 | mov bl, 3 |
||
459 | and dword [esp+8], 0 |
||
460 | jmp .spec |
||
9105 | hidnplayr | 461 | .long: |
836 | diamond | 462 | cmp bl, 3 |
463 | ja .errspec |
||
464 | mov bl, 4 |
||
465 | jmp .spec |
||
9105 | hidnplayr | 466 | .short: |
836 | diamond | 467 | cmp bl, 3 |
468 | ja .errspec |
||
469 | mov bl, 4 |
||
470 | or bh, 8 |
||
471 | jmp .spec |
||
9105 | hidnplayr | 472 | .unsigned: |
473 | .dec: |
||
836 | diamond | 474 | push 10 |
475 | jmp .write_number |
||
9105 | hidnplayr | 476 | .pointer: |
836 | diamond | 477 | mov dword [esp+12], 8 |
478 | or bh, 4 |
||
479 | and bh, not 8 |
||
9105 | hidnplayr | 480 | .hex: |
836 | diamond | 481 | push 16 |
482 | jmp @f |
||
9105 | hidnplayr | 483 | .oct: |
836 | diamond | 484 | push 8 |
9105 | hidnplayr | 485 | @@: |
836 | diamond | 486 | mov byte [esp+4], 0 |
9105 | hidnplayr | 487 | .write_number: |
836 | diamond | 488 | pop ecx |
489 | push edi |
||
490 | lea edi, [esp+16+64-1] ; edi -> end of buffer |
||
491 | mov byte [edi], 0 |
||
492 | push edx |
||
493 | push eax |
||
494 | mov eax, [ebp] |
||
495 | add ebp, 4 |
||
496 | test bh, 8 |
||
497 | jz @f |
||
498 | movzx eax, ax |
||
499 | cmp byte [esp], 'd' |
||
500 | jnz @f |
||
501 | movsx eax, ax |
||
9105 | hidnplayr | 502 | @@: |
836 | diamond | 503 | xor edx, edx |
504 | test eax, eax |
||
505 | jns @f |
||
506 | cmp byte [esp], 'd' |
||
507 | jnz @f |
||
508 | inc edx |
||
509 | neg eax |
||
9105 | hidnplayr | 510 | @@: |
836 | diamond | 511 | push edx |
512 | xor edx, edx |
||
513 | ; число в eax, основание системы счисления в ecx |
||
9105 | hidnplayr | 514 | @@: |
836 | diamond | 515 | cmp dword [esp+16+8], 0 |
516 | jnz .print_num |
||
517 | test eax, eax |
||
518 | jz .zeronum |
||
9105 | hidnplayr | 519 | .print_num: |
836 | diamond | 520 | div ecx |
521 | xchg eax, edx |
||
522 | cmp al, 10 |
||
523 | sbb al, 69h |
||
524 | das |
||
525 | cmp byte [esp+4], 'x' |
||
526 | jnz @f |
||
527 | or al, 20h |
||
9105 | hidnplayr | 528 | @@: |
836 | diamond | 529 | dec edi |
530 | mov [edi], al |
||
531 | xor eax, eax |
||
532 | xchg eax, edx |
||
533 | test eax, eax |
||
534 | jnz .print_num |
||
9105 | hidnplayr | 535 | .zeronum: |
836 | diamond | 536 | push 0 |
537 | mov edx, [esp+12] |
||
538 | lea eax, [esp+32+64-1] |
||
539 | sub eax, edi |
||
540 | cmp dword [esp+20+8], -1 |
||
541 | jz .noprec1 |
||
542 | cmp eax, [esp+20+8] |
||
543 | jae .len_found1 |
||
544 | mov eax, [esp+20+8] |
||
545 | jmp .len_found1 |
||
9105 | hidnplayr | 546 | .noprec1: |
836 | diamond | 547 | test bh, 4 |
548 | jnz .do_print_num |
||
9105 | hidnplayr | 549 | .len_found1: |
836 | diamond | 550 | test bh, 2 |
551 | jnz .do_print_num |
||
552 | cmp byte [esp+20], 0 |
||
553 | jz @f |
||
554 | inc eax |
||
9105 | hidnplayr | 555 | @@: |
836 | diamond | 556 | cmp byte [esp+20], 0 |
557 | jnz @f |
||
558 | cmp byte [esp+4], 0 |
||
559 | jz @f |
||
560 | inc eax |
||
9105 | hidnplayr | 561 | @@: |
836 | diamond | 562 | test bh, 1 |
563 | jz .nosharp1 |
||
564 | cmp cl, 8 |
||
565 | jnz @f |
||
566 | inc eax |
||
567 | jmp .nosharp1 |
||
9105 | hidnplayr | 568 | @@: |
836 | diamond | 569 | cmp cl, 16 |
570 | jnz .nosharp1 |
||
571 | inc eax |
||
572 | inc eax |
||
9105 | hidnplayr | 573 | .nosharp1: |
836 | diamond | 574 | cmp dword [esp+20+4], -1 |
575 | jz .do_print_num |
||
576 | sub eax, [esp+20+4] |
||
577 | jae .do_print_num |
||
578 | push ecx |
||
579 | mov ecx, eax |
||
580 | mov al, ' ' |
||
9105 | hidnplayr | 581 | @@: |
836 | diamond | 582 | xchg edi, [esp+20] |
583 | call con.write_char_ex |
||
584 | inc dword [esp+24+12+64+28] |
||
585 | xchg edi, [esp+20] |
||
586 | inc dword [esp+4] |
||
587 | inc ecx |
||
588 | jnz @b |
||
589 | pop ecx |
||
9105 | hidnplayr | 590 | .do_print_num: |
836 | diamond | 591 | mov al, '-' |
592 | cmp byte [esp+4], 0 |
||
593 | jnz .write_sign |
||
594 | mov al, [esp+20] |
||
595 | test al, al |
||
596 | jz .sign_written |
||
9105 | hidnplayr | 597 | .write_sign: |
836 | diamond | 598 | call .num_write_char |
9105 | hidnplayr | 599 | .sign_written: |
836 | diamond | 600 | test bh, 1 |
601 | jz .nosharp2 |
||
602 | mov al, '0' |
||
603 | cmp cl, 8 |
||
604 | jz @f |
||
605 | cmp cl, 16 |
||
606 | jnz .nosharp2 |
||
607 | call .num_write_char |
||
608 | mov al, [esp+8] |
||
9105 | hidnplayr | 609 | @@: |
836 | diamond | 610 | call .num_write_char |
9105 | hidnplayr | 611 | .nosharp2: |
836 | diamond | 612 | lea ecx, [esp+32+64-1] |
613 | sub ecx, edi |
||
614 | cmp dword [esp+20+8], -1 |
||
615 | jz .noprec2 |
||
616 | sub ecx, [esp+20+8] |
||
617 | jmp .lead_zeroes |
||
9105 | hidnplayr | 618 | .noprec2: |
836 | diamond | 619 | test bh, 4 |
620 | jz .do_print_num2 |
||
621 | add ecx, [esp] |
||
622 | sub ecx, [esp+20+4] |
||
9105 | hidnplayr | 623 | .lead_zeroes: |
836 | diamond | 624 | jae .do_print_num2 |
9105 | hidnplayr | 625 | @@: |
836 | diamond | 626 | mov al, '0' |
627 | call .num_write_char |
||
628 | inc ecx |
||
629 | jnz @b |
||
9105 | hidnplayr | 630 | .do_print_num2: |
836 | diamond | 631 | mov al, [edi] |
632 | test al, al |
||
633 | jz .num_written |
||
634 | call .num_write_char |
||
635 | inc edi |
||
636 | jmp .do_print_num2 |
||
9105 | hidnplayr | 637 | .num_written: |
836 | diamond | 638 | pop ecx |
639 | mov edi, [esp+12] |
||
640 | cmp dword [esp+16+4], -1 |
||
641 | jz .num_written2 |
||
9105 | hidnplayr | 642 | @@: |
836 | diamond | 643 | cmp ecx, [esp+16+4] |
644 | jae .num_written2 |
||
645 | mov al, ' ' |
||
646 | call con.write_char |
||
647 | inc ecx |
||
648 | jmp @b |
||
9105 | hidnplayr | 649 | .num_written2: |
836 | diamond | 650 | add esp, 16 |
9105 | hidnplayr | 651 | .spec_done: |
836 | diamond | 652 | add esp, 12 |
653 | jmp .loop |
||
9105 | hidnplayr | 654 | .char: |
836 | diamond | 655 | mov ecx, [esp+4] |
656 | cmp ecx, -1 |
||
657 | jnz @f |
||
658 | inc ecx |
||
9105 | hidnplayr | 659 | @@: |
836 | diamond | 660 | test ecx, ecx |
661 | jnz @f |
||
662 | inc ecx |
||
9105 | hidnplayr | 663 | @@: |
836 | diamond | 664 | test bh, 2 |
665 | jnz .char_left_pad |
||
666 | mov al, ' ' |
||
667 | dec ecx |
||
668 | jz .nowidth |
||
669 | add [esp+12+64+28], ecx |
||
9105 | hidnplayr | 670 | @@: |
836 | diamond | 671 | call con.write_char |
672 | loop @b |
||
9105 | hidnplayr | 673 | .nowidth: |
836 | diamond | 674 | mov al, [ebp] |
675 | add ebp, 4 |
||
676 | jmp .percent |
||
9105 | hidnplayr | 677 | .char_left_pad: |
836 | diamond | 678 | mov al, [ebp] |
679 | add ebp, 4 |
||
680 | call con.write_char_ex |
||
681 | add [esp+12+64+28], ecx |
||
682 | dec ecx |
||
683 | jz .nowidth2 |
||
684 | mov al, ' ' |
||
9105 | hidnplayr | 685 | @@: |
836 | diamond | 686 | call con.write_char |
687 | loop @b |
||
9105 | hidnplayr | 688 | .nowidth2: |
836 | diamond | 689 | jmp .spec_done |
9105 | hidnplayr | 690 | .string: |
836 | diamond | 691 | push esi |
692 | mov esi, [ebp] |
||
693 | test esi, esi |
||
694 | jnz @f |
||
695 | mov esi, con.aNull |
||
9105 | hidnplayr | 696 | @@: |
836 | diamond | 697 | add ebp, 4 |
698 | or ecx, -1 |
||
9105 | hidnplayr | 699 | @@: |
836 | diamond | 700 | inc ecx |
701 | cmp byte [esi+ecx], 0 |
||
702 | jnz @b |
||
703 | cmp ecx, [esp+12] |
||
704 | jb @f |
||
705 | mov ecx, [esp+12] |
||
9105 | hidnplayr | 706 | @@: |
836 | diamond | 707 | test bh, 2 |
708 | jnz .write_string |
||
709 | cmp dword [esp+8], -1 |
||
710 | jz .write_string |
||
711 | push ecx |
||
712 | sub ecx, [esp+12] |
||
713 | jae .nospace |
||
714 | mov al, ' ' |
||
9105 | hidnplayr | 715 | @@: |
836 | diamond | 716 | call con.write_char |
717 | inc dword [esp+20+64+28] |
||
718 | inc ecx |
||
719 | jnz @b |
||
9105 | hidnplayr | 720 | .nospace: |
836 | diamond | 721 | pop ecx |
9105 | hidnplayr | 722 | .write_string: |
836 | diamond | 723 | jecxz .string_written |
724 | add dword [esp+16+64+28], ecx |
||
725 | push ecx |
||
9105 | hidnplayr | 726 | @@: |
836 | diamond | 727 | lodsb |
728 | call con.write_char_ex |
||
729 | loop @b |
||
730 | pop ecx |
||
9105 | hidnplayr | 731 | .string_written: |
836 | diamond | 732 | pop esi |
733 | test bh, 2 |
||
734 | jz .spec_done |
||
735 | cmp dword [esp+4], -1 |
||
736 | jz .spec_done |
||
737 | sub ecx, [esp+4] |
||
738 | jae .spec_done |
||
739 | mov al, ' ' |
||
9105 | hidnplayr | 740 | @@: |
836 | diamond | 741 | call con.write_char |
742 | inc dword [esp+12+64+28] |
||
743 | inc ecx |
||
744 | jnz @b |
||
745 | jmp .spec_done |
||
9105 | hidnplayr | 746 | .done: |
836 | diamond | 747 | add esp, 64 |
748 | popad |
||
749 | jmp con.update_screen |
||
9105 | hidnplayr | 750 | .num_write_char: |
836 | diamond | 751 | xchg edi, [esp+20] |
752 | call con.write_char_ex |
||
753 | inc dword [esp+24+12+64+28] |
||
754 | xchg edi, [esp+20] |
||
755 | inc dword [esp+4] |
||
756 | ret |
||
757 | |||
758 | con.write: |
||
759 | ; esi = string, ebx = length (ebx=-1 for ASCIIZ strings) |
||
760 | push edi |
||
761 | call con.get_data_ptr |
||
762 | test ebx, ebx |
||
763 | jz .done |
||
9105 | hidnplayr | 764 | .loop: |
836 | diamond | 765 | lodsb |
766 | cmp ebx, -1 |
||
767 | jnz @f |
||
768 | test al, al |
||
769 | jz .done |
||
9105 | hidnplayr | 770 | @@: |
836 | diamond | 771 | call con.write_char_ex |
9105 | hidnplayr | 772 | .next: |
836 | diamond | 773 | cmp ebx, -1 |
774 | jz .loop |
||
775 | dec ebx |
||
776 | jnz .loop |
||
9105 | hidnplayr | 777 | .done: |
836 | diamond | 778 | pop edi |
779 | jmp con.update_screen |
||
780 | |||
781 | con.get_data_ptr: |
||
782 | mov edi, [con.cur_y] |
||
783 | imul edi, [con.scr_width] |
||
784 | add edi, [con.cur_x] |
||
785 | add edi, edi |
||
786 | add edi, [con.data] |
||
787 | ret |
||
788 | |||
789 | con.write_char_ex: |
||
790 | test byte [con_flags+1], 1 |
||
791 | jz con.write_special_char |
||
792 | |||
793 | con.write_char: |
||
794 | push eax |
||
3690 | hidnplayr | 795 | |
796 | mov eax, [con.cur_x] |
||
797 | cmp eax, [con.scr_width] |
||
798 | jb @f |
||
799 | and [con.cur_x], 0 |
||
800 | call con.newline |
||
9105 | hidnplayr | 801 | @@: |
3690 | hidnplayr | 802 | mov eax, [esp] |
836 | diamond | 803 | stosb |
804 | mov al, byte [con_flags] |
||
805 | stosb |
||
3690 | hidnplayr | 806 | |
836 | diamond | 807 | mov eax, [con.cur_x] |
808 | inc eax |
||
809 | mov [con.cur_x], eax |
||
3690 | hidnplayr | 810 | |
836 | diamond | 811 | pop eax |
812 | ret |
||
813 | |||
814 | con.write_special_char: |
||
815 | cmp [con_esc], 0 |
||
816 | jnz .esc_mode |
||
9105 | hidnplayr | 817 | .normal_mode: |
836 | diamond | 818 | cmp al, 10 |
819 | jz .write_lf |
||
820 | cmp al, 13 |
||
821 | jz .write_cr |
||
822 | cmp al, 27 |
||
823 | jz .write_esc |
||
824 | cmp al, 8 |
||
825 | jz .write_bs |
||
9096 | hidnplayr | 826 | cmp al, 7 |
827 | jz .bell |
||
836 | diamond | 828 | cmp al, 9 |
829 | jnz con.write_char |
||
9105 | hidnplayr | 830 | .write_tab: |
836 | diamond | 831 | mov al, ' ' |
832 | call con.write_char |
||
833 | test [con.cur_x], 7 |
||
834 | jnz .write_tab |
||
835 | ret |
||
9105 | hidnplayr | 836 | .write_cr: |
836 | diamond | 837 | and [con.cur_x], 0 |
838 | jmp con.get_data_ptr |
||
9105 | hidnplayr | 839 | .write_lf: |
836 | diamond | 840 | and [con.cur_x], 0 |
841 | jmp con.newline |
||
9105 | hidnplayr | 842 | .write_bs: |
836 | diamond | 843 | cmp [con.cur_x], 0 |
844 | jz @f |
||
845 | dec [con.cur_x] |
||
846 | dec edi |
||
847 | dec edi |
||
848 | ret |
||
9105 | hidnplayr | 849 | @@: |
836 | diamond | 850 | push eax |
851 | mov eax, [con.cur_y] |
||
852 | dec eax |
||
853 | js @f |
||
854 | mov [con.cur_y], eax |
||
855 | mov eax, [con.scr_width] |
||
856 | dec eax |
||
857 | mov [con.cur_x], eax |
||
858 | dec edi |
||
859 | dec edi |
||
9105 | hidnplayr | 860 | @@: |
836 | diamond | 861 | pop eax |
862 | ret |
||
9105 | hidnplayr | 863 | .bell: |
9096 | hidnplayr | 864 | pusha |
865 | push 55 |
||
866 | pop eax |
||
867 | mov ebx, eax |
||
9105 | hidnplayr | 868 | mov esi, con.bell |
9096 | hidnplayr | 869 | int 0x40 |
870 | popa |
||
871 | ret |
||
9105 | hidnplayr | 872 | .write_esc: |
836 | diamond | 873 | mov [con_esc], 1 |
874 | mov [con_esc_attr_n], 1 |
||
875 | and [con_esc_attrs], 0 |
||
876 | ret |
||
9105 | hidnplayr | 877 | |
878 | .esc_mode: |
||
836 | diamond | 879 | cmp [con_sci], 0 |
880 | jnz .esc_sci |
||
881 | cmp al, '[' |
||
9105 | hidnplayr | 882 | je .esc_sqro |
883 | cmp al, ']' |
||
884 | je .esc_sqrc |
||
885 | cmp al, '(' |
||
886 | je .esc_rndo |
||
887 | cmp al, '>' |
||
888 | je .keypm_norm |
||
889 | cmp al, '=' |
||
890 | je .keypm_alt |
||
891 | ; Unrecognized escape sequence, print it to screen |
||
836 | diamond | 892 | push eax |
893 | mov al, 27 |
||
894 | call con.write_char |
||
895 | pop eax |
||
896 | jmp con.write_char |
||
9105 | hidnplayr | 897 | |
898 | .esc_sqro: |
||
899 | mov [con_sci], 1 |
||
900 | ret |
||
901 | .esc_sqrc: |
||
902 | mov [con_sci], 2 |
||
903 | ret |
||
904 | .esc_rndo: |
||
905 | mov [con_sci], 4 |
||
906 | ret |
||
907 | |||
908 | .keypm_norm: |
||
909 | ; TODO: turn numlock on |
||
910 | mov [con_esc], 0 |
||
911 | ret |
||
912 | |||
913 | .keypm_alt: |
||
914 | ; TODO: turn numlock off |
||
915 | mov [con_esc], 0 |
||
916 | ret |
||
917 | |||
836 | diamond | 918 | .esc_sci: |
9105 | hidnplayr | 919 | cmp [con_sci], 3 |
920 | je .string |
||
921 | cmp [con_sci], 4 |
||
922 | je .g0charset |
||
836 | diamond | 923 | ; this is real Esc sequence |
3886 | hidnplayr | 924 | cmp al, '?' ; DEC private mode (DECSET/DECRST sequences) |
925 | je .questionmark |
||
836 | diamond | 926 | cmp al, ';' |
927 | jz .next_arg |
||
928 | cmp al, '0' |
||
929 | jb .not_digit |
||
930 | cmp al, '9' |
||
931 | ja .not_digit |
||
932 | push eax ecx edx |
||
933 | sub al, '0' |
||
934 | movzx eax, al |
||
935 | mov ecx, [con_esc_attr_n] |
||
936 | mov edx, [con_esc_attrs+(ecx-1)*4] |
||
937 | lea edx, [edx*5] |
||
938 | lea edx, [edx*2+eax] |
||
939 | mov [con_esc_attrs+(ecx-1)*4], edx |
||
940 | pop edx ecx eax |
||
941 | ret |
||
9105 | hidnplayr | 942 | .g0charset: |
943 | ; Designate G0 Character Set |
||
944 | ; Unimplemented: read and ignore. |
||
945 | mov [con_sci], 0 |
||
946 | mov [con_esc], 0 |
||
947 | ret |
||
948 | .string: |
||
949 | cmp al, 0x07 ; bell |
||
950 | je .string_end |
||
951 | cmp al, 0x9C ; string terminator |
||
952 | je .string_end |
||
953 | push ecx |
||
954 | mov ecx, [con_osc_strlen] |
||
955 | cmp ecx, 255 |
||
956 | jae @f |
||
957 | mov [con_osc_str+ecx], al |
||
958 | inc [con_osc_strlen] |
||
959 | @@: |
||
960 | pop ecx |
||
961 | ret |
||
962 | .string_end: |
||
963 | mov [con_sci], 0 |
||
964 | mov [con_esc], 0 |
||
965 | pusha |
||
966 | mov ecx, [con_osc_strlen] |
||
967 | mov byte[con_osc_str+ecx], 0 |
||
968 | cmp [con_esc_attrs+0], 0 ; Set Icon and Window Title |
||
969 | je .set_title |
||
970 | cmp [con_esc_attrs+0], 2 ; Set Window Title |
||
971 | je .set_title |
||
972 | ret |
||
973 | .set_title: |
||
974 | push con_osc_str |
||
975 | call con_set_title |
||
976 | popa |
||
977 | ret |
||
3886 | hidnplayr | 978 | .questionmark: |
979 | push ecx |
||
980 | mov ecx, [con_esc_attr_n] |
||
981 | mov dword[con_esc_attrs+(ecx-1)*4], 0xffffffff |
||
982 | pop ecx |
||
836 | diamond | 983 | .next_arg: |
984 | push eax |
||
985 | mov eax, [con_esc_attr_n] |
||
986 | inc eax |
||
987 | cmp al, 4 |
||
988 | jbe @f |
||
989 | dec eax |
||
990 | @@: |
||
991 | mov [con_esc_attr_n], eax |
||
992 | and [con_esc_attrs+(eax-1)*4], 0 |
||
9105 | hidnplayr | 993 | ; Check for operating system command |
994 | cmp [con_sci], 2 |
||
995 | jne @f |
||
996 | cmp [con_esc_attr_n], 2 |
||
997 | jne @f |
||
998 | ; Next argument is string |
||
999 | mov [con_sci], 3 |
||
1000 | mov [con_osc_strlen], 0 |
||
1001 | @@: |
||
836 | diamond | 1002 | pop eax |
1003 | ret |
||
1004 | .not_digit: |
||
1005 | mov [con_esc], 0 |
||
1006 | mov [con_sci], 0 ; in any case, leave Esc mode |
||
9105 | hidnplayr | 1007 | |
1008 | ; cmp al, '@' |
||
1009 | ; je .insert_chars |
||
853 | diamond | 1010 | cmp al, 'A' |
9105 | hidnplayr | 1011 | je .cursor_up |
853 | diamond | 1012 | cmp al, 'B' |
9105 | hidnplayr | 1013 | je .cursor_down |
853 | diamond | 1014 | cmp al, 'C' |
9105 | hidnplayr | 1015 | je .cursor_right |
853 | diamond | 1016 | cmp al, 'D' |
9105 | hidnplayr | 1017 | je .cursor_left |
1018 | ; cmp al, 'E' |
||
1019 | ; je .cursor_next_line |
||
1020 | ; cmp al, 'F' |
||
1021 | ; je .cursor_prev_line |
||
1022 | ; cmp al, 'G' |
||
1023 | ; je .cursor_next_line |
||
1024 | ; cmp al, 'S' |
||
1025 | ; je .scroll_page_up |
||
1026 | ; cmp al, 'T' |
||
1027 | ; je .scroll_page_down |
||
1028 | cmp al, 'H' |
||
1029 | je .cursor_position |
||
1030 | cmp al, 'J' |
||
1031 | je .erase_in_display |
||
9096 | hidnplayr | 1032 | cmp al, 'K' |
1033 | je .erase_in_line |
||
9105 | hidnplayr | 1034 | cmp al, 'L' |
1035 | je .insert_lines |
||
1036 | cmp al, 'M' |
||
1037 | je .delete_lines |
||
1038 | cmp al, 'P' |
||
1039 | je .delete_chars |
||
1040 | cmp al, 'X' |
||
1041 | je .erase_chars |
||
1042 | |||
1043 | cmp al, 'd' |
||
1044 | je .line_position_abs |
||
1045 | ; cmp al, 'e' |
||
1046 | ; je .line_position_rel |
||
1047 | cmp al, 'f' |
||
1048 | je .cursor_position |
||
1049 | cmp al, 'h' |
||
1050 | je .set_mode |
||
1051 | cmp al, 'l' |
||
1052 | je .reset_mode |
||
1053 | cmp al, 'm' |
||
1054 | je .set_attr |
||
1055 | cmp al, 'r' |
||
1056 | je .scroll_region |
||
1057 | ; cmp al, 's' |
||
1058 | ; je .save_cursor_pos |
||
1059 | ; cmp al, 't' |
||
1060 | ; je .window_manip |
||
1061 | ; cmp al, 'u' |
||
1062 | ; je .restore_cursor_pos |
||
1063 | |||
836 | diamond | 1064 | ret ; simply skip unknown sequences |
3886 | hidnplayr | 1065 | |
9105 | hidnplayr | 1066 | .insert_lines: |
1067 | |||
1068 | push eax ebx ecx esi |
||
1069 | mov eax, [con_esc_attrs+0] ; amount of lines to scroll down |
||
1070 | test eax, eax |
||
1071 | jnz @f ; default is 1 |
||
1072 | inc eax |
||
1073 | @@: |
||
1074 | ; Check that we are inside the scroll region |
||
1075 | mov ebx, [con.cur_y] |
||
1076 | cmp ebx, [con.scroll_top] |
||
1077 | jb .no_insert_lines |
||
1078 | add ebx, eax |
||
1079 | cmp ebx, [con.scroll_bot] |
||
1080 | ja .no_insert_lines |
||
1081 | ; Move cursor to the left |
||
1082 | mov [con.cur_x], 0 |
||
1083 | call con.get_data_ptr |
||
1084 | ; Calc amount of chars in requested numer of lines |
||
1085 | mov ebx, [con.scr_width] |
||
1086 | imul ebx, eax |
||
1087 | ; Move the lines down (in backwards order) |
||
1088 | push edi |
||
1089 | mov ecx, [con.scroll_bot] |
||
1090 | sub ecx, [con.cur_y] |
||
1091 | sub ecx, eax |
||
1092 | imul ecx, [con.scr_width] |
||
1093 | lea esi, [edi + 2*ecx - 2] |
||
1094 | lea edi, [esi + 2*ebx] |
||
1095 | std |
||
1096 | rep movsw |
||
1097 | cld |
||
1098 | pop edi |
||
1099 | ; Insert empty lines |
||
1100 | push edi |
||
1101 | mov ecx, ebx |
||
1102 | mov ah, byte[con_flags] |
||
1103 | mov al, ' ' |
||
1104 | rep stosw |
||
1105 | pop edi |
||
1106 | .no_insert_lines: |
||
1107 | pop esi ecx ebx eax |
||
1108 | ret |
||
1109 | |||
1110 | .delete_lines: |
||
1111 | |||
1112 | push eax ebx ecx esi |
||
1113 | mov eax, [con_esc_attrs+0] ; amount of lines to scroll up |
||
1114 | test eax, eax |
||
1115 | jnz @f ; default is 1 |
||
1116 | inc eax |
||
1117 | @@: |
||
1118 | ; Check that we are inside the scroll region |
||
1119 | mov ebx, [con.cur_y] |
||
1120 | cmp ebx, [con.scroll_top] |
||
1121 | jb .no_delete_lines |
||
1122 | add ebx, eax |
||
1123 | cmp ebx, [con.scroll_bot] |
||
1124 | ja .no_delete_lines |
||
1125 | ; Move cursor to the left |
||
1126 | mov [con.cur_x], 0 |
||
1127 | call con.get_data_ptr |
||
1128 | ; Calc amount of chars in requested numer of lines |
||
1129 | mov ebx, [con.scr_width] |
||
1130 | imul ebx, eax |
||
1131 | ; Move the lines up |
||
1132 | mov ecx, [con.scroll_bot] |
||
1133 | sub ecx, [con.cur_y] |
||
1134 | imul ecx, [con.scr_width] |
||
1135 | lea esi, [edi + 2*ebx] |
||
1136 | rep movsw |
||
1137 | ; Set new cursor row position |
||
1138 | add [con.cur_y], eax |
||
1139 | ; Add empty lines till end of scroll region |
||
1140 | push edi |
||
1141 | mov ecx, ebx |
||
1142 | mov ah, byte[con_flags] |
||
1143 | mov al, ' ' |
||
1144 | rep stosw |
||
1145 | pop edi |
||
1146 | .no_delete_lines: |
||
1147 | pop esi ecx ebx eax |
||
1148 | ret |
||
1149 | |||
1150 | .scroll_region: |
||
1151 | push eax ebx |
||
1152 | cmp [con_esc_attr_n], 2 |
||
1153 | jb .no_scroll_region |
||
1154 | mov eax, [con_esc_attrs+0] ; top |
||
1155 | dec eax |
||
1156 | js .no_scroll_region |
||
1157 | cmp eax, [con.wnd_height] |
||
1158 | ja .no_scroll_region |
||
1159 | |||
1160 | mov ebx, [con_esc_attrs+4] ; bottom |
||
1161 | dec ebx |
||
1162 | js .no_scroll_region |
||
1163 | cmp ebx, [con.wnd_height] |
||
1164 | ja .no_scroll_region |
||
1165 | |||
1166 | cmp eax, ebx |
||
1167 | ja .no_scroll_region |
||
1168 | |||
1169 | mov [con.scroll_top], eax |
||
1170 | mov [con.scroll_bot], ebx |
||
1171 | |||
1172 | .no_scroll_region: |
||
1173 | pop ebx eax |
||
1174 | ret |
||
1175 | |||
1176 | .reset_mode: |
||
3886 | hidnplayr | 1177 | mov eax, [con_esc_attrs] |
1178 | cmp eax, 0xffffffff |
||
1179 | jne .no_dec_rst |
||
1180 | mov eax, [con_esc_attrs+4] |
||
9105 | hidnplayr | 1181 | cmp eax, 1 |
1182 | je .dec_rst_app_cursor_keys |
||
1183 | ; cmp eax, 7 |
||
1184 | ; je .dec_rst_wraparound |
||
1185 | ; cmp eax, 12 |
||
1186 | ; je .dec_rst_cursor_blink |
||
3886 | hidnplayr | 1187 | cmp eax, 25 |
9105 | hidnplayr | 1188 | je .dec_rst_cursor |
1189 | ; cmp eax, 1000 |
||
1190 | ; je .dec_rst_mouse |
||
1191 | ; cmp eax, 1002 |
||
1192 | ; je .dec_rst_buttons |
||
1193 | ; cmp eax, 1006 |
||
1194 | ; je .dec_rst_mouse_sgr |
||
1195 | cmp eax, 1049 |
||
1196 | je .dec_rst_altbuff |
||
1197 | ; cmp eax, 2004 |
||
1198 | ; je .dec_rst_brck_paste |
||
3886 | hidnplayr | 1199 | .no_dec_rst: |
9105 | hidnplayr | 1200 | ; cmp eax, 2 |
1201 | ; je .rst_keyb_action_mode |
||
1202 | ; cmp eax, 4 |
||
1203 | ; je .set_replace_mode |
||
3886 | hidnplayr | 1204 | ret |
1205 | |||
9105 | hidnplayr | 1206 | .set_mode: |
3886 | hidnplayr | 1207 | mov eax, [con_esc_attrs] |
1208 | cmp eax, 0xffffffff |
||
1209 | jne .no_dec_set |
||
1210 | mov eax, [con_esc_attrs+4] |
||
9105 | hidnplayr | 1211 | cmp eax, 1 |
1212 | je .dec_set_app_cursor_keys |
||
1213 | ; cmp eax, 7 |
||
1214 | ; je .dec_set_wraparound |
||
1215 | ; cmp eax, 12 |
||
1216 | ; je .dec_set_cursor_blink |
||
3886 | hidnplayr | 1217 | cmp eax, 25 |
9105 | hidnplayr | 1218 | je .dec_set_cursor |
1219 | ; cmp eax, 1000 |
||
1220 | ; je .dec_set_mouse |
||
1221 | ; cmp eax, 1002 |
||
1222 | ; je .set_buttons |
||
1223 | ; cmp eax, 1006 |
||
1224 | ; je .dec_rst_mouse_sgr |
||
1225 | cmp eax, 1049 |
||
1226 | je .dec_set_altbuff |
||
1227 | ; cmp eax, 2004 |
||
1228 | ; je .dec_set_brck_paste |
||
3886 | hidnplayr | 1229 | .no_dec_set: |
9105 | hidnplayr | 1230 | ; cmp eax, 2 |
1231 | ; je .set_keyb_action_mode |
||
1232 | ; cmp eax, 4 |
||
1233 | ; je .set_insert_mode |
||
3886 | hidnplayr | 1234 | ret |
1235 | |||
9105 | hidnplayr | 1236 | .dec_set_app_cursor_keys: |
1237 | mov [cursor_esc], 27 + ('O' shl 8) |
||
1238 | ret |
||
1239 | |||
1240 | .dec_rst_app_cursor_keys: |
||
1241 | mov [cursor_esc], 27 + ('[' shl 8) |
||
1242 | ret |
||
1243 | |||
1244 | .dec_set_cursor: |
||
3886 | hidnplayr | 1245 | mov [con.cursor_height], (15*font_height+50)/100 ; default height |
1246 | ret |
||
9096 | hidnplayr | 1247 | |
9105 | hidnplayr | 1248 | .dec_rst_cursor: |
1249 | mov [con.cursor_height], 0 |
||
1250 | ret |
||
1251 | |||
1252 | .dec_set_altbuff: |
||
1253 | ; Switch buffer |
||
1254 | push [con.altbuffer] |
||
1255 | pop [con.data] |
||
1256 | ; Set new buffer size |
||
1257 | push [con.wnd_width] |
||
1258 | pop [con.scr_width] |
||
1259 | push [con.wnd_height] |
||
1260 | pop [con.scr_height] |
||
1261 | ; Save cursor |
||
1262 | push [con.cur_x] |
||
1263 | pop [con.main_cur_x] |
||
1264 | push [con.cur_y] |
||
1265 | pop [con.main_cur_y] |
||
1266 | ; Save window position |
||
1267 | push [con.wnd_xpos] |
||
1268 | pop [con.main_wnd_xpos] |
||
1269 | push [con.wnd_ypos] |
||
1270 | pop [con.main_wnd_ypos] |
||
1271 | ; Clear screen |
||
1272 | mov edi, [con.altbuffer] |
||
1273 | mov eax, [con.wnd_width] |
||
1274 | mul [con.wnd_height] |
||
1275 | mov ecx, eax |
||
1276 | mov ah, byte[con_flags] |
||
1277 | mov al, ' ' |
||
1278 | rep stosw |
||
1279 | ; Reset cursor position |
||
1280 | mov [con.cur_x], 0 |
||
1281 | mov [con.cur_y], 0 |
||
1282 | ; Reset window position |
||
1283 | mov [con.wnd_xpos], 0 |
||
1284 | mov [con.wnd_ypos], 0 |
||
1285 | ; Get new data ptr so we can sart writing to new buffer |
||
1286 | call con.get_data_ptr |
||
1287 | ; Finally, tell the GUI the window has been resized |
||
1288 | ; (Redraw scrollbar and image) |
||
1289 | mov [con.thread_op], OP_RESIZE |
||
1290 | jmp con.wake |
||
1291 | |||
1292 | .dec_rst_altbuff: |
||
1293 | ; Switch buffer |
||
1294 | push [con.mainbuffer] |
||
1295 | pop [con.data] |
||
1296 | ; Set new buffer size |
||
1297 | push [con.main_scr_width] |
||
1298 | pop [con.scr_width] |
||
1299 | push [con.main_scr_height] |
||
1300 | pop [con.scr_height] |
||
1301 | ; Restore cursor |
||
1302 | push [con.main_cur_x] |
||
1303 | pop [con.cur_x] |
||
1304 | push [con.main_cur_y] |
||
1305 | pop [con.cur_y] |
||
1306 | ; Restore window position |
||
1307 | push [con.main_wnd_xpos] |
||
1308 | pop [con.wnd_xpos] |
||
1309 | push [con.main_wnd_ypos] |
||
1310 | pop [con.wnd_ypos] |
||
1311 | ; Get new data ptr so we can sart writing to new buffer |
||
1312 | call con.get_data_ptr |
||
1313 | ; Finally, tell the GUI the window has been resized |
||
1314 | ; (Redraw scrollbar and image) |
||
1315 | mov [con.thread_op], OP_RESIZE |
||
1316 | jmp con.wake |
||
1317 | |||
1318 | .erase_chars: |
||
1319 | push edi ecx |
||
1320 | mov ecx, [con_esc_attrs] |
||
1321 | test ecx, ecx |
||
1322 | jnz @f |
||
1323 | inc ecx |
||
1324 | @@: |
||
1325 | mov ah, byte[con_flags] |
||
1326 | mov al, ' ' |
||
1327 | rep stosw |
||
1328 | pop ecx edi |
||
1329 | ; Unclear where cursor should point to now.. |
||
1330 | ret |
||
1331 | |||
1332 | .delete_chars: |
||
1333 | push edi ecx |
||
1334 | mov ecx, [con_esc_attrs] |
||
1335 | test ecx, ecx |
||
1336 | jnz @f |
||
1337 | inc ecx |
||
1338 | @@: |
||
1339 | sub edi, 2 |
||
1340 | mov ah, byte[con_flags] |
||
1341 | mov al, ' ' |
||
1342 | std |
||
1343 | rep stosw |
||
1344 | cld |
||
1345 | pop ecx edi |
||
1346 | ret |
||
1347 | |||
9096 | hidnplayr | 1348 | .erase_in_line: |
1349 | mov eax, [con_esc_attrs] |
||
1350 | test eax, eax |
||
9105 | hidnplayr | 1351 | jz .erase_after ; |
9096 | hidnplayr | 1352 | dec eax |
9105 | hidnplayr | 1353 | jz .erase_before ; |
9096 | hidnplayr | 1354 | dec eax |
1355 | je .erase_current_line ; |
||
1356 | ret ; unknown sequence |
||
1357 | |||
9105 | hidnplayr | 1358 | .erase_after: |
9096 | hidnplayr | 1359 | push edi ecx |
1360 | mov ecx, [con.scr_width] |
||
1361 | sub ecx, [con.cur_x] |
||
1362 | mov ah, byte[con_flags] |
||
1363 | mov al, ' ' |
||
1364 | rep stosw |
||
1365 | pop ecx edi |
||
1366 | ret |
||
1367 | |||
9105 | hidnplayr | 1368 | .erase_before: |
9096 | hidnplayr | 1369 | push edi ecx |
1370 | mov edi, [con.cur_y] |
||
1371 | imul edi, [con.scr_width] |
||
1372 | shl edi, 1 |
||
1373 | add edi, [con.data] |
||
1374 | mov ecx, [con.cur_y] |
||
1375 | mov ah, byte[con_flags] |
||
1376 | mov al, ' ' |
||
1377 | rep stosw |
||
1378 | pop ecx edi |
||
1379 | ret |
||
1380 | |||
1381 | .erase_current_line: |
||
1382 | push edi ecx |
||
1383 | mov edi, [con.cur_y] |
||
1384 | imul edi, [con.scr_width] |
||
1385 | shl edi, 1 |
||
1386 | add edi, [con.data] |
||
1387 | mov ecx, [con.scr_width] |
||
1388 | mov ah, byte[con_flags] |
||
1389 | mov al, ' ' |
||
1390 | rep stosw |
||
1391 | pop ecx edi |
||
1392 | ret |
||
1393 | |||
9105 | hidnplayr | 1394 | .erase_in_display: |
3885 | hidnplayr | 1395 | mov eax, [con_esc_attrs] |
1396 | test eax, eax |
||
9105 | hidnplayr | 1397 | jz .erase_below ; |
3885 | hidnplayr | 1398 | dec eax |
9105 | hidnplayr | 1399 | jz .erase_above ; |
3885 | hidnplayr | 1400 | dec eax |
9105 | hidnplayr | 1401 | je .erase_all ; |
3885 | hidnplayr | 1402 | ret ; unknown sequence |
1403 | |||
9105 | hidnplayr | 1404 | .erase_below: |
3885 | hidnplayr | 1405 | push edi ecx |
1406 | mov ecx, [con.scr_width] |
||
1407 | imul ecx, [con.scr_height] |
||
1408 | |||
1409 | mov edi, [con.cur_y] |
||
1410 | imul edi, [con.scr_width] |
||
1411 | add edi, [con.cur_x] |
||
1412 | |||
1413 | sub ecx, edi |
||
1414 | shl edi, 1 |
||
1415 | add edi, [con.data] |
||
1416 | mov ah, byte[con_flags] |
||
1417 | mov al, ' ' |
||
1418 | rep stosw |
||
1419 | |||
1420 | and [con.cur_x], 0 |
||
1421 | and [con.cur_y], 0 |
||
1422 | pop ecx edi |
||
1423 | ret |
||
1424 | |||
9105 | hidnplayr | 1425 | .erase_above: |
3885 | hidnplayr | 1426 | push edi ecx |
1427 | mov ecx, [con.cur_y] |
||
1428 | imul ecx, [con.scr_width] |
||
1429 | add ecx, [con.cur_x] |
||
1430 | mov edi, [con.data] |
||
1431 | mov ah, byte[con_flags] |
||
1432 | mov al, ' ' |
||
1433 | rep stosw |
||
1434 | pop ecx edi |
||
1435 | ret |
||
1436 | |||
9105 | hidnplayr | 1437 | .erase_all: ; clear screen completely |
853 | diamond | 1438 | push ecx |
1439 | and [con.cur_x], 0 |
||
1440 | and [con.cur_y], 0 |
||
1441 | mov edi, [con.data] |
||
1442 | push edi |
||
1443 | mov ecx, [con.scr_width] |
||
1444 | imul ecx, [con.scr_height] |
||
1445 | mov ax, 0720h |
||
1446 | rep stosw |
||
1447 | pop edi ecx |
||
1448 | .nosetcursor: |
||
1449 | ret |
||
9105 | hidnplayr | 1450 | .line_position_abs: |
1451 | mov eax, [con_esc_attrs] |
||
1452 | dec eax |
||
1453 | jns @f |
||
1454 | inc eax |
||
1455 | @@: |
||
1456 | cmp eax, [con.scr_height] |
||
1457 | jae .nolinepos |
||
3688 | hidnplayr | 1458 | mov [con.cur_y], eax |
9105 | hidnplayr | 1459 | jmp con.get_data_ptr |
1460 | .nolinepos: |
||
1461 | ret |
||
1462 | .cursor_position: |
||
1463 | ; We always have at least one con_esc_attr, defaulting to 0 |
||
1464 | ; Coordinates however are 1-based |
||
1465 | ; First comes Y (row) and then X (column) |
||
1466 | mov eax, [con_esc_attrs] |
||
1467 | dec eax |
||
1468 | jns @f |
||
1469 | inc eax |
||
3686 | hidnplayr | 1470 | @@: |
9105 | hidnplayr | 1471 | cmp eax, [con.scr_height] |
1472 | jae .no_y |
||
1473 | mov [con.cur_y], eax |
||
1474 | .no_y: |
||
1475 | cmp [con_esc_attr_n], 2 |
||
1476 | jb .no_x |
||
1477 | mov eax, [con_esc_attrs+4] |
||
1478 | dec eax |
||
1479 | jns @f |
||
1480 | inc eax |
||
1481 | @@: |
||
853 | diamond | 1482 | cmp eax, [con.scr_width] |
9105 | hidnplayr | 1483 | jae .no_x |
853 | diamond | 1484 | mov [con.cur_x], eax |
9105 | hidnplayr | 1485 | .no_x: |
853 | diamond | 1486 | .j_get_data: |
1487 | jmp con.get_data_ptr |
||
1488 | .cursor_up: |
||
9105 | hidnplayr | 1489 | mov eax, [con_esc_attrs] |
1490 | test eax, eax |
||
1491 | jnz @f |
||
1492 | inc eax ; default = 1 |
||
853 | diamond | 1493 | @@: |
9105 | hidnplayr | 1494 | sub [con.cur_y], eax |
1495 | jns .j_get_data |
||
1496 | mov [con.cur_y], 0 |
||
853 | diamond | 1497 | jmp .j_get_data |
1498 | .cursor_down: |
||
9105 | hidnplayr | 1499 | mov eax, [con_esc_attrs] |
1500 | test eax, eax |
||
1501 | jnz @f |
||
1502 | inc eax ; default = 1 |
||
1503 | @@: |
||
1504 | add eax, [con.cur_y] |
||
853 | diamond | 1505 | cmp eax, [con.scr_height] |
9105 | hidnplayr | 1506 | ja @f |
1507 | mov [con.cur_y], eax |
||
1508 | jmp .j_get_data |
||
1509 | @@: |
||
853 | diamond | 1510 | mov eax, [con.scr_height] |
1511 | mov [con.cur_y], eax |
||
1512 | jmp .j_get_data |
||
1513 | .cursor_right: |
||
9105 | hidnplayr | 1514 | mov eax, [con_esc_attrs] |
1515 | test eax, eax |
||
1516 | jnz @f |
||
1517 | inc eax ; default = 1 |
||
1518 | @@: |
||
1519 | add eax, [con.cur_x] |
||
853 | diamond | 1520 | cmp eax, [con.scr_width] |
9105 | hidnplayr | 1521 | ja @f |
1522 | mov [con.cur_x], eax |
||
1523 | jmp .j_get_data |
||
1524 | @@: |
||
853 | diamond | 1525 | mov eax, [con.scr_width] |
1526 | mov [con.cur_x], eax |
||
1527 | jmp .j_get_data |
||
1528 | .cursor_left: |
||
9105 | hidnplayr | 1529 | test eax, eax |
1530 | jnz @f |
||
1531 | inc eax ; default = 1 |
||
853 | diamond | 1532 | @@: |
9105 | hidnplayr | 1533 | sub [con.cur_x], eax |
1534 | jns .j_get_data |
||
1535 | mov [con.cur_x], 0 |
||
853 | diamond | 1536 | jmp .j_get_data |
836 | diamond | 1537 | .set_attr: |
1538 | push eax ecx edx |
||
1539 | xor ecx, ecx |
||
1540 | .set_one_attr: |
||
1541 | mov eax, [con_esc_attrs+ecx*4] |
||
1542 | cmp al, 0 |
||
1543 | jz .attr_normal |
||
1544 | cmp al, 1 |
||
1545 | jz .attr_bold |
||
1546 | cmp al, 5 |
||
1547 | jz .attr_bgr_bold |
||
1548 | cmp al, 7 |
||
1549 | jz .attr_reversed |
||
9105 | hidnplayr | 1550 | ; cmp al, 8 |
1551 | ; jz .attr_invisible |
||
1552 | cmp al, 27 |
||
1553 | jz .attr_normal ; FIXME: not inverse |
||
1554 | ; cmp al, 28 |
||
1555 | ; jz .attr_visible |
||
3690 | hidnplayr | 1556 | |
9105 | hidnplayr | 1557 | ; Forground colors |
836 | diamond | 1558 | xor edx, edx |
9105 | hidnplayr | 1559 | cmp al, 30 ; Black |
836 | diamond | 1560 | jz .attr_color |
1561 | mov dl, 4 |
||
9105 | hidnplayr | 1562 | cmp al, 31 ; Red |
836 | diamond | 1563 | jz .attr_color |
1564 | mov dl, 2 |
||
9105 | hidnplayr | 1565 | cmp al, 32 ; Green |
836 | diamond | 1566 | jz .attr_color |
1567 | mov dl, 6 |
||
9105 | hidnplayr | 1568 | cmp al, 33 ; Yellow |
836 | diamond | 1569 | jz .attr_color |
1570 | mov dl, 1 |
||
9105 | hidnplayr | 1571 | cmp al, 34 ; Blue |
836 | diamond | 1572 | jz .attr_color |
1573 | mov dl, 5 |
||
9105 | hidnplayr | 1574 | cmp al, 35 ; Purple |
836 | diamond | 1575 | jz .attr_color |
1576 | mov dl, 3 |
||
9105 | hidnplayr | 1577 | cmp al, 36 ; Cyan |
836 | diamond | 1578 | jz .attr_color |
1579 | mov dl, 7 |
||
9105 | hidnplayr | 1580 | cmp al, 37 ; White |
836 | diamond | 1581 | jz .attr_color |
9105 | hidnplayr | 1582 | mov dl, 7 |
1583 | cmp al, 39 ; Default - White |
||
1584 | jz .attr_color |
||
3690 | hidnplayr | 1585 | |
9105 | hidnplayr | 1586 | ; Background colors |
836 | diamond | 1587 | xor edx, edx |
9105 | hidnplayr | 1588 | cmp al, 40 ; Black |
836 | diamond | 1589 | jz .attr_bgr_color |
1590 | mov dl, 0x40 |
||
9105 | hidnplayr | 1591 | cmp al, 41 ; Red |
836 | diamond | 1592 | jz .attr_bgr_color |
1593 | mov dl, 0x20 |
||
9105 | hidnplayr | 1594 | cmp al, 42 ; Green |
836 | diamond | 1595 | jz .attr_bgr_color |
1596 | mov dl, 0x60 |
||
9105 | hidnplayr | 1597 | cmp al, 43 ; Yellow |
836 | diamond | 1598 | jz .attr_bgr_color |
1599 | mov dl, 0x10 |
||
9105 | hidnplayr | 1600 | cmp al, 44 ; Blue |
836 | diamond | 1601 | jz .attr_bgr_color |
1602 | mov dl, 0x50 |
||
9105 | hidnplayr | 1603 | cmp al, 45 ; Magenta |
836 | diamond | 1604 | jz .attr_bgr_color |
1605 | mov dl, 0x30 |
||
9105 | hidnplayr | 1606 | cmp al, 46 ; Cyan |
836 | diamond | 1607 | jz .attr_bgr_color |
1608 | mov dl, 0x70 |
||
9105 | hidnplayr | 1609 | cmp al, 47 ; White |
3690 | hidnplayr | 1610 | jz .attr_bgr_color |
9105 | hidnplayr | 1611 | mov dl, 0 |
1612 | cmp al, 49 ; Default - Black |
||
1613 | jz .attr_bgr_color |
||
3690 | hidnplayr | 1614 | |
9105 | hidnplayr | 1615 | ; 16-color support, bright colors follow |
1616 | ; Foreground colors |
||
3690 | hidnplayr | 1617 | mov dl, 0x08 |
9105 | hidnplayr | 1618 | cmp al, 90 ; Black |
3690 | hidnplayr | 1619 | jz .attr_color |
1620 | mov dl, 4 + 8 |
||
9105 | hidnplayr | 1621 | cmp al, 91 ; Red |
3690 | hidnplayr | 1622 | jz .attr_color |
1623 | mov dl, 2 + 8 |
||
9105 | hidnplayr | 1624 | cmp al, 92 ; Green |
3690 | hidnplayr | 1625 | jz .attr_color |
1626 | mov dl, 6 + 8 |
||
9105 | hidnplayr | 1627 | cmp al, 93 ; Yellow |
3690 | hidnplayr | 1628 | jz .attr_color |
1629 | mov dl, 1 + 8 |
||
9105 | hidnplayr | 1630 | cmp al, 94 ; Blue |
3690 | hidnplayr | 1631 | jz .attr_color |
1632 | mov dl, 5 + 8 |
||
9105 | hidnplayr | 1633 | cmp al, 95 ; Magenta |
3690 | hidnplayr | 1634 | jz .attr_color |
1635 | mov dl, 3 + 8 |
||
9105 | hidnplayr | 1636 | cmp al, 96 ; Cyan |
3690 | hidnplayr | 1637 | jz .attr_color |
1638 | mov dl, 7 + 8 |
||
9105 | hidnplayr | 1639 | cmp al, 97 ; White |
3690 | hidnplayr | 1640 | jz .attr_color |
1641 | |||
9105 | hidnplayr | 1642 | ; Background colors |
3690 | hidnplayr | 1643 | mov dl, 0x80 |
9105 | hidnplayr | 1644 | cmp al, 100 ; Black |
3690 | hidnplayr | 1645 | jz .attr_bgr_color |
1646 | mov dl, 0x80 + 0x40 |
||
9105 | hidnplayr | 1647 | cmp al, 101 ; Red |
3690 | hidnplayr | 1648 | jz .attr_bgr_color |
1649 | mov dl, 0x80 + 0x20 |
||
9105 | hidnplayr | 1650 | cmp al, 102 ; Green |
3690 | hidnplayr | 1651 | jz .attr_bgr_color |
1652 | mov dl, 0x80 + 0x60 |
||
9105 | hidnplayr | 1653 | cmp al, 103 ; Yellow |
3690 | hidnplayr | 1654 | jz .attr_bgr_color |
1655 | mov dl, 0x80 + 0x10 |
||
9105 | hidnplayr | 1656 | cmp al, 104 ; Blue |
3690 | hidnplayr | 1657 | jz .attr_bgr_color |
1658 | mov dl, 0x80 + 0x50 |
||
9105 | hidnplayr | 1659 | cmp al, 105 ; Magenta |
3690 | hidnplayr | 1660 | jz .attr_bgr_color |
1661 | mov dl, 0x80 + 0x30 |
||
9105 | hidnplayr | 1662 | cmp al, 106 ; Cyan |
3690 | hidnplayr | 1663 | jz .attr_bgr_color |
1664 | mov dl, 0x80 + 0x70 |
||
9105 | hidnplayr | 1665 | cmp al, 107 ; White |
836 | diamond | 1666 | jnz .attr_continue |
3690 | hidnplayr | 1667 | |
836 | diamond | 1668 | .attr_bgr_color: |
1669 | mov eax, [con_flags] |
||
3690 | hidnplayr | 1670 | and al, 0x0F |
9105 | hidnplayr | 1671 | or al, byte [con_flags_attr] |
836 | diamond | 1672 | or al, dl |
1673 | mov [con_flags], eax |
||
1674 | jmp .attr_continue |
||
1675 | .attr_color: |
||
1676 | mov eax, [con_flags] |
||
3690 | hidnplayr | 1677 | and al, 0xF0 |
9105 | hidnplayr | 1678 | or al, byte [con_flags_attr] |
836 | diamond | 1679 | or al, dl |
1680 | mov [con_flags], eax |
||
1681 | jmp .attr_continue |
||
1682 | .attr_normal: |
||
9105 | hidnplayr | 1683 | mov byte [con_flags_attr], 0 |
1684 | mov byte [con_flags], 0x07 |
||
836 | diamond | 1685 | jmp .attr_continue |
1686 | .attr_reversed: |
||
1687 | mov byte [con_flags], 0x70 |
||
1688 | jmp .attr_continue |
||
1689 | .attr_bold: |
||
9105 | hidnplayr | 1690 | or byte [con_flags_attr], 0x08 |
836 | diamond | 1691 | jmp .attr_continue |
1692 | .attr_bgr_bold: |
||
9105 | hidnplayr | 1693 | or byte [con_flags_attr], 0x80 |
836 | diamond | 1694 | .attr_continue: |
1695 | inc ecx |
||
1696 | cmp ecx, [con_esc_attr_n] |
||
1697 | jb .set_one_attr |
||
1698 | pop edx ecx eax |
||
1699 | ret |
||
1700 | |||
1701 | con.newline: |
||
1702 | mov eax, [con.cur_y] |
||
1703 | inc eax |
||
1704 | mov [con.cur_y], eax |
||
1705 | cmp eax, [con.scr_height] |
||
1706 | jb @f |
||
1707 | call con.scr_scroll_up |
||
1708 | @@: |
||
1709 | call con.get_data_ptr |
||
1710 | ret |
||
1711 | |||
1712 | con.scr_scroll_up: |
||
1713 | pushad |
||
1714 | mov edi, [con.data] |
||
1715 | mov esi, edi |
||
1716 | add esi, [con.scr_width] |
||
1717 | add esi, [con.scr_width] |
||
1718 | dec [con.cur_y] |
||
1719 | mov ecx, [con.scr_height] |
||
1720 | dec ecx |
||
1721 | imul ecx, [con.scr_width] |
||
1722 | shr ecx, 1 |
||
1723 | rep movsd |
||
1724 | adc ecx, ecx |
||
1725 | rep movsw |
||
1726 | mov ax, 0x0720 |
||
1727 | mov ecx, [con.scr_width] |
||
1728 | rep stosw |
||
1729 | popad |
||
1730 | ret |
||
1731 | |||
1732 | con.data2image: |
||
1733 | pushad |
||
1734 | mov edi, [con.image] |
||
1735 | mov esi, [con.data] |
||
1736 | mov eax, [con.wnd_ypos] |
||
1737 | mul [con.scr_width] |
||
1738 | add eax, [con.wnd_xpos] |
||
1739 | lea esi, [esi+eax*2] |
||
1740 | mov ecx, [con.wnd_height] |
||
1741 | .lh: |
||
1742 | push ecx |
||
1743 | mov ecx, [con.wnd_width] |
||
1744 | .lw: |
||
1745 | push ecx edi |
||
1746 | xor eax, eax |
||
1747 | mov al, [esi+1] |
||
1748 | push eax |
||
1749 | and al, 0xF |
||
1750 | mov ebx, eax ; цвет текста |
||
1751 | pop eax |
||
1752 | shr al, 4 |
||
1753 | mov ebp, eax ; цвет фона |
||
1754 | sub ebx, ebp |
||
1755 | lodsb |
||
1756 | inc esi |
||
1757 | if font_width > 8 |
||
1758 | lea edx, [eax+eax+font] |
||
1759 | else |
||
1760 | lea edx, [eax+font] |
||
1761 | end if |
||
1762 | .sh: |
||
1763 | mov ecx, [edx] |
||
1764 | repeat font_width |
||
1765 | shr ecx, 1 |
||
1766 | sbb eax, eax |
||
1767 | and eax, ebx |
||
1768 | add eax, ebp |
||
1769 | mov [edi+%-1], al |
||
1770 | end repeat |
||
1771 | mov eax, [con.wnd_width] |
||
1772 | ; imul eax, font_width |
||
1773 | ; add edi, eax |
||
1774 | if font_width = 6 |
||
1775 | lea eax, [eax*2+eax] |
||
1776 | lea edi, [edi+eax*2] |
||
1777 | else if font_width = 7 |
||
1778 | lea edi, [edi+eax*8] |
||
1779 | sub edi, eax |
||
1780 | else if font_width = 8 |
||
1781 | lea edi, [edi+eax*8] |
||
1782 | else if font_width = 9 |
||
1783 | lea edi, [edi+eax*8] |
||
1784 | add edi, eax |
||
1785 | else if font_width = 10 |
||
1786 | lea eax, [eax*4+eax] |
||
1787 | lea edi, [edi+eax*2] |
||
1788 | else |
||
1789 | Unknown font_width value! |
||
1790 | end if |
||
1791 | if font_width > 8 |
||
1792 | add edx, 256*2 |
||
1793 | cmp edx, font+256*2*font_height |
||
1794 | else |
||
1795 | add edx, 256 |
||
1796 | cmp edx, font+256*font_height |
||
1797 | end if |
||
1798 | jb .sh |
||
1799 | pop edi ecx |
||
1800 | add edi, font_width |
||
1801 | sub ecx, 1 |
||
1802 | jnz .lw |
||
1803 | mov eax, [con.wnd_width] |
||
1804 | imul eax, (font_height-1)*font_width |
||
1805 | add edi, eax |
||
1806 | pop ecx |
||
1807 | mov eax, [con.scr_width] |
||
1808 | sub eax, [con.wnd_width] |
||
1809 | lea esi, [esi+eax*2] |
||
1810 | dec ecx |
||
1811 | jnz .lh |
||
1812 | mov eax, [con.cur_y] |
||
1813 | sub eax, [con.wnd_ypos] |
||
1814 | jb .nocursor |
||
1815 | cmp eax, [con.wnd_height] |
||
1816 | jae .nocursor |
||
1817 | inc eax |
||
1818 | mul [con.wnd_width] |
||
1819 | imul eax, font_height*font_width |
||
1820 | mov edx, [con.cur_x] |
||
1821 | sub edx, [con.wnd_xpos] |
||
1822 | jb .nocursor |
||
1823 | cmp edx, [con.wnd_width] |
||
1824 | jae .nocursor |
||
1825 | inc edx |
||
1826 | imul edx, font_width |
||
1827 | add eax, edx |
||
1828 | add eax, [con.image] |
||
1829 | mov edx, [con.wnd_width] |
||
1830 | imul edx, font_width |
||
1831 | neg edx |
||
1832 | mov ecx, [con.cursor_height] |
||
1833 | jecxz .nocursor |
||
1834 | .cursor_loop: |
||
1835 | push ecx |
||
1836 | mov ecx, font_width |
||
1837 | add eax, edx |
||
1838 | push eax |
||
1839 | @@: |
||
1840 | xor byte [eax-1], 7 |
||
1841 | dec eax |
||
1842 | loop @b |
||
1843 | pop eax |
||
1844 | pop ecx |
||
1845 | loop .cursor_loop |
||
1846 | .nocursor: |
||
1847 | popad |
||
1848 | ret |
||
1849 | |||
1850 | con_exit: |
||
9096 | hidnplayr | 1851 | |
9105 | hidnplayr | 1852 | mov ah, [con.init_cmd] |
1853 | test ah, ah |
||
1854 | je .ret |
||
5835 | pavelyakov | 1855 | |
836 | diamond | 1856 | cmp byte [esp+4], 0 |
1857 | jz .noexit |
||
9105 | hidnplayr | 1858 | mov [con.thread_op], OP_EXIT |
836 | diamond | 1859 | call con.wake |
9096 | hidnplayr | 1860 | |
836 | diamond | 1861 | ret 4 |
1862 | .noexit: |
||
1863 | push esi |
||
1864 | mov esi, [con.title] |
||
1865 | mov edx, con.finished_title |
||
1866 | mov ecx, 255 |
||
1867 | call .strcpy |
||
1868 | mov esi, con.aFinished |
||
1869 | call .strcpy |
||
1870 | mov byte [edx], 0 |
||
1871 | pop esi |
||
1872 | and [con.cursor_height], 0 |
||
1873 | push con.finished_title |
||
1874 | call con_set_title |
||
1875 | ret 4 |
||
1876 | .strcpy: |
||
1877 | jecxz .ret |
||
1878 | @@: |
||
1879 | lodsb |
||
1880 | test al, al |
||
1881 | jz .ret |
||
1882 | mov [edx], al |
||
1883 | inc edx |
||
1884 | loop @b |
||
1885 | .ret: |
||
1886 | ret |
||
1887 | |||
1888 | con_set_title: |
||
1889 | mov eax, [esp+4] |
||
1890 | mov [con.title], eax |
||
9105 | hidnplayr | 1891 | mov [con.thread_op], OP_SET_TITLE |
836 | diamond | 1892 | call con.wake |
1893 | ret 4 |
||
1894 | |||
1895 | ; int __stdcall con_kbhit(void); |
||
1896 | con_kbhit: |
||
1133 | diamond | 1897 | test byte [con_flags+1], 2 |
1898 | jnz @f |
||
836 | diamond | 1899 | mov eax, [con.input_start] |
1900 | cmp eax, [con.input_end] |
||
1133 | diamond | 1901 | @@: |
836 | diamond | 1902 | setnz al |
1903 | movzx eax, al |
||
1904 | ret |
||
1905 | |||
1906 | con.force_entered_char: |
||
1907 | cmp [con.entered_char], -1 |
||
1908 | jnz .ret |
||
9105 | hidnplayr | 1909 | mov [con.thread_op], OP_GETCH |
836 | diamond | 1910 | call con.wake |
1133 | diamond | 1911 | test byte [con_flags+1], 2 |
1912 | jnz .ret |
||
836 | diamond | 1913 | ; wait for response |
1914 | push ebx |
||
1915 | push 5 |
||
1916 | pop eax |
||
1917 | push 2 |
||
1918 | pop ebx |
||
1919 | @@: |
||
1920 | int 0x40 |
||
1921 | cmp [con.entered_char], -1 |
||
1922 | jz @b |
||
1923 | pop ebx |
||
1924 | .ret: |
||
1925 | ret |
||
1926 | |||
1927 | ; int __stdcall con_getch(void); |
||
1928 | con_getch: |
||
9105 | hidnplayr | 1929 | call con_init_check |
836 | diamond | 1930 | call con.force_entered_char |
1133 | diamond | 1931 | test byte [con_flags+1], 2 |
1932 | jnz con_getch_closed |
||
836 | diamond | 1933 | movzx eax, byte [con.entered_char] |
1934 | sar [con.entered_char], 8 |
||
1935 | mov byte [con.entered_char+1], 0xFF |
||
1936 | test al, al |
||
1937 | jz @f |
||
1938 | mov byte [con.entered_char], 0xFF |
||
1939 | @@: |
||
1940 | ret |
||
1941 | |||
1133 | diamond | 1942 | con_getch_closed: |
1145 | diamond | 1943 | xor eax, eax |
1133 | diamond | 1944 | ret |
1945 | |||
836 | diamond | 1946 | ; int __stdcall con_getch2(void); |
1947 | con_getch2: |
||
9105 | hidnplayr | 1948 | call con_init_check |
836 | diamond | 1949 | call con.force_entered_char |
1133 | diamond | 1950 | test byte [con_flags+1], 2 |
1951 | jnz con_getch_closed |
||
836 | diamond | 1952 | mov eax, 0xFFFF |
1953 | xchg ax, [con.entered_char] |
||
1954 | ret |
||
1955 | |||
9105 | hidnplayr | 1956 | ; int __stdcall con_get_input(int *bufptr, int buflen); |
1957 | con_get_input: |
||
1958 | call con_init_check |
||
1959 | ; Wait for input available |
||
1960 | call con.force_entered_char |
||
1961 | test byte [con_flags+1], 2 |
||
1962 | jnz .none |
||
1963 | |||
1964 | push ebx |
||
1965 | mov ebx, [esp+12] |
||
1966 | .check_more: |
||
1967 | ; Avoid buffer overflow |
||
1968 | cmp dword[esp+8], 16 |
||
1969 | jl .no_more |
||
1970 | ; Check element available |
||
1971 | cmp [con.entered_char], 0xFFFF |
||
1972 | je .no_more |
||
1973 | ; Get an element from the input queue |
||
1974 | mov eax, 0xFFFF |
||
1975 | xchg ax, [con.entered_char] |
||
1976 | ; Function keys F1-F4 |
||
1977 | cmp ah, 0x3B |
||
1978 | jb @f |
||
1979 | cmp ah, 0x3E |
||
1980 | jbe .f1_4 |
||
1981 | @@: |
||
1982 | ; Function keys F5-F8 |
||
1983 | cmp ah, 0x3F |
||
1984 | jb @f |
||
1985 | je .f5 |
||
1986 | cmp ah, 0x42 |
||
1987 | jbe .f6_8 |
||
1988 | @@: |
||
1989 | ; Function keys F9-F12 |
||
1990 | cmp ah, 0x43 |
||
1991 | je .f9 |
||
1992 | cmp ah, 0x44 |
||
1993 | je .f10 |
||
1994 | cmp ah, 0x57 |
||
1995 | je .f11 |
||
1996 | cmp ah, 0x58 |
||
1997 | je .f12 |
||
1998 | ; Cursor keys |
||
1999 | cmp ah, 0x47 |
||
2000 | je .home |
||
2001 | cmp ah, 0x48 |
||
2002 | je .up |
||
2003 | cmp ah, 0x49 |
||
2004 | je .pgup |
||
2005 | ; cmp ah, 0x4a |
||
2006 | ; je .minus |
||
2007 | cmp ah, 0x4b |
||
2008 | je .left |
||
2009 | cmp ah, 0x4c |
||
2010 | je .begin |
||
2011 | cmp ah, 0x4d |
||
2012 | je .right |
||
2013 | ; cmp ah, 0x4e |
||
2014 | ; je .plus |
||
2015 | cmp ah, 0x4f |
||
2016 | je .end |
||
2017 | cmp ah, 0x50 |
||
2018 | je .down |
||
2019 | cmp ah, 0x51 |
||
2020 | je .pgdown |
||
2021 | cmp ah, 0x52 |
||
2022 | je .insert |
||
2023 | cmp ah, 0x53 |
||
2024 | je .delete |
||
2025 | ; regular ASCII |
||
2026 | mov byte[ebx], al |
||
2027 | mov eax, 1 |
||
2028 | .got_input: |
||
2029 | and eax, 0xff |
||
2030 | sub [esp+8], eax |
||
2031 | add ebx, eax |
||
2032 | jmp .check_more |
||
2033 | .no_more: |
||
2034 | mov eax, ebx |
||
2035 | sub eax, [esp+12] |
||
2036 | pop ebx |
||
2037 | ret 8 |
||
2038 | |||
2039 | .none: |
||
2040 | xor eax, eax |
||
2041 | ret 8 |
||
2042 | |||
2043 | .f1_4: |
||
2044 | ; F1 = SSR P, F2 = SS3 Q .. |
||
2045 | ; SS3 = 0x8f (8bit) or 0x1b + 'O' (7-bit) |
||
2046 | mov word[ebx], 27 + ('O' shl 8) |
||
2047 | add ah, 'P' - 59 |
||
2048 | mov byte[ebx+2], ah |
||
2049 | mov al, 3 |
||
2050 | jmp .got_input |
||
2051 | .f5: |
||
2052 | ; CSI = 0x9b (8bit) or 0x1b + '[' (7-bit) |
||
2053 | mov byte[ebx], 27 |
||
2054 | mov dword[ebx+1], '[15~' |
||
2055 | mov al, 5 |
||
2056 | jmp .got_input |
||
2057 | .f6_8: |
||
2058 | mov byte[ebx], 27 |
||
2059 | xor al, al |
||
2060 | shl eax, 8 |
||
2061 | add eax, '[17~' - (0x40 shl 16) |
||
2062 | mov dword[ebx+1], eax |
||
2063 | mov al, 5 |
||
2064 | jmp .got_input |
||
2065 | .f9: |
||
2066 | mov byte[ebx], 27 |
||
2067 | mov dword[ebx+1], '[20~' |
||
2068 | mov al, 5 |
||
2069 | jmp .got_input |
||
2070 | .f10: |
||
2071 | mov byte[ebx], 27 |
||
2072 | mov dword[ebx+1], '[21~' |
||
2073 | mov al, 5 |
||
2074 | jmp .got_input |
||
2075 | .f11: |
||
2076 | mov byte[ebx], 27 |
||
2077 | mov dword[ebx+1], '[23~' |
||
2078 | mov al, 5 |
||
2079 | jmp .got_input |
||
2080 | .f12: |
||
2081 | mov byte[ebx], 27 |
||
2082 | mov dword[ebx+1], '[24~' |
||
2083 | mov al, 5 |
||
2084 | jmp .got_input |
||
2085 | .up: |
||
2086 | mov eax, 'A' shl 16 |
||
2087 | add eax, [cursor_esc] |
||
2088 | mov dword[ebx], eax |
||
2089 | mov al, 3 |
||
2090 | jmp .got_input |
||
2091 | .down: |
||
2092 | mov eax, 'B' shl 16 |
||
2093 | add eax, [cursor_esc] |
||
2094 | mov dword[ebx], eax |
||
2095 | mov al, 3 |
||
2096 | jmp .got_input |
||
2097 | .right: |
||
2098 | mov eax, 'C' shl 16 |
||
2099 | add eax, [cursor_esc] |
||
2100 | mov dword[ebx], eax |
||
2101 | mov al, 3 |
||
2102 | jmp .got_input |
||
2103 | .left: |
||
2104 | mov eax, 'D' shl 16 |
||
2105 | add eax, [cursor_esc] |
||
2106 | mov dword[ebx], eax |
||
2107 | mov al, 3 |
||
2108 | jmp .got_input |
||
2109 | .home: |
||
2110 | mov eax, 'H' shl 16 |
||
2111 | add eax, [cursor_esc] |
||
2112 | mov dword[ebx], eax |
||
2113 | mov al, 3 |
||
2114 | jmp .got_input |
||
2115 | .end: |
||
2116 | mov eax, 'F' shl 16 |
||
2117 | add eax, [cursor_esc] |
||
2118 | mov dword[ebx], eax |
||
2119 | mov al, 3 |
||
2120 | jmp .got_input |
||
2121 | .insert: |
||
2122 | mov dword[ebx], 27 + ('[2~' shl 8) |
||
2123 | mov al, 4 |
||
2124 | jmp .got_input |
||
2125 | .delete: |
||
2126 | mov dword[ebx], 27 + ('[3~' shl 8) |
||
2127 | mov al, 4 |
||
2128 | jmp .got_input |
||
2129 | .pgup: |
||
2130 | mov dword[ebx], 27 + ('[5~' shl 8) |
||
2131 | mov al, 4 |
||
2132 | jmp .got_input |
||
2133 | .pgdown: |
||
2134 | mov dword[ebx], 27 + ('[6~' shl 8) |
||
2135 | mov al, 4 |
||
2136 | jmp .got_input |
||
2137 | .begin: |
||
2138 | mov dword[ebx], 27 + ('[E' shl 8) |
||
2139 | mov al, 3 |
||
2140 | jmp .got_input |
||
2141 | |||
2142 | |||
2143 | |||
1133 | diamond | 2144 | ; char* __stdcall con_gets(char* str, int n); |
836 | diamond | 2145 | con_gets: |
852 | diamond | 2146 | pop eax |
2147 | push 0 |
||
2148 | push eax |
||
1133 | diamond | 2149 | ; char* __stdcall con_gets2(con_gets2_callback callback, char* str, int n); |
852 | diamond | 2150 | con_gets2: |
9105 | hidnplayr | 2151 | call con_init_check |
1133 | diamond | 2152 | mov eax, [esp+8] ; str |
836 | diamond | 2153 | pushad |
1133 | diamond | 2154 | mov esi, eax ; str |
852 | diamond | 2155 | mov ebx, [esp+20h+12] ; n |
836 | diamond | 2156 | sub ebx, 1 |
2157 | jle .ret |
||
2158 | mov byte [esi], 0 |
||
2159 | xor ecx, ecx ; длина уже введённой строки |
||
2160 | call con.get_data_ptr |
||
2161 | .loop: |
||
852 | diamond | 2162 | call con_getch2 |
836 | diamond | 2163 | test al, al |
2164 | jz .extended |
||
2165 | cmp al, 8 |
||
2166 | jz .backspace |
||
2167 | cmp al, 27 |
||
2168 | jz .esc |
||
2169 | cmp al, 13 |
||
2170 | jz .enter |
||
852 | diamond | 2171 | cmp al, 9 |
2172 | jz .tab |
||
836 | diamond | 2173 | inc ecx |
2174 | mov dl, al |
||
2175 | call con.write_char_ex |
||
2176 | push [con.cur_x] |
||
2177 | push [con.cur_y] |
||
2178 | push edi |
||
2179 | push esi |
||
2180 | @@: |
||
2181 | lodsb |
||
2182 | mov [esi-1], dl |
||
2183 | mov dl, al |
||
2184 | test al, al |
||
2185 | jz @f |
||
2186 | call con.write_char_ex |
||
2187 | jmp @b |
||
2188 | @@: |
||
2189 | mov [esi], dl |
||
2190 | pop esi |
||
2191 | inc esi |
||
2192 | pop edi |
||
2193 | pop [con.cur_y] |
||
2194 | pop [con.cur_x] |
||
2195 | .update_screen_and_loop: |
||
2196 | call con.update_screen |
||
2197 | cmp ecx, ebx |
||
2198 | jb .loop |
||
852 | diamond | 2199 | .ret_us: |
836 | diamond | 2200 | mov edx, [con.cur_x] |
2201 | @@: |
||
2202 | lodsb |
||
2203 | test al, al |
||
2204 | jz @f |
||
2205 | inc edx |
||
2206 | cmp edx, [con.scr_width] |
||
2207 | jb @b |
||
2208 | xor edx, edx |
||
2209 | call con.newline |
||
2210 | jmp @b |
||
2211 | @@: |
||
2212 | mov [con.cur_x], edx |
||
2213 | call con.get_data_ptr |
||
2214 | call con.update_screen |
||
2215 | jmp .ret |
||
2216 | .esc: |
||
2217 | mov edx, [con.cur_x] |
||
2218 | @@: |
||
2219 | lodsb |
||
2220 | test al, al |
||
2221 | jz @f |
||
2222 | inc edx |
||
2223 | cmp edx, [con.scr_width] |
||
2224 | jb @b |
||
2225 | xor edx, edx |
||
2226 | call con.newline |
||
2227 | jmp @b |
||
2228 | @@: |
||
2229 | mov [con.cur_x], edx |
||
2230 | call con.get_data_ptr |
||
2231 | dec esi |
||
2232 | xor ecx, ecx |
||
2233 | @@: |
||
2234 | mov byte [esi], 0 |
||
852 | diamond | 2235 | cmp esi, [esp+20h+8] |
836 | diamond | 2236 | jbe .update_screen_and_loop |
2237 | mov al, 8 |
||
2238 | call con.write_special_char |
||
2239 | mov al, ' ' |
||
2240 | call con.write_char |
||
2241 | mov al, 8 |
||
2242 | call con.write_special_char |
||
2243 | dec esi |
||
2244 | jmp @b |
||
2245 | .delete: |
||
2246 | cmp byte [esi], 0 |
||
2247 | jz .loop |
||
2248 | lodsb |
||
2249 | call con.write_char_ex |
||
2250 | .backspace: |
||
852 | diamond | 2251 | cmp esi, [esp+20h+8] |
836 | diamond | 2252 | jbe .loop |
2253 | push esi |
||
2254 | mov edx, [con.cur_x] |
||
2255 | @@: |
||
2256 | lodsb |
||
2257 | test al, al |
||
2258 | jz @f |
||
2259 | inc edx |
||
2260 | cmp edx, [con.scr_width] |
||
2261 | jb @b |
||
2262 | xor edx, edx |
||
2263 | call con.newline |
||
2264 | jmp @b |
||
2265 | @@: |
||
2266 | mov [con.cur_x], edx |
||
2267 | call con.get_data_ptr |
||
2268 | dec esi |
||
2269 | mov al, 8 |
||
2270 | call con.write_special_char |
||
2271 | mov al, ' ' |
||
2272 | call con.write_char |
||
2273 | mov al, 8 |
||
2274 | call con.write_special_char |
||
2275 | mov dl, 0 |
||
2276 | @@: |
||
2277 | cmp esi, [esp] |
||
2278 | jbe @f |
||
2279 | mov al, 8 |
||
2280 | call con.write_special_char |
||
2281 | dec esi |
||
2282 | xchg dl, [esi] |
||
2283 | mov al, dl |
||
2284 | call con.write_char |
||
2285 | mov al, 8 |
||
2286 | call con.write_special_char |
||
2287 | jmp @b |
||
2288 | @@: |
||
2289 | pop esi |
||
2290 | dec esi |
||
2291 | mov [esi], dl |
||
2292 | dec ecx |
||
2293 | jmp .update_screen_and_loop |
||
2294 | .enter: |
||
2295 | mov edx, [con.cur_x] |
||
2296 | @@: |
||
2297 | lodsb |
||
2298 | test al, al |
||
2299 | jz @f |
||
2300 | inc edx |
||
2301 | cmp edx, [con.scr_width] |
||
2302 | jb @b |
||
2303 | xor edx, edx |
||
2304 | call con.newline |
||
2305 | jmp @b |
||
2306 | @@: |
||
2307 | mov [con.cur_x], edx |
||
2308 | call con.get_data_ptr |
||
2309 | mov al, 10 |
||
2310 | mov [esi-1], al |
||
2311 | mov byte [esi], 0 |
||
2312 | call con.write_special_char |
||
2313 | call con.update_screen |
||
2314 | jmp .ret |
||
852 | diamond | 2315 | .tab: |
2316 | mov al, 0 |
||
2317 | mov ah, 0xF |
||
836 | diamond | 2318 | .extended: |
1145 | diamond | 2319 | test ah, ah |
2320 | jz .closed |
||
852 | diamond | 2321 | xchg al, ah |
836 | diamond | 2322 | cmp al, 0x4B |
2323 | jz .left |
||
2324 | cmp al, 0x4D |
||
2325 | jz .right |
||
2326 | cmp al, 0x47 |
||
2327 | jz .home |
||
2328 | cmp al, 0x4F |
||
2329 | jz .end |
||
2330 | cmp al, 0x53 |
||
2331 | jz .delete |
||
852 | diamond | 2332 | ; give control to callback function |
2333 | cmp dword [esp+20h+4], 0 |
||
2334 | jz .loop |
||
2335 | ; remember length of text before and length of text after |
||
2336 | ; and advance cursor to the end of line |
||
2337 | push ecx |
||
2338 | push eax |
||
2339 | lea edx, [esi+1] |
||
2340 | @@: |
||
2341 | lodsb |
||
2342 | test al, al |
||
2343 | jz @f |
||
2344 | call con.write_char_ex |
||
2345 | jmp @b |
||
2346 | @@: |
||
2347 | sub esi, edx |
||
2348 | pop eax |
||
2349 | push esi |
||
2350 | dec edx |
||
2351 | sub edx, [esp+28h+8] |
||
2352 | push edx |
||
2353 | push esp ; ppos |
||
2354 | mov ecx, [esp+30h+4] |
||
2355 | lea edx, [esp+30h+12] |
||
2356 | push edx ; pn |
||
2357 | lea edx, [esp+34h+8] |
||
2358 | push edx ; pstr |
||
2359 | push eax ; keycode |
||
2360 | call ecx |
||
2361 | call con.get_data_ptr |
||
2362 | dec eax |
||
2363 | js .callback_nochange |
||
2364 | jz .callback_del |
||
2365 | dec eax |
||
2366 | jz .callback_output |
||
2367 | ; callback returned 2 - exit |
||
2368 | add esp, 12 |
||
2369 | jmp .ret |
||
2370 | .callback_nochange: |
||
2371 | ; callback returned 0 - string was not changed, only restore cursor position |
||
2372 | pop esi |
||
2373 | pop ecx |
||
2374 | test ecx, ecx |
||
2375 | jz .cncs |
||
2376 | @@: |
||
2377 | mov al, 8 |
||
2378 | call con.write_special_char |
||
2379 | loop @b |
||
2380 | .cncs: |
||
2381 | pop ecx |
||
2382 | add esi, [esp+20h+8] |
||
2383 | jmp .callback_done |
||
2384 | .callback_del: |
||
2385 | ; callback returned 1 - string was changed, delete old string and output new |
||
2386 | mov ecx, [esp+8] |
||
2387 | test ecx, ecx |
||
2388 | jz .cds |
||
2389 | @@: |
||
2390 | mov al, 8 |
||
2391 | call con.write_special_char |
||
2392 | mov al, ' ' |
||
2393 | call con.write_char_ex |
||
2394 | mov al, 8 |
||
2395 | call con.write_special_char |
||
2396 | loop @b |
||
2397 | .cds: |
||
2398 | .callback_output: |
||
2399 | ; callback returned 2 - string was changed, output new string |
||
2400 | pop edx |
||
2401 | pop esi |
||
2402 | pop ecx |
||
2403 | mov esi, [esp+20h+8] |
||
2404 | xor ecx, ecx |
||
2405 | @@: |
||
2406 | lodsb |
||
2407 | test al, al |
||
2408 | jz @f |
||
2409 | call con.write_char_ex |
||
2410 | inc ecx |
||
2411 | jmp @b |
||
2412 | @@: |
||
2413 | dec esi |
||
2414 | push ecx |
||
2415 | sub ecx, edx |
||
2416 | jz .cos |
||
2417 | @@: |
||
2418 | mov al, 8 |
||
2419 | call con.write_special_char |
||
2420 | dec esi |
||
2421 | loop @b |
||
2422 | .cos: |
||
2423 | pop ecx |
||
2424 | .callback_done: |
||
2425 | call con.update_screen |
||
2426 | mov ebx, [esp+20h+12] |
||
2427 | dec ebx |
||
2428 | cmp ecx, ebx |
||
2429 | jae .ret_us |
||
836 | diamond | 2430 | jmp .loop |
2431 | .left: |
||
852 | diamond | 2432 | cmp esi, [esp+20h+8] |
836 | diamond | 2433 | jbe .loop |
2434 | dec esi |
||
2435 | mov al, 8 |
||
2436 | call con.write_special_char |
||
2437 | jmp .update_screen_and_loop |
||
2438 | .right: |
||
2439 | cmp byte [esi], 0 |
||
2440 | jz .loop |
||
2441 | lodsb |
||
2442 | call con.write_char_ex |
||
2443 | jmp .update_screen_and_loop |
||
2444 | .home: |
||
852 | diamond | 2445 | cmp esi, [esp+20h+8] |
836 | diamond | 2446 | jz .update_screen_and_loop |
2447 | dec esi |
||
2448 | mov al, 8 |
||
2449 | call con.write_special_char |
||
2450 | jmp .home |
||
2451 | .end: |
||
2452 | lodsb |
||
2453 | test al, al |
||
2454 | jz @f |
||
2455 | call con.write_char_ex |
||
2456 | jmp .end |
||
2457 | @@: |
||
2458 | dec esi |
||
2459 | jmp .update_screen_and_loop |
||
1133 | diamond | 2460 | .closed: |
2461 | and dword [esp+1Ch], 0 |
||
836 | diamond | 2462 | .ret: |
2463 | popad |
||
852 | diamond | 2464 | ret 12 |
836 | diamond | 2465 | |
853 | diamond | 2466 | ; void __stdcall con_cls(); |
2467 | con_cls: |
||
9105 | hidnplayr | 2468 | mov ah, [con.init_cmd] |
2469 | test ah, ah |
||
2470 | je cmd_init_no |
||
9096 | hidnplayr | 2471 | |
853 | diamond | 2472 | push edi |
9105 | hidnplayr | 2473 | call con.write_special_char.erase_all |
853 | diamond | 2474 | pop edi |
2475 | call con.update_screen |
||
9096 | hidnplayr | 2476 | |
9105 | hidnplayr | 2477 | ret |
9096 | hidnplayr | 2478 | |
9105 | hidnplayr | 2479 | cmd_init_no: |
9096 | hidnplayr | 2480 | |
9105 | hidnplayr | 2481 | push con.title_init_console |
2482 | push -1 |
||
2483 | push -1 |
||
2484 | push -1 |
||
2485 | push -1 |
||
9096 | hidnplayr | 2486 | |
9105 | hidnplayr | 2487 | call con_init |
9096 | hidnplayr | 2488 | |
853 | diamond | 2489 | ret |
2490 | |||
2491 | ; void __stdcall con_get_cursor_pos(int* px, int* py); |
||
2492 | con_get_cursor_pos: |
||
2493 | push eax ecx |
||
2494 | mov eax, [esp+12] |
||
2495 | mov ecx, [con.cur_x] |
||
2496 | mov [eax], ecx |
||
2497 | mov eax, [esp+16] |
||
2498 | mov ecx, [con.cur_y] |
||
2499 | mov [eax], ecx |
||
2500 | pop ecx eax |
||
2501 | ret 8 |
||
2502 | |||
2503 | ; void __stdcall con_set_cursor_pos(int px, int py); |
||
2504 | con_set_cursor_pos: |
||
2505 | push eax |
||
2506 | mov eax, [esp+8] |
||
2507 | cmp eax, [con.scr_width] |
||
2508 | jae @f |
||
2509 | mov [con.cur_x], eax |
||
2510 | @@: |
||
2511 | mov eax, [esp+12] |
||
2512 | cmp eax, [con.scr_height] |
||
2513 | jae @f |
||
2514 | mov [con.cur_y], eax |
||
2515 | @@: |
||
2516 | pop eax |
||
2517 | call con.update_screen |
||
2518 | ret 8 |
||
2519 | |||
836 | diamond | 2520 | con.update_screen: |
2521 | push eax |
||
2522 | mov eax, [con.cur_y] |
||
2523 | sub eax, [con.wnd_ypos] |
||
2524 | jb .up |
||
2525 | cmp eax, [con.wnd_height] |
||
2526 | jb .done |
||
2527 | mov eax, [con.cur_y] |
||
2528 | sub eax, [con.wnd_height] |
||
2529 | inc eax |
||
2530 | jmp .set |
||
2531 | .up: |
||
2532 | mov eax, [con.cur_y] |
||
2533 | .set: |
||
2534 | mov [con.wnd_ypos], eax |
||
2535 | .done: |
||
2536 | pop eax |
||
9105 | hidnplayr | 2537 | mov [con.thread_op], OP_REDRAW |
836 | diamond | 2538 | |
2539 | con.wake: |
||
2540 | pushad |
||
2541 | mov al, [con.thread_op] |
||
2542 | cmp al, byte [con.ipc_buf+0x10] |
||
2543 | jz .ret |
||
2544 | @@: |
||
2545 | push 60 |
||
2546 | pop eax |
||
2547 | push 2 |
||
2548 | pop ebx |
||
2549 | mov ecx, [con.console_tid] |
||
1133 | diamond | 2550 | jecxz .ret |
836 | diamond | 2551 | mov edx, con.thread_op |
2552 | push 1 |
||
2553 | pop esi |
||
2554 | int 0x40 |
||
2555 | test eax, eax |
||
2556 | jz @f |
||
2557 | push 5 |
||
2558 | pop eax |
||
2559 | mov bl, 1 |
||
2560 | int 0x40 |
||
2561 | jmp @b |
||
2562 | @@: |
||
2563 | .ret: |
||
2564 | popad |
||
2565 | ret |
||
2566 | |||
2567 | ; Поток окна консоли. Обрабатывает ввод и вывод. |
||
2568 | con.thread: |
||
2569 | ; Поток реагирует на IPC, которое используется только для того, чтобы его можно было "разбудить" |
||
2570 | push 40 |
||
2571 | pop eax |
||
2572 | push 0x67 |
||
2573 | pop ebx |
||
2574 | int 0x40 |
||
2575 | mov al, 60 |
||
2576 | mov bl, 1 |
||
2577 | mov ecx, con.ipc_buf |
||
2578 | push 0x11 |
||
2579 | pop edx |
||
2580 | int 0x40 |
||
2581 | mov al, 66 |
||
2582 | mov bl, 1 |
||
2583 | mov ecx, ebx |
||
2584 | int 0x40 |
||
2585 | con.redraw: |
||
2586 | call con.draw_window |
||
2587 | con.msg_loop: |
||
2588 | cmp dword [con.bUpPressed], 0 |
||
2589 | jnz .wait_timeout |
||
2590 | push 10 |
||
2591 | pop eax |
||
2592 | jmp @f |
||
2593 | .wait_timeout: |
||
2594 | push 23 |
||
2595 | pop eax |
||
2596 | push 5 |
||
2597 | pop ebx |
||
2598 | @@: |
||
2599 | int 0x40 |
||
2600 | dec eax |
||
2601 | jz con.redraw |
||
2602 | dec eax |
||
2603 | jz con.key |
||
2604 | dec eax |
||
2605 | jz con.button |
||
2606 | cmp al, 4 |
||
2607 | jz con.ipc |
||
2608 | jmp con.mouse |
||
2609 | con.button: |
||
2610 | ; we have only one button, close |
||
8328 | superturbo | 2611 | mov eax, 18 |
2612 | mov ebx, 18 |
||
2613 | mov ecx,[process_info_buffer+30] |
||
2614 | dec ecx |
||
2615 | int 0x40 ; kill parent process |
||
2616 | |||
836 | diamond | 2617 | con.thread_exit: |
1133 | diamond | 2618 | or byte [con_flags+1], 2 |
2619 | and [con.console_tid], 0 |
||
1134 | diamond | 2620 | and [con.entered_char], 0 |
836 | diamond | 2621 | or eax, -1 |
2622 | int 0x40 |
||
2623 | con.key: |
||
2624 | mov al, 2 |
||
2625 | int 0x40 |
||
5618 | hidnplayr | 2626 | and eax, 0xffff ; supress scancodes |
836 | diamond | 2627 | ; ah = scancode |
2628 | cmp ah, 0xE0 |
||
2629 | jnz @f |
||
2630 | mov [con.bWasE0], 1 |
||
2631 | jmp con.msg_loop |
||
2632 | @@: |
||
2633 | shr eax, 8 |
||
2634 | xchg ah, [con.bWasE0] |
||
2635 | test al, al |
||
2636 | jle con.msg_loop |
||
2637 | cmp al, 0x1D |
||
2638 | jz con.msg_loop |
||
2639 | cmp al, 0x2A |
||
2640 | jz con.msg_loop |
||
2641 | cmp al, 0x36 |
||
2642 | jz con.msg_loop |
||
2643 | cmp al, 0x38 |
||
2644 | jz con.msg_loop |
||
2645 | cmp al, 0x3A |
||
2646 | jz con.msg_loop |
||
2647 | cmp al, 0x45 |
||
2648 | jz con.msg_loop |
||
2649 | cmp al, 0x46 |
||
2650 | jz con.msg_loop |
||
2651 | mov edx, eax |
||
4402 | hidnplayr | 2652 | cmp dl, 0x4e |
2653 | je .numpad |
||
2654 | cmp dl, 0x4a |
||
2655 | je .numpad |
||
836 | diamond | 2656 | push 66 |
2657 | pop eax |
||
2658 | push 3 |
||
2659 | pop ebx |
||
2660 | int 0x40 ; eax = control key state |
||
2661 | test dh, dh |
||
2662 | jnz .extended |
||
4306 | hidnplayr | 2663 | test al, 0x80 ; numlock |
2664 | jnz .numlock |
||
836 | diamond | 2665 | bt [scan_has_ascii], edx |
2666 | jnc .extended |
||
4306 | hidnplayr | 2667 | test al, 0x30 ; alt |
836 | diamond | 2668 | jnz .extended |
4306 | hidnplayr | 2669 | test al, 0x80 ; numlock |
2670 | jz .no_numlock |
||
2671 | .numlock: |
||
2672 | cmp dl, 71 |
||
2673 | jb .no_numlock |
||
2674 | cmp dl, 83 |
||
2675 | ja .no_numlock |
||
4402 | hidnplayr | 2676 | .numpad: |
4306 | hidnplayr | 2677 | mov dh, [con.extended_numlock+edx-71] |
2678 | xchg dl, dh |
||
2679 | jmp .gotcode |
||
2680 | .no_numlock: |
||
836 | diamond | 2681 | ; key has ASCII code |
2682 | push eax edx |
||
2683 | push 2 |
||
2684 | pop ecx |
||
2685 | test al, 3 |
||
2686 | jnz @f |
||
2687 | dec ecx |
||
2688 | @@: |
||
2689 | push 26 |
||
2690 | pop eax |
||
2691 | mov bl, 2 |
||
2692 | mov edx, con.kbd_layout |
||
2693 | int 0x40 |
||
2694 | pop edx eax |
||
2695 | mov dh, [con.kbd_layout+edx] |
||
2696 | test al, 0xC |
||
2697 | jz @f |
||
2698 | sub dh, 0x60 |
||
2699 | jmp @f |
||
2700 | .extended: |
||
2701 | mov dh, 0 ; no ASCII code |
||
2702 | @@: |
||
2703 | ; dh contains ASCII-code; now convert scancode to extended key code |
||
2704 | mov ecx, con.extended_alt |
||
2705 | test al, 0x30 |
||
2706 | jnz .xlat |
||
4384 | hidnplayr | 2707 | |
836 | diamond | 2708 | mov ecx, con.extended_shift |
2709 | test al, 3 |
||
2710 | jnz .xlat |
||
4384 | hidnplayr | 2711 | |
836 | diamond | 2712 | mov ecx, con.extended_ctrl |
2713 | test al, 0xC |
||
2714 | jnz .xlat |
||
4384 | hidnplayr | 2715 | |
2716 | cmp dl, 28 |
||
2717 | jne @f |
||
2718 | shl dx, 8 |
||
2719 | mov dl, 13 |
||
2720 | jmp .gotcode |
||
2721 | @@: |
||
2722 | cmp dl, 53 |
||
2723 | jne @f |
||
2724 | shl dx, 8 |
||
2725 | mov dl, '/' |
||
2726 | jmp .gotcode |
||
2727 | @@: |
||
2728 | cmp dl, 55 |
||
2729 | jne @f |
||
2730 | shl dx, 8 |
||
2731 | mov dl, '*' |
||
2732 | jmp .gotcode |
||
2733 | @@: |
||
836 | diamond | 2734 | xchg dl, dh |
2735 | cmp dh, 0x57 |
||
2736 | jz @f |
||
2737 | cmp dh, 0x58 |
||
2738 | jnz .gotcode |
||
2739 | @@: |
||
2740 | add dh, 0x85-0x57 |
||
2741 | jmp .gotcode |
||
2742 | .xlat: |
||
2743 | movzx eax, dl |
||
2744 | mov dl, dh |
||
2745 | mov dh, [eax+ecx] |
||
2746 | .gotcode: |
||
2747 | test dh, dh |
||
2748 | jz con.msg_loop |
||
2749 | cmp dh, 0x94 |
||
2750 | jnz @f |
||
2751 | mov dl, 0 |
||
2752 | @@: |
||
2753 | ; dx contains full keycode |
||
2754 | cmp [con.bGetchRequested], 0 |
||
2755 | jz @f |
||
2756 | mov [con.entered_char], dx |
||
2757 | jmp con.msg_loop |
||
2758 | @@: |
||
2759 | mov eax, [con.input_end] |
||
2760 | mov ecx, eax |
||
2761 | add eax, 2 |
||
2762 | cmp eax, con.input_buffer_end |
||
2763 | jnz @f |
||
2764 | mov eax, con.input_buffer |
||
2765 | @@: |
||
2766 | cmp eax, [con.input_start] |
||
2767 | jnz @f |
||
2768 | ; buffer overflow, make beep and continue |
||
2769 | push 55 |
||
2770 | pop eax |
||
2771 | mov ebx, eax |
||
2772 | mov esi, con.beep |
||
2773 | int 0x40 |
||
2774 | jmp con.msg_loop |
||
2775 | @@: |
||
2776 | mov [ecx], dx |
||
2777 | mov [con.input_end], eax |
||
2778 | jmp con.msg_loop |
||
2779 | con.ipc: |
||
2780 | movzx eax, byte [con.ipc_buf+0x10] |
||
2781 | mov byte [con.ipc_buf+4], 8 |
||
2782 | mov byte [con.ipc_buf+0x10], 0 |
||
2783 | dec eax |
||
2784 | jz con.thread_exit |
||
2785 | dec eax |
||
2786 | jz con.set_title |
||
2787 | dec eax |
||
2788 | jz con.redraw_image |
||
2789 | dec eax |
||
2790 | jz con.getch |
||
9105 | hidnplayr | 2791 | dec eax |
2792 | jz con.resize |
||
836 | diamond | 2793 | jmp con.msg_loop |
9105 | hidnplayr | 2794 | con.resize: |
2795 | push 48 |
||
2796 | pop eax |
||
2797 | push 4 |
||
2798 | pop ebx |
||
2799 | int 0x40 |
||
2800 | |||
2801 | mov edx, [con.def_wnd_x-2] |
||
2802 | mov edx, [con.wnd_width] |
||
2803 | imul edx, font_width |
||
2804 | add edx, 5+5-1 |
||
2805 | |||
2806 | mov esi, [con.def_wnd_y-2] |
||
2807 | mov esi, [con.wnd_height] |
||
2808 | imul esi, font_height |
||
2809 | lea esi, [eax + esi + 5-1] |
||
2810 | ; place for scrollbar |
||
2811 | mov eax, [con.wnd_height] |
||
2812 | cmp eax, [con.scr_height] |
||
2813 | jae @f |
||
2814 | add edx, con.vscroll_width |
||
2815 | @@: |
||
2816 | push 67 |
||
2817 | pop eax |
||
2818 | mov ebx, -1 |
||
2819 | mov ecx, ebx |
||
2820 | int 0x40 |
||
2821 | call con.draw_window |
||
2822 | jmp con.msg_loop |
||
836 | diamond | 2823 | con.set_title: |
2824 | push 71 |
||
2825 | pop eax |
||
2826 | push 1 |
||
2827 | pop ebx |
||
2828 | mov ecx, [con.title] |
||
2829 | int 0x40 |
||
2830 | jmp con.msg_loop |
||
2831 | con.redraw_image: |
||
2832 | call con.data2image |
||
2833 | call con.draw_image |
||
2834 | jmp con.msg_loop |
||
2835 | con.getch: |
||
2836 | mov eax, [con.input_start] |
||
2837 | cmp eax, [con.input_end] |
||
2838 | jz .noinput |
||
2839 | mov ecx, [eax] |
||
2840 | mov [con.entered_char], cx |
||
2841 | inc eax |
||
2842 | inc eax |
||
2843 | cmp eax, con.input_buffer_end |
||
2844 | jnz @f |
||
2845 | mov eax, con.input_buffer |
||
2846 | @@: |
||
2847 | mov [con.input_start], eax |
||
2848 | jmp con.msg_loop |
||
2849 | .noinput: |
||
2850 | mov [con.bGetchRequested], 1 |
||
2851 | jmp con.msg_loop |
||
2852 | con.mouse: |
||
5618 | hidnplayr | 2853 | push 37 |
2854 | pop eax |
||
2855 | push 7 |
||
2856 | pop ebx |
||
2857 | int 0x40 |
||
2858 | test eax, eax |
||
2859 | jz .no_scrollmouse |
||
2860 | cwde |
||
2861 | add eax, [con.wnd_ypos] |
||
2862 | jg @f |
||
836 | diamond | 2863 | xor eax, eax |
5618 | hidnplayr | 2864 | @@: |
2865 | mov ebx, [con.scr_height] |
||
2866 | sub ebx, [con.wnd_height] |
||
2867 | cmp eax, ebx |
||
2868 | jb @f |
||
2869 | mov eax, ebx |
||
2870 | @@: |
||
2871 | mov [con.wnd_ypos], eax |
||
2872 | jmp con.redraw_image |
||
2873 | .no_scrollmouse: |
||
2874 | xor eax, eax |
||
836 | diamond | 2875 | xchg eax, dword [con.bUpPressed] |
2876 | mov dword [con.bUpPressed_saved], eax |
||
2877 | push 37 |
||
2878 | pop eax |
||
2879 | push 2 |
||
2880 | pop ebx |
||
2881 | int 0x40 |
||
2882 | test al, 1 |
||
2883 | jnz @f |
||
2884 | cmp [con.vscroll_pt], -1 |
||
2885 | jz .redraw_if_needed |
||
2886 | or [con.vscroll_pt], -1 |
||
2887 | .redraw_if_needed: |
||
2888 | cmp dword [con.bUpPressed_saved], 0 |
||
2889 | jnz con.redraw_image |
||
2890 | jmp con.msg_loop |
||
2891 | @@: |
||
2892 | mov al, 37 |
||
2893 | dec ebx |
||
2894 | int 0x40 |
||
2895 | movsx ebx, ax |
||
2896 | sar eax, 16 |
||
2897 | cmp [con.vscroll_pt], -1 |
||
2898 | jnz .vscrolling |
||
2899 | test ebx, ebx |
||
2900 | js .redraw_if_needed |
||
2901 | sub ax, [con.data_width] |
||
2902 | jb .redraw_if_needed |
||
2903 | cmp eax, con.vscroll_width |
||
2904 | jae .redraw_if_needed |
||
2905 | cmp ebx, con.vscroll_btn_height |
||
2906 | jb .up |
||
2907 | sub bx, [con.data_height] |
||
2908 | jae .redraw_if_needed |
||
2909 | cmp bx, -con.vscroll_btn_height |
||
2910 | jge .down |
||
2911 | add bx, [con.data_height] |
||
2912 | sub bx, word [con.vscrollbar_pos] |
||
2913 | jl .vscroll_up |
||
2914 | cmp bx, word [con.vscrollbar_size] |
||
2915 | jl .vscroll |
||
2916 | .vscroll_down: |
||
2917 | cmp [con.bScrollingDown_saved], 0 |
||
2918 | jz .vscroll_down_first |
||
2919 | cmp [con.bScrollingDown_saved], 1 |
||
2920 | jz .vscroll_down_wasfirst |
||
2921 | mov [con.bScrollingDown], 2 |
||
2922 | .vscroll_down_do: |
||
2923 | mov eax, [con.wnd_ypos] |
||
2924 | add eax, [con.wnd_height] |
||
2925 | dec eax |
||
2926 | mov ebx, [con.scr_height] |
||
2927 | sub ebx, [con.wnd_height] |
||
2928 | cmp eax, ebx |
||
2929 | jb @f |
||
2930 | mov eax, ebx |
||
2931 | @@: |
||
2932 | mov [con.wnd_ypos], eax |
||
2933 | jmp con.redraw_image |
||
2934 | .vscroll_down_first: |
||
2935 | push 26 |
||
2936 | pop eax |
||
2937 | push 9 |
||
2938 | pop ebx |
||
2939 | int 0x40 |
||
2940 | mov [con.scroll_down_first_time], eax |
||
2941 | mov [con.bScrollingDown], 1 |
||
2942 | jmp .vscroll_down_do |
||
2943 | .vscroll_down_wasfirst: |
||
2944 | push 26 |
||
2945 | pop eax |
||
2946 | push 9 |
||
2947 | pop ebx |
||
2948 | int 0x40 |
||
2949 | sub eax, [con.scroll_down_first_time] |
||
2950 | cmp eax, 25 |
||
2951 | jb @f |
||
2952 | mov [con.bScrollingDown], 2 |
||
2953 | jmp .vscroll_down_do |
||
2954 | @@: |
||
2955 | mov [con.bScrollingDown], 1 |
||
2956 | jmp con.msg_loop |
||
2957 | .vscroll_up: |
||
2958 | cmp [con.bScrollingUp_saved], 0 |
||
2959 | jz .vscroll_up_first |
||
2960 | cmp [con.bScrollingUp_saved], 1 |
||
2961 | jz .vscroll_up_wasfirst |
||
2962 | mov [con.bScrollingUp], 2 |
||
2963 | .vscroll_up_do: |
||
2964 | mov eax, [con.wnd_ypos] |
||
2965 | inc eax |
||
2966 | sub eax, [con.wnd_height] |
||
2967 | jns @f |
||
2968 | xor eax, eax |
||
2969 | @@: |
||
2970 | mov [con.wnd_ypos], eax |
||
2971 | jmp con.redraw_image |
||
2972 | .vscroll_up_first: |
||
2973 | push 26 |
||
2974 | pop eax |
||
2975 | push 9 |
||
2976 | pop ebx |
||
2977 | int 0x40 |
||
2978 | mov [con.scroll_up_first_time], eax |
||
2979 | mov [con.bScrollingUp], 1 |
||
2980 | jmp .vscroll_up_do |
||
2981 | .vscroll_up_wasfirst: |
||
2982 | push 26 |
||
2983 | pop eax |
||
2984 | push 9 |
||
2985 | pop ebx |
||
2986 | int 0x40 |
||
2987 | sub eax, [con.scroll_up_first_time] |
||
2988 | cmp eax, 25 |
||
2989 | jb @f |
||
2990 | mov [con.bScrollingUp], 2 |
||
2991 | jmp .vscroll_up_do |
||
2992 | @@: |
||
2993 | mov [con.bScrollingUp], 1 |
||
2994 | jmp con.msg_loop |
||
2995 | .up: |
||
2996 | cmp [con.bUpPressed_saved], 0 |
||
2997 | jz .up_first |
||
2998 | cmp [con.bUpPressed_saved], 1 |
||
2999 | jz .up_wasfirst |
||
3000 | mov [con.bUpPressed], 2 |
||
3001 | .up_do: |
||
3002 | mov eax, [con.wnd_ypos] |
||
3003 | dec eax |
||
3004 | js @f |
||
3005 | mov [con.wnd_ypos], eax |
||
3006 | @@: |
||
3007 | jmp con.redraw_image |
||
3008 | .up_first: |
||
3009 | push 26 |
||
3010 | pop eax |
||
3011 | push 9 |
||
3012 | pop ebx |
||
3013 | int 0x40 |
||
3014 | mov [con.up_first_time], eax |
||
3015 | mov [con.bUpPressed], 1 |
||
3016 | jmp .up_do |
||
3017 | .up_wasfirst: |
||
3018 | push 26 |
||
3019 | pop eax |
||
3020 | push 9 |
||
3021 | pop ebx |
||
3022 | int 0x40 |
||
3023 | sub eax, [con.up_first_time] |
||
3024 | cmp eax, 25 |
||
3025 | jb @f |
||
3026 | mov [con.bUpPressed], 2 |
||
3027 | jmp .up_do |
||
3028 | @@: |
||
3029 | mov [con.bUpPressed], 1 |
||
3030 | jmp con.msg_loop |
||
3031 | .down: |
||
3032 | cmp [con.bDownPressed_saved], 0 |
||
3033 | jz .down_first |
||
3034 | cmp [con.bDownPressed_saved], 1 |
||
3035 | jz .down_wasfirst |
||
3036 | mov [con.bDownPressed], 2 |
||
3037 | .down_do: |
||
3038 | mov eax, [con.scr_height] |
||
3039 | sub eax, [con.wnd_height] |
||
3040 | jbe con.redraw_image |
||
3041 | cmp [con.wnd_ypos], eax |
||
3042 | jae con.redraw_image |
||
3043 | inc [con.wnd_ypos] |
||
3044 | jmp con.redraw_image |
||
3045 | .down_first: |
||
3046 | push 26 |
||
3047 | pop eax |
||
3048 | push 9 |
||
3049 | pop ebx |
||
3050 | int 0x40 |
||
3051 | mov [con.down_first_time], eax |
||
3052 | mov [con.bDownPressed], 1 |
||
3053 | jmp .down_do |
||
3054 | .down_wasfirst: |
||
3055 | push 26 |
||
3056 | pop eax |
||
3057 | push 9 |
||
3058 | pop ebx |
||
3059 | int 0x40 |
||
3060 | sub eax, [con.down_first_time] |
||
3061 | cmp eax, 25 |
||
3062 | jb @f |
||
3063 | mov [con.bDownPressed], 2 |
||
3064 | jmp .down_do |
||
3065 | @@: |
||
3066 | mov [con.bDownPressed], 1 |
||
3067 | jmp con.msg_loop |
||
3068 | .vscroll: |
||
3069 | mov [con.vscroll_pt], ebx |
||
3070 | call con.draw_image |
||
3071 | jmp con.msg_loop |
||
3072 | .vscrolling: |
||
3073 | sub ebx, [con.vscroll_pt] |
||
3074 | sub ebx, con.vscroll_btn_height |
||
3075 | jge @f |
||
3076 | xor ebx, ebx |
||
3077 | @@: |
||
3078 | movzx eax, [con.data_height] |
||
3079 | sub eax, 2*con.vscroll_btn_height |
||
3080 | sub eax, [con.vscrollbar_size] |
||
3081 | cmp ebx, eax |
||
3082 | jb @f |
||
3083 | lea ebx, [eax-1] |
||
3084 | @@: |
||
3085 | xchg eax, ebx |
||
3086 | mov edx, [con.scr_height] |
||
3087 | sub edx, [con.wnd_height] |
||
3088 | inc edx |
||
3089 | mul edx |
||
3090 | div ebx |
||
3091 | cmp [con.wnd_ypos], eax |
||
3092 | jz con.msg_loop |
||
3093 | mov [con.wnd_ypos], eax |
||
3094 | jmp con.redraw_image |
||
3095 | |||
3096 | con.draw_window: |
||
3097 | push 12 |
||
3098 | pop eax |
||
3099 | xor ebx, ebx |
||
3100 | inc ebx |
||
3101 | int 0x40 |
||
9105 | hidnplayr | 3102 | |
836 | diamond | 3103 | mov al, 48 |
3104 | mov bl, 4 |
||
3105 | int 0x40 |
||
3106 | mov ebx, [con.def_wnd_x-2] |
||
3107 | mov bx, word [con.wnd_width] |
||
3108 | imul bx, font_width |
||
3109 | add bx, 5+5-1 |
||
3110 | mov ecx, [con.def_wnd_y-2] |
||
3111 | mov cx, word [con.wnd_height] |
||
3112 | imul cx, font_height |
||
3113 | lea ecx, [ecx+eax+5-1] |
||
2530 | leency | 3114 | mov edx, 0x74000000 |
836 | diamond | 3115 | mov edi, [con.title] |
3116 | ; place for scrollbar |
||
3117 | mov eax, [con.wnd_height] |
||
3118 | cmp eax, [con.scr_height] |
||
3119 | jae @f |
||
3120 | add ebx, con.vscroll_width |
||
3121 | @@: |
||
3122 | xor eax, eax |
||
3123 | int 0x40 |
||
9105 | hidnplayr | 3124 | |
3125 | mov eax, 9 |
||
3126 | mov ebx, process_info_buffer |
||
3127 | mov ecx, -1 |
||
3034 | leency | 3128 | int 0x40 |
9105 | hidnplayr | 3129 | test [process_info_buffer.wnd_state], 110b ; window is rolled up or minimized to panel |
3034 | leency | 3130 | jnz .exit |
9105 | hidnplayr | 3131 | |
836 | diamond | 3132 | call con.draw_image |
3034 | leency | 3133 | |
3134 | .exit: |
||
836 | diamond | 3135 | push 12 |
3136 | pop eax |
||
3137 | push 2 |
||
3138 | pop ebx |
||
3139 | int 0x40 |
||
3686 | hidnplayr | 3140 | |
836 | diamond | 3141 | ret |
3142 | |||
3143 | con.draw_image: |
||
3144 | xor edx, edx |
||
3145 | mov ecx, [con.wnd_width] |
||
3146 | imul ecx, font_width |
||
3147 | mov [con.data_width], cx |
||
3148 | shl ecx, 16 |
||
3149 | mov cx, word [con.wnd_height] |
||
3150 | imul cx, font_height |
||
3151 | mov [con.data_height], cx |
||
3152 | mov ebx, [con.image] |
||
3153 | push 65 |
||
3154 | pop eax |
||
3155 | xor ebp, ebp |
||
3156 | mov edi, con.colors |
||
3157 | push 8 |
||
3158 | pop esi |
||
3159 | int 0x40 |
||
3160 | mov al, 7 |
||
3161 | mov edx, [con.wnd_height] |
||
3162 | cmp edx, [con.scr_height] |
||
3163 | jae .skip_vscroll |
||
3164 | push ecx |
||
3165 | mov edx, ecx |
||
3166 | xor dx, dx |
||
3167 | mov ebx, con.vscroll_btn3 |
||
3168 | cmp [con.bUpPressed], 0 |
||
3169 | jnz @f |
||
3170 | mov ebx, con.vscroll_btn1 |
||
3171 | @@: |
||
3172 | mov ecx, con.vscroll_width*65536 + con.vscroll_btn_height |
||
3173 | int 0x40 |
||
3174 | pop edx |
||
3175 | sub dx, con.vscroll_btn_height |
||
3176 | mov ebx, con.vscroll_btn4 |
||
3177 | cmp [con.bDownPressed], 0 |
||
3178 | jnz @f |
||
3179 | mov ebx, con.vscroll_btn2 |
||
3180 | @@: |
||
3181 | int 0x40 |
||
3182 | push edx |
||
3183 | ; Вычисляем высоту бегунка |
||
3184 | mov ax, dx |
||
3185 | sub eax, con.vscroll_btn_height |
||
3186 | mov ecx, eax |
||
3187 | mul [con.wnd_height] |
||
3188 | div [con.scr_height] |
||
3189 | cmp eax, 5 |
||
3190 | jae @f |
||
3191 | mov al, 5 |
||
3192 | @@: |
||
3193 | ; eax = высота бегунка. Вычисляем положение бегунка |
||
3194 | mov [con.vscrollbar_size], eax |
||
3195 | xchg eax, ecx |
||
3196 | sub eax, ecx |
||
3197 | mul [con.wnd_ypos] |
||
3198 | mov ebx, [con.scr_height] |
||
3199 | sub ebx, [con.wnd_height] |
||
3200 | div ebx |
||
3201 | pop edx |
||
3202 | push edx |
||
3203 | ; ecx = высота бегунка, eax = положение |
||
3204 | add eax, con.vscroll_btn_height |
||
3205 | mov [con.vscrollbar_pos], eax |
||
3206 | mov ebx, con.vscroll_bgr2 |
||
3207 | cmp [con.bScrollingUp], 0 |
||
3208 | jnz @f |
||
3209 | mov ebx, con.vscroll_bgr1 |
||
3210 | @@: |
||
3211 | mov ecx, con.vscroll_width*65536 + con.vscroll_bgr_height |
||
3212 | push eax |
||
3213 | push 7 |
||
3214 | pop eax |
||
3215 | mov dx, con.vscroll_btn_height |
||
3216 | call .vpattern |
||
3217 | mov dx, word [con.vscrollbar_pos] |
||
3218 | add dx, word [con.vscrollbar_size] |
||
3219 | mov cx, con.vscroll_bgr_height |
||
3220 | mov ebx, con.vscroll_bgr2 |
||
3221 | cmp [con.bScrollingDown], 0 |
||
3222 | jnz @f |
||
3223 | mov ebx, con.vscroll_bgr1 |
||
3224 | @@: |
||
3225 | call .vpattern |
||
3226 | mov ecx, [con.vscrollbar_pos] |
||
3227 | mov dx, cx |
||
3228 | add ecx, [con.vscrollbar_size] |
||
3229 | sub ecx, con.vscroll_bar_height3 |
||
3230 | push ecx |
||
3231 | mov ebx, con.vscroll_bar1 |
||
3232 | mov ecx, con.vscroll_width*65536 + con.vscroll_bar_height1 |
||
3233 | int 0x40 |
||
3234 | add dx, cx |
||
3235 | mov cx, con.vscroll_bar_height2 |
||
3236 | mov ebx, con.vscroll_bar2 |
||
3237 | call .vpattern |
||
3238 | mov ebx, con.vscroll_bar3 |
||
3239 | mov cx, con.vscroll_bar_height3 |
||
3240 | int 0x40 |
||
3241 | .skip_vscroll: |
||
3242 | ret |
||
3243 | |||
3244 | .vpattern: |
||
3245 | push edx |
||
3246 | add dx, cx |
||
3247 | cmp dx, [esp+8] |
||
3248 | pop edx |
||
3249 | jbe @f |
||
3250 | mov cx, [esp+4] |
||
3251 | sub cx, dx |
||
3252 | jz .ret |
||
3253 | @@: |
||
3254 | int 0x40 |
||
3255 | add dx, cx |
||
3256 | cmp dx, [esp+4] |
||
3257 | jb .vpattern |
||
3258 | .ret: |
||
3259 | ret 4 |
||
3260 | |||
3261 | align 4 |
||
3262 | con.colors dd 0x000000, 0x000080, 0x008000, 0x008080 |
||
3263 | dd 0x800000, 0x800080, 0x808000, 0xC0C0C0 |
||
3264 | dd 0x808080, 0x0000FF, 0x00FF00, 0x00FFFF |
||
3265 | dd 0xFF0000, 0xFF00FF, 0xFFFF00, 0xFFFFFF |
||
3266 | |||
3267 | scan_has_ascii: |
||
3268 | dd 11011111111111111111111111111110b |
||
3269 | dd 00000010001111111111101111111111b |
||
3270 | dd 00000000000000000000000000000000b |
||
3271 | dd 0 |
||
3272 | |||
3273 | con.extended_alt: |
||
3274 | db 00h,01h,78h,79h,7Ah,7Bh,7Ch,7Dh,7Eh,7Fh,80h,81h,82h,83h,0Eh,0A5h |
||
3275 | db 10h,11h,12h,13h,14h,15h,16h,17h,18h,19h,1Ah,1Bh,1Ch,00h,1Eh,1Fh |
||
3276 | db 20h,21h,22h,23h,24h,25h,26h,27h,28h,29h,00h,2Bh,2Ch,2Dh,2Eh,2Fh |
||
3277 | db 30h,31h,32h,33h,34h,35h,00h,37h,00h,39h,00h,68h,69h,6Ah,6Bh,6Ch |
||
3278 | db 6Dh,6Eh,6Fh,70h,71h,00h,00h,97h,98h,99h,4Ah,9Bh,9Ch,9Dh,4Eh,9Fh |
||
3279 | db 0A0h,0A1h,0A2h,0A3h,00h,00h,00h,8Bh,8Ch,00h,00h,00h,00h,00h,00h,00h |
||
3280 | times 20h db 0 |
||
3281 | con.extended_ctrl: |
||
3282 | times 0Fh db %-1 |
||
3283 | db 0x94 |
||
3284 | times 2Bh db %-1 |
||
3285 | db 5Eh,5Fh,60h,61h,62h,63h,64h,65h,66h,67h,00h,00h |
||
3286 | db 77h,8Dh,84h,8Eh,73h,8Fh,74h,90h,75h,91h,76h,92h,93h,00h,00h,00h,89h,8Ah |
||
3287 | times 0x80-0x59 db 0 |
||
3288 | con.extended_shift: |
||
3289 | times 3Bh db %-1 |
||
3290 | db 54h,55h,56h,57h,58h,59h,5Ah,5Bh,5Ch,5Dh,00h,00h |
||
3291 | db 47h,48h,49h,4Ah,4Bh,4Ch,4Dh,4Eh,4Fh,50h,51h,52h,53h,00h,00h,00h,87h,88h |
||
3292 | times 0x80-0x59 db 0 |
||
4306 | hidnplayr | 3293 | con.extended_numlock: |
3294 | db '7', '8', '9', '-' |
||
3295 | db '4', '5', '6', '+' |
||
3296 | db '1', '2', '3' |
||
3297 | db '0', '.' |
||
836 | diamond | 3298 | |
9105 | hidnplayr | 3299 | |
3300 | cursor_esc dd 27 + ('[' shl 8) |
||
3301 | |||
836 | diamond | 3302 | ; В текущей реализации значения по умолчанию таковы. |
3303 | ; В будущем они, возможно, будут считываться как параметры из ini-файла console.ini. |
||
3304 | con.def_wnd_width dd 80 |
||
3305 | con.def_wnd_height dd 25 |
||
3306 | con.def_scr_width dd 80 |
||
3307 | con.def_scr_height dd 300 |
||
3308 | con.def_wnd_x dd 200 |
||
3309 | con.def_wnd_y dd 50 |
||
3310 | |||
5835 | pavelyakov | 3311 | con.init_cmd db 0 |
3312 | con.title_init_console db "Console",0 |
||
836 | diamond | 3313 | con.vscroll_pt dd -1 |
3314 | |||
3315 | align 16 |
||
3316 | EXPORTS: |
||
3317 | dd szStart, START |
||
9105 | hidnplayr | 3318 | dd szVersion, 0x00020009 |
836 | diamond | 3319 | dd szcon_init, con_init |
3320 | dd szcon_write_asciiz, con_write_asciiz |
||
3686 | hidnplayr | 3321 | dd szcon_write_string, con_write_length |
836 | diamond | 3322 | dd szcon_printf, con_printf |
3323 | dd szcon_exit, con_exit |
||
3324 | dd szcon_get_flags, con_get_flags |
||
3325 | dd szcon_set_flags, con_set_flags |
||
3326 | dd szcon_kbhit, con_kbhit |
||
3327 | dd szcon_getch, con_getch |
||
3328 | dd szcon_getch2, con_getch2 |
||
3329 | dd szcon_gets, con_gets |
||
852 | diamond | 3330 | dd szcon_gets2, con_gets2 |
836 | diamond | 3331 | dd szcon_get_font_height, con_get_font_height |
3332 | dd szcon_get_cursor_height,con_get_cursor_height |
||
3333 | dd szcon_set_cursor_height,con_set_cursor_height |
||
853 | diamond | 3334 | dd szcon_cls, con_cls |
3335 | dd szcon_get_cursor_pos, con_get_cursor_pos |
||
3336 | dd szcon_set_cursor_pos, con_set_cursor_pos |
||
6603 | 0CodErr | 3337 | dd szcon_set_title, con_set_title |
9105 | hidnplayr | 3338 | dd szcon_get_input, con_get_input |
836 | diamond | 3339 | dd 0 |
3340 | |||
9105 | hidnplayr | 3341 | con_flags dd 0x07 ; black on white |
3342 | con_flags_attr dd 0 ; Modifiers (for example, high intensity colors) |
||
836 | diamond | 3343 | con.cursor_height dd (15*font_height+50)/100 |
3344 | con.input_start dd con.input_buffer |
||
3345 | con.input_end dd con.input_buffer |
||
3346 | |||
3347 | con_esc_attr_n dd 0 |
||
3348 | con_esc_attrs dd 0,0,0,0 |
||
3349 | con_esc db 0 |
||
3350 | con_sci db 0 |
||
9105 | hidnplayr | 3351 | con_osc_str rb 256 |
3352 | con_osc_strlen dd 0 |
||
836 | diamond | 3353 | |
3354 | con.entered_char dw -1 |
||
3355 | con.bGetchRequested db 0 |
||
3356 | con.bWasE0 db 0 |
||
3357 | |||
3358 | szStart db 'START',0 |
||
3359 | |||
3360 | szcon_init db 'con_init',0 |
||
3361 | szcon_write_asciiz db 'con_write_asciiz',0 |
||
3686 | hidnplayr | 3362 | szcon_write_string db 'con_write_string',0 |
836 | diamond | 3363 | szcon_printf db 'con_printf',0 |
3364 | szcon_exit db 'con_exit',0 |
||
3365 | szVersion db 'version',0 |
||
3366 | szcon_get_flags db 'con_get_flags',0 |
||
3367 | szcon_set_flags db 'con_set_flags',0 |
||
3368 | szcon_kbhit db 'con_kbhit',0 |
||
3369 | szcon_getch db 'con_getch',0 |
||
3370 | szcon_getch2 db 'con_getch2',0 |
||
3371 | szcon_gets db 'con_gets',0 |
||
852 | diamond | 3372 | szcon_gets2 db 'con_gets2',0 |
836 | diamond | 3373 | szcon_get_font_height db 'con_get_font_height',0 |
3374 | szcon_get_cursor_height db 'con_get_cursor_height',0 |
||
3375 | szcon_set_cursor_height db 'con_set_cursor_height',0 |
||
853 | diamond | 3376 | szcon_cls db 'con_cls',0 |
3377 | szcon_get_cursor_pos db 'con_get_cursor_pos',0 |
||
3378 | szcon_set_cursor_pos db 'con_set_cursor_pos',0 |
||
6603 | 0CodErr | 3379 | szcon_set_title db 'con_set_title',0 |
9105 | hidnplayr | 3380 | szcon_get_input db 'con_get_input',0 |
836 | diamond | 3381 | |
3382 | con.thread_err db 'Cannot create console thread!',13,10,0 |
||
3383 | con.nomem_err db 'Not enough memory!',13,10,0 |
||
3384 | con.aFinished db ' [Finished]',0 |
||
3385 | con.aNull db '(null)',0 |
||
9096 | hidnplayr | 3386 | con.beep db 0x90, 0x3C, 0x00 |
9105 | hidnplayr | 3387 | con.bell db 0x85, 0x25, 0x85, 0x40, 0x00 |
836 | diamond | 3388 | con.ipc_buf dd 0,8,0,0 |
3389 | db 0 |
||
3390 | |||
3391 | section '.data' data readable writable align 16 |
||
3392 | |||
9105 | hidnplayr | 3393 | process_info_buffer process_info |
3394 | |||
836 | diamond | 3395 | con.finished_title rb 256 |
3396 | |||
9105 | hidnplayr | 3397 | con.cur_x dd ? ; Active cursor column (0 based) |
3398 | con.cur_y dd ? ; Active cursor row (0 based) |
||
3399 | con.main_cur_x dd ? ; Saved cursor position for main buffer |
||
3400 | con.main_cur_y dd ? ; Saved cursor position for main buffer |
||
3401 | con.wnd_xpos dd ? ; Active window position in active buffer |
||
3402 | con.wnd_ypos dd ? ; Active window position in active buffer |
||
3403 | con.main_wnd_xpos dd ? ; Saved window position for main buffer |
||
3404 | con.main_wnd_ypos dd ? ; Saved window position for main buffer |
||
3405 | con.scroll_top dd ? ; VT100 scroll region |
||
3406 | con.scroll_bot dd ? ; VT100 scroll region |
||
836 | diamond | 3407 | |
9105 | hidnplayr | 3408 | con.wnd_width dd ? ; window width (= alt buffer width) |
3409 | con.wnd_height dd ? ; window height (= alt buffer height) |
||
3410 | con.main_scr_width dd ? ; main buffer width |
||
3411 | con.main_scr_height dd ? ; main buffer height |
||
3412 | con.scr_width dd ? ; active buffer width |
||
3413 | con.scr_height dd ? ; active buffer height |
||
3414 | con.title dd ? |
||
3415 | con.data dd ? ; active buffer ptr |
||
3416 | con.mainbuffer dd ? |
||
3417 | con.altbuffer dd ? |
||
3418 | con.image dd ? |
||
3419 | con.console_tid dd ? |
||
3420 | con.data_width dw ? ; width in pixels |
||
3421 | con.data_height dw ? ; height in pixels |
||
3422 | con.vscrollbar_size dd ? |
||
3423 | con.vscrollbar_pos dd ? |
||
3424 | con.up_first_time dd ? |
||
3425 | con.down_first_time dd ? |
||
3426 | con.scroll_up_first_time dd ? |
||
3427 | con.scroll_down_first_time dd ? |
||
3428 | con.bUpPressed_saved db ? |
||
3429 | con.bDownPressed_saved db ? |
||
3430 | con.bScrollingUp_saved db ? |
||
3431 | con.bScrollingDown_saved db ? |
||
836 | diamond | 3432 | |
9105 | hidnplayr | 3433 | con.input_buffer rw 128 |
836 | diamond | 3434 | con.input_buffer_end = $ |
3435 | |||
9105 | hidnplayr | 3436 | con.kbd_layout rb 128 |
836 | diamond | 3437 | |
9105 | hidnplayr | 3438 | con.thread_op db ? |
3439 | con.bUpPressed db ? |
||
3440 | con.bDownPressed db ? |
||
3441 | con.bScrollingUp db ? |
||
3442 | con.bScrollingDown db ? |
||
836 | diamond | 3443 | |
3444 | con.stack rb 1024 |
||
3445 | con.stack_top = $ |