Rev 853 | Rev 1134 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 853 | Rev 1133 | ||
---|---|---|---|
Line 79... | Line 79... | ||
79 | mov ecx, ebx |
79 | mov ecx, ebx |
80 | mov [con.image], edi |
80 | mov [con.image], edi |
81 | xor eax, eax |
81 | xor eax, eax |
82 | rep stosb |
82 | rep stosb |
83 | pop edi |
83 | pop edi |
- | 84 | and byte [con_flags+1], not 2 |
|
84 | ; create console thread |
85 | ; create console thread |
85 | push 51 |
86 | push 51 |
86 | pop eax |
87 | pop eax |
87 | xor ebx, ebx |
88 | xor ebx, ebx |
88 | inc ebx |
89 | inc ebx |
Line 117... | Line 118... | ||
117 | ret |
118 | ret |
Line 118... | Line 119... | ||
118 | 119 | ||
119 | ; dword __stdcall con_set_flags(dword flags); |
120 | ; dword __stdcall con_set_flags(dword flags); |
120 | con_set_flags: |
121 | con_set_flags: |
- | 122 | mov eax, [esp+4] |
|
121 | mov eax, [esp+4] |
123 | and ah, not 2 |
122 | xchg eax, [con_flags] |
124 | xchg eax, [con_flags] |
Line 123... | Line 125... | ||
123 | ret 4 |
125 | ret 4 |
124 | 126 | ||
Line 1176... | Line 1178... | ||
1176 | call con.wake |
1178 | call con.wake |
1177 | ret 4 |
1179 | ret 4 |
Line 1178... | Line 1180... | ||
1178 | 1180 | ||
1179 | ; int __stdcall con_kbhit(void); |
1181 | ; int __stdcall con_kbhit(void); |
- | 1182 | con_kbhit: |
|
- | 1183 | test byte [con_flags+1], 2 |
|
1180 | con_kbhit: |
1184 | jnz @f |
1181 | mov eax, [con.input_start] |
1185 | mov eax, [con.input_start] |
- | 1186 | cmp eax, [con.input_end] |
|
1182 | cmp eax, [con.input_end] |
1187 | @@: |
1183 | setnz al |
1188 | setnz al |
1184 | movzx eax, al |
1189 | movzx eax, al |
Line 1185... | Line 1190... | ||
1185 | ret |
1190 | ret |
1186 | 1191 | ||
1187 | con.force_entered_char: |
1192 | con.force_entered_char: |
1188 | cmp [con.entered_char], -1 |
1193 | cmp [con.entered_char], -1 |
1189 | jnz .ret |
1194 | jnz .ret |
- | 1195 | mov [con.thread_op], 4 |
|
- | 1196 | call con.wake |
|
1190 | mov [con.thread_op], 4 |
1197 | test byte [con_flags+1], 2 |
1191 | call con.wake |
1198 | jnz .ret |
1192 | ; wait for response |
1199 | ; wait for response |
1193 | push ebx |
1200 | push ebx |
1194 | push 5 |
1201 | push 5 |
Line 1204... | Line 1211... | ||
1204 | ret |
1211 | ret |
Line 1205... | Line 1212... | ||
1205 | 1212 | ||
1206 | ; int __stdcall con_getch(void); |
1213 | ; int __stdcall con_getch(void); |
1207 | con_getch: |
1214 | con_getch: |
- | 1215 | call con.force_entered_char |
|
- | 1216 | test byte [con_flags+1], 2 |
|
1208 | call con.force_entered_char |
1217 | jnz con_getch_closed |
1209 | movzx eax, byte [con.entered_char] |
1218 | movzx eax, byte [con.entered_char] |
1210 | sar [con.entered_char], 8 |
1219 | sar [con.entered_char], 8 |
1211 | mov byte [con.entered_char+1], 0xFF |
1220 | mov byte [con.entered_char+1], 0xFF |
1212 | test al, al |
1221 | test al, al |
1213 | jz @f |
1222 | jz @f |
1214 | mov byte [con.entered_char], 0xFF |
1223 | mov byte [con.entered_char], 0xFF |
1215 | @@: |
1224 | @@: |
Line -... | Line 1225... | ||
- | 1225 | ret |
|
- | 1226 | ||
- | 1227 | con_getch_closed: |
|
- | 1228 | or eax, -1 |
|
1216 | ret |
1229 | ret |
1217 | 1230 | ||
1218 | ; int __stdcall con_getch2(void); |
1231 | ; int __stdcall con_getch2(void); |
- | 1232 | con_getch2: |
|
- | 1233 | call con.force_entered_char |
|
1219 | con_getch2: |
1234 | test byte [con_flags+1], 2 |
1220 | call con.force_entered_char |
1235 | jnz con_getch_closed |
1221 | mov eax, 0xFFFF |
1236 | mov eax, 0xFFFF |
Line 1222... | Line 1237... | ||
1222 | xchg ax, [con.entered_char] |
1237 | xchg ax, [con.entered_char] |
1223 | ret |
1238 | ret |
1224 | 1239 | ||
1225 | ; void __stdcall con_gets(char* str, int n); |
1240 | ; char* __stdcall con_gets(char* str, int n); |
1226 | con_gets: |
1241 | con_gets: |
1227 | pop eax |
1242 | pop eax |
1228 | push 0 |
1243 | push 0 |
- | 1244 | push eax |
|
1229 | push eax |
1245 | ; char* __stdcall con_gets2(con_gets2_callback callback, char* str, int n); |
1230 | ; void __stdcall con_gets2(con_gets2_callback callback, char* str, int n); |
1246 | con_gets2: |
1231 | con_gets2: |
1247 | mov eax, [esp+8] ; str |
1232 | pushad |
1248 | pushad |
1233 | mov esi, [esp+20h+8] ; str |
1249 | mov esi, eax ; str |
1234 | mov ebx, [esp+20h+12] ; n |
1250 | mov ebx, [esp+20h+12] ; n |
1235 | sub ebx, 1 |
1251 | sub ebx, 1 |
1236 | jle .ret |
1252 | jle .ret |
1237 | mov byte [esi], 0 |
1253 | mov byte [esi], 0 |
1238 | xor ecx, ecx ; ¤«¨ 㦥 ¢¢¥¤ñ®© áâப¨ |
1254 | xor ecx, ecx ; ¤«¨ 㦥 ¢¢¥¤ñ®© áâப¨ |
- | 1255 | call con.get_data_ptr |
|
- | 1256 | .loop: |
|
1239 | call con.get_data_ptr |
1257 | call con_getch2 |
1240 | .loop: |
1258 | cmp eax, -1 |
1241 | call con_getch2 |
1259 | jz .closed |
1242 | test al, al |
1260 | test al, al |
1243 | jz .extended |
1261 | jz .extended |
Line 1532... | Line 1550... | ||
1532 | call con.write_char_ex |
1550 | call con.write_char_ex |
1533 | jmp .end |
1551 | jmp .end |
1534 | @@: |
1552 | @@: |
1535 | dec esi |
1553 | dec esi |
1536 | jmp .update_screen_and_loop |
1554 | jmp .update_screen_and_loop |
- | 1555 | .closed: |
|
- | 1556 | and dword [esp+1Ch], 0 |
|
1537 | .ret: |
1557 | .ret: |
1538 | popad |
1558 | popad |
1539 | ret 12 |
1559 | ret 12 |
Line 1540... | Line 1560... | ||
1540 | 1560 | ||
Line 1603... | Line 1623... | ||
1603 | push 60 |
1623 | push 60 |
1604 | pop eax |
1624 | pop eax |
1605 | push 2 |
1625 | push 2 |
1606 | pop ebx |
1626 | pop ebx |
1607 | mov ecx, [con.console_tid] |
1627 | mov ecx, [con.console_tid] |
- | 1628 | jecxz .ret |
|
1608 | mov edx, con.thread_op |
1629 | mov edx, con.thread_op |
1609 | push 1 |
1630 | push 1 |
1610 | pop esi |
1631 | pop esi |
1611 | int 0x40 |
1632 | int 0x40 |
1612 | test eax, eax |
1633 | test eax, eax |
Line 1664... | Line 1685... | ||
1664 | jz con.ipc |
1685 | jz con.ipc |
1665 | jmp con.mouse |
1686 | jmp con.mouse |
1666 | con.button: |
1687 | con.button: |
1667 | ; we have only one button, close |
1688 | ; we have only one button, close |
1668 | con.thread_exit: |
1689 | con.thread_exit: |
- | 1690 | or byte [con_flags+1], 2 |
|
- | 1691 | and [con.console_tid], 0 |
|
1669 | or eax, -1 |
1692 | or eax, -1 |
1670 | int 0x40 |
1693 | int 0x40 |
1671 | con.key: |
1694 | con.key: |
1672 | mov al, 2 |
1695 | mov al, 2 |
1673 | int 0x40 |
1696 | int 0x40 |
Line 2247... | Line 2270... | ||
2247 | con.vscroll_pt dd -1 |
2270 | con.vscroll_pt dd -1 |
Line 2248... | Line 2271... | ||
2248 | 2271 | ||
2249 | align 16 |
2272 | align 16 |
2250 | EXPORTS: |
2273 | EXPORTS: |
2251 | dd szStart, START |
2274 | dd szStart, START |
2252 | dd szVersion, 0x00020005 |
2275 | dd szVersion, 0x00020006 |
2253 | dd szcon_init, con_init |
2276 | dd szcon_init, con_init |
2254 | dd szcon_write_asciiz, con_write_asciiz |
2277 | dd szcon_write_asciiz, con_write_asciiz |
2255 | dd szcon_printf, con_printf |
2278 | dd szcon_printf, con_printf |
2256 | dd szcon_exit, con_exit |
2279 | dd szcon_exit, con_exit |