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