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