Subversion Repositories Kolibri OS

Rev

Rev 6167 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2794 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;
10
dword  alloc_mem    = #0x00010000;
11
dword  x86esp_reg   = #0x00010000;
12
dword  I_Param      = 0;
13
dword  I_Path       = 0;
14
 
15
//Events
16
#define evButton    3
17
#define evKey       2
18
#define evReDraw    1
19
 
20
//Button options
21
#define BT_DEL		0x80000000
22
#define BT_HIDE		0x40000000
23
#define BT_NOFRAME	0x20000000
24
 
25
//-------------------------------------------------------------------------
26
 
27
 
28
struct proc_info{
29
	dword	use_cpu;
30
	word	pos_in_stack,num_slot,rezerv1;
31
	char	name[11];
32
	char	rezerv2;
33
	dword	adress,use_memory,ID,left,top,width,height;
34
	word	status_slot,rezerv3;
35
	dword	work_left,work_top,work_width,work_height;
36
	char	status_window;
37
	void	GetInfo(dword ECX);
38
	byte    reserved[1024-71];
39
#define SelfInfo -1
40
};
41
 
42
inline fastcall void GetProcessInfo(dword EBX, ECX)
43
{
44
	EAX = 9;
45
	$int  0x40
46
}
47
 
6167 leency 48
struct system_colors {
49
dword
50
	nonset1,
51
	nonset2,
52
	work_light,
53
	work_dark,
54
	nonset3,
55
	work,
56
	work_button,
57
	work_button_text,
58
	work_text,
59
	work_graph;
2794 leency 60
	void get();
61
};
62
 
63
void system_colors::get()
64
{
2797 leency 65
	$push ecx
2794 leency 66
	EAX = 48;
67
	EBX = 3;
6167 leency 68
	ECX = #nonset1;
2794 leency 69
	EDX = 40;
70
	$int 0x40
2797 leency 71
	$pop ecx
2794 leency 72
}
73
 
74
//------------------------------------------------------------------------------
75
 
76
inline fastcall dword WaitEvent(){
77
 EAX = 10;
78
 $int 0x40
79
}
80
 
7984 leency 81
inline fastcall int GetKeyScancode()
6167 leency 82
{
83
	$mov  eax,2
84
	$int  0x40
85
	$shr  eax,16
86
	return AL;
2794 leency 87
}
88
 
89
inline fastcall word GetButtonID(){
90
 EAX = 17;
91
 $int  0x40
92
 EAX = EAX >> 8;
93
}
94
 
95
inline fastcall ExitProcess(){
96
 EAX = -1;              // close this program
97
 $int 0x40
98
}
99
 
100
inline fastcall Pause(dword EBX)
101
{					//EBX = value in milisec
102
	$mov eax, 5
103
	$int 0x40
104
}
105
 
106
//------------------------------------------------------------------------------
107
 
2842 leency 108
char buffer[11];
2794 leency 109
inline fastcall dword IntToStr(dword ESI)
110
{
111
     $mov     edi, #buffer
112
     $mov     ecx, 10
113
     $test     esi, esi
114
     $jns     f1
115
     $mov     al, '-'
116
     $stosb
117
     $neg     esi
118
f1:
119
     $mov     eax, esi
120
     $push     -'0'
121
f2:
122
     $xor     edx, edx
123
     $div     ecx
124
     $push     edx
125
     $test     eax, eax
126
     $jnz     f2
127
f3:
128
     $pop     eax
129
     $add     al, '0'
130
     $stosb
131
     $jnz     f3
132
     $mov     eax, #buffer
133
     $ret
134
}
135
 
136
inline fastcall copystr(dword ESI,EDI)
137
{
138
	$cld
139
l1:
140
	$lodsb
141
	$stosb
142
	$test al,al
143
	$jnz l1
144
}
145
 
146
inline fastcall dword strlen(dword EDI){
147
	EAX=0;
148
	ECX=-1;
149
	$REPNE $SCASB
150
	EAX-=2+ECX;
151
}
152
//------------------------------------------------------------------------------
153
 
154
 
155
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI)
156
{
157
	EAX = 12;              // function 12:tell os about windowdraw
158
	EBX = 1;
159
	$int 0x40
160
 
161
	EBX = x << 16 + sizeX;
162
	ECX = y << 16 + sizeY;
163
	EDX = mainAreaType << 24 | mainAreaColour;
164
	ESI = headerType << 24 | headerColour;
165
	$xor eax,eax
166
	$int 0x40
167
 
168
	EAX = 12;              // function 12:tell os about windowdraw
169
	EBX = 2;
170
	$int 0x40
171
}
172
 
173
inline fastcall MoveSize(int EBX,ECX,EDX,ESI)
174
{
175
	EAX = 67;
176
	$int 0x40
177
}
178
 
179
 
7984 leency 180
inline fastcall dword GetSkinHeight()
2794 leency 181
{
182
	$push ebx
183
	$mov  eax, 48
184
	$mov  ebx, 4
185
	$int  0x40
186
	$pop  ebx
187
}
188
 
189
void WriteText(dword x,y,byte fontType, dword color, EDX, ESI)
190
{
191
	EAX = 4;
192
	EBX = x<<16+y;
193
	ECX = fontType<<24+color;
194
	$int 0x40;
195
}
196
 
197
void DrawBar(dword x,y,w,h,EDX)
198
{
199
	EAX = 13;
200
	EBX = x<<16+w;
201
	ECX = y<<16+h;
202
 	$int 0x40
203
}
204
 
205
void DefineButton(dword x,y,w,h,EDX,ESI)
206
{
207
 	EAX = 8;
208
	EBX = x<<16+w;
209
	ECX = y<<16+h;
210
 	$int 0x40
211
}
212
 
213
inline fastcall void DeleteButton(dword EDX)
214
{
215
	EAX = 8;
216
	EDX += BT_DEL;
217
	$int 0x40;
218
}
219
 
220
 
221
void DrawRegion_3D(dword x,y,width,height,color1,color2)
222
{
223
	DrawBar(x,y,width+1,1,color1);
224
	DrawBar(x,y+1,1,height-1,color1);
225
	DrawBar(x+width,y+1,1,height,color2);
226
	DrawBar(x,y+height,width,1,color2);
227
}
228
 
229
void PutImage(dword EBX,w,h,x,y)
230
{
231
	EAX = 7;
232
	ECX = w<<16+h;
233
	EDX = x<<16+y;
234
	$int 0x40
235
}
236
 
2842 leency 237
inline fastcall dword debug(dword EDX)
2794 leency 238
{
239
	$push ebx
240
	$push ecx
241
	$mov eax, 63
242
	$mov ebx, 1
243
next_char:
244
	$mov ecx, DSDWORD[edx]
245
	$or	 cl, cl
246
	$jz  done
247
	$int 0x40
248
	$inc edx
249
	$jmp next_char
250
done:
251
	$mov cl, 13
252
	$int 0x40
253
	$mov cl, 10
254
	$int 0x40
255
	$pop ecx
256
	$pop ebx
6167 leency 257
}
258
 
259
void DrawCaptButton(dword x,y,w,h,id,color_b, color_t,text)
260
{
261
	if (id>0) DefineButton(x,y,w,h,id,color_b);
262
	WriteText(-strlen(text)*6+w/2+x+1,h/2-3+y,0x80,color_t,text);
263
}
264
 
265