2007-08-24 21:33:11 +02:00
|
|
|
format ELF
|
|
|
|
section '.text' executable
|
|
|
|
|
|
|
|
public console_init
|
|
|
|
public console_printf
|
|
|
|
public console_exit
|
|
|
|
|
|
|
|
align 4
|
|
|
|
console_init:
|
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
pushad
|
2007-08-24 21:33:11 +02:00
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
mov eax,[console_init_status]
|
|
|
|
test eax,eax
|
|
|
|
jnz console_initializated
|
2007-08-24 21:33:11 +02:00
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
mov [console_init_status],1
|
2007-08-24 21:33:11 +02:00
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
mov eax,68
|
|
|
|
mov ebx,19
|
|
|
|
mov ecx,console_path
|
|
|
|
int 0x40
|
2007-08-24 21:33:11 +02:00
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
test eax,eax
|
|
|
|
jz console_not_loaded
|
2007-08-24 21:33:11 +02:00
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
mov ebx,[eax+4]
|
|
|
|
mov [con_start],ebx
|
2007-08-24 21:33:11 +02:00
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
mov ebx,[eax+4+16]
|
|
|
|
mov [con_init],ebx
|
2007-08-24 21:33:11 +02:00
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
mov ebx,[eax+4+32]
|
|
|
|
mov [con_printf],ebx
|
2007-08-24 21:33:11 +02:00
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
push 1
|
|
|
|
call [con_start]
|
2007-08-24 21:33:11 +02:00
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
push caption
|
|
|
|
push -1
|
|
|
|
push -1
|
|
|
|
push -1
|
|
|
|
push -1
|
|
|
|
call [con_init]
|
2007-08-24 21:33:11 +02:00
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
console_not_loaded:
|
2007-08-24 21:33:11 +02:00
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
console_initializated:
|
2007-08-24 21:33:11 +02:00
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
popad
|
2007-08-24 21:33:11 +02:00
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
ret
|
2007-08-24 21:33:11 +02:00
|
|
|
|
|
|
|
align 4
|
|
|
|
console_printf:
|
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
pop [return_addres]
|
2007-08-24 21:33:11 +02:00
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
call [con_printf]
|
|
|
|
;add esp,8
|
2007-08-24 21:33:11 +02:00
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
push [return_addres]
|
2007-08-24 21:33:11 +02:00
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
ret
|
2007-08-24 21:33:11 +02:00
|
|
|
|
|
|
|
align 4
|
|
|
|
console_exit:
|
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
push 0
|
|
|
|
call [con_exit]
|
2007-08-24 21:33:11 +02:00
|
|
|
|
2016-04-27 21:59:20 +02:00
|
|
|
ret
|
2007-08-24 21:33:11 +02:00
|
|
|
|
|
|
|
|
|
|
|
;-----------------------------
|
|
|
|
console_path db '/sys/dll/console.obj',0
|
|
|
|
caption db 'Console',0
|
|
|
|
|
|
|
|
align 4
|
2016-04-27 21:59:20 +02:00
|
|
|
con_start rd 1
|
|
|
|
con_init rd 1
|
|
|
|
con_printf rd 1
|
|
|
|
con_exit rd 1
|
|
|
|
console_init_status rd 1
|
|
|
|
return_addres rd 1
|