Subversion Repositories Kolibri OS

Rev

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

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