Subversion Repositories Kolibri OS

Rev

Rev 4081 | Rev 4166 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
3067 leency 1
//CODED by Veliant, Leency, Nable. GNU GPL licence.
2
 
3
#startaddress 0
4
#code32 TRUE
5
 
6
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
7
dword  os_version   = 0x00000001;
8
dword  start_addr   = #main;
9
dword  final_addr   = #stop+32;
3363 leency 10
dword  alloc_mem    = MEMSIZE;
11
dword  x86esp_reg   = MEMSIZE;
3067 leency 12
dword  I_Param      = #param;
13
dword  I_Path       = #program_path;
14
char param[4096];
15
char program_path[4096];
16
 
3363 leency 17
#define NULL      0
18
#define OLD      -1
19
#define true      1
20
#define false     0
21
 
3067 leency 22
//Events
23
#define evMouse   6
24
#define evButton  3
25
#define evKey     2
26
#define evReDraw  1
27
 
28
//Button options
29
#define BT_DEL      0x80000000
30
#define BT_HIDE     0x40000000
31
#define BT_NOFRAME  0x20000000
32
 
33
//-------------------------------------------------------------------------
34
 
35
struct mouse
36
{
3991 leency 37
	signed x,y,lkm,pkm,hor,vert;
3067 leency 38
	void get();
39
};
40
 
41
void mouse::get()
42
{
43
	EAX = 37;
44
	EBX = 1;
45
	$int	0x40
46
	$mov	ebx, eax
47
	$shr	eax, 16
48
	$and	ebx,0x0000FFFF
49
	x = EAX;
50
	y = EBX;
3991 leency 51
	if (x>6000) x-=65535;
52
	if (y>6000) y-=65535;
3067 leency 53
	EAX = 37;
54
	EBX = 2;
55
	$int	0x40
56
	$mov	ebx, eax
57
	$and	eax, 0x00000001
58
	$shr	ebx, 1
59
	$and	ebx, 0x00000001
60
	lkm = EAX;
61
	pkm = EBX;
62
	EAX = 37; //бЄа®««
63
	EBX = 7;
64
	$int	0x40
65
	$mov	ebx, eax
66
	$shr	eax, 16
67
	$and	ebx,0x0000FFFF
68
	//hor = EAX;
69
	vert = EBX;
70
}
71
 
72
 
73
struct system_colors
74
{
75
	dword frame,grab,grab_button,grab_button_text,grab_text,
76
	      work,work_button,work_button_text,work_text,work_graph;
77
	void get();
78
};
79
 
80
void system_colors::get()
81
{
82
	EAX = 48;
83
	EBX = 3;
84
	ECX = #frame;
85
	EDX = 40;
86
	$int 0x40
87
}
88
 
89
//------------------------------------------------------------------------------
90
 
91
inline fastcall dword WaitEvent()
92
{
93
	$mov eax,10
94
	$int 0x40
95
}
96
 
97
inline fastcall dword CheckEvent()
98
{
99
	$mov eax,11
100
	$int 0x40
101
}
102
 
103
inline fastcall dword WaitEventTimeout( EBX)
104
{
105
	$mov eax,23
106
	$int 0x40
107
}
108
 
109
inline fastcall SetEventMask( EBX)
110
{
111
	$mov eax,40
112
	$int 0x40
113
}
114
 
115
inline fastcall ScancodesGeting(){
116
	$mov eax,66
117
	$mov ebx,1
118
	$mov ecx,1 //бЄ ­Є®¤л
119
	$int 0x40
120
}
121
 
122
inline fastcall word GetKey()  //+Gluk fix
123
{
124
		$push edx
3107 leency 125
GETKEY:
3067 leency 126
		$mov  eax,2
127
		$int  0x40
128
		$cmp eax,1
3107 leency 129
		$jne GETKEYI
3067 leency 130
		$mov ah,dh
3107 leency 131
		$jmp GETKEYII //jz?
132
GETKEYI:
3067 leency 133
		$mov dh,ah
3107 leency 134
		$jmp GETKEY
135
GETKEYII:
3067 leency 136
		$pop edx
137
		$shr eax,8
138
}
139
 
140
 
3076 leency 141
inline fastcall pause( EBX)
3067 leency 142
{
143
	$mov eax, 5
144
	$int 0x40
145
}
146
 
147
inline fastcall word GetButtonID()
148
{
149
	$mov eax,17
150
	$int  0x40
151
	$shr eax,8
152
}
153
 
154
inline fastcall dword GetFreeRAM()
155
{
156
	$mov eax, 18
157
	$mov ebx, 16
158
	$int 0x40
159
	//return eax = размер свободной памяти в килобайтах
160
}
161
 
162
inline fastcall dword LoadDriver( ECX) //ECX - имя драйвера
163
{
164
	$mov eax, 68
165
	$mov ebx, 16
166
	$int 0x40
167
	//return 0 - неудача, иначе eax = хэндл драйвера
168
}
169
 
170
inline fastcall dword RuleDriver( ECX) //указатель на управляющую структуру
171
{
172
	$mov eax, 68
173
	$mov ebx, 17
174
	$int 0x40
175
	//return eax = определяется драйвером
176
}
177
 
178
struct proc_info
179
{
180
	#define SelfInfo -1
181
	dword	use_cpu;
182
	word	pos_in_stack,num_slot,rezerv1;
4137 leency 183
	unsigned char name[11];
3067 leency 184
	char	rezerv2;
185
	dword	adress,use_memory,ID,left,top,width,height;
186
	word	status_slot,rezerv3;
187
	dword	work_left,work_top,work_width,work_height;
188
	char	status_window;
3107 leency 189
	dword   cwidth,cheight;
190
	byte    reserved[1024-71-8];
3067 leency 191
};
192
 
193
inline fastcall void GetProcessInfo( EBX, ECX)
194
{
195
	$mov eax,9;
196
	$int  0x40
3107 leency 197
	DSDWORD[EBX+71] = DSDWORD[EBX+42] - 9; //set cwidth
198
	DSDWORD[EBX+75] = DSDWORD[EBX+46] - GetSkinHeight() - 4; //set cheight
3067 leency 199
}
200
 
201
inline fastcall int GetPointOwner( EBX, ECX) //ebx=m.x, ecx=m.y
202
{
203
	$mov eax,34
204
	$int 0x40
205
}
206
 
207
inline fastcall int GetProcessSlot( ECX)
208
{
209
	EAX = 18;
210
	EBX = 21;
211
	$int 0x40
212
}
213
 
214
inline fastcall int GetActiveProcess()
215
{
216
	EAX = 18;
217
	EBX = 7;
218
	$int 0x40
219
}
220
 
4081 leency 221
:int CheckActiveProcess(int Form_ID)
222
{
223
	int id=GetProcessSlot(Form_ID);
224
	if (id==GetActiveProcess()) return 1;
225
	return 0;
226
}
227
 
3114 leency 228
inline fastcall void ActivateWindow( ECX)
229
{
230
	EAX = 18;
231
	EBX = 3;
232
	$int 0x40
233
}
234
 
3067 leency 235
inline fastcall int CreateThread( ECX,EDX)
236
{
237
	$mov eax,51
238
	$mov ebx,1
239
	$int 0x40
240
}
241
 
242
inline fastcall void SwitchToAnotherThread()
243
{
244
	$mov eax,68
245
	$mov ebx,1
246
	$int 0x40
247
}
248
 
3458 leency 249
inline fastcall int SendWindowMessage( ECX, EDX)
3444 leency 250
{
251
	$mov eax, 72
252
	$mov ebx, 1
253
	$int 0x40
254
}
255
 
3067 leency 256
inline fastcall int KillProcess( ECX)
257
{
258
	$mov eax,18;
259
	$mov ebx,18;
260
	$int 0x40
261
}
262
 
263
#define TURN_OFF 2