Subversion Repositories Kolibri OS

Rev

Rev 7031 | Rev 7054 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

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