Rev 6166 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 6166 | Rev 7661 | ||
---|---|---|---|
1 | /* |
1 | /* |
2 | Sphinx C-- header file for KolibriOS applications. |
2 | Sphinx C-- header file for KolibriOS applications. |
3 | Based on msys.h-- written by Alexey Sugonyaev and modified by Barry Kauler. |
3 | Based on msys.h-- written by Alexey Sugonyaev and modified by Barry Kauler. |
4 | This file is rewritten by Ivan Poddubny. |
4 | This file is rewritten by Ivan Poddubny. |
5 | 5 | ||
6 | e-mail: ivan-yar@bk.ru |
6 | e-mail: ivan-yar@bk.ru |
7 | */ |
7 | */ |
8 | 8 | ||
9 | // KeyCode constant |
9 | // KeyCode constant |
10 | #define UP_KEY 130+48 |
10 | #define UP_KEY 130+48 |
11 | #define DOWN_KEY 129+48 |
11 | #define DOWN_KEY 129+48 |
12 | #define LEFT_KEY 128+48 |
12 | #define LEFT_KEY 128+48 |
13 | #define RIGHT_KEY 131+48 |
13 | #define RIGHT_KEY 131+48 |
14 | #define RETURN_KEY 13 |
14 | #define RETURN_KEY 13 |
15 | #define BACKSPACE_KEY 8 |
15 | #define BACKSPACE_KEY 8 |
- | 16 | ||
- | 17 | //Button options |
|
- | 18 | #define BT_DEL 0x80000000 |
|
- | 19 | #define BT_HIDE 0x40000000 |
|
- | 20 | #define BT_NOFRAME 0x20000000 |
|
16 | 21 | ||
17 | // Color constant |
22 | // Color constant |
18 | #define clWhite 0x00ffffff |
23 | #define clWhite 0x00ffffff |
19 | #define clGray 0x00808080 |
24 | #define clGray 0x00808080 |
20 | #define clLightGray 0x00c0c0c0 |
25 | #define clLightGray 0x00c0c0c0 |
- | 26 | #define clWhiteGray 0x00E2E2E2 |
|
21 | #define clDarkGray 0x00707070 |
27 | #define clDarkGray 0x00707070 |
22 | #define clBlack 0x00000000 |
28 | #define clBlack 0x00000000 |
23 | #define clRed 0x00ff0000 |
29 | #define clRed 0x00ff0000 |
24 | #define clGreen 0x0000ff00 |
30 | #define clGreen 0x0000ff00 |
25 | #define clBlue 0x000000ff |
31 | #define clBlue 0x000000ff |
26 | 32 | ||
27 | // Events |
33 | // Events |
28 | #define evReDraw 1 |
34 | #define evReDraw 1 |
29 | #define evKey 2 |
35 | #define evKey 2 |
30 | #define evButton 3 |
36 | #define evButton 3 |
31 | #define evMouse 6 |
37 | #define evMouse 6 |
32 | #define evIPC 7 |
38 | #define evIPC 7 |
33 | #define evStack 8 |
39 | #define evStack 8 |
34 | 40 | ||
35 | #define OLD -1 |
41 | #define OLD -1 |
36 | 42 | ||
37 | struct FileInfo |
43 | struct FileInfo |
38 | { |
44 | { |
39 | dword read, |
45 | dword read, |
40 | firstBlock, |
46 | firstBlock, |
41 | qnBlockRead, |
47 | qnBlockRead, |
42 | retPtr, |
48 | retPtr, |
43 | Work; |
49 | Work; |
44 | byte filedir; |
50 | byte filedir; |
45 | }; |
51 | }; |
46 | 52 | ||
47 | struct ProcessInfo |
53 | struct ProcessInfo |
48 | { |
54 | { |
49 | dword cpu_usage; |
55 | dword cpu_usage; |
50 | word winstackpos; |
56 | word winstackpos; |
51 | word winstackval; |
57 | word winstackval; |
52 | word not_used1; |
58 | word not_used1; |
53 | byte name[12]; |
59 | byte name[12]; |
54 | dword memstart, |
60 | dword memstart, |
55 | memory_used, |
61 | memory_used, |
56 | PID, |
62 | PID, |
57 | xstart, |
63 | xstart, |
58 | ystart, |
64 | ystart, |
59 | xsize, |
65 | xsize, |
60 | ysize; |
66 | ysize; |
61 | byte not_used2[974]; |
67 | byte not_used2[974]; |
62 | }; |
68 | }; |
63 | 69 | ||
64 | #define SystemColors SystemColours // usa/british |
70 | #define SystemColors SystemColours // usa/british |
65 | 71 | ||
66 | struct SystemColours |
72 | struct SystemColours |
67 | { |
73 | { |
68 | dword nonset1, |
74 | dword nonset1, |
69 | nonset2, |
75 | nonset2, |
70 | work_3d_dark, |
76 | work_3d_dark, |
71 | work_3d_light, |
77 | work_3d_light, |
72 | w_title, |
78 | w_title, |
73 | w_work, |
79 | w_work, |
74 | w_work_button, |
80 | w_work_button, |
75 | w_work_button_text, |
81 | w_work_button_text, |
76 | w_work_text, |
82 | w_work_text, |
77 | w_work_graph; |
83 | w_work_graph; |
78 | }; |
84 | }; |
79 | 85 | ||
80 | /********************************************************* |
86 | /********************************************************* |
81 | 0 = DEFINE WINDOW |
87 | 0 = DEFINE WINDOW |
82 | {x_start|y_start}, {x_size|y_size}, color_back, color_title, color_frames |
88 | {x_start|y_start}, {x_size|y_size}, color_back, color_title, color_frames |
83 | EBX = [x_start][x_size] |
89 | EBX = [x_start][x_size] |
84 | ECX = [y_start][y_size] |
90 | ECX = [y_start][y_size] |
85 | EDX, ESI, EDI = [00RRGGBB] |
91 | EDX, ESI, EDI = [00RRGGBB] |
86 | *********************************************************/ |
92 | *********************************************************/ |
87 | 93 | ||
88 | inline fastcall void sys_draw_window(dword EBX, ECX, EDX, ESI, EDI) |
94 | inline fastcall void sys_draw_window(dword EBX, ECX, EDX, ESI, EDI) |
89 | { |
95 | { |
90 | EAX = 0; // function 0 : define and draw window |
96 | EAX = 0; // function 0 : define and draw window |
91 | $int 0x40 |
97 | $int 0x40 |
92 | } |
98 | } |
93 | 99 | ||
94 | 100 | ||
95 | /********************************************************* |
101 | /********************************************************* |
96 | 01 = PUTPIXEL |
102 | 01 = PUTPIXEL |
97 | ebx [x] |
103 | ebx [x] |
98 | ecx [y] |
104 | ecx [y] |
99 | edx pixel color 0x0XRRGGBB |
105 | edx pixel color 0x0XRRGGBB |
100 | ^ 0 normal put, 1 negative |
106 | ^ 0 normal put, 1 negative |
101 | ret: nothing changed |
107 | ret: nothing changed |
102 | *********************************************************/ |
108 | *********************************************************/ |
103 | 109 | ||
104 | inline fastcall void sys_put_pixel(dword EBX,ECX,EDX) |
110 | inline fastcall void sys_put_pixel(dword EBX,ECX,EDX) |
105 | { |
111 | { |
106 | EAX=1; |
112 | EAX=1; |
107 | $int 0x40 |
113 | $int 0x40 |
108 | } |
114 | } |
109 | 115 | ||
110 | 116 | ||
111 | /********************************************************* |
117 | /********************************************************* |
112 | 02 = GET KEY |
118 | 02 = GET KEY |
113 | ret: al 0 successful -> ah = key |
119 | ret: al 0 successful -> ah = key |
114 | al 1 no key in buffer |
120 | al 1 no key in buffer |
115 | MODIFIED, see below... |
121 | MODIFIED, see below... |
116 | *********************************************************/ |
122 | *********************************************************/ |
117 | 123 | ||
118 | inline fastcall dword sys_get_key() |
124 | inline fastcall dword sys_get_key() |
119 | { |
125 | { |
120 | EAX = 2; // just read it key from buffer |
126 | EAX = 2; // just read it key from buffer |
121 | $int 0x40 |
127 | $int 0x40 |
122 | $shr eax,8 |
128 | $shr eax,8 |
123 | } //return eax=key code. |
129 | } //return eax=key code. |
124 | 130 | ||
125 | 131 | ||
126 | /********************************************************* |
132 | /********************************************************* |
127 | 03 = GET SYSTEM CLOCK |
133 | 03 = GET SYSTEM CLOCK |
128 | ret: eax 0x00SSMMHH sec,min,hour |
134 | ret: eax 0x00SSMMHH sec,min,hour |
129 | *********************************************************/ |
135 | *********************************************************/ |
130 | 136 | ||
131 | #define sys_get_time sys_get_clock |
137 | #define sys_get_time sys_get_clock |
132 | inline fastcall dword sys_get_clock() |
138 | inline fastcall dword sys_get_clock() |
133 | { |
139 | { |
134 | EAX=3; |
140 | EAX=3; |
135 | $int 0x40 |
141 | $int 0x40 |
136 | } |
142 | } |
137 | 143 | ||
138 | 144 | ||
139 | /********************************************************* |
145 | /********************************************************* |
140 | 04 = WRITE TEXT TO WINDOW |
146 | 04 = WRITE TEXT TO WINDOW |
141 | ebx [x start]*65536 + [y start] |
147 | ebx [x start]*65536 + [y start] |
142 | ecx text color 0x00RRGGBB |
148 | ecx text color 0x00RRGGBB |
143 | edx pointer to text beginning |
149 | edx pointer to text beginning |
144 | esi text length |
150 | esi text length |
145 | return: nothing changed |
151 | return: nothing changed |
146 | *********************************************************/ |
152 | *********************************************************/ |
147 | 153 | ||
148 | #define sys_print_text sys_write_text |
154 | #define sys_print_text sys_write_text |
149 | inline fastcall void sys_write_text(dword EBX, ECX, EDX, ESI) |
155 | inline fastcall void sys_write_text(dword EBX, ECX, EDX, ESI) |
150 | { |
156 | { |
151 | EAX = 4; |
157 | EAX = 4; |
152 | $int 0x40; |
158 | $int 0x40; |
153 | } |
159 | } |
154 | 160 | ||
155 | inline fastcall void sys_write_char(dword EBX, ECX, EDX) |
161 | inline fastcall void sys_write_char(dword EBX, ECX, EDX) |
156 | { |
162 | { |
157 | EAX = 4; |
163 | EAX = 4; |
158 | ESI = 1; |
164 | ESI = 1; |
159 | $int 0x40 |
165 | $int 0x40 |
160 | } |
166 | } |
161 | 167 | ||
162 | 168 | ||
163 | /********************************************************* |
169 | /********************************************************* |
164 | 05 = DELAY X/100 SECS |
170 | 05 = DELAY X/100 SECS |
165 | ebx delay in 1/100 secs |
171 | ebx delay in 1/100 secs |
166 | ret: nothing changed |
172 | ret: nothing changed |
167 | *********************************************************/ |
173 | *********************************************************/ |
168 | 174 | ||
169 | #define sys_wait sys_delay |
175 | #define sys_wait sys_delay |
170 | inline fastcall void sys_delay(dword EBX) |
176 | inline fastcall void sys_delay(dword EBX) |
171 | { |
177 | { |
172 | EAX = 5; |
178 | EAX = 5; |
173 | $int 0x40 |
179 | $int 0x40 |
174 | } |
180 | } |
175 | 181 | ||
176 | 182 | ||
177 | /********************************************************* |
183 | /********************************************************* |
178 | 06 = OPEN FILE FROM FLOPPY |
184 | 06 = OPEN FILE FROM FLOPPY |
179 | ebx pointer to filename -> 11 capital letters |
185 | ebx pointer to filename -> 11 capital letters |
180 | ecx set 0x00000000 - reserved |
186 | ecx set 0x00000000 - reserved |
181 | edx set 0xffffffff - reserved |
187 | edx set 0xffffffff - reserved |
182 | esi read to mem position |
188 | esi read to mem position |
183 | ret: ebx = file size |
189 | ret: ebx = file size |
184 | *********************************************************/ |
190 | *********************************************************/ |
185 | 191 | ||
186 | inline fastcall dword sys_open_file_floppy(dword EBX, ESI) |
192 | inline fastcall dword sys_open_file_floppy(dword EBX, ESI) |
187 | { |
193 | { |
188 | ECX = 0; |
194 | ECX = 0; |
189 | EDX = -1; |
195 | EDX = -1; |
190 | EAX = 6; |
196 | EAX = 6; |
191 | $int 0x40 |
197 | $int 0x40 |
192 | } |
198 | } |
193 | 199 | ||
194 | 200 | ||
195 | /********************************************************* |
201 | /********************************************************* |
196 | 07 = PUTIMAGE |
202 | 07 = PUTIMAGE |
197 | ebx pointer to image in memory - RRGGBBRRGGBB.. |
203 | ebx pointer to image in memory - RRGGBBRRGGBB.. |
198 | ecx image size [x]*65536+[y] |
204 | ecx image size [x]*65536+[y] |
199 | edx image position in window [x]*65536+[y] |
205 | edx image position in window [x]*65536+[y] |
200 | ret: eax 0 succesful, 1 overlapped |
206 | ret: eax 0 succesful, 1 overlapped |
201 | *********************************************************/ |
207 | *********************************************************/ |
202 | 208 | ||
203 | inline fastcall dword sys_put_image(dword EBX, ECX, EDX) |
209 | inline fastcall dword sys_put_image(dword EBX, ECX, EDX) |
204 | { |
210 | { |
205 | EAX = 7; |
211 | EAX = 7; |
206 | $int 0x40 |
212 | $int 0x40 |
207 | } |
213 | } |
208 | 214 | ||
209 | 215 | ||
210 | /********************************************************* |
216 | /********************************************************* |
211 | 08 = DEFINE BUTTON |
217 | 08 = DEFINE BUTTON |
212 | ebx [x start]*65536 + [x size] |
218 | ebx [x start]*65536 + [x size] |
213 | ecx [y start]*65536 + [y size] |
219 | ecx [y start]*65536 + [y size] |
214 | edx button id number |
220 | edx button id number |
215 | esi button color 0x 00 RR GG BB |
221 | esi button color 0x 00 RR GG BB |
216 | ret: nothing changed |
222 | ret: nothing changed |
217 | *********************************************************/ |
223 | *********************************************************/ |
218 | 224 | ||
219 | inline fastcall void sys_draw_button(dword EBX, ECX, EDX, ESI) |
225 | inline fastcall void sys_draw_button(dword EBX, ECX, EDX, ESI) |
220 | { |
226 | { |
221 | EAX = 8; |
227 | EAX = 8; |
222 | $int 0x40 |
228 | $int 0x40 |
223 | } |
229 | } |
224 | 230 | ||
225 | inline fastcall void sys_delete_button(dword EDX) |
231 | inline fastcall void sys_delete_button(dword EDX) |
226 | { |
232 | { |
227 | EAX = 8; |
233 | EAX = 8; |
228 | EDX |= 0x80000000; |
234 | EDX |= 0x80000000; |
229 | $int 0x40 |
235 | $int 0x40 |
230 | } |
236 | } |
231 | 237 | ||
232 | 238 | ||
233 | /********************************************************* |
239 | /********************************************************* |
234 | 09 = PROCESS INFO |
240 | 09 = PROCESS INFO |
235 | ebx pointer to 1024 bytes table |
241 | ebx pointer to 1024 bytes table |
236 | ecx process number or -1 = who am I |
242 | ecx process number or -1 = who am I |
237 | ret: eax number of processes |
243 | ret: eax number of processes |
238 | table : +00 dword cpu usage |
244 | table : +00 dword cpu usage |
239 | +04 word processes position in windowing stack |
245 | +04 word processes position in windowing stack |
240 | +06 word window stack value at ecx |
246 | +06 word window stack value at ecx |
241 | +10 12 db name of the process |
247 | +10 12 db name of the process |
242 | +22 dword start of processes memory |
248 | +22 dword start of processes memory |
243 | +26 dword memory used by process |
249 | +26 dword memory used by process |
244 | +30 dword PID of the process |
250 | +30 dword PID of the process |
245 | +34 dword window x start |
251 | +34 dword window x start |
246 | +38 dword window y start |
252 | +38 dword window y start |
247 | +42 dword window x size |
253 | +42 dword window x size |
248 | +46 dword window y size |
254 | +46 dword window y size |
249 | *********************************************************/ |
255 | *********************************************************/ |
250 | 256 | ||
251 | inline fastcall dword sys_process_info(dword EBX, ECX) |
257 | inline fastcall dword sys_process_info(dword EBX, ECX) |
252 | { |
258 | { |
253 | EAX = 9; |
259 | EAX = 9; |
254 | $int 0x40 |
260 | $int 0x40 |
255 | } |
261 | } |
256 | 262 | ||
257 | 263 | ||
258 | /********************************************************* |
264 | /********************************************************* |
259 | 10 = WAIT FOR EVENT |
265 | 10 = WAIT FOR EVENT |
260 | ret: eax event type, |
266 | ret: eax event type, |
261 | 1 window redraw, |
267 | 1 window redraw, |
262 | 2 key in buffer, |
268 | 2 key in buffer, |
263 | 3 button pressed |
269 | 3 button pressed |
264 | *********************************************************/ |
270 | *********************************************************/ |
265 | 271 | ||
266 | inline fastcall dword sys_wait_event() |
272 | inline fastcall dword sys_wait_event() |
267 | { |
273 | { |
268 | EAX = 10; // wait here for event |
274 | EAX = 10; // wait here for event |
269 | $int 0x40 |
275 | $int 0x40 |
270 | } |
276 | } |
271 | 277 | ||
272 | 278 | ||
273 | /********************************************************* |
279 | /********************************************************* |
274 | 11 = CHECK FOR EVENT, NO WAIT |
280 | 11 = CHECK FOR EVENT, NO WAIT |
275 | ret: eax 0 no event, |
281 | ret: eax 0 no event, |
276 | 1 window redraw, |
282 | 1 window redraw, |
277 | 2 key in buffer, |
283 | 2 key in buffer, |
278 | 3 button pressed |
284 | 3 button pressed |
279 | *********************************************************/ |
285 | *********************************************************/ |
280 | 286 | ||
281 | inline fastcall dword sys_nowait_event() |
287 | inline fastcall dword sys_nowait_event() |
282 | { |
288 | { |
283 | EAX = 11; |
289 | EAX = 11; |
284 | $int 0x40 |
290 | $int 0x40 |
285 | } |
291 | } |
286 | 292 | ||
287 | 293 | ||
288 | /********************************************************* |
294 | /********************************************************* |
289 | 12 = WINDOW REDRAW |
295 | 12 = WINDOW REDRAW |
290 | EBX=1 start of draw, =2 end of draw. |
296 | EBX=1 start of draw, =2 end of draw. |
291 | *********************************************************/ |
297 | *********************************************************/ |
292 | 298 | ||
293 | inline fastcall void sys_window_redraw(dword EBX) |
299 | inline fastcall void sys_window_redraw(dword EBX) |
294 | { |
300 | { |
295 | EAX = 12; // function 12:tell os about windowdraw |
301 | EAX = 12; // function 12:tell os about windowdraw |
296 | $int 0x40 |
302 | $int 0x40 |
297 | } |
303 | } |
298 | 304 | ||
299 | inline fastcall void sys_begin_draw() |
305 | inline fastcall void sys_begin_draw() |
300 | { |
306 | { |
301 | EAX = 12; |
307 | EAX = 12; |
302 | EBX = 1; |
308 | EBX = 1; |
303 | $int 0x40 |
309 | $int 0x40 |
304 | } |
310 | } |
305 | 311 | ||
306 | inline fastcall void sys_end_draw() |
312 | inline fastcall void sys_end_draw() |
307 | { |
313 | { |
308 | EAX = 12; |
314 | EAX = 12; |
309 | EBX = 2; |
315 | EBX = 2; |
310 | $int 0x40 |
316 | $int 0x40 |
311 | } |
317 | } |
312 | 318 | ||
313 | /********************************************************* |
319 | /********************************************************* |
314 | 13 = DRAW BAR |
320 | 13 = DRAW BAR |
315 | DrawBar(EBX=[xstart][xsize],ECX=[ystart][ysize],EDX=[0x00RRGGBB]) |
321 | DrawBar(EBX=[xstart][xsize],ECX=[ystart][ysize],EDX=[0x00RRGGBB]) |
316 | ebx [x start]*65536 + [x size] |
322 | ebx [x start]*65536 + [x size] |
317 | ecx [y start]*65536 + [y size] |
323 | ecx [y start]*65536 + [y size] |
318 | edx color 0x00RRGGBB |
324 | edx color 0x00RRGGBB |
319 | ret: nothing changed |
325 | ret: nothing changed |
320 | *********************************************************/ |
326 | *********************************************************/ |
321 | 327 | ||
322 | inline fastcall void sys_draw_bar(dword EBX, ECX, EDX) |
328 | inline fastcall void sys_draw_bar(dword EBX, ECX, EDX) |
323 | { |
329 | { |
324 | EAX = 13; |
330 | EAX = 13; |
325 | $int 0x40 |
331 | $int 0x40 |
326 | } |
332 | } |
327 | 333 | ||
328 | 334 | ||
329 | /********************************************************* |
335 | /********************************************************* |
330 | 14 = GET SCREEN MAX |
336 | 14 = GET SCREEN MAX |
331 | ret: eax [screen x max]*65536 + [screen y max] |
337 | ret: eax [screen x max]*65536 + [screen y max] |
332 | *********************************************************/ |
338 | *********************************************************/ |
333 | 339 | ||
334 | inline fastcall dword sys_get_screen_size() |
340 | inline fastcall dword sys_get_screen_size() |
335 | { |
341 | { |
336 | EAX = 14; |
342 | EAX = 14; |
337 | $int 0x40 |
343 | $int 0x40 |
338 | } |
344 | } |
339 | 345 | ||
340 | 346 | ||
341 | /********************************************************* |
347 | /********************************************************* |
342 | 15 = BACKGROUND |
348 | 15 = BACKGROUND |
343 | ebx 1 : set background size |
349 | ebx 1 : set background size |
344 | ecx x size |
350 | ecx x size |
345 | edx y size |
351 | edx y size |
346 | ebx 2 : write to background memory - max (0x100000-16) |
352 | ebx 2 : write to background memory - max (0x100000-16) |
347 | ecx position in memory in bytes |
353 | ecx position in memory in bytes |
348 | edx color 0x00RRGGBB |
354 | edx color 0x00RRGGBB |
349 | ebx 3 : draw background |
355 | ebx 3 : draw background |
350 | ebx 4 : type of background draw |
356 | ebx 4 : type of background draw |
351 | ecx 1 - tile |
357 | ecx 1 - tile |
352 | ecx 2 - stretch |
358 | ecx 2 - stretch |
353 | ebx 5 : blockmove image to os bgr memory |
359 | ebx 5 : blockmove image to os bgr memory |
354 | ecx - from |
360 | ecx - from |
355 | edx - to where in os bgr memory |
361 | edx - to where in os bgr memory |
356 | esi - count of bytes to move |
362 | esi - count of bytes to move |
357 | *********************************************************/ |
363 | *********************************************************/ |
358 | 364 | ||
359 | inline fastcall void sys_set_background(dword EBX, ECX, EDX, ESI) |
365 | inline fastcall void sys_set_background(dword EBX, ECX, EDX, ESI) |
360 | { |
366 | { |
361 | EAX = 15; |
367 | EAX = 15; |
362 | $int 0x40 |
368 | $int 0x40 |
363 | } |
369 | } |
364 | 370 | ||
365 | 371 | ||
366 | /********************************************************* |
372 | /********************************************************* |
367 | 17 = GET PRESSED BUTTON ID |
373 | 17 = GET PRESSED BUTTON ID |
368 | ret: al 0 successful -> ah = id number al 1 no key in buffer. |
374 | ret: al 0 successful -> ah = id number al 1 no key in buffer. |
369 | MODIFIED, see below. |
375 | MODIFIED, see below. |
370 | *********************************************************/ |
376 | *********************************************************/ |
371 | 377 | ||
372 | inline fastcall dword sys_get_button_id() |
378 | inline fastcall dword sys_get_button_id() |
373 | { |
379 | { |
374 | EAX = 17; // Get ID |
380 | EAX = 17; // Get ID |
375 | $int 0x40 |
381 | $int 0x40 |
376 | $shr eax,8 |
382 | $shr eax,8 |
377 | } //eax=id, eax=0 no id. |
383 | } //eax=id, eax=0 no id. |
378 | 384 | ||
379 | 385 | ||
380 | /********************************************************* |
386 | /********************************************************* |
381 | 18 = SYSTEM SERVICE |
387 | 18 = SYSTEM SERVICE |
382 | ebx 1 - system boot |
388 | ebx 1 - system boot |
383 | ebx 2 - force terminate , ecx process no |
389 | ebx 2 - force terminate , ecx process no |
384 | ebx 4 - idle clock cycles / second |
390 | ebx 4 - idle clock cycles / second |
385 | ebx 5 - time stamp counter / second - cpu speed |
391 | ebx 5 - time stamp counter / second - cpu speed |
386 | HD-> ebx 6 - save ramdisk to /hd/1/menuet.img |
392 | HD-> ebx 6 - save ramdisk to /hd/1/menuet.img |
387 | *********************************************************/ |
393 | *********************************************************/ |
388 | 394 | ||
389 | inline fastcall dword sys_service(dword EBX, ECX) |
395 | inline fastcall dword sys_service(dword EBX, ECX) |
390 | { |
396 | { |
391 | EAX = 18; |
397 | EAX = 18; |
392 | $int 0x40 |
398 | $int 0x40 |
393 | } |
399 | } |
394 | 400 | ||
395 | inline fastcall void sys_shutdown() |
401 | inline fastcall void sys_shutdown() |
396 | { |
402 | { |
397 | EAX = 18; |
403 | EAX = 18; |
398 | EBX = 1; |
404 | EBX = 1; |
399 | $int 0x40 |
405 | $int 0x40 |
400 | } |
406 | } |
401 | 407 | ||
402 | inline fastcall void sys_kill(dword ECX) |
408 | inline fastcall void sys_kill(dword ECX) |
403 | { |
409 | { |
404 | EAX = 18; |
410 | EAX = 18; |
405 | EBX = 2; |
411 | EBX = 2; |
406 | $int 0x40 |
412 | $int 0x40 |
407 | } |
413 | } |
408 | 414 | ||
409 | inline fastcall dword sys_get_idle() |
415 | inline fastcall dword sys_get_idle() |
410 | { |
416 | { |
411 | EAX = 18; |
417 | EAX = 18; |
412 | EBX = 4; |
418 | EBX = 4; |
413 | $int 0x40 |
419 | $int 0x40 |
414 | } |
420 | } |
415 | 421 | ||
416 | inline fastcall dword sys_get_tscsec() |
422 | inline fastcall dword sys_get_tscsec() |
417 | { |
423 | { |
418 | EAX = 18; |
424 | EAX = 18; |
419 | EBX = 5; |
425 | EBX = 5; |
420 | $int 0x40 |
426 | $int 0x40 |
421 | } |
427 | } |
422 | 428 | ||
423 | 429 | ||
424 | /********************************************************* |
430 | /********************************************************* |
425 | 19 = START PROGRAM from RAMDISK |
431 | 19 = START PROGRAM from RAMDISK |
426 | ebx point to 11 char filename |
432 | ebx point to 11 char filename |
427 | ecx 0, or point to ASCIIZ start parameters - max 256 bytes |
433 | ecx 0, or point to ASCIIZ start parameters - max 256 bytes |
428 | ret: eax 0 successful |
434 | ret: eax 0 successful |
429 | eax other error code |
435 | eax other error code |
430 | *********************************************************/ |
436 | *********************************************************/ |
431 | 437 | ||
432 | inline fastcall dword sys_exec_app_ramdisk(dword EBX, ECX) |
438 | inline fastcall dword sys_exec_app_ramdisk(dword EBX, ECX) |
433 | { |
439 | { |
434 | EAX = 19; |
440 | EAX = 19; |
435 | $int 0x40 |
441 | $int 0x40 |
436 | } |
442 | } |
437 | 443 | ||
438 | 444 | ||
439 | /********************************************************* |
445 | /********************************************************* |
440 | 20 = MIDI INTERFACE - MPU401 |
446 | 20 = MIDI INTERFACE - MPU401 |
441 | ebx 1 - reset device |
447 | ebx 1 - reset device |
442 | ebx 2 - cl midi data to output |
448 | ebx 2 - cl midi data to output |
443 | *********************************************************/ |
449 | *********************************************************/ |
444 | 450 | ||
445 | inline fastcall void sys_midi(dword EBX) |
451 | inline fastcall void sys_midi(dword EBX) |
446 | { |
452 | { |
447 | EAX = 20; |
453 | EAX = 20; |
448 | $int 0x40 |
454 | $int 0x40 |
449 | } |
455 | } |
450 | 456 | ||
451 | 457 | ||
452 | /********************************************************* |
458 | /********************************************************* |
453 | 21 = SETUP FOR DEVICES |
459 | 21 = SETUP FOR DEVICES |
454 | ebx 1=roland mpu midi base , base io address |
460 | ebx 1=roland mpu midi base , base io address |
455 | ebx 2=keyboard 1 base keymap 2 shift keymap (ecx pointer to keymap) |
461 | ebx 2=keyboard 1 base keymap 2 shift keymap (ecx pointer to keymap) |
456 | 9 country 1eng 2fi 3ger 4rus |
462 | 9 country 1eng 2fi 3ger 4rus |
457 | ebx 3=cd base 1 pri.master 2 pri slave, |
463 | ebx 3=cd base 1 pri.master 2 pri slave, |
458 | 3 sec master 4 sec slave |
464 | 3 sec master 4 sec slave |
459 | ebx 4=sb16 base, base io address |
465 | ebx 4=sb16 base, base io address |
460 | ebx 5=system language, 1eng 2fi 3ger 4rus |
466 | ebx 5=system language, 1eng 2fi 3ger 4rus |
461 | ebx 6=wss base, base io address |
467 | ebx 6=wss base, base io address |
462 | ebx 7=hd base, 1 pri.master 2 pri slave |
468 | ebx 7=hd base, 1 pri.master 2 pri slave |
463 | 3 sec master 4 sec slave |
469 | 3 sec master 4 sec slave |
464 | ebx 8=fat32 partition in hd |
470 | ebx 8=fat32 partition in hd |
465 | *********************************************************/ |
471 | *********************************************************/ |
466 | 472 | ||
467 | inline fastcall void sys_setup_devices(dword EBX, ECX) |
473 | inline fastcall void sys_setup_devices(dword EBX, ECX) |
468 | { |
474 | { |
469 | EAX = 21; |
475 | EAX = 21; |
470 | $int 0x40 |
476 | $int 0x40 |
471 | } |
477 | } |
472 | 478 | ||
473 | 479 | ||
474 | /********************************************************* |
480 | /********************************************************* |
475 | 23 = WAIT FOR EVENT WITH TIMEOUT |
481 | 23 = WAIT FOR EVENT WITH TIMEOUT |
476 | ebx time to delay in hs |
482 | ebx time to delay in hs |
477 | ret: eax event type: 0 no event, 1 window redraw, |
483 | ret: eax event type: 0 no event, 1 window redraw, |
478 | 2 key in buffer, 3 button |
484 | 2 key in buffer, 3 button |
479 | *********************************************************/ |
485 | *********************************************************/ |
480 | 486 | ||
481 | inline fastcall dword sys_wait_event_timeout(dword EBX) |
487 | inline fastcall dword sys_wait_event_timeout(dword EBX) |
482 | { |
488 | { |
483 | EAX = 23; |
489 | EAX = 23; |
484 | $int 0x40 |
490 | $int 0x40 |
485 | } |
491 | } |
486 | 492 | ||
487 | 493 | ||
488 | /********************************************************* |
494 | /********************************************************* |
489 | 24 = CD AUDIO |
495 | 24 = CD AUDIO |
490 | ebx 1 - play from ecx 00 FR SS MM |
496 | ebx 1 - play from ecx 00 FR SS MM |
491 | ebx 2 - get playlist size of ecx to [edx] |
497 | ebx 2 - get playlist size of ecx to [edx] |
492 | ebx 3 - stop/pause play |
498 | ebx 3 - stop/pause play |
493 | *********************************************************/ |
499 | *********************************************************/ |
494 | 500 | ||
495 | inline fastcall void sys_cd_audio(dword EBX, ECX, EDX) |
501 | inline fastcall void sys_cd_audio(dword EBX, ECX, EDX) |
496 | { |
502 | { |
497 | EAX = 24; |
503 | EAX = 24; |
498 | $int 0x40 |
504 | $int 0x40 |
499 | } |
505 | } |
500 | 506 | ||
501 | 507 | ||
502 | /********************************************************* |
508 | /********************************************************* |
503 | 25 = SB16 - mixer I |
509 | 25 = SB16 - mixer I |
504 | ebx 1 - set main volume cl [L]*16+[R] |
510 | ebx 1 - set main volume cl [L]*16+[R] |
505 | ebx 2 - set cd volume cl [L]*16+[R] |
511 | ebx 2 - set cd volume cl [L]*16+[R] |
506 | *********************************************************/ |
512 | *********************************************************/ |
507 | 513 | ||
508 | inline fastcall void sys_sb16_mixer_1(dword EBX, ECX) |
514 | inline fastcall void sys_sb16_mixer_1(dword EBX, ECX) |
509 | { |
515 | { |
510 | EAX = 25; |
516 | EAX = 25; |
511 | $int 0x40 |
517 | $int 0x40 |
512 | } |
518 | } |
513 | 519 | ||
514 | 520 | ||
515 | /********************************************************* |
521 | /********************************************************* |
516 | 26 = GET SETUP FOR DEVICES |
522 | 26 = GET SETUP FOR DEVICES |
517 | ebx 1=roland mpu midi base , base io address |
523 | ebx 1=roland mpu midi base , base io address |
518 | ebx 2=keyboard 1 base keymap 2 shift keymap |
524 | ebx 2=keyboard 1 base keymap 2 shift keymap |
519 | 9 country 1eng 2fi 3ger 4rus |
525 | 9 country 1eng 2fi 3ger 4rus |
520 | ebx 3=cd base 1 pri.master 2 pri slave, |
526 | ebx 3=cd base 1 pri.master 2 pri slave, |
521 | 3 sec master 4 sec slave |
527 | 3 sec master 4 sec slave |
522 | ebx 4=sb16 base, base io address |
528 | ebx 4=sb16 base, base io address |
523 | ebx 5=system language, 1eng 2fi 3ger 4rus |
529 | ebx 5=system language, 1eng 2fi 3ger 4rus |
524 | ebx 6=wss base, base io address |
530 | ebx 6=wss base, base io address |
525 | ebx 7=hd base, 1 pri.master 2 pri slave |
531 | ebx 7=hd base, 1 pri.master 2 pri slave |
526 | 3 sec master 4 sec slave |
532 | 3 sec master 4 sec slave |
527 | ebx 8=fat32 partition in hd |
533 | ebx 8=fat32 partition in hd |
528 | ebx 9=1/100 timer tics from start -> eax |
534 | ebx 9=1/100 timer tics from start -> eax |
529 | return value in eax |
535 | return value in eax |
530 | *********************************************************/ |
536 | *********************************************************/ |
531 | 537 | ||
532 | inline fastcall dword sys_get_setup_devices(dword EBX) |
538 | inline fastcall dword sys_get_setup_devices(dword EBX) |
533 | { |
539 | { |
534 | EAX = 26; |
540 | EAX = 26; |
535 | $int 0x40 |
541 | $int 0x40 |
536 | } |
542 | } |
537 | 543 | ||
538 | 544 | ||
539 | /********************************************************* |
545 | /********************************************************* |
540 | 27 = WINDOWS SOUND SYSTEM |
546 | 27 = WINDOWS SOUND SYSTEM |
541 | ebx 1 - set main volume to cl 0-255 |
547 | ebx 1 - set main volume to cl 0-255 |
542 | ebx 2 - set cd volume to cl 0-255 |
548 | ebx 2 - set cd volume to cl 0-255 |
543 | *********************************************************/ |
549 | *********************************************************/ |
544 | 550 | ||
545 | inline fastcall void sys_windows_sound_system(dword EBX, ECX) |
551 | inline fastcall void sys_windows_sound_system(dword EBX, ECX) |
546 | { |
552 | { |
547 | EAX = 27; |
553 | EAX = 27; |
548 | $int 0x40 |
554 | $int 0x40 |
549 | } |
555 | } |
550 | 556 | ||
551 | 557 | ||
552 | /********************************************************* |
558 | /********************************************************* |
553 | 28 = SB16 - mixer II |
559 | 28 = SB16 - mixer II |
554 | ebx 1 - set main volume to cl 0-255 |
560 | ebx 1 - set main volume to cl 0-255 |
555 | ebx 2 - set cd volume to cl 0-255 |
561 | ebx 2 - set cd volume to cl 0-255 |
556 | *********************************************************/ |
562 | *********************************************************/ |
557 | 563 | ||
558 | inline fastcall void sys_sb16_mixer_2(dword EBX, ECX) |
564 | inline fastcall void sys_sb16_mixer_2(dword EBX, ECX) |
559 | { |
565 | { |
560 | EAX = 28; |
566 | EAX = 28; |
561 | $int 0x40 |
567 | $int 0x40 |
562 | } |
568 | } |
563 | 569 | ||
564 | 570 | ||
565 | /********************************************************* |
571 | /********************************************************* |
566 | 29 = GET DATE |
572 | 29 = GET DATE |
567 | ret: eax 0x00YYDDMM year date month |
573 | ret: eax 0x00YYDDMM year date month |
568 | *********************************************************/ |
574 | *********************************************************/ |
569 | 575 | ||
570 | inline fastcall dword sys_get_date() |
576 | inline fastcall dword sys_get_date() |
571 | { |
577 | { |
572 | EAX = 29; |
578 | EAX = 29; |
573 | $int 0x40 |
579 | $int 0x40 |
574 | } |
580 | } |
575 | 581 | ||
576 | 582 | ||
577 | /********************************************************* |
583 | /********************************************************* |
578 | 30 = READ HD |
584 | 30 = READ HD |
579 | ebx pointer to file |
585 | ebx pointer to file |
580 | ecx file lenght |
586 | ecx file lenght |
581 | edx block to read, starts from 1, blocksize = 512 bytes |
587 | edx block to read, starts from 1, blocksize = 512 bytes |
582 | esi reserved, set as 1 |
588 | esi reserved, set as 1 |
583 | edi pointer to return/work area (atleast 20 000 bytes) |
589 | edi pointer to return/work area (atleast 20 000 bytes) |
584 | return: work_area+1024 <- requested block of 512 bytes |
590 | return: work_area+1024 <- requested block of 512 bytes |
585 | *********************************************************/ |
591 | *********************************************************/ |
586 | 592 | ||
587 | inline fastcall dword sys_read_hd(dword EBX, ECX, EDX, ESI, EDI) |
593 | inline fastcall dword sys_read_hd(dword EBX, ECX, EDX, ESI, EDI) |
588 | { |
594 | { |
589 | EAX = 30; |
595 | EAX = 30; |
590 | $int 0x40 |
596 | $int 0x40 |
591 | } |
597 | } |
592 | 598 | ||
593 | 599 | ||
594 | /********************************************************* |
600 | /********************************************************* |
595 | 31 = START APP FROM HD |
601 | 31 = START APP FROM HD |
596 | ebx pointer to file |
602 | ebx pointer to file |
597 | ecx file lenght |
603 | ecx file lenght |
598 | edx pointer to return/work area (atleast 20 000 bytes) |
604 | edx pointer to return/work area (atleast 20 000 bytes) |
599 | ret eax=0 successful, eax<>0 errorcode |
605 | ret eax=0 successful, eax<>0 errorcode |
600 | *********************************************************/ |
606 | *********************************************************/ |
601 | 607 | ||
602 | inline fastcall dword sys_exec_app_hd() |
608 | inline fastcall dword sys_exec_app_hd() |
603 | { |
609 | { |
604 | EAX = 31; |
610 | EAX = 31; |
605 | $int 0x40 |
611 | $int 0x40 |
606 | } |
612 | } |
607 | 613 | ||
608 | 614 | ||
609 | /********************************************************* |
615 | /********************************************************* |
610 | 32 = DELETE FILE FROM FLOPPY IMAGE IN MEMORY |
616 | 32 = DELETE FILE FROM FLOPPY IMAGE IN MEMORY |
611 | ebx pointer to filename |
617 | ebx pointer to filename |
612 | *********************************************************/ |
618 | *********************************************************/ |
613 | 619 | ||
614 | inline fastcall dword sys_floppy_delete(EBX) |
620 | inline fastcall dword sys_floppy_delete(EBX) |
615 | { |
621 | { |
616 | EAX = 32; |
622 | EAX = 32; |
617 | $int 0x40 |
623 | $int 0x40 |
618 | } |
624 | } |
619 | 625 | ||
620 | 626 | ||
621 | /********************************************************* |
627 | /********************************************************* |
622 | 33 = SAVE FILE TO FLOPPY IMAGE IN MEMORY |
628 | 33 = SAVE FILE TO FLOPPY IMAGE IN MEMORY |
623 | ebx pointer to file name |
629 | ebx pointer to file name |
624 | ecx pointer to data |
630 | ecx pointer to data |
625 | edx count to write in bytes |
631 | edx count to write in bytes |
626 | esi 0 create new , ( 1 append - not implemented yet ) |
632 | esi 0 create new , ( 1 append - not implemented yet ) |
627 | *********************************************************/ |
633 | *********************************************************/ |
628 | 634 | ||
629 | inline fastcall dword sys_floppy_save(EBX,ECX,EDX) |
635 | inline fastcall dword sys_floppy_save(EBX,ECX,EDX) |
630 | { |
636 | { |
631 | EAX = 33; |
637 | EAX = 33; |
632 | ESI = 0; |
638 | ESI = 0; |
633 | $int 0x40 |
639 | $int 0x40 |
634 | } |
640 | } |
635 | 641 | ||
636 | 642 | ||
637 | /********************************************************* |
643 | /********************************************************* |
638 | 34 = READ DIRECTORY FROM FLOPPY |
644 | 34 = READ DIRECTORY FROM FLOPPY |
639 | ebx reserved : set as zero |
645 | ebx reserved : set as zero |
640 | ecx reserved : set as zero |
646 | ecx reserved : set as zero |
641 | edx start 512 block to read |
647 | edx start 512 block to read |
642 | esi reserved : set as 1 |
648 | esi reserved : set as 1 |
643 | edi pointer to return area |
649 | edi pointer to return area |
644 | *********************************************************/ |
650 | *********************************************************/ |
645 | 651 | ||
646 | /********************************************************* |
652 | /********************************************************* |
647 | 35 = READ SCREEN PIXEL |
653 | 35 = READ SCREEN PIXEL |
648 | ebx = pixel count from top left of the screen |
654 | ebx = pixel count from top left of the screen |
649 | return : eax = 0x00RRGGBB |
655 | return : eax = 0x00RRGGBB |
650 | *********************************************************/ |
656 | *********************************************************/ |
651 | 657 | ||
652 | inline fastcall dword sys_read_pixel(dword EBX) |
658 | inline fastcall dword sys_read_pixel(dword EBX) |
653 | { |
659 | { |
654 | EAX = 35; |
660 | EAX = 35; |
655 | $int 0x40 |
661 | $int 0x40 |
656 | } |
662 | } |
657 | 663 | ||
658 | 664 | ||
659 | /********************************************************* |
665 | /********************************************************* |
660 | 37 = READ MOUSE POSITION |
666 | 37 = READ MOUSE POSITION |
661 | ebx=0 screen relative |
667 | ebx=0 screen relative |
662 | ebx=1 window relative |
668 | ebx=1 window relative |
663 | ebx=2 buttons pressed |
669 | ebx=2 buttons pressed |
664 | return in eax |
670 | return in eax |
665 | *********************************************************/ |
671 | *********************************************************/ |
666 | 672 | ||
667 | inline fastcall dword sys_read_mouse(dword EBX) |
673 | inline fastcall dword sys_read_mouse(dword EBX) |
668 | { |
674 | { |
669 | EAX = 37; |
675 | EAX = 37; |
670 | $int 0x40 |
676 | $int 0x40 |
671 | } |
677 | } |
672 | 678 | ||
673 | 679 | ||
674 | /********************************************************* |
680 | /********************************************************* |
675 | 38 = DRAW LINE |
681 | 38 = DRAW LINE |
676 | ebx [x start] shl 16 + [x end] |
682 | ebx [x start] shl 16 + [x end] |
677 | ecx [y start] shl 16 + [y end] |
683 | ecx [y start] shl 16 + [y end] |
678 | edx colour 0x00RRGGBB |
684 | edx colour 0x00RRGGBB |
679 | return : nothing changed |
685 | return : nothing changed |
680 | *********************************************************/ |
686 | *********************************************************/ |
681 | 687 | ||
682 | inline fastcall void sys_draw_line(dword EBX, ECX, EDX) |
688 | inline fastcall void sys_draw_line(dword EBX, ECX, EDX) |
683 | { |
689 | { |
684 | EAX = 38; |
690 | EAX = 38; |
685 | $int 0x40 |
691 | $int 0x40 |
686 | } |
692 | } |
687 | 693 | ||
688 | 694 | ||
689 | /********************************************************* |
695 | /********************************************************* |
690 | 39 = GET BACKGROUND |
696 | 39 = GET BACKGROUND |
691 | ebx=1 -> eax=[bgr x size] shl 16 + [bgr y size] |
697 | ebx=1 -> eax=[bgr x size] shl 16 + [bgr y size] |
692 | ebx=2 |
698 | ebx=2 |
693 | ecx= postition of backgrounds memorymap to return in eax |
699 | ecx= postition of backgrounds memorymap to return in eax |
694 | ebx=4 -> eax=1 tiled, eax=2 stretched |
700 | ebx=4 -> eax=1 tiled, eax=2 stretched |
695 | *********************************************************/ |
701 | *********************************************************/ |
696 | 702 | ||
697 | inline fastcall dword sys_get_background(dword EBX, ECX) |
703 | inline fastcall dword sys_get_background(dword EBX, ECX) |
698 | { |
704 | { |
699 | EAX = 39; |
705 | EAX = 39; |
700 | $int 0x40 |
706 | $int 0x40 |
701 | } |
707 | } |
702 | 708 | ||
703 | 709 | ||
704 | /********************************************************* |
710 | /********************************************************* |
705 | 40 = SET BITFIELD FOR WANTED EVENTS |
711 | 40 = SET BITFIELD FOR WANTED EVENTS |
706 | as default: |
712 | as default: |
707 | ebx = 00000000 00000000 00000000 00000111b events: |
713 | ebx = 00000000 00000000 00000000 00000111b events: |
708 | I window draw |
714 | I window draw |
709 | I key in buffer |
715 | I key in buffer |
710 | I button in buffer |
716 | I button in buffer |
711 | I (end request) |
717 | I (end request) |
712 | I desktop background draw |
718 | I desktop background draw |
713 | I mouse change |
719 | I mouse change |
714 | I IPC message |
720 | I IPC message |
715 | I stack |
721 | I stack |
716 | I---------------I get irqs data |
722 | I---------------I get irqs data |
717 | 723 | ||
718 | *********************************************************/ |
724 | *********************************************************/ |
719 | 725 | ||
720 | //sys_set_event_mask() |
726 | //sys_set_event_mask() |
721 | //{ |
727 | //{ |
722 | //} |
728 | //} |
723 | 729 | ||
724 | /********************************************************* |
730 | /********************************************************* |
725 | 41 = GET IRQ OWNER |
731 | 41 = GET IRQ OWNER |
726 | ebx = irq |
732 | ebx = irq |
727 | return : PID of the process |
733 | return : PID of the process |
728 | *********************************************************/ |
734 | *********************************************************/ |
729 | 735 | ||
730 | /********************************************************* |
736 | /********************************************************* |
731 | 42 = GET DATA READ BY IRQ |
737 | 42 = GET DATA READ BY IRQ |
732 | ebx IRQ number |
738 | ebx IRQ number |
733 | return : eax number of bytes in buffer |
739 | return : eax number of bytes in buffer |
734 | bl data |
740 | bl data |
735 | ecx 0 = successful data read |
741 | ecx 0 = successful data read |
736 | 1 = no data in buffer |
742 | 1 = no data in buffer |
737 | 2 = incorrect IRQ owner |
743 | 2 = incorrect IRQ owner |
738 | *********************************************************/ |
744 | *********************************************************/ |
739 | 745 | ||
740 | /********************************************************* |
746 | /********************************************************* |
741 | 43 = SEND/READ DATA TO/FROM DEVICE |
747 | 43 = SEND/READ DATA TO/FROM DEVICE |
742 | 748 | ||
743 | SEND: |
749 | SEND: |
744 | 750 | ||
745 | bl : data |
751 | bl : data |
746 | cx : port |
752 | cx : port |
747 | 753 | ||
748 | return: eax: status of read ( 0 if successful, other if error ) |
754 | return: eax: status of read ( 0 if successful, other if error ) |
749 | 755 | ||
750 | READ: |
756 | READ: |
751 | 757 | ||
752 | ecx : bit 31 set + port |
758 | ecx : bit 31 set + port |
753 | 759 | ||
754 | return: eax: 0 status of read ( 0 if successful, other if error ) |
760 | return: eax: 0 status of read ( 0 if successful, other if error ) |
755 | ebx: low 8 bits : value |
761 | ebx: low 8 bits : value |
756 | *********************************************************/ |
762 | *********************************************************/ |
757 | 763 | ||
758 | inline fastcall dword sys_read_port(word CX) |
764 | inline fastcall dword sys_read_port(word CX) |
759 | { |
765 | { |
760 | EAX = 43; |
766 | EAX = 43; |
761 | ECX |= 0x80000000; // set bit 31 |
767 | ECX |= 0x80000000; // set bit 31 |
762 | $int 0x40 |
768 | $int 0x40 |
763 | } |
769 | } |
764 | 770 | ||
765 | inline fastcall dword sys_read_port_fast(dword ECX) |
771 | inline fastcall dword sys_read_port_fast(dword ECX) |
766 | { |
772 | { |
767 | EAX = 43; |
773 | EAX = 43; |
768 | $int 0x40 |
774 | $int 0x40 |
769 | } |
775 | } |
770 | 776 | ||
771 | inline fastcall dword sys_write_port(word CX,byte BL) |
777 | inline fastcall dword sys_write_port(word CX,byte BL) |
772 | { |
778 | { |
773 | EAX = 43; |
779 | EAX = 43; |
774 | $int 0x40 |
780 | $int 0x40 |
775 | } |
781 | } |
776 | 782 | ||
777 | 783 | ||
778 | /********************************************************* |
784 | /********************************************************* |
779 | 44 = PROGRAM IRQ's |
785 | 44 = PROGRAM IRQ's |
780 | ebx pointer to table |
786 | ebx pointer to table |
781 | ecx irq number |
787 | ecx irq number |
782 | *********************************************************/ |
788 | *********************************************************/ |
783 | 789 | ||
784 | inline fastcall void sys_program_irqs(dword EBX,ECX) |
790 | inline fastcall void sys_program_irqs(dword EBX,ECX) |
785 | { |
791 | { |
786 | EAX = 44; |
792 | EAX = 44; |
787 | $int 0x40 |
793 | $int 0x40 |
788 | } |
794 | } |
789 | 795 | ||
790 | 796 | ||
791 | /********************************************************* |
797 | /********************************************************* |
792 | 45 = RESERVE/FREE IRQ |
798 | 45 = RESERVE/FREE IRQ |
793 | ebx 0 reserve 1 free |
799 | ebx 0 reserve 1 free |
794 | ecx IRQ number |
800 | ecx IRQ number |
795 | 801 | ||
796 | ret eax 0 successful, 1 error |
802 | ret eax 0 successful, 1 error |
797 | *********************************************************/ |
803 | *********************************************************/ |
798 | 804 | ||
799 | inline fastcall dword sys_reserve_irq(dword ECX) |
805 | inline fastcall dword sys_reserve_irq(dword ECX) |
800 | { |
806 | { |
801 | EAX = 45; |
807 | EAX = 45; |
802 | EBX = 0; |
808 | EBX = 0; |
803 | $int 0x40 |
809 | $int 0x40 |
804 | } |
810 | } |
805 | 811 | ||
806 | inline fastcall dword sys_free_irq(dword ECX) |
812 | inline fastcall dword sys_free_irq(dword ECX) |
807 | { |
813 | { |
808 | EAX = 45; |
814 | EAX = 45; |
809 | EBX = 1; |
815 | EBX = 1; |
810 | $int 0x40 |
816 | $int 0x40 |
811 | } |
817 | } |
812 | 818 | ||
813 | 819 | ||
814 | /********************************************************* |
820 | /********************************************************* |
815 | 46 = RESERVE/FREE PORT AREA |
821 | 46 = RESERVE/FREE PORT AREA |
816 | ebx 0 reserve 1 free |
822 | ebx 0 reserve 1 free |
817 | ecx port area start |
823 | ecx port area start |
818 | edx port area end |
824 | edx port area end |
819 | ret eax 0 successful, 1 error |
825 | ret eax 0 successful, 1 error |
820 | *********************************************************/ |
826 | *********************************************************/ |
821 | 827 | ||
822 | inline fastcall dword sys_reserve_port_area(dword ECX,EDX) |
828 | inline fastcall dword sys_reserve_port_area(dword ECX,EDX) |
823 | { |
829 | { |
824 | EAX = 46; |
830 | EAX = 46; |
825 | EBX = 0; |
831 | EBX = 0; |
826 | $int 0x40 |
832 | $int 0x40 |
827 | } |
833 | } |
828 | 834 | ||
829 | inline fastcall dword sys_free_port_area() |
835 | inline fastcall dword sys_free_port_area() |
830 | { |
836 | { |
831 | EAX = 46; |
837 | EAX = 46; |
832 | EBX = 1; |
838 | EBX = 1; |
833 | $int 0x40 |
839 | $int 0x40 |
834 | } |
840 | } |
835 | 841 | ||
836 | 842 | ||
837 | /********************************************************* |
843 | /********************************************************* |
838 | 47 = DISPLAY NUMBER TO WINDOW |
844 | 47 = DISPLAY NUMBER TO WINDOW |
839 | ebx = print type, bl=0 -> ecx is number |
845 | ebx = print type, bl=0 -> ecx is number |
840 | bl=1 -> ecx is pointer |
846 | bl=1 -> ecx is pointer |
841 | bh=0 -> display decimal |
847 | bh=0 -> display decimal |
842 | bh=1 -> display hexadecimal |
848 | bh=1 -> display hexadecimal |
843 | bh=2 -> display binary |
849 | bh=2 -> display binary |
844 | bits 16-21 = number of digits to display (0-32) |
850 | bits 16-21 = number of digits to display (0-32) |
845 | bits 22-31 = reserved |
851 | bits 22-31 = reserved |
846 | ecx = number or pointer |
852 | ecx = number or pointer |
847 | edx = x shl 16 + y |
853 | edx = x shl 16 + y |
848 | esi = color |
854 | esi = color |
849 | *********************************************************/ |
855 | *********************************************************/ |
850 | inline fastcall void sys_write_number(dword EBX, ECX, EDX, ESI) |
856 | inline fastcall void sys_write_number(dword EBX, ECX, EDX, ESI) |
851 | { |
857 | { |
852 | EAX = 47; |
858 | EAX = 47; |
853 | $int 0x40 |
859 | $int 0x40 |
854 | } |
860 | } |
855 | 861 | ||
856 | 862 | ||
857 | /********************************************************* |
863 | /********************************************************* |
858 | 48 = DEFINE GENERAL WINDOW PROPERTIES |
864 | 48 = DEFINE GENERAL WINDOW PROPERTIES |
859 | ebx = 0 apply/redraw |
865 | ebx = 0 apply/redraw |
860 | ecx = 0 , apply/redraw desktop |
866 | ecx = 0 , apply/redraw desktop |
861 | ebx = 1 define button style |
867 | ebx = 1 define button style |
862 | ecx = 0 , set flat buttons |
868 | ecx = 0 , set flat buttons |
863 | ecx = 1 , set 3d buttons |
869 | ecx = 1 , set 3d buttons |
864 | ebx = 2 define window colors |
870 | ebx = 2 define window colors |
865 | ecx = pointer to table |
871 | ecx = pointer to table |
866 | edx = number of bytes defined |
872 | edx = number of bytes defined |
867 | ebx = 3 get define window colors |
873 | ebx = 3 get define window colors |
868 | ecx = pointer to table |
874 | ecx = pointer to table |
869 | edx = number of bytes to get |
875 | edx = number of bytes to get |
870 | ebx = 4 get window skin height |
876 | ebx = 4 get window skin height |
871 | *********************************************************/ |
877 | *********************************************************/ |
872 | 878 | ||
873 | inline fastcall void sys_redraw_desktop() |
879 | inline fastcall void sys_redraw_desktop() |
874 | { |
880 | { |
875 | EAX = 48; |
881 | EAX = 48; |
876 | EBX = ECX = 0; |
882 | EBX = ECX = 0; |
877 | $int 0x40 |
883 | $int 0x40 |
878 | } |
884 | } |
879 | 885 | ||
880 | inline fastcall void sys_set_button_style(dword ECX) |
886 | inline fastcall void sys_set_button_style(dword ECX) |
881 | { |
887 | { |
882 | EAX = 48; |
888 | EAX = 48; |
883 | EBX = 1; |
889 | EBX = 1; |
884 | $int 0x40 |
890 | $int 0x40 |
885 | } |
891 | } |
886 | 892 | ||
887 | inline fastcall void sys_set_colors(dword ECX,EDX) |
893 | inline fastcall void sys_set_colors(dword ECX,EDX) |
888 | { |
894 | { |
889 | EAX = 48; |
895 | EAX = 48; |
890 | EBX = 2; |
896 | EBX = 2; |
891 | $int 0x40 |
897 | $int 0x40 |
892 | } |
898 | } |
893 | 899 | ||
894 | inline fastcall void sys_get_colors(dword ECX,EDX) |
900 | inline fastcall void sys_get_colors(dword ECX,EDX) |
895 | { |
901 | { |
896 | EAX = 48; |
902 | EAX = 48; |
897 | EBX = 3; |
903 | EBX = 3; |
898 | $int 0x40 |
904 | $int 0x40 |
899 | } |
905 | } |
900 | 906 | ||
901 | inline fastcall dword sys_get_skin_height() |
907 | inline fastcall dword sys_get_skin_height() |
902 | { |
908 | { |
903 | EAX = 48; |
909 | EAX = 48; |
904 | EBX = 4; |
910 | EBX = 4; |
905 | $int 0x40 |
911 | $int 0x40 |
906 | } |
912 | } |
907 | 913 | ||
908 | 914 | ||
909 | /********************************************************* |
915 | /********************************************************* |
910 | 50 = FREE FORM WINDOW SHAPE AND SCALE |
916 | 50 = FREE FORM WINDOW SHAPE AND SCALE |
911 | ebx = 0 ; shape reference area |
917 | ebx = 0 ; shape reference area |
912 | ecx = pointer to reference area |
918 | ecx = pointer to reference area |
913 | byte per pixel, 0 not used, 1=used, other = reserved |
919 | byte per pixel, 0 not used, 1=used, other = reserved |
914 | ebx = 1 ; scale of reference area (default 1:1) |
920 | ebx = 1 ; scale of reference area (default 1:1) |
915 | ecx : scale is set to 2^ecx |
921 | ecx : scale is set to 2^ecx |
916 | return: nothing changed |
922 | return: nothing changed |
917 | *********************************************************/ |
923 | *********************************************************/ |
918 | 924 | ||
919 | inline void sys_freeform_window(dword EBX,ECX) |
925 | inline void sys_freeform_window(dword EBX,ECX) |
920 | { |
926 | { |
921 | EAX = 50; |
927 | EAX = 50; |
922 | $int 0x40 |
928 | $int 0x40 |
923 | } |
929 | } |
924 | 930 | ||
925 | 931 | ||
926 | /********************************************************* |
932 | /********************************************************* |
927 | 51 = CREATE THREAD |
933 | 51 = CREATE THREAD |
928 | ebx = 1 ; create |
934 | ebx = 1 ; create |
929 | ecx ; = thread entry point |
935 | ecx ; = thread entry point |
930 | edx ; = thread stack position |
936 | edx ; = thread stack position |
931 | return : eax = pid or 0xfffffff0+ for error |
937 | return : eax = pid or 0xfffffff0+ for error |
932 | *********************************************************/ |
938 | *********************************************************/ |
933 | 939 | ||
934 | inline fastcall dword sys_create_thread(dword ECX,EDX) |
940 | inline fastcall dword sys_create_thread(dword ECX,EDX) |
935 | { |
941 | { |
936 | EAX = 51; |
942 | EAX = 51; |
937 | EBX = 1; |
943 | EBX = 1; |
938 | $int 0x40 |
944 | $int 0x40 |
939 | } |
945 | } |
940 | 946 | ||
941 | 947 | ||
942 | /********************************************************* |
948 | /********************************************************* |
943 | 52 = STACK DRIVER STATUS |
949 | 52 = STACK DRIVER STATUS |
944 | - see stack.txt |
950 | - see stack.txt |
945 | net.h-- |
951 | net.h-- |
946 | 952 | ||
947 | 953 | ||
948 | 53 = SOCKET INTERFACE |
954 | 53 = SOCKET INTERFACE |
949 | - see stack.txt |
955 | - see stack.txt |
950 | net.h-- |
956 | net.h-- |
951 | *********************************************************/ |
957 | *********************************************************/ |
952 | 958 | ||
953 | 959 | ||
954 | /********************************************************* |
960 | /********************************************************* |
955 | 55 = SOUND INTERFACE |
961 | 55 = SOUND INTERFACE |
956 | 962 | ||
957 | ebx = 0 ; load sound block |
963 | ebx = 0 ; load sound block |
958 | ecx = ; pointer to (default size 65536 byte) soundblock |
964 | ecx = ; pointer to (default size 65536 byte) soundblock |
959 | 965 | ||
960 | ebx = 1 ; play (default 44 khz 8 bit mono) sound block |
966 | ebx = 1 ; play (default 44 khz 8 bit mono) sound block |
961 | 967 | ||
962 | ebx = 2 ; set format |
968 | ebx = 2 ; set format |
963 | ecx = 1 ; set play block length |
969 | ecx = 1 ; set play block length |
964 | edx = ; block length |
970 | edx = ; block length |
965 | *********************************************************/ |
971 | *********************************************************/ |
966 | 972 | ||
967 | inline fastcall void sys_sound_load(dword ECX) |
973 | inline fastcall void sys_sound_load(dword ECX) |
968 | { |
974 | { |
969 | EAX = 55; |
975 | EAX = 55; |
970 | EBX = 0; |
976 | EBX = 0; |
971 | $int 0x40 |
977 | $int 0x40 |
972 | } |
978 | } |
973 | 979 | ||
974 | inline fastcall void sys_sound_play() |
980 | inline fastcall void sys_sound_play() |
975 | { |
981 | { |
976 | EAX = 55; |
982 | EAX = 55; |
977 | EBX = 1; |
983 | EBX = 1; |
978 | $int 0x40 |
984 | $int 0x40 |
979 | } |
985 | } |
980 | 986 | ||
981 | inline fastcall void sys_sound_format_length(dword EDX) |
987 | inline fastcall void sys_sound_format_length(dword EDX) |
982 | { |
988 | { |
983 | EAX = 55; |
989 | EAX = 55; |
984 | EBX = 2; |
990 | EBX = 2; |
985 | ECX = 1; |
991 | ECX = 1; |
986 | $int 0x40 |
992 | $int 0x40 |
987 | } |
993 | } |
988 | 994 | ||
989 | 995 | ||
990 | /********************************************************* |
996 | /********************************************************* |
991 | 56 = WRITE FILE TO HD |
997 | 56 = WRITE FILE TO HD |
992 | ebx pointer to 12 char filename |
998 | ebx pointer to 12 char filename |
993 | ecx bytes to write |
999 | ecx bytes to write |
994 | edx pointer to data to write |
1000 | edx pointer to data to write |
995 | esi pointer to path |
1001 | esi pointer to path |
996 | path db 0 |
1002 | path db 0 |
997 | *********************************************************/ |
1003 | *********************************************************/ |
998 | 1004 | ||
999 | 1005 | ||
1000 | /********************************************************* |
1006 | /********************************************************* |
1001 | 57 = DELETE FILE FROM HD |
1007 | 57 = DELETE FILE FROM HD |
1002 | ebx pointer to filename : 11 capital letters |
1008 | ebx pointer to filename : 11 capital letters |
1003 | edx pointer to path : path db 0 |
1009 | edx pointer to path : path db 0 |
1004 | *********************************************************/ |
1010 | *********************************************************/ |
1005 | 1011 | ||
1006 | 1012 | ||
1007 | /********************************************************* |
1013 | /********************************************************* |
1008 | 58 = SYSTEM TREE ACCESS |
1014 | 58 = SYSTEM TREE ACCESS |
1009 | ebx pointer to fileinfo block |
1015 | ebx pointer to fileinfo block |
1010 | fileinfo: |
1016 | fileinfo: |
1011 | dd 0x0 ; 0=read (/write/delete/append) |
1017 | dd 0x0 ; 0=read (/write/delete/append) |
1012 | dd 0x0 ; 512 block to read 0+ |
1018 | dd 0x0 ; 512 block to read 0+ |
1013 | dd 0x1 ; blocks to read (/bytes to write/append) |
1019 | dd 0x1 ; blocks to read (/bytes to write/append) |
1014 | dd 0x20000 ; return data pointer |
1020 | dd 0x20000 ; return data pointer |
1015 | dd 0x10000 ; work area for os - 16384 bytes |
1021 | dd 0x10000 ; work area for os - 16384 bytes |
1016 | db '/RAMDISK/FIRST/KERNEL.ASM',0 ; ASCIIZ dir & filename |
1022 | db '/RAMDISK/FIRST/KERNEL.ASM',0 ; ASCIIZ dir & filename |
1017 | *********************************************************/ |
1023 | *********************************************************/ |
1018 | inline fastcall void sys_tree_access(dword EBX) |
1024 | inline fastcall void sys_tree_access(dword EBX) |
1019 | { |
1025 | { |
1020 | EAX = 58; |
1026 | EAX = 58; |
1021 | $int 0x40 |
1027 | $int 0x40 |
1022 | } |
1028 | } |
1023 | 1029 | ||
1024 | 1030 | ||
1025 | /********************************************************* |
1031 | /********************************************************* |
1026 | 59 = TRACE FOR SYSTEM CALLS FROM PROCESSES |
1032 | 59 = TRACE FOR SYSTEM CALLS FROM PROCESSES |
1027 | ebx = 0 ; get system events |
1033 | ebx = 0 ; get system events |
1028 | ecx ; pointer to table -> ; 64 bytes/system call descriptor |
1034 | ecx ; pointer to table -> ; 64 bytes/system call descriptor |
1029 | ; +00 PID |
1035 | ; +00 PID |
1030 | ; +32 EDI |
1036 | ; +32 EDI |
1031 | ; +36 ESI |
1037 | ; +36 ESI |
1032 | ; +40 EBP |
1038 | ; +40 EBP |
1033 | ; +44 ESP |
1039 | ; +44 ESP |
1034 | ; +48 EBX |
1040 | ; +48 EBX |
1035 | ; +52 EDX |
1041 | ; +52 EDX |
1036 | ; +56 ECX |
1042 | ; +56 ECX |
1037 | ; +60 EAX |
1043 | ; +60 EAX |
1038 | edx ; number of bytes to return to table (currently max 16*64) |
1044 | edx ; number of bytes to return to table (currently max 16*64) |
1039 | return: eax = number of system calls from start |
1045 | return: eax = number of system calls from start |
1040 | latest call is saved to (eax mod 16)*64 in table |
1046 | latest call is saved to (eax mod 16)*64 in table |
1041 | ebx = 0 : above format |
1047 | ebx = 0 : above format |
1042 | *********************************************************/ |
1048 | *********************************************************/ |
1043 | 1049 | ||
1044 | inline fastcall void sys_syscall_trace(dword ECX,EDX) |
1050 | inline fastcall void sys_syscall_trace(dword ECX,EDX) |
1045 | { |
1051 | { |
1046 | EAX = 59; |
1052 | EAX = 59; |
1047 | EBX = 0; |
1053 | EBX = 0; |
1048 | $int 0x40 |
1054 | $int 0x40 |
1049 | } |
1055 | } |
1050 | 1056 | ||
1051 | 1057 | ||
1052 | /********************************************************* |
1058 | /********************************************************* |
1053 | 60 = IPC |
1059 | 60 = IPC |
1054 | ebx = 1 ; define receive area |
1060 | ebx = 1 ; define receive area |
1055 | ecx = pointer to start |
1061 | ecx = pointer to start |
1056 | edx = size of area |
1062 | edx = size of area |
1057 | 1063 | ||
1058 | ebx = 2 ; send message |
1064 | ebx = 2 ; send message |
1059 | ecx = PID |
1065 | ecx = PID |
1060 | edx = pointer to message |
1066 | edx = pointer to message |
1061 | esi = length |
1067 | esi = length |
1062 | *********************************************************/ |
1068 | *********************************************************/ |
1063 | 1069 | ||
1064 | inline fastcall void sys_ipc_init(dword ECX, EDX) |
1070 | inline fastcall void sys_ipc_init(dword ECX, EDX) |
1065 | { |
1071 | { |
1066 | EAX = 60; |
1072 | EAX = 60; |
1067 | EBX = 1; |
1073 | EBX = 1; |
1068 | $int 0x40 |
1074 | $int 0x40 |
1069 | } |
1075 | } |
1070 | 1076 | ||
1071 | inline fastcall void sys_ipc_send(dword ECX, EDX, ESI) |
1077 | inline fastcall void sys_ipc_send(dword ECX, EDX, ESI) |
1072 | { |
1078 | { |
1073 | EAX = 60; |
1079 | EAX = 60; |
1074 | EBX = 2; |
1080 | EBX = 2; |
1075 | $int 0x40 |
1081 | $int 0x40 |
1076 | } |
1082 | } |
1077 | 1083 | ||
1078 | 1084 | ||
1079 | /********************************************************* |
1085 | /********************************************************* |
1080 | 63 = GENERAL DEBUG BOARD |
1086 | 63 = GENERAL DEBUG BOARD |
1081 | 1087 | ||
1082 | ebx = 1 write byte in cl |
1088 | ebx = 1 write byte in cl |
1083 | ebx = 2 read byte : ebx = 1 -> byte in al ; ebx = 0 -> no data |
1089 | ebx = 2 read byte : ebx = 1 -> byte in al ; ebx = 0 -> no data |
1084 | *********************************************************/ |
1090 | *********************************************************/ |
1085 | 1091 | ||
1086 | inline fastcall void sys_debug_write_char(byte CL) |
1092 | inline fastcall void sys_debug_write_char(byte CL) |
1087 | { |
1093 | { |
1088 | EAX = 63; |
1094 | EAX = 63; |
1089 | EBX = 1; |
1095 | EBX = 1; |
1090 | $int 0x40 |
1096 | $int 0x40 |
1091 | } |
1097 | } |
1092 | 1098 | ||
1093 | :fastcall void sys_debug_write_string(dword ESI) |
1099 | :fastcall void sys_debug_write_string(dword ESI) |
1094 | { |
1100 | { |
1095 | $pusha |
1101 | $pusha |
1096 | CL = DSBYTE[ESI]; |
1102 | CL = DSBYTE[ESI]; |
1097 | while(CL!=0) |
1103 | while(CL!=0) |
1098 | { |
1104 | { |
1099 | sys_debug_write_char(CL); |
1105 | sys_debug_write_char(CL); |
1100 | ESI++; |
1106 | ESI++; |
1101 | CL = DSBYTE[ESI]; |
1107 | CL = DSBYTE[ESI]; |
1102 | } |
1108 | } |
1103 | $popa |
1109 | $popa |
1104 | } |
1110 | } |
1105 | 1111 | ||
1106 | inline fastcall dword sys_debug_read_char(dword EBX) |
1112 | inline fastcall dword sys_debug_read_char(dword EBX) |
1107 | { |
1113 | { |
1108 | EAX = 63; |
1114 | EAX = 63; |
1109 | EBX = 2; |
1115 | EBX = 2; |
1110 | $int 0x40 |
1116 | $int 0x40 |
1111 | } |
1117 | } |
1112 | 1118 | ||
1113 | 1119 | ||
1114 | inline fastcall dword window_move_size(dword EBX,ECX,EDX,ESI){ |
1120 | inline fastcall dword window_move_size(dword EBX,ECX,EDX,ESI){ |
1115 | EAX = 67; |
1121 | EAX = 67; |
1116 | $int 0x40 |
1122 | $int 0x40 |
1117 | } |
1123 | } |
1118 | 1124 | ||
1119 | 1125 | ||
1120 | /********************************************************* |
1126 | /********************************************************* |
1121 | -1 = EXIT PROCESS |
1127 | -1 = EXIT PROCESS |
1122 | *********************************************************/ |
1128 | *********************************************************/ |
1123 | 1129 | ||
1124 | inline fastcall void sys_exit_process() |
1130 | inline fastcall void sys_exit_process() |
1125 | { |
1131 | { |
1126 | $or eax,0xffffffff |
1132 | $or eax,0xffffffff |
1127 | $int 0x40 |
1133 | $int 0x40 |
1128 | }>-> |
1134 | }>-> |