Console: new ver.

git-svn-id: svn://kolibrios.org@5835 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
pavelyakov 2015-10-09 10:00:02 +00:00
parent 1d2cc3a517
commit 2fadaa9c40

View File

@ -31,6 +31,7 @@ START:
align 4 align 4
con_init: con_init:
pop eax pop eax
pop [con.wnd_width] pop [con.wnd_width]
pop [con.wnd_height] pop [con.wnd_height]
@ -41,6 +42,8 @@ con_init:
push ebx push ebx
mov [con.init_cmd],1
mov ecx, 4 mov ecx, 4
mov eax, con.wnd_width mov eax, con.wnd_width
mov edx, con.def_wnd_width mov edx, con.def_wnd_width
@ -147,8 +150,25 @@ con_set_cursor_height:
mov eax, [con.cursor_height] mov eax, [con.cursor_height]
ret 4 ret 4
con_init_check:
mov ah,[con.init_cmd]
test ah,ah
jne cmd_init_yes
push con.title_init_console
push -1
push -1
push -1
push -1
call con_init
cmd_init_yes:
ret
; void __stdcall con_write_asciiz(const char* string); ; void __stdcall con_write_asciiz(const char* string);
con_write_asciiz: con_write_asciiz:
call con_init_check
push ebx esi push ebx esi
or ebx, -1 or ebx, -1
mov esi, [esp+12] mov esi, [esp+12]
@ -244,6 +264,7 @@ con.charjump:
; int __cdecl con_printf(const char* format, ...) ; int __cdecl con_printf(const char* format, ...)
con_printf: con_printf:
call con_init_check
xor eax, eax xor eax, eax
pushad pushad
call con.get_data_ptr call con.get_data_ptr
@ -1287,10 +1308,16 @@ end if
ret ret
con_exit: con_exit:
mov ah,[con.init_cmd]
test ah,ah
je .ret
cmp byte [esp+4], 0 cmp byte [esp+4], 0
jz .noexit jz .noexit
mov [con.thread_op], 1 mov [con.thread_op], 1
call con.wake call con.wake
ret 4 ret 4
.noexit: .noexit:
push esi push esi
@ -1359,6 +1386,7 @@ con.force_entered_char:
; int __stdcall con_getch(void); ; int __stdcall con_getch(void);
con_getch: con_getch:
call con_init_check
call con.force_entered_char call con.force_entered_char
test byte [con_flags+1], 2 test byte [con_flags+1], 2
jnz con_getch_closed jnz con_getch_closed
@ -1377,6 +1405,7 @@ con_getch_closed:
; int __stdcall con_getch2(void); ; int __stdcall con_getch2(void);
con_getch2: con_getch2:
call con_init_check
call con.force_entered_char call con.force_entered_char
test byte [con_flags+1], 2 test byte [con_flags+1], 2
jnz con_getch_closed jnz con_getch_closed
@ -1391,6 +1420,7 @@ con_gets:
push eax push eax
; char* __stdcall con_gets2(con_gets2_callback callback, char* str, int n); ; char* __stdcall con_gets2(con_gets2_callback callback, char* str, int n);
con_gets2: con_gets2:
call con_init_check
mov eax, [esp+8] ; str mov eax, [esp+8] ; str
pushad pushad
mov esi, eax ; str mov esi, eax ; str
@ -1707,10 +1737,27 @@ con_gets2:
; void __stdcall con_cls(); ; void __stdcall con_cls();
con_cls: con_cls:
mov ah,[con.init_cmd]
test ah,ah
je cmd_init_no
push edi push edi
call con.write_special_char.cls call con.write_special_char.cls
pop edi pop edi
call con.update_screen call con.update_screen
ret
cmd_init_no:
push con.title_init_console
push -1
push -1
push -1
push -1
call con_init
ret ret
; void __stdcall con_get_cursor_pos(int* px, int* py); ; void __stdcall con_get_cursor_pos(int* px, int* py);
@ -2496,6 +2543,8 @@ con.def_scr_height dd 300
con.def_wnd_x dd 200 con.def_wnd_x dd 200
con.def_wnd_y dd 50 con.def_wnd_y dd 50
con.init_cmd db 0
con.title_init_console db "Console",0
struc process_info struc process_info
{ {
@ -2528,7 +2577,7 @@ con.vscroll_pt dd -1
align 16 align 16
EXPORTS: EXPORTS:
dd szStart, START dd szStart, START
dd szVersion, 0x00020007 dd szVersion, 0x00020008
dd szcon_init, con_init dd szcon_init, con_init
dd szcon_write_asciiz, con_write_asciiz dd szcon_write_asciiz, con_write_asciiz
dd szcon_write_string, con_write_length dd szcon_write_string, con_write_length