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