Subversion Repositories Kolibri OS

Rev

Rev 6196 | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6196 Rev 7786
1
//CODED by Veliant, Leency, Nable. GNU GPL licence.
1
//CODED by Veliant, Leency, Nable. GNU GPL licence.
2
 
2
 
3
#startaddress 0
3
#startaddress 0
4
#code32 TRUE
4
#code32 TRUE
5
 
5
 
6
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
6
char   os_name[8]   = {'M','E','N','U','E','T','0','1'};
7
dword  os_version   = 0x00000001;
7
dword  os_version   = 0x00000001;
8
dword  start_addr   = #main;
8
dword  start_addr   = #main;
9
dword  final_addr   = #stop+32;
9
dword  final_addr   = #stop+32;
10
dword  alloc_mem    = #0x00010000;
10
dword  alloc_mem    = #0x00010000;
11
dword  x86esp_reg   = #0x00010000;
11
dword  x86esp_reg   = #0x00010000;
12
dword  I_Param      = 0;
12
dword  I_Param      = 0;
13
dword  I_Path       = 0;
13
dword  I_Path       = 0;
14
 
14
 
15
//Events
15
//Events
16
#define evMouse     6
16
#define evMouse     6
17
#define evButton    3
17
#define evButton    3
18
#define evKey       2
18
#define evKey       2
19
#define evReDraw    1
19
#define evReDraw    1
20
 
20
 
21
//Button options
21
//Button options
22
#define BT_DEL		0x80000000
22
#define BT_DEL		0x80000000
23
#define BT_HIDE		0x40000000
23
#define BT_HIDE		0x40000000
24
#define BT_NOFRAME	0x20000000
24
#define BT_NOFRAME	0x20000000
25
 
25
 
26
//-------------------------------------------------------------------------
26
//-------------------------------------------------------------------------
27
 
27
 
28
 
28
 
29
struct proc_info{
29
struct proc_info{
30
	dword	use_cpu;
30
	dword	use_cpu;
31
	word	pos_in_stack,num_slot,rezerv1;
31
	word	pos_in_stack,num_slot,rezerv1;
32
	char	name[11];
32
	char	name[11];
33
	char	rezerv2;
33
	char	rezerv2;
34
	dword	adress,use_memory,ID,left,top,width,height;
34
	dword	adress,use_memory,ID,left,top,width,height;
35
	word	status_slot,rezerv3;
35
	word	status_slot,rezerv3;
36
	dword	work_left,work_top,work_width,work_height;
36
	dword	work_left,work_top,work_width,work_height;
37
	char	status_window;
37
	char	status_window;
38
	void	GetInfo(dword ECX);
38
	void	GetInfo(dword ECX);
39
	byte    reserved[1024-71];
39
	byte    reserved[1024-71];
40
#define SelfInfo -1
40
#define SelfInfo -1
41
};
41
};
42
 
42
 
43
inline fastcall void GetProcessInfo(dword EBX, ECX)
43
inline fastcall void GetProcessInfo(dword EBX, ECX)
44
{
44
{
45
	EAX = 9;
45
	EAX = 9;
46
	$int  0x40
46
	$int  0x40
47
}
47
}
48
 
48
 
49
struct system_colors{
49
struct system_colors{
50
	dword frame,grab,work_3d_dark,work_3d_light,grab_text,work,work_button,work_button_text,work_text,work_graph;
50
	dword frame,grab,work_dark,work_light,grab_text,work,work_button,work_button_text,work_text,work_graph;
51
	void get();
51
	void get();
52
};
52
};
53
 
53
 
54
void system_colors::get()
54
void system_colors::get()
55
{
55
{
56
	EAX = 48;
56
	EAX = 48;
57
	EBX = 3;
57
	EBX = 3;
58
	ECX = #frame;
58
	ECX = #frame;
59
	EDX = 40;
59
	EDX = 40;
60
	$int 0x40
60
	$int 0x40
61
}
61
}
62
 
62
 
63
//------------------------------------------------------------------------------
63
//------------------------------------------------------------------------------
64
 
64
 
65
inline fastcall dword WaitEvent(){
65
inline fastcall dword WaitEvent(){
66
 EAX = 10;
66
 EAX = 10;
67
 $int 0x40
67
 $int 0x40
68
}
68
}
69
 
69
 
70
inline fastcall int GetKeyScancode()
70
inline fastcall int GetKeyScancode()
71
{
71
{
72
	$mov  eax,2
72
	$mov  eax,2
73
	$int  0x40
73
	$int  0x40
74
	$shr  eax,16
74
	$shr  eax,16
75
	return AL;
75
	return AL;
76
}
76
}
77
 
77
 
78
word GetButtonID(){
78
word GetButtonID(){
79
 EAX = 17;
79
 EAX = 17;
80
 $int  0x40
80
 $int  0x40
81
 EAX = EAX >> 8;
81
 EAX = EAX >> 8;
82
}
82
}
83
 
83
 
84
inline fastcall ExitProcess(){
84
inline fastcall ExitProcess(){
85
 EAX = -1;              // close this program
85
 EAX = -1;              // close this program
86
 $int 0x40
86
 $int 0x40
87
}
87
}
88
 
88
 
89
inline fastcall Pause(dword EBX)
89
inline fastcall Pause(dword EBX)
90
{					// ã§ , ¢ á®âëå ¤®«ïå ᥪ㭤ë EBX = value
90
{					// ã§ , ¢ á®âëå ¤®«ïå ᥪ㭤ë EBX = value
91
	$mov eax, 5
91
	$mov eax, 5
92
	$int 0x40
92
	$int 0x40
93
}
93
}
94
 
94
 
95
//------------------------------------------------------------------------------
95
//------------------------------------------------------------------------------
96
 
96
 
97
char buffer[11]="";
97
char buffer[11]="";
98
inline fastcall dword IntToStr(dword ESI)
98
inline fastcall dword IntToStr(dword ESI)
99
{
99
{
100
     $mov     edi, #buffer
100
     $mov     edi, #buffer
101
     $mov     ecx, 10
101
     $mov     ecx, 10
102
     $test     esi, esi
102
     $test     esi, esi
103
     $jns     f1
103
     $jns     f1
104
     $mov     al, '-'
104
     $mov     al, '-'
105
     $stosb
105
     $stosb
106
     $neg     esi
106
     $neg     esi
107
f1:
107
f1:
108
     $mov     eax, esi
108
     $mov     eax, esi
109
     $push     -'0'
109
     $push     -'0'
110
f2:
110
f2:
111
     $xor     edx, edx
111
     $xor     edx, edx
112
     $div     ecx
112
     $div     ecx
113
     $push     edx
113
     $push     edx
114
     $test     eax, eax
114
     $test     eax, eax
115
     $jnz     f2
115
     $jnz     f2
116
f3:
116
f3:
117
     $pop     eax
117
     $pop     eax
118
     $add     al, '0'
118
     $add     al, '0'
119
     $stosb
119
     $stosb
120
     $jnz     f3
120
     $jnz     f3
121
     $mov     eax, #buffer
121
     $mov     eax, #buffer
122
     $ret
122
     $ret
123
} 
123
} 
124
 
124
 
125
 
125
 
126
//------------------------------------------------------------------------------
126
//------------------------------------------------------------------------------
127
 
127
 
128
 
128
 
129
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI)
129
void DefineAndDrawWindow(dword x,y,sizeX,sizeY,byte mainAreaType,dword mainAreaColour,byte headerType,dword headerColour,EDI)
130
{
130
{
131
	EAX = 12;              // function 12:tell os about windowdraw
131
	EAX = 12;              // function 12:tell os about windowdraw
132
	EBX = 1;
132
	EBX = 1;
133
	$int 0x40
133
	$int 0x40
134
	
134
	
135
	EBX = x << 16 + sizeX;
135
	EBX = x << 16 + sizeX;
136
	ECX = y << 16 + sizeY;
136
	ECX = y << 16 + sizeY;
137
	EDX = mainAreaType << 24 | mainAreaColour;
137
	EDX = mainAreaType << 24 | mainAreaColour;
138
	ESI = headerType << 24 | headerColour;
138
	ESI = headerType << 24 | headerColour;
139
	$xor eax,eax
139
	$xor eax,eax
140
	$int 0x40
140
	$int 0x40
141
 
141
 
142
	EAX = 12;              // function 12:tell os about windowdraw
142
	EAX = 12;              // function 12:tell os about windowdraw
143
	EBX = 2;
143
	EBX = 2;
144
	$int 0x40
144
	$int 0x40
145
}
145
}
146
 
146
 
147
inline fastcall MoveSize(int EBX,ECX,EDX,ESI)
147
inline fastcall MoveSize(int EBX,ECX,EDX,ESI)
148
{
148
{
149
	EAX = 67;
149
	EAX = 67;
150
	$int 0x40
150
	$int 0x40
151
}
151
}
152
 
152
 
153
inline fastcall dword CreateThread(dword ECX,EDX)
153
inline fastcall dword CreateThread(dword ECX,EDX)
154
{
154
{
155
	EAX = 51;
155
	EAX = 51;
156
	EBX = 1;
156
	EBX = 1;
157
	$int 0x40
157
	$int 0x40
158
}
158
}
159
 
159
 
160
dword GetSkinHeight()
160
dword GetSkinHeight()
161
{
161
{
162
	$push ebx
162
	$push ebx
163
	$mov  eax, 48
163
	$mov  eax, 48
164
	$mov  ebx, 4
164
	$mov  ebx, 4
165
	$int  0x40
165
	$int  0x40
166
	$pop  ebx
166
	$pop  ebx
167
}
167
}
168
 
168
 
169
void WriteText(dword x,y,byte fontType, dword color, EDX, ESI)
169
void WriteText(dword x,y,byte fontType, dword color, EDX, ESI)
170
{
170
{
171
	EAX = 4;
171
	EAX = 4;
172
	EBX = x<<16+y;
172
	EBX = x<<16+y;
173
	ECX = fontType<<24+color;
173
	ECX = fontType<<24+color;
174
	$int 0x40;
174
	$int 0x40;
175
}
175
}
176
 
176
 
177
void DrawBar(dword x,y,w,h,EDX)
177
void DrawBar(dword x,y,w,h,EDX)
178
{
178
{
179
	EAX = 13;
179
	EAX = 13;
180
	EBX = x<<16+w;
180
	EBX = x<<16+w;
181
	ECX = y<<16+h;
181
	ECX = y<<16+h;
182
 	$int 0x40
182
 	$int 0x40
183
}
183
}
184
 
184
 
185
void DefineButton(dword x,y,w,h,EDX,ESI)
185
void DefineButton(dword x,y,w,h,EDX,ESI)
186
{
186
{
187
 	EAX = 8;
187
 	EAX = 8;
188
	EBX = x<<16+w;
188
	EBX = x<<16+w;
189
	ECX = y<<16+h;
189
	ECX = y<<16+h;
190
 	$int 0x40
190
 	$int 0x40
191
}
191
}
192
 
192
 
193
void DrawRegion(dword x,y,width,height,EDX)
193
void DrawRegion(dword x,y,width,height,EDX)
194
{
194
{
195
	DrawBar(x,y,width,1,EDX);
195
	DrawBar(x,y,width,1,EDX);
196
	DrawBar(x,y+height,width,1,EDX);
196
	DrawBar(x,y+height,width,1,EDX);
197
	DrawBar(x,y,1,height,EDX);
197
	DrawBar(x,y,1,height,EDX);
198
	DrawBar(x+width,y,1,height+1,EDX);
198
	DrawBar(x+width,y,1,height+1,EDX);
199
}
199
}
200
 
200
 
201
inline fastcall dword WriteDebug(dword EDX)
201
inline fastcall dword WriteDebug(dword EDX)
202
{
202
{
203
	$push ebx
203
	$push ebx
204
	$push ecx
204
	$push ecx
205
	$mov eax, 63
205
	$mov eax, 63
206
	$mov ebx, 1
206
	$mov ebx, 1
207
next_char:
207
next_char:
208
	$mov ecx, DSDWORD[edx]
208
	$mov ecx, DSDWORD[edx]
209
	$or	 cl, cl
209
	$or	 cl, cl
210
	$jz  done
210
	$jz  done
211
	$int 0x40
211
	$int 0x40
212
	$inc edx
212
	$inc edx
213
	$jmp next_char
213
	$jmp next_char
214
done:
214
done:
215
	$mov cl, 13
215
	$mov cl, 13
216
	$int 0x40
216
	$int 0x40
217
	$mov cl, 10
217
	$mov cl, 10
218
	$int 0x40
218
	$int 0x40
219
	$pop ecx
219
	$pop ecx
220
	$pop ebx
220
	$pop ebx
221
}
221
}
222
>
222
>
223
>
223
>
224
>
224
>
225
>
225
>
226
>
226
>
227
>
227
>
228
>
228
>
229
>
229
>
230
>
230
>
231
>
231
>
232
>
232
>
233
>
233
>