Rev 5618 | Rev 6067 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5618 | Rev 5835 | ||
---|---|---|---|
Line 29... | Line 29... | ||
29 | ; void __stdcall con_init(dword wnd_width, dword wnd_height, |
29 | ; void __stdcall con_init(dword wnd_width, dword wnd_height, |
30 | ; dword scr_width, dword scr_height, const char* title); |
30 | ; dword scr_width, dword scr_height, const char* title); |
Line 31... | Line 31... | ||
31 | 31 | ||
32 | align 4 |
32 | align 4 |
- | 33 | con_init: |
|
33 | con_init: |
34 | |
34 | pop eax |
35 | pop eax |
35 | pop [con.wnd_width] |
36 | pop [con.wnd_width] |
36 | pop [con.wnd_height] |
37 | pop [con.wnd_height] |
37 | pop [con.scr_width] |
38 | pop [con.scr_width] |
38 | pop [con.scr_height] |
39 | pop [con.scr_height] |
39 | pop [con.title] |
40 | pop [con.title] |
Line 40... | Line 41... | ||
40 | push eax |
41 | push eax |
Line -... | Line 42... | ||
- | 42 | ||
- | 43 | push ebx |
|
41 | 44 | ||
42 | push ebx |
45 | mov [con.init_cmd],1 |
43 | 46 | ||
44 | mov ecx, 4 |
47 | mov ecx, 4 |
45 | mov eax, con.wnd_width |
48 | mov eax, con.wnd_width |
Line 145... | Line 148... | ||
145 | ret 4 |
148 | ret 4 |
146 | @@: |
149 | @@: |
147 | mov eax, [con.cursor_height] |
150 | mov eax, [con.cursor_height] |
148 | ret 4 |
151 | ret 4 |
Line -... | Line 152... | ||
- | 152 | ||
- | 153 | con_init_check: |
|
- | 154 | mov ah,[con.init_cmd] |
|
- | 155 | test ah,ah |
|
- | 156 | jne cmd_init_yes |
|
- | 157 | ||
- | 158 | push con.title_init_console |
|
- | 159 | push -1 |
|
- | 160 | push -1 |
|
- | 161 | push -1 |
|
- | 162 | push -1 |
|
- | 163 | ||
- | 164 | call con_init |
|
- | 165 | ||
- | 166 | cmd_init_yes: |
|
- | 167 | ||
149 | 168 | ret |
|
150 | ; void __stdcall con_write_asciiz(const char* string); |
169 | ; void __stdcall con_write_asciiz(const char* string); |
- | 170 | con_write_asciiz: |
|
151 | con_write_asciiz: |
171 | call con_init_check |
152 | push ebx esi |
172 | push ebx esi |
153 | or ebx, -1 |
173 | or ebx, -1 |
154 | mov esi, [esp+12] |
174 | mov esi, [esp+12] |
155 | call con.write |
175 | call con.write |
Line 242... | Line 262... | ||
242 | dd con_printf.char |
262 | dd con_printf.char |
243 | dd con_printf.string |
263 | dd con_printf.string |
Line 244... | Line 264... | ||
244 | 264 | ||
245 | ; int __cdecl con_printf(const char* format, ...) |
265 | ; int __cdecl con_printf(const char* format, ...) |
- | 266 | con_printf: |
|
246 | con_printf: |
267 | call con_init_check |
247 | xor eax, eax |
268 | xor eax, eax |
248 | pushad |
269 | pushad |
249 | call con.get_data_ptr |
270 | call con.get_data_ptr |
250 | lea ebp, [esp+20h+8] |
271 | lea ebp, [esp+20h+8] |
Line 1285... | Line 1306... | ||
1285 | .nocursor: |
1306 | .nocursor: |
1286 | popad |
1307 | popad |
1287 | ret |
1308 | ret |
Line 1288... | Line 1309... | ||
1288 | 1309 | ||
- | 1310 | con_exit: |
|
- | 1311 | ||
- | 1312 | mov ah,[con.init_cmd] |
|
- | 1313 | test ah,ah |
|
- | 1314 | je .ret |
|
1289 | con_exit: |
1315 | |
1290 | cmp byte [esp+4], 0 |
1316 | cmp byte [esp+4], 0 |
1291 | jz .noexit |
1317 | jz .noexit |
1292 | mov [con.thread_op], 1 |
1318 | mov [con.thread_op], 1 |
- | 1319 | call con.wake |
|
1293 | call con.wake |
1320 | |
1294 | ret 4 |
1321 | ret 4 |
1295 | .noexit: |
1322 | .noexit: |
1296 | push esi |
1323 | push esi |
1297 | mov esi, [con.title] |
1324 | mov esi, [con.title] |
Line 1357... | Line 1384... | ||
1357 | .ret: |
1384 | .ret: |
1358 | ret |
1385 | ret |
Line 1359... | Line 1386... | ||
1359 | 1386 | ||
1360 | ; int __stdcall con_getch(void); |
1387 | ; int __stdcall con_getch(void); |
- | 1388 | con_getch: |
|
1361 | con_getch: |
1389 | call con_init_check |
1362 | call con.force_entered_char |
1390 | call con.force_entered_char |
1363 | test byte [con_flags+1], 2 |
1391 | test byte [con_flags+1], 2 |
1364 | jnz con_getch_closed |
1392 | jnz con_getch_closed |
1365 | movzx eax, byte [con.entered_char] |
1393 | movzx eax, byte [con.entered_char] |
Line 1375... | Line 1403... | ||
1375 | xor eax, eax |
1403 | xor eax, eax |
1376 | ret |
1404 | ret |
Line 1377... | Line 1405... | ||
1377 | 1405 | ||
1378 | ; int __stdcall con_getch2(void); |
1406 | ; int __stdcall con_getch2(void); |
- | 1407 | con_getch2: |
|
1379 | con_getch2: |
1408 | call con_init_check |
1380 | call con.force_entered_char |
1409 | call con.force_entered_char |
1381 | test byte [con_flags+1], 2 |
1410 | test byte [con_flags+1], 2 |
1382 | jnz con_getch_closed |
1411 | jnz con_getch_closed |
1383 | mov eax, 0xFFFF |
1412 | mov eax, 0xFFFF |
Line 1389... | Line 1418... | ||
1389 | pop eax |
1418 | pop eax |
1390 | push 0 |
1419 | push 0 |
1391 | push eax |
1420 | push eax |
1392 | ; char* __stdcall con_gets2(con_gets2_callback callback, char* str, int n); |
1421 | ; char* __stdcall con_gets2(con_gets2_callback callback, char* str, int n); |
1393 | con_gets2: |
1422 | con_gets2: |
- | 1423 | call con_init_check |
|
1394 | mov eax, [esp+8] ; str |
1424 | mov eax, [esp+8] ; str |
1395 | pushad |
1425 | pushad |
1396 | mov esi, eax ; str |
1426 | mov esi, eax ; str |
1397 | mov ebx, [esp+20h+12] ; n |
1427 | mov ebx, [esp+20h+12] ; n |
1398 | sub ebx, 1 |
1428 | sub ebx, 1 |
Line 1705... | Line 1735... | ||
1705 | popad |
1735 | popad |
1706 | ret 12 |
1736 | ret 12 |
Line 1707... | Line 1737... | ||
1707 | 1737 | ||
1708 | ; void __stdcall con_cls(); |
1738 | ; void __stdcall con_cls(); |
- | 1739 | con_cls: |
|
- | 1740 | mov ah,[con.init_cmd] |
|
- | 1741 | test ah,ah |
|
- | 1742 | je cmd_init_no |
|
1709 | con_cls: |
1743 | |
1710 | push edi |
1744 | push edi |
1711 | call con.write_special_char.cls |
1745 | call con.write_special_char.cls |
1712 | pop edi |
1746 | pop edi |
- | 1747 | call con.update_screen |
|
- | 1748 | ||
- | 1749 | ret |
|
- | 1750 | ||
- | 1751 | cmd_init_no: |
|
- | 1752 | ||
- | 1753 | push con.title_init_console |
|
- | 1754 | push -1 |
|
- | 1755 | push -1 |
|
- | 1756 | push -1 |
|
- | 1757 | push -1 |
|
- | 1758 | ||
- | 1759 | call con_init |
|
1713 | call con.update_screen |
1760 | |
Line 1714... | Line 1761... | ||
1714 | ret |
1761 | ret |
1715 | 1762 | ||
1716 | ; void __stdcall con_get_cursor_pos(int* px, int* py); |
1763 | ; void __stdcall con_get_cursor_pos(int* px, int* py); |
Line 2494... | Line 2541... | ||
2494 | con.def_scr_width dd 80 |
2541 | con.def_scr_width dd 80 |
2495 | con.def_scr_height dd 300 |
2542 | con.def_scr_height dd 300 |
2496 | con.def_wnd_x dd 200 |
2543 | con.def_wnd_x dd 200 |
2497 | con.def_wnd_y dd 50 |
2544 | con.def_wnd_y dd 50 |
Line -... | Line 2545... | ||
- | 2545 | ||
- | 2546 | con.init_cmd db 0 |
|
Line 2498... | Line 2547... | ||
2498 | 2547 | con.title_init_console db "Console",0 |
|
2499 | 2548 | ||
2500 | struc process_info |
2549 | struc process_info |
2501 | { |
2550 | { |
Line 2526... | Line 2575... | ||
2526 | con.vscroll_pt dd -1 |
2575 | con.vscroll_pt dd -1 |
Line 2527... | Line 2576... | ||
2527 | 2576 | ||
2528 | align 16 |
2577 | align 16 |
2529 | EXPORTS: |
2578 | EXPORTS: |
2530 | dd szStart, START |
2579 | dd szStart, START |
2531 | dd szVersion, 0x00020007 |
2580 | dd szVersion, 0x00020008 |
2532 | dd szcon_init, con_init |
2581 | dd szcon_init, con_init |
2533 | dd szcon_write_asciiz, con_write_asciiz |
2582 | dd szcon_write_asciiz, con_write_asciiz |
2534 | dd szcon_write_string, con_write_length |
2583 | dd szcon_write_string, con_write_length |
2535 | dd szcon_printf, con_printf |
2584 | dd szcon_printf, con_printf |