Subversion Repositories Kolibri OS

Compare Revisions

Regard whitespace Rev 1970 → Rev 1971

/programs/network/htmlv/lib/dll.h--
0,0 → 1,173
//Asper
char a_libdir[43] = "/sys/lib/\0";
 
 
//proc dll.Load, import_table:dword
int dll_Load(dword import_table)
{
$mov esi, import_table
@next_lib: $mov edx, DSDWORD[esi]
$or edx,edx
$jz exit_
$push esi
$mov esi,DSDWORD[esi+4]
$mov edi,#a_libdir
$push edi
$push esi
EAX=strlen(#a_libdir);
$pop esi
$pop edi
$add edi, eax //9
@loc01: $lodsb
$stosb
$or al,al
$jnz loc01
 
//IntToStr(EBX);
//$push edx
//WriteDebug(#a_libdir);
//$pop edx
//mcall 68,19,a_libdir
$mov eax, 68
$mov ebx, 19
$mov ecx,#a_libdir
$int 0x40
$or eax,eax
$jz fail
//stdcall dll.Link,eax,edx
dll_Link(EAX, EDX);
$push eax
$mov eax, DSDWORD [eax]
$cmp DSDWORD [eax], 'lib_'
$pop eax
//$jnz loc02
//IntToStr(EBX);
//$push eax
//WriteDebug(DSDWORD[EAX]);
//$pop eax
//stdcall dll.Init,[eax+4]
//dll_Init(DSDWORD[EAX]); //dll_Init(DSDWORD[EAX+4]);
@loc02:
$pop esi
$add esi,8
$jmp next_lib
@exit_: $xor eax,eax
return 0;
@fail: $add esp,4
$xor eax,eax
$inc eax
return -1;
}
 
//proc dll.Link, exp:dword,imp:dword
void dll_Link(dword exp, imp)
{
$push eax
$mov esi, imp
$test esi, esi
$jz done
@next: $lodsd
$test eax,eax
$jz done
 
//stdcall dll.GetProcAddress,[exp],eax
dll_GetProcAddress(exp,EAX);
$or eax,eax
$jz loc03
 
$mov DSDWORD[esi-4],eax
$jmp next
@loc03:
$mov DSDWORD[esp],0
@done: $pop eax
}
 
//proc dll.Init, dllentry:dword
void dll_Init(dword dllentry)
{
$pushad
EAX=#mem_Alloc;
EBX=#mem_Free;
ECX=#mem_ReAlloc;
EDX=#dll_Load;
DSDWORD [dllentry+4] stdcall ();
$popad
}
 
//proc dll.GetProcAddress, exp:dword,sz_name:dword
dword dll_GetProcAddress(dword exp, sz_name)
{
$push esi
$mov edx, exp
$xor eax,eax
@next: $or edx,edx
$jz end_
$cmp edx,0
$jz end_
strcmp(DSDWORD[EDX],sz_name);
$test eax,eax
$jz ok
$add edx,8
$jmp next
@ok:
$mov eax, DSDWORD[edx+4]
@end_:
$pop esi
return EAX;
}
 
 
int load_dll2(dword dllname, import_table, byte need_init)
{
//dword dllentry=0;
// load DLL
$mov eax, 68
$mov ebx, 19
ECX=dllname;
$int 0x40
$test eax, eax
$jz exit01
 
// initialize import
$mov edx,eax
ESI=import_table;
 
@import_loop01:
$lodsd
$test eax,eax
$jz import_done01
$push edx
@import_find01:
$mov ebx,DSDWORD[EDX]
$test ebx, ebx
$jz exit01
$push eax
@nex101:
$mov cl,DSBYTE[EAX];
$cmp cl,DSBYTE[EBX];
$jnz import_find_next01
$test cl,cl
$jz import_found01
$inc eax
$inc ebx
$jmp nex101
@import_find_next01:
$pop eax
$add edx, 8
$jmp import_find01
@import_found01:
$pop eax
$mov eax,DSDWORD[edx+4]
$mov DSDWORD[esi-4],eax
$pop edx
$jmp import_loop01
@import_done01:
IF (need_init) dll_Init(EDX);
return 0;
@exit01:
return -1;
}
/programs/network/htmlv/lib/edit_box_lib.h--
0,0 → 1,49
//BOX_LIB
dword boxlib = #aEdit_box_lib; //Asper
char aEdit_box_lib[22]="/sys/lib/box_lib.obj\0"; //Asper
 
dword edit_box_draw = #aEdit_box_draw;
dword edit_box_key = #aEdit_box_key;
dword edit_box_mouse = #aEdit_box_mouse;
dword version_ed = #aVersion_ed;
 
dword am__ = 0x0;
dword bm__ = 0x0;
 
char aEdit_box_draw[9] = "edit_box\0";
char aEdit_box_key[13] = "edit_box_key\0";
char aEdit_box_mouse[15] = "edit_box_mouse\0";
char aVersion_ed[11] = "version_ed\0";
 
char aCheck_box_draw [15] = "check_box_draw\0";
char aCheck_box_mouse [16] = "check_box_mouse\0";
char aVersion_ch [11] = "version_ch\0";
 
char aOption_box_draw [16] = "option_box_draw\0";
char aOption_box_mouse[17] = "option_box_mouse\0";
char aVersion_op [11] = "version_op\0" ;
 
 
struct edit_box{
dword width, left, top, color, shift_color, focus_border_color, blur_border_color,
text_color, max, text, mouse_variable, flags, size, pos, offset, cl_curs_x, cl_curs_y, shift, shift_old;
};
 
//ed_width equ [edi] ;è¨à¨­  ª®¬¯®­¥­â 
//ed_left equ [edi+4] ;¯®«®¦¥­¨¥ ¯® ®á¨ å
//ed_top equ [edi+8] ;¯®«®¦¥­¨¥ ¯® ®á¨ ã
//ed_color equ [edi+12] ;梥â ä®­  ª®¬¯®­¥­â 
//shift_color equ [edi+16] ;=0x6a9480
//ed_focus_border_color equ [edi+20] ;梥â à ¬ª¨ ª®¬¯®­¥­â 
//ed_blur_border_color equ [edi+24] ;梥⠭¥  ªâ¨¢­®£® ª®¬¯®­¥­â 
//ed_text_color equ [edi+28] ;梥â ⥪áâ 
//ed_max equ [edi+32] ;ª®«-¢® ᨬ¢®«®¢ ª®â®àë¥ ¬®¦­® ¬ ªá¨¬ «ì­® ¢¢¥áâ¨
//ed_text equ [edi+36] ;㪠§ â¥«ì ­  ¡ãä¥à
//ed_flags equ [edi+40] ;ä« £¨
//ed_size equ [edi+42] ;ª®«-¢® ᨬ¢®«®¢
//ed_pos equ [edi+46] ;¯®§¨æ¨ï ªãàá®à 
//ed_offset equ [edi+50] ;ᬥ饭¨¥
//cl_curs_x equ [edi+54] ;¯à¥¤ë¤ãé ï ª®®à¤¨­ â  ªãàá®à  ¯® å
//cl_curs_y equ [edi+58] ;¯à¥¤ë¤ãé ï ª®®à¤¨­ â  ªãàá®à  ¯® ã
//ed_shift_pos equ [edi+62] ;¯®«®¦¥­¨¥ ªãàá®à 
//ed_shift_pos_old equ [edi+66] ;áâ à®¥ ¯®«®¦¥­¨¥ ªãàá®à 
/programs/network/htmlv/lib/file_system.h--
0,0 → 1,194
struct f70{
dword func;
dword param1;
dword param2;
dword param3;
dword param4;
char rezerv;
dword name;
};
 
struct BDVK{
dword attr;
byte type_name;
byte rez1, rez2, rez3;
dword timecreate;
dword datecreate;
dword timelastaccess;
dword datelastaccess;
dword timelastedit;
dword datelastedit;
dword sizelo;
dword sizehi;
char name[518];
};
 
 
///////////////////////////
// Ïàðàìåòðû ôàéëà //
///////////////////////////
f70 getinfo_file_70;
BDVK getinfo_file_info;
dword GetFileInfo(dword file_name)
{
getinfo_file_70.func = 5;
getinfo_file_70.param1 =
getinfo_file_70.param2 =
getinfo_file_70.param3 =
getinfo_file_70.param4 = #getinfo_file_info;
getinfo_file_70.rezerv = 0;
getinfo_file_70.name = file_name;
$mov eax,70
$mov ebx,#getinfo_file_70.func
$int 0x40
IF (EAX == 0) {
EAX = #getinfo_file_info;
}
}
 
 
///////////////////////////
// Çàïóñê ïðîãðàììû //
///////////////////////////
f70 run_file_70;
void RunProgram(dword run_path, run_param)
{
run_file_70.func = 7;
run_file_70.param1 =
run_file_70.param3 =
run_file_70.param4 =
run_file_70.rezerv = 0;
run_file_70.param2 = run_param;
run_file_70.name = run_path;
$mov eax,70
$mov ebx,#run_file_70.func
$int 0x40
}
 
///////////////////////////
// Ñîçäàíèå ïàïêè //
///////////////////////////
f70 create_dir_70;
void CreateFolder(dword new_folder_path)
{
create_dir_70.func = 9;
create_dir_70.param1 =
create_dir_70.param2 =
create_dir_70.param3 =
create_dir_70.param4 =
create_dir_70.rezerv = 0;
create_dir_70.name = new_folder_path;
$mov eax,70
$mov ebx,#create_dir_70.func
$int 0x40
}
 
////////////////////////////
// Óäàëåíèå ôàéëà/ïàïêè //
////////////////////////////
f70 del_file_70;
void DeleteFile(dword del_file_path)
{
del_file_70.func = 8;
del_file_70.param1 =
del_file_70.param2 =
del_file_70.param3 =
del_file_70.param4 =
del_file_70.rezerv = 0;
del_file_70.name = del_file_path;
$mov eax,70
$mov ebx,#del_file_70.func
$int 0x40
}
 
////////////////////////////
// Ïðî÷èòàòü ôàéë //
////////////////////////////
f70 read_file_70;
void ReadFile(dword pos, file_size, read_buffer, file_path)
{
read_file_70.func = 0;
read_file_70.param1 = pos;
read_file_70.param2 = 0;
read_file_70.param3 = file_size;
read_file_70.param4 = read_buffer;
read_file_70.rezerv = 0;
read_file_70.name = file_path;
$mov eax,70
$mov ebx,#read_file_70.func
$int 0x40
}
 
///////////////////////////
// Ïðî÷èòàòü ïàïêó //
///////////////////////////
f70 read_dir_70;
void ReadDir(dword file_count, read_buffer, dir_path)
{
read_dir_70.func = 1;
read_dir_70.param1 =
read_dir_70.param2 =
read_dir_70.rezerv = 0;
read_dir_70.param3 = file_count;
read_dir_70.param4 = read_buffer;
read_dir_70.name = dir_path;
$mov eax,70
$mov ebx,#read_dir_70.func
$int 0x40
}
 
///////////////////////////
// Ñêîïèðîâàòü ôàéë //
///////////////////////////
f70 CopyFile_f;
inline fastcall dword CopyFile(dword EBX,ECX)
{
BDVK CopyFile_atr;
dword s=EBX, d=ECX, cBufer=0;
CopyFile_f.func = 5;
CopyFile_f.param1 = 0;
CopyFile_f.param2 = 0;
CopyFile_f.param3 = 0;
CopyFile_f.param4 = #CopyFile_atr;
CopyFile_f.rezerv = 0;
CopyFile_f.name = s;
$mov eax, 70
$mov ebx, #CopyFile_f
$int 0x40
if (!EAX)
{
cBufer = malloc(CopyFile_atr.sizelo);
ReadFile(dword 0, CopyFile_atr.sizelo, cBufer, s);
IF (!EAX)
{
CopyFile_f.func = 2;
CopyFile_f.param1 = 0;
CopyFile_f.param2 = 0;
CopyFile_f.param3 = CopyFile_atr.sizelo;
CopyFile_f.param4 = cBufer;
CopyFile_f.rezerv = 0;
CopyFile_f.name = d;
$mov eax, 70
$mov ebx, #CopyFile_f
$int 0x40
}
}
}
 
 
//Asper
void ReadAttributes(dword read_buffer, file_path)
{
read_file_70.func = 5;
read_file_70.param1 = 0;
read_file_70.param2 = 0;
read_file_70.param3 = 0;
read_file_70.param4 = read_buffer;
read_file_70.rezerv = 0;
read_file_70.name = file_path;
$mov eax,70
$mov ebx,#read_file_70.func
$int 0x40
}
/programs/network/htmlv/lib/kolibri.h--
0,0 → 1,608
//CODED by Veliant, Leency, Nable. GNU GPL licence.
 
#startaddress 0
#code32 TRUE
 
char os_name[8] = {'M','E','N','U','E','T','0','1'};
dword os_version = 0x00000001;
dword start_addr = #main;
dword final_addr = #stop+32;
dword alloc_mem = #0x00100000;
dword x86esp_reg = #0x00100000;
dword I_Param = #param;
dword I_Icon = 0x0;
char param[256]="";
 
//Events
#define evMouse 6
#define evButton 3
#define evKey 2
#define evReDraw 1
 
//Button options
#define BT_DEL 0x80000000
#define BT_HIDE 0x40000000
#define BT_NOFRAME 0x20000000
 
#define OLD -1
#define true 1
#define false 0
//-------------------------------------------------------------------------
 
struct mouse{
dword x,y,lkm,pkm,hor,vert;
void get();
};
 
void mouse::get()
{
EAX = 37;
EBX = 1;
$int 0x40
$mov ebx, eax
$shr eax, 16
$and ebx,0x0000FFFF
x = EAX;
y = EBX;
EAX = 37;
EBX = 2;
$int 0x40
$mov ebx, eax
$and eax, 0x00000001
$shr ebx, 1
$and ebx, 0x00000001
lkm = EAX;
pkm = EBX;
EAX = 37; //áªà®««
EBX = 7;
$int 0x40
$mov ebx, eax
$shr eax, 16
$and ebx,0x0000FFFF
//hor = EAX;
vert = EBX;
}
 
struct proc_info{
dword use_cpu;
word pos_in_stack,num_slot,rezerv1;
char name[11];
char rezerv2;
dword adress,use_memory,ID,left,top,width,height;
word status_slot,rezerv3;
dword work_left,work_top,work_width,work_height;
char status_window;
void GetInfo(dword ECX);
#define SelfInfo -1
};
 
void proc_info::GetInfo(dword ECX)
{
EAX = 9;
EBX = #use_cpu;
$int 0x40
}
 
struct system_colors{
dword frame,grab,grab_button,grab_button_text,grab_text,work,work_button,work_button_text,work_text,work_graph;
void get();
};
void system_colors::get()
{
EAX = 48;
EBX = 3;
ECX = #frame;
EDX = 40;
$int 0x40
}
 
//------------------------------------------------------------------------------
 
inline fastcall dword WaitEvent(){
EAX = 10;
$int 0x40
}
 
inline fastcall dword WaitEventTimeout(dword EBX){
EAX = 23;
$int 0x40
}
inline fastcall SetEventMask(dword EBX)
{
EAX = 40;
$int 0x40
}
 
inline fastcall ScancodesGeting(){
$mov eax,66;
$mov ebx,1;
$mov ecx,1; //᪠­ª®¤ë
$int 0x40
}
 
inline fastcall word GetKey(){
EAX = 2; // just read this key from buffer
$int 0x40
EAX = EAX >> 8;
}
 
inline fastcall word GetButtonID(){
EAX = 17;
$int 0x40
EAX = EAX >> 8;
}
 
inline fastcall ExitProcess(){
EAX = -1; // close this program
$int 0x40
}
 
inline fastcall Pause(dword EBX)
{ // ã§ , ¢ á®âëå ¤®«ïå ᥪ㭤ë EBX = value
$mov eax, 5
$int 0x40
}
 
//------------------------------------------------------------------------------
 
inline fastcall void DrawTitle(dword ECX)
{
EAX = 71;
EBX = 1;
$int 0x40;
}
 
inline fastcall dword GetSkinWidth()
{
EAX = 48;
EBX = 4;
$int 0x40
}
 
inline fastcall void ChangeSkin(ECX){
EAX = 48;
EBX = 8;
$int 0x40
}
 
inline fastcall dword GetScreenWidth()
{
EAX = 14;
EBX = 4;
$int 0x40
$shr eax, 16
$and eax,0x0000FFFF
}
 
inline fastcall MoveSize(dword EBX,ECX,EDX,ESI)
{
EAX = 67;
$int 0x40
}
 
inline fastcall dword LoadLibrary(dword ECX)
{
$mov eax, 68
$mov ebx, 19
$int 0x40
}
 
//------------------------------------------------------------------------------
inline fastcall dword strlen(dword EDI){
EAX=0;
ECX=-1;
$REPNE $SCASB
EAX-=2+ECX;
}
 
inline fastcall copystr(dword ESI,EDI)
{
$cld
l1:
$lodsb
$stosb
$test al,al
$jnz l1
}
 
byte fastcall TestBit(EAX, CL)
{
$shr eax,cl
$and eax,1
}
 
char buffer[11]="";
inline fastcall dword IntToStr(dword ESI)
{
$mov edi, #buffer
$mov ecx, 10
$test esi, esi
$jns f1
$mov al, '-'
$stosb
$neg esi
f1:
$mov eax, esi
$push -'0'
f2:
$xor edx, edx
$div ecx
$push edx
$test eax, eax
$jnz f2
f3:
$pop eax
$add al, '0'
$stosb
$jnz f3
$mov eax, #buffer
$ret
}
 
 
inline fastcall dword StrToInt()
{
ESI=EDI=EAX;
IF(DSBYTE[ESI]=='-')ESI++;
EAX=0;
BH=AL;
do{
BL=DSBYTE[ESI]-'0';
EAX=EAX*10+EBX;
ESI++;
}while(DSBYTE[ESI]>0);
IF(DSBYTE[EDI]=='-') -EAX;
}
 
 
/*int strcmp(char* string1, char* string2)
{
loop ()
{
IF (*string1<*string2) RETURN -1;
IF (*string1>*string2) RETURN 1;
IF (*string1=='\0') RETURN 0;
string1++;
string2++;
}
}*/
 
 
inline fastcall int strcmp(ESI, EDI)
{
loop()
{
IF (DSBYTE[ESI]<DSBYTE[EDI]) RETURN -1;
IF (DSBYTE[ESI]>DSBYTE[EDI]) RETURN 1;
IF (DSBYTE[ESI]=='\0') RETURN 0;
ESI++;
EDI++;
}
}
 
inline fastcall unsigned int find_symbol(ESI,BL)
{
int jj=0, last=-1;
do{
jj++;
$lodsb
IF(AL==BL) last=jj;
} while(AL!=0);
return last;
}
 
 
dword StrToCol(char* htmlcolor)
{
dword j=1, color=0; char ch=0x00;
IF (ESBYTE[htmlcolor]<>'#') RETURN;
FOR (;j<7;j++)
{
ch=ESBYTE[htmlcolor+j];
IF ((ch>='0') && (ch<='9')) ch -= '0';
IF ((ch>='A') && (ch<='F')) ch -= 'A'-10;
IF ((ch>='a') && (ch<='f')) ch -= 'a'-10;
color = color*0x10 + ch;
}
EAX=color;
}
 
inline fastcall dword upcase(dword ESI)
{
do{
AL=DSBYTE[ESI];
IF(AL>='a')IF(AL<='z')DSBYTE[ESI]=AL&0x5f;
ESI++;
}while(AL!=0);
}
 
/*inline fastcall void lowcase(ESI)
{
do{
$LODSB
IF(AL>='A')&&(AL<='Z'){
AL+=0x20;
DSBYTE[ESI-1]=AL;
CONTINUE;
}
}while(AL!=0);
}*/
 
inline fastcall lowcase(ESI)
{
do{
$LODSB
IF(AL>='A')&&(AL<='Z'){
AL+=0x20;
DSBYTE[ESI-1]=AL;
CONTINUE;
}
}while(AL!=0);
}
 
 
inline fastcall wintodos (dword ESI)
{
while (BL=ESBYTE[ESI])
{
IF (BL>=192)
{
IF (BL>=240) ESBYTE[ESI] = BL - 16;
ELSE ESBYTE[ESI] = BL - 64;
}
ELSE
{
IF (BL==178) ESBYTE[ESI] = 73; //I
IF (BL==179) ESBYTE[ESI] = 105; //i
IF (BL==175) ESBYTE[ESI] = 244; //J
IF (BL==191) ESBYTE[ESI] = 245; //j
IF (BL==170) ESBYTE[ESI] = 242; //E
IF (BL==186) ESBYTE[ESI] = 243; //e
IF (BL==168) ESBYTE[ESI] = 240; //ð
IF (BL==184) ESBYTE[ESI] = 'e'; //e
IF ((BL==147) || (BL==148) || (BL==171) || (BL==187)) ESBYTE[ESI] = 34;
IF ((BL==150) || (BL==151)) ESBYTE[ESI] = 45;
}
ESI++;
}
}
 
 
dword Hex2Symb(char* htmlcolor)
{
dword j=0, symbol=0;
char ch=0x00;
FOR (;j<2;j++)
{
ch=ESBYTE[htmlcolor+j];
IF (ch==0x0d) || (ch=='\9') return '';
IF ((ch>='0') && (ch<='9')) ch -= '0';
IF ((ch>='A') && (ch<='F')) ch -= 'A'-10;
IF ((ch>='a') && (ch<='f')) ch -= 'a'-10;
symbol = symbol*0x10 + ch;
}
wintodos(#symbol);
AL=symbol;
}
 
byte mas[66] = "椥ä£å¨©ª«¬­®¯ïàáâ㦢ìë§èíéçꞀ–„…”ƒ•ˆ‰Š‹ŒŽŸ‘’“†‚œ›‡˜™—š";
inline fastcall void koitodos(dword EDI)
{
WHILE (BL=ESBYTE[EDI])
{
IF (BL >= 0xC0)
{
BL -= 0xC0;
ESBYTE[EDI] = mas[BL];
}
//IF (ESBYTE[EDI]=='\244') ESBYTE[EDI]='i';
EDI++;
}
}
 
 
//Asper
//uncomplete
inline fastcall int utf8rutodos(dword ESI) //-
{
EDI=ESI;
while (BL=ESBYTE[ESI])
{
IF (BL == 0xD0) || (BL == 0xD1) EDI--;
else IF (BL == 0x81) && (ESBYTE[ESI-1]==0xD0) ESBYTE[EDI] = 0xF0; //è
else IF (BL == 0x91) && (ESBYTE[ESI-1]==0xD1) ESBYTE[EDI] = 0xF1; //¬
else IF (BL == 0xE2) && (ESBYTE[ESI+1]==0x80) && (ESBYTE[ESI+2]==0x94) //long defis
{
ESBYTE[EDI] = '-';
ESI+=2;
}
else IF (BL == 0xE2) && (ESBYTE[ESI+1]==0x80) && (ESBYTE[ESI+2]==0xA2) //central point
{
ESBYTE[EDI] = '*';
ESI+=2;
}
else IF (BL == 0xC2) && (ESBYTE[ESI+1]==0xA9) // (c)
{
ESBYTE[EDI] = '(';
ESBYTE[EDI+1] = 'c';
ESBYTE[EDI+2] = ')';
EDI+=2;
ESI++;
}
else IF (BL == 0xC2) && ((ESBYTE[ESI+1]==0xAB) || (ESBYTE[ESI+1]==0xBB)) // "
{
ESBYTE[EDI] = '\"';
ESI++;
}
else IF (BL == 0xC2) && (ESBYTE[ESI+1]==0xB7) // _
{
ESBYTE[EDI] = '_';
ESI++;
}
else IF (BL >= 0x90) && (BL <= 0xAF)
{
BL -= 0x10;
ESBYTE[EDI] = BL;
}
else IF (BL >= 0x80) && (BL <= 0x8F)
{
BL += 0x60;
ESBYTE[EDI] = BL;
}
else IF (BL >= 0xB0) && (BL <= 0xBF)
{
BL -= 0x10;
ESBYTE[EDI] = BL;
}
else ESBYTE[EDI] = BL;
ESI++;
EDI++;
}
WHILE (EDI<ESI)
{
ESBYTE[EDI] = ' ';
EDI++;
}
}
 
//------------------------------------------------------------------------------
 
byte WindowRePaint=0;
inline fastcall void WindowRedrawStatus(dword EBX)
{
EAX = 12; // function 12:tell os about windowdraw
$int 0x40
IF (EBX==1) WindowRePaint=1; ELSE WindowRePaint=0;
}
 
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI)
{
EBX = x << 16 + sizeX;
ECX = y << 16 + sizeY;
EDX = mainAreaType << 24 | mainAreaColour;
ESI = headerType << 24 | headerColour;
$xor eax,eax
$int 0x40
}
 
inline fastcall dword CreateThread(dword ECX,EDX)
{
EAX = 51;
EBX = 1;
$int 0x40
}
 
void WriteText(dword x,y,byte fontType, dword color, EDX, ESI)
{
EAX = 4;
EBX = x<<16+y;
ECX = fontType<<24+color;
$int 0x40;
}
 
void PutImage(dword EBX,w,h,x,y)
{
EAX = 7;
ECX = w<<16+h;
EDX = x<<16+y;
$int 0x40
}
 
void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI)
{
EAX = 65;
ECX = w<<16+h;
EDX = x<<16+y;
EBP = 0;
$int 0x40
}
 
inline fastcall void PutPixel(dword EBX,ECX,EDX){
EAX=1;
$int 0x40
}
 
void DrawBar(dword x,y,w,h,EDX)
{
EAX = 13;
EBX = x<<16+w;
ECX = y<<16+h;
$int 0x40
}
 
void DefineButton(dword x,y,w,h,EDX,ESI)
{
EAX = 8;
EBX = x<<16+w;
ECX = y<<16+h;
$int 0x40
}
 
inline fastcall void DeleteButton(dword EDX)
{
EAX = 8;
EDX += BT_DEL;
$int 0x40;
}
 
void DrawRegion(dword x,y,width,height,color1)
{
DrawBar(x,y,width,1,color1); //¯®«®á  £®à ᢥàåã
DrawBar(x,y+height,width,1,color1); //¯®«®á  £®à á­¨§ã
DrawBar(x,y,1,height,color1); //¯®«®á  ¢¥àåã á«¥¢ 
DrawBar(x+width,y,1,height+1,color1); //¯®«®á  ¢¥àåã á¯à ¢ 
}
 
void DrawRegion_3D(dword x,y,width,height,color1,color2)
{
DrawBar(x,y,width+1,1,color1); //¯®«®á  £®à ᢥàåã
DrawBar(x,y+1,1,height-1,color1); //¯®«®á  á«¥¢ 
DrawBar(x+width,y+1,1,height,color2); //¯®«®á  á¯à ¢ 
DrawBar(x,y+height,width,1,color2); //¯®«®á  £®à á­¨§ã
}
 
void DrawFlatButton(dword x,y,width,height,id,color,text)
{
DrawRegion_3D(x,y,width,height,0x94AECE,0x94AECE);
DrawRegion_3D(x+1,y+1,width-2,height-2,0xFFFFFF,0xC7C7C7);
DrawBar(x+2,y+2,width-3,height-3,color); //§ «¨¢ª 
IF (id<>0) DefineButton(x,y,width,height,id+BT_HIDE,0xEFEBEF); //ª­®¯ª 
WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,0,text,0);
}
 
void DrawCircle(int x, y, r)
{
int i; float px=0, py=r, ii = r * 3.1415926 * 2;
for (i = 0; i < ii; i++)
{
PutPixel(px + x, y - py, 0);
px = py / r + px;
py = -px / r + py;
//Pause(1);
}
}
 
//------------------------------------------------------------------------------
 
inline fastcall dword WriteDebug(dword EDX)
{
$push ebx
$push ecx
$mov eax, 63
$mov ebx, 1
next_char:
$mov ecx, DSDWORD[edx]
$or cl, cl
$jz done
$int 0x40
$inc edx
$jmp next_char
done:
$mov cl, 13
$int 0x40
$mov cl, 10
$int 0x40
$pop ecx
$pop ebx
}
/programs/network/htmlv/lib/libimg_lib.h--
0,0 → 1,104
//Asper
 
//library
dword libimg = #alibimg;
char alibimg[21] = "/sys/lib/libimg.obj\0"; //"libimg.obj\0";
 
dword libimg_init = #alibimg_init;
dword img_is_img = #aimg_is_img;
dword img_to_rgb2 = #aimg_to_rgb2;
dword img_decode = #aimg_decode;
dword img_destroy = #aimg_destroy;
dword img_draw = #aimg_draw;
//dword img_flip = #aimg_flip;
//dword img_rotate = #aimg_rotate;
 
dword am1__ = 0x0;
dword bm1__ = 0x0;
 
//import libimg , \
char alibimg_init[9] = "lib_init\0";
char aimg_is_img[11] = "img_is_img\0";
char aimg_to_rgb2[12] = "img_to_rgb2\0";
char aimg_decode[11] = "img_decode\0";
char aimg_destroy[12] = "img_destroy\0";
char aimg_draw[9] = "img_draw\0";
//char aimg_flip[9] = "img_flip\0";
//char aimg_rotate[11] = "img_rotate\0 ";
 
 
 
dword load_image(dword filename)
{
//align 4
dword img_data=0;
dword img_data_len=0;
dword fh=0;
dword image=0;
 
byte tmp_buf[40];
$and img_data, 0
//$mov eax, filename
//$push eax
//invoke file.open, eax, O_READ
file_open stdcall (filename, O_READ);
$or eax, eax
$jnz loc05
$stc
return 0;
@loc05:
$mov fh, eax
//invoke file.size
file_size stdcall (filename);
$mov img_data_len, ebx
//stdcall mem.Alloc, ebx
mem_Alloc(EBX);
$test eax, eax
$jz error_close
$mov img_data, eax
//invoke file.read, [fh], eax, [img_data_len]
file_read stdcall (fh, EAX, img_data_len);
$cmp eax, -1
$jz error_close
$cmp eax, img_data_len
$jnz error_close
//invoke file.close, [fh]
file_close stdcall (fh);
$inc eax
$jz error_
//; img.decode checks for img.is_img
//; //invoke img.is_img, [img_data], [img_data_len]
//; $or eax, eax
//; $jz exit
//invoke img.decode, [img_data], [img_data_len], 0
EAX=img_data;
img_decode stdcall (EAX, img_data_len,0);
$or eax, eax
$jz error_
$cmp image, 0
$pushf
$mov image, eax
//call init_frame
$popf
//call update_image_sizes
mem_Free(img_data);//free_img_data(img_data);
$clc
return image;
 
@error_free:
//invoke img.destroy, [image]
img_destroy stdcall (image);
$jmp error_
 
@error_pop:
$pop eax
$jmp error_
@error_close:
//invoke file.close, [fh]
file_close stdcall (fh);
@error_:
mem_Free(img_data);
$stc
return 0;
}
/programs/network/htmlv/lib/libio_lib.h--
0,0 → 1,36
//Asper
 
//library
dword libio = #alibio;
char alibio[21] = "/sys/lib/libio.obj\0"; //"libio.obj\0";
 
dword libio_init = #alibio_init;
dword file_size = #afile_size;
dword file_open = #afile_open;
dword file_read = #afile_read;
dword file_close = #afile_close;
 
dword am2__ = 0x0;
dword bm2__ = 0x0;
 
 
//import libio , \
char alibio_init[9] = "lib_init\0";
char afile_size[11] = "file_size\0";
char afile_open[12] = "file_open\0";
char afile_read[11] = "file_read\0";
char afile_close[12] = "file_close\0";
 
//align 4
//dword fh=0;
 
#define O_BINARY 0
#define O_READ 1
#define O_WRITE 2
#define O_CREATE 4
#define O_SHARE 8
#define O_TEXT 16
 
#define SEEK_SET 0
#define SEEK_CUR 1
#define SEEK_END 2
/programs/network/htmlv/lib/mem.h--
0,0 → 1,64
//mem.Init
dword mem_Init()
{
$push ebx
$mov eax, 68
$mov ebx, 11
$int 0x40
$pop ebx
return EAX;
}
 
//mem.Alloc
dword mem_Alloc(dword size)
{
$push ebx
$push ecx
$mov eax, 68
$mov ebx, 12
$mov ecx, size
$int 0x40
$pop ecx
$pop ebx
return EAX;
}
 
//mem.ReAlloc
stdcall dword mem_ReAlloc(dword mptr, size)
{
//$push ebx ecx edx
$push ebx
$push ecx
$push edx
$mov eax, 68
$mov ebx, 20
$mov ecx, size
$mov edx, mptr
$int 0x40
 
$pop edx
$pop ecx
$pop ebx
//$pop edx ecx ebx
return EAX;
}
 
//mem.Free
void mem_Free(dword mptr)
{
$push eax
$push ebx
$push ecx
$mov eax, 68
$mov ebx, 13
$mov ecx, mptr
$test ecx, ecx
$jz end0
$int 0x40
@end0:
$pop ecx
$pop ebx
$pop eax
}
/programs/network/htmlv/lib/memory.h--
0,0 → 1,66
#code32 TRUE
 
inline fastcall dword malloc(dword ECX){
dword size, heap;
#speed
size = ECX;
EAX = 68;
EBX = 11;
$int 0x40;
heap = EAX;
IF (size<=heap)
{
EAX = 68;
EBX = 12;
ECX = size;
$int 0x40;
}
ELSE EAX=-1;
#codesize
}
 
inline fastcall dword free(dword ECX){
#speed
EAX = 68;
EBX = 13;
$int 0x40;
#codesize
}
 
inline fastcall dword realloc(dword ECX, EDX){
#speed
EAX = 68;
EBX = 20;
$int 0x40;
#codesize
}
 
inline fastcall memmov( EDI, ESI, ECX)
{
asm {
MOV EAX, ECX
CMP EDI, ESI
JG L1
JE L2
SAR ECX, 2
JS L2
REP MOVSD
MOV ECX, EAX
AND ECX, 3
REP MOVSB
JMP SHORT L2
L1: LEA ESI, DSDWORD[ ESI+ECX-4]
LEA EDI, DSDWORD[ EDI+ECX-4]
SAR ECX, 2
JS L2
STD
REP MOVSD
MOV ECX, EAX
AND ECX, 3
ADD ESI, 3
ADD EDI, 3
REP MOVSB
CLD
L2:
}
}