Subversion Repositories Kolibri OS

Rev

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