Subversion Repositories Kolibri OS

Rev

Rev 2444 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2444 Rev 2495
1
//CODED by Veliant, Leency, Nable. GNU GPL licence.
1
//CODED by Veliant, Leency, Nable. GNU GPL licence.
2
 
2
 
3
#startaddress 0
3
#startaddress 0
4
#code32 TRUE
4
#code32 TRUE
5
 
5
 
6
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
6
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
7
dword  os_version   = 0x00000001;
7
dword  os_version   = 0x00000001;
8
dword  start_addr   = #main;
8
dword  start_addr   = #main;
9
dword  final_addr   = #stop+32;
9
dword  final_addr   = #stop+32;
10
dword  alloc_mem    = #0x00100000;
10
dword  alloc_mem    = #0x00100000;
11
dword  x86esp_reg   = #0x00100000;
11
dword  x86esp_reg   = #0x00100000;
12
dword  I_Param      = #param;
12
dword  I_Param      = #param;
13
dword  I_Path       = #program_path;
13
dword  I_Path       = #program_path;
14
char param[4096]="";
14
char param[4096]="";
15
char program_path[4096]="";
15
char program_path[4096]="";
16
 
16
 
17
//Events
17
//Events
18
#define evMouse	6
18
#define evMouse	6
19
#define evButton	3
19
#define evButton	3
20
#define evKey		2
20
#define evKey		2
21
#define evReDraw	1
21
#define evReDraw	1
22
 
22
 
23
//Button options
23
//Button options
24
#define BT_DEL		0x80000000
24
#define BT_DEL		0x80000000
25
#define BT_HIDE		0x40000000
25
#define BT_HIDE		0x40000000
26
#define BT_NOFRAME	0x20000000
26
#define BT_NOFRAME	0x20000000
27
 
27
 
28
#define OLD		-1
28
#define OLD		-1
29
#define true		1
29
#define true		1
30
#define false		0
30
#define false		0
31
//-------------------------------------------------------------------------
31
//-------------------------------------------------------------------------
32
 
32
 
33
struct mouse{
33
struct mouse{
34
 dword x,y,lkm,pkm,hor,vert;
34
 dword x,y,lkm,pkm,hor,vert;
35
 void get();
35
 void get();
36
};
36
};
37
 
37
 
38
void mouse::get()
38
void mouse::get()
39
{
39
{
40
	EAX = 37;
40
	EAX = 37;
41
	EBX = 1;
41
	EBX = 1;
42
	$int	0x40
42
	$int	0x40
43
	$mov	ebx, eax
43
	$mov	ebx, eax
44
	$shr	eax, 16
44
	$shr	eax, 16
45
	$and	ebx,0x0000FFFF
45
	$and	ebx,0x0000FFFF
46
	x = EAX;
46
	x = EAX;
47
	y = EBX;
47
	y = EBX;
48
	EAX = 37;
48
	EAX = 37;
49
	EBX = 2;
49
	EBX = 2;
50
	$int	0x40
50
	$int	0x40
51
	$mov	ebx, eax
51
	$mov	ebx, eax
52
	$and	eax, 0x00000001
52
	$and	eax, 0x00000001
53
	$shr	ebx, 1
53
	$shr	ebx, 1
54
	$and	ebx, 0x00000001
54
	$and	ebx, 0x00000001
55
	lkm = EAX;
55
	lkm = EAX;
56
	pkm = EBX;
56
	pkm = EBX;
57
	EAX = 37; //áªà®««
57
	EAX = 37; //áªà®««
58
	EBX = 7;
58
	EBX = 7;
59
	$int	0x40
59
	$int	0x40
60
	$mov	ebx, eax
60
	$mov	ebx, eax
61
	$shr	eax, 16
61
	$shr	eax, 16
62
	$and	ebx,0x0000FFFF
62
	$and	ebx,0x0000FFFF
63
	//hor = EAX;
63
	//hor = EAX;
64
	vert = EBX;
64
	vert = EBX;
65
}
65
}
66
 
66
 
67
 
67
 
68
struct system_colors{
68
struct system_colors{
69
	dword frame,grab,grab_button,grab_button_text,grab_text,work,work_button,work_button_text,work_text,work_graph;
69
	dword frame,grab,grab_button,grab_button_text,grab_text,work,work_button,work_button_text,work_text,work_graph;
70
	void get();
70
	void get();
71
};
71
};
72
void system_colors::get()
72
void system_colors::get()
73
{
73
{
74
	EAX = 48;
74
	EAX = 48;
75
	EBX = 3;
75
	EBX = 3;
76
	ECX = #frame;
76
	ECX = #frame;
77
	EDX = 40;
77
	EDX = 40;
78
	$int 0x40
78
	$int 0x40
79
}
79
}
80
 
80
 
81
//------------------------------------------------------------------------------
81
//------------------------------------------------------------------------------
82
 
82
 
83
inline fastcall dword WaitEvent(){
83
inline fastcall dword WaitEvent(){
84
 EAX = 10;
84
 EAX = 10;
85
 $int 0x40
85
 $int 0x40
86
}
86
}
87
 
87
 
88
inline fastcall dword WaitEventTimeout(dword EBX){
88
inline fastcall dword WaitEventTimeout(dword EBX){
89
 EAX = 23;
89
 EAX = 23;
90
 $int 0x40
90
 $int 0x40
91
} 
91
} 
92
 
92
 
93
inline fastcall SetEventMask(dword EBX)
93
inline fastcall SetEventMask(dword EBX)
94
{
94
{
95
 EAX = 40;
95
 EAX = 40;
96
 $int 0x40
96
 $int 0x40
97
}
97
}
98
 
98
 
99
inline fastcall ScancodesGeting(){
99
inline fastcall ScancodesGeting(){
100
	$mov eax,66;
100
	$mov eax,66;
101
	$mov ebx,1;
101
	$mov ebx,1;
102
	$mov ecx,1; //᪠­ª®¤ë
102
	$mov ecx,1; //᪠­ª®¤ë
103
	$int 0x40
103
	$int 0x40
104
}
104
}
105
 
105
 
106
 
106
 
107
inline fastcall word GetKey(){ //Gluk fix
107
inline fastcall word GetKey(){ //Gluk fix
108
		$push edx
108
		$push edx
109
@getkey:
109
@getkey:
110
		$mov  eax,2
110
		$mov  eax,2
111
		$int  0x40
111
		$int  0x40
112
		$cmp eax,1
112
		$cmp eax,1
113
		$jne getkeyi
113
		$jne getkeyi
114
		$mov ah,dh
114
		$mov ah,dh
115
		$jmp getkeyii //jz?
115
		$jmp getkeyii //jz?
116
@getkeyi:
116
@getkeyi:
117
		$mov dh,ah
117
		$mov dh,ah
118
		$jmp getkey
118
		$jmp getkey
119
@getkeyii:
119
@getkeyii:
120
		$pop edx
120
		$pop edx
121
		EAX = EAX >> 8;		 
121
		EAX = EAX >> 8;		 
122
}
122
}
123
 
123
 
124
 
124
 
125
inline fastcall Pause(dword EBX)
125
inline fastcall Pause(dword EBX)
126
{					// ã§ , ¢ á®âëå ¤®«ïå ᥪ㭤ë EBX = value
126
{					// ã§ , ¢ á®âëå ¤®«ïå ᥪ㭤ë EBX = value
127
	$mov eax, 5
127
	$mov eax, 5
128
	$int 0x40
128
	$int 0x40
129
}
129
}
130
 
130
 
131
//==================================================================
131
//==================================================================
132
 
132
 
133
inline fastcall word GetButtonID(){
133
inline fastcall word GetButtonID(){
134
 EAX = 17;
134
 EAX = 17;
135
 $int  0x40
135
 $int  0x40
136
 EAX = EAX >> 8;
136
 EAX = EAX >> 8;
137
}
137
}
138
 
138
 
139
struct proc_info{
139
struct proc_info{
140
	dword	use_cpu;
140
	dword	use_cpu;
141
	word	pos_in_stack,num_slot,rezerv1;
141
	word	pos_in_stack,num_slot,rezerv1;
142
	char	name[11];
142
	char	name[11];
143
	char	rezerv2;
143
	char	rezerv2;
144
	dword	adress,use_memory,ID,left,top,width,height;
144
	dword	adress,use_memory,ID,left,top,width,height;
145
	word	status_slot,rezerv3;
145
	word	status_slot,rezerv3;
146
	dword	work_left,work_top,work_width,work_height;
146
	dword	work_left,work_top,work_width,work_height;
147
	char	status_window;
147
	char	status_window;
148
	void	GetInfo(dword ECX);
148
	void	GetInfo(dword ECX);
149
	byte    reserved[1024-71];
149
	byte    reserved[1024-71];
150
#define SelfInfo -1
150
#define SelfInfo -1
151
};
151
};
152
 
152
 
153
void GetProcessInfo(dword EBX, ECX)
153
void GetProcessInfo(dword EBX, ECX)
154
{
154
{
155
	EAX = 9;
155
	EAX = 9;
156
	$int  0x40
156
	$int  0x40
157
}
157
}
158
 
158
 
159
int GetProcessSlot(ECX) //ECX = process ID
159
int GetProcessSlot(ECX) //ECX = process ID
160
{
160
{
161
	EAX = 18;
161
	EAX = 18;
162
	EBX = 21;
162
	EBX = 21;
163
	$int 0x40;	
163
	$int 0x40;	
164
}
164
}
165
 
165
 
166
inline fastcall ExitProcess(){
166
inline fastcall ExitProcess(){
167
 EAX = -1;              // close this program
167
 EAX = -1;              // close this program
168
 $int 0x40
168
 $int 0x40
169
}
169
}
170
 
170
 
171
inline fastcall KillProcess(dword ECX){
171
inline fastcall KillProcess(dword ECX){
172
	$mov eax,18;
172
	$mov eax,18;
173
	$mov ebx,18;
173
	$mov ebx,18;
174
	$int 0x40
174
	$int 0x40
175
}
175
}
176
 
176
 
177
//==================================================================
177
//==================================================================
178
 
178
 
179
//eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus)
179
//eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus)
180
inline fastcall int GetSystemLanguage(){
180
inline fastcall int GetSystemLanguage(){
181
 EAX = 26;
181
 EAX = 26;
182
 EBX = 5;
182
 EBX = 5;
183
 $int 0x40
183
 $int 0x40
184
 RETURN EAX; 
184
 RETURN EAX; 
185
}
185
}
186
 
186
 
187
inline fastcall void DrawTitle(dword ECX)
187
inline fastcall void DrawTitle(dword ECX)
188
{
188
{
189
	EAX = 71;
189
	EAX = 71;
190
	EBX = 1;
190
	EBX = 1;
191
	$int 0x40;
191
	$int 0x40;
192
}
192
}
193
 
193
 
194
inline fastcall dword GetSkinWidth()
194
inline fastcall dword GetSkinWidth()
195
{
195
{
196
	EAX = 48;
196
	EAX = 48;
197
	EBX = 4;
197
	EBX = 4;
198
	$int 0x40
198
	$int 0x40
199
}
199
}
200
 
200
 
201
inline fastcall void ChangeSkin(ECX){
201
inline fastcall void SetSystemSkin(ECX){
202
	EAX = 48;
202
	EAX = 48;
203
	EBX = 8;
203
	EBX = 8;
204
	$int 0x40
204
	$int 0x40
205
}
205
}
206
 
206
 
207
inline fastcall dword GetScreenWidth()
207
inline fastcall dword GetScreenWidth()
208
{
208
{
209
	EAX = 14;
209
	EAX = 14;
210
	EBX = 4;
210
	EBX = 4;
211
	$int 0x40
211
	$int 0x40
212
	$shr eax, 16
212
	$shr eax, 16
213
	$and eax,0x0000FFFF
213
	$and eax,0x0000FFFF
214
}
214
}
215
 
215
 
216
inline fastcall MoveSize(dword EBX,ECX,EDX,ESI)
216
inline fastcall MoveSize(dword EBX,ECX,EDX,ESI)
217
{
217
{
218
	EAX = 67;
218
	EAX = 67;
219
	$int 0x40
219
	$int 0x40
220
}
220
}
221
 
221
 
222
inline fastcall dword LoadLibrary(dword ECX)
222
inline fastcall dword LoadLibrary(dword ECX)
223
{
223
{
224
	$mov eax, 68 
224
	$mov eax, 68 
225
	$mov ebx, 19
225
	$mov ebx, 19
226
	$int  0x40
226
	$int  0x40
227
}
227
}
228
 
228
 
229
//------------------------------------------------------------------------------
229
//------------------------------------------------------------------------------
230
inline fastcall dword strlen(dword EDI){
230
inline fastcall dword strlen(dword EDI){
231
	EAX=0;
231
	EAX=0;
232
	ECX=-1;
232
	ECX=-1;
233
	$REPNE $SCASB
233
	$REPNE $SCASB
234
	EAX-=2+ECX;
234
	EAX-=2+ECX;
235
}
235
}
236
 
236
 
237
inline fastcall copystr(dword ESI,EDI)
237
inline fastcall copystr(dword ESI,EDI)
238
{
238
{
239
	$cld
239
	$cld
240
l1:
240
l1:
241
	$lodsb
241
	$lodsb
242
	$stosb
242
	$stosb
243
	$test al,al
243
	$test al,al
244
	$jnz l1
244
	$jnz l1
245
}
245
}
246
 
246
 
247
 
247
 
248
byte fastcall TestBit(EAX, CL)
248
byte fastcall TestBit(EAX, CL)
249
{
249
{
250
	$shr eax,cl
250
	$shr eax,cl
251
	$and eax,1
251
	$and eax,1
252
}
252
}
253
 
253
 
254
char buffer[11]="";
254
char buffer[11]="";
255
inline fastcall dword IntToStr(dword ESI)
255
inline fastcall dword IntToStr(dword ESI)
256
{
256
{
257
     $mov     edi, #buffer
257
     $mov     edi, #buffer
258
     $mov     ecx, 10
258
     $mov     ecx, 10
259
     $test     esi, esi
259
     $test     esi, esi
260
     $jns     f1
260
     $jns     f1
261
     $mov     al, '-'
261
     $mov     al, '-'
262
     $stosb
262
     $stosb
263
     $neg     esi
263
     $neg     esi
264
f1:
264
f1:
265
     $mov     eax, esi
265
     $mov     eax, esi
266
     $push     -'0'
266
     $push     -'0'
267
f2:
267
f2:
268
     $xor     edx, edx
268
     $xor     edx, edx
269
     $div     ecx
269
     $div     ecx
270
     $push     edx
270
     $push     edx
271
     $test     eax, eax
271
     $test     eax, eax
272
     $jnz     f2
272
     $jnz     f2
273
f3:
273
f3:
274
     $pop     eax
274
     $pop     eax
275
     $add     al, '0'
275
     $add     al, '0'
276
     $stosb
276
     $stosb
277
     $jnz     f3
277
     $jnz     f3
278
     $mov     eax, #buffer
278
     $mov     eax, #buffer
279
     $ret
279
     $ret
280
} 
280
} 
281
 
281
 
282
 
282
 
283
inline fastcall dword StrToInt()
283
inline fastcall dword StrToInt()
284
{
284
{
285
	ESI=EDI=EAX;
285
	ESI=EDI=EAX;
286
	IF(DSBYTE[ESI]=='-')ESI++;
286
	IF(DSBYTE[ESI]=='-')ESI++;
287
	EAX=0;
287
	EAX=0;
288
	BH=AL;
288
	BH=AL;
289
	do{
289
	do{
290
		BL=DSBYTE[ESI]-'0';
290
		BL=DSBYTE[ESI]-'0';
291
		EAX=EAX*10+EBX;
291
		EAX=EAX*10+EBX;
292
		ESI++;
292
		ESI++;
293
	}while(DSBYTE[ESI]>0);
293
	}while(DSBYTE[ESI]>0);
294
	IF(DSBYTE[EDI]=='-') -EAX;
294
	IF(DSBYTE[EDI]=='-') -EAX;
295
}
295
}
296
 
296
 
297
 
297
 
298
inline fastcall int strcmp(ESI, EDI)
298
inline fastcall int strcmp(ESI, EDI)
299
{
299
{
300
	loop()
300
	loop()
301
	{
301
	{
302
		IF (DSBYTE[ESI]
302
		IF (DSBYTE[ESI]
303
		IF (DSBYTE[ESI]>DSBYTE[EDI]) RETURN 1;
303
		IF (DSBYTE[ESI]>DSBYTE[EDI]) RETURN 1;
304
		IF (DSBYTE[ESI]=='\0') RETURN 0;
304
		IF (DSBYTE[ESI]=='\0') RETURN 0;
305
		ESI++;
305
		ESI++;
306
		EDI++;
306
		EDI++;
307
	}
307
	}
308
}
308
}
309
 
309
 
310
inline fastcall unsigned int find_symbol(ESI,BL)
310
inline fastcall unsigned int find_symbol(ESI,BL)
311
{
311
{
312
	int jj=0, last=-1;
312
	int jj=0, last=-1;
313
	do{
313
	do{
314
		jj++;
314
		jj++;
315
		$lodsb
315
		$lodsb
316
		IF(AL==BL) last=jj;
316
		IF(AL==BL) last=jj;
317
	} while(AL!=0);
317
	} while(AL!=0);
318
	return last;
318
	return last;
319
}
319
}
320
 
320
 
321
 
321
 
322
inline fastcall dword upcase(dword ESI)
322
inline fastcall dword upcase(dword ESI)
323
{
323
{
324
	do{
324
	do{
325
		AL=DSBYTE[ESI];
325
		AL=DSBYTE[ESI];
326
		IF(AL>='a')IF(AL<='z')DSBYTE[ESI]=AL&0x5f;
326
		IF(AL>='a')IF(AL<='z')DSBYTE[ESI]=AL&0x5f;
327
 		ESI++;
327
 		ESI++;
328
	}while(AL!=0);
328
	}while(AL!=0);
329
}
329
}
330
 
330
 
331
/*inline fastcall void lowcase(ESI)
331
/*inline fastcall void lowcase(ESI)
332
{
332
{
333
	do{
333
	do{
334
		$LODSB
334
		$LODSB
335
		IF(AL>='A')&&(AL<='Z'){
335
		IF(AL>='A')&&(AL<='Z'){
336
			AL+=0x20;
336
			AL+=0x20;
337
			DSBYTE[ESI-1]=AL;
337
			DSBYTE[ESI-1]=AL;
338
			CONTINUE;
338
			CONTINUE;
339
		}
339
		}
340
	}while(AL!=0);
340
	}while(AL!=0);
341
}*/
341
}*/
342
 
342
 
343
inline fastcall lowcase(ESI)
343
inline fastcall lowcase(ESI)
344
{
344
{
345
	do{
345
	do{
346
		$LODSB
346
		$LODSB
347
		IF(AL>='A')&&(AL<='Z'){
347
		IF(AL>='A')&&(AL<='Z'){
348
			AL+=0x20;
348
			AL+=0x20;
349
			DSBYTE[ESI-1]=AL;
349
			DSBYTE[ESI-1]=AL;
350
			CONTINUE;
350
			CONTINUE;
351
		}
351
		}
352
	}while(AL!=0);
352
	}while(AL!=0);
353
}
353
}
354
 
354
 
355
 
355
 
356
inline fastcall wintodos (dword ESI) 
356
inline fastcall wintodos (dword ESI) 
357
{
357
{
358
   while (BL=ESBYTE[ESI])
358
   while (BL=ESBYTE[ESI])
359
   {
359
   {
360
        IF (BL>=192)
360
        IF (BL>=192)
361
        {
361
        {
362
             IF (BL>=240) ESBYTE[ESI] = BL - 16;
362
             IF (BL>=240) ESBYTE[ESI] = BL - 16;
363
             ELSE ESBYTE[ESI] = BL - 64;
363
             ELSE ESBYTE[ESI] = BL - 64;
364
        }
364
        }
365
        ELSE
365
        ELSE
366
        {
366
        {
367
	IF (BL==178) ESBYTE[ESI] = 73;  //I
367
	IF (BL==178) ESBYTE[ESI] = 73;  //I
368
	IF (BL==179) ESBYTE[ESI] = 105; //i
368
	IF (BL==179) ESBYTE[ESI] = 105; //i
369
	IF (BL==175) ESBYTE[ESI] = 244; //J
369
	IF (BL==175) ESBYTE[ESI] = 244; //J
370
    IF (BL==191) ESBYTE[ESI] = 245; //j
370
    IF (BL==191) ESBYTE[ESI] = 245; //j
371
	IF (BL==170) ESBYTE[ESI] = 242; //E
371
	IF (BL==170) ESBYTE[ESI] = 242; //E
372
	IF (BL==186) ESBYTE[ESI] = 243; //e
372
	IF (BL==186) ESBYTE[ESI] = 243; //e
373
    IF (BL==168) ESBYTE[ESI] = 240; //ð
373
    IF (BL==168) ESBYTE[ESI] = 240; //ð
374
    IF (BL==184) ESBYTE[ESI] = 'e'; //e
374
    IF (BL==184) ESBYTE[ESI] = 'e'; //e
375
	IF (BL==180) ESBYTE[ESI] = 254; //ã
375
	IF (BL==180) ESBYTE[ESI] = 254; //ã
376
    IF ((BL==147) || (BL==148) || (BL==171) || (BL==187)) ESBYTE[ESI] = 34;
376
    IF ((BL==147) || (BL==148) || (BL==171) || (BL==187)) ESBYTE[ESI] = 34;
377
    IF ((BL==150) || (BL==151)) ESBYTE[ESI] = 45;
377
    IF ((BL==150) || (BL==151)) ESBYTE[ESI] = 45;
378
        }
378
        }
379
        ESI++;
379
        ESI++;
380
   }
380
   }
381
}
381
}
382
 
382
 
383
 
383
 
384
dword Hex2Symb(char* htmlcolor)
384
dword Hex2Symb(char* htmlcolor)
385
{
385
{
386
  dword j=0, symbol=0;
386
  dword j=0, symbol=0;
387
  char ch=0x00;
387
  char ch=0x00;
388
  FOR (;j<2;j++)
388
  FOR (;j<2;j++)
389
  {
389
  {
390
    ch=ESBYTE[htmlcolor+j];
390
    ch=ESBYTE[htmlcolor+j];
391
    IF (ch==0x0d) || (ch=='\9') RETURN '';
391
    IF (ch==0x0d) || (ch=='\9') RETURN '';
392
    IF ((ch>='0') && (ch<='9')) ch -= '0';
392
    IF ((ch>='0') && (ch<='9')) ch -= '0';
393
    IF ((ch>='A') && (ch<='F')) ch -= 'A'-10;
393
    IF ((ch>='A') && (ch<='F')) ch -= 'A'-10;
394
    IF ((ch>='a') && (ch<='f')) ch -= 'a'-10;
394
    IF ((ch>='a') && (ch<='f')) ch -= 'a'-10;
395
    symbol = symbol*0x10 + ch;
395
    symbol = symbol*0x10 + ch;
396
  }
396
  }
397
  wintodos(#symbol);
397
  wintodos(#symbol);
398
  AL=symbol;
398
  AL=symbol;
399
}
399
}
400
 
400
 
401
/*int hex2char(char c)
401
/*int hex2char(char c)
402
{
402
{
403
  if (c <=9)
403
  if (c <=9)
404
    return (c+48);
404
    return (c+48);
405
 
405
 
406
  return (c - 10 + 'a');
406
  return (c - 10 + 'a');
407
}
407
}
408
 
408
 
409
int hex2char(dword c)
409
int hex2char(dword c)
410
{
410
{
411
  if (c <=9)
411
  if (c <=9)
412
    return (c+48);
412
    return (c+48);
413
 
413
 
414
  return (c - 10 + 'a');
414
  return (c - 10 + 'a');
415
}*/
415
}*/
416
 
416
 
417
byte mas[66] = "椥ä£å¨©ª«¬­®¯ïàáâ㦢ìë§èíéçꞀ–„…”ƒ•ˆ‰Š‹ŒŽŸ‘’“†‚œ›‡˜™—š";
417
byte mas[66] = "椥ä£å¨©ª«¬­®¯ïàáâ㦢ìë§èíéçꞀ–„…”ƒ•ˆ‰Š‹ŒŽŸ‘’“†‚œ›‡˜™—š";
418
inline fastcall void koitodos(dword EDI)
418
inline fastcall void koitodos(dword EDI)
419
{
419
{
420
	WHILE (BL=ESBYTE[EDI])
420
	WHILE (BL=ESBYTE[EDI])
421
	{	
421
	{	
422
		IF (BL >= 0xC0)
422
		IF (BL >= 0xC0)
423
		{
423
		{
424
			BL -= 0xC0;
424
			BL -= 0xC0;
425
			ESBYTE[EDI] = mas[BL];
425
			ESBYTE[EDI] = mas[BL];
426
		}
426
		}
427
		//IF (ESBYTE[EDI]=='\244') ESBYTE[EDI]='i';
427
		//IF (ESBYTE[EDI]=='\244') ESBYTE[EDI]='i';
428
		EDI++;
428
		EDI++;
429
	}
429
	}
430
}
430
}
431
 
431
 
432
 
432
 
433
//Asper
433
//Asper
434
//uncomplete
434
//uncomplete
435
inline fastcall int utf8rutodos(dword ESI) //-
435
inline fastcall int utf8rutodos(dword ESI) //-
436
{
436
{
437
    EDI=ESI;
437
    EDI=ESI;
438
	while (BL=ESBYTE[ESI])
438
	while (BL=ESBYTE[ESI])
439
	{	
439
	{	
440
		IF (BL == 0xD0) || (BL == 0xD1) EDI--;
440
		IF (BL == 0xD0) || (BL == 0xD1) EDI--;
441
        else IF (BL == 0x81) && (ESBYTE[ESI-1]==0xD0) ESBYTE[EDI] = 0xF0; //è
441
        else IF (BL == 0x81) && (ESBYTE[ESI-1]==0xD0) ESBYTE[EDI] = 0xF0; //è
442
        else IF (BL == 0x91) && (ESBYTE[ESI-1]==0xD1) ESBYTE[EDI] = 0xF1; //¬
442
        else IF (BL == 0x91) && (ESBYTE[ESI-1]==0xD1) ESBYTE[EDI] = 0xF1; //¬
443
        else IF (BL == 0xE2) && (ESBYTE[ESI+1]==0x80) && (ESBYTE[ESI+2]==0x94)  //long defis
443
        else IF (BL == 0xE2) && (ESBYTE[ESI+1]==0x80) && (ESBYTE[ESI+2]==0x94)  //long defis
444
        {
444
        {
445
          ESBYTE[EDI] = '-';
445
          ESBYTE[EDI] = '-';
446
          ESI+=2;
446
          ESI+=2;
447
        }  
447
        }  
448
        else IF (BL == 0xE2) && (ESBYTE[ESI+1]==0x80) && (ESBYTE[ESI+2]==0xA2)  //central point
448
        else IF (BL == 0xE2) && (ESBYTE[ESI+1]==0x80) && (ESBYTE[ESI+2]==0xA2)  //central point
449
        {
449
        {
450
          ESBYTE[EDI] = '*';
450
          ESBYTE[EDI] = '*';
451
          ESI+=2;
451
          ESI+=2;
452
        }  
452
        }  
453
        else IF (BL == 0xC2) && (ESBYTE[ESI+1]==0xA9)  // (c)
453
        else IF (BL == 0xC2) && (ESBYTE[ESI+1]==0xA9)  // (c)
454
        {
454
        {
455
          ESBYTE[EDI] = '(';
455
          ESBYTE[EDI] = '(';
456
          ESBYTE[EDI+1] = 'c';
456
          ESBYTE[EDI+1] = 'c';
457
          ESBYTE[EDI+2] = ')';
457
          ESBYTE[EDI+2] = ')';
458
          EDI+=2;
458
          EDI+=2;
459
          ESI++;
459
          ESI++;
460
        }  
460
        }  
461
        ELSE IF (BL == 0xC2) && ((ESBYTE[ESI+1]==0xAB) || (ESBYTE[ESI+1]==0xBB))  // "
461
        ELSE IF (BL == 0xC2) && ((ESBYTE[ESI+1]==0xAB) || (ESBYTE[ESI+1]==0xBB))  // "
462
        {
462
        {
463
          ESBYTE[EDI] = '\"';
463
          ESBYTE[EDI] = '\"';
464
          ESI++;
464
          ESI++;
465
        }  
465
        }  
466
        ELSE IF (BL == 0xC2) && (ESBYTE[ESI+1]==0xB7)  // _
466
        ELSE IF (BL == 0xC2) && (ESBYTE[ESI+1]==0xB7)  // _
467
        {
467
        {
468
          ESBYTE[EDI] = '_';
468
          ESBYTE[EDI] = '_';
469
          ESI++;
469
          ESI++;
470
        }  
470
        }  
471
        ELSE IF (BL >= 0x90) && (BL <= 0xAF)
471
        ELSE IF (BL >= 0x90) && (BL <= 0xAF)
472
		{
472
		{
473
            BL -= 0x10;
473
            BL -= 0x10;
474
			ESBYTE[EDI] = BL;
474
			ESBYTE[EDI] = BL;
475
		}
475
		}
476
        ELSE IF (BL >= 0x80) && (BL <= 0x8F)
476
        ELSE IF (BL >= 0x80) && (BL <= 0x8F)
477
		{
477
		{
478
            BL += 0x60;
478
            BL += 0x60;
479
			ESBYTE[EDI] = BL;            
479
			ESBYTE[EDI] = BL;            
480
		}
480
		}
481
        ELSE IF (BL >= 0xB0) && (BL <= 0xBF)
481
        ELSE IF (BL >= 0xB0) && (BL <= 0xBF)
482
		{
482
		{
483
            BL -= 0x10;
483
            BL -= 0x10;
484
			ESBYTE[EDI] = BL;
484
			ESBYTE[EDI] = BL;
485
		}
485
		}
486
        ELSE ESBYTE[EDI] = BL;
486
        ELSE ESBYTE[EDI] = BL;
487
		ESI++;
487
		ESI++;
488
        EDI++;
488
        EDI++;
489
	}
489
	}
490
	WHILE (EDI
490
	WHILE (EDI
491
	{
491
	{
492
        ESBYTE[EDI] = ' ';
492
        ESBYTE[EDI] = ' ';
493
        EDI++;
493
        EDI++;
494
    }
494
    }
495
}
495
}
496
 
496
 
497
//------------------------------------------------------------------------------
497
//------------------------------------------------------------------------------
498
 
498
 
499
 
499
 
500
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI)
500
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI)
501
{
501
{
502
	EAX = 12;              // function 12:tell os about windowdraw
502
	EAX = 12;              // function 12:tell os about windowdraw
503
	EBX = 1;
503
	EBX = 1;
504
	$int 0x40
504
	$int 0x40
505
	
505
	
506
	EBX = x << 16 + sizeX;
506
	EBX = x << 16 + sizeX;
507
	ECX = y << 16 + sizeY;
507
	ECX = y << 16 + sizeY;
508
	EDX = mainAreaType << 24 | mainAreaColour;
508
	EDX = mainAreaType << 24 | mainAreaColour;
509
	ESI = headerType << 24 | headerColour;
509
	ESI = headerType << 24 | headerColour;
510
	$xor eax,eax
510
	$xor eax,eax
511
	$int 0x40
511
	$int 0x40
512
 
512
 
513
	EAX = 12;              // function 12:tell os about windowdraw
513
	EAX = 12;              // function 12:tell os about windowdraw
514
	EBX = 2;
514
	EBX = 2;
515
	$int 0x40
515
	$int 0x40
516
}
516
}
517
 
517
 
518
 
518
 
519
inline fastcall dword CreateThread(dword ECX,EDX)
519
inline fastcall dword CreateThread(dword ECX,EDX)
520
{
520
{
521
	EAX = 51;
521
	EAX = 51;
522
	EBX = 1;
522
	EBX = 1;
523
	$int 0x40
523
	$int 0x40
524
}
524
}
-
 
525
 
-
 
526
inline fastcall int GetSlot(dword ECX)
-
 
527
{
-
 
528
	EAX = 18;
-
 
529
	EBX = 21;
-
 
530
	$int 0x40
-
 
531
}
-
 
532
 
-
 
533
inline fastcall int GetActiveProcess()
-
 
534
{
-
 
535
	EAX = 18;
-
 
536
	EBX = 7;
-
 
537
	$int 0x40
-
 
538
}
-
 
539
 
525
 
540
 
526
void WriteText(dword x,y,byte fontType, dword color, EDX, ESI)
541
void WriteText(dword x,y,byte fontType, dword color, EDX, ESI)
527
{
542
{
528
	EAX = 4;
543
	EAX = 4;
529
	EBX = x<<16+y;
544
	EBX = x<<16+y;
530
	ECX = fontType<<24+color;
545
	ECX = fontType<<24+color;
531
	$int 0x40;
546
	$int 0x40;
532
}
547
}
533
 
548
 
534
void CopyScreen(dword EBX, x, y, sizeX, sizeY)
549
void CopyScreen(dword EBX, x, y, sizeX, sizeY)
535
{
550
{
536
  EAX = 36;
551
  EAX = 36;
537
  ECX = sizeX << 16 + sizeY;
552
  ECX = sizeX << 16 + sizeY;
538
  EDX = x << 16 + y;
553
  EDX = x << 16 + y;
539
  $int  0x40;
554
  $int  0x40;
540
}
555
}
541
 
556
 
542
void PutImage(dword EBX,w,h,x,y)
557
void PutImage(dword EBX,w,h,x,y)
543
{
558
{
544
	EAX = 7;
559
	EAX = 7;
545
	ECX = w<<16+h;
560
	ECX = w<<16+h;
546
	EDX = x<<16+y;
561
	EDX = x<<16+y;
547
	$int 0x40
562
	$int 0x40
548
}
563
}
549
 
564
 
550
void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI)
565
void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI)
551
{
566
{
552
	EAX = 65;
567
	EAX = 65;
553
	ECX = w<<16+h;
568
	ECX = w<<16+h;
554
	EDX = x<<16+y;
569
	EDX = x<<16+y;
555
	EBP = 0;
570
	EBP = 0;
556
	$int 0x40
571
	$int 0x40
557
} 
572
} 
558
 
573
 
559
inline fastcall void PutPixel(dword EBX,ECX,EDX){
574
inline fastcall void PutPixel(dword EBX,ECX,EDX){
560
  EAX=1;
575
  EAX=1;
561
  $int 0x40
576
  $int 0x40
562
}
577
}
563
 
578
 
564
void DrawBar(dword x,y,w,h,EDX)
579
void DrawBar(dword x,y,w,h,EDX)
565
{
580
{
566
	EAX = 13;
581
	EAX = 13;
567
	EBX = x<<16+w;
582
	EBX = x<<16+w;
568
	ECX = y<<16+h;
583
	ECX = y<<16+h;
569
 	$int 0x40
584
 	$int 0x40
570
}
585
}
571
 
586
 
572
void DefineButton(dword x,y,w,h,EDX,ESI)
587
void DefineButton(dword x,y,w,h,EDX,ESI)
573
{
588
{
574
 	EAX = 8;
589
 	EAX = 8;
575
	EBX = x<<16+w;
590
	EBX = x<<16+w;
576
	ECX = y<<16+h;
591
	ECX = y<<16+h;
577
 	$int 0x40
592
 	$int 0x40
578
}
593
}
579
 
594
 
580
inline fastcall void DeleteButton(dword EDX)
595
inline fastcall void DeleteButton(dword EDX)
581
{
596
{
582
	EAX = 8;
597
	EAX = 8;
583
	EDX += BT_DEL;
598
	EDX += BT_DEL;
584
	$int 0x40;
599
	$int 0x40;
585
}
600
}
586
 
601
 
587
:void DrawRegion(dword x,y,width,height,color1)
602
:void DrawRegion(dword x,y,width,height,color1)
588
{
603
{
589
	DrawBar(x,y,width,1,color1); //¯®«®á  £®à ᢥàåã
604
	DrawBar(x,y,width,1,color1); //¯®«®á  £®à ᢥàåã
590
	DrawBar(x,y+height,width,1,color1); //¯®«®á  £®à á­¨§ã
605
	DrawBar(x,y+height,width,1,color1); //¯®«®á  £®à á­¨§ã
591
	DrawBar(x,y,1,height,color1); //¯®«®á  ¢¥àåã á«¥¢ 
606
	DrawBar(x,y,1,height,color1); //¯®«®á  ¢¥àåã á«¥¢ 
592
	DrawBar(x+width,y,1,height+1,color1); //¯®«®á  ¢¥àåã á¯à ¢ 
607
	DrawBar(x+width,y,1,height+1,color1); //¯®«®á  ¢¥àåã á¯à ¢ 
593
}
608
}
594
 
609
 
595
:void DrawRegion_3D(dword x,y,width,height,color1,color2)
610
:void DrawRegion_3D(dword x,y,width,height,color1,color2)
596
{
611
{
597
	DrawBar(x,y,width+1,1,color1); //¯®«®á  £®à ᢥàåã
612
	DrawBar(x,y,width+1,1,color1); //¯®«®á  £®à ᢥàåã
598
	DrawBar(x,y+1,1,height-1,color1); //¯®«®á  á«¥¢ 
613
	DrawBar(x,y+1,1,height-1,color1); //¯®«®á  á«¥¢ 
599
	DrawBar(x+width,y+1,1,height,color2); //¯®«®á  á¯à ¢ 
614
	DrawBar(x+width,y+1,1,height,color2); //¯®«®á  á¯à ¢ 
600
	DrawBar(x,y+height,width,1,color2); //¯®«®á  £®à á­¨§ã
615
	DrawBar(x,y+height,width,1,color2); //¯®«®á  £®à á­¨§ã
601
}
616
}
602
 
617
 
603
void DrawFlatButton(dword x,y,width,height,id,color,text)
618
void DrawFlatButton(dword x,y,width,height,id,color,text)
604
{
619
{
605
	DrawRegion_3D(x,y,width,height,0x94AECE,0x94AECE);
620
	DrawRegion_3D(x,y,width,height,0x94AECE,0x94AECE);
606
	DrawRegion_3D(x+1,y+1,width-2,height-2,0xFFFFFF,0xC7C7C7);
621
	DrawRegion_3D(x+1,y+1,width-2,height-2,0xFFFFFF,0xC7C7C7);
607
	DrawBar(x+2,y+2,width-3,height-3,color); //§ «¨¢ª 
622
	DrawBar(x+2,y+2,width-3,height-3,color); //§ «¨¢ª 
608
	IF (id<>0)	DefineButton(x,y,width,height,id+BT_HIDE,0xEFEBEF); //ª­®¯ª 
623
	IF (id<>0)	DefineButton(x,y,width,height,id+BT_HIDE,0xEFEBEF); //ª­®¯ª 
609
	WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,0,text,0);
624
	WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,0,text,0);
610
}
625
}
611
 
626
 
612
:void DrawCircle(int x, y, r)
627
:void DrawCircle(int x, y, r)
613
{
628
{
614
	int i; float px=0, py=r, ii = r * 3.1415926 * 2;
629
	int i; float px=0, py=r, ii = r * 3.1415926 * 2;
615
	FOR (i = 0; i < ii; i++)
630
	FOR (i = 0; i < ii; i++)
616
	{
631
	{
617
        PutPixel(px + x, y - py, 0);
632
        PutPixel(px + x, y - py, 0);
618
        px = py / r + px;
633
        px = py / r + px;
619
        py = -px / r + py;
634
        py = -px / r + py;
620
		//Pause(1);
635
		//Pause(1);
621
	}
636
	}
622
}
637
}
623
 
638
 
624
//------------------------------------------------------------------------------
639
//------------------------------------------------------------------------------
625
 
640
 
626
inline fastcall dword WriteDebug(dword EDX)
641
inline fastcall dword WriteDebug(dword EDX)
627
{
642
{
628
	$push ebx
643
	$push ebx
629
	$push ecx
644
	$push ecx
630
	$mov eax, 63
645
	$mov eax, 63
631
	$mov ebx, 1
646
	$mov ebx, 1
632
next_char:
647
next_char:
633
	$mov ecx, DSDWORD[edx]
648
	$mov ecx, DSDWORD[edx]
634
	$or	 cl, cl
649
	$or	 cl, cl
635
	$jz  done
650
	$jz  done
636
	$int 0x40
651
	$int 0x40
637
	$inc edx
652
	$inc edx
638
	$jmp next_char
653
	$jmp next_char
639
done:
654
done:
640
	$mov cl, 13
655
	$mov cl, 13
641
	$int 0x40
656
	$int 0x40
642
	$mov cl, 10
657
	$mov cl, 10
643
	$int 0x40
658
	$int 0x40
644
	$pop ecx
659
	$pop ecx
645
	$pop ebx
660
	$pop ebx
646
}
661
}
647
>
662
>
648
>
663
>
649
>
664
>
650
>
665
>
651
>
666
>
652
>
667
>
653
>
668
>
654
>
669
>
655
>
670
>
656
>
671
>
657
>
672
>
658
>
673
>
659
>
674
>
660
>
675
>
661
>
676
>
662
>
677
>
663
>
678
>
664
>
679
>
665
>
680
>
666
>
681
>
667
>
682
>
668
>
683
>
669
>
684
>
670
>
685
>
671
>
686
>
672
>
687
>
673
>
688
>