Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 8823 → Rev 8824

/programs/bcc32/include/kolibri.h
121,10 → 121,11
void DebugPutChar(char c); // Put the character to the debug board.
void DebugPutString(const char *s); // Put the string to the debug board.
int GetKey(); // Return key pressed by user or -1 if no key was pressed.
int GetMouseButton(); // Return buttons pressed: 0 - no buttons, 1 - left button, 2 - right button, 3 - both buttons.
void GetMousePosition(short &x, short &y, bool absolute = false);
// Write mouse position to (x) and (y): absolute if (absolute) is true and relative the window otherwise.
void GetMousePosPicture(short &x, short &y);
int GetMouseButton(); // Return buttons pressed: bit 0 - left button, bit 1 - right button...
void GetMouseScrollData(short &x, short &y);
 
int GetThreadNumber(); // Return the number of threads currently executing.
bool WasThreadCreated(); // Return true if there was created at least one thread except the main thred.
/programs/bcc32/include/kos_func.inc
1030,21 → 1030,34
endp
 
align 4
proc @Kolibri@GetMousePosition$qrst1o uses ebx
mov eax,SF_MOUSE_GET
xor ebx,ebx ;SSF_SCREEN_POSITION
cmp byte [esp+16],0
jnz @f
inc ebx ;SSF_WINDOW_POSITION
@@:
int 0x40
mov ecx,[esp+12]
mov word [ecx],ax
mov ecx,[esp+8]
shr eax,16
mov word [ecx],ax
ret
endp
 
align 4
proc @Kolibri@GetMouseButton$qv uses ebx
mov eax,SF_MOUSE_GET
mov ebx,SSF_BUTTON
mov ebx,SSF_BUTTON_EXT
int 0x40
ret
endp
 
align 4
proc @Kolibri@GetMousePosition$qrst1o uses ebx
proc @Kolibri@GetMouseScrollData$qrst1 uses ebx
mov eax,SF_MOUSE_GET
xor ebx,ebx ;SSF_SCREEN_POSITION
cmp byte [esp+16],0
jnz .get_mouse_pos_absolute
inc ebx
.get_mouse_pos_absolute:
mov ebx,SSF_SCROLL_DATA
int 0x40
mov ecx,[esp+12]
mov word [ecx],ax
/programs/bcc32/include/kos_heap.inc
1,13 → 1,13
;/***
 
KolibriHeapInit = @Kolibri@HeapInit$qv
 
KolibriHeapAlloc = @Kolibri@Alloc$qul
 
KolibriHeapReAlloc = @Kolibri@ReAlloc$qpvul
 
KolibriHeapFree = @Kolibri@Free$qpv
 
@$bnwa$qui equ @Kolibri@Alloc$qul ;new variable
@$bnew$qui equ @Kolibri@Alloc$qul ;new struct or class
@$bdele$qpv equ @Kolibri@Free$qpv ;delete
 
align 4
proc @Kolibri@HeapInit$qv uses ebx
mov eax,SF_SYS_MISC
43,5 → 43,3
int 0x40
ret
endp
 
;/**/
/programs/bcc32/include/kos_lib.h
1,16 → 1,13
#ifndef __KOLIBRI_LIB_H_INCLUDED_
#define __KOLIBRI_LIB_H_INCLUDED_
 
// Kolibri interface.
unsigned int strlen(const char *str);
char *strcpy(char *dest, const char *src);
void *memcpy(void *dest, const void *src, unsigned int n);
void *memset(void *s, char c, unsigned int n);
int strcmp(const char *str1, const char *str2);
char *strchr(const char *str, int ch);
char *strstr(const char *str1, const char *str2);
 
namespace Kolibri // All kolibri functions, types and data are nested in the (Kolibri) namespace.
{
unsigned int StrLen(const char *str);
char *StrCopy(char *dest, const char *src);
void *MemCopy(void *dest, const void *src, unsigned int n);
void *MemSet(void *s, char c, unsigned int n);
 
double Floor(double x);
}
 
#endif // __KOLIBRI_LIB_H_INCLUDED_
double floor(double x);
const char *DoubleToStr(double x, unsigned short digits = 5, bool crop_0 = false);
double StrToDouble(char *str);
long StrToInt(char *str);
/programs/bcc32/include/kos_lib.inc
1,34 → 1,149
proc @Kolibri@StrLen$qpxc uses edi
include "..\..\..\develop\info3ds\info_fun_float.inc"
 
align 4
proc @DoubleToStr$qduso uses esi edi
cld
lea esi,[esp+12]
mov edi,Data_Double
movsd
movsd
mov ax,[esp+20]
mov [NumberSymbolsAD],ax
call DoubleFloat_to_String
cmp dword[esp+24],0
je @f
call String_crop_0
@@:
mov eax,Data_String
ret
endp
 
align 4
proc @StrToDouble$qpc uses esi edi
cld
mov edi,Data_String
mov esi,[esp+12]
mov ecx,32
repnz movsb
call String_to_DoubleFloat
fld qword[Data_Double]
ret
endp
 
;input:
; *str - указатель на строку, число должно быть в 10 или 16 ричном виде
;output:
; eax - число
align 4
proc @StrToInt$qpc uses ebx esi
xor eax,eax
xor ebx,ebx
mov esi,[esp+12]
 
;на случай если перед числом находятся пробелы
@@:
cmp byte[esi],' '
jne @f
inc esi
jmp @b
@@:
 
;определение отрицательных чисел
xor ecx,ecx
inc ecx
cmp byte[esi],'-'
jne @f
dec ecx
inc esi
@@:
 
cmp word[esi],'0x'
je .load_digit_16
 
.load_digit_10: ;считывание 10-тичных цифр
mov bl,byte[esi]
cmp bl,'0'
jl @f
cmp bl,'9'
jg @f
sub bl,'0'
imul eax,10
add eax,ebx
inc esi
jmp .load_digit_10
jmp @f
 
.load_digit_16: ;считывание 16-ричных цифр
add esi,2
.cycle_16:
mov bl,byte[esi]
cmp bl,'0'
jl @f
cmp bl,'f'
jg @f
cmp bl,'9'
jle .us1
cmp bl,'A'
jl @f ;отсеиваем символы >'9' и <'A'
.us1: ;составное условие
cmp bl,'F'
jle .us2
cmp bl,'a'
jl @f ;отсеиваем символы >'F' и <'a'
sub bl,32 ;переводим символы в верхний регистр, для упрощения их последущей обработки
.us2: ;составное условие
sub bl,'0'
cmp bl,9
jle .cor1
sub bl,7 ;convert 'A' to '10'
.cor1:
shl eax,4
add eax,ebx
inc esi
jmp .cycle_16
@@:
or ecx,ecx ;если число отрицательное
jnz @f
sub ecx,eax
mov eax,ecx
@@:
ret
endp
 
align 4
proc @strlen$qpxc uses edi
cld
mov edi,[esp+8]
mov ecx,-1
xor al,al
repnz scas byte [edi]
repnz scasb
not ecx
lea eax,[ecx-1]
ret
endp
 
proc @Kolibri@StrCopy$qpcpxc uses esi edi
align 4
proc @strcpy$qpcpxc uses esi edi
cld
mov edi,[esp+16]
mov ecx,-1
mov esi,edi
xor al,al
repnz scas byte [edi]
repnz scasb
not ecx
mov edi,[esp+12]
mov edx,ecx
mov eax,edi
shr ecx,2
rep movs dword [edi],[esi]
rep movsd
mov ecx,edx
and ecx,3
rep movs byte [edi],[esi]
rep movsb
ret
endp
 
proc @Kolibri@MemCopy$qpvpxvui uses esi edi
align 4
proc @memcpy$qpvpxvui uses esi edi
cld
mov edi,[esp+12]
mov eax,edi
36,14 → 151,15
mov esi,[esp+16]
mov edx,ecx
shr ecx,2
rep movs dword [edi],[esi]
rep movsd
mov ecx,edx
and ecx,3
rep movs byte [edi],[esi]
rep movsb
ret
endp
 
proc @Kolibri@MemSet$qpvcui uses edi
align 4
proc @memset$qpvcui uses edi
cld
mov edi,[esp+8]
mov al,[esp+12]
54,14 → 170,86
mov ecx,[esp+16]
mov edx,ecx
shr ecx,2
rep stos dword [edi]
rep stosd
mov ecx,edx
and ecx,3
rep stos byte [edi]
rep stosb
mov eax,[esp+4]
ret
endp
 
align 4
proc @strcmp$qpxct1 uses esi edi
cld
xor eax,eax
mov edi,[esp+16]
mov esi,edi
mov ecx,-1
repne scasb
not ecx
mov edi,esi
mov esi,[esp+12]
repe cmpsb
mov al,[esi-1]
movzx edx,byte[edi-1]
sub eax,edx
ret
endp
 
align 4
proc @strchr$qpxci uses edi
mov edi,[esp+8]
mov edx,edi
mov ecx,-1
xor eax,eax
cld
repne scasb
not ecx
mov edi,edx
mov al,[esp+12]
repne scasb
jnz @f
lea eax,[edi-1]
ret
@@:
xor eax,eax
ret
endp
 
align 4
proc @strstr$qpxct1 uses ebx esi edi
xor eax,eax
mov esi,[esp+16]
test esi,esi
je .not_f
mov edi,[esp+20]
test edi,edi
je .not_f
mov edx,edi
mov ecx,-1
cld
repne scasb
not ecx
mov ebx,ecx ;ebx = strlen(str2)
align 4
.cycle:
cmp byte[esi],0
je .not_f
mov edi,edx
push esi
mov ecx,ebx
repe cmpsb
pop esi
inc esi
cmp byte[edi-1],0
jne .cycle
 
lea eax,[esi-1]
.not_f:
ret
endp
 
align 4
proc __ftol
sub esp,12
wait
79,7 → 267,8
ret
endp
 
proc @Kolibri@Floor$qd
align 4
proc @floor$qd
fld qword [esp+4]
mov ax,[esp+10]
shl ax,1
103,4 → 292,3
.floor_end:
ret
endp
 
/programs/bcc32/include/kos_unpack.h
0,0 → 1,5
void __stdcall unpack(void* packed_data, void* unpacked_data);
 
asm{
include '..\..\include\kos_unpack.inc'
}
/programs/bcc32/include/kos_unpack.inc
0,0 → 1,7
@@unpack$qqspvt1 equ unpack
 
include "..\..\..\system\skincfg\trunk\kglobals.inc"
include "..\..\..\system\skincfg\trunk\unpacker.inc"
 
IncludeIGlobals
IncludeUGlobals
/programs/bcc32/include/l_tinygl.h
756,7 → 756,7
void (__stdcall* glScalef)(float x, float y, float z) = (void (__stdcall*)(float, float, float))&"glScalef";
void (__stdcall* glViewport)(int x, int y, int width, int height) = (void (__stdcall*)(int, int, int, int))&"glViewport";
void (__stdcall* glFrustum)(double l, double r, double b, double t, double n, double f) = (void (__stdcall*)(double, double, double, double, double, double))&"glFrustum";
void (__stdcall* glGenLists)(int range) = (void (__stdcall*)(int))&"glGenLists";
int (__stdcall* glGenLists)(int range) = (int (__stdcall*)(int))&"glGenLists";
//void (__stdcall* glIsList)(...) = (void (__stdcall*)(...))&"glIsList";
void (__stdcall* glNewList)(unsigned int list, int mode) = (void (__stdcall*)(unsigned int, int))&"glNewList";
void (__stdcall* glEndList)() = (void (__stdcall*)())&"glEndList";