forked from KolibriOS/kolibrios
add files :)
git-svn-id: svn://kolibrios.org@806 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
0ce1599841
commit
3e4779ce20
52
programs/develop/box_lib/C--/lib/RANDOM.H--
Normal file
52
programs/develop/box_lib/C--/lib/RANDOM.H--
Normal file
@ -0,0 +1,52 @@
|
||||
/*******************************************************************************
|
||||
|
||||
MenuetOS MineSweeper
|
||||
Copyright (C) 2003 Ivan Poddubny
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
*******************************************************************************/
|
||||
|
||||
dword generator; // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë
|
||||
|
||||
:int random(int max)
|
||||
// get pseudo-random number - ïîëó÷èòü ïñåâäîñëó÷àéíîå ÷èñëî
|
||||
{
|
||||
$rdtsc // eax & edx
|
||||
$xor eax,edx
|
||||
$not eax
|
||||
|
||||
EBX = generator;
|
||||
$ror ebx,3
|
||||
$xor ebx,0xdeadbeef
|
||||
EBX += EAX;
|
||||
generator = EBX;
|
||||
|
||||
EAX += EBX;
|
||||
EAX = EAX % max;
|
||||
return EAX;
|
||||
}
|
||||
|
||||
:randomize()
|
||||
// initialize random number generator - èíèöèàëèçèðîâàòü ãåíåðàòîð ñëó÷àéíûõ ÷èñåë
|
||||
{
|
||||
asm
|
||||
{
|
||||
mov eax,3
|
||||
int 0x40
|
||||
ror eax,16
|
||||
}
|
||||
generator = EAX;
|
||||
}
|
558
programs/develop/box_lib/C--/lib/kolibri.h--
Normal file
558
programs/develop/box_lib/C--/lib/kolibri.h--
Normal file
@ -0,0 +1,558 @@
|
||||
#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 = #stop+0x100;
|
||||
dword x86esp_reg = #stop+0x100;
|
||||
dword I_Param = 0x0;
|
||||
dword I_Icon = 0x0;
|
||||
dword skin_width;
|
||||
|
||||
//Events
|
||||
#define evMouse 6
|
||||
#define evButton 3
|
||||
#define evKey 2
|
||||
#define evReDraw 1
|
||||
#define evNet 8
|
||||
|
||||
//Button options
|
||||
#define BT_DEL 0x80000000
|
||||
#define BT_HIDE 0x40000000
|
||||
#define BT_NOFRAME 0x20000000
|
||||
|
||||
#define OLD -1
|
||||
#define true 1
|
||||
#define false 0
|
||||
|
||||
struct FileInfo{
|
||||
dword read, firstBlock, qnBlockRead, retPtr, Work;
|
||||
byte filedir;
|
||||
};
|
||||
//-------------------------------------------------------------------------
|
||||
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
|
||||
}
|
||||
|
||||
|
||||
int vert;
|
||||
struct mouse{
|
||||
dword x,y,lkm,pkm;
|
||||
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 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];
|
||||
};
|
||||
//---------------------------------------------------------------------------
|
||||
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 getme();
|
||||
};
|
||||
|
||||
void proc_info::getme()
|
||||
{
|
||||
EAX = 9;
|
||||
EBX = #use_cpu;
|
||||
ECX = -1;
|
||||
$int 0x40
|
||||
}
|
||||
//-------------------------------------------------------------------------------
|
||||
|
||||
/*
|
||||
Žâà¨á®¢ª ®ª
|
||||
{x_start|y_start}, {x_size|y_size}, color_back, color_title, color_frames
|
||||
|
||||
DrawWindow(
|
||||
EBX = [x_start][x_size]
|
||||
ECX = [y_start][y_size]
|
||||
EDX, ESI, EDI = [00RRGGBB]
|
||||
)
|
||||
*/
|
||||
|
||||
inline fastcall void DrawWindow(dword EBX, ECX, EDX, ESI, EDI){
|
||||
#speed
|
||||
EAX = 0; // function 0 : define and draw window
|
||||
$int 0x40
|
||||
#codesize
|
||||
}
|
||||
|
||||
inline fastcall void DrawButton(dword EBX, ECX, EDX, ESI){
|
||||
EAX = 8;
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
inline fastcall dword WaitEvent(){
|
||||
EAX = 10; // wait here for event
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
inline fastcall void ExitProcess(){
|
||||
EAX = -1; // close this program
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
/*
|
||||
02 = GET KEY
|
||||
|
||||
ret: al 0 successful -> ah = key
|
||||
al 1 no key in buffer
|
||||
*/
|
||||
inline fastcall word GetKey(){
|
||||
EAX = 2; // just read this key from buffer
|
||||
$int 0x40
|
||||
// EAX = EAX >> 8;
|
||||
}
|
||||
|
||||
/*
|
||||
17 = GET PRESSED BUTTON ID
|
||||
|
||||
ret: al 0 successful -> ah = id number
|
||||
al 1 no key in buffer
|
||||
*/
|
||||
inline fastcall word GetButtonID(){
|
||||
EAX = 17; // Get ID
|
||||
$int 0x40
|
||||
EAX = EAX >> 8;
|
||||
}
|
||||
|
||||
/*
|
||||
04 = WRITE TEXT TO WINDOW
|
||||
|
||||
ebx [x start]*65536 + [y start]
|
||||
ecx text color 0x00RRGGBB
|
||||
edx pointer to text beginning
|
||||
esi text length
|
||||
ret: nothing changed
|
||||
*/
|
||||
inline fastcall void WriteTextXY(dword EBX, ECX, EDX, ESI){
|
||||
#speed
|
||||
EAX = 4;
|
||||
$int 0x40;
|
||||
#codesize
|
||||
}
|
||||
|
||||
/*
|
||||
13 = DRAW BAR
|
||||
|
||||
ebx [x start]*65536 + [x size]
|
||||
ecx [y start]*65536 + [y size]
|
||||
edx color 0x00RRGGBB
|
||||
ret: nothing changed
|
||||
*/
|
||||
inline fastcall void kos_DrawBar(dword EBX, ECX, EDX){
|
||||
#speed
|
||||
EAX = 13;
|
||||
$int 0x40
|
||||
#codesize
|
||||
}
|
||||
|
||||
/* function EBX=5 (GetBackgroun) ECX[]->EDX[], length ESI
|
||||
inline fastcall void GetBackground(dword ECX, EDX, ESI){
|
||||
#speed
|
||||
EAX = 39;
|
||||
EBX = 5;
|
||||
$int 0x40
|
||||
#codesize
|
||||
}*/
|
||||
|
||||
//CODED by Veliant
|
||||
/*eax = 38 - íîìåð ôóíêöèè
|
||||
ebx = [êîîðäèíàòà íà÷àëà ïî îñè x]*65536 + [êîîðäèíàòà êîíöà ïî îñè x]
|
||||
ecx = [êîîðäèíàòà íà÷àëà ïî îñè y]*65536 + [êîîðäèíàòà êîíöà ïî îñè y]
|
||||
edx = 0x00RRGGBB - öâåò
|
||||
edx = 0x01xxxxxx - ðèñîâàòü èíâåðñívé îòðåçîê (ìëàäøèå 24 áèòà èãíîðèðó³òñÿ) */
|
||||
inline fastcall void DrawLine(dword EBX, ECX, EDX){
|
||||
EAX = 38;
|
||||
$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(){
|
||||
EAX = 48;
|
||||
EBX = 8;
|
||||
ECX = #file_path;
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
inline fastcall dword GetScreenWidth()
|
||||
{
|
||||
EAX = 14;
|
||||
EBX = 4;
|
||||
$int 0x40
|
||||
$shr eax, 16
|
||||
$and eax,0x0000FFFF
|
||||
}
|
||||
|
||||
inline fastcall void DeleteButton(dword EDX)
|
||||
{
|
||||
EAX = 8;
|
||||
EDX = EDX + BT_DEL;
|
||||
$int 0x40;
|
||||
}
|
||||
|
||||
inline fastcall dword LoadLibrary(dword ECX)
|
||||
{
|
||||
$mov eax, 68
|
||||
$mov ebx, 19
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
inline fastcall dword strlen(dword EDI)
|
||||
{
|
||||
#speed
|
||||
ECX=0;
|
||||
EAX=0;
|
||||
ECX--;
|
||||
$REPNE $SCASB
|
||||
EAX=EAX-2-ECX;
|
||||
#codesize
|
||||
}
|
||||
|
||||
//-1 - ¥ à ¢ë
|
||||
// 0 - ¥ à ¢ë
|
||||
inline fastcall dword strcmp(dword ESI,EDI)
|
||||
{
|
||||
dword strcmp_i,ret=-1,len1,len2,sovpadenij=0,str1,str2;
|
||||
str1=ESI;
|
||||
str2=EDI;
|
||||
len1=strlen(str1);
|
||||
len2=strlen(str2);
|
||||
IF (len1==len2)
|
||||
{
|
||||
FOR (strcmp_i=0;strcmp_i<len1;strcmp_i++)
|
||||
{
|
||||
EAX = str1+strcmp_i;
|
||||
EAX = ESBYTE[EAX];
|
||||
EBX = str2+strcmp_i;
|
||||
EBX = ESBYTE[EBX];
|
||||
IF (EAX==EBX) sovpadenij++;
|
||||
}
|
||||
IF (sovpadenij==len1) ret=0;
|
||||
} ELSE ret=-1;
|
||||
EAX = ret;
|
||||
}
|
||||
|
||||
inline fastcall dword upcase(dword ESI)
|
||||
{
|
||||
dword str, i;
|
||||
str = ESI;
|
||||
for (i=0;i<strlen(str);i++)
|
||||
{
|
||||
EAX = str+i;
|
||||
EDX = ESBYTE[EAX];
|
||||
IF (EDX>=97) && (EDX<=122) ESBYTE[str+i] = DL - 32; //a-z
|
||||
IF (EDX>=160) && (EDX<=175) ESBYTE[str+i] = DL - 32; //à-ï
|
||||
IF (EDX>=224) && (EDX<=239) ESBYTE[str+i] = DL - 80; //ð-ÿ
|
||||
IF (EDX == 241) ESBYTE[EAX] = 240; //¿
|
||||
}
|
||||
EAX = str;
|
||||
//EAX = ESDWORD[EAX];
|
||||
//if (EAX != 0x5249443C) $int 3;
|
||||
}
|
||||
|
||||
inline fastcall dword lowcase(dword ESI)
|
||||
{
|
||||
dword str=ESI, i;
|
||||
FOR (i=0;i<strlen(str);i++)
|
||||
{
|
||||
EAX = str+i;
|
||||
EDX = ESBYTE[EAX];
|
||||
IF (EDX>=65) && (EDX<=90) ESBYTE[str+i] = DL + 32; //a-z
|
||||
IF (EDX>=128) && (EDX<=143) ESBYTE[str+i] = DL + 32; //à-ï
|
||||
IF (EDX>=144) && (EDX<=159) ESBYTE[str+i] = DL + 80; //ð-ÿ
|
||||
IF (EDX == 240) ESBYTE[EAX] = 241; //¿
|
||||
}
|
||||
EAX = str;
|
||||
//EAX = ESDWORD[EAX];
|
||||
//if (EAX != 0x5249443C) $int 3;
|
||||
}
|
||||
|
||||
inline fastcall void dostowin (dword ESI)
|
||||
{
|
||||
dword stroka,dlina;
|
||||
stroka = ESI;
|
||||
while (BL=ESBYTE[ESI])
|
||||
{
|
||||
IF (BL>128)
|
||||
IF (BL>=240) ESBYTE[ESI] = BL - 16;
|
||||
ELSE ESBYTE[ESI] = BL - 64;
|
||||
ESI++;
|
||||
}
|
||||
}
|
||||
|
||||
void WindowRedrawStatus(dword i)
|
||||
{
|
||||
EAX = 12; // function 12:tell os about windowdraw
|
||||
EBX = i; // 1, start of draw
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,borderColour)
|
||||
{
|
||||
dword arg1, arg2, arg3, arg4;
|
||||
//
|
||||
arg1 = x << 16 + sizeX;
|
||||
arg2 = y << 16 + sizeY;
|
||||
arg3 = mainAreaType << 24 | mainAreaColour;
|
||||
arg4 = headerType << 24 | headerColour;
|
||||
//
|
||||
$mov eax, 0
|
||||
$mov ebx, arg1
|
||||
$mov ecx, arg2
|
||||
$mov edx, arg3
|
||||
$mov esi, arg4
|
||||
$mov edi, borderColour
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
void DefineButton(dword x,y,w,h,id,color)
|
||||
{
|
||||
DrawButton(x<<16+w, skin_width+y<<16+h, id, color);
|
||||
}
|
||||
|
||||
void WriteText(dword x,y,byte fontType, dword color, text, len)
|
||||
{
|
||||
EBX = x<<16+skin_width+y;
|
||||
ECX = fontType<<24+color;
|
||||
EDX = text;
|
||||
ESI = len;
|
||||
EAX = 4;
|
||||
$int 0x40;
|
||||
}
|
||||
|
||||
inline fastcall void PutPixel(dword EBX,ECX,EDX) //Coded by Leency :D
|
||||
{
|
||||
EAX=1;
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
void DrawBar(dword x,y,w,h,color)
|
||||
{
|
||||
kos_DrawBar(x<<16+w,skin_width+y<<16+h,color);
|
||||
}
|
||||
|
||||
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 DrawFlatButton(dword x,y,width,height,id,color,text)
|
||||
{
|
||||
DrawRegion(x,y,width,height,0x94AECE);
|
||||
DrawBar(x+1,y+1,width-1,1,0xFFFFFF); //ïîëîñà ãîð áåëàÿ
|
||||
DrawBar(x+1,y+height-1,width-2,1,0xC7C7C7); //òåíü âåðò
|
||||
DrawBar(x+1,y+1,1,height-1,0xFFFFFF); //ïîëîñà âåðò áåëàÿ
|
||||
DrawBar(x+width-1,y+2,1,height-2,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,strlen(text));
|
||||
}
|
||||
|
||||
|
||||
void PutImage(dword buf,w,h,x,y)
|
||||
{
|
||||
int i,r,g,b;
|
||||
EDI=buf;
|
||||
EAX = 7;
|
||||
EBX = buf;
|
||||
ECX = w<<16+h;
|
||||
EDX = x<<16+y+skin_width;
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
|
||||
void copystr(dword s,d)
|
||||
{
|
||||
$mov esi,s
|
||||
$mov edi,d
|
||||
$cld
|
||||
l1:
|
||||
$lodsb
|
||||
$stosb
|
||||
$test al,al
|
||||
$jnz l1
|
||||
}
|
||||
|
||||
|
||||
int pos,razr,backup,j=0,chislo;
|
||||
char buffer[11]="";
|
||||
inline fastcall dword IntToStr(dword ESI)
|
||||
{
|
||||
chislo=ESI;
|
||||
ECX=12;
|
||||
$push edi
|
||||
$mov edi,#buffer
|
||||
$xor al,al
|
||||
$cld
|
||||
$rep $stosb
|
||||
pos=razr=backup=j=0;
|
||||
if (chislo<0)
|
||||
{
|
||||
buffer[pos]='-';
|
||||
chislo=-1*chislo;
|
||||
pos++;
|
||||
}
|
||||
backup=chislo;
|
||||
do
|
||||
{
|
||||
backup=backup/10;
|
||||
razr++;
|
||||
}
|
||||
while (backup!=0);
|
||||
razr--;
|
||||
FOR (j=razr+pos;j>pos-1;j--)
|
||||
{
|
||||
backup=chislo/10;
|
||||
backup=backup*10;
|
||||
buffer[j]=chislo-backup+48;
|
||||
chislo=chislo/10;
|
||||
}
|
||||
//return #buffer;
|
||||
$pop edi;
|
||||
EAX = #buffer;
|
||||
}
|
||||
|
||||
|
||||
inline fastcall dword MoveSize(dword EBX,ECX,EDX,ESI)
|
||||
{
|
||||
EAX = 67;
|
||||
$int 0x40
|
||||
}
|
||||
|
||||
|
||||
f70 CopyFile_f;
|
||||
BDVK CopyFile_atr;
|
||||
inline fastcall dword CopyFile(dword EBX,ECX)
|
||||
{
|
||||
dword s, d, bufer=0;
|
||||
s = EBX;
|
||||
d = ECX;
|
||||
|
||||
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 == 0)
|
||||
{
|
||||
bufer = malloc(CopyFile_atr.sizelo);
|
||||
CopyFile_f.func = 0;
|
||||
CopyFile_f.param1 = 0;
|
||||
CopyFile_f.param2 = 0;
|
||||
CopyFile_f.param3 = CopyFile_atr.sizelo;
|
||||
CopyFile_f.param4 = bufer;
|
||||
CopyFile_f.rezerv = 0;
|
||||
CopyFile_f.name = s;
|
||||
$mov eax, 70
|
||||
$mov ebx, #CopyFile_f
|
||||
$int 0x40
|
||||
|
||||
IF (EAX == 0)
|
||||
{
|
||||
CopyFile_f.func = 2;
|
||||
CopyFile_f.param1 = 0;
|
||||
CopyFile_f.param2 = 0;
|
||||
CopyFile_f.param3 = CopyFile_atr.sizelo;
|
||||
CopyFile_f.param4 = bufer;
|
||||
CopyFile_f.rezerv = 0;
|
||||
CopyFile_f.name = d;
|
||||
$mov eax, 70
|
||||
$mov ebx, #CopyFile_f
|
||||
$int 0x40
|
||||
}
|
||||
}
|
||||
|
||||
}
|
67
programs/develop/box_lib/C--/lib/load_bmp.h--
Normal file
67
programs/develop/box_lib/C--/lib/load_bmp.h--
Normal file
@ -0,0 +1,67 @@
|
||||
//Load BMP by Veliant
|
||||
|
||||
struct readimage{
|
||||
dword func, param1, param2, size, buffer;
|
||||
byte z;
|
||||
dword name;
|
||||
};
|
||||
|
||||
void Put_Image(dword x,y,w,h,name)
|
||||
{
|
||||
int i, j, size, off, off2;
|
||||
byte r, g, b;
|
||||
readimage image;
|
||||
dword buf;
|
||||
size=w*h*3+100;
|
||||
buf=malloc(size);
|
||||
image.func = 0;
|
||||
image.param1 = 0;
|
||||
image.param2 = 0;
|
||||
image.size = size;
|
||||
image.buffer = buf;
|
||||
image.z = 0;
|
||||
image.name = #path;
|
||||
EAX = 70;
|
||||
EBX = #image;
|
||||
$int 0x40;
|
||||
|
||||
for(i=0;i<h;i++)
|
||||
for (j=0;j<w/2;j++)
|
||||
{
|
||||
off=w*3*i+buf+0x36;
|
||||
off2=w-j*3+off;
|
||||
off=j*3+off;
|
||||
|
||||
r=ESBYTE[off2-3];
|
||||
g=ESBYTE[off2-2];
|
||||
b=ESBYTE[off2-1];
|
||||
ESBYTE[off2-3]=ESBYTE[off];
|
||||
ESBYTE[off2-2]=ESBYTE[off+1];
|
||||
ESBYTE[off2-1]=ESBYTE[off+2];
|
||||
ESBYTE[off]=r;
|
||||
ESBYTE[off+1]=g;
|
||||
ESBYTE[off+2]=b;
|
||||
}
|
||||
size=w*h;
|
||||
for(i=0;i<size/2;i++)
|
||||
{
|
||||
off=buf+0x36;
|
||||
off2=size-i*3+off;
|
||||
off=i*3+off;
|
||||
|
||||
r=ESBYTE[off2-3];
|
||||
g=ESBYTE[off2-2];
|
||||
b=ESBYTE[off2-1];
|
||||
ESBYTE[off2-3]=ESBYTE[off];
|
||||
ESBYTE[off2-2]=ESBYTE[off+1];
|
||||
ESBYTE[off2-1]=ESBYTE[off+2];
|
||||
ESBYTE[off]=r;
|
||||
ESBYTE[off+1]=g;
|
||||
ESBYTE[off+2]=b;
|
||||
}
|
||||
EAX = 7;
|
||||
EBX = buf+0x36;
|
||||
ECX = w<<16+h;
|
||||
EDX = x<<16+y+skin_width;
|
||||
$int 0x40
|
||||
}
|
36
programs/develop/box_lib/C--/lib/memory.h--
Normal file
36
programs/develop/box_lib/C--/lib/memory.h--
Normal file
@ -0,0 +1,36 @@
|
||||
#code32 TRUE
|
||||
dword heap;
|
||||
inline fastcall dword malloc(dword ECX){
|
||||
dword size;
|
||||
#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
|
||||
}
|
96
programs/develop/box_lib/C--/trunk/EditBox2.c--
Normal file
96
programs/develop/box_lib/C--/trunk/EditBox2.c--
Normal file
@ -0,0 +1,96 @@
|
||||
//EditBox in C-- example v0.1
|
||||
//Veliant 2007 Leency 2008
|
||||
|
||||
#pragma option A
|
||||
#codesize
|
||||
#include "..\..\lib\kolibri.h--"
|
||||
#include "use_library.h--"
|
||||
//////////////////////////////////////////////////////////////////
|
||||
//Bit mask from editbox
|
||||
//////////////////////////////////////////////////////////////////
|
||||
|
||||
//char edit_path[256] = "You can edit me!"; //ñîäåðæèìîå EditBox'a
|
||||
char way_of_ini[250] = "/sys/lib/box_lib.obj",NULL; //ñîäåðæèìîå EditBox'a
|
||||
|
||||
edit_box edit1= {250,14,35,0xffffff,0x6f9480,0,0xAABBCC,0,248,#way_of_ini,2,20,20};
|
||||
|
||||
//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] ;áâ ஥ ¯®«®¦¥¨¥ ªãàá®à
|
||||
|
||||
proc_info Form;
|
||||
|
||||
|
||||
void main()
|
||||
byte id;
|
||||
{
|
||||
load_dll();
|
||||
|
||||
draw_window();
|
||||
loop()
|
||||
{
|
||||
switch(WaitEvent())
|
||||
{
|
||||
//Button pressed----------------------------------------------------
|
||||
CASE evButton:
|
||||
id=GetButtonID();
|
||||
IF (id==1) || (id==2) ExitProcess();
|
||||
break;
|
||||
//Key pressed-------------------------------------------------------
|
||||
case evKey:
|
||||
GetKey();
|
||||
edit_box_key stdcall (#edit1);
|
||||
break;
|
||||
|
||||
case evReDraw: draw_window(); break;
|
||||
// default: break;
|
||||
}
|
||||
|
||||
|
||||
edit_box_mouse stdcall (dword 0,0,#edit1);
|
||||
|
||||
}
|
||||
|
||||
ExitProcess();
|
||||
}
|
||||
|
||||
void draw_window()
|
||||
{
|
||||
WindowRedrawStatus(1);
|
||||
skin_width = GetSkinWidth();
|
||||
DefineAndDrawWindow(400,200,280,200,0x04,0x00E4DFE1,0,0,0); DrawTitle("Extended EditBox in C--");
|
||||
Form.getme();
|
||||
//òåêñò
|
||||
WriteText(30,40,0x80,0,"<22> ¨¯à®á⥩訩 ¯à¨¬¥à EditBox'a ‘--",0);
|
||||
WriteText(30,50,0x80,0,"<22>® ¥£® ¬®¦® ¥¬®£® ãá«®¦¨âì á 楫ìî",0);
|
||||
WriteText(30,60,0x80,0,"㬥ìè¥¨ï ¯¥à¥à¨á®¢ª¨.",0);
|
||||
//êíîïû
|
||||
DrawFlatButton(100,105,70,22,2,0xD7D7D7,"Close");
|
||||
//EditBox
|
||||
// DrawRegion(30,14,201,16,0x94AECE); //îáîäîê ïîëîñû àäðåñà
|
||||
|
||||
|
||||
edit_box_draw stdcall (#edit1);
|
||||
// typedef void (*edit_box_draw)(dword edit_b); // îáúÿâëåíèå óêàçàòåëÿ íà ôóíêöèþ
|
||||
// edit_box_draw(edit_b); // âûçîâ ôóíêöèè
|
||||
|
||||
WindowRedrawStatus(2);
|
||||
}
|
||||
|
||||
|
||||
stop:
|
BIN
programs/develop/box_lib/C--/trunk/EditBox2.kex
Normal file
BIN
programs/develop/box_lib/C--/trunk/EditBox2.kex
Normal file
Binary file not shown.
5
programs/develop/box_lib/C--/trunk/compile.bat
Normal file
5
programs/develop/box_lib/C--/trunk/compile.bat
Normal file
@ -0,0 +1,5 @@
|
||||
C-- EditBox2.c--
|
||||
del EditBox2.kex
|
||||
rename EditBox2 EditBox2.kex
|
||||
rename EditBox2.com EditBox2.kex
|
||||
pause
|
112
programs/develop/box_lib/C--/trunk/use_library.h--
Normal file
112
programs/develop/box_lib/C--/trunk/use_library.h--
Normal file
@ -0,0 +1,112 @@
|
||||
//BOX_LIB
|
||||
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
|
||||
//dword
|
||||
//dword
|
||||
|
||||
//dword
|
||||
//dword
|
||||
//dword
|
||||
|
||||
//$edit_box_draw dword aEdit_box_draw
|
||||
//$edit_box_key dword aEdit_box_key
|
||||
//$edit_box_mouse dword aEdit_box_mouse
|
||||
//$version_ed dword aVersion_ed
|
||||
|
||||
//$check_box_draw dword aCheck_box_draw
|
||||
//$check_box_mouse dword aCheck_box_mouse
|
||||
//$version_ch dword aVersion_ch
|
||||
|
||||
//$option_box_draw dword aOption_box_draw
|
||||
//$option_box_mouse dword aOption_box_mouse
|
||||
//$version_op dword aVersion_op
|
||||
|
||||
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, flags, size, pos, offset, cl_curs_x, cl_curs_y, shift, shift_old;
|
||||
};
|
||||
|
||||
//void Edit_box_draw(dword edit_b)
|
||||
//{
|
||||
|
||||
// $ PUSH dword edit_b
|
||||
// $ CALL dword [edit_box_draw]
|
||||
//}
|
||||
|
||||
//struct load_dll{
|
||||
// dword way_of_ini, myimport;
|
||||
// void get();
|
||||
//};
|
||||
|
||||
int load_dll(EAX)
|
||||
{
|
||||
//set mask
|
||||
$mov eax,40
|
||||
$mov ebx,0x27
|
||||
$int 0x40
|
||||
// load DLL
|
||||
$mov eax, 68
|
||||
$mov ebx, 19
|
||||
ECX=#way_of_ini;
|
||||
$int 0x40
|
||||
$test eax, eax
|
||||
$jz exit
|
||||
|
||||
// initialize import
|
||||
$mov edx,eax
|
||||
ESI=#edit_box_draw;
|
||||
import_loop:
|
||||
$lodsd
|
||||
$test eax,eax
|
||||
$jz import_done
|
||||
$push edx
|
||||
import_find:
|
||||
$mov ebx,DSDWORD[EDX]
|
||||
$test ebx, ebx
|
||||
$jz exit
|
||||
$push eax
|
||||
nex1:
|
||||
$mov cl,DSBYTE[EAX];
|
||||
$cmp cl,DSBYTE[EBX];
|
||||
$jnz import_find_next
|
||||
$test cl,cl
|
||||
$jz import_found
|
||||
$inc eax
|
||||
$inc ebx
|
||||
$jmp nex1
|
||||
import_find_next:
|
||||
$pop eax
|
||||
$add edx, 8
|
||||
$jmp import_find
|
||||
import_found:
|
||||
$pop eax
|
||||
$mov eax,DSDWORD[edx+4]
|
||||
$mov DSDWORD[esi-4],eax
|
||||
$pop edx
|
||||
$jmp import_loop
|
||||
import_done:
|
||||
return 0;
|
||||
exit:
|
||||
return -1;
|
||||
}
|
551
programs/develop/box_lib/trunk/box_lib.asm
Normal file
551
programs/develop/box_lib/trunk/box_lib.asm
Normal file
@ -0,0 +1,551 @@
|
||||
;Libray from Editbox
|
||||
; SEE YOU File FAQ.txt and HISTORY. Good Like!
|
||||
;;;;;;;;;;;;;;;;;;
|
||||
|
||||
format MS COFF
|
||||
|
||||
public EXPORTS
|
||||
|
||||
section '.flat' code readable align 16
|
||||
include 'macros.inc'
|
||||
include 'editbox.mac' ;¬ ªà®á ª®â®àë© ¤®«¦¥ ®¡«¥£ç¨âì ¦¨§ì :) á¯¥æ¨ «ì® ¤«ï editbox
|
||||
|
||||
edit_box:
|
||||
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+44] ;ª®«-¢® ᨬ¢®«®¢
|
||||
ed_pos equ [edi+48] ;¯®§¨æ¨ï ªãàá®à
|
||||
ed_offset equ [edi+52] ;ᬥ饨¥
|
||||
cl_curs_x equ [edi+56] ;¯à¥¤ë¤ã饥 ª®®à¤¨ â ªãàá®à ¯® å
|
||||
cl_curs_y equ [edi+60] ;¯à¥¤ë¤ã饥 ª®®à¤¨ â ªãàá®à ¯® ã
|
||||
ed_shift_pos equ [edi+64] ;¯®«®¦¥¨¥ ªãàá®à
|
||||
ed_shift_pos_old equ [edi+68] ;áâ ஥ ¯®«®¦¥¨¥ ªãàá®à
|
||||
.draw:
|
||||
pusha
|
||||
mov eax,9
|
||||
push procinfo
|
||||
pop ebx
|
||||
or ecx,-1
|
||||
mcall
|
||||
;--- à¨á㥬 à ¬ªã ---
|
||||
mov edi,dword [esp+36]
|
||||
call .draw_border ; ”ãªæ¨ï áâ ¡¨«ì
|
||||
.draw_bg_cursor_text:
|
||||
;--- ¨§¬¥ï¥¬ ᬥ饨¥, ¥á«¨ ¤® ---
|
||||
call .check_offset ;¢ëç¨á«¥¨¥ ¯®§¨æ¨¨ ªãàá®à áâ ¡¨«ì
|
||||
;--- à¨á㥬 ¢ãâà¥îî ®¡« áâì ---
|
||||
call .draw_bg ; à¨á®¢ âì ¯àאַ㣮«ì¨ª à ¡®ç¥© ®¡« áâ¨
|
||||
;---- à¨á㥬 ¢ë¤¥«¥¨¥, ¯® shift ¥á«¨ ¥áâì
|
||||
call .draw_shift
|
||||
.draw_cursor_text:
|
||||
;--- à¨á㥬 ªãàá®à ---
|
||||
;--- ¬®¦¥â ¥£® ¥ ¤® à¨á®¢ âì ----
|
||||
test word ed_flags,ed_focus
|
||||
je @f
|
||||
call .draw_cursor
|
||||
@@:
|
||||
call .draw_text
|
||||
; ret
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Ž¡é¨© ¢ë室 ¨§ editbox ¤«ï ¢á¥å äãªæ¨© ¨ ¯®áâ ®¡à ¡®â稪®¢
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
.editbox_exit:
|
||||
popa
|
||||
ret 4
|
||||
|
||||
;==========================================================
|
||||
;=== ®¡à ¡®âª ª« ¢¨ âãàë =================================
|
||||
;==========================================================
|
||||
edit_box_key:
|
||||
pusha
|
||||
mov edi,dword [esp+36]
|
||||
test word ed_flags,ed_focus ; ¥á«¨ ¥ ¢ 䮪ãá¥, ¢ë室¨¬
|
||||
je edit_box.editbox_exit
|
||||
test word ed_flags,ed_mouse_on
|
||||
jne edit_box.editbox_exit
|
||||
|
||||
;<3B>஢¥àª ¦ â shift ?
|
||||
call edit_box_key.check_shift
|
||||
;----------------------------------------------------------
|
||||
;--- ¯à®¢¥à塞, çâ® ¦ â® --------------------------------
|
||||
;----------------------------------------------------------
|
||||
use_key_process backspase,delete,left,right,home,end,insert
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;‡ £«ãèª ®¡à ¡®âªã ª« ¢¨è ¢¢¥àå ¨ ¢¨§ â.¥. ¯à¨ ®¡ à㦥¨¨ íâ¨å ª®¤®¢ ¯à®¨á室¨â ¢ë室 ¨§ ®¡à ¡®â稪
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_key_no_process up,down,esc
|
||||
;--- ¦ â ¤àã£ ï ª« ¢¨è ---
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;<3B>஢¥àª ãáâ ®¢«¥ «¨ ä« £ ¯à¨ ª®â®à®¬ 㦮 ¢ë¢®¤¨âì ⮫쪮 æ¨äàë ¢ 㦮¬ ¡®ªá¥ ¥á«¨ â ª®©¥®¡å®¤¨¬®á⨠¥â 㦮 § ª®¬¥â¨à®¢ âì ¬ ªà®á
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_key_figures_only
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;¯à®¢¥àª shift ¡ë« «¨ ¦ â
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
are_key_shift_press
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
; ¯à®¢¥à塞, 室¨âáï «¨ ªãàá®à ¢ ª®æ¥ + ¤ «ì¥©è ï ®¡à ¡®âª
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
are_key_cur_end
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Ž¡à ¡®âª ª« ¢¨è insert,delete.backspase,home,end,left,right
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_work_key
|
||||
|
||||
;==========================================================
|
||||
;=== ®¡à ¡®âª ¬ëè¨ =======================================
|
||||
;==========================================================
|
||||
;save for stdcall ebx,esi,edi,ebp
|
||||
edit_box_mouse:
|
||||
pop eax ;opint to back
|
||||
pop edx ;scr_w
|
||||
pop ecx ;ebp ;scr_h
|
||||
push eax
|
||||
|
||||
; pop eax
|
||||
; pop edx ;scr_w
|
||||
; pop ecx ;scr_h
|
||||
; push eax ;pointer to back
|
||||
pusha
|
||||
mov ebp,ecx
|
||||
|
||||
mov edi,dword [esp+36]
|
||||
;debug
|
||||
;----------------------------------------------------------
|
||||
;--- ¯®«ãç ¥¬ á®áâ®ï¨¥ ª®¯®ª ¬ëè¨ -----------------------
|
||||
;----------------------------------------------------------
|
||||
mcall 37,2
|
||||
;----------------------------------------------------------
|
||||
;--- ¯à®¢¥à塞 á®áâ®ï¨¥ ----------------------------------
|
||||
;----------------------------------------------------------
|
||||
test eax,1
|
||||
jnz edit_box_mouse.mouse_left_button
|
||||
and word ed_flags,ed_mouse_on_off
|
||||
xor ebx,ebx
|
||||
mov dword [mouse_flag],ebx
|
||||
jmp edit_box.editbox_exit
|
||||
.mouse_left_button:
|
||||
;----------------------------------------------------------
|
||||
;--- ¡«®ª¨à®¢ª ®â 䮪ãá¨à®¢ª¨ ¢ ¤àã£¨å ¡®ªá å ¯à¨ ¯®¯ ¤ ¨¨ ¨å ªãàá®à
|
||||
;----------------------------------------------------------
|
||||
mov eax,dword [mouse_flag]
|
||||
test eax,eax
|
||||
jz @f
|
||||
cmp eax,edi
|
||||
je @f
|
||||
jmp edit_box_mouse._blur
|
||||
;----------------------------------------------------------
|
||||
;--- ¯®«ãç ¥¬ ª®®à¤¨ âë ¬ëè¨ ®â®á¨â¥«ì® 0 â.¥ ¢á¥© ®¡« á⨠íªà
|
||||
;----------------------------------------------------------
|
||||
@@: mcall 37,0
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;”ãªæ¨ï ®¡à ¡®âª¨ ¬ë誨 ¯®«ã票¥ ª®®à¤¨ â ¨ ¯à®¢¥àª ¨å + ¢ë¤¥«¥¨ï
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_work_mouse
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Ž¡é¨¥ äãªæ¨¨ ®¡à ¡®âª¨
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_general_func
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;”ãªæ¨¨ ¤«ï à ¡®âë á key
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_key_func
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;”ãªæ¨¨ ¤«ï à ¡®âë á mouse
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
use_mouse_func ;scr_w
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Bit mask from editbox
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
ed_figure_only= 1000000000000000b ;®¤¨ ᨬ¢®«ë
|
||||
ed_always_focus= 100000000000000b
|
||||
ed_focus= 10b ;䮪ãá ¯à¨«®¦¥¨ï
|
||||
ed_shift_on= 1000b ;¥á«¨ ¥ ãáâ ®¢«¥ -§ ç¨â ¢¯¥à¢ë¥ ¦ â shift,¥á«¨ ¡ë« ãáâ ®¢«¥, § ç¨â ¬ë 㦥 çâ® - â® ¤¥« «¨ 㤥ন¢ ï shift
|
||||
ed_shift_on_off=1111111111110111b
|
||||
ed_shift= 100b ;¢ª«îç ¥âáï ¯à¨ ¦ ⨨ shift â.¥. ¥á«¨ ¦¨¬ î
|
||||
ed_shift_off= 1111111111111011b
|
||||
ed_shift_bac= 10000b ;¡¨â ¤«ï ®ç¨á⪨ ¢ë¤¥«¥®£® shift â.¥. ¯à¨ ãáâ ®¢ª¥ £®¢®à¨â çâ® ¥áâì ¢ë¤¥«¥¨¥
|
||||
ed_shift_bac_cl=1111111111101111b ;®ç¨á⪠¯à¨ 㤠«¥¨¨ ¢ë¤¥«¥¨ï
|
||||
ed_shift_cl= 1111111111100011b
|
||||
ed_shift_mcl= 1111111111111011b
|
||||
ed_left_fl= 100000b
|
||||
ed_right_fl= 1111111111011111b
|
||||
ed_offset_fl= 1000000b
|
||||
ed_offset_cl= 1111111110111111b
|
||||
ed_insert= 10000000b
|
||||
ed_insert_cl= 1111111101111111b
|
||||
ed_mouse_on = 100000000b
|
||||
ed_mous_adn_b= 100011000b
|
||||
ed_mouse_on_off=1111111011111111b
|
||||
ed_height=14 ; ¢ëá®â
|
||||
|
||||
;----------------------------------------------------
|
||||
;CheckBox
|
||||
;----------------------------------------------------
|
||||
check_box_draw:
|
||||
;ch_struc_size=24
|
||||
ch_left equ [edi] ;ª®®à¤¨ â ç « à¨á®¢ ¨ï ¯® å
|
||||
ch_top equ [edi+2] ;ª®®à¤¨ â ç « à¨á®¢ ¨ï ¯® ã
|
||||
ch_text_margin equ [edi+4] ;=4 à ááâ®ï¨¥ ®â ¯àאַ㣮«ì¨ª 祪 ¡®ªá ¤® ¤¯¨á¨
|
||||
ch_size equ [edi+8] ;12 à §¬¥à ª¢ ¤à â 祪 ¡®ªá
|
||||
ch_color equ [edi+12]
|
||||
ch_border_color equ [edi+16] ; or [edi+4] ;梥â à ¬ª¨ checkbox ¥¥ ¬®¦® § ¤ âì á ¬®áâ®ï⥫ì®
|
||||
ch_text_color equ [edi+20];[edi+4] ;梥â ⥪áâ
|
||||
ch_text_ptr equ [edi+24] ;㪠§ ⥫ì ç «® ⥪á⮢®© áâப¨
|
||||
ch_text_length equ [edi+28]
|
||||
ch_flags equ [edi+32] ;ä« £¨
|
||||
|
||||
pusha ;á®åà ¨¬ ¢á¥ ॣ¨áâàë
|
||||
mov edi,dword [esp+36]
|
||||
mov eax,13
|
||||
movzx ebx,word ch_left
|
||||
shl ebx,16
|
||||
add ebx,ch_size
|
||||
mov ecx,ch_top
|
||||
shl ecx,16
|
||||
add ecx,dword ch_size
|
||||
mov edx,dword ch_border_color
|
||||
mcall ;à¨á㥬 à ¬ªã
|
||||
|
||||
mov edx,dword ch_color
|
||||
add ebx,1 shl 16 - 2
|
||||
add ecx,1 shl 16 - 2
|
||||
mcall ;§ ªà 訢 ¥¬ ¢ãâ८á⨠祪¡®ªá
|
||||
|
||||
test dword ch_flags,2 ;¤®áâ âì § 票¥ ¡¨â ¨§ ¯¥à¥¬¥®© ¨ ¯®¬¥áâ¨âì ¢ ä« £ CF
|
||||
jz @f ;¢ ¥á«¨ CF=1, â® ¢ë¯®«¨¬ á«¥¤ãîéãî ¯à®æ¥¤ãàã ¨ ç¥ ¯¥à¥©â¨ ¨¦îî @@
|
||||
call check_box_draw_ch ; à¨á®¢ âì ¢ª«îç¥ë© 祪 ¡®ªá
|
||||
@@:
|
||||
;----------------------------
|
||||
;à áç¥â ªã¤ ¡ã¤¥â ¯à®¨§¢¥¤¥ ¢ë¢®¤ ⥪áâ
|
||||
;----------------------------
|
||||
movzx ebx,word ch_left ;§ £à㧨âì § 票¥ å ¤«ï 祪 ¡®ªá
|
||||
add ebx,dword ch_size
|
||||
add ebx,dword ch_text_margin;¤®¡ ¢¨âì à §¬¥à áâ®à®ë ¨ à ááâ®ï¨¥ ª®â®à®¬ ç¥âáï ¢ë¢®¤ ⥪áâ
|
||||
shl ebx,16 ;ᤢ¨¥¬ 16 à §à冷¢ ¢ «¥¢® (㬮¦¨¬ 65536)
|
||||
mov bx,word ch_top ;§ £à㧨¬ § 票¥ ¯® y
|
||||
add ebx,ch_size
|
||||
mov ecx,dword ch_text_color ;§ £à㧨¬ 梥⠤¯¨á¨ + flags
|
||||
sub ebx,7 ;¤®¡ ¢¨¬ § 票¥ ¤«¨ë áâ®à®ë -9+2
|
||||
|
||||
mov edx,dword ch_text_ptr ;㪠¦¥¬ ¤à¥á ®â ªã¤ 㦮 ¢ë¢®¤¨âì áâபã
|
||||
mov esi,dword ch_text_length
|
||||
;¢¥á¥¬ ¢ eax § 票¥ ¢ë¢®¤ ¤¯¨á¨ ª ¢ã
|
||||
mov eax,4
|
||||
mcall ;‚뢮¤
|
||||
popa ;¢®ááâ ®¢¨âì § 票ï ॣ¨áâ஢ ¨§ á⥪
|
||||
ret 4 ;¢ë©¤¥¬ ¨§ ¯à®æ¥¤ãàë
|
||||
|
||||
check_box_clear_ch: ;®ç¨á⪠祪 ¡®ªá
|
||||
mov edx,dword ch_color ;梥⠢ãâਠ祪 ¡®ªá
|
||||
jmp @f ;¡¥§ãá«®¢ë© ¯à릮ª ¨¦îî ¬¥âªã @@
|
||||
|
||||
check_box_draw_ch: ; à¨á®¢ âì ¢ª«îç¥ë© 祪 ¡®ªá
|
||||
mov edx,dword ch_border_color ;§ £à㧨âì 梥â
|
||||
@@:
|
||||
movzx ebx,word ch_left ;§ £à㧨âì ª®®à¤¨ âã ¯® å
|
||||
mov eax,dword ch_size
|
||||
push ax
|
||||
shr eax,2
|
||||
add ebx,eax ;¤®¡ ¢¨âì (áâ®à® ¯àאַ㣮«ì¨ª /3)
|
||||
shl ebx,16 ;ᤢ¨¥¬ 16 à §à冷¢ ¢ «¥¢® (㬮¦¨¬ 65536)
|
||||
pop bx
|
||||
shr bx,1 ;§ £à㧨âì (áâ®à® ¯àאַ㣮«ì¨ª /2)
|
||||
mov bp,bx ;á®åà ¨¬ ॣ¨áâà bx ¢ ॣ¨áâॠ㪠§ â¥«ï ¡ §ë
|
||||
|
||||
movzx ecx,word ch_top ;§ £à㧨âì ª®®à¤¨ âã ¯® ã
|
||||
mov eax,dword ch_size
|
||||
shr eax,2
|
||||
add ecx,eax ;¤®¡ ¢¨âì (áâ®à® ¯àאַ㣮«ì¨ª /4)
|
||||
shl ecx,16 ;ᤢ¨¥¬ 16 à §à冷¢ ¢ «¥¢® (㬮¦¨¬ 65536)
|
||||
mov cx,bp ;§ £à㧨¬ § 票ï ॣ¨áâà 㪠§ â¥«ï ¡ §ë ¢ cx
|
||||
mov eax,13 ;¢ eax - § 票ï äãªæ¨¨ ¤«ï ¢ë¢®¤ ¯®«®áë â.¥. ¯® áã⨠¯àאַ㣮«ì¨ª , ª®â®àë© ®â®¡à ¦ ¥â ¢ª«îç¥ë© ª®¬¯®¥â 祪 ¡®ªá
|
||||
mcall ;¢ë¢®¤
|
||||
ret ;¢ë©â¨ ¨§ ¯à®æ¥¤ãàë
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Ž¡à ¡®â稪 mouse
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
check_box_mouse: ;®¡à ¡®âª ¬ëè¨
|
||||
pusha
|
||||
mov edi,dword [esp+36]
|
||||
mov eax,37 ;¡ã¤¥¬ çâ® â® ¤¥« âì ¥á«¨ ã á çâ® - ¨âì ¦ â®
|
||||
mov ebx,2 ;¢¥á⨠¢ ॣ¨áâà § 票¥ 2
|
||||
mcall ;¯à®¢¥àª ¥ ¦ « «¨ ¯®«ì§®¢ â¥«ì ª®¯ªã ¬ë誨
|
||||
test eax,eax ;¯à®¢¥àª ¥á«¨ ã á ¢ eax=0, â® ãáâ ®¢¨¬ ä« £ ¨ ¢ë©¤¥¬
|
||||
jnz @f ;¯¥à¥©â¨ ¨¦îî ¬¥âªã @@
|
||||
btr dword ch_flags,2 ;¨§¢«¥ç¥¨¥ § ç¥¨ï § ¤ ®£® ¡¨â ¢ ä« £ cf ¨ ¨§¬¥¥¨¥ ¥£® § 票ï ã«¥¢®¥.
|
||||
jmp check_box_mouse_end
|
||||
|
||||
@@:
|
||||
bts dword ch_flags,2 ;¯à®¢¥àª ä« £ â.¥. ¯¥à¥®á ¢ cf § 票¥ ¡¨â ¨ ãáâ ®¢ª ¡¨â ¢ á®áâ®ï¨¥ ¢ª«î祮
|
||||
jc check_box_mouse_end ;¥á«¨ CF=1 â® ¯¥à¥©â¨ ¢ ª®¥æ â.¥. íâ® ¢ë室
|
||||
mov esi,dword ch_text_length ;§ £à㧨âì ª®«-¢® ᨬ¢®«®¢ ¢ ⥪á⮢®© áâப¥
|
||||
;“¬®¦¥¨¥ 6 <20>ëáâ஥ 㬮¦¥¨¥ ¬®¦® ¢®á¯®«ì§®¢ âìáï «î¡ë¬ ¬§ ¬¥â®¤®¢, ® áâ àëå <20>à®æ¥áá®à å (386,486,P1)¡ëáâ॥ ¡ã¤¥â á ¨áâàãªæ¨¥© Lea
|
||||
;lea esi,[eax*2+eax]
|
||||
;shl eax,1
|
||||
imul esi,6 ; ¨«¨ ¬®¦® ¨ â ª 㬮¦¨âì 6
|
||||
add esi,dword ch_text_margin ;¤®¡ ¢¨âì 3 - à ááâ®ï¨¥ ®â 祪 ¡®ªá ¤® ¤¯¨á¨
|
||||
|
||||
mov eax,37 ;¯®«ã稬 ª®®à¤¨ âë ¬ë誨
|
||||
mov ebx,1 ;¤®¡ ¢¨âì 1
|
||||
mcall ;¯®«ãç¨âì ª®®à¤¨ âë ªãàá®à ®â®á¨â¥«ì® ®ª
|
||||
|
||||
movzx ebx,word ch_top ;§ £à㧨âì ¢ bx § 票¥ ª®®à¤¨ âë ã
|
||||
cmp ax,bx ;áà ¢¨âì á á ª®®à¤¨ ⮩ ªãàá®à
|
||||
jl check_box_mouse_end ;SF <> OF ¥á«¨ ¬¥ìè¥
|
||||
add ebx,dword ch_size ;¤®¡ ¢¨âì à §¬¥à
|
||||
cmp ax,bx ;áà ¢¨âì
|
||||
jg check_box_mouse_end ;ZF = 0 ¨ SF = OF ¥á«¨ ¡®«ìè¥
|
||||
|
||||
shr eax,16 ;à §¤¥«¨¬ 65536 ¨«¨ ¯à®á⮠ᤢ¨¥¬ ¡¨âë 16 § 票©
|
||||
movzx ebx,word ch_left ;¯à®¨§¢¥¤¥¬ «®£¨ç®¥ áà ¢¥¨¥
|
||||
cmp ax,bx ;áà ¢¨âì ॣ¨áâàë
|
||||
jl check_box_mouse_end ;¥á«¨ ¬¥ìè¥
|
||||
add ebx,dword ch_size ;¤®¡ ¢¨âì ¤«¨ã áâ®à®ë ¯àאַ㣮«ì¨ª
|
||||
add ebx,esi ;“ç¥áâì ¢ § 票¨ ¯® å ¥é¥ ¨ ¤«¨ã ¤¯¨á¨ ª 祪¡®ªáã
|
||||
cmp ax,bx ;áâà ¢¨âì ॣ¨áâàë
|
||||
jg check_box_mouse_end ;¥á«¨ ¡®«ìè¥
|
||||
|
||||
bts dword ch_flags,1 ;¨§¢«¥ç¥¨¥ § ç¥¨ï § ¤ ®£® ¡¨â ¢ ä« £ cf ¨ ¨§¬¥¥¨¥ ¥£® § 票ï 1.
|
||||
jc @f ;CF=1 â® ¯¥à¥©â¨ ¨¦îî @@
|
||||
|
||||
call check_box_draw_ch ;®â®¡à §¨âì ¢ª«îç¥ë© 祪 ¡®ªá
|
||||
; mov dword [esp+24],1 ;¤ «ì¥©è ï ¯à®¢¥àª 祪 ¡®ªá®¢ ¡¥á¬ëá«¥ , ¯® í⮬㠢 á⥪, £¤¥ à ᯮ« £ ¥âáï ecx ¯®¬¥áâ¨â¬ 0
|
||||
jmp check_box_mouse_end ;¢ë©â¨
|
||||
@@:
|
||||
btr word ch_flags,1 ;¨§¢«¥ç¥¨¥ § ç¥¨ï § ¤ ®£® ¡¨â ¢ ä« £ cf ¨ ¨§¬¥¥¨¥ ¥£® § 票ï ã«¥¢®¥.
|
||||
call check_box_clear_ch ;¢ëª«îç¨âì 祪 ¡®ªá â.¥. ¬¥á⥠§ ªà 襮£® ¯àאַ㣮«ì¨ª ®â®¡à §¨âì 梥â ä® .
|
||||
check_box_mouse_end:
|
||||
popa ;¢®ááâ ®¢¨âì ॣ¨áâàë ¨§ á⥪
|
||||
ret 4 ;¢ë©â¨
|
||||
|
||||
;--------------------------------------------------
|
||||
;radiobutton Group
|
||||
;--------------------------------------------------
|
||||
option_box_draw_box:
|
||||
option_group equ [edi]
|
||||
op_left equ [edi+4] ;ª®®à¤¨ â ç « à¨á®¢ ¨ï ¯® å
|
||||
op_top equ [edi+6] ;ª®®à¤¨ â ç « à¨á®¢ ¨ï ¯® ã
|
||||
op_text_margin equ [edi+8] ;=4 à ááâ®ï¨¥ ®â ¯àאַ㣮«ì¨ª 祪 ¡®ªá ¤® ¤¯¨á¨
|
||||
op_size equ [edi+12] ;12 à §¬¥à ª¢ ¤à â 祪 ¡®ªá
|
||||
op_color equ [edi+16]
|
||||
op_border_color equ [edi+20] ; or [edi+4] ;梥â à ¬ª¨ checkbox ¥¥ ¬®¦® § ¤ âì á ¬®áâ®ï⥫ì®
|
||||
op_text_color equ [edi+24];[edi+4] ;梥â ⥪áâ
|
||||
op_text_ptr equ [edi+28] ;㪠§ ⥫ì ç «® ⥪á⮢®© áâப¨
|
||||
op_text_length equ [edi+32]
|
||||
op_flags equ [edi+36] ;ä« £¨
|
||||
|
||||
pusha ;á®åà ¨¬ ¢á¥ ॣ¨áâàë
|
||||
|
||||
movzx ebx,word op_left
|
||||
shl ebx,16
|
||||
add ebx,dword op_size
|
||||
movzx ecx,word op_top
|
||||
shl ecx,16
|
||||
add ecx,dword op_size
|
||||
mov edx,dword op_border_color
|
||||
mov eax,13
|
||||
mcall ;à¨á㥬 à ¬ªã
|
||||
|
||||
mov edx,dword op_color
|
||||
add ebx,1 shl 16 - 2
|
||||
add ecx,1 shl 16 - 2
|
||||
mcall ;§ ªà 訢 ¥¬ ¢ãâ८á⨠祪¡®ªá
|
||||
|
||||
; mov eax,dword option_group
|
||||
; mov dword eax,[eax]
|
||||
; cmp eax,edi
|
||||
; jne @f
|
||||
; call option_box_draw_op ; à¨á®¢ âì ¢ª«îç¥ë© 祪 ¡®ªá
|
||||
|
||||
|
||||
;----------------------------
|
||||
;à áç¥â ªã¤ ¡ã¤¥â ¯à®¨§¢¥¤¥ ¢ë¢®¤ ⥪áâ
|
||||
;----------------------------
|
||||
@@: movzx ebx,word op_left ;§ £à㧨âì § 票¥ å ¤«ï 祪 ¡®ªá
|
||||
add ebx,dword op_size
|
||||
add ebx,dword op_text_margin;¤®¡ ¢¨âì à §¬¥à áâ®à®ë ¨ à ááâ®ï¨¥ ª®â®à®¬ ç¥âáï ¢ë¢®¤ ⥪áâ
|
||||
shl ebx,16 ;ᤢ¨¥¬ 16 à §à冷¢ ¢ «¥¢® (㬮¦¨¬ 65536)
|
||||
mov bx,word op_top ;§ £à㧨¬ § 票¥ ¯® y
|
||||
add ebx,op_size
|
||||
mov ecx,dword op_text_color ;§ £à㧨¬ 梥⠤¯¨á¨ + flags
|
||||
sub ebx,7 ;¤®¡ ¢¨¬ § 票¥ ¤«¨ë áâ®à®ë -9+2
|
||||
|
||||
mov edx,dword op_text_ptr ;㪠¦¥¬ ¤à¥á ®â ªã¤ 㦮 ¢ë¢®¤¨âì áâபã
|
||||
mov esi,dword op_text_length
|
||||
;¢¥á¥¬ ¢ eax § 票¥ ¢ë¢®¤ ¤¯¨á¨ ª ¢ã
|
||||
mov eax,4
|
||||
mcall ;‚뢮¤
|
||||
popa ;¢®ááâ ®¢¨âì § 票ï ॣ¨áâ஢ ¨§ á⥪
|
||||
ret ;¢ë©¤¥¬ ¨§ ¯à®æ¥¤ãàë
|
||||
|
||||
option_box_clear_op: ;®ç¨á⪠祪 ¡®ªá
|
||||
mov edx,dword op_color ;梥⠢ãâਠ祪 ¡®ªá
|
||||
jmp @f ;¡¥§ãá«®¢ë© ¯à릮ª ¨¦îî ¬¥âªã @@
|
||||
|
||||
|
||||
option_box_draw_op: ; à¨á®¢ âì ¢ª«îç¥ë© 祪 ¡®ªá
|
||||
mov edx,dword op_border_color ;§ £à㧨âì 梥â
|
||||
@@:
|
||||
movzx ebx,word op_left ;§ £à㧨âì ª®®à¤¨ âã ¯® å
|
||||
mov eax,dword op_size
|
||||
push ax
|
||||
shr eax,2
|
||||
add ebx,eax ;¤®¡ ¢¨âì (áâ®à® ¯àאַ㣮«ì¨ª /3)
|
||||
shl ebx,16 ;ᤢ¨¥¬ 16 à §à冷¢ ¢ «¥¢® (㬮¦¨¬ 65536)
|
||||
pop bx
|
||||
shr bx,1 ;§ £à㧨âì (áâ®à® ¯àאַ㣮«ì¨ª /2)
|
||||
mov bp,bx ;á®åà ¨¬ ॣ¨áâà bx ¢ ॣ¨áâॠ㪠§ â¥«ï ¡ §ë
|
||||
|
||||
movzx ecx,word op_top ;§ £à㧨âì ª®®à¤¨ âã ¯® ã
|
||||
mov eax,dword op_size
|
||||
shr eax,2
|
||||
add ecx,eax ;¤®¡ ¢¨âì (áâ®à® ¯àאַ㣮«ì¨ª /4)
|
||||
shl ecx,16 ;ᤢ¨¥¬ 16 à §à冷¢ ¢ «¥¢® (㬮¦¨¬ 65536)
|
||||
mov cx,bp ;§ £à㧨¬ § 票ï ॣ¨áâà 㪠§ â¥«ï ¡ §ë ¢ cx
|
||||
mov eax,13 ;¢ eax - § 票ï äãªæ¨¨ ¤«ï ¢ë¢®¤ ¯®«®áë â.¥. ¯® áã⨠¯àאַ㣮«ì¨ª , ª®â®àë© ®â®¡à ¦ ¥â ¢ª«îç¥ë© ª®¬¯®¥â 祪 ¡®ªá
|
||||
mcall ;¢ë¢®¤
|
||||
ret ;¢ë©â¨ ¨§ ¯à®æ¥¤ãàë
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Ž¡à ¡®â稪 mouse
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
option_box_mouse_op: ;®¡à ¡®âª ¬ëè¨
|
||||
pusha
|
||||
mov eax,37 ;¡ã¤¥¬ çâ® â® ¤¥« âì ¥á«¨ ã á çâ® - ¨âì ¦ â®
|
||||
mov ebx,2 ;¢¥á⨠¢ ॣ¨áâà § 票¥ 2
|
||||
mcall ;¯à®¢¥àª ¥ ¦ « «¨ ¯®«ì§®¢ â¥«ì ª®¯ªã ¬ë誨
|
||||
test eax,eax ;¯à®¢¥àª ¥á«¨ ã á ¢ eax=0, â® ãáâ ®¢¨¬ ä« £ ¨ ¢ë©¤¥¬
|
||||
jnz @f ;¯¥à¥©â¨ ¨¦îî ¬¥âªã @@
|
||||
|
||||
jmp option_box_mouse_end
|
||||
;¥á«¨ ¨ç¥£® ¥ ¯à®¨§®è«®, â® ¢®ááâ ®¢¨¬ § 票ï ॣ¨áâ஢ ¨§ á⥪
|
||||
;¢ë室
|
||||
@@:
|
||||
mov esi,dword op_text_length ;§ £à㧨âì ª®«-¢® ᨬ¢®«®¢ ¢ ⥪á⮢®© áâப¥
|
||||
;“¬®¦¥¨¥ 6 <20>ëáâ஥ 㬮¦¥¨¥ ¬®¦® ¢®á¯®«ì§®¢ âìáï «î¡ë¬ ¬§ ¬¥â®¤®¢, ® áâ àëå <20>à®æ¥áá®à å (386,486,P1)¡ëáâ॥ ¡ã¤¥â á ¨áâàãªæ¨¥© Lea
|
||||
;lea esi,[eax*2+eax]
|
||||
;shl eax,1
|
||||
imul esi,6 ; ¨«¨ ¬®¦® ¨ â ª 㬮¦¨âì 6
|
||||
xor ebx,ebx
|
||||
add esi,dword op_text_margin ;¤®¡ ¢¨âì 3 - à ááâ®ï¨¥ ®â 祪 ¡®ªá ¤® ¤¯¨á¨
|
||||
|
||||
mov eax,37 ;¯®«ã稬 ª®®à¤¨ âë ¬ë誨
|
||||
inc ebx ;¤®¡ ¢¨âì 1
|
||||
mcall ;¯®«ãç¨âì ª®®à¤¨ âë ªãàá®à ®â®á¨â¥«ì® ®ª
|
||||
|
||||
movzx ebx,word op_top ;§ £à㧨âì ¢ bx § 票¥ ª®®à¤¨ âë ã
|
||||
cmp ax,bx ;áà ¢¨âì á á ª®®à¤¨ ⮩ ªãàá®à
|
||||
jl option_box_mouse_end ;SF <> OF ¥á«¨ ¬¥ìè¥
|
||||
add ebx,dword op_size ;¤®¡ ¢¨âì à §¬¥à
|
||||
cmp ax,bx ;áà ¢¨âì
|
||||
jg option_box_mouse_end ;ZF = 0 ¨ SF = OF ¥á«¨ ¡®«ìè¥
|
||||
|
||||
shr eax,16 ;à §¤¥«¨¬ 65536 ¨«¨ ¯à®á⮠ᤢ¨¥¬ ¡¨âë 16 § 票©
|
||||
movzx ebx,word op_left ;¯à®¨§¢¥¤¥¬ «®£¨ç®¥ áà ¢¥¨¥
|
||||
cmp ax,bx ;áà ¢¨âì ॣ¨áâàë
|
||||
jl option_box_mouse_end ;¥á«¨ ¬¥ìè¥
|
||||
add ebx,dword op_size ;¤®¡ ¢¨âì ¤«¨ã áâ®à®ë ¯àאַ㣮«ì¨ª
|
||||
add ebx,esi ;“ç¥áâì ¢ § 票¨ ¯® å ¥é¥ ¨ ¤«¨ã ¤¯¨á¨ ª 祪¡®ªáã
|
||||
cmp ax,bx ;áâà ¢¨âì ॣ¨áâàë
|
||||
jg option_box_mouse_end ;¥á«¨ ¡®«ìè¥
|
||||
mov eax,dword option_group
|
||||
mov [eax],edi
|
||||
|
||||
option_box_mouse_end:
|
||||
popa ;¢®ááâ ®¢¨âì ॣ¨áâàë ¨§ á⥪
|
||||
ret ;¢ë©â¨
|
||||
|
||||
option_box_draw:
|
||||
pusha
|
||||
|
||||
mov eax,dword [esp+36]
|
||||
@@: mov edi,dword [eax]
|
||||
test edi,edi
|
||||
je option_check
|
||||
call option_box_draw_box
|
||||
add eax,4
|
||||
jmp @b
|
||||
|
||||
option_check:
|
||||
mov eax,dword [esp+36]
|
||||
@@: mov edi,dword [eax]
|
||||
test edi,edi
|
||||
je @f
|
||||
|
||||
mov ebx,dword [edi]
|
||||
mov ebx,dword [ebx]
|
||||
cmp edi,ebx
|
||||
jne .clear_op
|
||||
|
||||
pusha
|
||||
call option_box_draw_op
|
||||
popa
|
||||
add eax,4
|
||||
jmp @b
|
||||
|
||||
.clear_op:
|
||||
pusha
|
||||
call option_box_clear_op
|
||||
popa
|
||||
add eax,4
|
||||
jmp @b
|
||||
|
||||
|
||||
@@: popa
|
||||
ret 4
|
||||
; exit ¢®®¡é¥ :)
|
||||
|
||||
|
||||
option_box_mouse:
|
||||
pusha
|
||||
|
||||
mov eax,dword [esp+36]
|
||||
@@: mov edi,dword [eax]
|
||||
test edi,edi
|
||||
je option_check
|
||||
call option_box_mouse_op
|
||||
add eax,4
|
||||
jmp @b
|
||||
|
||||
|
||||
align 16
|
||||
EXPORTS:
|
||||
|
||||
dd sz_edit_box, edit_box
|
||||
dd sz_edit_box_key, edit_box_key
|
||||
dd sz_edit_box_mouse, edit_box_mouse
|
||||
dd szVersion_ed, 0x00000001
|
||||
dd sz_check_box_draw, check_box_draw
|
||||
dd sz_check_box_mouse, check_box_mouse
|
||||
dd szVersion_ch, 0x00000001
|
||||
dd sz_option_box_draw, option_box_draw
|
||||
dd sz_option_box_mouse, option_box_mouse
|
||||
dd szVersion_op, 0x00000001
|
||||
dd 0,0
|
||||
|
||||
sz_edit_box db 'edit_box',0
|
||||
sz_edit_box_key db 'edit_box_key',0
|
||||
sz_edit_box_mouse db 'edit_box_mouse',0
|
||||
szVersion_ed db 'version_ed',0
|
||||
sz_check_box_draw db 'check_box_draw',0
|
||||
sz_check_box_mouse db 'check_box_mouse',0
|
||||
szVersion_ch db 'version_ch',0
|
||||
sz_option_box_draw db 'option_box_draw',0
|
||||
sz_option_box_mouse db 'option_box_mouse',0
|
||||
szVersion_op db 'version_op',0
|
||||
|
||||
;;;;;;;;;;;
|
||||
;;Data
|
||||
;;;;;;;;;;;
|
||||
align 16
|
||||
mouse_flag dd 0x0
|
||||
procinfo process_information
|
BIN
programs/develop/box_lib/trunk/box_lib.obj
Normal file
BIN
programs/develop/box_lib/trunk/box_lib.obj
Normal file
Binary file not shown.
1
programs/develop/box_lib/trunk/config.inc
Normal file
1
programs/develop/box_lib/trunk/config.inc
Normal file
@ -0,0 +1 @@
|
||||
__CPU_type fix p5
|
1174
programs/develop/box_lib/trunk/editbox.mac
Normal file
1174
programs/develop/box_lib/trunk/editbox.mac
Normal file
File diff suppressed because it is too large
Load Diff
249
programs/develop/box_lib/trunk/editbox_ex.asm
Normal file
249
programs/develop/box_lib/trunk/editbox_ex.asm
Normal file
@ -0,0 +1,249 @@
|
||||
;§ £®«®¢®ª ¯à¨«®¦¥¨ï
|
||||
use32 ; âà á«ïâ®à, ¨á¯®«ì§ãî騩 32 à §àï¤ëå ª®¬ ¤ë
|
||||
org 0x0 ; ¡ §®¢ë© ¤à¥á ª®¤ , ¢á¥£¤ 0x0
|
||||
db 'MENUET01' ; ¨¤¥â¨ä¨ª â®à ¨á¯®«ï¥¬®£® ä ©« (8 ¡ ©â)
|
||||
dd 0x1 ; ¢¥àá¨ï ä®à¬ â § £®«®¢ª ¨á¯®«ï¥¬®£® ä ©«
|
||||
dd start ; ¤à¥á, ª®â®àë© á¨á⥬ ¯¥à¥¤ ñâ ã¯à ¢«¥¨¥
|
||||
; ¯®á«¥ § £à㧪¨ ¯à¨«®¦¥¨ï ¢ ¯ ¬ïâì
|
||||
dd i_end ; à §¬¥à ¯à¨«®¦¥¨ï
|
||||
dd mem ; Ž¡ê¥¬ ¨á¯®«ì§ã¥¬®© ¯ ¬ïâ¨, ¤«ï á⥪ ®â¢¥¤¥¬ 0å100 ¡ ©â ¨ ¢ë஢¨¬ £à¨æã 4 ¡ ©â
|
||||
dd mem ; à ᯮ«®¦¨¬ ¯®§¨æ¨î á⥪ ¢ ®¡« á⨠¯ ¬ïâ¨, áà §ã § ⥫®¬ ¯à®£à ¬¬ë. ‚¥àè¨ á⥪ ¢ ¤¨ ¯ §®¥ ¯ ¬ïâ¨, 㪠§ ®¬ ¢ëè¥
|
||||
dd 0x0 ; 㪠§ ⥫ì áâபã á ¯ à ¬¥âà ¬¨.
|
||||
dd way_of_ini
|
||||
include 'macros.inc'
|
||||
include 'editbox_ex.mac'
|
||||
start:
|
||||
;Get way for ini file.
|
||||
mov edi,way_of_ini
|
||||
mov ecx,1024
|
||||
xor eax,eax
|
||||
cld
|
||||
repne scasb
|
||||
test ecx,ecx
|
||||
jz @f
|
||||
|
||||
mov esi,1024
|
||||
sub esi,ecx
|
||||
mov ecx,esi
|
||||
std
|
||||
mov al,'/'
|
||||
repne scasb
|
||||
test ecx,ecx
|
||||
jz next_way
|
||||
add edi,2
|
||||
@@:
|
||||
mov esi,ini_file
|
||||
cld
|
||||
|
||||
@@: lodsb
|
||||
test al,al
|
||||
jz @f
|
||||
stosb
|
||||
jmp @b
|
||||
|
||||
@@: xor eax,eax
|
||||
stosb
|
||||
|
||||
; load DLL
|
||||
mov ecx,way_of_ini
|
||||
mov eax, 68
|
||||
mov ebx, 19
|
||||
mcall
|
||||
test eax, eax
|
||||
jz next_way
|
||||
jmp import_init_
|
||||
next_way:
|
||||
mov ecx,ini_file
|
||||
mov eax, 68
|
||||
mov ebx, 19
|
||||
mcall
|
||||
test eax, eax
|
||||
jz exit
|
||||
|
||||
|
||||
|
||||
import_init_:
|
||||
; initialize import
|
||||
mov edx, eax
|
||||
mov esi,myimport
|
||||
import_loop:
|
||||
lodsd
|
||||
test eax, eax
|
||||
jz import_done
|
||||
push edx
|
||||
import_find:
|
||||
mov ebx, [edx]
|
||||
test ebx, ebx
|
||||
jz exit;import_not_found
|
||||
push eax
|
||||
@@:
|
||||
mov cl, [eax]
|
||||
cmp cl, [ebx]
|
||||
jnz import_find_next
|
||||
test cl, cl
|
||||
jz import_found
|
||||
inc eax
|
||||
inc ebx
|
||||
jmp @b
|
||||
import_find_next:
|
||||
pop eax
|
||||
add edx, 8
|
||||
jmp import_find
|
||||
import_found:
|
||||
pop eax
|
||||
mov eax, [edx+4]
|
||||
mov [esi-4], eax
|
||||
pop edx
|
||||
jmp import_loop
|
||||
import_done:
|
||||
|
||||
mcall 40,0x27 ;ãáâ ®¢¨âì ¬ áªã ¤«ï ®¦¨¤ ¥¬ëå ᮡë⨩
|
||||
red_win:
|
||||
call draw_window ;¯¥à¢® ç «ì® ¥®¡å®¤¨¬® à¨á®¢ âì ®ª®
|
||||
align 4
|
||||
still: ;®á®¢®© ®¡à ¡®â稪
|
||||
mcall 10 ;Ž¦¨¤ âì ᮡëâ¨ï
|
||||
dec eax
|
||||
jz red_win
|
||||
dec eax
|
||||
jz key
|
||||
dec eax
|
||||
jz button
|
||||
|
||||
push dword edit1
|
||||
push 22
|
||||
push 5
|
||||
call [edit_box_mouse]
|
||||
|
||||
push dword edit2
|
||||
push 22
|
||||
push 5
|
||||
call [edit_box_mouse]
|
||||
|
||||
push dword check1
|
||||
call [check_box_mouse]
|
||||
|
||||
push dword check2
|
||||
call [check_box_mouse]
|
||||
|
||||
push dword Option_boxs
|
||||
call [option_box_mouse]
|
||||
|
||||
push dword Option_boxs2
|
||||
call [option_box_mouse]
|
||||
|
||||
jmp still ;¥á«¨ ¨ç¥£® ¨§ ¯¥à¥ç¨á«¥®£® ⮠ᮢ ¢ 横«
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
button:
|
||||
mcall 17 ;¯®«ãç¨âì ¨¤¥â¨ä¨ª â®à ¦ ⮩ ª« ¢¨è¨
|
||||
test ah,ah ;¥á«¨ ¢ ah 0, â® ¯¥à¥©â¨ ®¡à ¡®â稪 ᮡë⨩ still
|
||||
jz still
|
||||
exit: mcall -1
|
||||
key:
|
||||
mcall 2 ;§ £à㧨¬ § 票¥ 2 ¢ ॣ¨áâ®à eax ¨ ¯®«ã稬 ª®¤ ¦ ⮩ ª« ¢¨è¨
|
||||
|
||||
push dword edit1
|
||||
call [edit_box_key]
|
||||
|
||||
push dword edit2
|
||||
call [edit_box_key]
|
||||
|
||||
jmp still
|
||||
|
||||
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
align 4
|
||||
draw_window: ;à¨á®¢ ¨¥ ®ª ¯à¨«®¦¥¨ï
|
||||
mcall 12,1
|
||||
mcall 0,(50*65536+390),(30*65536+200),0xb3AABBCC,0x805080DD,hed
|
||||
|
||||
push dword edit1
|
||||
call [edit_box_draw]
|
||||
|
||||
push dword edit2
|
||||
call [edit_box_draw]
|
||||
|
||||
push dword check1
|
||||
call [check_box_draw]
|
||||
|
||||
push dword check2
|
||||
call [check_box_draw]
|
||||
|
||||
push dword Option_boxs
|
||||
call [option_box_draw]
|
||||
|
||||
push dword Option_boxs2
|
||||
call [option_box_draw]
|
||||
|
||||
mcall 12,2
|
||||
ret
|
||||
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
|
||||
;DATA ¤ ë¥
|
||||
ini_file db '/sys/lib/box_lib.obj',0
|
||||
myimport:
|
||||
|
||||
edit_box_draw dd aEdit_box_draw
|
||||
edit_box_key dd aEdit_box_key
|
||||
edit_box_mouse dd aEdit_box_mouse
|
||||
version_ed dd aVersion_ed
|
||||
|
||||
check_box_draw dd aCheck_box_draw
|
||||
check_box_mouse dd aCheck_box_mouse
|
||||
version_ch dd aVersion_ch
|
||||
|
||||
option_box_draw dd aOption_box_draw
|
||||
option_box_mouse dd aOption_box_mouse
|
||||
version_op dd aVersion_op
|
||||
|
||||
dd 0
|
||||
dd 0
|
||||
|
||||
aEdit_box_draw db 'edit_box',0
|
||||
aEdit_box_key db 'edit_box_key',0
|
||||
aEdit_box_mouse db 'edit_box_mouse',0
|
||||
aVersion_ed db 'version_ed',0
|
||||
|
||||
aCheck_box_draw db 'check_box_draw',0
|
||||
aCheck_box_mouse db 'check_box_mouse',0
|
||||
aVersion_ch db 'version_ch',0
|
||||
|
||||
aOption_box_draw db 'option_box_draw',0
|
||||
aOption_box_mouse db 'option_box_mouse',0
|
||||
aVersion_op db 'version_op',0
|
||||
|
||||
|
||||
|
||||
|
||||
check1 check_box 10,45,6,12,0x80AABBCC,0,0,check_text,14,ch_flag_en
|
||||
check2 check_box 10,60,6,12,0x80AABBCC,0,0,check_text2,15
|
||||
|
||||
edit1 edit_box 350,3,5,0xffffff,0x6f9480,0,0xAABBCC,0,308,hed,ed_focus,hed_end-hed-1,hed_end-hed-1
|
||||
edit2 edit_box 350,3,25,0xffffff,0x6a9480,0,0,0,99,ed_buffer,ed_figure_only
|
||||
|
||||
op1 option_box option_group1,10,90,6,12,0xffffff,0,0,op_text.1,op_text.e1-op_text.1
|
||||
op2 option_box option_group1,10,105,6,12,0xFFFFFF,0,0,op_text.2,op_text.e2-op_text.2
|
||||
op3 option_box option_group1,10,120,6,12,0xffffff,0,0,op_text.3,op_text.e3-op_text.3
|
||||
op11 option_box option_group2,120,90,6,12,0xffffff,0,0,op_text.1,op_text.e1-op_text.1
|
||||
op12 option_box option_group2,120,105,6,12,0xffffff,0,0,op_text.2,op_text.e2-op_text.2
|
||||
op13 option_box option_group2,120,120,6,12,0xffffff,0,0,op_text.3,op_text.e3-op_text.3
|
||||
|
||||
option_group1 dd op1 ;㪠§ ⥫¨, ®¨ ®â®¡à ¦ îâáï ¯® 㬮«ç ¨î, ª®£¤ ¢ë¢®¤¨âáï
|
||||
option_group2 dd op12 ;¯à¨«®¦¥¨¥
|
||||
Option_boxs dd op1,op2,op3,0
|
||||
Option_boxs2 dd op11,op12,op13,0
|
||||
hed db 'BOXs load from lib <Lrz> date 27.09.2007',0
|
||||
hed_end:
|
||||
rb 256
|
||||
check_text db 'First checkbox'
|
||||
check_text2 db 'Second checkbox'
|
||||
op_text: ; ‘®¯à®¢®¦¤ î騩 ⥪áâ ¤«ï 祪 ¡®ªá®¢
|
||||
.1 db 'Option_Box #1'
|
||||
.e1:
|
||||
.2 db 'Option_Box #2'
|
||||
.e2:
|
||||
.3 db 'Option_Box #3'
|
||||
.e3:
|
||||
ed_buffer rb 100
|
||||
way_of_ini rb 1024
|
||||
i_end:
|
||||
rb 1024
|
||||
mem:
|
BIN
programs/develop/box_lib/trunk/editbox_ex.kex
Normal file
BIN
programs/develop/box_lib/trunk/editbox_ex.kex
Normal file
Binary file not shown.
77
programs/develop/box_lib/trunk/editbox_ex.mac
Normal file
77
programs/develop/box_lib/trunk/editbox_ex.mac
Normal file
@ -0,0 +1,77 @@
|
||||
ed_struc_size=72
|
||||
struc edit_box width,left,top,color,shift_color,focus_border_color,\
|
||||
blur_border_color,text_color,max,text,flags,size,pos
|
||||
{
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
;Bit mask from editbox
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
ed_figure_only= 1000000000000000b ;®¤¨ ᨬ¢®«ë
|
||||
ed_always_focus= 100000000000000b
|
||||
ed_focus= 10b ;䮪ãá ¯à¨«®¦¥¨ï
|
||||
ed_shift_on= 1000b ;¥á«¨ ¥ ãáâ ®¢«¥ -§ ç¨â ¢¯¥à¢ë¥ ¦ â shift,¥á«¨ ¡ë« ãáâ ®¢«¥, § ç¨â ¬ë 㦥 çâ® - â® ¤¥« «¨ 㤥ন¢ ï shift
|
||||
ed_shift_on_off=1111111111110111b
|
||||
ed_shift= 100b ;¢ª«îç ¥âáï ¯à¨ ¦ ⨨ shift â.¥. ¥á«¨ ¦¨¬ î
|
||||
ed_shift_off= 1111111111111011b
|
||||
ed_shift_bac= 10000b ;¡¨â ¤«ï ®ç¨á⪨ ¢ë¤¥«¥®£® shift â.¥. ¯à¨ ãáâ ®¢ª¥ £®¢®à¨â çâ® ¥áâì ¢ë¤¥«¥¨¥
|
||||
ed_shift_bac_cl=1111111111101111b ;®ç¨á⪠¯à¨ 㤠«¥¨¨ ¢ë¤¥«¥¨ï
|
||||
ed_shift_cl= 1111111111100011b
|
||||
ed_shift_mcl= 1111111111111011b
|
||||
ed_left_fl= 100000b
|
||||
ed_right_fl= 1111111111011111b
|
||||
ed_offset_fl= 1000000b
|
||||
ed_offset_cl= 1111111110111111b
|
||||
ed_insert= 10000000b
|
||||
ed_insert_cl= 1111111101111111b
|
||||
ed_mouse_on = 100000000b
|
||||
ed_mous_adn_b= 100011000b
|
||||
ed_mouse_on_off=1111111011111111b
|
||||
ed_height=14 ; ¢ëá®â
|
||||
|
||||
.width dd width
|
||||
.left dd left
|
||||
.top dd top
|
||||
.color dd color
|
||||
.shift_color dd shift_color
|
||||
.focus_border_color dd focus_border_color
|
||||
.blur_border_color dd blur_border_color
|
||||
.text_color dd text_color
|
||||
.max dd max
|
||||
.text dd text
|
||||
.flags dd flags+0
|
||||
.size dd size+0
|
||||
.pos dd pos+0
|
||||
.offset dd 0
|
||||
.cl_curs_x dd 0
|
||||
.cl_curs_y dd 0
|
||||
.shift dd 0
|
||||
.shift_old dd 0
|
||||
}
|
||||
struc check_box left,top,ch_text_margin,ch_size,color,border_color,text_color,text,ch_text_length,flags
|
||||
{ ;áâàãªâãà ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá
|
||||
ch_flag_en=10b
|
||||
.left: dw left ;+0 ;¯®«®¦¥¨¥ ¯® å
|
||||
.top: dw top ;¯®«®¦¥¨¥ ¯® ã
|
||||
.ch_text_margin: dd ch_text_margin ;à ááâ®ï¨¥ ®â ¯àאַ㣮«ì¨ª 祪 ¡®ªá ¤® ¤¯¨á¨
|
||||
.ch_size: dd ch_size ;à §¬¥à ª¢ ¤à â 祪 ¡®ªá , ¤«ï ¯à¨¬¥à 12
|
||||
.color: dd color ;梥⠢ãâਠ祪¡®ªá
|
||||
.border_color: dd border_color ;梥â à ¬ª¨
|
||||
.text_color: dd text_color ;梥⠤¯¨á¨
|
||||
.text: dd text ; ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à ᯮ«®¦¥ ⥪áâ
|
||||
.ch_text_length: dd ch_text_length ;¤«¨ áâப¨ á ᨬ¢®« ¬¨
|
||||
.flags: dd flags+0 ; ä« £¨
|
||||
}
|
||||
struc option_box point_gr,left,top,op_text_margin,op_size,color,border_color,text_color,text,op_text_length,flags
|
||||
{ ;áâàãªâãà ¯ à ¬¥â஢ ¤«ï 祪 ¡®ªá
|
||||
op_flag_en=10b
|
||||
.option_group: dd point_gr
|
||||
.left: dw left ;+0 ;¯®«®¦¥¨¥ ¯® å
|
||||
.top: dw top ;¯®«®¦¥¨¥ ¯® ã
|
||||
.ch_text_margin: dd op_text_margin ;à ááâ®ï¨¥ ®â ¯àאַ㣮«ì¨ª 祪 ¡®ªá ¤® ¤¯¨á¨
|
||||
.ch_size: dd op_size ;à §¬¥à ª¢ ¤à â 祪 ¡®ªá , ¤«ï ¯à¨¬¥à 12
|
||||
.color: dd color ;梥⠢ãâਠ祪¡®ªá
|
||||
.border_color: dd border_color ;梥â à ¬ª¨
|
||||
.text_color: dd text_color ;梥⠤¯¨á¨
|
||||
.text: dd text ; ¤à¥á ¢ ª®¤¥ ¯à®£à ¬¬ë £¤¥ à ᯮ«®¦¥ ⥪áâ
|
||||
.ch_text_length: dd op_text_length ;¤«¨ áâப¨ á ᨬ¢®« ¬¨
|
||||
.flags: dd flags+0 ; ä« £¨
|
||||
}
|
502
programs/develop/box_lib/trunk/macros.inc
Normal file
502
programs/develop/box_lib/trunk/macros.inc
Normal file
@ -0,0 +1,502 @@
|
||||
@^ fix macro comment {
|
||||
^@ fix }
|
||||
|
||||
|
||||
macro m2m dest,src {
|
||||
push src
|
||||
pop dest
|
||||
}
|
||||
|
||||
|
||||
macro iglobal {
|
||||
IGlobals equ IGlobals,
|
||||
macro __IGlobalBlock { }
|
||||
|
||||
macro uglobal {
|
||||
UGlobals equ UGlobals,
|
||||
macro __UGlobalBlock { }
|
||||
|
||||
endg fix } ; Use endg for ending iglobal and uglobal blocks.
|
||||
|
||||
|
||||
macro IncludeIGlobals{
|
||||
macro IGlobals dummy,[n] \{ __IGlobalBlock
|
||||
purge __IGlobalBlock \}
|
||||
match I, IGlobals \{ I \} }
|
||||
|
||||
macro IncludeUGlobals{
|
||||
macro UGlobals dummy,[n] \{
|
||||
\common
|
||||
\local begin, size
|
||||
begin = $
|
||||
virtual at $
|
||||
\forward
|
||||
__UGlobalBlock
|
||||
purge __UGlobalBlock
|
||||
\common
|
||||
size = $ - begin
|
||||
end virtual
|
||||
rb size
|
||||
\}
|
||||
match U, UGlobals \{ U \} }
|
||||
|
||||
uglobal
|
||||
endg
|
||||
|
||||
iglobal
|
||||
endg
|
||||
|
||||
|
||||
; new application structure
|
||||
macro meos_app_start
|
||||
{
|
||||
use32
|
||||
org 0x0
|
||||
|
||||
db 'MENUET01'
|
||||
dd 0x01
|
||||
dd __start
|
||||
dd __end
|
||||
dd __memory
|
||||
dd __stack
|
||||
|
||||
if used __params & ~defined __params
|
||||
dd __params
|
||||
else
|
||||
dd 0x0
|
||||
end if
|
||||
|
||||
dd 0x0
|
||||
}
|
||||
MEOS_APP_START fix meos_app_start
|
||||
|
||||
macro code
|
||||
{
|
||||
__start:
|
||||
}
|
||||
CODE fix code
|
||||
|
||||
macro data
|
||||
{
|
||||
__data:
|
||||
IncludeIGlobals
|
||||
}
|
||||
DATA fix data
|
||||
|
||||
macro udata
|
||||
{
|
||||
if used __params & ~defined __params
|
||||
__params:
|
||||
db 0
|
||||
__end:
|
||||
rb 255
|
||||
else
|
||||
__end:
|
||||
end if
|
||||
__udata:
|
||||
IncludeUGlobals
|
||||
}
|
||||
UDATA fix udata
|
||||
|
||||
macro meos_app_end
|
||||
{
|
||||
align 32
|
||||
rb 2048
|
||||
__stack:
|
||||
__memory:
|
||||
}
|
||||
MEOS_APP_END fix meos_app_end
|
||||
|
||||
|
||||
; macro for defining multiline text data
|
||||
struc mstr [sstring]
|
||||
{
|
||||
forward
|
||||
local ssize
|
||||
virtual at 0
|
||||
db sstring
|
||||
ssize = $
|
||||
end virtual
|
||||
dd ssize
|
||||
db sstring
|
||||
common
|
||||
dd -1
|
||||
}
|
||||
|
||||
; macro for defining multiline text data
|
||||
struc mls [sstring]
|
||||
{
|
||||
forward
|
||||
local ssize
|
||||
virtual at 0
|
||||
db sstring ; mod
|
||||
ssize = $
|
||||
end virtual
|
||||
db ssize
|
||||
db sstring
|
||||
common
|
||||
db -1 ; mod
|
||||
}
|
||||
|
||||
|
||||
|
||||
; strings
|
||||
macro sz name,[data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
if used name
|
||||
name db data
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
macro lsz name,[lng,data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
if used name
|
||||
label name
|
||||
forward
|
||||
if lang eq lng
|
||||
db data
|
||||
end if
|
||||
common
|
||||
.size = $-name
|
||||
end if
|
||||
}
|
||||
|
||||
macro szc name,elsz,[data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
local s,m
|
||||
m = 0
|
||||
if used name
|
||||
label name
|
||||
forward
|
||||
virtual at 0
|
||||
db data
|
||||
s = $
|
||||
end virtual
|
||||
d#elsz s
|
||||
if m < s
|
||||
m = s
|
||||
end if
|
||||
db data
|
||||
common
|
||||
.size = $-name
|
||||
.maxl = m
|
||||
end if
|
||||
}
|
||||
|
||||
macro lszc name,elsz,[lng,data] { ; from MFAR [mike.dld]
|
||||
common
|
||||
local s,m,c
|
||||
m = 0
|
||||
c = 0
|
||||
if used name
|
||||
label name
|
||||
forward
|
||||
if lang eq lng
|
||||
virtual at 0
|
||||
db data
|
||||
s = $
|
||||
end virtual
|
||||
d#elsz s
|
||||
if m < s
|
||||
m = s
|
||||
end if
|
||||
db data
|
||||
c = c+1
|
||||
end if
|
||||
common
|
||||
.size = $-name
|
||||
.maxl = m
|
||||
.count = c
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
; easy system call macro
|
||||
macro mpack dest, hsrc, lsrc
|
||||
{
|
||||
if (hsrc eqtype 0) & (lsrc eqtype 0)
|
||||
mov dest, (hsrc) shl 16 + lsrc
|
||||
else
|
||||
if (hsrc eqtype 0) & (~lsrc eqtype 0)
|
||||
mov dest, (hsrc) shl 16
|
||||
add dest, lsrc
|
||||
else
|
||||
mov dest, hsrc
|
||||
shl dest, 16
|
||||
add dest, lsrc
|
||||
end if
|
||||
end if
|
||||
}
|
||||
|
||||
macro __mov reg,a,b { ; mike.dld
|
||||
if (~a eq)&(~b eq)
|
||||
mpack reg,a,b
|
||||
else if (~a eq)&(b eq)
|
||||
mov reg,a
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
include 'config.inc'
|
||||
;__CPU_type equ p5
|
||||
SYSENTER_VAR equ 0
|
||||
|
||||
macro mcall a,b,c,d,e,f,i { ; mike.dld, updated by Ghost for Fast System Calls
|
||||
local ..ret_point
|
||||
__mov eax,a
|
||||
__mov ebx,b
|
||||
__mov ecx,c
|
||||
__mov edx,d
|
||||
__mov esi,e
|
||||
__mov edi,f
|
||||
__mov ebp,i
|
||||
|
||||
if __CPU_type eq p5
|
||||
int 0x40
|
||||
else
|
||||
if __CPU_type eq p6
|
||||
push ebp
|
||||
mov ebp, esp
|
||||
push ..ret_point ; it may be 2 or 5 byte
|
||||
sysenter
|
||||
..ret_point:
|
||||
pop edx
|
||||
pop ecx
|
||||
|
||||
else
|
||||
if __CPU_type eq k6
|
||||
push ecx
|
||||
syscall
|
||||
pop ecx
|
||||
else
|
||||
display 'ERROR : unknown CPU type'
|
||||
int 0x40
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
; -------------------------
|
||||
macro header a,[b] {
|
||||
common
|
||||
use32
|
||||
org 0
|
||||
db 'MENUET',a
|
||||
forward
|
||||
if b eq
|
||||
dd 0
|
||||
else
|
||||
dd b
|
||||
end if }
|
||||
macro section name { align 16
|
||||
label name }
|
||||
macro func name {
|
||||
if ~used name
|
||||
display 'FUNC NOT USED: ',`name,13,10
|
||||
else
|
||||
align 4
|
||||
name:
|
||||
;diff16 `name,0,name
|
||||
;pushad
|
||||
;pushfd
|
||||
;dps `name
|
||||
;newline
|
||||
;mcall 5,1
|
||||
;popfd
|
||||
;popad
|
||||
}
|
||||
macro endf { end if }
|
||||
|
||||
macro diff16 title,l1,l2
|
||||
{
|
||||
local s,d
|
||||
s = l2-l1
|
||||
display title,': 0x'
|
||||
repeat 8
|
||||
d = '0' + s shr ((8-%) shl 2) and $0F
|
||||
if d > '9'
|
||||
d = d + 'A'-'9'-1
|
||||
end if
|
||||
display d
|
||||
end repeat
|
||||
display 13,10
|
||||
}
|
||||
|
||||
macro diff10 title,l1,l2
|
||||
{
|
||||
local s,d,z,m
|
||||
s = l2-l1
|
||||
z = 0
|
||||
m = 1000000000
|
||||
display title,': '
|
||||
repeat 10
|
||||
d = '0' + s / m
|
||||
s = s - (s/m)*m
|
||||
m = m / 10
|
||||
if d <> '0'
|
||||
z = 1
|
||||
end if
|
||||
if z <> 0
|
||||
display d
|
||||
end if
|
||||
end repeat
|
||||
display 13,10
|
||||
}
|
||||
|
||||
; optimize the code for size
|
||||
__regs fix <eax,ebx,ecx,edx,esi,edi,ebp,esp>
|
||||
|
||||
macro add arg1,arg2
|
||||
{
|
||||
if (arg2 eqtype 0)
|
||||
if (arg2) = 1
|
||||
inc arg1
|
||||
else
|
||||
add arg1,arg2
|
||||
end if
|
||||
else
|
||||
add arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
macro sub arg1,arg2
|
||||
{
|
||||
if (arg2 eqtype 0)
|
||||
if (arg2) = 1
|
||||
dec arg1
|
||||
else
|
||||
sub arg1,arg2
|
||||
end if
|
||||
else
|
||||
sub arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
macro mov arg1,arg2
|
||||
{
|
||||
if (arg1 in __regs) & ((arg2 eqtype 0) | (arg2 eqtype '0'))
|
||||
if (arg2) = 0
|
||||
xor arg1,arg1
|
||||
else if (arg2) = 1
|
||||
xor arg1,arg1
|
||||
inc arg1
|
||||
else if (arg2) = -1
|
||||
or arg1,-1
|
||||
else if (arg2) > -128 & (arg2) < 128
|
||||
push arg2
|
||||
pop arg1
|
||||
else
|
||||
mov arg1,arg2
|
||||
end if
|
||||
else
|
||||
mov arg1,arg2
|
||||
end if
|
||||
}
|
||||
|
||||
|
||||
macro RGB [a] {
|
||||
common
|
||||
match (r=,g=,b),a \{
|
||||
\dd ((r) shl 16) or ((g) shl 8) or (b)
|
||||
\}
|
||||
}
|
||||
|
||||
|
||||
struc POINT _t,_dx,_dy {
|
||||
.x _t _dx
|
||||
.y _t _dy
|
||||
}
|
||||
|
||||
; structure definition helper
|
||||
include 'struct.inc'
|
||||
|
||||
struct RECT
|
||||
left dd ?
|
||||
top dd ?
|
||||
right dd ?
|
||||
bottom dd ?
|
||||
ends
|
||||
|
||||
struct BOX
|
||||
left dd ?
|
||||
top dd ?
|
||||
width dd ?
|
||||
height dd ?
|
||||
ends
|
||||
|
||||
; structures used in MeOS
|
||||
struct process_information
|
||||
cpu_usage dd ? ; +0
|
||||
window_stack_position dw ? ; +4
|
||||
window_stack_value dw ? ; +6
|
||||
dw ? ; +8
|
||||
process_name rb 12 ; +10
|
||||
memory_start dd ? ; +22
|
||||
used_memory dd ? ; +26
|
||||
PID dd ? ; +30
|
||||
box BOX ; +34
|
||||
slot_state dw ? ; +50
|
||||
dw ? ; +52
|
||||
client_box BOX ; +54
|
||||
wnd_state db ? ; +70
|
||||
rb (1024-71)
|
||||
ends
|
||||
|
||||
struct system_colors
|
||||
frame dd ?
|
||||
grab dd ?
|
||||
grab_button dd ?
|
||||
grab_button_text dd ?
|
||||
grab_text dd ?
|
||||
work dd ?
|
||||
work_button dd ?
|
||||
work_button_text dd ?
|
||||
work_text dd ?
|
||||
work_graph dd ?
|
||||
ends
|
||||
|
||||
struct FILEDATE
|
||||
Second db ?
|
||||
Minute db ?
|
||||
Hour db ?
|
||||
db ?
|
||||
Day db ?
|
||||
Month db ?
|
||||
Year dw ?
|
||||
ends
|
||||
|
||||
struct FILEINFO
|
||||
Attributes dd ?
|
||||
IsUnicode db ?
|
||||
db 3 dup(?)
|
||||
DateCreate FILEDATE
|
||||
DateAccess FILEDATE
|
||||
DateModify FILEDATE
|
||||
Size dq ?
|
||||
ends
|
||||
|
||||
; constants
|
||||
|
||||
; events
|
||||
EV_IDLE = 0
|
||||
EV_TIMER = 0
|
||||
EV_REDRAW = 1
|
||||
EV_KEY = 2
|
||||
EV_BUTTON = 3
|
||||
EV_EXIT = 4
|
||||
EV_BACKGROUND = 5
|
||||
EV_MOUSE = 6
|
||||
EV_IPC = 7
|
||||
EV_STACK = 8
|
||||
|
||||
; event mask bits for function 40
|
||||
EVM_REDRAW = 1b
|
||||
EVM_KEY = 10b
|
||||
EVM_BUTTON = 100b
|
||||
EVM_EXIT = 1000b
|
||||
EVM_BACKGROUND = 10000b
|
||||
EVM_MOUSE = 100000b
|
||||
EVM_IPC = 1000000b
|
||||
EVM_STACK = 10000000b
|
270
programs/develop/box_lib/trunk/proc32.inc
Normal file
270
programs/develop/box_lib/trunk/proc32.inc
Normal file
@ -0,0 +1,270 @@
|
||||
|
||||
; Macroinstructions for defining and calling procedures
|
||||
|
||||
macro stdcall proc,[arg] ; directly call STDCALL procedure
|
||||
{ common
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
common
|
||||
end if
|
||||
call proc }
|
||||
|
||||
macro invoke proc,[arg] ; indirectly call STDCALL procedure
|
||||
{ common
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
common
|
||||
end if
|
||||
call [proc] }
|
||||
|
||||
macro ccall proc,[arg] ; directly call CDECL procedure
|
||||
{ common
|
||||
size@ccall = 0
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
size@ccall = size@ccall+4
|
||||
common
|
||||
end if
|
||||
call proc
|
||||
if size@ccall
|
||||
add esp,size@ccall
|
||||
end if }
|
||||
|
||||
macro cinvoke proc,[arg] ; indirectly call CDECL procedure
|
||||
{ common
|
||||
size@ccall = 0
|
||||
if ~ arg eq
|
||||
reverse
|
||||
pushd arg
|
||||
size@ccall = size@ccall+4
|
||||
common
|
||||
end if
|
||||
call [proc]
|
||||
if size@ccall
|
||||
add esp,size@ccall
|
||||
end if }
|
||||
|
||||
macro proc [args] ; define procedure
|
||||
{ common
|
||||
match name params, args>
|
||||
\{ define@proc name,<params \} }
|
||||
|
||||
prologue@proc equ prologuedef
|
||||
|
||||
macro prologuedef procname,flag,parmbytes,localbytes,reglist
|
||||
{ if parmbytes | localbytes
|
||||
push ebp
|
||||
mov ebp,esp
|
||||
if localbytes
|
||||
sub esp,localbytes
|
||||
end if
|
||||
end if
|
||||
irps reg, reglist \{ push reg \} }
|
||||
|
||||
epilogue@proc equ epiloguedef
|
||||
|
||||
macro epiloguedef procname,flag,parmbytes,localbytes,reglist
|
||||
{ irps reg, reglist \{ reverse pop reg \}
|
||||
if parmbytes | localbytes
|
||||
leave
|
||||
end if
|
||||
if flag and 10000b
|
||||
retn
|
||||
else
|
||||
retn parmbytes
|
||||
end if }
|
||||
|
||||
macro define@proc name,statement
|
||||
{ local params,flag,regs,parmbytes,localbytes,current
|
||||
if used name
|
||||
name:
|
||||
match =stdcall args, statement \{ params equ args
|
||||
flag = 11b \}
|
||||
match =stdcall, statement \{ params equ
|
||||
flag = 11b \}
|
||||
match =c args, statement \{ params equ args
|
||||
flag = 10001b \}
|
||||
match =c, statement \{ params equ
|
||||
flag = 10001b \}
|
||||
match =params, params \{ params equ statement
|
||||
flag = 0 \}
|
||||
virtual at ebp+8
|
||||
match =uses reglist=,args, params \{ regs equ reglist
|
||||
params equ args \}
|
||||
match =regs =uses reglist, regs params \{ regs equ reglist
|
||||
params equ \}
|
||||
match =regs, regs \{ regs equ \}
|
||||
match =,args, params \{ defargs@proc args \}
|
||||
match =args@proc args, args@proc params \{ defargs@proc args \}
|
||||
parmbytes = $ - (ebp+8)
|
||||
end virtual
|
||||
name # % = parmbytes/4
|
||||
all@vars equ
|
||||
current = 0
|
||||
match prologue:reglist, prologue@proc:<regs> \{ prologue name,flag,parmbytes,localbytes,reglist \}
|
||||
macro locals
|
||||
\{ virtual at ebp-localbytes+current
|
||||
macro label def \\{ match . type,def> \\\{ deflocal@proc .,label,<type \\\} \\}
|
||||
struc db [val] \\{ \common deflocal@proc .,db,val \\}
|
||||
struc du [val] \\{ \common deflocal@proc .,du,val \\}
|
||||
struc dw [val] \\{ \common deflocal@proc .,dw,val \\}
|
||||
struc dp [val] \\{ \common deflocal@proc .,dp,val \\}
|
||||
struc dd [val] \\{ \common deflocal@proc .,dd,val \\}
|
||||
struc dt [val] \\{ \common deflocal@proc .,dt,val \\}
|
||||
struc dq [val] \\{ \common deflocal@proc .,dq,val \\}
|
||||
struc rb cnt \\{ deflocal@proc .,rb cnt, \\}
|
||||
struc rw cnt \\{ deflocal@proc .,rw cnt, \\}
|
||||
struc rp cnt \\{ deflocal@proc .,rp cnt, \\}
|
||||
struc rd cnt \\{ deflocal@proc .,rd cnt, \\}
|
||||
struc rt cnt \\{ deflocal@proc .,rt cnt, \\}
|
||||
struc rq cnt \\{ deflocal@proc .,rq cnt, \\} \}
|
||||
macro endl
|
||||
\{ purge label
|
||||
restruc db,du,dw,dp,dd,dt,dq
|
||||
restruc rb,rw,rp,rd,rt,rq
|
||||
current = $-(ebp-localbytes)
|
||||
end virtual \}
|
||||
macro ret operand
|
||||
\{ match any, operand \\{ retn operand \\}
|
||||
match , operand \\{ match epilogue:reglist, epilogue@proc:<regs>
|
||||
\\\{ epilogue name,flag,parmbytes,localbytes,reglist \\\} \\} \}
|
||||
macro finish@proc \{ localbytes = (((current-1) shr 2)+1) shl 2
|
||||
end if \} }
|
||||
|
||||
macro defargs@proc [arg]
|
||||
{ common
|
||||
if ~ arg eq
|
||||
forward
|
||||
local ..arg,current@arg
|
||||
match argname:type, arg
|
||||
\{ current@arg equ argname
|
||||
label ..arg type
|
||||
argname equ ..arg
|
||||
if dqword eq type
|
||||
dd ?,?,?,?
|
||||
else if tbyte eq type
|
||||
dd ?,?,?
|
||||
else if qword eq type | pword eq type
|
||||
dd ?,?
|
||||
else
|
||||
dd ?
|
||||
end if \}
|
||||
match =current@arg,current@arg
|
||||
\{ current@arg equ arg
|
||||
arg equ ..arg
|
||||
..arg dd ? \}
|
||||
common
|
||||
args@proc equ current@arg
|
||||
forward
|
||||
restore current@arg
|
||||
common
|
||||
end if }
|
||||
|
||||
macro deflocal@proc name,def,[val]
|
||||
{ common
|
||||
match vars, all@vars \{ all@vars equ all@vars, \}
|
||||
all@vars equ all@vars name
|
||||
forward
|
||||
local ..var,..tmp
|
||||
match =label,def \{ ..tmp equ \}
|
||||
match tmp,..tmp \{ ..var def val \}
|
||||
match ,..tmp \{ label ..var val \}
|
||||
match =?, val \{ ..tmp equ \}
|
||||
match any =dup (=?), val \{ ..tmp equ \}
|
||||
match tmp : value, ..tmp : val
|
||||
\{ tmp: end virtual
|
||||
initlocal@proc ..var,def value
|
||||
virtual at tmp\}
|
||||
common
|
||||
match first rest, ..var, \{ name equ first \} }
|
||||
|
||||
macro initlocal@proc name,def
|
||||
{ virtual at name
|
||||
def
|
||||
size@initlocal = $ - name
|
||||
end virtual
|
||||
position@initlocal = 0
|
||||
while size@initlocal > position@initlocal
|
||||
virtual at name
|
||||
def
|
||||
if size@initlocal - position@initlocal < 2
|
||||
current@initlocal = 1
|
||||
load byte@initlocal byte from name+position@initlocal
|
||||
else if size@initlocal - position@initlocal < 4
|
||||
current@initlocal = 2
|
||||
load word@initlocal word from name+position@initlocal
|
||||
else
|
||||
current@initlocal = 4
|
||||
load dword@initlocal dword from name+position@initlocal
|
||||
end if
|
||||
end virtual
|
||||
if current@initlocal = 1
|
||||
mov byte [name+position@initlocal],byte@initlocal
|
||||
else if current@initlocal = 2
|
||||
mov word [name+position@initlocal],word@initlocal
|
||||
else
|
||||
mov dword [name+position@initlocal],dword@initlocal
|
||||
end if
|
||||
position@initlocal = position@initlocal + current@initlocal
|
||||
end while }
|
||||
|
||||
macro endp
|
||||
{ purge ret,locals,endl
|
||||
finish@proc
|
||||
purge finish@proc
|
||||
restore regs@proc
|
||||
match all,args@proc \{ restore all \}
|
||||
restore args@proc
|
||||
match all,all@vars \{ restore all \} }
|
||||
|
||||
macro local [var]
|
||||
{ common
|
||||
locals
|
||||
forward done@local equ
|
||||
match varname[count]:vartype, var
|
||||
\{ match =BYTE, vartype \\{ varname rb count
|
||||
restore done@local \\}
|
||||
match =WORD, vartype \\{ varname rw count
|
||||
restore done@local \\}
|
||||
match =DWORD, vartype \\{ varname rd count
|
||||
restore done@local \\}
|
||||
match =PWORD, vartype \\{ varname rp count
|
||||
restore done@local \\}
|
||||
match =QWORD, vartype \\{ varname rq count
|
||||
restore done@local \\}
|
||||
match =TBYTE, vartype \\{ varname rt count
|
||||
restore done@local \\}
|
||||
match =DQWORD, vartype \\{ label varname dqword
|
||||
rq count+count
|
||||
restore done@local \\}
|
||||
match , done@local \\{ virtual
|
||||
varname vartype
|
||||
end virtual
|
||||
rb count*sizeof.\#vartype
|
||||
restore done@local \\} \}
|
||||
match :varname:vartype, done@local:var
|
||||
\{ match =BYTE, vartype \\{ varname db ?
|
||||
restore done@local \\}
|
||||
match =WORD, vartype \\{ varname dw ?
|
||||
restore done@local \\}
|
||||
match =DWORD, vartype \\{ varname dd ?
|
||||
restore done@local \\}
|
||||
match =PWORD, vartype \\{ varname dp ?
|
||||
restore done@local \\}
|
||||
match =QWORD, vartype \\{ varname dq ?
|
||||
restore done@local \\}
|
||||
match =TBYTE, vartype \\{ varname dt ?
|
||||
restore done@local \\}
|
||||
match =DQWORD, vartype \\{ label varname dqword
|
||||
dq ?,?
|
||||
restore done@local \\}
|
||||
match , done@local \\{ varname vartype
|
||||
restore done@local \\} \}
|
||||
match ,done@local
|
||||
\{ var
|
||||
restore done@local \}
|
||||
common
|
||||
endl }
|
13
programs/develop/box_lib/trunk/readme.txt
Normal file
13
programs/develop/box_lib/trunk/readme.txt
Normal file
@ -0,0 +1,13 @@
|
||||
<Lrz> Теплов Алексей, Челябинск.
|
||||
Пример простого испльзования editbox в библиотеке,
|
||||
EditBox переписан для работы в библиотеке.
|
||||
Дата 25.06.2008
|
||||
сделана поддержка запуска ассемблерного примера при расположении текущей библиотеки по 2-м местам
|
||||
1. /sys/lib/box_lib.obj и когда библиотека находиться в папке с программой.
|
||||
|
||||
Дата 21.09.2007
|
||||
Сделан упор на поддрежку С и передачи параметров в стеке stdcall.
|
||||
На данный момент, носит эксперементальный, тестовый характер.
|
||||
Библиотеку box_lib.obj нужно поместить в папку с выполняющейся программой editbox_ex, или по адресу /sys/lib/? но тогда нужно подменить путь в файле ini_file на путь к библиотеке
|
||||
. Пример сам вычисляет путь к библиотеке, не зависимо от своего месторасположения
|
||||
24.09.2007 - сделал поддрежку checkbox. Добавил ошибки, программа глючит очень серьезно :(
|
4
programs/develop/box_lib/trunk/run.bat
Normal file
4
programs/develop/box_lib/trunk/run.bat
Normal file
@ -0,0 +1,4 @@
|
||||
..\FASM\fasm.exe box_lib.asm
|
||||
..\FASM\fasm.exe editbox_ex.asm editbox_ex.kex
|
||||
REM ..\FASM\kpack.exe editbox_ex
|
||||
..\emul\klbrinwin.exe editbox_ex.kex
|
180
programs/develop/box_lib/trunk/struct.inc
Normal file
180
programs/develop/box_lib/trunk/struct.inc
Normal file
@ -0,0 +1,180 @@
|
||||
|
||||
; Macroinstructions for defining data structures
|
||||
|
||||
macro struct name
|
||||
{ fields@struct equ name
|
||||
match child parent, name \{ fields@struct equ child,fields@\#parent \}
|
||||
sub@struct equ
|
||||
struc db [val] \{ \common fields@struct equ fields@struct,.,db,<val> \}
|
||||
struc dw [val] \{ \common fields@struct equ fields@struct,.,dw,<val> \}
|
||||
struc du [val] \{ \common fields@struct equ fields@struct,.,du,<val> \}
|
||||
struc dd [val] \{ \common fields@struct equ fields@struct,.,dd,<val> \}
|
||||
struc dp [val] \{ \common fields@struct equ fields@struct,.,dp,<val> \}
|
||||
struc dq [val] \{ \common fields@struct equ fields@struct,.,dq,<val> \}
|
||||
struc dt [val] \{ \common fields@struct equ fields@struct,.,dt,<val> \}
|
||||
struc rb count \{ fields@struct equ fields@struct,.,db,count dup (?) \}
|
||||
struc rw count \{ fields@struct equ fields@struct,.,dw,count dup (?) \}
|
||||
struc rd count \{ fields@struct equ fields@struct,.,dd,count dup (?) \}
|
||||
struc rp count \{ fields@struct equ fields@struct,.,dp,count dup (?) \}
|
||||
struc rq count \{ fields@struct equ fields@struct,.,dq,count dup (?) \}
|
||||
struc rt count \{ fields@struct equ fields@struct,.,dt,count dup (?) \}
|
||||
macro db [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,db,<val> \}
|
||||
macro dw [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dw,<val> \}
|
||||
macro du [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,du,<val> \}
|
||||
macro dd [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dd,<val> \}
|
||||
macro dp [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dp,<val> \}
|
||||
macro dq [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dq,<val> \}
|
||||
macro dt [val] \{ \common \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dt,<val> \}
|
||||
macro rb count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,db,count dup (?) \}
|
||||
macro rw count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dw,count dup (?) \}
|
||||
macro rd count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dd,count dup (?) \}
|
||||
macro rp count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dp,count dup (?) \}
|
||||
macro rq count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dq,count dup (?) \}
|
||||
macro rt count \{ \local anonymous
|
||||
fields@struct equ fields@struct,anonymous,dt,count dup (?) \}
|
||||
macro union \{ fields@struct equ fields@struct,,union,<
|
||||
sub@struct equ union \}
|
||||
macro struct \{ fields@struct equ fields@struct,,substruct,<
|
||||
sub@struct equ substruct \}
|
||||
virtual at 0 }
|
||||
|
||||
macro ends
|
||||
{ match , sub@struct \{ restruc db,dw,du,dd,dp,dq,dt
|
||||
restruc rb,rw,rd,rp,rq,rt
|
||||
purge db,dw,du,dd,dp,dq,dt
|
||||
purge rb,rw,rd,rp,rq,rt
|
||||
purge union,struct
|
||||
match name=,fields,fields@struct \\{ fields@struct equ
|
||||
make@struct name,fields
|
||||
fields@\\#name equ fields \\}
|
||||
end virtual \}
|
||||
match any, sub@struct \{ fields@struct equ fields@struct> \}
|
||||
restore sub@struct }
|
||||
|
||||
macro make@struct name,[field,type,def]
|
||||
{ common
|
||||
if $
|
||||
display 'Error: definition of ',`name,' contains illegal instructions.',0Dh,0Ah
|
||||
err
|
||||
end if
|
||||
local define
|
||||
define equ name
|
||||
forward
|
||||
local sub
|
||||
match , field \{ make@substruct type,name,sub def
|
||||
define equ define,.,sub, \}
|
||||
match any, field \{ define equ define,.#field,type,<def> \}
|
||||
common
|
||||
match fields, define \{ define@struct fields \} }
|
||||
|
||||
macro define@struct name,[field,type,def]
|
||||
{ common
|
||||
local list
|
||||
list equ
|
||||
forward
|
||||
if ~ field eq .
|
||||
name#field type def
|
||||
sizeof.#name#field = $ - name#field
|
||||
else
|
||||
rb sizeof.#type
|
||||
end if
|
||||
local value
|
||||
match any, list \{ list equ list, \}
|
||||
list equ list <value>
|
||||
common
|
||||
sizeof.#name = $
|
||||
restruc name
|
||||
match values, list \{
|
||||
struc name value \\{
|
||||
match any, fields@struct \\\{ fields@struct equ fields@struct,.,name,<values> \\\}
|
||||
match , fields@struct \\\{ label .
|
||||
forward
|
||||
match , value \\\\{ field type def \\\\}
|
||||
match any, value \\\\{ field type value
|
||||
if ~ field eq .
|
||||
rb sizeof.#name#field - ($-field)
|
||||
end if \\\\}
|
||||
common \\\} \\} \} }
|
||||
|
||||
macro enable@substruct
|
||||
{ macro make@substruct substruct,parent,name,[field,type,def]
|
||||
\{ \common
|
||||
\local define
|
||||
define equ parent,name
|
||||
\forward
|
||||
\local sub
|
||||
match , field \\{ match any, type \\\{ enable@substruct
|
||||
make@substruct type,name,sub def
|
||||
purge make@substruct
|
||||
define equ define,.,sub, \\\} \\}
|
||||
match any, field \\{ define equ define,.\#field,type,<def> \\}
|
||||
\common
|
||||
match fields, define \\{ define@\#substruct fields \\} \} }
|
||||
|
||||
enable@substruct
|
||||
|
||||
macro define@union parent,name,[field,type,def]
|
||||
{ common
|
||||
virtual at 0
|
||||
forward
|
||||
if ~ field eq .
|
||||
virtual at 0
|
||||
parent#field type def
|
||||
sizeof.#parent#field = $ - parent#field
|
||||
end virtual
|
||||
if sizeof.#parent#field > $
|
||||
rb sizeof.#parent#field - $
|
||||
end if
|
||||
else if sizeof.#type > $
|
||||
rb sizeof.#type - $
|
||||
end if
|
||||
common
|
||||
sizeof.#name = $
|
||||
end virtual
|
||||
struc name [value] \{ \common
|
||||
label .\#name
|
||||
last@union equ
|
||||
forward
|
||||
match any, last@union \\{ virtual at .\#name
|
||||
field type def
|
||||
end virtual \\}
|
||||
match , last@union \\{ match , value \\\{ field type def \\\}
|
||||
match any, value \\\{ field type value \\\} \\}
|
||||
last@union equ field
|
||||
common rb sizeof.#name - ($ - .\#name) \} }
|
||||
|
||||
macro define@substruct parent,name,[field,type,def]
|
||||
{ common
|
||||
virtual at 0
|
||||
forward
|
||||
if ~ field eq .
|
||||
parent#field type def
|
||||
sizeof.#parent#field = $ - parent#field
|
||||
else
|
||||
rb sizeof.#type
|
||||
end if
|
||||
local value
|
||||
common
|
||||
sizeof.#name = $
|
||||
end virtual
|
||||
struc name value \{
|
||||
label .\#name
|
||||
forward
|
||||
match , value \\{ field type def \\}
|
||||
match any, value \\{ field type value
|
||||
if ~ field eq .
|
||||
rb sizeof.#parent#field - ($-field)
|
||||
end if \\}
|
||||
common \} }
|
Loading…
Reference in New Issue
Block a user