Rev 4137 | Rev 4536 | 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 | { |
||
3991 | leency | 37 | signed 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; |
||
3991 | leency | 51 | if (x>6000) x-=65535; |
52 | if (y>6000) y-=65535; |
||
3067 | leency | 53 | EAX = 37; |
54 | EBX = 2; |
||
55 | $int 0x40 |
||
56 | $mov ebx, eax |
||
57 | $and eax, 0x00000001 |
||
58 | $shr ebx, 1 |
||
59 | $and ebx, 0x00000001 |
||
60 | lkm = EAX; |
||
61 | pkm = EBX; |
||
62 | EAX = 37; //бЄа®«« |
||
63 | EBX = 7; |
||
64 | $int 0x40 |
||
65 | $mov ebx, eax |
||
66 | $shr eax, 16 |
||
67 | $and ebx,0x0000FFFF |
||
68 | //hor = EAX; |
||
69 | vert = EBX; |
||
70 | } |
||
71 | |||
72 | |||
73 | struct system_colors |
||
74 | { |
||
75 | dword frame,grab,grab_button,grab_button_text,grab_text, |
||
76 | work,work_button,work_button_text,work_text,work_graph; |
||
77 | void get(); |
||
78 | }; |
||
79 | |||
80 | void system_colors::get() |
||
81 | { |
||
82 | EAX = 48; |
||
83 | EBX = 3; |
||
84 | ECX = #frame; |
||
85 | EDX = 40; |
||
86 | $int 0x40 |
||
87 | } |
||
88 | |||
89 | //------------------------------------------------------------------------------ |
||
90 | |||
91 | inline fastcall dword WaitEvent() |
||
92 | { |
||
93 | $mov eax,10 |
||
94 | $int 0x40 |
||
95 | } |
||
96 | |||
97 | inline fastcall dword CheckEvent() |
||
98 | { |
||
99 | $mov eax,11 |
||
100 | $int 0x40 |
||
101 | } |
||
102 | |||
103 | inline fastcall dword WaitEventTimeout( EBX) |
||
104 | { |
||
105 | $mov eax,23 |
||
106 | $int 0x40 |
||
107 | } |
||
108 | |||
109 | inline fastcall SetEventMask( EBX) |
||
110 | { |
||
111 | $mov eax,40 |
||
112 | $int 0x40 |
||
113 | } |
||
114 | |||
115 | inline fastcall ScancodesGeting(){ |
||
116 | $mov eax,66 |
||
117 | $mov ebx,1 |
||
118 | $mov ecx,1 //бЄ Є®¤л |
||
119 | $int 0x40 |
||
120 | } |
||
121 | |||
122 | inline fastcall word GetKey() //+Gluk fix |
||
123 | { |
||
124 | $push edx |
||
3107 | leency | 125 | GETKEY: |
3067 | leency | 126 | $mov eax,2 |
127 | $int 0x40 |
||
128 | $cmp eax,1 |
||
3107 | leency | 129 | $jne GETKEYI |
3067 | leency | 130 | $mov ah,dh |
3107 | leency | 131 | $jmp GETKEYII //jz? |
132 | GETKEYI: |
||
3067 | leency | 133 | $mov dh,ah |
3107 | leency | 134 | $jmp GETKEY |
135 | GETKEYII: |
||
3067 | leency | 136 | $pop edx |
137 | $shr eax,8 |
||
138 | } |
||
139 | |||
140 | |||
3076 | leency | 141 | inline fastcall pause( EBX) |
3067 | leency | 142 | { |
143 | $mov eax, 5 |
||
144 | $int 0x40 |
||
145 | } |
||
146 | |||
147 | inline fastcall word GetButtonID() |
||
148 | { |
||
149 | $mov eax,17 |
||
150 | $int 0x40 |
||
151 | $shr eax,8 |
||
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; |
||
4137 | leency | 183 | unsigned char name[11]; |
3067 | leency | 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 | |||
4081 | leency | 221 | :int CheckActiveProcess(int Form_ID) |
222 | { |
||
4166 | leency | 223 | int id9=GetProcessSlot(Form_ID); |
224 | if (id9==GetActiveProcess()) return 1; |
||
4081 | leency | 225 | return 0; |
226 | } |
||
227 | |||
3114 | leency | 228 | inline fastcall void ActivateWindow( ECX) |
229 | { |
||
230 | EAX = 18; |
||
231 | EBX = 3; |
||
232 | $int 0x40 |
||
233 | } |
||
234 | |||
3067 | leency | 235 | inline fastcall int CreateThread( ECX,EDX) |
236 | { |
||
237 | $mov eax,51 |
||
238 | $mov ebx,1 |
||
239 | $int 0x40 |
||
240 | } |
||
241 | |||
242 | inline fastcall void SwitchToAnotherThread() |
||
243 | { |
||
244 | $mov eax,68 |
||
245 | $mov ebx,1 |
||
246 | $int 0x40 |
||
247 | } |
||
248 | |||
3458 | leency | 249 | inline fastcall int SendWindowMessage( ECX, EDX) |
3444 | leency | 250 | { |
251 | $mov eax, 72 |
||
252 | $mov ebx, 1 |
||
253 | $int 0x40 |
||
254 | } |
||
255 | |||
3067 | leency | 256 | inline fastcall int KillProcess( ECX) |
257 | { |
||
258 | $mov eax,18; |
||
259 | $mov ebx,18; |
||
260 | $int 0x40 |
||
261 | } |
||
262 | |||
263 | #define TURN_OFF 2 |
||
264 | #define REBOOT 3 |
||
265 | #define KERNEL 4 |
||
266 | inline fastcall int ExitSystem( ECX) |
||
267 | { |
||
268 | $mov eax, 18 |
||
269 | $mov ebx, 9 |
||
270 | $int 0x40 |
||
271 | } |
||
272 | |||
273 | inline fastcall ExitProcess() |
||
274 | { |
||
275 | $mov eax,-1; |
||
276 | $int 0x40 |
||
277 | } |
||
278 | |||
279 | //------------------------------------------------------------------------------ |
||
280 | |||
281 | //eax = язык системы (1=eng, 2=fi, 3=ger, 4=rus) |
||
282 | inline fastcall int GetSystemLanguage() |
||
283 | { |
||
284 | EAX = 26; |
||
285 | EBX = 5; |
||
286 | $int 0x40 |
||
287 | } |
||
288 | |||
289 | inline fastcall GetSkinHeight() |
||
290 | { |
||
291 | $push ebx |
||
292 | $mov eax,48 |
||
293 | $mov ebx,4 |
||
294 | $int 0x40 |
||
295 | $pop ebx |
||
296 | } |
||
297 | |||
298 | inline fastcall void SetSystemSkin( ECX) |
||
299 | { |
||
300 | EAX = 48; |
||
301 | EBX = 8; |
||
302 | $int 0x40 |
||
303 | } |
||
304 | |||
305 | inline fastcall int GetScreenWidth() |
||
306 | { |
||
307 | $mov eax, 14 |
||
308 | $int 0x40 |
||
309 | $shr eax, 16 |
||
310 | } |
||
311 | |||
312 | inline fastcall int GetScreenHeight() |
||
313 | { |
||
314 | $mov eax, 14 |
||
315 | $int 0x40 |
||
316 | $and eax,0x0000FFFF |
||
317 | } |
||
318 | |||
319 | inline fastcall dword LoadLibrary( ECX) |
||
320 | { |
||
321 | $mov eax, 68 |
||
322 | $mov ebx, 19 |
||
323 | $int 0x40 |
||
324 | } |
||
325 | |||
326 | inline fastcall int TestBit( EAX, CL) |
||
327 | { |
||
328 | $shr eax,cl |
||
329 | $and eax,1 |
||
330 | } |
||
331 | |||
332 | inline fastcall int PlaySpeaker( ESI) |
||
333 | { |
||
334 | $mov eax, 55 |
||
335 | $mov ebx, 55 |
||
336 | $int 0x40 |
||
337 | } |
||
338 | |||
339 | inline fastcall void debug( EDX) |
||
340 | { |
||
3128 | leency | 341 | $push eax |
3067 | leency | 342 | $push ebx |
343 | $push ecx |
||
344 | $mov eax, 63 |
||
345 | $mov ebx, 1 |
||
3107 | leency | 346 | NEXT_CHAR: |
3067 | leency | 347 | $mov ecx, DSDWORD[edx] |
348 | $or cl, cl |
||
3107 | leency | 349 | $jz DONE |
3067 | leency | 350 | $int 0x40 |
351 | $inc edx |
||
3107 | leency | 352 | $jmp NEXT_CHAR |
353 | DONE: |
||
3067 | leency | 354 | $mov cl, 13 |
355 | $int 0x40 |
||
356 | $mov cl, 10 |
||
357 | $int 0x40 |
||
358 | $pop ecx |
||
359 | $pop ebx |
||
3128 | leency | 360 | $pop eax |
3067 | leency | 361 | } |
3081 | leency | 362 | |
3363 | leency | 363 | |
3081 | leency | 364 | inline fastcall void debugch( ECX) |
365 | { |
||
3128 | leency | 366 | $push eax |
367 | $push ebx |
||
3081 | leency | 368 | $mov eax,63 |
369 | $mov ebx,1 |
||
370 | $int 0x40 |
||
3128 | leency | 371 | $pop ebx |
372 | $pop eax |
||
3081 | leency | 373 | } |
3067 | leency | 374 | //------------------------------------------------------------------------------ |
375 | |||
3958 | leency | 376 | void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword WindowAreaColor, EDI, ESI) |
3067 | leency | 377 | { |
378 | EAX = 12; // function 12:tell os about windowdraw |
||
379 | EBX = 1; |
||
380 | $int 0x40 |
||
381 | |||
382 | EAX = 0; |
||
3958 | leency | 383 | EBX = x << 16 + size_w; |
384 | ECX = y << 16 + size_h; |
||
3067 | leency | 385 | EDX = WindowType << 24 | WindowAreaColor; |
386 | $int 0x40 |
||
387 | |||
388 | EAX = 12; // function 12:tell os about windowdraw |
||
389 | EBX = 2; |
||
390 | $int 0x40 |
||
391 | } |
||
392 | |||
393 | inline fastcall MoveSize( EBX,ECX,EDX,ESI) |
||
394 | { |
||
395 | $mov eax, 67 |
||
396 | $int 0x40 |
||
397 | } |
||
398 | |||
399 | inline fastcall void DrawTitle( ECX) |
||
400 | { |
||
401 | EAX = 71; |
||
402 | EBX = 1; |
||
403 | $int 0x40; |
||
404 | } |
||
405 | |||
3107 | leency | 406 | void WriteTextB(dword x,y,byte fontType, dword color, EDX) |
3067 | leency | 407 | { |
408 | EAX = 4; |
||
409 | EBX = x<<16+y; |
||
410 | ECX = fontType<<24+color; |
||
3363 | leency | 411 | ESI = 0; |
3067 | leency | 412 | $int 0x40; |
3107 | leency | 413 | $add ebx, 1<<16 |
414 | $int 0x40 |
||
3067 | leency | 415 | } |
416 | |||
3107 | leency | 417 | void WriteText(dword x,y,byte fontType, dword color, EDX) |
418 | { |
||
419 | EAX = 4; |
||
420 | EBX = x<<16+y; |
||
421 | ECX = fontType<<24+color; |
||
422 | $int 0x40; |
||
423 | } |
||
424 | |||
3467 | leency | 425 | dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI) |
426 | { |
||
427 | EAX = 4; |
||
428 | EBX = x<<16+y; |
||
429 | ECX = fontType<<24+color; |
||
430 | $int 0x40; |
||
431 | } |
||
432 | |||
3067 | leency | 433 | void WriteNumber(dword x,y,byte fontType, dword color, count, ECX) |
434 | { |
||
435 | EAX = 47; |
||
436 | EBX = count<<16; |
||
437 | EDX = x<<16+y; |
||
438 | ESI = fontType<<24+color; |
||
439 | $int 0x40; |
||
440 | } |
||
441 | |||
3363 | leency | 442 | void CopyScreen(dword EBX, x, y, w, h) |
3067 | leency | 443 | { |
444 | EAX = 36; |
||
3363 | leency | 445 | ECX = w << 16 + h; |
3067 | leency | 446 | EDX = x << 16 + y; |
447 | $int 0x40; |
||
448 | } |
||
449 | |||
3467 | leency | 450 | :dword GetPixelColor(dword x, x_size, y) |
3067 | leency | 451 | { |
452 | $mov eax, 35 |
||
453 | EBX= y*x_size+x; |
||
454 | $int 0x40 |
||
455 | } |
||
456 | |||
457 | |||
458 | void _PutImage(dword x,y, w,h, EBX) |
||
459 | { |
||
460 | EAX = 7; |
||
461 | ECX = w<<16+h; |
||
462 | EDX = x<<16+y; |
||
463 | $int 0x40 |
||
464 | } |
||
465 | |||
466 | void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI) |
||
467 | { |
||
468 | EAX = 65; |
||
469 | ECX = w<<16+h; |
||
470 | EDX = x<<16+y; |
||
471 | EBP = 0; |
||
472 | $int 0x40 |
||
473 | } |
||
474 | |||
475 | inline fastcall void PutPixel( EBX,ECX,EDX) |
||
476 | { |
||
477 | EAX=1; |
||
478 | $int 0x40 |
||
479 | } |
||
480 | |||
481 | void DrawBar(dword x,y,w,h,EDX) |
||
482 | { |
||
3225 | leency | 483 | if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :) |
3067 | leency | 484 | EAX = 13; |
485 | EBX = x<<16+w; |
||
486 | ECX = y<<16+h; |
||
487 | $int 0x40 |
||
488 | } |
||
489 | |||
490 | void DefineButton(dword x,y,w,h,EDX,ESI) |
||
491 | { |
||
3107 | leency | 492 | EAX = 8; |
493 | $push edx |
||
494 | EDX += BT_DEL; |
||
495 | $int 0x40; |
||
496 | $pop edx |
||
3067 | leency | 497 | EBX = x<<16+w; |
498 | ECX = y<<16+h; |
||
499 | $int 0x40 |
||
500 | } |
||
501 | |||
3107 | leency | 502 | void UnsafeDefineButton(dword x,y,w,h,EDX,ESI) |
503 | { |
||
504 | EAX = 8; |
||
505 | EBX = x<<16+w; |
||
506 | ECX = y<<16+h; |
||
507 | $int 0x40 |
||
508 | } |
||
509 | |||
3067 | leency | 510 | inline fastcall void DeleteButton( EDX) |
511 | { |
||
512 | EAX = 8; |
||
513 | EDX += BT_DEL; |
||
514 | $int 0x40; |
||
3363 | leency | 515 | }16+h; |