mblocks clean
git-svn-id: svn://kolibrios.org@930 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
e119dfaa2f
commit
069cad1deb
|
@ -1,52 +0,0 @@
|
|||
/*******************************************************************************
|
||||
|
||||
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;
|
||||
}
|
|
@ -1,4 +0,0 @@
|
|||
c-- mblocks.c--
|
||||
del mblocks.kex
|
||||
rename mblocks.com mblocks.kex
|
||||
pause
|
|
@ -1,620 +0,0 @@
|
|||
#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 = 0x0007fff0;
|
||||
dword I_Param = 0x0;
|
||||
dword I_Icon = 0x0;
|
||||
dword skin_width;
|
||||
|
||||
// KeyCode constant
|
||||
#define UP_KEY 130+48
|
||||
#define DOWN_KEY 129+48
|
||||
#define LEFT_KEY 128+48
|
||||
#define RIGHT_KEY 131+48
|
||||
#define RETURN_KEY 13
|
||||
|
||||
// Color constant
|
||||
#define clWhite 0x00ffffff
|
||||
#define clBlack 0x00000000
|
||||
#define clRed 0x00ff0000
|
||||
#define clGreen 0x0000ff00
|
||||
#define clBlue 0x000000ff
|
||||
|
||||
#define evButton 3
|
||||
#define evKey 2
|
||||
#define evReDraw 1
|
||||
#define evNet 8
|
||||
|
||||
#define BT_DEL 0x80000000
|
||||
#define BT_HIDE 0x40000000
|
||||
#define BT_NOFRAME 0x20000000
|
||||
|
||||
#define OLD -1
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
}
|
||||
//---------------------------------------------------------------------------
|
||||
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
|
||||
}
|
||||
//-------------------------------------------------------------------------------
|
||||
|
||||
inline fastcall void begin_paint(){
|
||||
#speed
|
||||
EAX = 12; // function 12:tell os about windowdraw
|
||||
EBX = 1; // 1, start of draw
|
||||
$int 0x40
|
||||
#codesize
|
||||
}
|
||||
|
||||
inline fastcall void end_paint(){
|
||||
#speed
|
||||
EAX = 12; // function 12:tell os about windowdraw
|
||||
EBX = 2; // 1, start of draw
|
||||
$int 0x40
|
||||
#codesize
|
||||
}
|
||||
|
||||
/*
|
||||
Žâà¨á®¢ª ®ª
|
||||
{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){
|
||||
#speed
|
||||
EAX = 8;
|
||||
$int 0x40
|
||||
#codesize
|
||||
}
|
||||
|
||||
inline fastcall dword WaitEvent(){
|
||||
#speed
|
||||
EAX = 10; // wait here for event
|
||||
$int 0x40
|
||||
#codesize
|
||||
}
|
||||
|
||||
inline fastcall void ExitProcess(){
|
||||
#speed
|
||||
EAX = -1; // close this program
|
||||
$int 0x40
|
||||
#codesize
|
||||
}
|
||||
|
||||
/*
|
||||
02 = GET KEY
|
||||
|
||||
ret: al 0 successful -> ah = key
|
||||
al 1 no key in buffer
|
||||
*/
|
||||
inline fastcall word GetKey(){
|
||||
#speed
|
||||
EAX = 2; // just read it key from buffer
|
||||
$int 0x40
|
||||
EAX = EAX >> 8;
|
||||
#codesize
|
||||
}
|
||||
|
||||
/*
|
||||
17 = GET PRESSED BUTTON ID
|
||||
|
||||
ret: al 0 successful -> ah = id number
|
||||
al 1 no key in buffer
|
||||
*/
|
||||
inline fastcall word GetButtonID(){
|
||||
#speed
|
||||
EAX = 17; // Get ID
|
||||
$int 0x40
|
||||
EAX = EAX >> 8;
|
||||
#codesize
|
||||
}
|
||||
|
||||
/*
|
||||
58 = SYSTEM TREE ACCESS
|
||||
|
||||
ebx pointer to fileinfo block
|
||||
|
||||
fileinfo:
|
||||
|
||||
dd 0x0 ; 0=read (/write/delete/append)
|
||||
dd 0x0 ; 512 block to read 0+
|
||||
dd 0x1 ; blocks to read (/bytes to write/append)
|
||||
dd 0x20000 ; return data pointer
|
||||
dd 0x10000 ; work area for os - 16384 bytes
|
||||
db '/RAMDISK/FIRST/KERNEL.ASM',0 ; ASCIIZ dir & filename
|
||||
*/
|
||||
inline fastcall void AccessSystemTree(dword EBX){
|
||||
#speed
|
||||
EAX = 58;
|
||||
$int 0x40
|
||||
#codesize
|
||||
}
|
||||
|
||||
/*
|
||||
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
|
||||
}
|
||||
|
||||
//CODED by Veliant
|
||||
/*eax = 38 - íîìåð ôóíêöèè
|
||||
ebx = [êîîðäèíàòà íà÷àëà ïî îñè x]*65536 + [êîîðäèíàòà êîíöà ïî îñè x]
|
||||
ecx = [êîîðäèíàòà íà÷àëà ïî îñè y]*65536 + [êîîðäèíàòà êîíöà ïî îñè y]
|
||||
edx = 0x00RRGGBB - öâåò
|
||||
edx = 0x01xxxxxx - ðèñîâàòü èíâåðñíûé îòðåçîê (ìëàäøèå 24 áèòà èãíîðèðóþòñÿ) */
|
||||
inline fastcall void DrawLine(dword EBX, ECX, EDX){
|
||||
#speed
|
||||
EAX = 38;
|
||||
$int 0x40
|
||||
#codesize
|
||||
}
|
||||
|
||||
inline fastcall void DrawTitle(dword ECX)
|
||||
{
|
||||
#speed
|
||||
EAX = 71;
|
||||
EBX = 1;
|
||||
$int 0x40;
|
||||
#codesize
|
||||
}
|
||||
|
||||
inline fastcall dword GetSkinWidth()
|
||||
{
|
||||
#speed
|
||||
EAX = 48;
|
||||
EBX = 4;
|
||||
$int 0x40
|
||||
#codesize
|
||||
}
|
||||
|
||||
inline fastcall dword GetScreenWidth()
|
||||
{
|
||||
#speed
|
||||
EAX = 14;
|
||||
EBX = 4;
|
||||
$int 0x40
|
||||
$shr eax, 16
|
||||
$and eax,0x0000FFFF
|
||||
#codesize
|
||||
}
|
||||
|
||||
inline fastcall void DeleteButton(dword EDX)
|
||||
{
|
||||
#speed
|
||||
EAX = 8;
|
||||
EDX = EDX + BT_DEL;
|
||||
$int 0x40;
|
||||
#codesize
|
||||
}
|
||||
|
||||
inline fastcall dword LoadLibrary(dword ECX)
|
||||
{
|
||||
#speed
|
||||
$mov eax, 68
|
||||
$mov ebx, 19
|
||||
$int 0x40
|
||||
#codesize
|
||||
}
|
||||
|
||||
//function GetProcAdress(hLib:integer; name:string):integer;
|
||||
inline fastcall dword GetProcAdress(dword ECX, EAX)
|
||||
{
|
||||
#speed
|
||||
#codesize
|
||||
}
|
||||
|
||||
inline fastcall dword strlen(dword ESI)
|
||||
{
|
||||
#speed
|
||||
int len=0;
|
||||
while (AL=ESBYTE[ESI])
|
||||
{
|
||||
len++;
|
||||
ESI++;
|
||||
}
|
||||
EAX=len;
|
||||
#codesize
|
||||
}
|
||||
|
||||
//-1 - íå ðàâíû
|
||||
// 0 - ðàâíû
|
||||
inline fastcall dword strcmp(dword ESI,EDI)
|
||||
{
|
||||
#speed
|
||||
dword strcmp_i,ret,len1,len2,sovpadenij,str1,str2;
|
||||
str1=ESI;
|
||||
str2=EDI;
|
||||
ret=-1;
|
||||
sovpadenij=0;
|
||||
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;
|
||||
#codesize
|
||||
}
|
||||
|
||||
inline fastcall dword upcase(dword ESI)
|
||||
{
|
||||
#speed
|
||||
dword str, i;
|
||||
str = ESI;
|
||||
for (i=0;i<strlen(i);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;
|
||||
#codesize
|
||||
}
|
||||
|
||||
inline fastcall dword lowcase(dword ESI)
|
||||
{
|
||||
#speed
|
||||
dword str, i;
|
||||
str = ESI;
|
||||
for (i=0;i<strlen(i);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;
|
||||
#codesize
|
||||
}
|
||||
|
||||
inline fastcall void dostowin (dword ESI)
|
||||
{
|
||||
#speed
|
||||
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++;
|
||||
}
|
||||
#codesize
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
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)
|
||||
{
|
||||
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_DEL,0xEFEBEF); //óäàëÿåì êíîïêó
|
||||
DefineButton(x,y,width,height,id+BT_HIDE,0xEFEBEF); //îïðåäåëÿåì êíîïêó
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
ECX=strlen(d);//î÷èùàåì ñòàðîå
|
||||
$mov edi,d
|
||||
$xor al,al
|
||||
$cld
|
||||
$rep $stosb
|
||||
|
||||
ECX=strlen(s);//êîïèðóåì
|
||||
$mov esi,s
|
||||
$mov edi,d
|
||||
$cld
|
||||
$rep $movsb
|
||||
}
|
||||
int pos,razr,backup,j=0;
|
||||
char buffer[11]="";
|
||||
int chislo;
|
||||
inline fastcall dword IntToStr(dword ESI)
|
||||
{
|
||||
#speed
|
||||
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;
|
||||
#codesize
|
||||
}
|
||||
|
||||
inline fastcall dword MoveSize(dword EBX,ECX,EDX,ESI)
|
||||
{
|
||||
#speed
|
||||
EAX = 67;
|
||||
$int 0x40
|
||||
#codesize
|
||||
}
|
||||
|
||||
f70 CopyFile_f;
|
||||
BDVK CopyFile_atr;
|
||||
inline fastcall dword CopyFile(dword EBX,ECX)
|
||||
{
|
||||
#speed
|
||||
dword s, d, buf;
|
||||
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)
|
||||
{
|
||||
buf = 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 = buf;
|
||||
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 = buf;
|
||||
CopyFile_f.rezerv = 0;
|
||||
CopyFile_f.name = d;
|
||||
$mov eax, 70
|
||||
$mov ebx, #CopyFile_f
|
||||
$int 0x40
|
||||
}
|
||||
}
|
||||
#codesize
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,293 +0,0 @@
|
|||
/*
|
||||
Memory Blocks for KolibriOS v1.01
|
||||
L&V Edition
|
||||
|
||||
Èäåÿ è äèçàéí: Leency
|
||||
Ðåàëèçîâàíî: Veliant è Leency
|
||||
Compile with C--
|
||||
2008
|
||||
*/
|
||||
|
||||
#pragma option J0
|
||||
#pragma option LST
|
||||
#pragma option OC
|
||||
#pragma option 4
|
||||
#pragma option A
|
||||
#include "kolibri.h--"
|
||||
#include "random.h--"
|
||||
#include "mbgraph.h--"
|
||||
|
||||
#define strok 6 //êîëè÷åñòâî áëîêîâ ïî âåðòèêàëè
|
||||
#define stolbcov 10 //êîëè÷åñòâî áëîêîâ ïî ãîðèçîíòàëè
|
||||
|
||||
#define header "Memory Blocks L&V Edition"
|
||||
|
||||
char button_r = "<22>®¢ ï ¨£à (F2)"; //Íîâàÿ èãðà
|
||||
char tcount_r = " ‘ç¥â:"; //Ñ÷¸ò
|
||||
char lg_r = "RU";
|
||||
|
||||
char button_e = "New game (F2)";
|
||||
char tcount_e = "Count:";
|
||||
char lg_e = "EN";
|
||||
|
||||
#define button "<22>®¢ ï ¨£à (F2)"
|
||||
#define tcount " ‘ç¥â:"
|
||||
|
||||
|
||||
int lang = 0;
|
||||
|
||||
byte bitstat[60] = 0;
|
||||
byte bitpict[60] = 0;
|
||||
dword butonsx[60] = 0;
|
||||
dword butonsy[60] = 0;
|
||||
dword i, k, x, id, count = 0;
|
||||
dword firstbit, secondbit;
|
||||
|
||||
void main()
|
||||
{
|
||||
int z=1;
|
||||
int off;
|
||||
FOR (i = 0; i < 30; i++)
|
||||
{
|
||||
do
|
||||
off = random(60);
|
||||
while (bitpict[off] != 0);
|
||||
bitpict[off] = z;
|
||||
do
|
||||
off = random(60);
|
||||
while (bitpict[off] != 0);
|
||||
bitpict[off] = z;
|
||||
z++;
|
||||
}
|
||||
skin_width = GetSkinWidth();
|
||||
firstbit = secondbit = 0x0BAD;
|
||||
Draw_Window();
|
||||
loop()
|
||||
{
|
||||
switch (WaitEvent())
|
||||
{
|
||||
CASE evButton:
|
||||
id = GetButtonID();
|
||||
switch (id)
|
||||
{
|
||||
CASE 1:
|
||||
ExitProcess();
|
||||
break;
|
||||
CASE 5:
|
||||
init();
|
||||
break;
|
||||
CASE 6:
|
||||
SWITCH (lang)
|
||||
{
|
||||
CASE 0:
|
||||
copystr(#button_e, button);
|
||||
copystr(#tcount_e, tcount);
|
||||
lang = 1;
|
||||
break;
|
||||
CASE 1:
|
||||
copystr(#button_r, button);
|
||||
copystr(#tcount_r, tcount);
|
||||
lang = 0;
|
||||
break;
|
||||
}
|
||||
Draw_Panel();
|
||||
break;
|
||||
default:
|
||||
if (bitstat[id-100] == 0)
|
||||
{
|
||||
if (firstbit <> 0x0BAD)
|
||||
{
|
||||
if (secondbit <> 0x0BAD)
|
||||
{
|
||||
IF (bitpict[firstbit-100] == bitpict[secondbit-100])
|
||||
{
|
||||
bitstat[firstbit-100] = 2;
|
||||
bitstat[secondbit-100] = 2;
|
||||
}
|
||||
ELSE
|
||||
{
|
||||
bitstat[firstbit-100] = 0;
|
||||
bitstat[secondbit-100] = 0;
|
||||
}
|
||||
ReDraw_Game_Button(firstbit - 100);
|
||||
ReDraw_Game_Button(secondbit - 100);
|
||||
secondbit = 0x0BAD;
|
||||
firstbit = id;
|
||||
bitstat[id-100] = 1;
|
||||
ReDraw_Game_Button(id - 100);
|
||||
count++;
|
||||
}
|
||||
ELSE
|
||||
{
|
||||
IF (firstbit<>id)
|
||||
{
|
||||
secondbit = id;
|
||||
bitstat[id-100] = 1;
|
||||
ReDraw_Game_Button(id - 100);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
ELSE
|
||||
{
|
||||
firstbit = id;
|
||||
bitstat[id-100] = 1;
|
||||
ReDraw_Game_Button(id - 100);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
Draw_Count();
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case evKey:
|
||||
SWITCH (GetKey())
|
||||
{
|
||||
CASE 51:
|
||||
init(); //Íàæàòà F2
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case evReDraw:
|
||||
Draw_Window();
|
||||
break;
|
||||
}
|
||||
}
|
||||
ExitProcess();
|
||||
}
|
||||
|
||||
void Draw_Window()
|
||||
{
|
||||
begin_paint();
|
||||
DefineAndDrawWindow(100, 100, 434, 290 + skin_width + 1, 0x04, 0x00C0C0C0, 0, 0, 0);
|
||||
DrawTitle(header);
|
||||
Draw_Panel();
|
||||
Draw_Game_Pole();
|
||||
|
||||
end_paint();
|
||||
}
|
||||
|
||||
void init()
|
||||
{
|
||||
int off, z;
|
||||
z=1;
|
||||
$mov edi, #bitstat
|
||||
$mov ecx, 60
|
||||
$xor al, al
|
||||
$rep $stosb //ñòèðàåì ñòàðûå äàííûå î íàæàòûõ êíîïêàõ
|
||||
|
||||
$mov edi, #bitpict
|
||||
$mov ecx, 60
|
||||
$xor al, al
|
||||
$rep $stosb //ñòèðàåì ñòàðûå äàííûå î êàðòèíêàõ
|
||||
|
||||
count = 0;
|
||||
firstbit = secondbit = 0x0BAD;
|
||||
FOR (i = 0; i < 30; i++)
|
||||
{
|
||||
do
|
||||
off = random(60);
|
||||
while (bitpict[off] != 0);
|
||||
bitpict[off] = z;
|
||||
do
|
||||
off = random(60);
|
||||
while (bitpict[off] != 0);
|
||||
bitpict[off] = z;
|
||||
z++;
|
||||
}
|
||||
Draw_Game_Pole();
|
||||
Draw_Panel();
|
||||
}
|
||||
|
||||
void ReDraw_Game_Button(int id)
|
||||
{
|
||||
int off;
|
||||
DefineButton(0, 0, 0, 0, 100 + id + BT_DEL, 0); //óäàëÿåì ñòàðóþ
|
||||
DefineButton(butonsx[id], butonsy[id], 38, 38, 100 + id + BT_HIDE, 0xEFEBEF); //äåëàåì íîâóþ
|
||||
switch (bitstat[id])
|
||||
{
|
||||
CASE 0:
|
||||
Draw_Block(butonsx[id], butonsy[id]);
|
||||
break;
|
||||
CASE 1:
|
||||
Draw_Pressed_Block(butonsx[id], butonsy[id]);
|
||||
PutImage(bitpict[id]-1*32*32*3+#data,32,32,butonsx[id]+3,butonsy[id]+3);
|
||||
break;
|
||||
case 2:
|
||||
Draw_Open_Block(butonsx[id], butonsy[id]);
|
||||
PutImage(bitpict[id]-1*32*32*3+#data,32,32,butonsx[id]+3,butonsy[id]+3);
|
||||
break;
|
||||
}
|
||||
//WriteText(butonsx[id] + 10, butonsy[id] + 10, 0x80, 0x000000, IntToStr(bitpict[id]), 0);
|
||||
}
|
||||
|
||||
void Draw_Game_Pole()
|
||||
{
|
||||
FOR (k = 0; k < stolbcov; k++)
|
||||
{
|
||||
FOR (i = 0; i < strok; i++)
|
||||
{
|
||||
butonsx[k*strok+i] = k * 42 + 4 + 5; //ñîõðàíÿåì êîîðäèíàòû ÷òîá íå ñ÷èòàòü â äàëüíåéøåì
|
||||
butonsy[k*strok+i] = i * 42 + 4;
|
||||
ReDraw_Game_Button(k*strok + i); //ðèñóåì ïîëå
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Draw_Block(dword x, y)
|
||||
{
|
||||
DrawRegion(x, y, 38, 38, 0x0094AECE);//ðàìêà
|
||||
DrawLine(x + 1*65536 + x + 37, y + skin_width + 1*65536 + y + skin_width + 1, 0x00FFFFFF);//áåëûå ëèíèè
|
||||
DrawLine(x + 1*65536 + x + 1, y + skin_width + 1*65536 + y + skin_width + 36, 0x00FFFFFF);
|
||||
DrawLine(x + 1*65536 + x + 37, y + skin_width + 37*65536 + y + skin_width + 37, 0x00DEDEDE);//ñåðûå ëèíèè
|
||||
DrawLine(x + 37*65536 + x + 37, y + skin_width + 2*65536 + y + skin_width + 36, 0x00DEDEDE);
|
||||
DrawBar(x + 2, y + 2, 35, 35, 0x00BDC7D6);//ôîí
|
||||
}
|
||||
|
||||
void Draw_Open_Block(dword x, y)
|
||||
{
|
||||
DrawRegion(x, y, 38, 38, 0x0094AECE);//ðàìêà
|
||||
DrawBar(x + 1, y + 1, 37, 37, 0x00EFEBEF);//ôîí
|
||||
}
|
||||
|
||||
void Draw_Pressed_Block(dword x, y)
|
||||
{
|
||||
DrawRegion(x, y, 38, 38, 0x0094AECE);//ðàìêà
|
||||
DrawRegion(x + 1, y + 1, 36, 36, 0x0094DB00);//ðàìêà çåëåíàÿ
|
||||
DrawRegion(x + 2, y + 2, 34, 34, 0x0094DB00);//ðàìêà çåëåíàÿ
|
||||
DrawBar(x + 3, y + 3, 33, 33, 0x00EFEBEF);//ôîí
|
||||
}
|
||||
|
||||
void Draw_Panel()
|
||||
{
|
||||
DrawBar(5, 255, 425, 32, 0x00EBE7DB);//ôîí ïàíåëè
|
||||
DrawLine(5*65536 + 429, 255 + skin_width*65536 + 255 + skin_width, 0x0094AECE);//ëèíèè
|
||||
DrawLine(5*65536 + 429, 256 + skin_width*65536 + 256 + skin_width, 0x00FFFFFF);//ëèíèè
|
||||
|
||||
//Êíîïêà
|
||||
DrawFlatButton(4 + 5, 260, 107, 23, 5, 0x00EFEBEF);//íîâàÿ èãðà
|
||||
DrawFlatButton(210 + 5, 260, 23, 23, 6, 0x00EFEBEF);//ÿçûê
|
||||
//íàäïèñü íà êíîïêå
|
||||
WriteText(22, 268, 0x80, 0x000000, button, 0);
|
||||
//íàäïèñü "Ñ÷åò"
|
||||
WriteText(150, 268, 0x80, 0x000000, tcount, 0);
|
||||
IF (lang==0)
|
||||
WriteText(221, 268, 0x80, 0x000000, #lg_e, 0);
|
||||
ELSE
|
||||
WriteText(221, 268, 0x80, 0x000000, #lg_r, 0);
|
||||
Draw_Count();
|
||||
|
||||
//ïðÿìîóãîëüíèêè ñïðàâà
|
||||
DrawBar(395 + 10, 260 + 5, 2, 2, 0x00BDCBDE);
|
||||
DrawBar(393 + 10, 265 + 5, 6, 6, 0x00BDCBDE);
|
||||
DrawBar(401 + 10, 270 + 5, 6, 6, 0x00BDCBDE);
|
||||
DrawBar(402 + 10, 257 + 5, 9, 8, 0x00D6D7CE);
|
||||
}
|
||||
|
||||
void Draw_Count()
|
||||
{
|
||||
EDI = 0x00EBE7DB; //öâåò ïàíåëè
|
||||
WriteText(190, 268, 0xC0, 0x000000, IntToStr(count), 0);
|
||||
}
|
||||
|
||||
stop:
|
|
@ -1,36 +0,0 @@
|
|||
#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
|
||||
}
|
Loading…
Reference in New Issue