Rev 935 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
903 | leency | 1 | //CODED by Veliant, Leency. 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; // 0x0007fff0; |
||
12 | dword I_Param = #param; |
||
13 | dword I_Icon = 0x0; |
||
935 | leency | 14 | dword skin_width; |
903 | leency | 15 | char param[256]=""; |
16 | |||
17 | //Events |
||
935 | leency | 18 | #define evMouse 6 |
903 | leency | 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 | |||
34 | int vert; |
||
35 | struct mouse{ |
||
937 | leency | 36 | int x,y,lkm,pkm; |
903 | 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; |
||
937 | leency | 49 | y = EBX-skin_width; |
903 | leency | 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 BDVK{ |
||
71 | dword attr; |
||
72 | byte type_name; |
||
73 | byte rez1, rez2, rez3; |
||
74 | dword timecreate; |
||
75 | dword datecreate; |
||
76 | dword timelastaccess; |
||
77 | dword datelastaccess; |
||
78 | dword timelastedit; |
||
79 | dword datelastedit; |
||
80 | dword sizelo; |
||
81 | dword sizehi; |
||
82 | char name[518]; |
||
83 | }; |
||
84 | //--------------------------------------------------------------------------- |
||
85 | struct proc_info{ |
||
86 | dword use_cpu; |
||
87 | word pos_in_stack,num_slot,rezerv1; |
||
88 | char name[11]; |
||
89 | char rezerv2; |
||
90 | dword adress,use_memory,ID,left,top,width,height; |
||
91 | word status_slot,rezerv3; |
||
92 | dword work_left,work_top,work_width,work_height; |
||
93 | char status_window; |
||
937 | leency | 94 | void GetInfo(dword ECX); |
95 | #define SelfInfo -1 |
||
903 | leency | 96 | }; |
97 | |||
937 | leency | 98 | void proc_info::GetInfo(dword ECX) |
903 | leency | 99 | { |
100 | EAX = 9; |
||
101 | EBX = #use_cpu; |
||
937 | leency | 102 | $int 0x40 |
903 | leency | 103 | } |
104 | //------------------------------------------------------------------------------- |
||
105 | |||
106 | inline fastcall dword WaitEvent(){ |
||
107 | EAX = 10; // wait here for event |
||
108 | $int 0x40 |
||
109 | } |
||
110 | |||
937 | leency | 111 | /*inline fastcall void SetEventMask(dword EBX) |
112 | { |
||
113 | EAX = 40; |
||
114 | $int 0x40 |
||
115 | } */ |
||
903 | leency | 116 | |
117 | inline fastcall word GetKey(){ |
||
118 | EAX = 2; // just read this key from buffer |
||
119 | $int 0x40 |
||
120 | EAX = EAX >> 8; |
||
121 | } |
||
122 | |||
123 | inline fastcall word GetButtonID(){ |
||
124 | EAX = 17; // Get ID |
||
125 | $int 0x40 |
||
126 | EAX = EAX >> 8; |
||
127 | } |
||
128 | |||
935 | leency | 129 | inline fastcall void ExitProcess(){ |
130 | EAX = -1; // close this program |
||
131 | $int 0x40 |
||
132 | } |
||
903 | leency | 133 | |
937 | leency | 134 | void Pause(dword EBX){ |
135 | $mov eax, 5 //Пауза, в сотых долях секунды |
||
935 | leency | 136 | $int 0x40 |
937 | leency | 137 | } |
935 | leency | 138 | |
139 | //------------------------------------------------------------------------------ |
||
140 | void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword |
||
141 | mainAreaColor,byte headerType,dword headerColor,EDI) |
||
903 | leency | 142 | { |
935 | leency | 143 | EBX = x << 16 + sizeX; |
144 | ECX = y << 16 + sizeY; |
||
145 | EDX = mainAreaType << 24 | mainAreaColor; |
||
146 | ESI = headerType << 24 | headerColor; |
||
147 | $xor eax,eax |
||
148 | $int 0x40 |
||
149 | } |
||
150 | |||
151 | inline fastcall void DrawTitle(dword ECX){ |
||
903 | leency | 152 | EAX = 71; |
153 | EBX = 1; |
||
154 | $int 0x40; |
||
155 | } |
||
156 | |||
935 | leency | 157 | |
158 | inline fastcall void WindowRedrawStatus(dword EBX){ |
||
159 | EAX = 12; //tell os about windowdraw |
||
160 | $int 0x40 |
||
161 | } |
||
162 | |||
163 | inline fastcall dword GetSkinWidth(){ |
||
903 | leency | 164 | EAX = 48; |
165 | EBX = 4; |
||
166 | $int 0x40 |
||
167 | } |
||
168 | |||
935 | leency | 169 | inline fastcall dword MoveSize(dword EBX,ECX,EDX,ESI){ |
170 | EAX = 67; |
||
171 | $int 0x40 |
||
903 | leency | 172 | } |
173 | |||
935 | leency | 174 | //------------------------------------------------------------------------------ |
903 | leency | 175 | |
935 | leency | 176 | inline fastcall dword strlen(dword EDI){ |
903 | leency | 177 | ECX=EAX=0; |
178 | ECX--; |
||
179 | $REPNE $SCASB |
||
935 | leency | 180 | EAX-=2+ECX; |
903 | leency | 181 | } |
182 | |||
183 | |||
935 | leency | 184 | inline fastcall copystr(dword ESI,EDI) |
185 | { |
||
186 | $cld |
||
187 | l1: |
||
188 | $lodsb |
||
189 | $stosb |
||
190 | $test al,al |
||
191 | $jnz l1 |
||
192 | } |
||
193 | |||
194 | |||
195 | char buffer[11]=""; |
||
196 | inline fastcall dword IntToStr(dword ESI) |
||
197 | { |
||
198 | $mov edi, #buffer |
||
199 | $mov ecx, 10 |
||
200 | $test esi, esi |
||
201 | $jns f1 |
||
202 | $mov al, '-' |
||
203 | $stosb |
||
204 | $neg esi |
||
205 | f1: |
||
206 | $mov eax, esi |
||
207 | $push -'0' |
||
208 | f2: |
||
209 | $xor edx, edx |
||
210 | $div ecx |
||
211 | $push edx |
||
212 | $test eax, eax |
||
213 | $jnz f2 |
||
214 | f3: |
||
215 | $pop eax |
||
216 | $add al, '0' |
||
217 | $stosb |
||
218 | $jnz f3 |
||
219 | $mov eax, #buffer |
||
220 | $ret |
||
221 | } |
||
222 | |||
223 | |||
903 | leency | 224 | inline fastcall int strcmp(dword EAX,EBX) |
225 | { |
||
935 | leency | 226 | #speed |
903 | leency | 227 | ESI=EAX; |
228 | EBX--; |
||
229 | TOP: |
||
230 | EBX++; |
||
231 | $LODSB |
||
232 | $CMP AL,0 |
||
233 | $JE HERE |
||
234 | $CMP DSBYTE[EBX],AL |
||
235 | $JE TOP |
||
236 | HERE: |
||
237 | AL-=DSBYTE[EBX]; |
||
238 | return AL; |
||
935 | leency | 239 | #codesize |
903 | leency | 240 | } |
241 | |||
242 | |||
243 | inline fastcall dword ChangeCase(dword EDX) |
||
244 | { |
||
935 | leency | 245 | #speed |
903 | leency | 246 | AL=DSBYTE[EDX]; |
247 | IF(AL>='a')&&(AL<='z')DSBYTE[EDX]=AL&0x5f; |
||
248 | EDX++; |
||
249 | do{ |
||
250 | AL=DSBYTE[EDX]; |
||
251 | IF(AL>='A')&&(AL<='Z')DSBYTE[EDX]=AL|0x20; |
||
252 | EDX++; |
||
253 | }while(AL!=0); |
||
935 | leency | 254 | #codesize |
903 | leency | 255 | } |
256 | |||
935 | leency | 257 | //------------------------------------------------------------------------------ |
258 | inline fastcall void PutPixel(dword EBX,ECX,EDX){ |
||
259 | EAX=1; |
||
260 | ECX+=skin_width; |
||
261 | $int 0x40 |
||
903 | leency | 262 | } |
263 | |||
935 | leency | 264 | void DefineButton(dword x,y,w,h,EDX,ESI){ |
265 | EAX = 8; |
||
266 | EBX = x<<16+w; |
||
267 | ECX = skin_width+y<<16+h; |
||
903 | leency | 268 | $int 0x40 |
269 | } |
||
270 | |||
935 | leency | 271 | inline fastcall void DeleteButton(dword EDX) |
903 | leency | 272 | { |
273 | EAX = 8; |
||
935 | leency | 274 | EDX += BT_DEL; |
275 | $int 0x40; |
||
903 | leency | 276 | } |
277 | |||
278 | void WriteText(dword x,y,byte fontType, dword color, EDX, ESI) |
||
279 | { |
||
280 | EAX = 4; |
||
281 | EBX = x<<16+skin_width+y; |
||
282 | ECX = fontType<<24+color; |
||
283 | $int 0x40; |
||
284 | } |
||
285 | |||
286 | void DrawBar(dword x,y,w,h,EDX) |
||
287 | { |
||
935 | leency | 288 | #speed |
903 | leency | 289 | EAX = 13; |
290 | EBX = x<<16+w; |
||
291 | ECX = skin_width+y<<16+h; |
||
292 | $int 0x40 |
||
935 | leency | 293 | #codesize |
903 | leency | 294 | } |
295 | |||
296 | void DrawRegion(dword x,y,width,height,color1) |
||
297 | { |
||
298 | DrawBar(x,y,width,1,color1); //полоса гор сверху |
||
299 | DrawBar(x,y+height,width,1,color1); //полоса гор снизу |
||
300 | DrawBar(x,y,1,height,color1); //полоса верху слева |
||
301 | DrawBar(x+width,y,1,height+1,color1); //полоса верху справа |
||
302 | } |
||
303 | |||
304 | void DrawFlatButton(dword x,y,width,height,id,color,text) |
||
305 | { |
||
306 | DrawRegion(x,y,width,height,0x94AECE); |
||
307 | DrawBar(x+1,y+1,width-1,1,0xFFFFFF); //полоса гор белая |
||
308 | DrawBar(x+1,y+height-1,width-2,1,0xC7C7C7); //венм верв |
||
309 | DrawBar(x+1,y+1,1,height-1,0xFFFFFF); //полоса верв белап |
||
310 | DrawBar(x+width-1,y+2,1,height-2,0xC7C7C7); //венм верв |
||
311 | DrawBar(x+2,y+2,width-3,height-3,color); //заливка |
||
935 | leency | 312 | IF (id<>0) DefineButton(x,y,width,height,id+BT_HIDE,0xEFEBEF); //кнопка |
903 | leency | 313 | WriteText(-strlen(text)*6+width/2+x+1,height/2-3+y,0x80,0,text,0); |
314 | } |
||
315 | |||
316 | void PutImage(dword EBX,w,h,x,y) |
||
317 | { |
||
318 | EAX = 7; |
||
319 | ECX = w<<16+h; |
||
320 | EDX = x<<16+y+skin_width; |
||
321 | $int 0x40 |
||
322 | } |
||
323 | |||
935 | leency | 324 | void PutPaletteImage(dword EBX,w,h,x,y, EDI) |
903 | leency | 325 | { |
935 | leency | 326 | EAX = 65; |
327 | ECX = w<<16+h; |
||
328 | EDX = x<<16+y+skin_width; |
||
329 | ESI = 8; |
||
330 | EBP = 0; |
||
903 | leency | 331 | $int 0x40 |
935 | leency | 332 | }16+y+skin_width; |
903 | leency | 333 |