Rev 3958 | Rev 4081 | 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; |
||
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 | |||
3458 | leency | 242 | inline fastcall int SendWindowMessage( ECX, EDX) |
3444 | leency | 243 | { |
244 | $mov eax, 72 |
||
245 | $mov ebx, 1 |
||
246 | $int 0x40 |
||
247 | } |
||
248 | |||
3067 | leency | 249 | inline fastcall int KillProcess( ECX) |
250 | { |
||
251 | $mov eax,18; |
||
252 | $mov ebx,18; |
||
253 | $int 0x40 |
||
254 | } |
||
255 | |||
256 | #define TURN_OFF 2 |
||
257 | #define REBOOT 3 |
||
258 | #define KERNEL 4 |
||
259 | inline fastcall int ExitSystem( ECX) |
||
260 | { |
||
261 | $mov eax, 18 |
||
262 | $mov ebx, 9 |
||
263 | $int 0x40 |
||
264 | } |
||
265 | |||
266 | inline fastcall ExitProcess() |
||
267 | { |
||
268 | $mov eax,-1; |
||
269 | $int 0x40 |
||
270 | } |
||
271 | |||
272 | //------------------------------------------------------------------------------ |
||
273 | |||
274 | //eax = язык системы (1=eng, 2=fi, 3=ger, 4=rus) |
||
275 | inline fastcall int GetSystemLanguage() |
||
276 | { |
||
277 | EAX = 26; |
||
278 | EBX = 5; |
||
279 | $int 0x40 |
||
280 | } |
||
281 | |||
282 | inline fastcall GetSkinHeight() |
||
283 | { |
||
284 | $push ebx |
||
285 | $mov eax,48 |
||
286 | $mov ebx,4 |
||
287 | $int 0x40 |
||
288 | $pop ebx |
||
289 | } |
||
290 | |||
291 | inline fastcall void SetSystemSkin( ECX) |
||
292 | { |
||
293 | EAX = 48; |
||
294 | EBX = 8; |
||
295 | $int 0x40 |
||
296 | } |
||
297 | |||
298 | inline fastcall int GetScreenWidth() |
||
299 | { |
||
300 | $mov eax, 14 |
||
301 | $int 0x40 |
||
302 | $shr eax, 16 |
||
303 | } |
||
304 | |||
305 | inline fastcall int GetScreenHeight() |
||
306 | { |
||
307 | $mov eax, 14 |
||
308 | $int 0x40 |
||
309 | $and eax,0x0000FFFF |
||
310 | } |
||
311 | |||
312 | inline fastcall dword LoadLibrary( ECX) |
||
313 | { |
||
314 | $mov eax, 68 |
||
315 | $mov ebx, 19 |
||
316 | $int 0x40 |
||
317 | } |
||
318 | |||
319 | inline fastcall int TestBit( EAX, CL) |
||
320 | { |
||
321 | $shr eax,cl |
||
322 | $and eax,1 |
||
323 | } |
||
324 | |||
325 | inline fastcall int PlaySpeaker( ESI) |
||
326 | { |
||
327 | $mov eax, 55 |
||
328 | $mov ebx, 55 |
||
329 | $int 0x40 |
||
330 | } |
||
331 | |||
332 | inline fastcall void debug( EDX) |
||
333 | { |
||
3128 | leency | 334 | $push eax |
3067 | leency | 335 | $push ebx |
336 | $push ecx |
||
337 | $mov eax, 63 |
||
338 | $mov ebx, 1 |
||
3107 | leency | 339 | NEXT_CHAR: |
3067 | leency | 340 | $mov ecx, DSDWORD[edx] |
341 | $or cl, cl |
||
3107 | leency | 342 | $jz DONE |
3067 | leency | 343 | $int 0x40 |
344 | $inc edx |
||
3107 | leency | 345 | $jmp NEXT_CHAR |
346 | DONE: |
||
3067 | leency | 347 | $mov cl, 13 |
348 | $int 0x40 |
||
349 | $mov cl, 10 |
||
350 | $int 0x40 |
||
351 | $pop ecx |
||
352 | $pop ebx |
||
3128 | leency | 353 | $pop eax |
3067 | leency | 354 | } |
3081 | leency | 355 | |
3363 | leency | 356 | |
3081 | leency | 357 | inline fastcall void debugch( ECX) |
358 | { |
||
3128 | leency | 359 | $push eax |
360 | $push ebx |
||
3081 | leency | 361 | $mov eax,63 |
362 | $mov ebx,1 |
||
363 | $int 0x40 |
||
3128 | leency | 364 | $pop ebx |
365 | $pop eax |
||
3081 | leency | 366 | } |
3067 | leency | 367 | //------------------------------------------------------------------------------ |
368 | |||
3958 | leency | 369 | void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword WindowAreaColor, EDI, ESI) |
3067 | leency | 370 | { |
371 | EAX = 12; // function 12:tell os about windowdraw |
||
372 | EBX = 1; |
||
373 | $int 0x40 |
||
374 | |||
375 | EAX = 0; |
||
3958 | leency | 376 | EBX = x << 16 + size_w; |
377 | ECX = y << 16 + size_h; |
||
3067 | leency | 378 | EDX = WindowType << 24 | WindowAreaColor; |
379 | $int 0x40 |
||
380 | |||
381 | EAX = 12; // function 12:tell os about windowdraw |
||
382 | EBX = 2; |
||
383 | $int 0x40 |
||
384 | } |
||
385 | |||
386 | inline fastcall MoveSize( EBX,ECX,EDX,ESI) |
||
387 | { |
||
388 | $mov eax, 67 |
||
389 | $int 0x40 |
||
390 | } |
||
391 | |||
392 | inline fastcall void DrawTitle( ECX) |
||
393 | { |
||
394 | EAX = 71; |
||
395 | EBX = 1; |
||
396 | $int 0x40; |
||
397 | } |
||
398 | |||
3107 | leency | 399 | void WriteTextB(dword x,y,byte fontType, dword color, EDX) |
3067 | leency | 400 | { |
401 | EAX = 4; |
||
402 | EBX = x<<16+y; |
||
403 | ECX = fontType<<24+color; |
||
3363 | leency | 404 | ESI = 0; |
3067 | leency | 405 | $int 0x40; |
3107 | leency | 406 | $add ebx, 1<<16 |
407 | $int 0x40 |
||
3067 | leency | 408 | } |
409 | |||
3107 | leency | 410 | void WriteText(dword x,y,byte fontType, dword color, EDX) |
411 | { |
||
412 | EAX = 4; |
||
413 | EBX = x<<16+y; |
||
414 | ECX = fontType<<24+color; |
||
415 | $int 0x40; |
||
416 | } |
||
417 | |||
3467 | leency | 418 | dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI) |
419 | { |
||
420 | EAX = 4; |
||
421 | EBX = x<<16+y; |
||
422 | ECX = fontType<<24+color; |
||
423 | $int 0x40; |
||
424 | } |
||
425 | |||
3067 | leency | 426 | void WriteNumber(dword x,y,byte fontType, dword color, count, ECX) |
427 | { |
||
428 | EAX = 47; |
||
429 | EBX = count<<16; |
||
430 | EDX = x<<16+y; |
||
431 | ESI = fontType<<24+color; |
||
432 | $int 0x40; |
||
433 | } |
||
434 | |||
3363 | leency | 435 | void CopyScreen(dword EBX, x, y, w, h) |
3067 | leency | 436 | { |
437 | EAX = 36; |
||
3363 | leency | 438 | ECX = w << 16 + h; |
3067 | leency | 439 | EDX = x << 16 + y; |
440 | $int 0x40; |
||
441 | } |
||
442 | |||
3467 | leency | 443 | :dword GetPixelColor(dword x, x_size, y) |
3067 | leency | 444 | { |
445 | $mov eax, 35 |
||
446 | EBX= y*x_size+x; |
||
447 | $int 0x40 |
||
448 | } |
||
449 | |||
450 | |||
451 | void _PutImage(dword x,y, w,h, EBX) |
||
452 | { |
||
453 | EAX = 7; |
||
454 | ECX = w<<16+h; |
||
455 | EDX = x<<16+y; |
||
456 | $int 0x40 |
||
457 | } |
||
458 | |||
459 | void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI) |
||
460 | { |
||
461 | EAX = 65; |
||
462 | ECX = w<<16+h; |
||
463 | EDX = x<<16+y; |
||
464 | EBP = 0; |
||
465 | $int 0x40 |
||
466 | } |
||
467 | |||
468 | inline fastcall void PutPixel( EBX,ECX,EDX) |
||
469 | { |
||
470 | EAX=1; |
||
471 | $int 0x40 |
||
472 | } |
||
473 | |||
474 | void DrawBar(dword x,y,w,h,EDX) |
||
475 | { |
||
3225 | leency | 476 | if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :) |
3067 | leency | 477 | EAX = 13; |
478 | EBX = x<<16+w; |
||
479 | ECX = y<<16+h; |
||
480 | $int 0x40 |
||
481 | } |
||
482 | |||
483 | void DefineButton(dword x,y,w,h,EDX,ESI) |
||
484 | { |
||
3107 | leency | 485 | EAX = 8; |
486 | $push edx |
||
487 | EDX += BT_DEL; |
||
488 | $int 0x40; |
||
489 | $pop edx |
||
3067 | leency | 490 | EBX = x<<16+w; |
491 | ECX = y<<16+h; |
||
492 | $int 0x40 |
||
493 | } |
||
494 | |||
3107 | leency | 495 | void UnsafeDefineButton(dword x,y,w,h,EDX,ESI) |
496 | { |
||
497 | EAX = 8; |
||
498 | EBX = x<<16+w; |
||
499 | ECX = y<<16+h; |
||
500 | $int 0x40 |
||
501 | } |
||
502 | |||
3067 | leency | 503 | inline fastcall void DeleteButton( EDX) |
504 | { |
||
505 | EAX = 8; |
||
506 | EDX += BT_DEL; |
||
507 | $int 0x40; |
||
3363 | leency | 508 | }16+h; |