Rev 3877 | Rev 3991 | 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 | { |
||
3107 | leency | 37 | signed int 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; |
||
51 | EAX = 37; |
||
52 | EBX = 2; |
||
53 | $int 0x40 |
||
54 | $mov ebx, eax |
||
55 | $and eax, 0x00000001 |
||
56 | $shr ebx, 1 |
||
57 | $and ebx, 0x00000001 |
||
58 | lkm = EAX; |
||
59 | pkm = EBX; |
||
60 | EAX = 37; //бЄа®«« |
||
61 | EBX = 7; |
||
62 | $int 0x40 |
||
63 | $mov ebx, eax |
||
64 | $shr eax, 16 |
||
65 | $and ebx,0x0000FFFF |
||
66 | //hor = EAX; |
||
67 | vert = EBX; |
||
3434 | leency | 68 | if (y>6000) y=0; |
3067 | leency | 69 | } |
70 | |||
71 | |||
72 | struct system_colors |
||
73 | { |
||
74 | dword frame,grab,grab_button,grab_button_text,grab_text, |
||
75 | work,work_button,work_button_text,work_text,work_graph; |
||
76 | void get(); |
||
77 | }; |
||
78 | |||
79 | void system_colors::get() |
||
80 | { |
||
81 | EAX = 48; |
||
82 | EBX = 3; |
||
83 | ECX = #frame; |
||
84 | EDX = 40; |
||
85 | $int 0x40 |
||
86 | } |
||
87 | |||
88 | //------------------------------------------------------------------------------ |
||
89 | |||
90 | inline fastcall dword WaitEvent() |
||
91 | { |
||
92 | $mov eax,10 |
||
93 | $int 0x40 |
||
94 | } |
||
95 | |||
96 | inline fastcall dword CheckEvent() |
||
97 | { |
||
98 | $mov eax,11 |
||
99 | $int 0x40 |
||
100 | } |
||
101 | |||
102 | inline fastcall dword WaitEventTimeout( EBX) |
||
103 | { |
||
104 | $mov eax,23 |
||
105 | $int 0x40 |
||
106 | } |
||
107 | |||
108 | inline fastcall SetEventMask( EBX) |
||
109 | { |
||
110 | $mov eax,40 |
||
111 | $int 0x40 |
||
112 | } |
||
113 | |||
114 | inline fastcall ScancodesGeting(){ |
||
115 | $mov eax,66 |
||
116 | $mov ebx,1 |
||
117 | $mov ecx,1 //бЄ Є®¤л |
||
118 | $int 0x40 |
||
119 | } |
||
120 | |||
121 | inline fastcall word GetKey() //+Gluk fix |
||
122 | { |
||
123 | $push edx |
||
3107 | leency | 124 | GETKEY: |
3067 | leency | 125 | $mov eax,2 |
126 | $int 0x40 |
||
127 | $cmp eax,1 |
||
3107 | leency | 128 | $jne GETKEYI |
3067 | leency | 129 | $mov ah,dh |
3107 | leency | 130 | $jmp GETKEYII //jz? |
131 | GETKEYI: |
||
3067 | leency | 132 | $mov dh,ah |
3107 | leency | 133 | $jmp GETKEY |
134 | GETKEYII: |
||
3067 | leency | 135 | $pop edx |
136 | $shr eax,8 |
||
137 | } |
||
138 | |||
139 | |||
3076 | leency | 140 | inline fastcall pause( EBX) |
3067 | leency | 141 | { |
142 | $mov eax, 5 |
||
143 | $int 0x40 |
||
144 | } |
||
145 | |||
146 | inline fastcall word GetButtonID() |
||
147 | { |
||
148 | $mov eax,17 |
||
149 | $int 0x40 |
||
150 | $shr eax,8 |
||
151 | } |
||
152 | |||
153 | inline fastcall dword GetFreeRAM() |
||
154 | { |
||
155 | $mov eax, 18 |
||
156 | $mov ebx, 16 |
||
157 | $int 0x40 |
||
158 | //return eax = размер свободной памяти в килобайтах |
||
159 | } |
||
160 | |||
161 | inline fastcall dword LoadDriver( ECX) //ECX - имя драйвера |
||
162 | { |
||
163 | $mov eax, 68 |
||
164 | $mov ebx, 16 |
||
165 | $int 0x40 |
||
166 | //return 0 - неудача, иначе eax = хэндл драйвера |
||
167 | } |
||
168 | |||
169 | inline fastcall dword RuleDriver( ECX) //указатель на управляющую структуру |
||
170 | { |
||
171 | $mov eax, 68 |
||
172 | $mov ebx, 17 |
||
173 | $int 0x40 |
||
174 | //return eax = определяется драйвером |
||
175 | } |
||
176 | |||
177 | struct proc_info |
||
178 | { |
||
179 | #define SelfInfo -1 |
||
180 | dword use_cpu; |
||
181 | word pos_in_stack,num_slot,rezerv1; |
||
182 | char name[11]; |
||
183 | char rezerv2; |
||
184 | dword adress,use_memory,ID,left,top,width,height; |
||
185 | word status_slot,rezerv3; |
||
186 | dword work_left,work_top,work_width,work_height; |
||
187 | char status_window; |
||
3107 | leency | 188 | dword cwidth,cheight; |
189 | byte reserved[1024-71-8]; |
||
3067 | leency | 190 | }; |
191 | |||
192 | inline fastcall void GetProcessInfo( EBX, ECX) |
||
193 | { |
||
194 | $mov eax,9; |
||
195 | $int 0x40 |
||
3107 | leency | 196 | DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth |
197 | DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight |
||
3067 | leency | 198 | } |
199 | |||
200 | inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y |
||
201 | { |
||
202 | $mov eax,34 |
||
203 | $int 0x40 |
||
204 | } |
||
205 | |||
206 | inline fastcall int GetProcessSlot( ECX) |
||
207 | { |
||
208 | EAX = 18; |
||
209 | EBX = 21; |
||
210 | $int 0x40 |
||
211 | } |
||
212 | |||
213 | inline fastcall int GetActiveProcess() |
||
214 | { |
||
215 | EAX = 18; |
||
216 | EBX = 7; |
||
217 | $int 0x40 |
||
218 | } |
||
219 | |||
3114 | leency | 220 | inline fastcall void ActivateWindow( ECX) |
221 | { |
||
222 | EAX = 18; |
||
223 | EBX = 3; |
||
224 | $int 0x40 |
||
225 | } |
||
226 | |||
3067 | leency | 227 | inline fastcall int CreateThread( ECX,EDX) |
228 | { |
||
229 | $mov eax,51 |
||
230 | $mov ebx,1 |
||
231 | $int 0x40 |
||
232 | } |
||
233 | |||
234 | inline fastcall void SwitchToAnotherThread() |
||
235 | { |
||
236 | $mov eax,68 |
||
237 | $mov ebx,1 |
||
238 | $int 0x40 |
||
239 | } |
||
240 | |||
3458 | leency | 241 | inline fastcall int SendWindowMessage( ECX, EDX) |
3444 | leency | 242 | { |
243 | $mov eax, 72 |
||
244 | $mov ebx, 1 |
||
245 | $int 0x40 |
||
246 | } |
||
247 | |||
3067 | leency | 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 | |
3363 | leency | 355 | |
3081 | leency | 356 | inline fastcall void debugch( ECX) |
357 | { |
||
3128 | leency | 358 | $push eax |
359 | $push ebx |
||
3081 | leency | 360 | $mov eax,63 |
361 | $mov ebx,1 |
||
362 | $int 0x40 |
||
3128 | leency | 363 | $pop ebx |
364 | $pop eax |
||
3081 | leency | 365 | } |
3067 | leency | 366 | //------------------------------------------------------------------------------ |
367 | |||
3958 | leency | 368 | void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword WindowAreaColor, EDI, ESI) |
3067 | leency | 369 | { |
370 | EAX = 12; // function 12:tell os about windowdraw |
||
371 | EBX = 1; |
||
372 | $int 0x40 |
||
373 | |||
374 | EAX = 0; |
||
3958 | leency | 375 | EBX = x << 16 + size_w; |
376 | ECX = y << 16 + size_h; |
||
3067 | leency | 377 | EDX = WindowType << 24 | WindowAreaColor; |
378 | $int 0x40 |
||
379 | |||
380 | EAX = 12; // function 12:tell os about windowdraw |
||
381 | EBX = 2; |
||
382 | $int 0x40 |
||
383 | } |
||
384 | |||
385 | inline fastcall MoveSize( EBX,ECX,EDX,ESI) |
||
386 | { |
||
387 | $mov eax, 67 |
||
388 | $int 0x40 |
||
389 | } |
||
390 | |||
391 | inline fastcall void DrawTitle( ECX) |
||
392 | { |
||
393 | EAX = 71; |
||
394 | EBX = 1; |
||
395 | $int 0x40; |
||
396 | } |
||
397 | |||
3107 | leency | 398 | void WriteTextB(dword x,y,byte fontType, dword color, EDX) |
3067 | leency | 399 | { |
400 | EAX = 4; |
||
401 | EBX = x<<16+y; |
||
402 | ECX = fontType<<24+color; |
||
3363 | leency | 403 | ESI = 0; |
3067 | leency | 404 | $int 0x40; |
3107 | leency | 405 | $add ebx, 1<<16 |
406 | $int 0x40 |
||
3067 | leency | 407 | } |
408 | |||
3107 | leency | 409 | void WriteText(dword x,y,byte fontType, dword color, EDX) |
410 | { |
||
411 | EAX = 4; |
||
412 | EBX = x<<16+y; |
||
413 | ECX = fontType<<24+color; |
||
414 | $int 0x40; |
||
415 | } |
||
416 | |||
3467 | leency | 417 | dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI) |
418 | { |
||
419 | EAX = 4; |
||
420 | EBX = x<<16+y; |
||
421 | ECX = fontType<<24+color; |
||
422 | $int 0x40; |
||
423 | } |
||
424 | |||
3067 | leency | 425 | void WriteNumber(dword x,y,byte fontType, dword color, count, ECX) |
426 | { |
||
427 | EAX = 47; |
||
428 | EBX = count<<16; |
||
429 | EDX = x<<16+y; |
||
430 | ESI = fontType<<24+color; |
||
431 | $int 0x40; |
||
432 | } |
||
433 | |||
3363 | leency | 434 | void CopyScreen(dword EBX, x, y, w, h) |
3067 | leency | 435 | { |
436 | EAX = 36; |
||
3363 | leency | 437 | ECX = w << 16 + h; |
3067 | leency | 438 | EDX = x << 16 + y; |
439 | $int 0x40; |
||
440 | } |
||
441 | |||
3467 | leency | 442 | :dword GetPixelColor(dword x, x_size, y) |
3067 | leency | 443 | { |
444 | $mov eax, 35 |
||
445 | EBX= y*x_size+x; |
||
446 | $int 0x40 |
||
447 | } |
||
448 | |||
449 | |||
450 | void _PutImage(dword x,y, w,h, EBX) |
||
451 | { |
||
452 | EAX = 7; |
||
453 | ECX = w<<16+h; |
||
454 | EDX = x<<16+y; |
||
455 | $int 0x40 |
||
456 | } |
||
457 | |||
458 | void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI) |
||
459 | { |
||
460 | EAX = 65; |
||
461 | ECX = w<<16+h; |
||
462 | EDX = x<<16+y; |
||
463 | EBP = 0; |
||
464 | $int 0x40 |
||
465 | } |
||
466 | |||
467 | inline fastcall void PutPixel( EBX,ECX,EDX) |
||
468 | { |
||
469 | EAX=1; |
||
470 | $int 0x40 |
||
471 | } |
||
472 | |||
473 | void DrawBar(dword x,y,w,h,EDX) |
||
474 | { |
||
3225 | leency | 475 | if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :) |
3067 | leency | 476 | EAX = 13; |
477 | EBX = x<<16+w; |
||
478 | ECX = y<<16+h; |
||
479 | $int 0x40 |
||
480 | } |
||
481 | |||
482 | void DefineButton(dword x,y,w,h,EDX,ESI) |
||
483 | { |
||
3107 | leency | 484 | EAX = 8; |
485 | $push edx |
||
486 | EDX += BT_DEL; |
||
487 | $int 0x40; |
||
488 | $pop edx |
||
3067 | leency | 489 | EBX = x<<16+w; |
490 | ECX = y<<16+h; |
||
491 | $int 0x40 |
||
492 | } |
||
493 | |||
3107 | leency | 494 | void UnsafeDefineButton(dword x,y,w,h,EDX,ESI) |
495 | { |
||
496 | EAX = 8; |
||
497 | EBX = x<<16+w; |
||
498 | ECX = y<<16+h; |
||
499 | $int 0x40 |
||
500 | } |
||
501 | |||
3067 | leency | 502 | inline fastcall void DeleteButton( EDX) |
503 | { |
||
504 | EAX = 8; |
||
505 | EDX += BT_DEL; |
||
506 | $int 0x40; |
||
3363 | leency | 507 | }16+h; |