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