Rev 5548 | Rev 5572 | 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 |
4536 | leency | 23 | #define evReDraw 1 |
24 | #define evKey 2 |
||
25 | #define evButton 3 |
||
3067 | leency | 26 | #define evMouse 6 |
4536 | leency | 27 | #define evNetwork 8 |
3067 | leency | 28 | |
4536 | leency | 29 | |
3067 | leency | 30 | //Button options |
31 | #define BT_DEL 0x80000000 |
||
32 | #define BT_HIDE 0x40000000 |
||
33 | #define BT_NOFRAME 0x20000000 |
||
34 | |||
5465 | leency | 35 | //ASCII KEYS |
36 | #define ASCII_KEY_BS 008 |
||
37 | #define ASCII_KEY_TAB 009 |
||
38 | #define ASCII_KEY_ENTER 013 |
||
39 | #define ASCII_KEY_ESC 027 |
||
40 | #define ASCII_KEY_DEL 182 |
||
41 | #define ASCII_KEY_INS 185 |
||
42 | #define ASCII_KEY_SPACE 032 |
||
43 | |||
44 | #define ASCII_KEY_LEFT 176 |
||
45 | #define ASCII_KEY_RIGHT 179 |
||
46 | #define ASCII_KEY_DOWN 177 |
||
47 | #define ASCII_KEY_UP 178 |
||
48 | #define ASCII_KEY_HOME 180 |
||
49 | #define ASCII_KEY_END 181 |
||
50 | #define ASCII_KEY_PGDN 183 |
||
51 | #define ASCII_KEY_PGUP 184 |
||
52 | |||
53 | |||
3067 | leency | 54 | //------------------------------------------------------------------------- |
55 | |||
5477 | leency | 56 | :struct raw_image { |
57 | dword w, h, data; |
||
58 | }; |
||
59 | |||
60 | :struct mouse |
||
3067 | leency | 61 | { |
5549 | punk_joker | 62 | signed x,y,lkm,mkm,pkm,hor,vert; |
3067 | leency | 63 | void get(); |
64 | }; |
||
65 | |||
5477 | leency | 66 | :void mouse::get() |
3067 | leency | 67 | { |
68 | EAX = 37; |
||
69 | EBX = 1; |
||
70 | $int 0x40 |
||
71 | $mov ebx, eax |
||
72 | $shr eax, 16 |
||
73 | $and ebx,0x0000FFFF |
||
74 | x = EAX; |
||
75 | y = EBX; |
||
3991 | leency | 76 | if (x>6000) x-=65535; |
77 | if (y>6000) y-=65535; |
||
3067 | leency | 78 | EAX = 37; |
79 | EBX = 2; |
||
80 | $int 0x40 |
||
81 | $mov ebx, eax |
||
5549 | punk_joker | 82 | $mov ecx, eax |
3067 | leency | 83 | $and eax, 0x00000001 |
84 | $shr ebx, 1 |
||
85 | $and ebx, 0x00000001 |
||
5549 | punk_joker | 86 | $shr ecx, 2 |
87 | $and ecx, 0x00000001 |
||
3067 | leency | 88 | lkm = EAX; |
89 | pkm = EBX; |
||
5549 | punk_joker | 90 | mkm = ECX; |
3067 | leency | 91 | EAX = 37; //бЄа®«« |
92 | EBX = 7; |
||
93 | $int 0x40 |
||
94 | $mov ebx, eax |
||
95 | $shr eax, 16 |
||
96 | $and ebx,0x0000FFFF |
||
97 | //hor = EAX; |
||
98 | vert = EBX; |
||
99 | } |
||
100 | |||
101 | |||
5477 | leency | 102 | :struct system_colors |
3067 | leency | 103 | { |
104 | dword frame,grab,grab_button,grab_button_text,grab_text, |
||
105 | work,work_button,work_button_text,work_text,work_graph; |
||
106 | void get(); |
||
107 | }; |
||
108 | |||
5477 | leency | 109 | :void system_colors::get() |
3067 | leency | 110 | { |
111 | EAX = 48; |
||
112 | EBX = 3; |
||
113 | ECX = #frame; |
||
114 | EDX = 40; |
||
115 | $int 0x40 |
||
116 | } |
||
117 | |||
118 | //------------------------------------------------------------------------------ |
||
119 | |||
120 | inline fastcall dword WaitEvent() |
||
121 | { |
||
122 | $mov eax,10 |
||
123 | $int 0x40 |
||
124 | } |
||
125 | |||
126 | inline fastcall dword CheckEvent() |
||
127 | { |
||
128 | $mov eax,11 |
||
129 | $int 0x40 |
||
130 | } |
||
131 | |||
132 | inline fastcall dword WaitEventTimeout( EBX) |
||
133 | { |
||
134 | $mov eax,23 |
||
135 | $int 0x40 |
||
136 | } |
||
137 | |||
138 | inline fastcall SetEventMask( EBX) |
||
139 | { |
||
140 | $mov eax,40 |
||
141 | $int 0x40 |
||
142 | } |
||
143 | |||
144 | inline fastcall ScancodesGeting(){ |
||
145 | $mov eax,66 |
||
146 | $mov ebx,1 |
||
147 | $mov ecx,1 //бЄ Є®¤л |
||
148 | $int 0x40 |
||
149 | } |
||
150 | |||
151 | inline fastcall word GetKey() //+Gluk fix |
||
152 | { |
||
153 | $push edx |
||
3107 | leency | 154 | GETKEY: |
3067 | leency | 155 | $mov eax,2 |
156 | $int 0x40 |
||
157 | $cmp eax,1 |
||
3107 | leency | 158 | $jne GETKEYI |
3067 | leency | 159 | $mov ah,dh |
3107 | leency | 160 | $jmp GETKEYII //jz? |
161 | GETKEYI: |
||
3067 | leency | 162 | $mov dh,ah |
3107 | leency | 163 | $jmp GETKEY |
164 | GETKEYII: |
||
3067 | leency | 165 | $pop edx |
166 | $shr eax,8 |
||
167 | } |
||
168 | |||
4646 | leency | 169 | inline fastcall int GetFullKey() |
170 | { |
||
171 | $mov eax,2 |
||
172 | $int 0x40 |
||
173 | } |
||
3067 | leency | 174 | |
4646 | leency | 175 | |
3076 | leency | 176 | inline fastcall pause( EBX) |
3067 | leency | 177 | { |
178 | $mov eax, 5 |
||
179 | $int 0x40 |
||
180 | } |
||
181 | |||
182 | inline fastcall word GetButtonID() |
||
183 | { |
||
184 | $mov eax,17 |
||
185 | $int 0x40 |
||
186 | $shr eax,8 |
||
187 | } |
||
188 | |||
189 | inline fastcall dword GetFreeRAM() |
||
190 | { |
||
191 | $mov eax, 18 |
||
192 | $mov ebx, 16 |
||
193 | $int 0x40 |
||
194 | //return eax = размер свободной памяти в килобайтах |
||
195 | } |
||
196 | |||
197 | inline fastcall dword LoadDriver( ECX) //ECX - имя драйвера |
||
198 | { |
||
199 | $mov eax, 68 |
||
200 | $mov ebx, 16 |
||
201 | $int 0x40 |
||
202 | //return 0 - неудача, иначе eax = хэндл драйвера |
||
203 | } |
||
204 | |||
205 | inline fastcall dword RuleDriver( ECX) //указатель на управляющую структуру |
||
206 | { |
||
207 | $mov eax, 68 |
||
208 | $mov ebx, 17 |
||
209 | $int 0x40 |
||
210 | //return eax = определяется драйвером |
||
211 | } |
||
212 | |||
213 | struct proc_info |
||
214 | { |
||
215 | #define SelfInfo -1 |
||
216 | dword use_cpu; |
||
217 | word pos_in_stack,num_slot,rezerv1; |
||
4137 | leency | 218 | unsigned char name[11]; |
3067 | leency | 219 | char rezerv2; |
220 | dword adress,use_memory,ID,left,top,width,height; |
||
221 | word status_slot,rezerv3; |
||
222 | dword work_left,work_top,work_width,work_height; |
||
223 | char status_window; |
||
3107 | leency | 224 | dword cwidth,cheight; |
225 | byte reserved[1024-71-8]; |
||
3067 | leency | 226 | }; |
227 | |||
228 | inline fastcall void GetProcessInfo( EBX, ECX) |
||
229 | { |
||
230 | $mov eax,9; |
||
231 | $int 0x40 |
||
3107 | leency | 232 | DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth |
233 | DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight |
||
3067 | leency | 234 | } |
235 | |||
236 | inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y |
||
237 | { |
||
238 | $mov eax,34 |
||
239 | $int 0x40 |
||
240 | } |
||
241 | |||
242 | inline fastcall int GetProcessSlot( ECX) |
||
243 | { |
||
244 | EAX = 18; |
||
245 | EBX = 21; |
||
246 | $int 0x40 |
||
247 | } |
||
248 | |||
249 | inline fastcall int GetActiveProcess() |
||
250 | { |
||
251 | EAX = 18; |
||
252 | EBX = 7; |
||
253 | $int 0x40 |
||
254 | } |
||
255 | |||
4081 | leency | 256 | :int CheckActiveProcess(int Form_ID) |
257 | { |
||
4166 | leency | 258 | int id9=GetProcessSlot(Form_ID); |
259 | if (id9==GetActiveProcess()) return 1; |
||
4081 | leency | 260 | return 0; |
261 | } |
||
262 | |||
3114 | leency | 263 | inline fastcall void ActivateWindow( ECX) |
264 | { |
||
265 | EAX = 18; |
||
266 | EBX = 3; |
||
267 | $int 0x40 |
||
268 | } |
||
269 | |||
5421 | leency | 270 | inline fastcall int MinimizeWindow() |
271 | { |
||
272 | EAX = 18; |
||
273 | EBX = 10; |
||
274 | $int 0x40 |
||
275 | } |
||
276 | |||
3067 | leency | 277 | inline fastcall int CreateThread( ECX,EDX) |
278 | { |
||
279 | $mov eax,51 |
||
280 | $mov ebx,1 |
||
281 | $int 0x40 |
||
282 | } |
||
283 | |||
284 | inline fastcall void SwitchToAnotherThread() |
||
285 | { |
||
286 | $mov eax,68 |
||
287 | $mov ebx,1 |
||
288 | $int 0x40 |
||
289 | } |
||
290 | |||
3458 | leency | 291 | inline fastcall int SendWindowMessage( ECX, EDX) |
3444 | leency | 292 | { |
293 | $mov eax, 72 |
||
294 | $mov ebx, 1 |
||
295 | $int 0x40 |
||
296 | } |
||
297 | |||
3067 | leency | 298 | inline fastcall int KillProcess( ECX) |
299 | { |
||
300 | $mov eax,18; |
||
301 | $mov ebx,18; |
||
302 | $int 0x40 |
||
303 | } |
||
304 | |||
305 | #define TURN_OFF 2 |
||
306 | #define REBOOT 3 |
||
307 | #define KERNEL 4 |
||
308 | inline fastcall int ExitSystem( ECX) |
||
309 | { |
||
310 | $mov eax, 18 |
||
311 | $mov ebx, 9 |
||
312 | $int 0x40 |
||
313 | } |
||
314 | |||
315 | inline fastcall ExitProcess() |
||
316 | { |
||
317 | $mov eax,-1; |
||
318 | $int 0x40 |
||
319 | } |
||
320 | |||
321 | //------------------------------------------------------------------------------ |
||
322 | |||
323 | //eax = язык системы (1=eng, 2=fi, 3=ger, 4=rus) |
||
324 | inline fastcall int GetSystemLanguage() |
||
325 | { |
||
326 | EAX = 26; |
||
327 | EBX = 5; |
||
328 | $int 0x40 |
||
329 | } |
||
330 | |||
331 | inline fastcall GetSkinHeight() |
||
332 | { |
||
333 | $push ebx |
||
334 | $mov eax,48 |
||
335 | $mov ebx,4 |
||
336 | $int 0x40 |
||
337 | $pop ebx |
||
338 | } |
||
339 | |||
340 | inline fastcall void SetSystemSkin( ECX) |
||
341 | { |
||
342 | EAX = 48; |
||
343 | EBX = 8; |
||
344 | $int 0x40 |
||
345 | } |
||
346 | |||
347 | inline fastcall int GetScreenWidth() |
||
348 | { |
||
349 | $mov eax, 14 |
||
350 | $int 0x40 |
||
351 | $shr eax, 16 |
||
352 | } |
||
353 | |||
354 | inline fastcall int GetScreenHeight() |
||
355 | { |
||
356 | $mov eax, 14 |
||
357 | $int 0x40 |
||
358 | $and eax,0x0000FFFF |
||
359 | } |
||
360 | |||
5421 | leency | 361 | inline fastcall int GetClientTop() |
362 | { |
||
363 | $mov eax, 48 |
||
364 | $mov ebx, 5 |
||
365 | $int 0x40 |
||
366 | $mov eax, ebx |
||
367 | $shr eax, 16 |
||
368 | } |
||
369 | |||
370 | inline fastcall int GetClientHeight() |
||
371 | { |
||
372 | $mov eax, 48 |
||
373 | $mov ebx, 5 |
||
374 | $int 0x40 |
||
375 | $mov eax, ebx |
||
376 | } |
||
377 | |||
378 | |||
3067 | leency | 379 | inline fastcall dword LoadLibrary( ECX) |
380 | { |
||
381 | $mov eax, 68 |
||
382 | $mov ebx, 19 |
||
383 | $int 0x40 |
||
384 | } |
||
385 | |||
386 | inline fastcall int TestBit( EAX, CL) |
||
387 | { |
||
388 | $shr eax,cl |
||
389 | $and eax,1 |
||
390 | } |
||
391 | |||
392 | inline fastcall int PlaySpeaker( ESI) |
||
393 | { |
||
394 | $mov eax, 55 |
||
395 | $mov ebx, 55 |
||
396 | $int 0x40 |
||
397 | } |
||
398 | |||
4645 | leency | 399 | inline fastcall void debugln( EDX) |
3067 | leency | 400 | { |
3128 | leency | 401 | $push eax |
3067 | leency | 402 | $push ebx |
403 | $push ecx |
||
404 | $mov eax, 63 |
||
405 | $mov ebx, 1 |
||
3107 | leency | 406 | NEXT_CHAR: |
3067 | leency | 407 | $mov ecx, DSDWORD[edx] |
408 | $or cl, cl |
||
3107 | leency | 409 | $jz DONE |
3067 | leency | 410 | $int 0x40 |
411 | $inc edx |
||
3107 | leency | 412 | $jmp NEXT_CHAR |
413 | DONE: |
||
3067 | leency | 414 | $mov cl, 13 |
415 | $int 0x40 |
||
416 | $mov cl, 10 |
||
417 | $int 0x40 |
||
418 | $pop ecx |
||
419 | $pop ebx |
||
3128 | leency | 420 | $pop eax |
3067 | leency | 421 | } |
3081 | leency | 422 | |
4646 | leency | 423 | inline fastcall void debug( EDX) |
424 | { |
||
425 | $push eax |
||
426 | $push ebx |
||
427 | $push ecx |
||
428 | $mov eax, 63 |
||
429 | $mov ebx, 1 |
||
430 | NEXT_CHAR: |
||
431 | $mov ecx, DSDWORD[edx] |
||
432 | $or cl, cl |
||
433 | $jz DONE |
||
434 | $int 0x40 |
||
435 | $inc edx |
||
436 | $jmp NEXT_CHAR |
||
437 | DONE: |
||
438 | $pop ecx |
||
439 | $pop ebx |
||
440 | $pop eax |
||
441 | } |
||
3363 | leency | 442 | |
4646 | leency | 443 | |
3081 | leency | 444 | inline fastcall void debugch( ECX) |
445 | { |
||
3128 | leency | 446 | $push eax |
447 | $push ebx |
||
3081 | leency | 448 | $mov eax,63 |
449 | $mov ebx,1 |
||
450 | $int 0x40 |
||
3128 | leency | 451 | $pop ebx |
452 | $pop eax |
||
3081 | leency | 453 | } |
3067 | leency | 454 | //------------------------------------------------------------------------------ |
455 | |||
3958 | leency | 456 | void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword WindowAreaColor, EDI, ESI) |
3067 | leency | 457 | { |
458 | EAX = 12; // function 12:tell os about windowdraw |
||
459 | EBX = 1; |
||
460 | $int 0x40 |
||
461 | |||
462 | EAX = 0; |
||
3958 | leency | 463 | EBX = x << 16 + size_w; |
464 | ECX = y << 16 + size_h; |
||
3067 | leency | 465 | EDX = WindowType << 24 | WindowAreaColor; |
466 | $int 0x40 |
||
467 | |||
468 | EAX = 12; // function 12:tell os about windowdraw |
||
469 | EBX = 2; |
||
470 | $int 0x40 |
||
471 | } |
||
472 | |||
473 | inline fastcall MoveSize( EBX,ECX,EDX,ESI) |
||
474 | { |
||
475 | $mov eax, 67 |
||
476 | $int 0x40 |
||
477 | } |
||
478 | |||
479 | inline fastcall void DrawTitle( ECX) |
||
480 | { |
||
481 | EAX = 71; |
||
482 | EBX = 1; |
||
483 | $int 0x40; |
||
484 | } |
||
485 | |||
3107 | leency | 486 | void WriteTextB(dword x,y,byte fontType, dword color, EDX) |
3067 | leency | 487 | { |
488 | EAX = 4; |
||
489 | EBX = x<<16+y; |
||
490 | ECX = fontType<<24+color; |
||
3363 | leency | 491 | ESI = 0; |
3067 | leency | 492 | $int 0x40; |
3107 | leency | 493 | $add ebx, 1<<16 |
494 | $int 0x40 |
||
3067 | leency | 495 | } |
496 | |||
3107 | leency | 497 | void WriteText(dword x,y,byte fontType, dword color, EDX) |
498 | { |
||
499 | EAX = 4; |
||
500 | EBX = x<<16+y; |
||
501 | ECX = fontType<<24+color; |
||
502 | $int 0x40; |
||
503 | } |
||
504 | |||
3467 | leency | 505 | dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI) |
506 | { |
||
507 | EAX = 4; |
||
508 | EBX = x<<16+y; |
||
509 | ECX = fontType<<24+color; |
||
510 | $int 0x40; |
||
511 | } |
||
512 | |||
3067 | leency | 513 | void WriteNumber(dword x,y,byte fontType, dword color, count, ECX) |
514 | { |
||
515 | EAX = 47; |
||
516 | EBX = count<<16; |
||
517 | EDX = x<<16+y; |
||
518 | ESI = fontType<<24+color; |
||
519 | $int 0x40; |
||
520 | } |
||
521 | |||
3363 | leency | 522 | void CopyScreen(dword EBX, x, y, w, h) |
3067 | leency | 523 | { |
524 | EAX = 36; |
||
3363 | leency | 525 | ECX = w << 16 + h; |
3067 | leency | 526 | EDX = x << 16 + y; |
527 | $int 0x40; |
||
528 | } |
||
529 | |||
3467 | leency | 530 | :dword GetPixelColor(dword x, x_size, y) |
3067 | leency | 531 | { |
532 | $mov eax, 35 |
||
533 | EBX= y*x_size+x; |
||
534 | $int 0x40 |
||
535 | } |
||
536 | |||
537 | |||
538 | void _PutImage(dword x,y, w,h, EBX) |
||
539 | { |
||
540 | EAX = 7; |
||
541 | ECX = w<<16+h; |
||
542 | EDX = x<<16+y; |
||
543 | $int 0x40 |
||
544 | } |
||
545 | |||
546 | void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI) |
||
547 | { |
||
548 | EAX = 65; |
||
549 | ECX = w<<16+h; |
||
550 | EDX = x<<16+y; |
||
551 | EBP = 0; |
||
552 | $int 0x40 |
||
553 | } |
||
554 | |||
555 | inline fastcall void PutPixel( EBX,ECX,EDX) |
||
556 | { |
||
557 | EAX=1; |
||
558 | $int 0x40 |
||
559 | } |
||
560 | |||
561 | void DrawBar(dword x,y,w,h,EDX) |
||
562 | { |
||
3225 | leency | 563 | if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :) |
3067 | leency | 564 | EAX = 13; |
565 | EBX = x<<16+w; |
||
566 | ECX = y<<16+h; |
||
567 | $int 0x40 |
||
568 | } |
||
569 | |||
570 | void DefineButton(dword x,y,w,h,EDX,ESI) |
||
571 | { |
||
3107 | leency | 572 | EAX = 8; |
573 | $push edx |
||
574 | EDX += BT_DEL; |
||
575 | $int 0x40; |
||
576 | $pop edx |
||
3067 | leency | 577 | EBX = x<<16+w; |
578 | ECX = y<<16+h; |
||
579 | $int 0x40 |
||
580 | } |
||
581 | |||
3107 | leency | 582 | void UnsafeDefineButton(dword x,y,w,h,EDX,ESI) |
583 | { |
||
584 | EAX = 8; |
||
585 | EBX = x<<16+w; |
||
586 | ECX = y<<16+h; |
||
587 | $int 0x40 |
||
588 | } |
||
589 | |||
3067 | leency | 590 | inline fastcall void DeleteButton( EDX) |
591 | { |
||
592 | EAX = 8; |
||
593 | EDX += BT_DEL; |
||
594 | $int 0x40; |
||
5548 | leency | 595 | } |
596 | |||
597 | inline fastcall dword GetStartTime() |
||
598 | { |
||
599 | $mov eax,26 |
||
600 | $mov ebx,9 |
||
601 | $int 0x40 |
||
3363 | leency | 602 | }16+h; |