Rev 3076 | Go to most recent revision | Details | 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; |
||
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 | #define NULL 0 |
||
28 | |||
29 | //Button options |
||
30 | #define BT_DEL 0x80000000 |
||
31 | #define BT_HIDE 0x40000000 |
||
32 | #define BT_NOFRAME 0x20000000 |
||
33 | |||
34 | //------------------------------------------------------------------------- |
||
35 | |||
36 | struct mouse |
||
37 | { |
||
38 | int x,y,lkm,pkm,hor,vert; |
||
39 | void get(); |
||
40 | }; |
||
41 | |||
42 | void mouse::get() |
||
43 | { |
||
44 | EAX = 37; |
||
45 | EBX = 1; |
||
46 | $int 0x40 |
||
47 | $mov ebx, eax |
||
48 | $shr eax, 16 |
||
49 | $and ebx,0x0000FFFF |
||
50 | x = EAX; |
||
51 | y = EBX; |
||
52 | EAX = 37; |
||
53 | EBX = 2; |
||
54 | $int 0x40 |
||
55 | $mov ebx, eax |
||
56 | $and eax, 0x00000001 |
||
57 | $shr ebx, 1 |
||
58 | $and ebx, 0x00000001 |
||
59 | lkm = EAX; |
||
60 | pkm = EBX; |
||
61 | EAX = 37; //бЄа®«« |
||
62 | EBX = 7; |
||
63 | $int 0x40 |
||
64 | $mov ebx, eax |
||
65 | $shr eax, 16 |
||
66 | $and ebx,0x0000FFFF |
||
67 | //hor = EAX; |
||
68 | vert = EBX; |
||
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 |
||
124 | @getkey: |
||
125 | $mov eax,2 |
||
126 | $int 0x40 |
||
127 | $cmp eax,1 |
||
128 | $jne getkeyi |
||
129 | $mov ah,dh |
||
130 | $jmp getkeyii //jz? |
||
131 | @getkeyi: |
||
132 | $mov dh,ah |
||
133 | $jmp getkey |
||
134 | @getkeyii: |
||
135 | $pop edx |
||
136 | $shr eax,8 |
||
137 | } |
||
138 | |||
139 | |||
140 | inline fastcall Pause( EBX) |
||
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 | //---------------------------------------- |
||
154 | |||
155 | inline fastcall dword GetFreeRAM() |
||
156 | { |
||
157 | $mov eax, 18 |
||
158 | $mov ebx, 16 |
||
159 | $int 0x40 |
||
160 | //return eax = размер свободной памяти в килобайтах |
||
161 | } |
||
162 | |||
163 | inline fastcall dword LoadDriver( ECX) //ECX - имя драйвера |
||
164 | { |
||
165 | $mov eax, 68 |
||
166 | $mov ebx, 16 |
||
167 | $int 0x40 |
||
168 | //return 0 - неудача, иначе eax = хэндл драйвера |
||
169 | } |
||
170 | |||
171 | inline fastcall dword RuleDriver( ECX) //указатель на управляющую структуру |
||
172 | { |
||
173 | $mov eax, 68 |
||
174 | $mov ebx, 17 |
||
175 | $int 0x40 |
||
176 | //return eax = определяется драйвером |
||
177 | } |
||
178 | |||
179 | struct proc_info |
||
180 | { |
||
181 | #define SelfInfo -1 |
||
182 | dword use_cpu; |
||
183 | word pos_in_stack,num_slot,rezerv1; |
||
184 | char name[11]; |
||
185 | char rezerv2; |
||
186 | dword adress,use_memory,ID,left,top,width,height; |
||
187 | word status_slot,rezerv3; |
||
188 | dword work_left,work_top,work_width,work_height; |
||
189 | char status_window; |
||
190 | void GetInfo( ECX); |
||
191 | byte reserved[1024-71]; |
||
192 | }; |
||
193 | |||
194 | inline fastcall void GetProcessInfo( EBX, ECX) |
||
195 | { |
||
196 | $mov eax,9; |
||
197 | $int 0x40 |
||
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 | |||
220 | inline fastcall int CreateThread( ECX,EDX) |
||
221 | { |
||
222 | $mov eax,51 |
||
223 | $mov ebx,1 |
||
224 | $int 0x40 |
||
225 | } |
||
226 | |||
227 | inline fastcall void SwitchToAnotherThread() |
||
228 | { |
||
229 | $mov eax,68 |
||
230 | $mov ebx,1 |
||
231 | $int 0x40 |
||
232 | } |
||
233 | |||
234 | inline fastcall int KillProcess( ECX) |
||
235 | { |
||
236 | $mov eax,18; |
||
237 | $mov ebx,18; |
||
238 | $int 0x40 |
||
239 | } |
||
240 | |||
241 | #define TURN_OFF 2 |
||
242 | #define REBOOT 3 |
||
243 | #define KERNEL 4 |
||
244 | inline fastcall int ExitSystem( ECX) |
||
245 | { |
||
246 | $mov eax, 18 |
||
247 | $mov ebx, 9 |
||
248 | $int 0x40 |
||
249 | } |
||
250 | |||
251 | inline fastcall ExitProcess() |
||
252 | { |
||
253 | $mov eax,-1; |
||
254 | $int 0x40 |
||
255 | } |
||
256 | |||
257 | //------------------------------------------------------------------------------ |
||
258 | |||
259 | //eax = язык системы (1=eng, 2=fi, 3=ger, 4=rus) |
||
260 | inline fastcall int GetSystemLanguage() |
||
261 | { |
||
262 | EAX = 26; |
||
263 | EBX = 5; |
||
264 | $int 0x40 |
||
265 | } |
||
266 | |||
267 | inline fastcall GetSkinHeight() |
||
268 | { |
||
269 | $push ebx |
||
270 | $mov eax,48 |
||
271 | $mov ebx,4 |
||
272 | $int 0x40 |
||
273 | $pop ebx |
||
274 | } |
||
275 | |||
276 | inline fastcall void SetSystemSkin( ECX) |
||
277 | { |
||
278 | EAX = 48; |
||
279 | EBX = 8; |
||
280 | $int 0x40 |
||
281 | } |
||
282 | |||
283 | inline fastcall int GetScreenWidth() |
||
284 | { |
||
285 | $mov eax, 14 |
||
286 | $int 0x40 |
||
287 | $shr eax, 16 |
||
288 | } |
||
289 | |||
290 | inline fastcall int GetScreenHeight() |
||
291 | { |
||
292 | $mov eax, 14 |
||
293 | $int 0x40 |
||
294 | $and eax,0x0000FFFF |
||
295 | } |
||
296 | |||
297 | inline fastcall dword LoadLibrary( ECX) |
||
298 | { |
||
299 | $mov eax, 68 |
||
300 | $mov ebx, 19 |
||
301 | $int 0x40 |
||
302 | } |
||
303 | |||
304 | inline fastcall int TestBit( EAX, CL) |
||
305 | { |
||
306 | $shr eax,cl |
||
307 | $and eax,1 |
||
308 | } |
||
309 | |||
310 | inline fastcall int PlaySpeaker( ESI) |
||
311 | { |
||
312 | $mov eax, 55 |
||
313 | $mov ebx, 55 |
||
314 | $int 0x40 |
||
315 | } |
||
316 | |||
317 | inline fastcall void debug( EDX) |
||
318 | { |
||
319 | $push ebx |
||
320 | $push ecx |
||
321 | $mov eax, 63 |
||
322 | $mov ebx, 1 |
||
323 | next_char: |
||
324 | $mov ecx, DSDWORD[edx] |
||
325 | $or cl, cl |
||
326 | $jz done |
||
327 | $int 0x40 |
||
328 | $inc edx |
||
329 | $jmp next_char |
||
330 | done: |
||
331 | $mov cl, 13 |
||
332 | $int 0x40 |
||
333 | $mov cl, 10 |
||
334 | $int 0x40 |
||
335 | $pop ecx |
||
336 | $pop ebx |
||
337 | } |
||
338 | //------------------------------------------------------------------------------ |
||
339 | |||
340 | void DefineAndDrawWindow(dword x,y, sizeX,sizeY, byte WindowType,dword WindowAreaColor, EDI, ESI) |
||
341 | { |
||
342 | EAX = 12; // function 12:tell os about windowdraw |
||
343 | EBX = 1; |
||
344 | $int 0x40 |
||
345 | |||
346 | EAX = 0; |
||
347 | EBX = x << 16 + sizeX; |
||
348 | ECX = y << 16 + sizeY; |
||
349 | EDX = WindowType << 24 | WindowAreaColor; |
||
350 | $int 0x40 |
||
351 | |||
352 | EAX = 12; // function 12:tell os about windowdraw |
||
353 | EBX = 2; |
||
354 | $int 0x40 |
||
355 | } |
||
356 | |||
357 | inline fastcall DeleteAllButtons() |
||
358 | { |
||
359 | EAX = 12; // function 12:tell os about windowdraw |
||
360 | EBX = 1; |
||
361 | $int 0x40 |
||
362 | EBX = 2; |
||
363 | $int 0x40 |
||
364 | } |
||
365 | |||
366 | inline fastcall MoveSize( EBX,ECX,EDX,ESI) |
||
367 | { |
||
368 | $mov eax, 67 |
||
369 | $int 0x40 |
||
370 | } |
||
371 | |||
372 | inline fastcall void DrawTitle( ECX) |
||
373 | { |
||
374 | EAX = 71; |
||
375 | EBX = 1; |
||
376 | $int 0x40; |
||
377 | } |
||
378 | |||
379 | void WriteText(dword x,y,byte fontType, dword color, EDX, ESI) |
||
380 | { |
||
381 | EAX = 4; |
||
382 | EBX = x<<16+y; |
||
383 | ECX = fontType<<24+color; |
||
384 | $int 0x40; |
||
385 | } |
||
386 | |||
387 | void WriteNumber(dword x,y,byte fontType, dword color, count, ECX) |
||
388 | { |
||
389 | EAX = 47; |
||
390 | EBX = count<<16; |
||
391 | EDX = x<<16+y; |
||
392 | ESI = fontType<<24+color; |
||
393 | $int 0x40; |
||
394 | } |
||
395 | |||
396 | void CopyScreen(dword EBX, x, y, sizeX, sizeY) |
||
397 | { |
||
398 | EAX = 36; |
||
399 | ECX = sizeX << 16 + sizeY; |
||
400 | EDX = x << 16 + y; |
||
401 | $int 0x40; |
||
402 | } |
||
403 | |||
404 | dword GetPixelColor(dword x, x_size, y) |
||
405 | { |
||
406 | $mov eax, 35 |
||
407 | EBX= y*x_size+x; |
||
408 | $int 0x40 |
||
409 | } |
||
410 | |||
411 | void PutImage(dword EBX,w,h,x,y) |
||
412 | { |
||
413 | EAX = 7; |
||
414 | ECX = w<<16+h; |
||
415 | EDX = x<<16+y; |
||
416 | $int 0x40 |
||
417 | } |
||
418 | |||
419 | void _PutImage(dword x,y, w,h, EBX) |
||
420 | { |
||
421 | EAX = 7; |
||
422 | ECX = w<<16+h; |
||
423 | EDX = x<<16+y; |
||
424 | $int 0x40 |
||
425 | } |
||
426 | |||
427 | void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI) |
||
428 | { |
||
429 | EAX = 65; |
||
430 | ECX = w<<16+h; |
||
431 | EDX = x<<16+y; |
||
432 | EBP = 0; |
||
433 | $int 0x40 |
||
434 | } |
||
435 | |||
436 | inline fastcall void PutPixel( EBX,ECX,EDX) |
||
437 | { |
||
438 | EAX=1; |
||
439 | $int 0x40 |
||
440 | } |
||
441 | |||
442 | void DrawBar(dword x,y,w,h,EDX) |
||
443 | { |
||
444 | EAX = 13; |
||
445 | EBX = x<<16+w; |
||
446 | ECX = y<<16+h; |
||
447 | $int 0x40 |
||
448 | } |
||
449 | |||
450 | void DefineButton(dword x,y,w,h,EDX,ESI) |
||
451 | { |
||
452 | EAX = 8; |
||
453 | EBX = x<<16+w; |
||
454 | ECX = y<<16+h; |
||
455 | $int 0x40 |
||
456 | } |
||
457 | |||
458 | inline fastcall void DeleteButton( EDX) |
||
459 | { |
||
460 | EAX = 8; |
||
461 | EDX += BT_DEL; |
||
462 | $int 0x40; |
||
463 | }16+h; |