Rev 3045 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3045 | Rev 3113 | ||
---|---|---|---|
1 | //CODED by Veliant, Leency 2008-2012. GNU GPL licence. |
1 | //CODED by Veliant, Leency 2008-2012. GNU GPL licence. |
2 | 2 | ||
3 | #startaddress 0 |
3 | #startaddress 0 |
4 | #code32 TRUE |
4 | #code32 TRUE |
5 | 5 | ||
6 | byte os_name[8] = {'M','E','N','U','E','T','0','1'}; |
6 | byte os_name[8] = {'M','E','N','U','E','T','0','1'}; |
7 | dword os_version = 0x00000001; |
7 | dword os_version = 0x00000001; |
8 | dword start_addr = #main; |
8 | dword start_addr = #main; |
9 | dword final_addr = #stop+32; |
9 | dword final_addr = #stop+32; |
10 | dword alloc_mem = 0x00080000; |
10 | dword alloc_mem = 0x00080000; |
11 | dword x86esp_reg = 0x00080000; |
11 | dword x86esp_reg = 0x00080000; |
12 | dword I_Param = #param; |
12 | dword I_Param = #param; |
13 | dword I_Path = #program_path; |
13 | dword I_Path = #program_path; |
14 | 14 | ||
15 | char param[4096]; |
15 | char param[4096]; |
16 | char program_path[4096]; |
16 | char program_path[4096]; |
17 | 17 | ||
18 | #include "lib\strings.h" |
18 | #include "lib\strings.h" |
19 | 19 | ||
20 | //Events |
20 | //Events |
21 | #define evMouse 6 |
21 | #define evMouse 6 |
22 | #define evButton 3 |
22 | #define evButton 3 |
23 | #define evKey 2 |
23 | #define evKey 2 |
24 | #define evReDraw 1 |
24 | #define evReDraw 1 |
25 | 25 | ||
26 | //Button options |
26 | //Button options |
27 | #define BT_DEL 0x80000000 |
27 | #define BT_DEL 0x80000000 |
28 | #define BT_HIDE 0x40000000 |
28 | #define BT_HIDE 0x40000000 |
29 | #define BT_NOFRAME 0x20000000 |
29 | #define BT_NOFRAME 0x20000000 |
30 | 30 | ||
31 | #define OLD -1 |
31 | #define OLD -1 |
32 | #define true 1 |
32 | #define true 1 |
33 | #define false 0 |
33 | #define false 0 |
34 | 34 | ||
35 | #define NULL 0 |
35 | #define NULL 0 |
36 | 36 | ||
37 | 37 | ||
38 | struct mouse |
38 | struct mouse |
39 | { |
39 | { |
40 | unsigned int x,y,lkm,pkm,hor,vert; |
40 | unsigned int x,y,lkm,pkm,hor,vert; |
41 | void get(); |
41 | void get(); |
42 | }; |
42 | }; |
43 | 43 | ||
44 | inline fastcall int TestBit(EAX, CL) |
44 | inline fastcall int TestBit(EAX, CL) |
45 | { |
45 | { |
46 | $shr eax,cl |
46 | $shr eax,cl |
47 | $and eax,1 |
47 | $and eax,1 |
48 | } |
48 | } |
49 | 49 | ||
50 | void mouse::get() |
50 | void mouse::get() |
51 | { |
51 | { |
52 | EAX = 37; |
52 | EAX = 37; |
53 | EBX = 1; |
53 | EBX = 1; |
54 | $int 0x40 |
54 | $int 0x40 |
55 | $mov ebx, eax |
55 | $mov ebx, eax |
56 | $shr eax, 16 |
56 | $shr eax, 16 |
57 | $and ebx,0x0000FFFF |
57 | $and ebx,0x0000FFFF |
58 | x = EAX; |
58 | x = EAX; |
59 | y = EBX; |
59 | y = EBX; |
60 | 60 | ||
61 | EAX = 37; |
61 | EAX = 37; |
62 | EBX = 2; |
62 | EBX = 2; |
63 | $int 0x40 |
63 | $int 0x40 |
64 | $mov ebx, eax |
64 | $mov ebx, eax |
65 | $and eax, 0x00000001 |
65 | $and eax, 0x00000001 |
66 | $shr ebx, 1 |
66 | $shr ebx, 1 |
67 | $and ebx, 0x00000001 |
67 | $and ebx, 0x00000001 |
68 | lkm = EAX; |
68 | lkm = EAX; |
69 | pkm = EBX; |
69 | pkm = EBX; |
70 | 70 | ||
71 | EAX = 37; //scroll |
71 | EAX = 37; //scroll |
72 | EBX = 7; |
72 | EBX = 7; |
73 | $int 0x40 |
73 | $int 0x40 |
74 | $mov ebx, eax |
74 | $mov ebx, eax |
75 | $shr eax, 16 |
75 | $shr eax, 16 |
76 | $and ebx,0x0000FFFF |
76 | $and ebx,0x0000FFFF |
77 | //hor = EAX; |
77 | //hor = EAX; |
78 | vert = EBX; |
78 | vert = EBX; |
79 | } |
79 | } |
80 | 80 | ||
81 | //--------------------------------------------------------------------------- |
81 | //--------------------------------------------------------------------------- |
82 | struct proc_info |
82 | struct proc_info |
83 | { |
83 | { |
84 | #define SelfInfo -1 |
84 | #define SelfInfo -1 |
85 | dword use_cpu; |
85 | dword use_cpu; |
86 | word pos_in_stack,num_slot,rezerv1; |
86 | word pos_in_stack,num_slot,rezerv1; |
87 | char name[11]; |
87 | char name[11]; |
88 | char rezerv2; |
88 | char rezerv2; |
89 | dword adress,use_memory,ID,left,top,width,height; |
89 | dword adress,use_memory,ID,left,top,width,height; |
90 | word status_slot,rezerv3; |
90 | word status_slot,rezerv3; |
91 | dword work_left,work_top,work_width,work_height; |
91 | dword work_left,work_top,work_width,work_height; |
92 | char status_window; |
92 | char status_window; |
93 | void GetInfo( ECX); |
93 | void GetInfo( ECX); |
94 | byte reserved[1024-71]; |
94 | byte reserved[1024-71]; |
95 | }; |
95 | }; |
96 | 96 | ||
97 | void proc_info::GetInfo( EBX, ECX) |
97 | void proc_info::GetInfo( EBX, ECX) |
98 | { |
98 | { |
99 | $mov eax,9; |
99 | $mov eax,9; |
100 | $int 0x40 |
100 | $int 0x40 |
101 | } |
101 | } |
102 | 102 | ||
103 | inline fastcall int GetSlot( ECX) |
103 | inline fastcall int GetSlot( ECX) |
104 | { |
104 | { |
105 | $mov eax,18; |
105 | $mov eax,18; |
106 | $mov ebx,21; |
106 | $mov ebx,21; |
107 | $int 0x40 |
107 | $int 0x40 |
108 | } |
108 | } |
109 | 109 | ||
110 | inline fastcall int ActiveProcess() |
110 | inline fastcall int GetActiveProcess() |
111 | { |
111 | { |
112 | $mov eax,18; |
112 | $mov eax,18; |
113 | $mov ebx,7; |
113 | $mov ebx,7; |
114 | $int 0x40 |
114 | $int 0x40 |
115 | } |
115 | } |
- | 116 | ||
- | 117 | inline fastcall void ActivateWindow( ECX) |
|
- | 118 | { |
|
- | 119 | EAX = 18; |
|
- | 120 | EBX = 3; |
|
- | 121 | $int 0x40 |
|
- | 122 | } |
|
116 | 123 | ||
117 | //------------------------------------------------------------------------------- |
124 | //------------------------------------------------------------------------------- |
118 | 125 | ||
119 | inline fastcall dword WaitEvent(){ |
126 | inline fastcall dword WaitEvent(){ |
120 | $mov eax,10; |
127 | $mov eax,10; |
121 | $int 0x40 |
128 | $int 0x40 |
122 | } |
129 | } |
123 | 130 | ||
124 | inline fastcall void SetEventMask( EBX) |
131 | inline fastcall void SetEventMask( EBX) |
125 | { |
132 | { |
126 | EAX = 40; |
133 | EAX = 40; |
127 | $int 0x40 |
134 | $int 0x40 |
128 | } |
135 | } |
129 | 136 | ||
130 | inline fastcall word GetKey(){ //+Gluk fix |
137 | inline fastcall word GetKey(){ //+Gluk fix |
131 | $push edx |
138 | $push edx |
132 | @getkey: |
139 | GETKEY: |
133 | $mov eax,2 |
140 | $mov eax,2 |
134 | $int 0x40 |
141 | $int 0x40 |
135 | $cmp eax,1 |
142 | $cmp eax,1 |
136 | $jne getkeyi |
143 | $jne GETKEYI |
137 | $mov ah,dh |
144 | $mov ah,dh |
138 | $jmp getkeyii //jz? |
145 | $jmp GETKEYII //jz? |
139 | @getkeyi: |
146 | GETKEYI: |
140 | $mov dh,ah |
147 | $mov dh,ah |
141 | $jmp getkey |
148 | $jmp GETKEY |
142 | @getkeyii: |
149 | GETKEYII: |
143 | $pop edx |
150 | $pop edx |
144 | EAX = EAX >> 8; |
151 | EAX = EAX >> 8; |
145 | } |
152 | } |
146 | 153 | ||
147 | inline fastcall word GetButtonID(){ |
154 | inline fastcall word GetButtonID(){ |
148 | EAX = 17; // Get ID |
155 | EAX = 17; // Get ID |
149 | $int 0x40 |
156 | $int 0x40 |
150 | EAX = EAX >> 8; |
157 | EAX = EAX >> 8; |
151 | } |
158 | } |
152 | 159 | ||
153 | inline fastcall void ExitProcess(){ |
160 | inline fastcall void ExitProcess(){ |
154 | EAX = -1; // close this program |
161 | EAX = -1; // close this program |
155 | $int 0x40 |
162 | $int 0x40 |
156 | } |
163 | } |
157 | 164 | ||
158 | inline fastcall void Pause( EBX){ |
165 | inline fastcall void Pause( EBX){ |
159 | $mov eax, 5 |
166 | $mov eax, 5 |
160 | $int 0x40 |
167 | $int 0x40 |
161 | } |
168 | } |
162 | 169 | ||
163 | //------------------------------------------------------------------------------ |
170 | //------------------------------------------------------------------------------ |
164 | void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType, dword mainAreaColour, EDI) |
171 | void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType, dword mainAreaColour, EDI) |
165 | { |
172 | { |
166 | EAX = 12; // function 12:tell os about windowdraw |
173 | EAX = 12; // function 12:tell os about windowdraw |
167 | EBX = 1; |
174 | EBX = 1; |
168 | $int 0x40 |
175 | $int 0x40 |
169 | 176 | ||
170 | EBX = x << 16 + sizeX; |
177 | EBX = x << 16 + sizeX; |
171 | ECX = y << 16 + sizeY; |
178 | ECX = y << 16 + sizeY; |
172 | EDX = mainAreaType << 24 | mainAreaColour; |
179 | EDX = mainAreaType << 24 | mainAreaColour; |
173 | $xor eax,eax |
180 | $xor eax,eax |
174 | $int 0x40 |
181 | $int 0x40 |
175 | 182 | ||
176 | EAX = 12; // function 12:tell os about windowdraw |
183 | EAX = 12; // function 12:tell os about windowdraw |
177 | EBX = 2; |
184 | EBX = 2; |
178 | $int 0x40 |
185 | $int 0x40 |
179 | } |
186 | } |
180 | 187 | ||
181 | inline fastcall void CreateThread( ECX,EDX) |
188 | inline fastcall void CreateThread( ECX,EDX) |
182 | { |
189 | { |
183 | EAX = 51; |
190 | EAX = 51; |
184 | EBX = 1; |
191 | EBX = 1; |
185 | $int 0x40 |
192 | $int 0x40 |
186 | } |
193 | } |
187 | 194 | ||
188 | inline fastcall void DrawTitle( ECX){ |
195 | inline fastcall void DrawTitle( ECX){ |
189 | EAX = 71; |
196 | EAX = 71; |
190 | EBX = 1; |
197 | EBX = 1; |
191 | $int 0x40; |
198 | $int 0x40; |
192 | } |
199 | } |
193 | 200 | ||
194 | inline fastcall dword GetSkinHeight() |
201 | inline fastcall dword GetSkinHeight() |
195 | { |
202 | { |
196 | $push ebx |
203 | $push ebx |
197 | $mov eax,48 |
204 | $mov eax,48 |
198 | $mov ebx,4 |
205 | $mov ebx,4 |
199 | $int 0x40 |
206 | $int 0x40 |
200 | $pop ebx |
207 | $pop ebx |
201 | } |
208 | } |
202 | 209 | ||
203 | inline fastcall dword GetScreenHeight() |
210 | inline fastcall dword GetScreenHeight() |
204 | { |
211 | { |
205 | EAX = 14; |
212 | EAX = 14; |
206 | $int 0x40 |
213 | $int 0x40 |
207 | $and eax,0x0000FFFF |
214 | $and eax,0x0000FFFF |
208 | } |
215 | } |
- | 216 | ||
- | 217 | inline fastcall dword GetScreenWidth() |
|
- | 218 | { |
|
- | 219 | $mov eax, 14 |
|
- | 220 | $int 0x40 |
|
- | 221 | $shr eax, 16 |
|
- | 222 | } |
|
209 | 223 | ||
210 | inline fastcall void MoveSize( EBX,ECX,EDX,ESI){ |
224 | inline fastcall void MoveSize( EBX,ECX,EDX,ESI){ |
211 | $mov eax,67; |
225 | $mov eax,67; |
212 | $int 0x40 |
226 | $int 0x40 |
213 | } |
227 | } |
214 | 228 | ||
215 | //------------------------------------------------------------------------------ |
229 | //------------------------------------------------------------------------------ |
216 | inline fastcall void PutPixel( EBX,ECX,EDX) |
230 | inline fastcall void PutPixel( EBX,ECX,EDX) |
217 | { |
231 | { |
218 | EAX=1; |
232 | EAX=1; |
219 | $int 0x40 |
233 | $int 0x40 |
220 | } |
234 | } |
221 | 235 | ||
222 | void DefineButton(dword x,y,w,h,EDX,ESI) |
236 | void DefineButton(dword x,y,w,h,EDX,ESI) |
223 | { |
237 | { |
224 | EAX = 8; |
238 | EAX = 8; |
225 | $push edx |
239 | $push edx |
226 | EDX += BT_DEL; //âíà÷àëå óäàëÿåì êíîïó ñ ýòè èä, ïîòîì ñîçäà¸ì |
240 | EDX += BT_DEL; //âíà÷àëå óäàëÿåì êíîïó ñ ýòè èä, ïîòîì ñîçäà¸ì |
227 | $int 0x40; |
241 | $int 0x40; |
228 | EBX = x<<16+w; |
242 | EBX = x<<16+w; |
229 | ECX = y<<16+h; |
243 | ECX = y<<16+h; |
230 | $pop edx |
244 | $pop edx |
231 | $int 0x40 |
245 | $int 0x40 |
232 | } |
246 | } |
233 | 247 | ||
234 | inline fastcall void DeleteButton( EDX) |
248 | inline fastcall void DeleteButton( EDX) |
235 | { |
249 | { |
236 | EAX = 8; |
250 | EAX = 8; |
237 | EDX += BT_DEL; |
251 | EDX += BT_DEL; |
238 | $int 0x40; |
252 | $int 0x40; |
239 | } |
253 | } |
240 | 254 | ||
241 | void WriteText(dword x,y,byte fontType, dword color, EDX, ESI) |
255 | void WriteText(dword x,y,byte fontType, dword color, EDX, ESI) |
242 | { |
256 | { |
243 | EAX = 4; |
257 | EAX = 4; |
244 | EBX = x<<16+y; |
258 | EBX = x<<16+y; |
245 | ECX = fontType<<24+color; |
259 | ECX = fontType<<24+color; |
246 | $int 0x40; |
260 | $int 0x40; |
247 | } |
261 | } |
248 | 262 | ||
249 | void DrawBar(dword x,y,w,h,EDX) |
263 | void DrawBar(dword x,y,w,h,EDX) |
250 | { |
264 | { |
251 | EAX = 13; |
265 | EAX = 13; |
252 | EBX = x<<16+w; |
266 | EBX = x<<16+w; |
253 | ECX = y<<16+h; |
267 | ECX = y<<16+h; |
254 | $int 0x40 |
268 | $int 0x40 |
255 | } |
269 | } |
256 | 270 | ||
257 | void DrawRegion_3D(dword x,y,width,height,color1,color2) |
271 | void DrawRegion_3D(dword x,y,width,height,color1,color2) |
258 | { |
272 | { |
259 | DrawBar(x,y,width+1,1,color1); |
273 | DrawBar(x,y,width+1,1,color1); |
260 | DrawBar(x,y+1,1,height-1,color1); |
274 | DrawBar(x,y+1,1,height-1,color1); |
261 | DrawBar(x+width,y+1,1,height,color2); |
275 | DrawBar(x+width,y+1,1,height,color2); |
262 | DrawBar(x,y+height,width,1,color2); |
276 | DrawBar(x,y+height,width,1,color2); |
263 | } |
277 | } |
264 | 278 | ||
265 | void DrawFlatButton(dword x,y,width,height,id,color,text) |
279 | void DrawFlatButton(dword x,y,width,height,id,color,text) |
266 | { |
280 | { |
267 | DrawRegion_3D(x,y,width,height,0x94AECE,0x94AECE); |
281 | DrawRegion_3D(x,y,width,height,0x94AECE,0x94AECE); |
268 | DrawRegion_3D(x+1,y+1,width-2,height-2,0xFFFFFF,0xC7C7C7); |
282 | DrawRegion_3D(x+1,y+1,width-2,height-2,0xFFFFFF,0xC7C7C7); |
269 | DrawBar(x+2,y+2,width-3,height-3,color); |
283 | DrawBar(x+2,y+2,width-3,height-3,color); |
270 | IF (id<>0) DefineButton(x+1,y+1,width-2,height-2,id+BT_HIDE,0xEFEBEF); |
284 | IF (id<>0) DefineButton(x+1,y+1,width-2,height-2,id+BT_HIDE,0xEFEBEF); |
271 | WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,0,text,0); |
285 | WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,0,text,0); |
272 | } |
286 | } |
273 | 287 | ||
274 | void PutPaletteImage(dword EBX,w,h,x,y, EDI) |
288 | void PutPaletteImage(dword EBX,w,h,x,y, EDI) |
275 | { |
289 | { |
276 | EAX = 65; |
290 | EAX = 65; |
277 | ECX = w<<16+h; |
291 | ECX = w<<16+h; |
278 | EDX = x<<16+y; |
292 | EDX = x<<16+y; |
279 | ESI = 8; |
293 | ESI = 8; |
280 | EBP = 0; |
294 | EBP = 0; |
281 | $int 0x40 |
295 | $int 0x40 |
282 | } |
296 | } |
283 | 297 | ||
284 | void PutImage(dword EBX,w,h,x,y) |
298 | void PutImage(dword EBX,w,h,x,y) |
285 | { |
299 | { |
286 | EAX = 7; |
300 | EAX = 7; |
287 | ECX = w<<16+h; |
301 | ECX = w<<16+h; |
288 | EDX = x<<16+y; |
302 | EDX = x<<16+y; |
289 | $int 0x40 |
303 | $int 0x40 |
290 | } |
304 | } |
291 | 305 | ||
292 | //------------------------------------------------------------------------------ |
306 | //------------------------------------------------------------------------------ |
293 | inline fastcall void debug( EDX) |
307 | inline fastcall void debug( EDX) |
294 | { |
308 | { |
295 | $mov eax, 63 |
309 | $mov eax, 63 |
296 | $mov ebx, 1 |
310 | $mov ebx, 1 |
297 | next_char: |
311 | NEXT_CHAR: |
298 | $mov ecx, DSDWORD[edx] |
312 | $mov ecx, DSDWORD[edx] |
299 | $or cl, cl |
313 | $or cl, cl |
300 | $jz done |
314 | $jz DONE |
301 | $int 0x40 |
315 | $int 0x40 |
302 | $inc edx |
316 | $inc edx |
303 | $jmp next_char |
317 | $jmp NEXT_CHAR |
304 | done: |
318 | DONE: |
305 | $mov cl, 13 |
319 | $mov cl, 13 |
306 | $int 0x40 |
320 | $int 0x40 |
307 | $mov cl, 10 |
321 | $mov cl, 10 |
308 | $int 0x40 |
322 | $int 0x40 |
309 | }16+y; |
323 | }16+y; |
310 | ><16+y; |
324 | ><16+y; |
311 | >16+h; |
325 | >16+h; |
312 | ><16+h; |
326 | ><16+h; |
313 | >16+y; |
327 | >16+y; |
314 | ><16+y; |
328 | ><16+y; |
315 | >16+h; |
329 | >16+h; |
316 | ><16+h; |
330 | ><16+h; |
317 | >>16+h; |
331 | >>16+h; |
318 | ><16+h; |
332 | ><16+h; |
319 | >16+w; |
333 | >16+w; |
320 | ><16+w; |
334 | ><16+w; |
321 | >24+color; |
335 | >24+color; |
322 | ><24+color; |
336 | ><24+color; |
323 | >16+y; |
337 | >16+y; |
324 | ><16+y; |
338 | ><16+y; |
325 | >16+h; |
339 | >16+h; |
326 | ><16+h; |
340 | ><16+h; |
327 | >16+w; |
341 | >16+w; |
328 | ><16+w; |
342 | ><16+w; |
329 | >><>><>><> |
343 | >><>><>><> |