Rev 2763 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1971 | lev | 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; |
||
10 | dword alloc_mem = #0x00100000; |
||
11 | dword x86esp_reg = #0x00100000; |
||
12 | dword I_Param = #param; |
||
2085 | leency | 13 | dword I_Path = #program_path; |
2566 | leency | 14 | char param[4096]; |
15 | char program_path[4096]; |
||
1971 | lev | 16 | |
17 | //Events |
||
18 | #define evMouse 6 |
||
19 | #define evButton 3 |
||
20 | #define evKey 2 |
||
21 | #define evReDraw 1 |
||
22 | |||
23 | //Button options |
||
24 | #define BT_DEL 0x80000000 |
||
25 | #define BT_HIDE 0x40000000 |
||
26 | #define BT_NOFRAME 0x20000000 |
||
27 | |||
28 | #define OLD -1 |
||
29 | #define true 1 |
||
30 | #define false 0 |
||
31 | //------------------------------------------------------------------------- |
||
32 | |||
33 | struct mouse{ |
||
34 | dword x,y,lkm,pkm,hor,vert; |
||
35 | void get(); |
||
36 | }; |
||
37 | |||
38 | void mouse::get() |
||
39 | { |
||
40 | EAX = 37; |
||
41 | EBX = 1; |
||
42 | $int 0x40 |
||
43 | $mov ebx, eax |
||
44 | $shr eax, 16 |
||
45 | $and ebx,0x0000FFFF |
||
46 | x = EAX; |
||
47 | y = EBX; |
||
48 | EAX = 37; |
||
49 | EBX = 2; |
||
50 | $int 0x40 |
||
51 | $mov ebx, eax |
||
52 | $and eax, 0x00000001 |
||
53 | $shr ebx, 1 |
||
54 | $and ebx, 0x00000001 |
||
55 | lkm = EAX; |
||
56 | pkm = EBX; |
||
57 | EAX = 37; //скролл |
||
58 | EBX = 7; |
||
59 | $int 0x40 |
||
60 | $mov ebx, eax |
||
61 | $shr eax, 16 |
||
62 | $and ebx,0x0000FFFF |
||
63 | //hor = EAX; |
||
64 | vert = EBX; |
||
65 | } |
||
66 | |||
67 | |||
68 | struct system_colors{ |
||
69 | dword frame,grab,grab_button,grab_button_text,grab_text,work,work_button,work_button_text,work_text,work_graph; |
||
70 | void get(); |
||
71 | }; |
||
72 | void system_colors::get() |
||
73 | { |
||
74 | EAX = 48; |
||
75 | EBX = 3; |
||
76 | ECX = #frame; |
||
77 | EDX = 40; |
||
78 | $int 0x40 |
||
79 | } |
||
80 | |||
81 | //------------------------------------------------------------------------------ |
||
82 | |||
83 | inline fastcall dword WaitEvent(){ |
||
2765 | leency | 84 | $mov eax,10 |
85 | $int 0x40 |
||
1971 | lev | 86 | } |
87 | |||
2765 | leency | 88 | inline fastcall dword CheckEvent(){ |
89 | $mov eax,11 |
||
90 | $int 0x40 |
||
91 | } |
||
92 | |||
1971 | lev | 93 | inline fastcall dword WaitEventTimeout(dword EBX){ |
2765 | leency | 94 | $mov eax,23 |
95 | $int 0x40 |
||
1971 | lev | 96 | } |
97 | |||
98 | inline fastcall SetEventMask(dword EBX) |
||
99 | { |
||
2765 | leency | 100 | $mov eax,40 |
101 | $int 0x40 |
||
1971 | lev | 102 | } |
103 | |||
104 | inline fastcall ScancodesGeting(){ |
||
2765 | leency | 105 | $mov eax,66 |
106 | $mov ebx,1 |
||
107 | $mov ecx,1 //сканкоды |
||
1971 | lev | 108 | $int 0x40 |
109 | } |
||
110 | |||
2085 | leency | 111 | |
112 | inline fastcall word GetKey(){ //Gluk fix |
||
113 | $push edx |
||
114 | @getkey: |
||
115 | $mov eax,2 |
||
116 | $int 0x40 |
||
117 | $cmp eax,1 |
||
118 | $jne getkeyi |
||
119 | $mov ah,dh |
||
120 | $jmp getkeyii //jz? |
||
121 | @getkeyi: |
||
122 | $mov dh,ah |
||
123 | $jmp getkey |
||
124 | @getkeyii: |
||
125 | $pop edx |
||
2765 | leency | 126 | $shr eax,8 |
1971 | lev | 127 | } |
128 | |||
2416 | leency | 129 | |
130 | inline fastcall Pause(dword EBX) |
||
131 | { //Пауза, в сотых долях секунды EBX = value |
||
132 | $mov eax, 5 |
||
133 | $int 0x40 |
||
134 | } |
||
135 | |||
136 | //================================================================== |
||
137 | |||
1971 | lev | 138 | inline fastcall word GetButtonID(){ |
2765 | leency | 139 | $mov eax,17 |
140 | $int 0x40 |
||
141 | $shr eax,8 |
||
1971 | lev | 142 | } |
143 | |||
2416 | leency | 144 | struct proc_info{ |
145 | dword use_cpu; |
||
146 | word pos_in_stack,num_slot,rezerv1; |
||
147 | char name[11]; |
||
148 | char rezerv2; |
||
149 | dword adress,use_memory,ID,left,top,width,height; |
||
150 | word status_slot,rezerv3; |
||
151 | dword work_left,work_top,work_width,work_height; |
||
152 | char status_window; |
||
153 | void GetInfo(dword ECX); |
||
154 | byte reserved[1024-71]; |
||
155 | #define SelfInfo -1 |
||
156 | }; |
||
157 | |||
158 | void GetProcessInfo(dword EBX, ECX) |
||
159 | { |
||
2765 | leency | 160 | $mov eax,9; |
2416 | leency | 161 | $int 0x40 |
162 | } |
||
163 | |||
164 | int GetProcessSlot(ECX) //ECX = process ID |
||
165 | { |
||
166 | EAX = 18; |
||
167 | EBX = 21; |
||
168 | $int 0x40; |
||
169 | } |
||
170 | |||
2763 | leency | 171 | inline fastcall int ActiveProcess() |
172 | { |
||
173 | EAX = 18; |
||
174 | EBX = 7; |
||
175 | $int 0x40 |
||
176 | } |
||
177 | |||
178 | |||
1971 | lev | 179 | inline fastcall ExitProcess(){ |
2765 | leency | 180 | $mov eax,-1; |
181 | $int 0x40 |
||
1971 | lev | 182 | } |
183 | |||
2416 | leency | 184 | inline fastcall KillProcess(dword ECX){ |
185 | $mov eax,18; |
||
186 | $mov ebx,18; |
||
1971 | lev | 187 | $int 0x40 |
188 | } |
||
189 | |||
2416 | leency | 190 | //================================================================== |
1971 | lev | 191 | |
2252 | leency | 192 | //eax = ч√ъ ёшёЄхь√ (1=eng, 2=fi, 3=ger, 4=rus) |
193 | inline fastcall int GetSystemLanguage(){ |
||
194 | EAX = 26; |
||
195 | EBX = 5; |
||
196 | $int 0x40 |
||
197 | RETURN EAX; |
||
198 | } |
||
199 | |||
1971 | lev | 200 | inline fastcall void DrawTitle(dword ECX) |
201 | { |
||
202 | EAX = 71; |
||
203 | EBX = 1; |
||
204 | $int 0x40; |
||
205 | } |
||
206 | |||
207 | inline fastcall dword GetSkinWidth() |
||
208 | { |
||
209 | EAX = 48; |
||
210 | EBX = 4; |
||
211 | $int 0x40 |
||
212 | } |
||
213 | |||
2495 | leency | 214 | inline fastcall void SetSystemSkin(ECX){ |
1971 | lev | 215 | EAX = 48; |
216 | EBX = 8; |
||
217 | $int 0x40 |
||
218 | } |
||
219 | |||
220 | inline fastcall dword GetScreenWidth() |
||
221 | { |
||
222 | EAX = 14; |
||
223 | EBX = 4; |
||
224 | $int 0x40 |
||
225 | $shr eax, 16 |
||
226 | $and eax,0x0000FFFF |
||
227 | } |
||
228 | |||
229 | inline fastcall MoveSize(dword EBX,ECX,EDX,ESI) |
||
230 | { |
||
231 | EAX = 67; |
||
232 | $int 0x40 |
||
233 | } |
||
234 | |||
235 | inline fastcall dword LoadLibrary(dword ECX) |
||
236 | { |
||
237 | $mov eax, 68 |
||
238 | $mov ebx, 19 |
||
239 | $int 0x40 |
||
240 | } |
||
241 | |||
242 | //------------------------------------------------------------------------------ |
||
243 | inline fastcall dword strlen(dword EDI){ |
||
244 | EAX=0; |
||
245 | ECX=-1; |
||
246 | $REPNE $SCASB |
||
247 | EAX-=2+ECX; |
||
248 | } |
||
249 | |||
250 | inline fastcall copystr(dword ESI,EDI) |
||
251 | { |
||
252 | $cld |
||
253 | l1: |
||
254 | $lodsb |
||
255 | $stosb |
||
256 | $test al,al |
||
257 | $jnz l1 |
||
258 | } |
||
259 | |||
2252 | leency | 260 | |
1971 | lev | 261 | byte fastcall TestBit(EAX, CL) |
262 | { |
||
263 | $shr eax,cl |
||
264 | $and eax,1 |
||
265 | } |
||
266 | |||
267 | char buffer[11]=""; |
||
268 | inline fastcall dword IntToStr(dword ESI) |
||
269 | { |
||
270 | $mov edi, #buffer |
||
271 | $mov ecx, 10 |
||
272 | $test esi, esi |
||
273 | $jns f1 |
||
274 | $mov al, '-' |
||
275 | $stosb |
||
276 | $neg esi |
||
277 | f1: |
||
278 | $mov eax, esi |
||
279 | $push -'0' |
||
280 | f2: |
||
281 | $xor edx, edx |
||
282 | $div ecx |
||
283 | $push edx |
||
284 | $test eax, eax |
||
285 | $jnz f2 |
||
286 | f3: |
||
287 | $pop eax |
||
288 | $add al, '0' |
||
289 | $stosb |
||
290 | $jnz f3 |
||
291 | $mov eax, #buffer |
||
292 | $ret |
||
293 | } |
||
294 | |||
295 | |||
296 | inline fastcall dword StrToInt() |
||
297 | { |
||
298 | ESI=EDI=EAX; |
||
299 | IF(DSBYTE[ESI]=='-')ESI++; |
||
300 | EAX=0; |
||
301 | BH=AL; |
||
302 | do{ |
||
303 | BL=DSBYTE[ESI]-'0'; |
||
304 | EAX=EAX*10+EBX; |
||
305 | ESI++; |
||
306 | }while(DSBYTE[ESI]>0); |
||
307 | IF(DSBYTE[EDI]=='-') -EAX; |
||
308 | } |
||
309 | |||
310 | |||
311 | inline fastcall int strcmp(ESI, EDI) |
||
312 | { |
||
313 | loop() |
||
314 | { |
||
315 | IF (DSBYTE[ESI] |
||
316 | IF (DSBYTE[ESI]>DSBYTE[EDI]) RETURN 1; |
||
317 | IF (DSBYTE[ESI]=='\0') RETURN 0; |
||
318 | ESI++; |
||
319 | EDI++; |
||
320 | } |
||
321 | } |
||
322 | |||
323 | inline fastcall unsigned int find_symbol(ESI,BL) |
||
324 | { |
||
325 | int jj=0, last=-1; |
||
326 | do{ |
||
327 | jj++; |
||
328 | $lodsb |
||
329 | IF(AL==BL) last=jj; |
||
330 | } while(AL!=0); |
||
331 | return last; |
||
332 | } |
||
333 | |||
334 | |||
335 | inline fastcall dword upcase(dword ESI) |
||
336 | { |
||
337 | do{ |
||
338 | AL=DSBYTE[ESI]; |
||
339 | IF(AL>='a')IF(AL<='z')DSBYTE[ESI]=AL&0x5f; |
||
340 | ESI++; |
||
341 | }while(AL!=0); |
||
342 | } |
||
343 | |||
344 | inline fastcall lowcase(ESI) |
||
345 | { |
||
346 | do{ |
||
347 | $LODSB |
||
348 | IF(AL>='A')&&(AL<='Z'){ |
||
349 | AL+=0x20; |
||
350 | DSBYTE[ESI-1]=AL; |
||
351 | CONTINUE; |
||
352 | } |
||
353 | }while(AL!=0); |
||
354 | } |
||
355 | |||
356 | |||
2416 | leency | 357 | void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI) |
1971 | lev | 358 | { |
359 | EAX = 12; // function 12:tell os about windowdraw |
||
2416 | leency | 360 | EBX = 1; |
1971 | lev | 361 | $int 0x40 |
2416 | leency | 362 | |
1971 | lev | 363 | EBX = x << 16 + sizeX; |
364 | ECX = y << 16 + sizeY; |
||
365 | EDX = mainAreaType << 24 | mainAreaColour; |
||
366 | ESI = headerType << 24 | headerColour; |
||
367 | $xor eax,eax |
||
368 | $int 0x40 |
||
369 | |||
2416 | leency | 370 | EAX = 12; // function 12:tell os about windowdraw |
371 | EBX = 2; |
||
372 | $int 0x40 |
||
373 | } |
||
374 | |||
375 | |||
1971 | lev | 376 | inline fastcall dword CreateThread(dword ECX,EDX) |
377 | { |
||
378 | EAX = 51; |
||
379 | EBX = 1; |
||
380 | $int 0x40 |
||
381 | } |
||
382 | |||
2495 | leency | 383 | inline fastcall int GetSlot(dword ECX) |
384 | { |
||
385 | EAX = 18; |
||
386 | EBX = 21; |
||
387 | $int 0x40 |
||
388 | } |
||
389 | |||
390 | inline fastcall int GetActiveProcess() |
||
391 | { |
||
392 | EAX = 18; |
||
393 | EBX = 7; |
||
394 | $int 0x40 |
||
395 | } |
||
396 | |||
397 | |||
1971 | lev | 398 | void WriteText(dword x,y,byte fontType, dword color, EDX, ESI) |
399 | { |
||
400 | EAX = 4; |
||
401 | EBX = x<<16+y; |
||
402 | ECX = fontType<<24+color; |
||
403 | $int 0x40; |
||
404 | } |
||
405 | |||
2444 | leency | 406 | void CopyScreen(dword EBX, x, y, sizeX, sizeY) |
407 | { |
||
408 | EAX = 36; |
||
409 | ECX = sizeX << 16 + sizeY; |
||
410 | EDX = x << 16 + y; |
||
411 | $int 0x40; |
||
412 | } |
||
413 | |||
1971 | lev | 414 | void PutImage(dword EBX,w,h,x,y) |
415 | { |
||
416 | EAX = 7; |
||
417 | ECX = w<<16+h; |
||
418 | EDX = x<<16+y; |
||
419 | $int 0x40 |
||
420 | } |
||
421 | |||
422 | void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI) |
||
423 | { |
||
424 | EAX = 65; |
||
425 | ECX = w<<16+h; |
||
426 | EDX = x<<16+y; |
||
427 | EBP = 0; |
||
428 | $int 0x40 |
||
429 | } |
||
430 | |||
431 | inline fastcall void PutPixel(dword EBX,ECX,EDX){ |
||
432 | EAX=1; |
||
433 | $int 0x40 |
||
434 | } |
||
435 | |||
436 | void DrawBar(dword x,y,w,h,EDX) |
||
437 | { |
||
438 | EAX = 13; |
||
439 | EBX = x<<16+w; |
||
440 | ECX = y<<16+h; |
||
441 | $int 0x40 |
||
442 | } |
||
443 | |||
444 | void DefineButton(dword x,y,w,h,EDX,ESI) |
||
445 | { |
||
446 | EAX = 8; |
||
2528 | leency | 447 | $push edx |
448 | EDX += BT_DEL; //тэрўрых єфры хь ъэюяє ё ¤Єш шф, яюЄюь ёючфр╕ь |
||
449 | $int 0x40; |
||
1971 | lev | 450 | EBX = x<<16+w; |
451 | ECX = y<<16+h; |
||
2528 | leency | 452 | $pop edx |
453 | $int 0x40 |
||
1971 | lev | 454 | } |
455 | |||
456 | inline fastcall void DeleteButton(dword EDX) |
||
457 | { |
||
458 | EAX = 8; |
||
459 | EDX += BT_DEL; |
||
460 | $int 0x40; |
||
461 | } |
||
462 | |||
2252 | leency | 463 | :void DrawRegion(dword x,y,width,height,color1) |
1971 | lev | 464 | { |
465 | DrawBar(x,y,width,1,color1); //полоса гор сверху |
||
466 | DrawBar(x,y+height,width,1,color1); //полоса гор снизу |
||
467 | DrawBar(x,y,1,height,color1); //полоса верху слева |
||
468 | DrawBar(x+width,y,1,height+1,color1); //полоса верху справа |
||
469 | } |
||
470 | |||
2252 | leency | 471 | :void DrawRegion_3D(dword x,y,width,height,color1,color2) |
1971 | lev | 472 | { |
473 | DrawBar(x,y,width+1,1,color1); //полоса гор сверху |
||
474 | DrawBar(x,y+1,1,height-1,color1); //полоса слева |
||
475 | DrawBar(x+width,y+1,1,height,color2); //полоса справа |
||
476 | DrawBar(x,y+height,width,1,color2); //полоса гор снизу |
||
477 | } |
||
478 | |||
479 | void DrawFlatButton(dword x,y,width,height,id,color,text) |
||
480 | { |
||
481 | DrawRegion_3D(x,y,width,height,0x94AECE,0x94AECE); |
||
482 | DrawRegion_3D(x+1,y+1,width-2,height-2,0xFFFFFF,0xC7C7C7); |
||
483 | DrawBar(x+2,y+2,width-3,height-3,color); //заливка |
||
484 | IF (id<>0) DefineButton(x,y,width,height,id+BT_HIDE,0xEFEBEF); //кнопка |
||
485 | WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,0,text,0); |
||
486 | } |
||
487 | |||
2252 | leency | 488 | :void DrawCircle(int x, y, r) |
1971 | lev | 489 | { |
490 | int i; float px=0, py=r, ii = r * 3.1415926 * 2; |
||
1974 | yogev_ezra | 491 | FOR (i = 0; i < ii; i++) |
1971 | lev | 492 | { |
493 | PutPixel(px + x, y - py, 0); |
||
494 | px = py / r + px; |
||
495 | py = -px / r + py; |
||
496 | //Pause(1); |
||
497 | } |
||
498 | } |
||
499 | |||
500 | //------------------------------------------------------------------------------ |
||
501 | |||
502 | inline fastcall dword WriteDebug(dword EDX) |
||
503 | { |
||
504 | $push ebx |
||
505 | $push ecx |
||
506 | $mov eax, 63 |
||
507 | $mov ebx, 1 |
||
508 | next_char: |
||
509 | $mov ecx, DSDWORD[edx] |
||
510 | $or cl, cl |
||
511 | $jz done |
||
512 | $int 0x40 |
||
513 | $inc edx |
||
514 | $jmp next_char |
||
515 | done: |
||
516 | $mov cl, 13 |
||
517 | $int 0x40 |
||
518 | $mov cl, 10 |
||
519 | $int 0x40 |
||
520 | $pop ecx |
||
521 | $pop ebx |
||
522 | }>>16+h; |