Rev 9096 | Rev 9125 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 9096 | Rev 9105 | ||
---|---|---|---|
Line 8... | Line 8... | ||
8 | 8 | ||
9 | section '.flat' code readable align 16 |
9 | section '.flat' code readable align 16 |
10 | include 'font.inc' |
10 | include 'font.inc' |
Line -... | Line 11... | ||
- | 11 | include 'conscrl.inc' |
|
- | 12 | ||
- | 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 |
|
11 | include 'conscrl.inc' |
41 | OP_RESIZE = 5 |
12 | 42 | ||
13 | ;void __stdcall START(dword state); |
43 | ;void __stdcall START(dword state); |
14 | START: |
44 | START: |
15 | ; N.B. The current kernel implementation does not require |
45 | ; N.B. The current kernel implementation does not require |
Line 34... | Line 64... | ||
34 | con_init: |
64 | con_init: |
Line 35... | Line 65... | ||
35 | 65 | ||
36 | pop eax |
66 | pop eax |
37 | pop [con.wnd_width] |
67 | pop [con.wnd_width] |
38 | pop [con.wnd_height] |
68 | pop [con.wnd_height] |
39 | pop [con.scr_width] |
69 | pop [con.main_scr_width] |
40 | pop [con.scr_height] |
70 | pop [con.main_scr_height] |
41 | pop [con.title] |
71 | pop [con.title] |
Line 42... | Line 72... | ||
42 | push eax |
72 | push eax |
Line 55... | Line 85... | ||
55 | mov [eax], ebx |
85 | mov [eax], ebx |
56 | @@: |
86 | @@: |
57 | add eax, 4 |
87 | add eax, 4 |
58 | add edx, 4 |
88 | add edx, 4 |
59 | loop .1 |
89 | loop .1 |
- | 90 | ||
60 | ; allocate memory for console data & bitmap data |
91 | ; Allocate memory for console data & bitmap data |
- | 92 | ; First, calculate required amount of bytes |
|
- | 93 | ||
- | 94 | ; Main buffer |
|
61 | mov eax, [con.scr_width] |
95 | mov eax, [con.main_scr_width] |
62 | mul [con.scr_height] |
96 | mul [con.main_scr_height] |
- | 97 | ; 2 bytes per on-screen character (1 flags and 1 ascii) |
|
63 | lea ecx, [eax+eax] |
98 | lea ecx, [eax+eax] |
- | 99 | ||
- | 100 | ; Alternate buffer |
|
- | 101 | mov [con.altbuffer], ecx |
|
- | 102 | mov eax, [con.wnd_width] |
|
- | 103 | mul [con.wnd_height] |
|
- | 104 | ; 2 bytes per on-screen character (1 flags and 1 ascii) |
|
- | 105 | lea ecx, [ecx+2*eax] |
|
- | 106 | ||
- | 107 | ; Bitmap data |
|
64 | mov eax, [con.wnd_width] |
108 | mov eax, [con.wnd_width] |
65 | mul [con.wnd_height] |
109 | mul [con.wnd_height] |
66 | imul eax, font_width*font_height |
110 | imul eax, font_width*font_height |
67 | mov ebx, eax |
111 | mov ebx, eax |
68 | push ebx ecx |
112 | push ebx ecx |
69 | add ecx, eax |
113 | add ecx, eax |
- | 114 | ||
- | 115 | ; malloc |
|
70 | push 68 |
116 | push 68 |
71 | pop eax |
117 | pop eax |
72 | push 12 |
118 | push 12 |
73 | pop ebx |
119 | pop ebx |
74 | int 0x40 |
120 | int 0x40 |
75 | pop ecx ebx |
121 | pop ecx ebx |
76 | mov edx, con.nomem_err |
122 | mov edx, con.nomem_err |
77 | test eax, eax |
123 | test eax, eax |
78 | jz con.fatal |
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 |
|
79 | mov [con.data], eax |
131 | mov [con.data], eax |
- | 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 |
|
80 | push edi |
140 | push edi |
81 | mov edi, eax |
141 | mov edi, eax |
82 | shr ecx, 1 |
142 | shr ecx, 1 |
83 | mov ax, 0x0720 |
143 | mov ax, 0x0720 |
84 | rep stosw |
144 | rep stosw |
- | 145 | ||
- | 146 | ; Clear bitmap buffer |
|
85 | mov ecx, ebx |
147 | mov ecx, ebx |
86 | mov [con.image], edi |
148 | mov [con.image], edi |
87 | xor eax, eax |
149 | xor eax, eax |
88 | rep stosb |
150 | rep stosb |
89 | pop edi |
151 | pop edi |
90 | and byte [con_flags+1], not 2 |
152 | and byte [con_flags+1], not 2 |
- | 153 | ||
91 | ; create console thread |
154 | ; create console thread |
92 | push 51 |
155 | push 51 |
93 | pop eax |
156 | pop eax |
94 | xor ebx, ebx |
157 | xor ebx, ebx |
95 | inc ebx |
158 | inc ebx |
96 | mov ecx, con.thread |
159 | mov ecx, con.thread |
97 | mov edx, con.stack_top |
160 | mov edx, con.stack_top |
98 | int 0x40 |
161 | int 0x40 |
99 | mov edx, con.thread_err |
162 | mov edx, con.thread_err |
100 | test eax, eax |
163 | test eax, eax |
101 | js con.fatal |
164 | js .fatal |
102 | mov [con.console_tid], eax |
165 | mov [con.console_tid], eax |
103 | pop ebx |
166 | pop ebx |
104 | ret |
167 | ret |
- | 168 | ||
105 | con.fatal: |
169 | .fatal: |
106 | ; output string to debug board and die |
170 | ; output string to debug board and die |
107 | mov cl, [edx] |
171 | mov cl, [edx] |
108 | test cl, cl |
172 | test cl, cl |
109 | jz @f |
173 | jz @f |
110 | push 63 |
174 | push 63 |
111 | pop eax |
175 | pop eax |
112 | xor ebx, ebx |
176 | xor ebx, ebx |
113 | inc ebx |
177 | inc ebx |
114 | int 0x40 |
178 | int 0x40 |
115 | inc edx |
179 | inc edx |
116 | jmp con.fatal |
180 | jmp .fatal |
117 | @@: |
181 | @@: |
118 | or eax, -1 |
182 | or eax, -1 |
119 | int 0x40 |
183 | int 0x40 |
Line 120... | Line 184... | ||
120 | 184 | ||
Line 152... | Line 216... | ||
152 | ret 4 |
216 | ret 4 |
Line 153... | Line 217... | ||
153 | 217 | ||
154 | con_init_check: |
218 | con_init_check: |
155 | mov ah,[con.init_cmd] |
219 | mov ah, [con.init_cmd] |
156 | test ah,ah |
220 | test ah, ah |
Line 157... | Line 221... | ||
157 | jne cmd_init_yes |
221 | jne .yes |
158 | 222 | ||
159 | push con.title_init_console |
223 | push con.title_init_console |
160 | push -1 |
224 | push -1 |
161 | push -1 |
225 | push -1 |
Line 162... | Line 226... | ||
162 | push -1 |
226 | push -1 |
163 | push -1 |
- | |
164 | 227 | push -1 |
|
165 | call con_init |
- | |
166 | 228 | ||
- | 229 | call con_init |
|
167 | cmd_init_yes: |
230 | .yes: |
168 | 231 | ret |
|
- | 232 | ||
169 | ret |
233 | ; void __stdcall con_write_asciiz(const char* string); |
- | 234 | con_write_asciiz: |
|
170 | ; void __stdcall con_write_asciiz(const char* string); |
235 | |
171 | con_write_asciiz: |
236 | call con_init_check |
172 | call con_init_check |
237 | |
173 | push ebx esi |
238 | push ebx esi |
174 | or ebx, -1 |
239 | or ebx, -1 |
175 | mov esi, [esp+12] |
240 | mov esi, [esp+12] |
Line 176... | Line 241... | ||
176 | call con.write |
241 | call con.write |
177 | pop esi ebx |
242 | pop esi ebx |
- | 243 | ret 4 |
|
178 | ret 4 |
244 | |
179 | 245 | ; void __stdcall con_write_string(const char* string, dword length); |
|
180 | ; void __stdcall con_write_string(const char* string, dword length); |
246 | con_write_length: |
181 | con_write_length: |
247 | |
182 | push ebx esi |
248 | push ebx esi |
Line 263... | Line 329... | ||
263 | dd con_printf.char |
329 | dd con_printf.char |
264 | dd con_printf.string |
330 | dd con_printf.string |
Line 265... | Line 331... | ||
265 | 331 | ||
266 | ; int __cdecl con_printf(const char* format, ...) |
332 | ; int __cdecl con_printf(const char* format, ...) |
- | 333 | con_printf: |
|
267 | con_printf: |
334 | |
- | 335 | call con_init_check |
|
268 | call con_init_check |
336 | |
269 | xor eax, eax |
337 | xor eax, eax |
270 | pushad |
338 | pushad |
271 | call con.get_data_ptr |
339 | call con.get_data_ptr |
272 | lea ebp, [esp+20h+8] |
340 | lea ebp, [esp+20h+8] |
Line 795... | Line 863... | ||
795 | .bell: |
863 | .bell: |
796 | pusha |
864 | pusha |
797 | push 55 |
865 | push 55 |
798 | pop eax |
866 | pop eax |
799 | mov ebx, eax |
867 | mov ebx, eax |
800 | mov esi, con.beep2 |
868 | mov esi, con.bell |
801 | int 0x40 |
869 | int 0x40 |
802 | popa |
870 | popa |
803 | ret |
871 | ret |
804 | .write_esc: |
872 | .write_esc: |
805 | mov [con_esc], 1 |
873 | mov [con_esc], 1 |
806 | mov [con_esc_attr_n], 1 |
874 | mov [con_esc_attr_n], 1 |
807 | and [con_esc_attrs], 0 |
875 | and [con_esc_attrs], 0 |
808 | ret |
876 | ret |
- | 877 | ||
809 | .esc_mode: |
878 | .esc_mode: |
810 | cmp [con_sci], 0 |
879 | cmp [con_sci], 0 |
811 | jnz .esc_sci |
880 | jnz .esc_sci |
812 | cmp al, '[' |
881 | cmp al, '[' |
- | 882 | je .esc_sqro |
|
- | 883 | cmp al, ']' |
|
- | 884 | je .esc_sqrc |
|
813 | jnz @f |
885 | cmp al, '(' |
814 | mov [con_sci], 1 |
886 | je .esc_rndo |
815 | ret |
887 | cmp al, '>' |
- | 888 | je .keypm_norm |
|
816 | @@: |
889 | cmp al, '=' |
- | 890 | je .keypm_alt |
|
- | 891 | ; Unrecognized escape sequence, print it to screen |
|
817 | push eax |
892 | push eax |
818 | mov al, 27 |
893 | mov al, 27 |
819 | call con.write_char |
894 | call con.write_char |
820 | pop eax |
895 | pop eax |
821 | jmp con.write_char |
896 | jmp con.write_char |
- | 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 | ||
822 | .esc_sci: |
918 | .esc_sci: |
- | 919 | cmp [con_sci], 3 |
|
- | 920 | je .string |
|
- | 921 | cmp [con_sci], 4 |
|
- | 922 | je .g0charset |
|
823 | ; this is real Esc sequence |
923 | ; this is real Esc sequence |
824 | cmp al, '?' ; DEC private mode (DECSET/DECRST sequences) |
924 | cmp al, '?' ; DEC private mode (DECSET/DECRST sequences) |
825 | je .questionmark |
925 | je .questionmark |
826 | cmp al, ';' |
926 | cmp al, ';' |
827 | jz .next_arg |
927 | jz .next_arg |
Line 837... | Line 937... | ||
837 | lea edx, [edx*5] |
937 | lea edx, [edx*5] |
838 | lea edx, [edx*2+eax] |
938 | lea edx, [edx*2+eax] |
839 | mov [con_esc_attrs+(ecx-1)*4], edx |
939 | mov [con_esc_attrs+(ecx-1)*4], edx |
840 | pop edx ecx eax |
940 | pop edx ecx eax |
841 | ret |
941 | ret |
- | 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 |
|
842 | .questionmark: |
978 | .questionmark: |
843 | push ecx |
979 | push ecx |
844 | mov ecx, [con_esc_attr_n] |
980 | mov ecx, [con_esc_attr_n] |
845 | mov dword[con_esc_attrs+(ecx-1)*4], 0xffffffff |
981 | mov dword[con_esc_attrs+(ecx-1)*4], 0xffffffff |
846 | pop ecx |
982 | pop ecx |
Line 852... | Line 988... | ||
852 | jbe @f |
988 | jbe @f |
853 | dec eax |
989 | dec eax |
854 | @@: |
990 | @@: |
855 | mov [con_esc_attr_n], eax |
991 | mov [con_esc_attr_n], eax |
856 | and [con_esc_attrs+(eax-1)*4], 0 |
992 | and [con_esc_attrs+(eax-1)*4], 0 |
- | 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 | @@: |
|
857 | pop eax |
1002 | pop eax |
858 | ret |
1003 | ret |
859 | .not_digit: |
1004 | .not_digit: |
860 | mov [con_esc], 0 |
1005 | mov [con_esc], 0 |
861 | mov [con_sci], 0 ; in any case, leave Esc mode |
1006 | mov [con_sci], 0 ; in any case, leave Esc mode |
- | 1007 | ||
862 | cmp al, 'J' |
1008 | ; cmp al, '@' |
863 | jz .clear |
- | |
864 | cmp al, 'H' |
- | |
865 | jz .setcursor |
- | |
866 | cmp al, 'f' |
- | |
867 | jz .setcursor |
- | |
868 | cmp al, 'm' |
- | |
869 | jz .set_attr |
1009 | ; je .insert_chars |
870 | cmp al, 'A' |
1010 | cmp al, 'A' |
871 | jz .cursor_up |
1011 | je .cursor_up |
872 | cmp al, 'B' |
1012 | cmp al, 'B' |
873 | jz .cursor_down |
1013 | je .cursor_down |
874 | cmp al, 'C' |
1014 | cmp al, 'C' |
875 | jz .cursor_right |
1015 | je .cursor_right |
876 | cmp al, 'D' |
1016 | cmp al, 'D' |
877 | jz .cursor_left |
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 |
|
878 | cmp al, 'l' |
1028 | cmp al, 'H' |
879 | je .dec_rst |
1029 | je .cursor_position |
880 | cmp al, 'h' |
1030 | cmp al, 'J' |
881 | je .dec_set |
1031 | je .erase_in_display |
882 | cmp al, 'K' |
1032 | cmp al, 'K' |
883 | je .erase_in_line |
1033 | je .erase_in_line |
- | 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 | ||
884 | ret ; simply skip unknown sequences |
1064 | ret ; simply skip unknown sequences |
Line -... | Line 1065... | ||
- | 1065 | ||
- | 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 |
|
885 | 1175 | ||
886 | .dec_rst: |
1176 | .reset_mode: |
887 | mov eax, [con_esc_attrs] |
1177 | mov eax, [con_esc_attrs] |
888 | cmp eax, 0xffffffff |
1178 | cmp eax, 0xffffffff |
889 | jne .no_dec_rst |
1179 | jne .no_dec_rst |
- | 1180 | mov eax, [con_esc_attrs+4] |
|
- | 1181 | cmp eax, 1 |
|
- | 1182 | je .dec_rst_app_cursor_keys |
|
- | 1183 | ; cmp eax, 7 |
|
- | 1184 | ; je .dec_rst_wraparound |
|
- | 1185 | ; cmp eax, 12 |
|
890 | mov eax, [con_esc_attrs+4] |
1186 | ; je .dec_rst_cursor_blink |
891 | cmp eax, 25 |
1187 | cmp eax, 25 |
- | 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 |
|
892 | je .hide_cursor |
1198 | ; je .dec_rst_brck_paste |
893 | .no_dec_rst: |
1199 | .no_dec_rst: |
- | 1200 | ; cmp eax, 2 |
|
894 | ret |
1201 | ; je .rst_keyb_action_mode |
895 | .hide_cursor: |
1202 | ; cmp eax, 4 |
896 | mov [con.cursor_height], 0 |
1203 | ; je .set_replace_mode |
Line 897... | Line 1204... | ||
897 | ret |
1204 | ret |
898 | 1205 | ||
899 | .dec_set: |
1206 | .set_mode: |
900 | mov eax, [con_esc_attrs] |
1207 | mov eax, [con_esc_attrs] |
901 | cmp eax, 0xffffffff |
1208 | cmp eax, 0xffffffff |
- | 1209 | jne .no_dec_set |
|
- | 1210 | mov eax, [con_esc_attrs+4] |
|
- | 1211 | cmp eax, 1 |
|
- | 1212 | je .dec_set_app_cursor_keys |
|
- | 1213 | ; cmp eax, 7 |
|
- | 1214 | ; je .dec_set_wraparound |
|
902 | jne .no_dec_set |
1215 | ; cmp eax, 12 |
903 | mov eax, [con_esc_attrs+4] |
1216 | ; je .dec_set_cursor_blink |
- | 1217 | cmp eax, 25 |
|
- | 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 |
|
904 | cmp eax, 25 |
1227 | ; cmp eax, 2004 |
- | 1228 | ; je .dec_set_brck_paste |
|
- | 1229 | .no_dec_set: |
|
- | 1230 | ; cmp eax, 2 |
|
- | 1231 | ; je .set_keyb_action_mode |
|
905 | je .show_cursor |
1232 | ; cmp eax, 4 |
Line -... | Line 1233... | ||
- | 1233 | ; je .set_insert_mode |
|
- | 1234 | ret |
|
- | 1235 | ||
- | 1236 | .dec_set_app_cursor_keys: |
|
- | 1237 | mov [cursor_esc], 27 + ('O' shl 8) |
|
- | 1238 | ret |
|
- | 1239 | ||
- | 1240 | .dec_rst_app_cursor_keys: |
|
906 | .no_dec_set: |
1241 | mov [cursor_esc], 27 + ('[' shl 8) |
907 | ret |
1242 | ret |
908 | 1243 | ||
Line -... | Line 1244... | ||
- | 1244 | .dec_set_cursor: |
|
- | 1245 | mov [con.cursor_height], (15*font_height+50)/100 ; default height |
|
- | 1246 | ret |
|
- | 1247 | ||
- | 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 |
|
909 | .show_cursor: |
1344 | cld |
910 | mov [con.cursor_height], (15*font_height+50)/100 ; default height |
1345 | pop ecx edi |
911 | ret |
1346 | ret |
912 | 1347 | ||
913 | .erase_in_line: |
1348 | .erase_in_line: |
914 | mov eax, [con_esc_attrs] |
1349 | mov eax, [con_esc_attrs] |
915 | test eax, eax |
1350 | test eax, eax |
916 | jz .erase_till_end_of_line ; |
1351 | jz .erase_after ; |
917 | dec eax |
1352 | dec eax |
Line 918... | Line 1353... | ||
918 | jz .erase_till_start_of_line ; |
1353 | jz .erase_before ; |
919 | dec eax |
1354 | dec eax |
920 | je .erase_current_line ; |
- | |
921 | ret ; unknown sequence |
- | |
922 | - | ||
923 | .erase_till_end_of_line: |
- | |
924 | push edi ecx |
- | |
925 | mov edi, [con.cur_y] |
1355 | je .erase_current_line ; |
926 | imul edi, [con.scr_width] |
1356 | ret ; unknown sequence |
927 | add edi, [con.cur_x] |
1357 | |
928 | shl edi, 1 |
1358 | .erase_after: |
929 | add edi, [con.data] |
1359 | push edi ecx |
930 | mov ecx, [con.scr_width] |
1360 | mov ecx, [con.scr_width] |
931 | sub ecx, [con.cur_x] |
1361 | sub ecx, [con.cur_x] |
Line 932... | Line 1362... | ||
932 | mov ah, byte[con_flags] |
1362 | mov ah, byte[con_flags] |
933 | mov al, ' ' |
1363 | mov al, ' ' |
934 | rep stosw |
1364 | rep stosw |
935 | pop ecx edi |
1365 | pop ecx edi |
936 | ret |
1366 | ret |
937 | 1367 | ||
Line 959... | Line 1389... | ||
959 | mov al, ' ' |
1389 | mov al, ' ' |
960 | rep stosw |
1390 | rep stosw |
961 | pop ecx edi |
1391 | pop ecx edi |
962 | ret |
1392 | ret |
Line 963... | Line 1393... | ||
963 | 1393 | ||
964 | .clear: |
1394 | .erase_in_display: |
965 | mov eax, [con_esc_attrs] |
1395 | mov eax, [con_esc_attrs] |
966 | test eax, eax |
1396 | test eax, eax |
967 | jz .clear_till_end_of_screen ; |
1397 | jz .erase_below ; |
968 | dec eax |
1398 | dec eax |
969 | jz .clear_till_start_of_screen ; |
1399 | jz .erase_above ; |
970 | dec eax |
1400 | dec eax |
971 | je .cls ; |
1401 | je .erase_all ; |
Line 972... | Line 1402... | ||
972 | ret ; unknown sequence |
1402 | ret ; unknown sequence |
973 | 1403 | ||
974 | .clear_till_end_of_screen: |
1404 | .erase_below: |
975 | push edi ecx |
1405 | push edi ecx |
Line 976... | Line 1406... | ||
976 | mov ecx, [con.scr_width] |
1406 | mov ecx, [con.scr_width] |
Line 990... | Line 1420... | ||
990 | and [con.cur_x], 0 |
1420 | and [con.cur_x], 0 |
991 | and [con.cur_y], 0 |
1421 | and [con.cur_y], 0 |
992 | pop ecx edi |
1422 | pop ecx edi |
993 | ret |
1423 | ret |
Line 994... | Line 1424... | ||
994 | 1424 | ||
995 | .clear_till_start_of_screen: |
1425 | .erase_above: |
996 | push edi ecx |
1426 | push edi ecx |
997 | mov ecx, [con.cur_y] |
1427 | mov ecx, [con.cur_y] |
998 | imul ecx, [con.scr_width] |
1428 | imul ecx, [con.scr_width] |
999 | add ecx, [con.cur_x] |
1429 | add ecx, [con.cur_x] |
Line 1002... | Line 1432... | ||
1002 | mov al, ' ' |
1432 | mov al, ' ' |
1003 | rep stosw |
1433 | rep stosw |
1004 | pop ecx edi |
1434 | pop ecx edi |
1005 | ret |
1435 | ret |
Line 1006... | Line 1436... | ||
1006 | 1436 | ||
1007 | .cls: ; clear screen completely |
1437 | .erase_all: ; clear screen completely |
1008 | push ecx |
1438 | push ecx |
1009 | and [con.cur_x], 0 |
1439 | and [con.cur_x], 0 |
1010 | and [con.cur_y], 0 |
1440 | and [con.cur_y], 0 |
1011 | mov edi, [con.data] |
1441 | mov edi, [con.data] |
Line 1015... | Line 1445... | ||
1015 | mov ax, 0720h |
1445 | mov ax, 0720h |
1016 | rep stosw |
1446 | rep stosw |
1017 | pop edi ecx |
1447 | pop edi ecx |
1018 | .nosetcursor: |
1448 | .nosetcursor: |
1019 | ret |
1449 | ret |
1020 | .setcursor: |
1450 | .line_position_abs: |
1021 | cmp [con_esc_attr_n], 2 |
1451 | mov eax, [con_esc_attrs] |
1022 | je @f |
1452 | dec eax |
1023 | xor eax, eax |
1453 | jns @f |
1024 | mov [con.cur_x], eax |
- | |
1025 | mov [con.cur_y], eax |
- | |
1026 | jmp .j_get_data |
1454 | inc eax |
1027 | @@: |
1455 | @@: |
- | 1456 | cmp eax, [con.scr_height] |
|
- | 1457 | jae .nolinepos |
|
- | 1458 | mov [con.cur_y], eax |
|
- | 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) |
|
1028 | mov eax, [con_esc_attrs] |
1466 | mov eax, [con_esc_attrs] |
1029 | cmp eax, [con.scr_width] |
1467 | dec eax |
1030 | jae @f |
1468 | jns @f |
1031 | mov [con.cur_x], eax |
1469 | inc eax |
1032 | @@: |
1470 | @@: |
1033 | mov eax, [con_esc_attrs+4] |
- | |
1034 | cmp eax, [con.scr_height+4] |
1471 | cmp eax, [con.scr_height] |
1035 | jae @f |
1472 | jae .no_y |
1036 | mov [con.cur_y], eax |
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 | @@: |
|
- | 1482 | cmp eax, [con.scr_width] |
|
- | 1483 | jae .no_x |
|
- | 1484 | mov [con.cur_x], eax |
|
- | 1485 | .no_x: |
|
1037 | .j_get_data: |
1486 | .j_get_data: |
1038 | jmp con.get_data_ptr |
1487 | jmp con.get_data_ptr |
1039 | .cursor_up: |
1488 | .cursor_up: |
1040 | cmp [con_esc_attr_n], 1 |
- | |
1041 | jnz .nosetcursor |
- | |
1042 | mov eax, [con.cur_y] |
1489 | mov eax, [con_esc_attrs] |
1043 | sub eax, [con_esc_attrs] |
1490 | test eax, eax |
1044 | jnc @f |
1491 | jnz @f |
1045 | xor eax, eax |
1492 | inc eax ; default = 1 |
1046 | @@: |
1493 | @@: |
1047 | mov [con.cur_y], eax |
1494 | sub [con.cur_y], eax |
- | 1495 | jns .j_get_data |
|
- | 1496 | mov [con.cur_y], 0 |
|
1048 | jmp .j_get_data |
1497 | jmp .j_get_data |
1049 | .cursor_down: |
1498 | .cursor_down: |
1050 | cmp [con_esc_attr_n], 1 |
1499 | mov eax, [con_esc_attrs] |
- | 1500 | test eax, eax |
|
1051 | jnz .nosetcursor |
1501 | jnz @f |
1052 | mov eax, [con.cur_y] |
1502 | inc eax ; default = 1 |
- | 1503 | @@: |
|
1053 | add eax, [con_esc_attrs] |
1504 | add eax, [con.cur_y] |
1054 | cmp eax, [con.scr_height] |
1505 | cmp eax, [con.scr_height] |
1055 | jb @f |
1506 | ja @f |
1056 | mov eax, [con.scr_height] |
1507 | mov [con.cur_y], eax |
1057 | dec eax |
1508 | jmp .j_get_data |
1058 | @@: |
1509 | @@: |
- | 1510 | mov eax, [con.scr_height] |
|
1059 | mov [con.cur_y], eax |
1511 | mov [con.cur_y], eax |
1060 | jmp .j_get_data |
1512 | jmp .j_get_data |
1061 | .cursor_right: |
1513 | .cursor_right: |
1062 | cmp [con_esc_attr_n], 1 |
1514 | mov eax, [con_esc_attrs] |
- | 1515 | test eax, eax |
|
1063 | jnz .nosetcursor |
1516 | jnz @f |
1064 | mov eax, [con.cur_x] |
1517 | inc eax ; default = 1 |
- | 1518 | @@: |
|
1065 | add eax, [con_esc_attrs] |
1519 | add eax, [con.cur_x] |
1066 | cmp eax, [con.scr_width] |
1520 | cmp eax, [con.scr_width] |
1067 | jb @f |
1521 | ja @f |
1068 | mov eax, [con.scr_width] |
1522 | mov [con.cur_x], eax |
1069 | dec eax |
1523 | jmp .j_get_data |
1070 | @@: |
1524 | @@: |
- | 1525 | mov eax, [con.scr_width] |
|
1071 | mov [con.cur_x], eax |
1526 | mov [con.cur_x], eax |
1072 | jmp .j_get_data |
1527 | jmp .j_get_data |
1073 | .cursor_left: |
1528 | .cursor_left: |
1074 | cmp [con_esc_attr_n], 1 |
- | |
1075 | jnz .nosetcursor |
- | |
1076 | mov eax, [con.cur_x] |
1529 | test eax, eax |
1077 | sub eax, [con_esc_attrs] |
- | |
1078 | jnc @f |
1530 | jnz @f |
1079 | xor eax, eax |
1531 | inc eax ; default = 1 |
1080 | @@: |
1532 | @@: |
1081 | mov [con.cur_x], eax |
1533 | sub [con.cur_x], eax |
- | 1534 | jns .j_get_data |
|
- | 1535 | mov [con.cur_x], 0 |
|
1082 | jmp .j_get_data |
1536 | jmp .j_get_data |
1083 | .set_attr: |
1537 | .set_attr: |
1084 | push eax ecx edx |
1538 | push eax ecx edx |
1085 | xor ecx, ecx |
1539 | xor ecx, ecx |
1086 | .set_one_attr: |
1540 | .set_one_attr: |
Line 1091... | Line 1545... | ||
1091 | jz .attr_bold |
1545 | jz .attr_bold |
1092 | cmp al, 5 |
1546 | cmp al, 5 |
1093 | jz .attr_bgr_bold |
1547 | jz .attr_bgr_bold |
1094 | cmp al, 7 |
1548 | cmp al, 7 |
1095 | jz .attr_reversed |
1549 | jz .attr_reversed |
- | 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 |
|
Line -... | Line 1556... | ||
- | 1556 | ||
1096 | 1557 | ; Forground colors |
|
1097 | xor edx, edx |
1558 | xor edx, edx |
1098 | cmp al, 30 |
1559 | cmp al, 30 ; Black |
1099 | jz .attr_color |
1560 | jz .attr_color |
1100 | mov dl, 4 |
1561 | mov dl, 4 |
1101 | cmp al, 31 |
1562 | cmp al, 31 ; Red |
1102 | jz .attr_color |
1563 | jz .attr_color |
1103 | mov dl, 2 |
1564 | mov dl, 2 |
1104 | cmp al, 32 |
1565 | cmp al, 32 ; Green |
1105 | jz .attr_color |
1566 | jz .attr_color |
1106 | mov dl, 6 |
1567 | mov dl, 6 |
1107 | cmp al, 33 |
1568 | cmp al, 33 ; Yellow |
1108 | jz .attr_color |
1569 | jz .attr_color |
1109 | mov dl, 1 |
1570 | mov dl, 1 |
1110 | cmp al, 34 |
1571 | cmp al, 34 ; Blue |
1111 | jz .attr_color |
1572 | jz .attr_color |
1112 | mov dl, 5 |
1573 | mov dl, 5 |
1113 | cmp al, 35 |
1574 | cmp al, 35 ; Purple |
1114 | jz .attr_color |
1575 | jz .attr_color |
1115 | mov dl, 3 |
1576 | mov dl, 3 |
1116 | cmp al, 36 |
1577 | cmp al, 36 ; Cyan |
1117 | jz .attr_color |
1578 | jz .attr_color |
- | 1579 | mov dl, 7 |
|
- | 1580 | cmp al, 37 ; White |
|
1118 | mov dl, 7 |
1581 | jz .attr_color |
- | 1582 | mov dl, 7 |
|
1119 | cmp al, 37 |
1583 | cmp al, 39 ; Default - White |
Line -... | Line 1584... | ||
- | 1584 | jz .attr_color |
|
1120 | jz .attr_color |
1585 | |
1121 | 1586 | ; Background colors |
|
1122 | xor edx, edx |
1587 | xor edx, edx |
1123 | cmp al, 40 |
1588 | cmp al, 40 ; Black |
1124 | jz .attr_bgr_color |
1589 | jz .attr_bgr_color |
1125 | mov dl, 0x40 |
1590 | mov dl, 0x40 |
1126 | cmp al, 41 |
1591 | cmp al, 41 ; Red |
1127 | jz .attr_bgr_color |
1592 | jz .attr_bgr_color |
1128 | mov dl, 0x20 |
1593 | mov dl, 0x20 |
1129 | cmp al, 42 |
1594 | cmp al, 42 ; Green |
1130 | jz .attr_bgr_color |
1595 | jz .attr_bgr_color |
1131 | mov dl, 0x60 |
1596 | mov dl, 0x60 |
1132 | cmp al, 43 |
1597 | cmp al, 43 ; Yellow |
1133 | jz .attr_bgr_color |
1598 | jz .attr_bgr_color |
1134 | mov dl, 0x10 |
1599 | mov dl, 0x10 |
1135 | cmp al, 44 |
1600 | cmp al, 44 ; Blue |
1136 | jz .attr_bgr_color |
1601 | jz .attr_bgr_color |
1137 | mov dl, 0x50 |
1602 | mov dl, 0x50 |
1138 | cmp al, 45 |
1603 | cmp al, 45 ; Magenta |
1139 | jz .attr_bgr_color |
1604 | jz .attr_bgr_color |
1140 | mov dl, 0x30 |
1605 | mov dl, 0x30 |
1141 | cmp al, 46 |
1606 | cmp al, 46 ; Cyan |
- | 1607 | jz .attr_bgr_color |
|
- | 1608 | mov dl, 0x70 |
|
1142 | jz .attr_bgr_color |
1609 | cmp al, 47 ; White |
- | 1610 | jz .attr_bgr_color |
|
1143 | mov dl, 0x70 |
1611 | mov dl, 0 |
Line -... | Line 1612... | ||
- | 1612 | cmp al, 49 ; Default - Black |
|
- | 1613 | jz .attr_bgr_color |
|
1144 | cmp al, 47 |
1614 | |
1145 | jz .attr_bgr_color |
1615 | ; 16-color support, bright colors follow |
1146 | 1616 | ; Foreground colors |
|
1147 | mov dl, 0x08 |
1617 | mov dl, 0x08 |
1148 | cmp al, 90 |
1618 | cmp al, 90 ; Black |
1149 | jz .attr_color |
1619 | jz .attr_color |
1150 | mov dl, 4 + 8 |
1620 | mov dl, 4 + 8 |
1151 | cmp al, 91 |
1621 | cmp al, 91 ; Red |
1152 | jz .attr_color |
1622 | jz .attr_color |
1153 | mov dl, 2 + 8 |
1623 | mov dl, 2 + 8 |
1154 | cmp al, 92 |
1624 | cmp al, 92 ; Green |
1155 | jz .attr_color |
1625 | jz .attr_color |
1156 | mov dl, 6 + 8 |
1626 | mov dl, 6 + 8 |
1157 | cmp al, 93 |
1627 | cmp al, 93 ; Yellow |
1158 | jz .attr_color |
1628 | jz .attr_color |
1159 | mov dl, 1 + 8 |
1629 | mov dl, 1 + 8 |
1160 | cmp al, 94 |
1630 | cmp al, 94 ; Blue |
1161 | jz .attr_color |
1631 | jz .attr_color |
1162 | mov dl, 5 + 8 |
1632 | mov dl, 5 + 8 |
1163 | cmp al, 95 |
1633 | cmp al, 95 ; Magenta |
1164 | jz .attr_color |
1634 | jz .attr_color |
1165 | mov dl, 3 + 8 |
1635 | mov dl, 3 + 8 |
1166 | cmp al, 96 |
1636 | cmp al, 96 ; Cyan |
1167 | jz .attr_color |
1637 | jz .attr_color |
Line -... | Line 1638... | ||
- | 1638 | mov dl, 7 + 8 |
|
1168 | mov dl, 7 + 8 |
1639 | cmp al, 97 ; White |
1169 | cmp al, 97 |
1640 | jz .attr_color |
1170 | jz .attr_color |
1641 | |
1171 | 1642 | ; Background colors |
|
1172 | mov dl, 0x80 |
1643 | mov dl, 0x80 |
1173 | cmp al, 100 |
1644 | cmp al, 100 ; Black |
1174 | jz .attr_bgr_color |
1645 | jz .attr_bgr_color |
1175 | mov dl, 0x80 + 0x40 |
1646 | mov dl, 0x80 + 0x40 |
1176 | cmp al, 101 |
1647 | cmp al, 101 ; Red |
1177 | jz .attr_bgr_color |
1648 | jz .attr_bgr_color |
1178 | mov dl, 0x80 + 0x20 |
1649 | mov dl, 0x80 + 0x20 |
1179 | cmp al, 102 |
1650 | cmp al, 102 ; Green |
1180 | jz .attr_bgr_color |
1651 | jz .attr_bgr_color |
1181 | mov dl, 0x80 + 0x60 |
1652 | mov dl, 0x80 + 0x60 |
1182 | cmp al, 103 |
1653 | cmp al, 103 ; Yellow |
1183 | jz .attr_bgr_color |
1654 | jz .attr_bgr_color |
1184 | mov dl, 0x80 + 0x10 |
1655 | mov dl, 0x80 + 0x10 |
1185 | cmp al, 104 |
1656 | cmp al, 104 ; Blue |
1186 | jz .attr_bgr_color |
1657 | jz .attr_bgr_color |
1187 | mov dl, 0x80 + 0x50 |
1658 | mov dl, 0x80 + 0x50 |
1188 | cmp al, 105 |
1659 | cmp al, 105 ; Magenta |
1189 | jz .attr_bgr_color |
1660 | jz .attr_bgr_color |
1190 | mov dl, 0x80 + 0x30 |
1661 | mov dl, 0x80 + 0x30 |
1191 | cmp al, 106 |
1662 | cmp al, 106 ; Cyan |
Line 1192... | Line 1663... | ||
1192 | jz .attr_bgr_color |
1663 | jz .attr_bgr_color |
1193 | mov dl, 0x80 + 0x70 |
1664 | mov dl, 0x80 + 0x70 |
1194 | cmp al, 107 |
1665 | cmp al, 107 ; White |
- | 1666 | jnz .attr_continue |
|
1195 | jnz .attr_continue |
1667 | |
1196 | 1668 | .attr_bgr_color: |
|
1197 | .attr_bgr_color: |
1669 | mov eax, [con_flags] |
1198 | mov eax, [con_flags] |
1670 | and al, 0x0F |
1199 | and al, 0x0F |
1671 | or al, byte [con_flags_attr] |
1200 | or al, dl |
1672 | or al, dl |
- | 1673 | mov [con_flags], eax |
|
1201 | mov [con_flags], eax |
1674 | jmp .attr_continue |
1202 | jmp .attr_continue |
1675 | .attr_color: |
1203 | .attr_color: |
1676 | mov eax, [con_flags] |
1204 | mov eax, [con_flags] |
1677 | and al, 0xF0 |
- | 1678 | or al, byte [con_flags_attr] |
|
1205 | and al, 0xF0 |
1679 | or al, dl |
1206 | or al, dl |
1680 | mov [con_flags], eax |
1207 | mov [con_flags], eax |
1681 | jmp .attr_continue |
1208 | jmp .attr_continue |
1682 | .attr_normal: |
1209 | .attr_normal: |
1683 | mov byte [con_flags_attr], 0 |
1210 | mov byte [con_flags], 7 |
1684 | mov byte [con_flags], 0x07 |
1211 | jmp .attr_continue |
1685 | jmp .attr_continue |
1212 | .attr_reversed: |
1686 | .attr_reversed: |
1213 | mov byte [con_flags], 0x70 |
1687 | mov byte [con_flags], 0x70 |
1214 | jmp .attr_continue |
1688 | jmp .attr_continue |
1215 | .attr_bold: |
1689 | .attr_bold: |
1216 | or byte [con_flags], 8 |
1690 | or byte [con_flags_attr], 0x08 |
1217 | jmp .attr_continue |
1691 | jmp .attr_continue |
1218 | .attr_bgr_bold: |
1692 | .attr_bgr_bold: |
1219 | or byte [con_flags], 0x80 |
1693 | or byte [con_flags_attr], 0x80 |
Line 1379... | Line 1853... | ||
1379 | test ah,ah |
1853 | test ah, ah |
1380 | je .ret |
1854 | je .ret |
Line 1381... | Line 1855... | ||
1381 | 1855 | ||
1382 | cmp byte [esp+4], 0 |
1856 | cmp byte [esp+4], 0 |
1383 | jz .noexit |
1857 | jz .noexit |
1384 | mov [con.thread_op], 1 |
1858 | mov [con.thread_op], OP_EXIT |
Line 1385... | Line 1859... | ||
1385 | call con.wake |
1859 | call con.wake |
1386 | 1860 | ||
1387 | ret 4 |
1861 | ret 4 |
Line 1412... | Line 1886... | ||
1412 | ret |
1886 | ret |
Line 1413... | Line 1887... | ||
1413 | 1887 | ||
1414 | con_set_title: |
1888 | con_set_title: |
1415 | mov eax, [esp+4] |
1889 | mov eax, [esp+4] |
1416 | mov [con.title], eax |
1890 | mov [con.title], eax |
1417 | mov [con.thread_op], 2 |
1891 | mov [con.thread_op], OP_SET_TITLE |
1418 | call con.wake |
1892 | call con.wake |
Line 1419... | Line 1893... | ||
1419 | ret 4 |
1893 | ret 4 |
1420 | 1894 | ||
Line 1430... | Line 1904... | ||
1430 | ret |
1904 | ret |
Line 1431... | Line 1905... | ||
1431 | 1905 | ||
1432 | con.force_entered_char: |
1906 | con.force_entered_char: |
1433 | cmp [con.entered_char], -1 |
1907 | cmp [con.entered_char], -1 |
1434 | jnz .ret |
1908 | jnz .ret |
1435 | mov [con.thread_op], 4 |
1909 | mov [con.thread_op], OP_GETCH |
1436 | call con.wake |
1910 | call con.wake |
1437 | test byte [con_flags+1], 2 |
1911 | test byte [con_flags+1], 2 |
1438 | jnz .ret |
1912 | jnz .ret |
1439 | ; wait for response |
1913 | ; wait for response |
Line 1477... | Line 1951... | ||
1477 | jnz con_getch_closed |
1951 | jnz con_getch_closed |
1478 | mov eax, 0xFFFF |
1952 | mov eax, 0xFFFF |
1479 | xchg ax, [con.entered_char] |
1953 | xchg ax, [con.entered_char] |
1480 | ret |
1954 | ret |
Line -... | Line 1955... | ||
- | 1955 | ||
- | 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 | ||
1481 | 2143 | ||
1482 | ; char* __stdcall con_gets(char* str, int n); |
2144 | ; char* __stdcall con_gets(char* str, int n); |
1483 | con_gets: |
2145 | con_gets: |
1484 | pop eax |
2146 | pop eax |
1485 | push 0 |
2147 | push 0 |
Line 1806... | Line 2468... | ||
1806 | mov ah,[con.init_cmd] |
2468 | mov ah, [con.init_cmd] |
1807 | test ah,ah |
2469 | test ah, ah |
1808 | je cmd_init_no |
2470 | je cmd_init_no |
Line 1809... | Line 2471... | ||
1809 | 2471 | ||
1810 | push edi |
2472 | push edi |
1811 | call con.write_special_char.cls |
2473 | call con.write_special_char.erase_all |
1812 | pop edi |
2474 | pop edi |
Line 1813... | Line 2475... | ||
1813 | call con.update_screen |
2475 | call con.update_screen |
Line 1870... | Line 2532... | ||
1870 | mov eax, [con.cur_y] |
2532 | mov eax, [con.cur_y] |
1871 | .set: |
2533 | .set: |
1872 | mov [con.wnd_ypos], eax |
2534 | mov [con.wnd_ypos], eax |
1873 | .done: |
2535 | .done: |
1874 | pop eax |
2536 | pop eax |
1875 | mov [con.thread_op], 3 |
2537 | mov [con.thread_op], OP_REDRAW |
Line 1876... | Line 2538... | ||
1876 | 2538 | ||
1877 | con.wake: |
2539 | con.wake: |
1878 | pushad |
2540 | pushad |
1879 | mov al, [con.thread_op] |
2541 | mov al, [con.thread_op] |
Line 2124... | Line 2786... | ||
2124 | jz con.set_title |
2786 | jz con.set_title |
2125 | dec eax |
2787 | dec eax |
2126 | jz con.redraw_image |
2788 | jz con.redraw_image |
2127 | dec eax |
2789 | dec eax |
2128 | jz con.getch |
2790 | jz con.getch |
- | 2791 | dec eax |
|
- | 2792 | jz con.resize |
|
- | 2793 | jmp con.msg_loop |
|
- | 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 |
|
2129 | jmp con.msg_loop |
2822 | jmp con.msg_loop |
2130 | con.set_title: |
2823 | con.set_title: |
2131 | push 71 |
2824 | push 71 |
2132 | pop eax |
2825 | pop eax |
2133 | push 1 |
2826 | push 1 |
Line 2404... | Line 3097... | ||
2404 | push 12 |
3097 | push 12 |
2405 | pop eax |
3098 | pop eax |
2406 | xor ebx, ebx |
3099 | xor ebx, ebx |
2407 | inc ebx |
3100 | inc ebx |
2408 | int 0x40 |
3101 | int 0x40 |
- | 3102 | ||
2409 | mov al, 48 |
3103 | mov al, 48 |
2410 | mov bl, 4 |
3104 | mov bl, 4 |
2411 | int 0x40 |
3105 | int 0x40 |
2412 | mov ebx, [con.def_wnd_x-2] |
3106 | mov ebx, [con.def_wnd_x-2] |
2413 | mov bx, word [con.wnd_width] |
3107 | mov bx, word [con.wnd_width] |
Line 2425... | Line 3119... | ||
2425 | jae @f |
3119 | jae @f |
2426 | add ebx, con.vscroll_width |
3120 | add ebx, con.vscroll_width |
2427 | @@: |
3121 | @@: |
2428 | xor eax, eax |
3122 | xor eax, eax |
2429 | int 0x40 |
3123 | int 0x40 |
2430 | ;Leency{ |
- | |
- | 3124 | ||
2431 | mov eax,9 |
3125 | mov eax, 9 |
2432 | mov ebx,process_info_buffer |
3126 | mov ebx, process_info_buffer |
2433 | mov ecx,-1 |
3127 | mov ecx, -1 |
2434 | int 0x40 |
3128 | int 0x40 |
2435 | mov eax,[ebx+70] |
- | |
2436 | mov [window_status],eax |
- | |
2437 | test [window_status],100b ; window is rolled up |
- | |
2438 | jnz .exit |
- | |
2439 | test [window_status],10b ; window is minimized to panel |
3129 | test [process_info_buffer.wnd_state], 110b ; window is rolled up or minimized to panel |
2440 | jnz .exit |
3130 | jnz .exit |
2441 | ;}Leency - I'm in diamond code... |
- | |
- | 3131 | ||
2442 | call con.draw_image |
3132 | call con.draw_image |
Line 2443... | Line 3133... | ||
2443 | 3133 | ||
2444 | .exit: |
3134 | .exit: |
2445 | push 12 |
3135 | push 12 |
Line 2604... | Line 3294... | ||
2604 | db '7', '8', '9', '-' |
3294 | db '7', '8', '9', '-' |
2605 | db '4', '5', '6', '+' |
3295 | db '4', '5', '6', '+' |
2606 | db '1', '2', '3' |
3296 | db '1', '2', '3' |
2607 | db '0', '.' |
3297 | db '0', '.' |
Line -... | Line 3298... | ||
- | 3298 | ||
- | 3299 | ||
- | 3300 | cursor_esc dd 27 + ('[' shl 8) |
|
2608 | 3301 | ||
2609 | ; ⥪ã饩 ॠ«¨§ 樨 § ç¥¨ï ¯® 㬮«ç ¨î â ª®¢ë. |
3302 | ; ⥪ã饩 ॠ«¨§ 樨 § ç¥¨ï ¯® 㬮«ç ¨î â ª®¢ë. |
2610 | ; ¡ã¤ã饬 ®¨, ¢®§¬®¦®, ¡ã¤ãâ áç¨âë¢ âìáï ª ª ¯ à ¬¥âàë ¨§ ini-ä ©« console.ini. |
3303 | ; ¡ã¤ã饬 ®¨, ¢®§¬®¦®, ¡ã¤ãâ áç¨âë¢ âìáï ª ª ¯ à ¬¥âàë ¨§ ini-ä ©« console.ini. |
2611 | con.def_wnd_width dd 80 |
3304 | con.def_wnd_width dd 80 |
2612 | con.def_wnd_height dd 25 |
3305 | con.def_wnd_height dd 25 |
Line 2615... | Line 3308... | ||
2615 | con.def_wnd_x dd 200 |
3308 | con.def_wnd_x dd 200 |
2616 | con.def_wnd_y dd 50 |
3309 | con.def_wnd_y dd 50 |
Line 2617... | Line 3310... | ||
2617 | 3310 | ||
2618 | con.init_cmd db 0 |
3311 | con.init_cmd db 0 |
2619 | con.title_init_console db "Console",0 |
- | |
2620 | - | ||
2621 | struc process_info |
- | |
2622 | { |
- | |
2623 | cpu_usage dd ? ; +0 |
- | |
2624 | window_stack_position dw ? ; +4 |
- | |
2625 | window_stack_value dw ? ; +6 |
- | |
2626 | dw ? ; +8 |
- | |
2627 | process_name rb 12 ; +10 |
- | |
2628 | memory_start dd ? ; +22 |
- | |
2629 | used_memory dd ? ; +26 |
- | |
2630 | PID dd ? ; +30 |
- | |
2631 | box.x dd ? ; +34 |
- | |
2632 | box.y dd ? ; +38 |
- | |
2633 | box.width dd ? ; +42 |
- | |
2634 | box.height dd ? ; +46 |
- | |
2635 | slot_state dw ? ; +50 |
- | |
2636 | dw ? ; +52 |
- | |
2637 | client_box.x dd ? ; +54 |
- | |
2638 | client_box.y dd ? ; +58 |
- | |
2639 | client_box.width dd ? ; +62 |
- | |
2640 | client_box.height dd ? ; +66 |
- | |
2641 | wnd_state db ? ; +70 |
- | |
2642 | rb (1024-71) |
- | |
2643 | } |
- | |
2644 | process_info_buffer process_info |
- | |
2645 | window_status rd 1 |
- | |
2646 | 3312 | con.title_init_console db "Console",0 |
|
Line 2647... | Line 3313... | ||
2647 | con.vscroll_pt dd -1 |
3313 | con.vscroll_pt dd -1 |
2648 | 3314 | ||
2649 | align 16 |
3315 | align 16 |
2650 | EXPORTS: |
3316 | EXPORTS: |
2651 | dd szStart, START |
3317 | dd szStart, START |
2652 | dd szVersion, 0x00020008 |
3318 | dd szVersion, 0x00020009 |
2653 | dd szcon_init, con_init |
3319 | dd szcon_init, con_init |
2654 | dd szcon_write_asciiz, con_write_asciiz |
3320 | dd szcon_write_asciiz, con_write_asciiz |
2655 | dd szcon_write_string, con_write_length |
3321 | dd szcon_write_string, con_write_length |
Line 2667... | Line 3333... | ||
2667 | dd szcon_set_cursor_height,con_set_cursor_height |
3333 | dd szcon_set_cursor_height,con_set_cursor_height |
2668 | dd szcon_cls, con_cls |
3334 | dd szcon_cls, con_cls |
2669 | dd szcon_get_cursor_pos, con_get_cursor_pos |
3335 | dd szcon_get_cursor_pos, con_get_cursor_pos |
2670 | dd szcon_set_cursor_pos, con_set_cursor_pos |
3336 | dd szcon_set_cursor_pos, con_set_cursor_pos |
2671 | dd szcon_set_title, con_set_title |
3337 | dd szcon_set_title, con_set_title |
- | 3338 | dd szcon_get_input, con_get_input |
|
2672 | dd 0 |
3339 | dd 0 |
Line 2673... | Line 3340... | ||
2673 | 3340 | ||
- | 3341 | con_flags dd 0x07 ; black on white |
|
2674 | con_flags dd 7 |
3342 | con_flags_attr dd 0 ; Modifiers (for example, high intensity colors) |
2675 | con.cursor_height dd (15*font_height+50)/100 |
3343 | con.cursor_height dd (15*font_height+50)/100 |
2676 | con.input_start dd con.input_buffer |
3344 | con.input_start dd con.input_buffer |
Line 2677... | Line 3345... | ||
2677 | con.input_end dd con.input_buffer |
3345 | con.input_end dd con.input_buffer |
2678 | 3346 | ||
2679 | con_esc_attr_n dd 0 |
3347 | con_esc_attr_n dd 0 |
2680 | con_esc_attrs dd 0,0,0,0 |
3348 | con_esc_attrs dd 0,0,0,0 |
- | 3349 | con_esc db 0 |
|
- | 3350 | con_sci db 0 |
|
Line 2681... | Line 3351... | ||
2681 | con_esc db 0 |
3351 | con_osc_str rb 256 |
2682 | con_sci db 0 |
3352 | con_osc_strlen dd 0 |
2683 | 3353 | ||
Line 2705... | Line 3375... | ||
2705 | szcon_set_cursor_height db 'con_set_cursor_height',0 |
3375 | szcon_set_cursor_height db 'con_set_cursor_height',0 |
2706 | szcon_cls db 'con_cls',0 |
3376 | szcon_cls db 'con_cls',0 |
2707 | szcon_get_cursor_pos db 'con_get_cursor_pos',0 |
3377 | szcon_get_cursor_pos db 'con_get_cursor_pos',0 |
2708 | szcon_set_cursor_pos db 'con_set_cursor_pos',0 |
3378 | szcon_set_cursor_pos db 'con_set_cursor_pos',0 |
2709 | szcon_set_title db 'con_set_title',0 |
3379 | szcon_set_title db 'con_set_title',0 |
- | 3380 | szcon_get_input db 'con_get_input',0 |
|
Line 2710... | Line 3381... | ||
2710 | 3381 | ||
2711 | con.thread_err db 'Cannot create console thread!',13,10,0 |
3382 | con.thread_err db 'Cannot create console thread!',13,10,0 |
2712 | con.nomem_err db 'Not enough memory!',13,10,0 |
3383 | con.nomem_err db 'Not enough memory!',13,10,0 |
2713 | con.aFinished db ' [Finished]',0 |
3384 | con.aFinished db ' [Finished]',0 |
2714 | con.aNull db '(null)',0 |
3385 | con.aNull db '(null)',0 |
2715 | con.beep db 0x90, 0x3C, 0x00 |
3386 | con.beep db 0x90, 0x3C, 0x00 |
2716 | con.beep2 db 0x85, 0x25, 0x85, 0x40, 0x00 |
3387 | con.bell db 0x85, 0x25, 0x85, 0x40, 0x00 |
2717 | con.ipc_buf dd 0,8,0,0 |
3388 | con.ipc_buf dd 0,8,0,0 |
Line 2718... | Line 3389... | ||
2718 | db 0 |
3389 | db 0 |
Line -... | Line 3390... | ||
- | 3390 | ||
- | 3391 | section '.data' data readable writable align 16 |
|
2719 | 3392 | ||
Line 2720... | Line 3393... | ||
2720 | section '.data' data readable writable align 16 |
3393 | process_info_buffer process_info |
2721 | 3394 | ||
- | 3395 | con.finished_title rb 256 |
|
- | 3396 | ||
- | 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 |
|
2722 | con.finished_title rb 256 |
3401 | con.wnd_xpos dd ? ; Active window position in active buffer |
2723 | 3402 | con.wnd_ypos dd ? ; Active window position in active buffer |
|
2724 | con.cur_x rd 1 |
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 |
|
2725 | con.cur_y rd 1 |
3406 | con.scroll_bot dd ? ; VT100 scroll region |
2726 | con.wnd_xpos rd 1 |
3407 | |
2727 | con.wnd_ypos rd 1 |
3408 | con.wnd_width dd ? ; window width (= alt buffer width) |
- | 3409 | con.wnd_height dd ? ; window height (= alt buffer height) |
|
2728 | 3410 | con.main_scr_width dd ? ; main buffer width |
|
- | 3411 | con.main_scr_height dd ? ; main buffer height |
|
2729 | con.wnd_width rd 1 |
3412 | con.scr_width dd ? ; active buffer width |
2730 | con.wnd_height rd 1 |
3413 | con.scr_height dd ? ; active buffer height |
2731 | con.scr_width rd 1 |
3414 | con.title dd ? |
2732 | con.scr_height rd 1 |
3415 | con.data dd ? ; active buffer ptr |
2733 | con.title rd 1 |
3416 | con.mainbuffer dd ? |
2734 | con.data rd 1 |
3417 | con.altbuffer dd ? |
2735 | con.image rd 1 |
3418 | con.image dd ? |
2736 | con.console_tid rd 1 |
3419 | con.console_tid dd ? |
2737 | con.data_width rw 1 |
3420 | con.data_width dw ? ; width in pixels |
2738 | con.data_height rw 1 |
3421 | con.data_height dw ? ; height in pixels |
2739 | con.vscrollbar_size rd 1 |
3422 | con.vscrollbar_size dd ? |
2740 | con.vscrollbar_pos rd 1 |
3423 | con.vscrollbar_pos dd ? |
2741 | con.up_first_time rd 1 |
3424 | con.up_first_time dd ? |
2742 | con.down_first_time rd 1 |
3425 | con.down_first_time dd ? |
2743 | con.scroll_up_first_time rd 1 |
3426 | con.scroll_up_first_time dd ? |
2744 | con.scroll_down_first_time rd 1 |
3427 | con.scroll_down_first_time dd ? |
Line 2745... | Line 3428... | ||
2745 | con.bUpPressed_saved rb 1 |
3428 | con.bUpPressed_saved db ? |
2746 | con.bDownPressed_saved rb 1 |
3429 | con.bDownPressed_saved db ? |
Line 2747... | Line 3430... | ||
2747 | con.bScrollingUp_saved rb 1 |
3430 | con.bScrollingUp_saved db ? |
Line 2748... | Line -... | ||
2748 | con.bScrollingDown_saved rb 1 |
- | |
2749 | 3431 | con.bScrollingDown_saved db ? |
|
2750 | con.input_buffer rw 128 |
3432 | |
2751 | con.input_buffer_end = $ |
3433 | con.input_buffer rw 128 |
2752 | 3434 | con.input_buffer_end = $ |
|
2753 | con.kbd_layout rb 128 |
3435 | |
Line 2754... | Line 3436... | ||
2754 | 3436 | con.kbd_layout rb 128 |
|
2755 | ; 1 = exit, 2 = set title, 3 = redraw, 4 = getch |
3437 |