Subversion Repositories Kolibri OS

Rev

Rev 3076 | Rev 3107 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3067 leency 1
//CODED by Veliant, Leency, Nable. GNU GPL licence.
2
 
3
#startaddress 0
4
#code32 TRUE
5
 
6
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
7
dword  os_version   = 0x00000001;
8
dword  start_addr   = #main;
9
dword  final_addr   = #stop+32;
10
dword  alloc_mem    = #0x00100000;
11
dword  x86esp_reg   = #0x00100000;
12
dword  I_Param      = #param;
13
dword  I_Path       = #program_path;
14
char param[4096];
15
char program_path[4096];
16
 
17
//Events
18
#define evMouse   6
19
#define evButton  3
20
#define evKey     2
21
#define evReDraw  1
22
 
23
#define OLD      -1
24
#define true      1
25
#define false     0
26
 
27
#define NULL      0
28
 
29
//Button options
30
#define BT_DEL      0x80000000
31
#define BT_HIDE     0x40000000
32
#define BT_NOFRAME  0x20000000
33
 
34
//-------------------------------------------------------------------------
35
 
36
struct mouse
37
{
38
	int x,y,lkm,pkm,hor,vert;
39
	void get();
40
};
41
 
42
void mouse::get()
43
{
44
	EAX = 37;
45
	EBX = 1;
46
	$int	0x40
47
	$mov	ebx, eax
48
	$shr	eax, 16
49
	$and	ebx,0x0000FFFF
50
	x = EAX;
51
	y = EBX;
52
	EAX = 37;
53
	EBX = 2;
54
	$int	0x40
55
	$mov	ebx, eax
56
	$and	eax, 0x00000001
57
	$shr	ebx, 1
58
	$and	ebx, 0x00000001
59
	lkm = EAX;
60
	pkm = EBX;
61
	EAX = 37; //бЄа®««
62
	EBX = 7;
63
	$int	0x40
64
	$mov	ebx, eax
65
	$shr	eax, 16
66
	$and	ebx,0x0000FFFF
67
	//hor = EAX;
68
	vert = EBX;
69
}
70
 
71
 
72
struct system_colors
73
{
74
	dword frame,grab,grab_button,grab_button_text,grab_text,
75
	      work,work_button,work_button_text,work_text,work_graph;
76
	void get();
77
};
78
 
79
void system_colors::get()
80
{
81
	EAX = 48;
82
	EBX = 3;
83
	ECX = #frame;
84
	EDX = 40;
85
	$int 0x40
86
}
87
 
88
//------------------------------------------------------------------------------
89
 
90
inline fastcall dword WaitEvent()
91
{
92
	$mov eax,10
93
	$int 0x40
94
}
95
 
96
inline fastcall dword CheckEvent()
97
{
98
	$mov eax,11
99
	$int 0x40
100
}
101
 
102
inline fastcall dword WaitEventTimeout( EBX)
103
{
104
	$mov eax,23
105
	$int 0x40
106
}
107
 
108
inline fastcall SetEventMask( EBX)
109
{
110
	$mov eax,40
111
	$int 0x40
112
}
113
 
114
inline fastcall ScancodesGeting(){
115
	$mov eax,66
116
	$mov ebx,1
117
	$mov ecx,1 //бЄ ­Є®¤л
118
	$int 0x40
119
}
120
 
121
inline fastcall word GetKey()  //+Gluk fix
122
{
123
		$push edx
124
@getkey:
125
		$mov  eax,2
126
		$int  0x40
127
		$cmp eax,1
128
		$jne getkeyi
129
		$mov ah,dh
130
		$jmp getkeyii //jz?
131
@getkeyi:
132
		$mov dh,ah
133
		$jmp getkey
134
@getkeyii:
135
		$pop edx
136
		$shr eax,8
137
}
138
 
139
 
3076 leency 140
inline fastcall pause( EBX)
3067 leency 141
{
142
	$mov eax, 5
143
	$int 0x40
144
}
145
 
146
inline fastcall word GetButtonID()
147
{
148
	$mov eax,17
149
	$int  0x40
150
	$shr eax,8
151
}
152
 
153
//----------------------------------------
154
 
155
inline fastcall dword GetFreeRAM()
156
{
157
	$mov eax, 18
158
	$mov ebx, 16
159
	$int 0x40
160
	//return eax = размер свободной памяти в килобайтах
161
}
162
 
163
inline fastcall dword LoadDriver( ECX) //ECX - имя драйвера
164
{
165
	$mov eax, 68
166
	$mov ebx, 16
167
	$int 0x40
168
	//return 0 - неудача, иначе eax = хэндл драйвера
169
}
170
 
171
inline fastcall dword RuleDriver( ECX) //указатель на управляющую структуру
172
{
173
	$mov eax, 68
174
	$mov ebx, 17
175
	$int 0x40
176
	//return eax = определяется драйвером
177
}
178
 
179
struct proc_info
180
{
181
	#define SelfInfo -1
182
	dword	use_cpu;
183
	word	pos_in_stack,num_slot,rezerv1;
184
	char	name[11];
185
	char	rezerv2;
186
	dword	adress,use_memory,ID,left,top,width,height;
187
	word	status_slot,rezerv3;
188
	dword	work_left,work_top,work_width,work_height;
189
	char	status_window;
190
	void	GetInfo( ECX);
191
	byte    reserved[1024-71];
192
};
193
 
194
inline fastcall void GetProcessInfo( EBX, ECX)
195
{
196
	$mov eax,9;
197
	$int  0x40
198
}
199
 
200
inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y
201
{
202
	$mov eax,34
203
	$int 0x40
204
}
205
 
206
inline fastcall int GetProcessSlot( ECX)
207
{
208
	EAX = 18;
209
	EBX = 21;
210
	$int 0x40
211
}
212
 
213
inline fastcall int GetActiveProcess()
214
{
215
	EAX = 18;
216
	EBX = 7;
217
	$int 0x40
218
}
219
 
220
inline fastcall int CreateThread( ECX,EDX)
221
{
222
	$mov eax,51
223
	$mov ebx,1
224
	$int 0x40
225
}
226
 
227
inline fastcall void SwitchToAnotherThread()
228
{
229
	$mov eax,68
230
	$mov ebx,1
231
	$int 0x40
232
}
233
 
234
inline fastcall int KillProcess( ECX)
235
{
236
	$mov eax,18;
237
	$mov ebx,18;
238
	$int 0x40
239
}
240
 
241
#define TURN_OFF 2
242
#define REBOOT 3
243
#define KERNEL 4
244
inline fastcall int ExitSystem( ECX)
245
{
246
	$mov eax, 18
247
	$mov ebx, 9
248
	$int 0x40
249
}
250
 
251
inline fastcall ExitProcess()
252
{
253
	$mov eax,-1;
254
	$int 0x40
255
}
256
 
257
//------------------------------------------------------------------------------
258
 
259
//eax = язык системы (1=eng, 2=fi, 3=ger, 4=rus)
260
inline fastcall int GetSystemLanguage()
261
{
262
	EAX = 26;
263
	EBX = 5;
264
	$int 0x40
265
}
266
 
267
inline fastcall GetSkinHeight()
268
{
269
	$push ebx
270
	$mov  eax,48
271
	$mov  ebx,4
272
	$int 0x40
273
	$pop  ebx
274
}
275
 
276
inline fastcall void SetSystemSkin( ECX)
277
{
278
	EAX = 48;
279
	EBX = 8;
280
	$int 0x40
281
}
282
 
283
inline fastcall int GetScreenWidth()
284
{
285
	$mov eax, 14
286
	$int 0x40
287
	$shr eax, 16
288
}
289
 
290
inline fastcall int GetScreenHeight()
291
{
292
	$mov eax, 14
293
	$int 0x40
294
	$and eax,0x0000FFFF
295
}
296
 
297
inline fastcall dword LoadLibrary( ECX)
298
{
299
	$mov eax, 68
300
	$mov ebx, 19
301
	$int  0x40
302
}
303
 
304
inline fastcall int TestBit( EAX, CL)
305
{
306
	$shr eax,cl
307
	$and eax,1
308
}
309
 
310
inline fastcall int PlaySpeaker( ESI)
311
{
312
	$mov eax, 55
313
	$mov ebx, 55
314
	$int 0x40
315
}
316
 
317
inline fastcall void debug( EDX)
318
{
319
	$push ebx
320
	$push ecx
321
	$mov eax, 63
322
	$mov ebx, 1
323
next_char:
324
	$mov ecx, DSDWORD[edx]
325
	$or	 cl, cl
326
	$jz  done
327
	$int 0x40
328
	$inc edx
329
	$jmp next_char
330
done:
331
	$mov cl, 13
332
	$int 0x40
333
	$mov cl, 10
334
	$int 0x40
335
	$pop ecx
336
	$pop ebx
337
}
3081 leency 338
 
339
inline fastcall void debugch( ECX)
340
{
341
	$mov eax,63
342
	$mov ebx,1
343
	$int 0x40
344
}
3067 leency 345
//------------------------------------------------------------------------------
346
 
347
void DefineAndDrawWindow(dword x,y, sizeX,sizeY, byte WindowType,dword WindowAreaColor, EDI, ESI)
348
{
349
	EAX = 12;              // function 12:tell os about windowdraw
350
	EBX = 1;
351
	$int 0x40
352
 
353
	EAX = 0;
354
	EBX = x << 16 + sizeX;
355
	ECX = y << 16 + sizeY;
356
	EDX = WindowType << 24 | WindowAreaColor;
357
	$int 0x40
358
 
359
	EAX = 12;              // function 12:tell os about windowdraw
360
	EBX = 2;
361
	$int 0x40
362
}
363
 
364
inline fastcall DeleteAllButtons()
365
{
366
	EAX = 12;              // function 12:tell os about windowdraw
367
	EBX = 1;
368
	$int 0x40
369
	EBX = 2;
370
	$int 0x40
371
}
372
 
373
inline fastcall MoveSize( EBX,ECX,EDX,ESI)
374
{
375
	$mov eax, 67
376
	$int 0x40
377
}
378
 
379
inline fastcall void DrawTitle( ECX)
380
{
381
	EAX = 71;
382
	EBX = 1;
383
	$int 0x40;
384
}
385
 
386
void WriteText(dword x,y,byte fontType, dword color, EDX, ESI)
387
{
388
	EAX = 4;
389
	EBX = x<<16+y;
390
	ECX = fontType<<24+color;
391
	$int 0x40;
392
}
393
 
394
void WriteNumber(dword x,y,byte fontType, dword color, count, ECX)
395
{
396
	EAX = 47;
397
	EBX = count<<16;
398
	EDX = x<<16+y;
399
	ESI = fontType<<24+color;
400
	$int 0x40;
401
}
402
 
403
void CopyScreen(dword EBX, x, y, sizeX, sizeY)
404
{
405
  EAX = 36;
406
  ECX = sizeX << 16 + sizeY;
407
  EDX = x << 16 + y;
408
  $int  0x40;
409
}
410
 
411
dword GetPixelColor(dword x, x_size, y)
412
{
413
	$mov eax, 35
414
	EBX= y*x_size+x;
415
	$int 0x40
416
}
417
 
418
void PutImage(dword EBX,w,h,x,y)
419
{
420
	EAX = 7;
421
	ECX = w<<16+h;
422
	EDX = x<<16+y;
423
	$int 0x40
424
}
425
 
426
void _PutImage(dword x,y, w,h, EBX)
427
{
428
	EAX = 7;
429
	ECX = w<<16+h;
430
	EDX = x<<16+y;
431
	$int 0x40
432
}
433
 
434
void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI)
435
{
436
	EAX = 65;
437
	ECX = w<<16+h;
438
	EDX = x<<16+y;
439
	EBP = 0;
440
	$int 0x40
441
}
442
 
443
inline fastcall void PutPixel( EBX,ECX,EDX)
444
{
445
  EAX=1;
446
  $int 0x40
447
}
448
 
449
void DrawBar(dword x,y,w,h,EDX)
450
{
451
	EAX = 13;
452
	EBX = x<<16+w;
453
	ECX = y<<16+h;
454
 	$int 0x40
455
}
456
 
457
void DefineButton(dword x,y,w,h,EDX,ESI)
458
{
459
 	EAX = 8;
460
	EBX = x<<16+w;
461
	ECX = y<<16+h;
462
	$int 0x40
463
}
464
 
465
inline fastcall void DeleteButton( EDX)
466
{
467
	EAX = 8;
468
	EDX += BT_DEL;
469
	$int 0x40;
3081 leency 470
}