Rev 6662 | Rev 6738 | Go to most recent revision | Only display areas with differences | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6662 | Rev 6735 | ||
---|---|---|---|
1 | //CODED by Veliant, Leency, Nable, Pavelyakov. GNU GPL licence. |
1 | //CODED by Veliant, Leency, Nable, Pavelyakov. GNU GPL licence. |
2 | 2 | ||
3 | #ifndef INCLUDE_KOLIBRI_H |
3 | #ifndef INCLUDE_KOLIBRI_H |
4 | #define INCLUDE_KOLIBRI_H |
4 | #define INCLUDE_KOLIBRI_H |
5 | #print "[include |
5 | #print "[include |
6 | 6 | ||
7 | #pragma option OST |
7 | #pragma option OST |
8 | #pragma option ON |
8 | #pragma option ON |
9 | #pragma option cri- |
9 | #pragma option cri- |
10 | #pragma option -CPA |
10 | #pragma option -CPA |
11 | #initallvar 0 |
11 | #initallvar 0 |
12 | #jumptomain FALSE |
12 | #jumptomain FALSE |
13 | 13 | ||
14 | #startaddress 0 |
14 | #startaddress 0 |
15 | 15 | ||
16 | #code32 TRUE |
16 | #code32 TRUE |
17 | 17 | ||
18 | char os_name[8] = {'M','E','N','U','E','T','0','1'}; |
18 | char os_name[8] = {'M','E','N','U','E','T','0','1'}; |
19 | dword os_version = 0x00000001; |
19 | dword os_version = 0x00000001; |
20 | dword start_addr = #______INIT______; |
20 | dword start_addr = #______INIT______; |
21 | dword final_addr = #______STOP______+32; |
21 | dword final_addr = #______STOP______+32; |
22 | dword alloc_mem = MEMSIZE; |
22 | dword alloc_mem = MEMSIZE; |
23 | dword x86esp_reg = MEMSIZE; |
23 | dword x86esp_reg = MEMSIZE; |
24 | dword I_Param = #param; |
24 | dword I_Param = #param; |
25 | dword I_Path = #program_path; |
25 | dword I_Path = #program_path; |
26 | char param[4096]; |
26 | char param[4096]; |
27 | char program_path[4096]; |
27 | char program_path[4096]; |
28 | 28 | ||
29 | #define bool int |
29 | #define bool int |
30 | 30 | ||
31 | #define NULL 0 |
31 | #define NULL 0 |
32 | #define OLD -1 |
32 | #define OLD -1 |
33 | #define true 1 |
33 | #define true 1 |
34 | #define false 0 |
34 | #define false 0 |
35 | 35 | ||
36 | //Process Events |
36 | //Process Events |
37 | #define evReDraw 1 |
37 | #define evReDraw 1 |
38 | #define evKey 2 |
38 | #define evKey 2 |
39 | #define evButton 3 |
39 | #define evButton 3 |
40 | #define evDesktop 5 |
40 | #define evDesktop 5 |
41 | #define evMouse 6 |
41 | #define evMouse 6 |
42 | #define evIPC 7 |
42 | #define evIPC 7 |
43 | #define evNetwork 8 |
43 | #define evNetwork 8 |
44 | #define evDebug 9 |
44 | #define evDebug 9 |
45 | 45 | ||
46 | //Button options |
46 | //Button options |
47 | #define BT_DEL 0x80000000 |
47 | #define BT_DEL 0x80000000 |
48 | #define BT_HIDE 0x40000000 |
48 | #define BT_HIDE 0x40000000 |
49 | #define BT_NOFRAME 0x20000000 |
49 | #define BT_NOFRAME 0x20000000 |
50 | 50 | ||
51 | //allow event mask |
51 | //allow event mask |
52 | #define EVENT_MASK_REDRAW 000000001b |
52 | #define EVENT_MASK_REDRAW 000000001b |
53 | #define EVENT_MASK_KEYBOARD 000000010b |
53 | #define EVENT_MASK_KEYBOARD 000000010b |
54 | #define EVENT_MASK_BUTTONS 000000100b |
54 | #define EVENT_MASK_BUTTONS 000000100b |
55 | #define EVENT_MASK_DESKTOP 000010000b |
55 | #define EVENT_MASK_DESKTOP 000010000b |
56 | #define EVENT_MASK_MOUSE 000100000b |
56 | #define EVENT_MASK_MOUSE 000100000b |
57 | #define EVENT_MASK_IPC 001000000b |
57 | #define EVENT_MASK_IPC 001000000b |
58 | #define EVENT_MASK_NETWORK 010000000b |
58 | #define EVENT_MASK_NETWORK 010000000b |
59 | #define EVENT_MASK_DEBUG 100000000b |
59 | #define EVENT_MASK_DEBUG 100000000b |
60 | 60 | ||
61 | //ARGS FUNCTION |
61 | //ARGS FUNCTION |
62 | #define END_ARGS 0xFF00FF |
62 | #define END_ARGS 0xFF00FF |
63 | //------------------------------------------------------------------------- |
63 | //------------------------------------------------------------------------- |
64 | 64 | ||
65 | #include "../lib/system.h" |
65 | #include "../lib/system.h" |
66 | #include "../lib/mouse.h" |
66 | #include "../lib/mouse.h" |
67 | #include "../lib/keyboard.h" |
67 | #include "../lib/keyboard.h" |
68 | 68 | ||
69 | :struct raw_image { |
69 | :struct raw_image { |
70 | dword w, h, data; |
70 | dword w, h, data; |
71 | }; |
71 | }; |
72 | 72 | ||
73 | //------------------------------------------------------------------------------ |
73 | //------------------------------------------------------------------------------ |
74 | :dword wait_event_code; |
74 | :dword wait_event_code; |
75 | inline fastcall dword WaitEvent() |
75 | inline fastcall dword WaitEvent() |
76 | { |
76 | { |
77 | $mov eax,10 |
77 | $mov eax,10 |
78 | $int 0x40 |
78 | $int 0x40 |
79 | wait_event_code = EAX; |
79 | wait_event_code = EAX; |
80 | //if(wait_event_code==evMouse) MOUSE.get(); |
80 | //if(wait_event_code==evMouse) MOUSE.get(); |
81 | //return wait_event_code; |
81 | //return wait_event_code; |
82 | } |
82 | } |
83 | 83 | ||
84 | inline fastcall dword CheckEvent() |
84 | inline fastcall dword CheckEvent() |
85 | { |
85 | { |
86 | $mov eax,11 |
86 | $mov eax,11 |
87 | $int 0x40 |
87 | $int 0x40 |
88 | } |
88 | } |
89 | 89 | ||
90 | inline fastcall dword WaitEventTimeout(EBX) |
90 | inline fastcall dword WaitEventTimeout(EBX) |
91 | { |
91 | { |
92 | $mov eax,23 |
92 | $mov eax,23 |
93 | $int 0x40 |
93 | $int 0x40 |
94 | } |
94 | } |
95 | 95 | ||
96 | inline fastcall SetEventMask(EBX) |
96 | inline fastcall SetEventMask(EBX) |
97 | { |
97 | { |
98 | $mov eax,40 |
98 | $mov eax,40 |
99 | $int 0x40 |
99 | $int 0x40 |
100 | } |
100 | } |
101 | 101 | ||
102 | 102 | ||
103 | inline fastcall pause(EBX) |
103 | inline fastcall pause(EBX) |
104 | { |
104 | { |
105 | $mov eax, 5 |
105 | $mov eax, 5 |
106 | $int 0x40 |
106 | $int 0x40 |
107 | } |
107 | } |
108 | 108 | ||
109 | inline fastcall word GetButtonID() |
109 | inline fastcall word GetButtonID() |
110 | { |
110 | { |
111 | $mov eax,17 |
111 | $mov eax,17 |
112 | $int 0x40 |
112 | $int 0x40 |
113 | $shr eax,8 |
113 | $shr eax,8 |
114 | } |
114 | } |
115 | 115 | ||
116 | inline fastcall dword GetFreeRAM() |
116 | inline fastcall dword GetFreeRAM() |
117 | { |
117 | { |
118 | $mov eax, 18 |
118 | $mov eax, 18 |
119 | $mov ebx, 16 |
119 | $mov ebx, 16 |
120 | $int 0x40 |
120 | $int 0x40 |
121 | //return eax = ðàçìåð ñâîáîäíîé ïàìÿòè â êèëîáàéòàõ |
121 | //return eax = ðàçìåð ñâîáîäíîé ïàìÿòè â êèëîáàéòàõ |
122 | } |
122 | } |
123 | 123 | ||
124 | inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà |
124 | inline fastcall dword LoadDriver(ECX) //ECX - èìÿ äðàéâåðà |
125 | { |
125 | { |
126 | $mov eax, 68 |
126 | $mov eax, 68 |
127 | $mov ebx, 16 |
127 | $mov ebx, 16 |
128 | $int 0x40 |
128 | $int 0x40 |
129 | //return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà |
129 | //return 0 - íåóäà÷à, èíà÷å eax = õýíäë äðàéâåðà |
130 | } |
130 | } |
131 | 131 | ||
132 | inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó |
132 | inline fastcall dword RuleDriver(ECX) //óêàçàòåëü íà óïðàâëÿþùóþ ñòðóêòóðó |
133 | { |
133 | { |
134 | $mov eax, 68 |
134 | $mov eax, 68 |
135 | $mov ebx, 17 |
135 | $mov ebx, 17 |
136 | $int 0x40 |
136 | $int 0x40 |
137 | //return eax = îïðåäåëÿåòñÿ äðàéâåðîì |
137 | //return eax = îïðåäåëÿåòñÿ äðàéâåðîì |
138 | } |
138 | } |
139 | 139 | ||
140 | struct proc_info |
140 | struct proc_info |
141 | { |
141 | { |
142 | #define SelfInfo -1 |
142 | #define SelfInfo -1 |
143 | dword use_cpu; |
143 | dword use_cpu; |
144 | word pos_in_stack,num_slot,rezerv1; |
144 | word pos_in_stack,num_slot,rezerv1; |
145 | unsigned char name[11]; |
145 | unsigned char name[11]; |
146 | char rezerv2; |
146 | char rezerv2; |
147 | dword adress,use_memory,ID,left,top,width,height; |
147 | dword adress,use_memory,ID,left,top,width,height; |
148 | word status_slot,rezerv3; |
148 | word status_slot,rezerv3; |
149 | dword work_left,work_top,work_width,work_height; |
149 | dword work_left,work_top,work_width,work_height; |
150 | char status_window; |
150 | char status_window; |
151 | dword cwidth,cheight; |
151 | dword cwidth,cheight; |
152 | byte reserved[1024-71-8]; |
152 | byte reserved[1024-71-8]; |
153 | }; |
153 | }; |
154 | 154 | ||
155 | inline fastcall void GetProcessInfo(EBX, ECX) |
155 | inline fastcall void GetProcessInfo(EBX, ECX) |
156 | { |
156 | { |
157 | $mov eax,9; |
157 | $mov eax,9; |
158 | $int 0x40 |
158 | $int 0x40 |
159 | DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth |
159 | DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth |
160 | DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight |
160 | DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight |
161 | } |
161 | } |
162 | 162 | ||
163 | inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y |
163 | inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y |
164 | { |
164 | { |
165 | $mov eax,34 |
165 | $mov eax,34 |
166 | $int 0x40 |
166 | $int 0x40 |
167 | } |
167 | } |
168 | 168 | ||
169 | inline fastcall int GetProcessSlot( ECX) |
169 | inline fastcall int GetProcessSlot( ECX) |
170 | { |
170 | { |
171 | EAX = 18; |
171 | EAX = 18; |
172 | EBX = 21; |
172 | EBX = 21; |
173 | $int 0x40 |
173 | $int 0x40 |
174 | } |
174 | } |
175 | 175 | ||
176 | inline fastcall int GetActiveProcess() |
176 | inline fastcall int GetActiveProcess() |
177 | { |
177 | { |
178 | EAX = 18; |
178 | EAX = 18; |
179 | EBX = 7; |
179 | EBX = 7; |
180 | $int 0x40 |
180 | $int 0x40 |
181 | } |
181 | } |
182 | 182 | ||
183 | :int CheckActiveProcess(int Form_ID) |
183 | :int CheckActiveProcess(int Form_ID) |
184 | { |
184 | { |
185 | int id9=GetProcessSlot(Form_ID); |
185 | int id9=GetProcessSlot(Form_ID); |
186 | if (id9==GetActiveProcess()) return 1; |
186 | if (id9==GetActiveProcess()) return 1; |
187 | return 0; |
187 | return 0; |
188 | } |
188 | } |
189 | 189 | ||
190 | inline fastcall void ActivateWindow( ECX) |
190 | inline fastcall void ActivateWindow( ECX) |
191 | { |
191 | { |
192 | EAX = 18; |
192 | EAX = 18; |
193 | EBX = 3; |
193 | EBX = 3; |
194 | $int 0x40 |
194 | $int 0x40 |
195 | } |
195 | } |
196 | 196 | ||
197 | inline fastcall int MinimizeWindow() |
197 | inline fastcall int MinimizeWindow() |
198 | { |
198 | { |
199 | EAX = 18; |
199 | EAX = 18; |
200 | EBX = 10; |
200 | EBX = 10; |
201 | $int 0x40 |
201 | $int 0x40 |
202 | } |
202 | } |
203 | 203 | ||
204 | inline fastcall int CreateThread(ECX,EDX) |
204 | inline fastcall int CreateThread(ECX,EDX) |
205 | { |
205 | { |
206 | $mov eax,51 |
206 | $mov eax,51 |
207 | $mov ebx,1 |
207 | $mov ebx,1 |
208 | $int 0x40 |
208 | $int 0x40 |
209 | } |
209 | } |
210 | 210 | ||
211 | inline fastcall void SwitchToAnotherThread() |
211 | inline fastcall void SwitchToAnotherThread() |
212 | { |
212 | { |
213 | $mov eax,68 |
213 | $mov eax,68 |
214 | $mov ebx,1 |
214 | $mov ebx,1 |
215 | $int 0x40 |
215 | $int 0x40 |
216 | } |
216 | } |
217 | 217 | ||
218 | inline fastcall int SendWindowMessage( ECX, EDX) |
218 | inline fastcall int SendWindowMessage( ECX, EDX) |
219 | { |
219 | { |
220 | $mov eax, 72 |
220 | $mov eax, 72 |
221 | $mov ebx, 1 |
221 | $mov ebx, 1 |
222 | $int 0x40 |
222 | $int 0x40 |
223 | } |
223 | } |
224 | 224 | ||
225 | inline fastcall int KillProcess( ECX) |
225 | inline fastcall int KillProcess( ECX) |
226 | { |
226 | { |
227 | $mov eax,18; |
227 | $mov eax,18; |
228 | $mov ebx,18; |
228 | $mov ebx,18; |
229 | $int 0x40 |
229 | $int 0x40 |
230 | } |
230 | } |
231 | 231 | ||
232 | #define TURN_OFF 2 |
232 | #define TURN_OFF 2 |
233 | #define REBOOT 3 |
233 | #define REBOOT 3 |
234 | #define KERNEL 4 |
234 | #define KERNEL 4 |
235 | inline fastcall int ExitSystem( ECX) |
235 | inline fastcall int ExitSystem( ECX) |
236 | { |
236 | { |
237 | $mov eax, 18 |
237 | $mov eax, 18 |
238 | $mov ebx, 9 |
238 | $mov ebx, 9 |
239 | $int 0x40 |
239 | $int 0x40 |
240 | } |
240 | } |
241 | 241 | ||
242 | inline fastcall ExitProcess() |
242 | inline fastcall ExitProcess() |
243 | { |
243 | { |
244 | $mov eax,-1; |
244 | $mov eax,-1; |
245 | $int 0x40 |
245 | $int 0x40 |
246 | } |
246 | } |
247 | 247 | ||
248 | //------------------------------------------------------------------------------ |
248 | //------------------------------------------------------------------------------ |
249 | 249 | ||
250 | inline fastcall void SetCurDir( ECX) |
250 | inline fastcall void SetCurDir( ECX) |
251 | { |
251 | { |
252 | EAX=30; |
252 | EAX=30; |
253 | EBX=1; |
253 | EBX=1; |
254 | $int 0x40 |
254 | $int 0x40 |
255 | } |
255 | } |
256 | 256 | ||
257 | 257 | ||
258 | //eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus) |
258 | //eax = ÿçûê ñèñòåìû (1=eng, 2=fi, 3=ger, 4=rus) |
259 | #define SYS_LANG_ENG 1 |
259 | #define SYS_LANG_ENG 1 |
260 | #define SYS_LANG_FIN 2 |
260 | #define SYS_LANG_FIN 2 |
261 | #define SYS_LANG_GER 3 |
261 | #define SYS_LANG_GER 3 |
262 | #define SYS_LANG_RUS 4 |
262 | #define SYS_LANG_RUS 4 |
263 | inline fastcall int GetSystemLanguage() |
263 | inline fastcall int GetSystemLanguage() |
264 | { |
264 | { |
265 | EAX = 26; |
265 | EAX = 26; |
266 | EBX = 5; |
266 | EBX = 5; |
267 | $int 0x40 |
267 | $int 0x40 |
268 | } |
268 | } |
269 | 269 | ||
270 | inline fastcall GetSkinHeight() |
270 | inline fastcall GetSkinHeight() |
271 | { |
271 | { |
272 | $push ebx |
272 | $push ebx |
273 | $mov eax,48 |
273 | $mov eax,48 |
274 | $mov ebx,4 |
274 | $mov ebx,4 |
275 | $int 0x40 |
275 | $int 0x40 |
276 | $pop ebx |
276 | $pop ebx |
277 | } |
277 | } |
278 | 278 | ||
279 | inline fastcall void SetSystemSkin( ECX) |
279 | inline fastcall void SetSystemSkin( ECX) |
280 | { |
280 | { |
281 | EAX = 48; |
281 | EAX = 48; |
282 | EBX = 8; |
282 | EBX = 8; |
283 | $int 0x40 |
283 | $int 0x40 |
284 | } |
284 | } |
285 | 285 | ||
286 | inline fastcall int GetScreenWidth() |
286 | inline fastcall int GetScreenWidth() |
287 | { |
287 | { |
288 | $mov eax, 14 |
288 | $mov eax, 14 |
289 | $int 0x40 |
289 | $int 0x40 |
290 | $shr eax, 16 |
290 | $shr eax, 16 |
291 | } |
291 | } |
292 | 292 | ||
293 | inline fastcall int GetScreenHeight() |
293 | inline fastcall int GetScreenHeight() |
294 | { |
294 | { |
295 | $mov eax, 14 |
295 | $mov eax, 14 |
296 | $int 0x40 |
296 | $int 0x40 |
297 | $and eax,0x0000FFFF |
297 | $and eax,0x0000FFFF |
298 | } |
298 | } |
299 | 299 | ||
300 | inline fastcall int GetClientTop() |
300 | inline fastcall int GetClientTop() |
301 | { |
301 | { |
302 | $mov eax, 48 |
302 | $mov eax, 48 |
303 | $mov ebx, 5 |
303 | $mov ebx, 5 |
304 | $int 0x40 |
304 | $int 0x40 |
305 | $mov eax, ebx |
305 | $mov eax, ebx |
306 | $shr eax, 16 |
306 | $shr eax, 16 |
307 | } |
307 | } |
308 | 308 | ||
309 | inline fastcall int GetClientHeight() |
309 | inline fastcall int GetClientHeight() |
310 | { |
310 | { |
311 | $mov eax, 48 |
311 | $mov eax, 48 |
312 | $mov ebx, 5 |
312 | $mov ebx, 5 |
313 | $int 0x40 |
313 | $int 0x40 |
314 | $mov eax, ebx |
314 | $mov eax, ebx |
315 | } |
315 | } |
316 | 316 | ||
317 | inline fastcall dword LoadLibrary( ECX) |
317 | inline fastcall dword LoadLibrary( ECX) |
318 | { |
318 | { |
319 | $mov eax, 68 |
319 | $mov eax, 68 |
320 | $mov ebx, 19 |
320 | $mov ebx, 19 |
321 | $int 0x40 |
321 | $int 0x40 |
322 | } |
322 | } |
323 | 323 | ||
324 | inline fastcall int TestBit( EAX, CL) |
324 | inline fastcall int TestBit( EAX, CL) |
325 | { |
325 | { |
326 | $shr eax,cl |
326 | $shr eax,cl |
327 | $and eax,1 |
327 | $and eax,1 |
328 | } |
328 | } |
329 | 329 | ||
330 | //------------------------------------------------------------------------------ |
330 | //------------------------------------------------------------------------------ |
331 | 331 | ||
332 | void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword WindowAreaColor, EDI, ESI) |
332 | void DefineAndDrawWindow(dword x, y, size_w, size_h, byte WindowType,dword WindowAreaColor, EDI, ESI) |
333 | { |
333 | { |
334 | EAX = 12; // function 12:tell os about windowdraw |
334 | EAX = 12; // function 12:tell os about windowdraw |
335 | EBX = 1; |
335 | EBX = 1; |
336 | $int 0x40 |
336 | $int 0x40 |
337 | 337 | ||
338 | $xor EAX,EAX |
338 | $xor EAX,EAX |
339 | EBX = x << 16 + size_w; |
339 | EBX = x << 16 + size_w; |
340 | ECX = y << 16 + size_h; |
340 | ECX = y << 16 + size_h; |
341 | 341 | ||
342 | EDX = WindowType << 24 | WindowAreaColor; |
342 | EDX = WindowType << 24 | WindowAreaColor; |
343 | $int 0x40 |
343 | $int 0x40 |
344 | 344 | ||
345 | EAX = 12; // function 12:tell os about windowdraw |
345 | EAX = 12; // function 12:tell os about windowdraw |
346 | EBX = 2; |
346 | EBX = 2; |
347 | $int 0x40 |
347 | $int 0x40 |
348 | } |
348 | } |
349 | 349 | ||
350 | inline fastcall MoveSize( EBX,ECX,EDX,ESI) |
350 | inline fastcall MoveSize( EBX,ECX,EDX,ESI) |
351 | { |
351 | { |
352 | $mov eax, 67 |
352 | $mov eax, 67 |
353 | $int 0x40 |
353 | $int 0x40 |
354 | } |
354 | } |
355 | 355 | ||
356 | inline fastcall void DrawTitle( ECX) |
356 | inline fastcall void DrawTitle( ECX) |
357 | { |
357 | { |
358 | EAX = 71; |
358 | EAX = 71; |
359 | EBX = 1; |
359 | EBX = 1; |
360 | $int 0x40; |
360 | $int 0x40; |
361 | } |
361 | } |
362 | 362 | ||
363 | void WriteTextB(dword x,y,byte fontType, dword color, EDX) |
363 | :void WriteTextB(dword x,y,byte fontType, dword color, str_offset) |
364 | { |
364 | { |
365 | EAX = 4; |
365 | EAX = 4; |
366 | EBX = x<<16+y; |
366 | EBX = x<<16+y; |
367 | ECX = fontType<<24+color; |
367 | ECX = fontType<<24+color; |
- | 368 | EDX = str_offset; |
|
368 | ESI = 0; |
369 | ESI = 0; |
369 | $int 0x40; |
370 | $int 0x40; |
370 | $add ebx, 1<<16 |
371 | $add ebx, 1<<16 |
371 | $int 0x40 |
372 | $int 0x40 |
372 | } |
373 | } |
373 | 374 | ||
374 | void WriteText(dword x,y,byte fontType, dword color, EDX) |
375 | :void WriteText(dword x,y,byte fontType, dword color, str_offset) |
375 | { |
376 | { |
376 | EAX = 4; |
377 | EAX = 4; |
377 | EBX = x<<16+y; |
378 | EBX = x<<16+y; |
378 | ECX = fontType<<24+color; |
379 | ECX = fontType<<24+color; |
- | 380 | EDX = str_offset; |
|
379 | $int 0x40; |
381 | $int 0x40; |
380 | } |
382 | } |
381 | 383 | ||
382 | dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI) |
384 | dword WriteBufText(dword x,y,byte fontType, dword color, EDX, EDI) |
383 | { |
385 | { |
384 | EAX = 4; |
386 | EAX = 4; |
385 | EBX = x<<16+y; |
387 | EBX = x<<16+y; |
386 | ECX = fontType<<24+color; |
388 | ECX = fontType<<24+color; |
387 | $int 0x40; |
389 | $int 0x40; |
388 | } |
390 | } |
389 | 391 | ||
390 | void WriteNumber(dword x,y,byte fontType, dword color, count, ECX) |
392 | void WriteNumber(dword x,y,byte fontType, dword color, count, number_or_offset) |
391 | { |
393 | { |
392 | EAX = 47; |
394 | EAX = 47; |
393 | EBX = count<<16; |
395 | EBX = count<<16; |
- | 396 | ECX = number_or_offset; |
|
394 | EDX = x<<16+y; |
397 | EDX = x<<16+y; |
395 | ESI = fontType<<24+color; |
398 | ESI = fontType<<24+color; |
396 | $int 0x40; |
399 | $int 0x40; |
397 | } |
400 | } |
398 | 401 | ||
399 | void CopyScreen(dword EBX, x, y, w, h) |
402 | :void CopyScreen(dword dst_offset, x, y, w, h) |
400 | { |
403 | { |
- | 404 | EAX = 36; |
|
401 | EAX = 36; |
405 | EBX = dst_offset; |
402 | ECX = w << 16 + h; |
406 | ECX = w << 16 + h; |
403 | EDX = x << 16 + y; |
407 | EDX = x << 16 + y; |
404 | $int 0x40; |
408 | $int 0x40; |
405 | } |
409 | } |
406 | 410 | ||
407 | :dword GetPixelColor(dword x, x_size, y) |
411 | :dword GetPixelColor(dword x, x_size, y) |
408 | { |
412 | { |
409 | $mov eax, 35 |
413 | $mov eax, 35 |
410 | EBX= y*x_size+x; |
414 | EBX= y*x_size+x; |
411 | $int 0x40 |
415 | $int 0x40 |
412 | } |
416 | } |
413 | - | ||
414 | 417 | ||
415 | void _PutImage(dword x,y, w,h, EBX) |
418 | :void _PutImage(dword x,y, w,h, data_offset) |
416 | { |
419 | { |
- | 420 | EAX = 7; |
|
417 | EAX = 7; |
421 | EBX = data_offset; |
418 | ECX = w<<16+h; |
422 | ECX = w<<16+h; |
419 | EDX = x<<16+y; |
423 | EDX = x<<16+y; |
420 | $int 0x40 |
424 | $int 0x40 |
421 | } |
425 | } |
422 | 426 | ||
423 | void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI) |
427 | void PutPaletteImage(dword EBX,w,h,x,y,ESI,EDI) |
424 | { |
428 | { |
425 | EAX = 65; |
429 | EAX = 65; |
426 | ECX = w<<16+h; |
430 | ECX = w<<16+h; |
427 | EDX = x<<16+y; |
431 | EDX = x<<16+y; |
428 | EBP = 0; |
432 | EBP = 0; |
429 | $int 0x40 |
433 | $int 0x40 |
430 | } |
434 | } |
431 | 435 | ||
432 | inline fastcall void PutPixel( EBX,ECX,EDX) |
436 | inline fastcall void PutPixel( EBX,ECX,EDX) |
433 | { |
437 | { |
434 | EAX=1; |
438 | EAX=1; |
435 | $int 0x40 |
439 | $int 0x40 |
436 | } |
440 | } |
437 | 441 | ||
438 | void DrawBar(dword x,y,w,h,EDX) |
442 | void DrawBar(dword x,y,w,h,EDX) |
439 | { |
443 | { |
440 | if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :) |
444 | if (h<=0) || (h>60000) || (w<=0) || (w>60000) return; //bad boy :) |
441 | EAX = 13; |
445 | EAX = 13; |
442 | EBX = x<<16+w; |
446 | EBX = x<<16+w; |
443 | ECX = y<<16+h; |
447 | ECX = y<<16+h; |
444 | $int 0x40 |
448 | $int 0x40 |
445 | } |
449 | } |
446 | 450 | ||
447 | void DefineButton(dword x,y,w,h,EDX,ESI) |
451 | void DefineButton(dword x,y,w,h,EDX,ESI) |
448 | { |
452 | { |
449 | EAX = 8; |
453 | EAX = 8; |
450 | $push edx |
454 | $push edx |
451 | EDX += BT_DEL; |
455 | EDX += BT_DEL; |
452 | $int 0x40; |
456 | $int 0x40; |
453 | $pop edx |
457 | $pop edx |
454 | EBX = x<<16+w; |
458 | EBX = x<<16+w; |
455 | ECX = y<<16+h; |
459 | ECX = y<<16+h; |
456 | $int 0x40 |
460 | $int 0x40 |
457 | } |
461 | } |
458 | 462 | ||
459 | inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE) |
463 | inline RefreshWindow(dword ID_REFRESH,ID_ACTIVE) |
460 | { |
464 | { |
461 | EAX = 18; |
465 | EAX = 18; |
462 | EBX = 22; |
466 | EBX = 22; |
463 | ECX = 3; |
467 | ECX = 3; |
464 | EDX = ID_REFRESH; |
468 | EDX = ID_REFRESH; |
465 | $int 0x40 |
469 | $int 0x40 |
466 | EAX = 18; |
470 | EAX = 18; |
467 | EBX = 3; |
471 | EBX = 3; |
468 | EDX = ID_ACTIVE; |
472 | EDX = ID_ACTIVE; |
469 | $int 0x40 |
473 | $int 0x40 |
470 | } |
474 | } |
471 | 475 | ||
472 | void UnsafeDefineButton(dword x,y,w,h,EDX,ESI) |
476 | void UnsafeDefineButton(dword x,y,w,h,EDX,ESI) |
473 | { |
477 | { |
474 | EAX = 8; |
478 | EAX = 8; |
475 | EBX = x<<16+w; |
479 | EBX = x<<16+w; |
476 | ECX = y<<16+h; |
480 | ECX = y<<16+h; |
477 | $int 0x40 |
481 | $int 0x40 |
478 | } |
482 | } |
479 | 483 | ||
480 | inline fastcall void DeleteButton( EDX) |
484 | inline fastcall void DeleteButton( EDX) |
481 | { |
485 | { |
482 | EAX = 8; |
486 | EAX = 8; |
483 | EDX += BT_DEL; |
487 | EDX += BT_DEL; |
484 | $int 0x40 |
488 | $int 0x40 |
485 | } |
489 | } |
486 | 490 | ||
487 | inline fastcall dword GetStartTime() |
491 | inline fastcall dword GetStartTime() |
488 | { |
492 | { |
489 | $mov eax,26 |
493 | $mov eax,26 |
490 | $mov ebx,9 |
494 | $mov ebx,9 |
491 | $int 0x40 |
495 | $int 0x40 |
492 | } |
496 | } |
493 | 497 | ||
494 | :dword X_EventRedrawWindow,Y_EventRedrawWindow; |
498 | :dword X_EventRedrawWindow,Y_EventRedrawWindow; |
495 | :void _EventRedrawWindow() |
499 | :void _EventRedrawWindow() |
496 | { |
500 | { |
497 | loop()switch(WaitEvent()) |
501 | loop()switch(WaitEvent()) |
498 | { |
502 | { |
499 | case evReDraw: |
503 | case evReDraw: |
500 | DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,100,1,1,0x34,0xFFFFFF,""); |
504 | DefineAndDrawWindow(X_EventRedrawWindow,Y_EventRedrawWindow,100,1,1,0x34,0xFFFFFF,""); |
501 | pause(10); |
505 | pause(10); |
502 | ExitProcess(); |
506 | ExitProcess(); |
503 | break; |
507 | break; |
504 | } |
508 | } |
505 | } |
509 | } |
506 | :char REDRAW_BUFF_EVENT_[4096]; |
510 | :char REDRAW_BUFF_EVENT_[4096]; |
507 | :void EventRedrawWindow(dword x,y) |
511 | :void EventRedrawWindow(dword x,y) |
508 | { |
512 | { |
509 | X_EventRedrawWindow = x; |
513 | X_EventRedrawWindow = x; |
510 | Y_EventRedrawWindow = y; |
514 | Y_EventRedrawWindow = y; |
511 | CreateThread(#_EventRedrawWindow,#REDRAW_BUFF_EVENT_+4092); |
515 | CreateThread(#_EventRedrawWindow,#REDRAW_BUFF_EVENT_+4092); |
512 | } |
516 | } |
513 | 517 | ||
514 | :struct obj |
518 | :struct obj |
515 | { |
519 | { |
516 | dword x,y,w,h; |
520 | dword x,y,w,h; |
517 | void size(); |
521 | void size(); |
518 | }; |
522 | }; |
519 | 523 | ||
520 | :void obj::size(dword _x, _y, _w, _h) |
524 | :void obj::size(dword _x, _y, _w, _h) |
521 | { |
525 | { |
522 | x=_x; |
526 | x=_x; |
523 | y=_y; |
527 | y=_y; |
524 | w=_w; |
528 | w=_w; |
525 | h=_h; |
529 | h=_h; |
526 | } |
530 | } |
527 | 531 | ||
528 | :struct _screen |
532 | :struct _screen |
529 | { |
533 | { |
530 | dword width,height; |
534 | dword width,height; |
531 | } screen; |
535 | } screen; |
532 | 536 | ||
533 | :byte skin_height; |
537 | :byte skin_height; |
534 | 538 | ||
535 | :void DrawDate(dword x, y, color, in_date) |
539 | :void DrawDate(dword x, y, color, in_date) |
536 | { |
540 | { |
537 | EDI = in_date; |
541 | EDI = in_date; |
538 | EAX = 47; |
542 | EAX = 47; |
539 | EBX = 2<<16; |
543 | EBX = 2<<16; |
540 | EDX = x<<16+y; |
544 | EDX = x<<16+y; |
541 | ESI = 0x90<<24+color; |
545 | ESI = 0x90<<24+color; |
542 | ECX = EDI.date.day; |
546 | ECX = EDI.date.day; |
543 | $int 0x40; |
547 | $int 0x40; |
544 | EDX += 20<<16; |
548 | EDX += 20<<16; |
545 | ECX = EDI.date.month; |
549 | ECX = EDI.date.month; |
546 | $int 0x40; |
550 | $int 0x40; |
547 | EDX += 20<<16; |
551 | EDX += 20<<16; |
548 | EBX = 4<<16; |
552 | EBX = 4<<16; |
549 | ECX = EDI.date.year; |
553 | ECX = EDI.date.year; |
550 | $int 0x40; |
554 | $int 0x40; |
551 | DrawBar(x+17,y+10,2,2,color); |
555 | DrawBar(x+17,y+10,2,2,color); |
552 | DrawBar(x+37,y+10,2,2,color); |
556 | DrawBar(x+37,y+10,2,2,color); |
553 | } |
557 | } |
554 | 558 | ||
555 | :void __path_name__(dword BUF,PATH) |
559 | :void __path_name__(dword BUF,PATH) |
556 | { |
560 | { |
557 | dword beg = PATH; |
561 | dword beg = PATH; |
558 | dword pos = PATH; |
562 | dword pos = PATH; |
559 | dword sav = PATH; |
563 | dword sav = PATH; |
560 | dword i; |
564 | dword i; |
561 | while(DSBYTE[pos]) |
565 | while(DSBYTE[pos]) |
562 | { |
566 | { |
563 | if(DSBYTE[pos]=='/')sav = pos; |
567 | if(DSBYTE[pos]=='/')sav = pos; |
564 | pos++; |
568 | pos++; |
565 | } |
569 | } |
566 | i = sav-beg; |
570 | i = sav-beg; |
567 | while(i) |
571 | while(i) |
568 | { |
572 | { |
569 | DSBYTE[BUF] = DSBYTE[beg]; |
573 | DSBYTE[BUF] = DSBYTE[beg]; |
570 | beg++; |
574 | beg++; |
571 | BUF++; |
575 | BUF++; |
572 | i--; |
576 | i--; |
573 | } |
577 | } |
574 | /*while(DSBYTE[beg]) |
578 | /*while(DSBYTE[beg]) |
575 | { |
579 | { |
576 | DSBYTE[BUF1] = DSBYTE[beg]; |
580 | DSBYTE[BUF1] = DSBYTE[beg]; |
577 | beg++; |
581 | beg++; |
578 | BUF1++; |
582 | BUF1++; |
579 | }*/ |
583 | }*/ |
580 | //DSBYTE[BUF1] = 0; |
584 | //DSBYTE[BUF1] = 0; |
581 | DSBYTE[BUF] = 0; |
585 | DSBYTE[BUF] = 0; |
582 | } |
586 | } |
583 | char __BUF_DIR__[4096]; |
587 | char __BUF_DIR__[4096]; |
584 | :struct SELF |
588 | :struct SELF |
585 | { |
589 | { |
586 | dword dir; |
590 | dword dir; |
587 | dword file; |
591 | dword file; |
588 | dword path; |
592 | dword path; |
589 | } self; |
593 | } self; |
590 | 594 | ||
591 | dword __generator; // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë |
595 | dword __generator; // random number generator - äëÿ ãåíåðàöèè ñëó÷àéíûõ ÷èñåë |
592 | 596 | ||
593 | :dword program_path_length; |
597 | :dword program_path_length; |
594 | 598 | ||
595 | //The initialization of the initial data before running |
599 | //The initialization of the initial data before running |
596 | void ______INIT______() |
600 | void ______INIT______() |
597 | { |
601 | { |
598 | self.dir = #__BUF_DIR__; |
602 | self.dir = #__BUF_DIR__; |
599 | self.file = 0; |
603 | self.file = 0; |
600 | self.path = I_Path; |
604 | self.path = I_Path; |
601 | __path_name__(#__BUF_DIR__,I_Path); |
605 | __path_name__(#__BUF_DIR__,I_Path); |
602 | 606 | ||
603 | skin_height = GetSkinHeight(); |
607 | skin_height = GetSkinHeight(); |
604 | screen.width = GetScreenWidth(); |
608 | screen.width = GetScreenWidth(); |
605 | screen.height = GetScreenHeight(); |
609 | screen.height = GetScreenHeight(); |
606 | 610 | ||
607 | //program_path_length = strlen(I_Path); |
611 | //program_path_length = strlen(I_Path); |
608 | DOUBLE_CLICK_DELAY = GetMouseDoubleClickDelay(); |
612 | DOUBLE_CLICK_DELAY = GetMouseDoubleClickDelay(); |
609 | __generator = GetStartTime(); |
613 | __generator = GetStartTime(); |
610 | 614 | ||
611 | mem_init(); |
615 | mem_init(); |
- | 616 | ||
- | 617 | if (program_path[0]!='/') I_Path++; |
|
612 | 618 | ||
613 | main(); |
619 | main(); |
614 | ExitProcess(); |
620 | ExitProcess(); |
615 | } |
621 | } |
616 | ______STOP______: |
622 | ______STOP______: |
617 | #endif |
623 | #endif |
618 | 624 | ||
619 | #ifndef INCLUDE_MEM_H |
625 | #ifndef INCLUDE_MEM_H |
620 | #include "../lib/mem.h" |
626 | #include "../lib/mem.h" |
621 | #endif |
627 | #endif |
622 | 628 | ||
623 | #ifndef INCLUDE_DEBUG_H |
629 | #ifndef INCLUDE_DEBUG_H |
624 | #include "../lib/debug.h" |
630 | #include "../lib/debug.h" |
625 | #endif16; |
631 | #endif16; |
626 | ><16; |
632 | ><16; |
627 | >16; |
633 | >16; |
628 | ><16; |
634 | ><16; |
629 | >16; |
635 | >16; |
630 | ><16; |
636 | ><16; |
631 | >24+color; |
637 | >24+color; |
632 | ><24+color; |
638 | ><24+color; |
633 | >16+y; |
639 | >16+y; |
634 | ><16+y; |
640 | ><16+y; |
635 | >16; |
641 | >16; |
636 | ><16; |
642 | ><16; |
637 | >16+h; |
643 | >16+h; |
638 | ><16+h; |
644 | ><16+h; |
639 | >16+w; |
645 | >16+w; |
640 | ><16+w; |
646 | ><16+w; |
641 | >16+h; |
647 | >16+h; |
642 | ><16+h; |
648 | ><16+h; |
643 | >16+w; |
649 | >16+w; |
644 | ><16+w; |
650 | ><16+w; |
645 | >16+h; |
651 | >16+h; |
646 | ><16+h; |
652 | ><16+h; |
647 | >16+w; |
653 | >16+w; |
648 | ><16+w; |
654 | ><16+w; |
649 | >=0)>=0)>16+y; |
655 | >=0)>=0)>16+y; |
650 | ><16+y; |
656 | ><16+y; |
651 | >16+h; |
657 | >16+h; |
652 | ><16+h; |
658 | ><16+h; |
653 | >16+y; |
659 | >16+y; |
654 | ><16+y; |
660 | ><16+y; |
655 | >16+h; |
661 | >16+h; |
656 | ><16+h; |
662 | ><16+h; |
657 | >><>><>24+color; |
663 | >><>><>24+color; |
658 | ><24+color; |
664 | ><24+color; |
659 | >16+y; |
665 | >16+y; |
660 | ><16+y; |
666 | ><16+y; |
661 | >16; |
667 | >16; |
662 | ><16; |
668 | ><16; |
663 | >24+color; |
669 | >24+color; |
664 | ><24+color; |
670 | ><24+color; |
665 | >16+y; |
671 | >16+y; |
666 | ><16+y; |
672 | ><16+y; |
667 | >24+color; |
673 | >24+color; |
668 | ><24+color; |
674 | ><24+color; |
669 | >16+y; |
675 | >16+y; |
670 | ><16+y; |
676 | ><16+y; |
671 | >16 |
677 | >16 |
672 | ><16 |
678 | ><16 |
673 | >24+color; |
679 | >24+color; |
674 | ><24+color; |
680 | ><24+color; |
675 | >16+y; |
681 | >16+y; |
676 | ><16+y; |
682 | ><16+y; |
677 | >><>><>><> |
683 | >><>><>><> |