cmm: decrease apps size

git-svn-id: svn://kolibrios.org@6742 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Kirill Lipatov (Leency) 2016-11-23 10:04:07 +00:00
parent e73f2a8659
commit 562beb7d6a
4 changed files with 23 additions and 19 deletions

View File

@ -50,8 +50,6 @@
#define KEY_LWIN 01000000000b #define KEY_LWIN 01000000000b
#define KEY_RWIN 10000000000b #define KEY_RWIN 10000000000b
dword calc(EAX) { return EAX; }
inline fastcall word GetKey() //+Gluk fix inline fastcall word GetKey() //+Gluk fix
{ {
$push edx $push edx

View File

@ -66,6 +66,8 @@ char program_path[4096];
#include "../lib/mouse.h" #include "../lib/mouse.h"
#include "../lib/keyboard.h" #include "../lib/keyboard.h"
:dword calc(EAX) { return EAX; }
:struct raw_image { :struct raw_image {
dword w, h, data; dword w, h, data;
}; };
@ -329,7 +331,7 @@ inline fastcall int TestBit( EAX, CL)
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword WindowAreaColor, EDI, ESI) :void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword WindowAreaColor, bgcolor, title)
{ {
EAX = 12; // function 12:tell os about windowdraw EAX = 12; // function 12:tell os about windowdraw
EBX = 1; EBX = 1;
@ -338,10 +340,12 @@ void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword Windo
$xor EAX,EAX $xor EAX,EAX
EBX = x << 16 + size_w; EBX = x << 16 + size_w;
ECX = y << 16 + size_h; ECX = y << 16 + size_h;
EDX = WindowType << 24 | WindowAreaColor; EDX = WindowType << 24 | WindowAreaColor;
EDI = bgcolor;
ESI = title;
$int 0x40 $int 0x40
EAX = 12; // function 12:tell os about windowdraw EAX = 12; // function 12:tell os about windowdraw
EBX = 2; EBX = 2;
$int 0x40 $int 0x40
@ -381,15 +385,17 @@ inline fastcall void DrawTitle( ECX)
$int 0x40; $int 0x40;
} }
dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI) :dword WriteBufText(dword x,y,byte fontType, dword color, str_offset, buf_offset)
{ {
EAX = 4; EAX = 4;
EBX = x<<16+y; EBX = x<<16+y;
ECX = fontType<<24+color; ECX = fontType<<24+color;
EDX = str_offset;
EDI = buf_offset;
$int 0x40; $int 0x40;
} }
void WriteNumber(dword x,y,byte fontType, dword color, count, number_or_offset) :void WriteNumber(dword x,y,byte fontType, dword color, count, number_or_offset)
{ {
EAX = 47; EAX = 47;
EBX = count<<16; EBX = count<<16;
@ -439,12 +445,13 @@ inline fastcall void PutPixel( EBX,ECX,EDX)
$int 0x40 $int 0x40
} }
void DrawBar(dword x,y,w,h,EDX) :void DrawBar(dword x,y,w,h,color)
{ {
if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :) if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :)
EAX = 13; EAX = 13;
EBX = x<<16+w; EBX = x<<16+w;
ECX = y<<16+h; ECX = y<<16+h;
EDX = color;
$int 0x40 $int 0x40
} }
@ -473,11 +480,13 @@ inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE)
$int 0x40 $int 0x40
} }
void UnsafeDefineButton(dword x,y,w,h,EDX,ESI) :void UnsafeDefineButton(dword x,y,w,h,id,color)
{ {
EAX = 8; EAX = 8;
EBX = x<<16+w; EBX = x<<16+w;
ECX = y<<16+h; ECX = y<<16+h;
EDX = id;
ESI = color;
$int 0x40 $int 0x40
} }
@ -608,7 +617,6 @@ void ______INIT______()
screen.width = GetScreenWidth(); screen.width = GetScreenWidth();
screen.height = GetScreenHeight(); screen.height = GetScreenHeight();
//program_path_length = strlen(I_Path);
DOUBLE_CLICK_DELAY = GetMouseDoubleClickDelay(); DOUBLE_CLICK_DELAY = GetMouseDoubleClickDelay();
__generator = GetStartTime(); __generator = GetStartTime();

View File

@ -356,9 +356,9 @@ inline fastcall void strcat( EDI, ESI)
} }
} }
void strncat(dword text1, text2, signed len) :void strncat(dword text1, text2, signed len)
signed o1,o2; signed o1,o2;
char s; char s;
{ {
s = DSBYTE[text1]; s = DSBYTE[text1];
while(s){ while(s){
@ -413,13 +413,13 @@ inline fastcall signed int strrchr( ESI,BL)
} }
int chrnum(dword searchin, char symbol) inline fastcall unsigned int chrnum( ESI, BL)
{ {
int num = 0; int num = 0;
while(DSBYTE[searchin]) while(DSBYTE[ESI])
{ {
if (DSBYTE[searchin] == symbol) num++; if (DSBYTE[ESI] == BL) num++;
searchin++; ESI++;
} }
return num; return num;
} }

View File

@ -102,11 +102,9 @@ void main()
{ {
int id; int id;
byte mouse_clicked;
dword tmp_x,tmp_y; dword tmp_x,tmp_y;
dword z1,z2; dword z1,z2;
mem_Init();
load_dll(boxlib, #box_lib_init,0); load_dll(boxlib, #box_lib_init,0);
load_dll(libio, #libio_init,1); load_dll(libio, #libio_init,1);
load_dll(libimg, #libimg_init,1); load_dll(libimg, #libimg_init,1);