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