Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 7925 → Rev 7924

/programs/develop/ktcc/trunk/lib/http/head.asm
File deleted
/programs/develop/ktcc/trunk/lib/http/__lib__.asm
File deleted
/programs/develop/ktcc/trunk/lib/http/receive.asm
File deleted
/programs/develop/ktcc/trunk/lib/http/make.bat
File deleted
\ No newline at end of file
/programs/develop/ktcc/trunk/lib/http/post.asm
File deleted
/programs/develop/ktcc/trunk/lib/http/send.asm
File deleted
/programs/develop/ktcc/trunk/lib/http/__lib__.inc
File deleted
\ No newline at end of file
/programs/develop/ktcc/trunk/lib/http/get.asm
File deleted
/programs/develop/ktcc/trunk/lib/sample/__lib__.inc
File deleted
\ No newline at end of file
/programs/develop/ktcc/trunk/lib/sample/howto.txt
File deleted
/programs/develop/ktcc/trunk/lib/sample/__lib__.asm
File deleted
/programs/develop/ktcc/trunk/lib/sample/make.bat
File deleted
\ No newline at end of file
/programs/develop/ktcc/trunk/lib/sample/sample_symbol.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/con_kbhit.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/con_printf.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/con_gets.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/__lib__.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/con_init.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/make.bat
File deleted
\ No newline at end of file
/programs/develop/ktcc/trunk/lib/console/con_get_cursor_height.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/con_set_flags.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/con_set_cursor_pos.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/con_exit.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/con_getch2.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/con_write_string.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/con_cls.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/con_gets2.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/con_getch.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/con_get_flags.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/con_write_asciiz.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/con_set_title.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/__lib__.inc
File deleted
/programs/develop/ktcc/trunk/lib/console/con_get_font_height.asm
File deleted
/programs/develop/ktcc/trunk/lib/console/con_get_cursor_pos.asm
File deleted
/programs/develop/ktcc/trunk/lib/inputbox/__lib__.asm
File deleted
/programs/develop/ktcc/trunk/lib/inputbox/make.bat
File deleted
\ No newline at end of file
/programs/develop/ktcc/trunk/lib/inputbox/InputBox.asm
File deleted
/programs/develop/ktcc/trunk/lib/inputbox/__lib__.inc
File deleted
\ No newline at end of file
/programs/develop/ktcc/trunk/samples/dynamic.c
File deleted
/programs/develop/ktcc/trunk/samples/build_all.sh
3,5 → 3,4
../tcc consoleio.c /kolibrios/develop/tcc/lib/libck.a -o consoleio
../tcc files.c /kolibrios/develop/tcc/lib/libck.a -o files
../tcc winbasics.c /kolibrios/develop/tcc/lib/libck.a -o winbasics
../tcc dynamic.c -lconsole -lhttp -linputbox
exit
/programs/develop/ktcc/trunk/bin/lib/start.o
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
/programs/develop/ktcc/trunk/libc/include/kos/http.h
File deleted
\ No newline at end of file
/programs/develop/ktcc/trunk/libc/include/kos/console.h
File deleted
/programs/develop/ktcc/trunk/libc/include/kos/inputbox.h
File deleted
/programs/develop/ktcc/trunk/libc/start/start.old.asm
File deleted
/programs/develop/ktcc/trunk/libc/start/start.asm
5,9 → 5,6
;extrn mf_init
extrn main
;include 'debug2.inc'
include '..\..\..\..\..\proc32.inc'
include '..\..\..\..\..\macros.inc'
include '..\..\..\..\..\dll.inc'
__DEBUG__=0
 
;start_:
15,7 → 12,7
db 'MENUET01' ; 1. Magic number (8 bytes)
dd 0x01 ; 2. Version of executable file
dd start ; 3. Start address
imgsz dd 0x0 ; 4. Size of image
dd 0x0 ; 4. Size of image
dd 0x100000 ; 5. Size of needed memory
dd 0x100000 ; 6. Pointer to stack
hparams dd 0x0 ; 7. Pointer to program arguments
29,6 → 26,13
mov ebx,11
int 0x40
 
;DEBUGF ' path "%s"\n params "%s"\n', .path, .params
; check for overflow
;; that not work
; mov al, [path+buf_len-1]
; or al, [params+buf_len-1]
; jnz .crash
; check if path written by OS
mov [argc], 0
mov eax, [hparams]
test eax, eax
86,16 → 90,25
jmp .parse
 
.run:
call load_imports
;DEBUGF 'call main(%x, %x) with params:\n', [argc], argv
if __DEBUG__ = 1
mov ecx, [argc]
@@:
lea esi, [ecx * 4 + argv-4]
DEBUGF '0x%x) "%s"\n', cx, [esi]
loop @b
end if
push argv
push [argc]
call main
.exit:
;DEBUGF 'Exit from prog\n';
xor eax,eax
dec eax
int 0x40
dd -1
.crash:
;DEBUGF 'E:buffer overflowed\n'
jmp .exit
;============================
push_param:
114,96 → 127,6
.dont_add:
ret
;==============================
 
;==============================
load_imports:
;==============================
;parameters
; none
;description
; imports must be located at end of image (but before BSS sections)
; the address of end of imports (next byte after imports) is located in imgsz
; look at each import from that address up to illegal import
; legal import is such that:
; first pointer points to procedure name
; and is smaller than imgsz
; second pointer points lo library name, starting with 0x55, 0xAA
; and is smaller than imgsz
; each library should be initialized as appropriate, once
; so as library is initialized, its name will be replaced 0x00
mov ebx, [imgsz] ; byte after imports
.handle_next_import:
sub ebx, 4 ; ebx = pointer to pointer to library name
mov esi, dword[ebx] ; esi = pointer to library name
push ebx
push esi
call load_library ; eax = pointer to library exports
pop esi
pop ebx
test eax, eax
jz .done
sub ebx, 4 ; ebx = pointer to pointer to symbol name
push ebx
stdcall dll.GetProcAddress, eax, dword[ebx]
pop ebx
test eax, eax
jz .fail
mov dword[ebx], eax
jmp .handle_next_import
.done:
ret
.fail:
ret
;==============================
 
;==============================
load_library:
;==============================
;parameters
; ebx: library name address
;description
; each library should be initialized as appropriate, once
; so as library is initialized, its name will be replaced 0x00
; and 4 next bytes will be set to address of library
; first two bytes of library name must be 0x55, 0xAA (is like a magic)
cld ; move esi further, not back
cmp esi, [imgsz]
ja .fail
lodsb ; al = first byte of library name
cmp al, 0x55
jne .fail
lodsb ; al = second byte of library name
cmp al, 0xAA
jne .fail
lodsb ; al = third byte of library name (0x00 if the library is already loaded)
test al, al
jnz .load
lodsd ; if we here, then third byte is 0x00 => address of library is in next 4 bytes
; now eax contains address of library
ret
.load:
dec esi ; we checked on 0 before, let's go back
mov eax, 68
mov ebx, 19
mov ecx, esi
int 0x40 ; eax = address of exports
mov byte[esi], 0 ; library is loaded, let's place 0 in first byte of name
mov [esi + 1], eax ; now next 4 bytes of library name are replaced by address of library
; call lib_init
stdcall dll.GetProcAddress, eax, lib_init_str ; eax = address of lib_init
test eax, eax
jz .ret
stdcall dll.Init, eax
.ret:
mov eax, [esi + 1] ; put address of library into eax
ret
.fail:
mov eax, 0
ret
;==============================
 
lib_init_str db 'lib_init', 0
 
public argc as '__argc'
public params as '__argv'
public path as '__path'