From 41086737df8dd5d764a0397cb525419c257d58e8 Mon Sep 17 00:00:00 2001 From: "Kirill Lipatov (Leency)" Date: Mon, 5 Nov 2012 11:59:41 +0000 Subject: [PATCH] c-- libraries update git-svn-id: svn://kolibrios.org@3003 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/network/htmlv/lib/kolibri.h | 23 ++++++++++++++++++----- programs/network/htmlv/lib/random.h | 11 +++++++---- programs/network/htmlv/lib/strings.h | 19 +++++++++++++++++++ programs/network/htmlv/lib/truetype.h | 25 +++++++++++++++++++++++++ programs/network/htmlv/lib/ttf_fonts.h | 20 -------------------- 5 files changed, 69 insertions(+), 29 deletions(-) create mode 100644 programs/network/htmlv/lib/truetype.h delete mode 100644 programs/network/htmlv/lib/ttf_fonts.h diff --git a/programs/network/htmlv/lib/kolibri.h b/programs/network/htmlv/lib/kolibri.h index 89c702ec38..ee3d4ea88d 100644 --- a/programs/network/htmlv/lib/kolibri.h +++ b/programs/network/htmlv/lib/kolibri.h @@ -115,7 +115,6 @@ inline fastcall ScancodesGeting(){ $int 0x40 } - inline fastcall word GetKey() //+Gluk fix { $push edx @@ -212,12 +211,11 @@ inline fastcall int KillProcess( ECX) $int 0x40 } +#define TURN_OFF 2 +#define REBOOT 3 +#define KERNEL 4 inline fastcall int ExitSystem( ECX) { - #define TURN_OFF 2 - #define REBOOT 3 - #define KERNEL 4 - $mov eax, 18 $mov ebx, 9 $int 0x40 @@ -282,6 +280,12 @@ inline fastcall int TestBit( EAX, CL) $and eax,1 } +inline fastcall int PlaySpeaker( ESI) +{ + $mov eax, 55 + $mov ebx, 55 + $int 0x40 +} //------------------------------------------------------------------------------ @@ -323,6 +327,15 @@ void WriteText(dword x,y,byte fontType, dword color, EDX, ESI) $int 0x40; } +void WriteNumber(dword x,y,byte fontType, dword color, count, ECX) +{ + EAX = 47; + EBX = count<<16; + EDX = x<<16+y; + ESI = fontType<<24+color; + $int 0x40; +} + void CopyScreen(dword EBX, x, y, sizeX, sizeY) { EAX = 36; diff --git a/programs/network/htmlv/lib/random.h b/programs/network/htmlv/lib/random.h index 11b60c117f..a6d5282f28 100644 --- a/programs/network/htmlv/lib/random.h +++ b/programs/network/htmlv/lib/random.h @@ -21,9 +21,11 @@ dword generator; // random number generator - -:int random(int max) +inline fastcall int random( ECX) // get pseudo-random number - { + $push ebx + $rdtsc // eax & edx $xor eax,edx $not eax @@ -35,11 +37,12 @@ dword generator; // random number generator - generator = EBX; EAX += EBX; - EAX = EAX % max; - return EAX; + EAX = EAX % ECX; + + $pop ebx } -:randomize() +inline fastcall randomize() // initialize random number generator - { asm diff --git a/programs/network/htmlv/lib/strings.h b/programs/network/htmlv/lib/strings.h index 1fe46ab3d0..c6f12b574c 100644 --- a/programs/network/htmlv/lib/strings.h +++ b/programs/network/htmlv/lib/strings.h @@ -10,6 +10,7 @@ // atoi( EAX) // strupr( ESI) // strlwr( ESI) +// strttl( EDX) // strtok( ESI) //------------------------------------------------------------------------------ @@ -47,6 +48,8 @@ L1: } } + + /* inline fastcall signed int strcmpi( ESI,EDI) @@ -216,6 +219,22 @@ inline fastcall strlwr( ESI) }while(AL!=0); } +inline fastcall strttl( EDX) +{ + AL=DSBYTE[EDX]; + IF(AL>='a')&&(AL<='z')DSBYTE[EDX]=AL&0x5f; + IF (AL>=160) && (AL<=175) DSBYTE[EDX] = AL - 32; //- + IF (AL>=224) && (AL<=239) DSBYTE[EDX] = AL - 80; //- + do{ + EDX++; + AL=DSBYTE[EDX]; + IF(AL>='A')&&(AL<='Z'){DSBYTE[EDX]=AL|0x20; CONTINUE;} + IF(AL>='')&&(AL<='')DSBYTE[EDX]=AL|0x20; //- + IF (AL>=144) && (AL<=159) DSBYTE[EDX] = AL + 80; //- + }while(AL!=0); +} + + inline fastcall unsigned int strstr( EBX, EDX) { diff --git a/programs/network/htmlv/lib/truetype.h b/programs/network/htmlv/lib/truetype.h new file mode 100644 index 0000000000..e6c8ffee35 --- /dev/null +++ b/programs/network/htmlv/lib/truetype.h @@ -0,0 +1,25 @@ +// + +dword libtruetype = #att; + +char att[] = "/sys/lib/truetype.obj"; //"truetype.obj\0"; + +dword truetype = #att_truetype; +dword get_length = #att_get_length; +dword get_width = #att_get_width; +dword text_out = #att_text_out; + +dword am3__ = 0x0; +dword bm3__ = 0x0; + +//import libimg , \ + +char att_truetype[] = "truetype"; +char att_get_length[] = "get_length"; +char att_get_width[] = "get_width"; +char att_text_out[] = "text_out"; + +//load_dll2(libtruetype, #truetype,0); + +// - +//text_out stdcall (#text, -1, 40, 0xFF0000, 100, 100); diff --git a/programs/network/htmlv/lib/ttf_fonts.h b/programs/network/htmlv/lib/ttf_fonts.h deleted file mode 100644 index 70a86b7651..0000000000 --- a/programs/network/htmlv/lib/ttf_fonts.h +++ /dev/null @@ -1,20 +0,0 @@ -// - -dword libtruetype = #att; - -char att[23] = "/sys/lib/truetype.obj\0"; //"truetype.obj\0"; - - -dword truetype = #att_truetype; -dword get_length = #att_get_length; -dword get_width = #att_get_width; -dword text_out = #att_text_out; - -dword am3__ = 0x0; -dword bm3__ = 0x0; - - -char att_truetype[10] = "truetype\0"; -char att_get_length[12] = "get_length\0"; -char att_get_width[11] = "get_width\0"; -char att_text_out[10] = "text_out\0"; \ No newline at end of file