Rev 852 | Rev 1133 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 852 | Rev 853 | ||
---|---|---|---|
Line 807... | Line 807... | ||
807 | pop eax |
807 | pop eax |
808 | ret |
808 | ret |
809 | .not_digit: |
809 | .not_digit: |
810 | mov [con_esc], 0 |
810 | mov [con_esc], 0 |
811 | mov [con_sci], 0 ; in any case, leave Esc mode |
811 | mov [con_sci], 0 ; in any case, leave Esc mode |
- | 812 | cmp al, 'J' |
|
- | 813 | jz .cls |
|
- | 814 | cmp al, 'H' |
|
- | 815 | jz .setcursor |
|
- | 816 | cmp al, 'f' |
|
- | 817 | jz .setcursor |
|
812 | cmp al, 'm' |
818 | cmp al, 'm' |
813 | jz .set_attr |
819 | jz .set_attr |
- | 820 | cmp al, 'A' |
|
- | 821 | jz .cursor_up |
|
- | 822 | cmp al, 'B' |
|
- | 823 | jz .cursor_down |
|
- | 824 | cmp al, 'C' |
|
- | 825 | jz .cursor_right |
|
- | 826 | cmp al, 'D' |
|
- | 827 | jz .cursor_left |
|
814 | ret ; simply skip unknown sequences |
828 | ret ; simply skip unknown sequences |
- | 829 | .cls: |
|
- | 830 | push ecx |
|
- | 831 | and [con.cur_x], 0 |
|
- | 832 | and [con.cur_y], 0 |
|
- | 833 | mov edi, [con.data] |
|
- | 834 | push edi |
|
- | 835 | mov ecx, [con.scr_width] |
|
- | 836 | imul ecx, [con.scr_height] |
|
- | 837 | mov ax, 0720h |
|
- | 838 | rep stosw |
|
- | 839 | pop edi ecx |
|
- | 840 | .nosetcursor: |
|
- | 841 | ret |
|
- | 842 | .setcursor: |
|
- | 843 | cmp [con_esc_attr_n], 2 |
|
- | 844 | jnz .nosetcursor |
|
- | 845 | mov eax, [con_esc_attrs] |
|
- | 846 | cmp eax, [con.scr_width] |
|
- | 847 | jae @f |
|
- | 848 | mov [con.cur_x], eax |
|
- | 849 | @@: |
|
- | 850 | mov eax, [con_esc_attrs+4] |
|
- | 851 | cmp eax, [con.scr_height+4] |
|
- | 852 | jae @f |
|
- | 853 | mov [con.cur_y], eax |
|
- | 854 | .j_get_data: |
|
- | 855 | jmp con.get_data_ptr |
|
- | 856 | .cursor_up: |
|
- | 857 | cmp [con_esc_attr_n], 1 |
|
- | 858 | jnz .nosetcursor |
|
- | 859 | mov eax, [con.cur_y] |
|
- | 860 | sub eax, [con_esc_attrs] |
|
- | 861 | jnc @f |
|
- | 862 | xor eax, eax |
|
- | 863 | @@: |
|
- | 864 | mov [con.cur_y], eax |
|
- | 865 | jmp .j_get_data |
|
- | 866 | .cursor_down: |
|
- | 867 | cmp [con_esc_attr_n], 1 |
|
- | 868 | jnz .nosetcursor |
|
- | 869 | mov eax, [con.cur_y] |
|
- | 870 | add eax, [con_esc_attrs] |
|
- | 871 | cmp eax, [con.scr_height] |
|
- | 872 | jb @f |
|
- | 873 | mov eax, [con.scr_height] |
|
- | 874 | dec eax |
|
- | 875 | @@: |
|
- | 876 | mov [con.cur_y], eax |
|
- | 877 | jmp .j_get_data |
|
- | 878 | .cursor_right: |
|
- | 879 | cmp [con_esc_attr_n], 1 |
|
- | 880 | jnz .nosetcursor |
|
- | 881 | mov eax, [con.cur_x] |
|
- | 882 | add eax, [con_esc_attrs] |
|
- | 883 | cmp eax, [con.scr_width] |
|
- | 884 | jb @f |
|
- | 885 | mov eax, [con.scr_width] |
|
- | 886 | dec eax |
|
- | 887 | @@: |
|
- | 888 | mov [con.cur_x], eax |
|
- | 889 | jmp .j_get_data |
|
- | 890 | .cursor_left: |
|
- | 891 | cmp [con_esc_attr_n], 1 |
|
- | 892 | jnz .nosetcursor |
|
- | 893 | mov eax, [con.cur_x] |
|
- | 894 | sub eax, [con_esc_attrs] |
|
- | 895 | jnc @f |
|
- | 896 | xor eax, eax |
|
- | 897 | @@: |
|
- | 898 | mov [con.cur_x], eax |
|
- | 899 | jmp .j_get_data |
|
815 | .set_attr: |
900 | .set_attr: |
816 | push eax ecx edx |
901 | push eax ecx edx |
817 | xor ecx, ecx |
902 | xor ecx, ecx |
818 | .set_one_attr: |
903 | .set_one_attr: |
819 | mov eax, [con_esc_attrs+ecx*4] |
904 | mov eax, [con_esc_attrs+ecx*4] |
Line 1451... | Line 1536... | ||
1451 | jmp .update_screen_and_loop |
1536 | jmp .update_screen_and_loop |
1452 | .ret: |
1537 | .ret: |
1453 | popad |
1538 | popad |
1454 | ret 12 |
1539 | ret 12 |
Line -... | Line 1540... | ||
- | 1540 | ||
- | 1541 | ; void __stdcall con_cls(); |
|
- | 1542 | con_cls: |
|
- | 1543 | push edi |
|
- | 1544 | call con.write_special_char.cls |
|
- | 1545 | pop edi |
|
- | 1546 | call con.update_screen |
|
- | 1547 | ret |
|
- | 1548 | ||
- | 1549 | ; void __stdcall con_get_cursor_pos(int* px, int* py); |
|
- | 1550 | con_get_cursor_pos: |
|
- | 1551 | push eax ecx |
|
- | 1552 | mov eax, [esp+12] |
|
- | 1553 | mov ecx, [con.cur_x] |
|
- | 1554 | mov [eax], ecx |
|
- | 1555 | mov eax, [esp+16] |
|
- | 1556 | mov ecx, [con.cur_y] |
|
- | 1557 | mov [eax], ecx |
|
- | 1558 | pop ecx eax |
|
- | 1559 | ret 8 |
|
- | 1560 | ||
- | 1561 | ; void __stdcall con_set_cursor_pos(int px, int py); |
|
- | 1562 | con_set_cursor_pos: |
|
- | 1563 | push eax |
|
- | 1564 | mov eax, [esp+8] |
|
- | 1565 | cmp eax, [con.scr_width] |
|
- | 1566 | jae @f |
|
- | 1567 | mov [con.cur_x], eax |
|
- | 1568 | @@: |
|
- | 1569 | mov eax, [esp+12] |
|
- | 1570 | cmp eax, [con.scr_height] |
|
- | 1571 | jae @f |
|
- | 1572 | mov [con.cur_y], eax |
|
- | 1573 | @@: |
|
- | 1574 | pop eax |
|
- | 1575 | call con.update_screen |
|
- | 1576 | ret 8 |
|
1455 | 1577 | ||
1456 | con.update_screen: |
1578 | con.update_screen: |
1457 | push eax |
1579 | push eax |
1458 | mov eax, [con.cur_y] |
1580 | mov eax, [con.cur_y] |
1459 | sub eax, [con.wnd_ypos] |
1581 | sub eax, [con.wnd_ypos] |
Line 2125... | Line 2247... | ||
2125 | con.vscroll_pt dd -1 |
2247 | con.vscroll_pt dd -1 |
Line 2126... | Line 2248... | ||
2126 | 2248 | ||
2127 | align 16 |
2249 | align 16 |
2128 | EXPORTS: |
2250 | EXPORTS: |
2129 | dd szStart, START |
2251 | dd szStart, START |
2130 | dd szVersion, 0x00020004 |
2252 | dd szVersion, 0x00020005 |
2131 | dd szcon_init, con_init |
2253 | dd szcon_init, con_init |
2132 | dd szcon_write_asciiz, con_write_asciiz |
2254 | dd szcon_write_asciiz, con_write_asciiz |
2133 | dd szcon_printf, con_printf |
2255 | dd szcon_printf, con_printf |
2134 | dd szcon_exit, con_exit |
2256 | dd szcon_exit, con_exit |
Line 2140... | Line 2262... | ||
2140 | dd szcon_gets, con_gets |
2262 | dd szcon_gets, con_gets |
2141 | dd szcon_gets2, con_gets2 |
2263 | dd szcon_gets2, con_gets2 |
2142 | dd szcon_get_font_height, con_get_font_height |
2264 | dd szcon_get_font_height, con_get_font_height |
2143 | dd szcon_get_cursor_height,con_get_cursor_height |
2265 | dd szcon_get_cursor_height,con_get_cursor_height |
2144 | dd szcon_set_cursor_height,con_set_cursor_height |
2266 | dd szcon_set_cursor_height,con_set_cursor_height |
- | 2267 | dd szcon_cls, con_cls |
|
- | 2268 | dd szcon_get_cursor_pos, con_get_cursor_pos |
|
- | 2269 | dd szcon_set_cursor_pos, con_set_cursor_pos |
|
2145 | dd 0 |
2270 | dd 0 |
Line 2146... | Line 2271... | ||
2146 | 2271 | ||
2147 | con_flags dd 7 |
2272 | con_flags dd 7 |
2148 | con.cursor_height dd (15*font_height+50)/100 |
2273 | con.cursor_height dd (15*font_height+50)/100 |
Line 2173... | Line 2298... | ||
2173 | szcon_gets db 'con_gets',0 |
2298 | szcon_gets db 'con_gets',0 |
2174 | szcon_gets2 db 'con_gets2',0 |
2299 | szcon_gets2 db 'con_gets2',0 |
2175 | szcon_get_font_height db 'con_get_font_height',0 |
2300 | szcon_get_font_height db 'con_get_font_height',0 |
2176 | szcon_get_cursor_height db 'con_get_cursor_height',0 |
2301 | szcon_get_cursor_height db 'con_get_cursor_height',0 |
2177 | szcon_set_cursor_height db 'con_set_cursor_height',0 |
2302 | szcon_set_cursor_height db 'con_set_cursor_height',0 |
- | 2303 | szcon_cls db 'con_cls',0 |
|
- | 2304 | szcon_get_cursor_pos db 'con_get_cursor_pos',0 |
|
- | 2305 | szcon_set_cursor_pos db 'con_set_cursor_pos',0 |
|
Line 2178... | Line 2306... | ||
2178 | 2306 | ||
2179 | con.thread_err db 'Cannot create console thread!',13,10,0 |
2307 | con.thread_err db 'Cannot create console thread!',13,10,0 |
2180 | con.nomem_err db 'Not enough memory!',13,10,0 |
2308 | con.nomem_err db 'Not enough memory!',13,10,0 |
2181 | con.aFinished db ' [Finished]',0 |
2309 | con.aFinished db ' [Finished]',0 |