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