Rev 3444 | Rev 3467 | 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; |
||
3434 | leency | 68 | if (y>6000) y=0; |
3067 | leency | 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 |
||
3107 | leency | 124 | GETKEY: |
3067 | leency | 125 | $mov eax,2 |
126 | $int 0x40 |
||
127 | $cmp eax,1 |
||
3107 | leency | 128 | $jne GETKEYI |
3067 | leency | 129 | $mov ah,dh |
3107 | leency | 130 | $jmp GETKEYII //jz? |
131 | GETKEYI: |
||
3067 | leency | 132 | $mov dh,ah |
3107 | leency | 133 | $jmp GETKEY |
134 | GETKEYII: |
||
3067 | leency | 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; |
||
3107 | leency | 190 | dword cwidth,cheight; |
191 | byte reserved[1024-71-8]; |
||
3067 | leency | 192 | }; |
193 | |||
194 | inline fastcall void GetProcessInfo( EBX, ECX) |
||
195 | { |
||
196 | $mov eax,9; |
||
197 | $int 0x40 |
||
3107 | leency | 198 | DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth |
199 | DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight |
||
3067 | leency | 200 | } |
201 | |||
202 | inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y |
||
203 | { |
||
204 | $mov eax,34 |
||
205 | $int 0x40 |
||
206 | } |
||
207 | |||
208 | inline fastcall int GetProcessSlot( ECX) |
||
209 | { |
||
210 | EAX = 18; |
||
211 | EBX = 21; |
||
212 | $int 0x40 |
||
213 | } |
||
214 | |||
215 | inline fastcall int GetActiveProcess() |
||
216 | { |
||
217 | EAX = 18; |
||
218 | EBX = 7; |
||
219 | $int 0x40 |
||
220 | } |
||
221 | |||
3114 | leency | 222 | inline fastcall void ActivateWindow( ECX) |
223 | { |
||
224 | EAX = 18; |
||
225 | EBX = 3; |
||
226 | $int 0x40 |
||
227 | } |
||
228 | |||
3067 | leency | 229 | inline fastcall int CreateThread( ECX,EDX) |
230 | { |
||
231 | $mov eax,51 |
||
232 | $mov ebx,1 |
||
233 | $int 0x40 |
||
234 | } |
||
235 | |||
236 | inline fastcall void SwitchToAnotherThread() |
||
237 | { |
||
238 | $mov eax,68 |
||
239 | $mov ebx,1 |
||
240 | $int 0x40 |
||
241 | } |
||
242 | |||
3458 | leency | 243 | inline fastcall int SendWindowMessage( ECX, EDX) |
3444 | leency | 244 | { |
245 | $mov eax, 72 |
||
246 | $mov ebx, 1 |
||
247 | $int 0x40 |
||
248 | } |
||
249 | |||
3067 | leency | 250 | inline fastcall int KillProcess( ECX) |
251 | { |
||
252 | $mov eax,18; |
||
253 | $mov ebx,18; |
||
254 | $int 0x40 |
||
255 | } |
||
256 | |||
257 | #define TURN_OFF 2 |
||
258 | #define REBOOT 3 |
||
259 | #define KERNEL 4 |
||
260 | inline fastcall int ExitSystem( ECX) |
||
261 | { |
||
262 | $mov eax, 18 |
||
263 | $mov ebx, 9 |
||
264 | $int 0x40 |
||
265 | } |
||
266 | |||
267 | inline fastcall ExitProcess() |
||
268 | { |
||
269 | $mov eax,-1; |
||
270 | $int 0x40 |
||
271 | } |
||
272 | |||
273 | //------------------------------------------------------------------------------ |
||
274 | |||
275 | //eax = язык системы (1=eng, 2=fi, 3=ger, 4=rus) |
||
276 | inline fastcall int GetSystemLanguage() |
||
277 | { |
||
278 | EAX = 26; |
||
279 | EBX = 5; |
||
280 | $int 0x40 |
||
281 | } |
||
282 | |||
283 | inline fastcall GetSkinHeight() |
||
284 | { |
||
285 | $push ebx |
||
286 | $mov eax,48 |
||
287 | $mov ebx,4 |
||
288 | $int 0x40 |
||
289 | $pop ebx |
||
290 | } |
||
291 | |||
292 | inline fastcall void SetSystemSkin( ECX) |
||
293 | { |
||
294 | EAX = 48; |
||
295 | EBX = 8; |
||
296 | $int 0x40 |
||
297 | } |
||
298 | |||
299 | inline fastcall int GetScreenWidth() |
||
300 | { |
||
301 | $mov eax, 14 |
||
302 | $int 0x40 |
||
303 | $shr eax, 16 |
||
304 | } |
||
305 | |||
306 | inline fastcall int GetScreenHeight() |
||
307 | { |
||
308 | $mov eax, 14 |
||
309 | $int 0x40 |
||
310 | $and eax,0x0000FFFF |
||
311 | } |
||
312 | |||
313 | inline fastcall dword LoadLibrary( ECX) |
||
314 | { |
||
315 | $mov eax, 68 |
||
316 | $mov ebx, 19 |
||
317 | $int 0x40 |
||
318 | } |
||
319 | |||
320 | inline fastcall int TestBit( EAX, CL) |
||
321 | { |
||
322 | $shr eax,cl |
||
323 | $and eax,1 |
||
324 | } |
||
325 | |||
326 | inline fastcall int PlaySpeaker( ESI) |
||
327 | { |
||
328 | $mov eax, 55 |
||
329 | $mov ebx, 55 |
||
330 | $int 0x40 |
||
331 | } |
||
332 | |||
333 | inline fastcall void debug( EDX) |
||
334 | { |
||
3128 | leency | 335 | $push eax |
3067 | leency | 336 | $push ebx |
337 | $push ecx |
||
338 | $mov eax, 63 |
||
339 | $mov ebx, 1 |
||
3107 | leency | 340 | NEXT_CHAR: |
3067 | leency | 341 | $mov ecx, DSDWORD[edx] |
342 | $or cl, cl |
||
3107 | leency | 343 | $jz DONE |
3067 | leency | 344 | $int 0x40 |
345 | $inc edx |
||
3107 | leency | 346 | $jmp NEXT_CHAR |
347 | DONE: |
||
3067 | leency | 348 | $mov cl, 13 |
349 | $int 0x40 |
||
350 | $mov cl, 10 |
||
351 | $int 0x40 |
||
352 | $pop ecx |
||
353 | $pop ebx |
||
3128 | leency | 354 | $pop eax |
3067 | leency | 355 | } |
3081 | leency | 356 | |
3363 | leency | 357 | |
3081 | leency | 358 | inline fastcall void debugch( ECX) |
359 | { |
||
3128 | leency | 360 | $push eax |
361 | $push ebx |
||
3081 | leency | 362 | $mov eax,63 |
363 | $mov ebx,1 |
||
364 | $int 0x40 |
||
3128 | leency | 365 | $pop ebx |
366 | $pop eax |
||
3081 | leency | 367 | } |
3067 | leency | 368 | //------------------------------------------------------------------------------ |
369 | |||
370 | void DefineAndDrawWindow(dword x,y, sizeX,sizeY, byte WindowType,dword WindowAreaColor, EDI, ESI) |
||
371 | { |
||
372 | EAX = 12; // function 12:tell os about windowdraw |
||
373 | EBX = 1; |
||
374 | $int 0x40 |
||
375 | |||
376 | EAX = 0; |
||
377 | EBX = x << 16 + sizeX; |
||
378 | ECX = y << 16 + sizeY; |
||
379 | EDX = WindowType << 24 | WindowAreaColor; |
||
380 | $int 0x40 |
||
381 | |||
382 | EAX = 12; // function 12:tell os about windowdraw |
||
383 | EBX = 2; |
||
384 | $int 0x40 |
||
385 | } |
||
386 | |||
387 | inline fastcall MoveSize( EBX,ECX,EDX,ESI) |
||
388 | { |
||
389 | $mov eax, 67 |
||
390 | $int 0x40 |
||
391 | } |
||
392 | |||
393 | inline fastcall void DrawTitle( ECX) |
||
394 | { |
||
395 | EAX = 71; |
||
396 | EBX = 1; |
||
397 | $int 0x40; |
||
398 | } |
||
399 | |||
3107 | leency | 400 | void WriteTextB(dword x,y,byte fontType, dword color, EDX) |
3067 | leency | 401 | { |
402 | EAX = 4; |
||
403 | EBX = x<<16+y; |
||
404 | ECX = fontType<<24+color; |
||
3363 | leency | 405 | ESI = 0; |
3067 | leency | 406 | $int 0x40; |
3107 | leency | 407 | $add ebx, 1<<16 |
408 | $int 0x40 |
||
3067 | leency | 409 | } |
410 | |||
3107 | leency | 411 | void WriteText(dword x,y,byte fontType, dword color, EDX) |
412 | { |
||
413 | EAX = 4; |
||
414 | EBX = x<<16+y; |
||
415 | ECX = fontType<<24+color; |
||
416 | $int 0x40; |
||
417 | } |
||
418 | |||
3067 | leency | 419 | void WriteNumber(dword x,y,byte fontType, dword color, count, ECX) |
420 | { |
||
421 | EAX = 47; |
||
422 | EBX = count<<16; |
||
423 | EDX = x<<16+y; |
||
424 | ESI = fontType<<24+color; |
||
425 | $int 0x40; |
||
426 | } |
||
427 | |||
3363 | leency | 428 | void CopyScreen(dword EBX, x, y, w, h) |
3067 | leency | 429 | { |
430 | EAX = 36; |
||
3363 | leency | 431 | ECX = w << 16 + h; |
3067 | leency | 432 | EDX = x << 16 + y; |
433 | $int 0x40; |
||
434 | } |
||
435 | |||
436 | dword GetPixelColor(dword x, x_size, y) |
||
437 | { |
||
438 | $mov eax, 35 |
||
439 | EBX= y*x_size+x; |
||
440 | $int 0x40 |
||
441 | } |
||
442 | |||
443 | |||
444 | void _PutImage(dword x,y, w,h, EBX) |
||
445 | { |
||
446 | EAX = 7; |
||
447 | ECX = w<<16+h; |
||
448 | EDX = x<<16+y; |
||
449 | $int 0x40 |
||
450 | } |
||
451 | |||
452 | void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI) |
||
453 | { |
||
454 | EAX = 65; |
||
455 | ECX = w<<16+h; |
||
456 | EDX = x<<16+y; |
||
457 | EBP = 0; |
||
458 | $int 0x40 |
||
459 | } |
||
460 | |||
461 | inline fastcall void PutPixel( EBX,ECX,EDX) |
||
462 | { |
||
463 | EAX=1; |
||
464 | $int 0x40 |
||
465 | } |
||
466 | |||
467 | void DrawBar(dword x,y,w,h,EDX) |
||
468 | { |
||
3225 | leency | 469 | if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :) |
3067 | leency | 470 | EAX = 13; |
471 | EBX = x<<16+w; |
||
472 | ECX = y<<16+h; |
||
473 | $int 0x40 |
||
474 | } |
||
475 | |||
476 | void DefineButton(dword x,y,w,h,EDX,ESI) |
||
477 | { |
||
3107 | leency | 478 | EAX = 8; |
479 | $push edx |
||
480 | EDX += BT_DEL; |
||
481 | $int 0x40; |
||
482 | $pop edx |
||
3067 | leency | 483 | EBX = x<<16+w; |
484 | ECX = y<<16+h; |
||
485 | $int 0x40 |
||
486 | } |
||
487 | |||
3107 | leency | 488 | void UnsafeDefineButton(dword x,y,w,h,EDX,ESI) |
489 | { |
||
490 | EAX = 8; |
||
491 | EBX = x<<16+w; |
||
492 | ECX = y<<16+h; |
||
493 | $int 0x40 |
||
494 | } |
||
495 | |||
3067 | leency | 496 | inline fastcall void DeleteButton( EDX) |
497 | { |
||
498 | EAX = 8; |
||
499 | EDX += BT_DEL; |
||
500 | $int 0x40; |
||
3363 | leency | 501 | }16+h; |