Subversion Repositories Kolibri OS

Rev

Rev 2797 | Rev 6167 | Go to most recent revision | 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
 
48
struct system_colors{
49
	dword frame,grab,grab_button,grab_button_text,grab_text,work,work_button,work_button_text,work_text,work_graph;
50
	void get();
51
};
52
 
53
void system_colors::get()
54
{
2797 leency 55
	$push ecx
2794 leency 56
	EAX = 48;
57
	EBX = 3;
58
	ECX = #frame;
59
	EDX = 40;
60
	$int 0x40
2797 leency 61
	$pop ecx
2794 leency 62
}
63
 
64
//------------------------------------------------------------------------------
65
 
66
inline fastcall dword WaitEvent(){
67
 EAX = 10;
68
 $int 0x40
69
}
70
 
71
 
72
inline fastcall word GetKey(){
73
 EAX = 2;              // just read it key from buffer
74
 $int  0x40
75
 EAX = EAX >> 8;
76
}
77
 
78
inline fastcall word GetButtonID(){
79
 EAX = 17;
80
 $int  0x40
81
 EAX = EAX >> 8;
82
}
83
 
84
inline fastcall ExitProcess(){
85
 EAX = -1;              // close this program
86
 $int 0x40
87
}
88
 
89
inline fastcall Pause(dword EBX)
90
{					//EBX = value in milisec
91
	$mov eax, 5
92
	$int 0x40
93
}
94
 
95
//------------------------------------------------------------------------------
96
 
2842 leency 97
char buffer[11];
2794 leency 98
inline fastcall dword IntToStr(dword ESI)
99
{
100
     $mov     edi, #buffer
101
     $mov     ecx, 10
102
     $test     esi, esi
103
     $jns     f1
104
     $mov     al, '-'
105
     $stosb
106
     $neg     esi
107
f1:
108
     $mov     eax, esi
109
     $push     -'0'
110
f2:
111
     $xor     edx, edx
112
     $div     ecx
113
     $push     edx
114
     $test     eax, eax
115
     $jnz     f2
116
f3:
117
     $pop     eax
118
     $add     al, '0'
119
     $stosb
120
     $jnz     f3
121
     $mov     eax, #buffer
122
     $ret
123
}
124
 
125
inline fastcall copystr(dword ESI,EDI)
126
{
127
	$cld
128
l1:
129
	$lodsb
130
	$stosb
131
	$test al,al
132
	$jnz l1
133
}
134
 
135
inline fastcall dword strlen(dword EDI){
136
	EAX=0;
137
	ECX=-1;
138
	$REPNE $SCASB
139
	EAX-=2+ECX;
140
}
141
//------------------------------------------------------------------------------
142
 
143
 
144
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI)
145
{
146
	EAX = 12;              // function 12:tell os about windowdraw
147
	EBX = 1;
148
	$int 0x40
149
 
150
	EBX = x << 16 + sizeX;
151
	ECX = y << 16 + sizeY;
152
	EDX = mainAreaType << 24 | mainAreaColour;
153
	ESI = headerType << 24 | headerColour;
154
	$xor eax,eax
155
	$int 0x40
156
 
157
	EAX = 12;              // function 12:tell os about windowdraw
158
	EBX = 2;
159
	$int 0x40
160
}
161
 
162
inline fastcall MoveSize(int EBX,ECX,EDX,ESI)
163
{
164
	EAX = 67;
165
	$int 0x40
166
}
167
 
168
 
169
inline fastcall dword GetSkinWidth()
170
{
171
	$push ebx
172
	$mov  eax, 48
173
	$mov  ebx, 4
174
	$int  0x40
175
	$pop  ebx
176
}
177
 
178
void WriteText(dword x,y,byte fontType, dword color, EDX, ESI)
179
{
180
	EAX = 4;
181
	EBX = x<<16+y;
182
	ECX = fontType<<24+color;
183
	$int 0x40;
184
}
185
 
186
void DrawBar(dword x,y,w,h,EDX)
187
{
188
	EAX = 13;
189
	EBX = x<<16+w;
190
	ECX = y<<16+h;
191
 	$int 0x40
192
}
193
 
194
void DefineButton(dword x,y,w,h,EDX,ESI)
195
{
196
 	EAX = 8;
197
	EBX = x<<16+w;
198
	ECX = y<<16+h;
199
 	$int 0x40
200
}
201
 
202
inline fastcall void DeleteButton(dword EDX)
203
{
204
	EAX = 8;
205
	EDX += BT_DEL;
206
	$int 0x40;
207
}
208
 
209
 
210
void DrawRegion_3D(dword x,y,width,height,color1,color2)
211
{
212
	DrawBar(x,y,width+1,1,color1);
213
	DrawBar(x,y+1,1,height-1,color1);
214
	DrawBar(x+width,y+1,1,height,color2);
215
	DrawBar(x,y+height,width,1,color2);
216
}
217
 
218
void PutImage(dword EBX,w,h,x,y)
219
{
220
	EAX = 7;
221
	ECX = w<<16+h;
222
	EDX = x<<16+y;
223
	$int 0x40
224
}
225
 
2842 leency 226
inline fastcall dword debug(dword EDX)
2794 leency 227
{
228
	$push ebx
229
	$push ecx
230
	$mov eax, 63
231
	$mov ebx, 1
232
next_char:
233
	$mov ecx, DSDWORD[edx]
234
	$or	 cl, cl
235
	$jz  done
236
	$int 0x40
237
	$inc edx
238
	$jmp next_char
239
done:
240
	$mov cl, 13
241
	$int 0x40
242
	$mov cl, 10
243
	$int 0x40
244
	$pop ecx
245
	$pop ebx
246
}