cObj program added (author: Albom)

git-svn-id: svn://kolibrios.org@1655 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Nasarus 2010-10-11 19:36:46 +00:00
parent 52ac68520a
commit 7ef2a89c79
4 changed files with 159 additions and 0 deletions

View File

@ -96,6 +96,7 @@ fasm develop\mtdbg\mtdbg.asm %BIN%\develop\mtdbg
rem fasm develop\param\trunk\param.asm param rem fasm develop\param\trunk\param.asm param
fasm develop\scancode\trunk\scancode.asm %BIN%\develop\scancode fasm develop\scancode\trunk\scancode.asm %BIN%\develop\scancode
fasm develop\tinypad\trunk\tinypad.asm %BIN%\tinypad fasm develop\tinypad\trunk\tinypad.asm %BIN%\tinypad
fasm develop\cObj\trunk\cObj.asm %BIN%\develop\cObj
echo * echo *
echo Building systems libraries echo Building systems libraries

View File

@ -0,0 +1,5 @@
@echo lang fix en >lang.inc
@fasm cObj.asm cObj
@kpack cObj
@erase lang.inc
@pause

View File

@ -0,0 +1,5 @@
@echo lang fix ru >lang.inc
@fasm cObj.asm cObj
@kpack cObj
@erase lang.inc
@pause

View File

@ -0,0 +1,148 @@
use32
org 0
db 'MENUET01'
dd 1
dd _start
dd _end
dd _memory
dd _stack
dd _param
dd 0
;=========================================
_start:
mov ah, byte [_param]
test ah, ah
jz _exit
call console_lib_init
push cobj_caption
push -1
push -1
push -1
push -1
call [con_init]
mov eax, 68
mov ebx, 19
mov ecx, _param
int 0x40
test eax, eax
jz _exit_and_close_console
mov edx, eax
_main_loop:
cmp dword [edx], 0
je _exit_and_close_console
push dword [edx]
push specification
call [con_printf]
add esp, 8
add edx, 8
jmp _main_loop
_exit_and_close_console:
push 0
call [con_exit]
_exit:
mov eax, -1
int 0x40
;=========================================
console_lib_init:
; load DLL
mov eax, 68
mov ebx, 19
mov ecx, console_lib_name
int 0x40
test eax, eax
jz _exit
; initialize import
mov edx, eax
mov esi, console_lib_import
import_loop:
lodsd
test eax, eax
jz import_done
push edx
import_find:
mov ebx, [edx]
test ebx, ebx
jz _exit;import_not_found
push eax
@@:
mov cl, [eax]
cmp cl, [ebx]
jnz import_find_next
test cl, cl
jz import_found
inc eax
inc ebx
jmp @b
import_find_next:
pop eax
add edx, 8
jmp import_find
import_found:
pop eax
mov eax, [edx+4]
mov [esi-4], eax
pop edx
jmp import_loop
import_done:
ret
;=========================================
console_lib_name db '/sys/lib/console.obj',0
align 4
console_lib_import:
dll_start dd aStart
con_init dd aConInit
con_exit dd aConExit
con_printf dd aCon_printf
dd 0
aStart db 'START',0
aConInit db 'con_init',0
aConExit db 'con_exit',0
aCon_printf db 'con_printf',0
;=========================================
cobj_caption db 'cObj v0.2 by Albom',0
specification db '%s',13,10,0
;=========================================
_param:
db 0
rb 256
_end:
align 32
rb 2048
_stack:
_memory:
;=========================================