Subversion Repositories Kolibri OS

Rev

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

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