Go to most recent revision | Details | 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. |
||
4 | This extended version is written by Ivan Poddubny. |
||
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 | |||
27 | #define evReDraw 1 |
||
28 | #define evKey 2 |
||
29 | #define evButton 3 |
||
30 | #define evMouse 6 |
||
31 | #define evIPC 7 |
||
32 | |||
33 | struct FileInfo |
||
34 | { |
||
35 | dword read, |
||
36 | firstBlock, |
||
37 | qnBlockRead, |
||
38 | retPtr, |
||
39 | Work; |
||
40 | byte filedir; |
||
41 | }; |
||
42 | |||
43 | struct ProcessInfo |
||
44 | { |
||
45 | dword cpu_usage; |
||
46 | word winstackpos; |
||
47 | word winstackval; |
||
48 | word not_used1; |
||
49 | byte name[12]; |
||
50 | dword memstart, |
||
51 | memory_used, |
||
52 | PID, |
||
53 | xstart, |
||
54 | ystart, |
||
55 | xsize, |
||
56 | ysize; |
||
57 | byte not_used2[974]; |
||
58 | }; |
||
59 | |||
60 | #define SystemColors SystemColours // usa/british |
||
61 | |||
62 | struct SystemColours |
||
63 | { |
||
64 | dword w_frames, |
||
65 | w_grab, |
||
66 | w_grab_button, |
||
67 | w_grab_button_text, |
||
68 | w_grab_text, |
||
69 | w_work, |
||
70 | w_work_button, |
||
71 | w_work_button_text, |
||
72 | w_work_text, |
||
73 | w_work_graph; |
||
74 | }; |
||
75 | |||
76 | /* |
||
77 | |||
78 | {x_start|y_start}, {x_size|y_size}, color_back, color_title, color_frames |
||
79 | EBX = [x_start][x_size] |
||
80 | ECX = [y_start][y_size] |
||
81 | EDX, ESI, EDI = [00RRGGBB] |
||
82 | */ |
||
83 | inline fastcall void sys_draw_window(dword EBX, ECX, EDX, ESI, EDI) |
||
84 | { |
||
85 | EAX = 0; // function 0 : define and draw window |
||
86 | $int 0x40 |
||
87 | } |
||
88 | |||
89 | /* |
||
90 | 01 = PUTPIXEL |
||
91 | ebx [x] |
||
92 | ecx [y] |
||
93 | edx pixel color 0x0XRRGGBB |
||
94 | ^ 0 normal put, 1 negative |
||
95 | ret: nothing changed |
||
96 | */ |
||
97 | inline fastcall void sys_put_pixel(dword EBX,ECX,EDX) |
||
98 | { |
||
99 | EAX=1; |
||
100 | $int 0x40 |
||
101 | } |
||
102 | |||
103 | /* |
||
104 | 02 = GET KEY |
||
105 | ret: al 0 successful -> ah = key |
||
106 | al 1 no key in buffer |
||
107 | MODIFIED, see below... |
||
108 | */ |
||
109 | inline fastcall dword sys_get_key() |
||
110 | { |
||
111 | EAX = 2; // just read it key from buffer |
||
112 | $int 0x40 |
||
113 | $shr eax,8 |
||
114 | } //return eax=key code. |
||
115 | |||
116 | /* |
||
117 | 03 = GET SYSTEM CLOCK |
||
118 | ret: eax 0x00SSMMHH sec,min,hour |
||
119 | */ |
||
120 | inline fastcall dword sys_get_clock() |
||
121 | { |
||
122 | EAX=3; |
||
123 | $int 0x40 |
||
124 | } |
||
125 | |||
126 | /* |
||
127 | 04 = WRITE TEXT TO WINDOW |
||
128 | ebx [x start]*65536 + [y start] |
||
129 | ecx text color 0x00RRGGBB |
||
130 | edx pointer to text beginning |
||
131 | esi text length |
||
132 | ret: nothing changed |
||
133 | */ |
||
134 | inline fastcall void sys_write_text(dword EBX, ECX, EDX, ESI) |
||
135 | { |
||
136 | EAX = 4; |
||
137 | $int 0x40; |
||
138 | } |
||
139 | |||
140 | /* |
||
141 | 05 = DELAY X/100 SECS |
||
142 | ebx delay in 1/100 secs |
||
143 | ret: nothing changed |
||
144 | */ |
||
145 | inline fastcall void sys_delay(dword EBX) |
||
146 | { |
||
147 | EAX = 5; |
||
148 | $int 0x40 |
||
149 | } |
||
150 | |||
151 | /* |
||
152 | 06 = OPEN FILE FROM FLOPPY |
||
153 | ebx pointer to filename -> 11 capital letters |
||
154 | ecx set 0x00000000 - reserved |
||
155 | edx set 0xffffffff - reserved |
||
156 | esi read to mem position |
||
157 | ret: nothing changed |
||
158 | */ |
||
159 | inline fastcall void sys_open_file_floppy(dword EBX, ESI) |
||
160 | { |
||
161 | $xor ecx,ecx |
||
162 | EDX = -1; |
||
163 | EAX = 6; |
||
164 | $int 0x40 |
||
165 | } |
||
166 | |||
167 | /* |
||
168 | 07 = PUTIMAGE |
||
169 | ebx pointer to image in memory - RRGGBBRRGGBB.. |
||
170 | ecx image size [x]*65536+[y] |
||
171 | edx image position in window [x]*65536+[y] |
||
172 | ret: eax 0 succesful, 1 overlapped |
||
173 | */ |
||
174 | inline fastcall dword sys_put_image(dword EBX, ECX, EDX) |
||
175 | { |
||
176 | EAX = 7; |
||
177 | $int 0x40 |
||
178 | } |
||
179 | |||
180 | /* |
||
181 | 08 = DEFINE BUTTON |
||
182 | ebx [x start]*65536 + [x size] |
||
183 | ecx [y start]*65536 + [y size] |
||
184 | edx button id number |
||
185 | esi button color 0x 00 RR GG BB |
||
186 | ret: nothing changed |
||
187 | */ |
||
188 | inline fastcall void sys_draw_button(dword EBX, ECX, EDX, ESI) |
||
189 | { |
||
190 | EAX = 8; |
||
191 | $int 0x40 |
||
192 | } |
||
193 | |||
194 | /* |
||
195 | 09 = PROCESS INFO |
||
196 | ebx pointer to 1024 bytes table |
||
197 | ecx process number or -1 = who am I |
||
198 | ret: eax number of processes |
||
199 | table : +00 dword cpu usage |
||
200 | +04 word processes position in windowing stack |
||
201 | +06 word window stack value at ecx |
||
202 | +10 12 db name of the process |
||
203 | +22 dword start of processes memory |
||
204 | +26 dword memory used by process |
||
205 | +30 dword PID of the process |
||
206 | +34 dword window x start |
||
207 | +38 dword window y start |
||
208 | +42 dword window x size |
||
209 | +46 dword window y size |
||
210 | */ |
||
211 | inline fastcall dword sys_process_info(dword EBX, ECX) |
||
212 | { |
||
213 | EAX = 9; |
||
214 | $int 0x40 |
||
215 | } |
||
216 | |||
217 | /* |
||
218 | 10 = WAIT FOR EVENT |
||
219 | ret: eax event type, 1 window redraw, 2 key in buffer, 3 button pressed |
||
220 | */ |
||
221 | inline fastcall dword sys_wait_event() |
||
222 | { |
||
223 | EAX = 10; // wait here for event |
||
224 | $int 0x40 |
||
225 | } |
||
226 | |||
227 | /* |
||
228 | 11 = CHECK FOR EVENT, NO WAIT |
||
229 | ret: eax 0 no event, 1 window redraw, 2 key in buffer, 3 button pressed |
||
230 | */ |
||
231 | inline fastcall dword sys_nowait_event() |
||
232 | { |
||
233 | EAX = 11; |
||
234 | $int 0x40 |
||
235 | } |
||
236 | |||
237 | /* 12 = WINDOW REDRAW |
||
238 | EBX=1 start of draw, =2 end of draw. |
||
239 | */ |
||
240 | inline fastcall void sys_window_redraw(dword EBX) |
||
241 | { |
||
242 | EAX = 12; // function 12:tell os about windowdraw |
||
243 | $int 0x40 |
||
244 | } |
||
245 | |||
246 | /* |
||
247 | 13 = DRAW BAR |
||
248 | DrawBar(EBX=[xstart][xsize],ECX=[ystart][ysize],EDX=[0x00RRGGBB]) |
||
249 | ebx [x start]*65536 + [x size] |
||
250 | ecx [y start]*65536 + [y size] |
||
251 | edx color 0x00RRGGBB |
||
252 | ret: nothing changed |
||
253 | */ |
||
254 | inline fastcall void sys_draw_bar(dword EBX, ECX, EDX) |
||
255 | { |
||
256 | EAX = 13; |
||
257 | $int 0x40 |
||
258 | } |
||
259 | |||
260 | /* |
||
261 | 14 = GET SCREEN MAX |
||
262 | ret: eax [screen x max]*65536 + [screen y max] |
||
263 | */ |
||
264 | inline fastcall dword sys_get_screen_size() |
||
265 | { |
||
266 | EAX = 14; |
||
267 | $int 0x40 |
||
268 | } |
||
269 | |||
270 | /* |
||
271 | 15 = BACKGROUND |
||
272 | ebx 1 : set background size |
||
273 | ecx x size |
||
274 | edx y size |
||
275 | ebx 2 : write to background memory - max (0x100000-16) |
||
276 | ecx position in memory in bytes |
||
277 | edx color 0x00RRGGBB |
||
278 | ebx 3 : draw background |
||
279 | ebx 4 : type of background draw |
||
280 | ecx 1 - tile |
||
281 | ecx 2 - stretch |
||
282 | ebx 5 : blockmove image to os bgr memory |
||
283 | ecx - from |
||
284 | edx - to where in os bgr memory |
||
285 | esi - count of bytes to move |
||
286 | */ |
||
287 | inline fastcall void sys_set_background(dword EBX, ECX, EDX, ESI) |
||
288 | { |
||
289 | EAX = 15; |
||
290 | $int 0x40 |
||
291 | } |
||
292 | |||
293 | |||
294 | /* |
||
295 | 17 = GET PRESSED BUTTON ID |
||
296 | ret: al 0 successful -> ah = id number al 1 no key in buffer. |
||
297 | MODIFIED, see below. |
||
298 | */ |
||
299 | inline fastcall dword sys_get_button_id() |
||
300 | { |
||
301 | EAX = 17; // Get ID |
||
302 | $int 0x40 |
||
303 | $shr eax,8 |
||
304 | } //eax=id, eax=0 no id. |
||
305 | |||
306 | /* |
||
307 | 18 = SYSTEM SERVICE |
||
308 | ebx 1 - system boot |
||
309 | ebx 2 - force terminate , ecx process no |
||
310 | ebx 4 - idle clock cycles / second |
||
311 | ebx 5 - time stamp counter / second - cpu speed |
||
312 | HD-> ebx 6 - save ramdisk to /hd/1/menuet.img |
||
313 | */ |
||
314 | inline fastcall dword sys_service(dword EBX, ECX) |
||
315 | { |
||
316 | EAX = 18; |
||
317 | $int 0x40 |
||
318 | } |
||
319 | |||
320 | /* |
||
321 | 19 = START PROGRAM from RAMDISK |
||
322 | ebx point to 11 char filename |
||
323 | ecx 0, or point to ASCIIZ start parameters - max 256 bytes |
||
324 | ret: eax 0 successful |
||
325 | eax other error code |
||
326 | */ |
||
327 | inline fastcall dword sys_exec_app_ramdisk(dword EBX, ECX) |
||
328 | { |
||
329 | EAX = 19; |
||
330 | $int 0x40 |
||
331 | } |
||
332 | |||
333 | /* |
||
334 | 20 = MIDI INTERFACE - MPU401 |
||
335 | ebx 1 - reset device |
||
336 | ebx 2 - cl midi data to output |
||
337 | */ |
||
338 | inline fastcall void sys_midi(dword EBX) |
||
339 | { |
||
340 | EAX = 20; |
||
341 | $int 0x40 |
||
342 | } |
||
343 | |||
344 | /* |
||
345 | 21 = SETUP FOR DEVICES |
||
346 | ebx 1=roland mpu midi base , base io address |
||
347 | ebx 2=keyboard 1 base keymap 2 shift keymap (ecx pointer to keymap) |
||
348 | 9 country 1eng 2fi 3ger 4rus |
||
349 | ebx 3=cd base 1 pri.master 2 pri slave, |
||
350 | 3 sec master 4 sec slave |
||
351 | ebx 4=sb16 base, base io address |
||
352 | ebx 5=system language, 1eng 2fi 3ger 4rus |
||
353 | ebx 6=wss base, base io address |
||
354 | ebx 7=hd base, 1 pri.master 2 pri slave |
||
355 | 3 sec master 4 sec slave |
||
356 | ebx 8=fat32 partition in hd |
||
357 | */ |
||
358 | inline fastcall void sys_setup_devices(dword EBX, ECX) |
||
359 | { |
||
360 | EAX = 21; |
||
361 | $int 0x40 |
||
362 | } |
||
363 | |||
364 | /* |
||
365 | 23 = WAIT FOR EVENT WITH TIMEOUT |
||
366 | ebx time to delay in hs |
||
367 | ret: eax event type: 0 no event, 1 window redraw, |
||
368 | 2 key in buffer, 3 button |
||
369 | */ |
||
370 | inline fastcall dword sys_wait_event_timeout(dword EBX) |
||
371 | { |
||
372 | EAX = 23; |
||
373 | $int 0x40 |
||
374 | } |
||
375 | |||
376 | /* |
||
377 | 24 = CD AUDIO |
||
378 | ebx 1 - play from ecx 00 FR SS MM |
||
379 | ebx 2 - get playlist size of ecx to [edx] |
||
380 | ebx 3 - stop/pause play |
||
381 | */ |
||
382 | inline fastcall void sys_cd_audio(dword EBX, ECX, EDX) |
||
383 | { |
||
384 | EAX = 24; |
||
385 | $int 0x40 |
||
386 | } |
||
387 | |||
388 | /* |
||
389 | 25 = SB16 - mixer I |
||
390 | ebx 1 - set main volume cl [L]*16+[R] |
||
391 | ebx 2 - set cd volume cl [L]*16+[R] |
||
392 | */ |
||
393 | inline fastcall void sys_sb16_mixer_1(dword EBX, ECX) |
||
394 | { |
||
395 | EAX = 25; |
||
396 | $int 0x40 |
||
397 | } |
||
398 | |||
399 | /* |
||
400 | 26 = GET SETUP FOR DEVICES |
||
401 | ebx 1=roland mpu midi base , base io address |
||
402 | ebx 2=keyboard 1 base keymap 2 shift keymap |
||
403 | 9 country 1eng 2fi 3ger 4rus |
||
404 | ebx 3=cd base 1 pri.master 2 pri slave, |
||
405 | 3 sec master 4 sec slave |
||
406 | ebx 4=sb16 base, base io address |
||
407 | ebx 5=system language, 1eng 2fi 3ger 4rus |
||
408 | ebx 6=wss base, base io address |
||
409 | ebx 7=hd base, 1 pri.master 2 pri slave |
||
410 | 3 sec master 4 sec slave |
||
411 | ebx 8=fat32 partition in hd |
||
412 | ebx 9=1/100 timer tics from stard -> eax |
||
413 | return value in eax |
||
414 | */ |
||
415 | inline fastcall dword sys_get_setup_devices(dword EBX) |
||
416 | { |
||
417 | EAX = 26; |
||
418 | $int 0x40 |
||
419 | } |
||
420 | |||
421 | /* |
||
422 | 27 = WINDOWS SOUND SYSTEM |
||
423 | ebx 1 - set main volume to cl 0-255 |
||
424 | ebx 2 - set cd volume to cl 0-255 |
||
425 | */ |
||
426 | inline fastcall void sys_windows_sound_system(dword EBX, ECX) |
||
427 | { |
||
428 | EAX = 27; |
||
429 | $int 0x40 |
||
430 | } |
||
431 | |||
432 | /* |
||
433 | 28 = SB16 - mixer II |
||
434 | ebx 1 - set main volume to cl 0-255 |
||
435 | ebx 2 - set cd volume to cl 0-255 |
||
436 | */ |
||
437 | inline fastcall void sys_sb16_mixer_2(dword EBX, ECX) |
||
438 | { |
||
439 | EAX = 28; |
||
440 | $int 0x40 |
||
441 | } |
||
442 | |||
443 | /* |
||
444 | 29 = GET DATE |
||
445 | ret: eax 0x00YYDDMM year date month |
||
446 | */ |
||
447 | inline fastcall dword sys_get_date() |
||
448 | { |
||
449 | EAX = 29; |
||
450 | $int 0x40 |
||
451 | } |
||
452 | |||
453 | /* |
||
454 | 30 = READ HD |
||
455 | ebx pointer to file |
||
456 | ecx file lenght |
||
457 | edx block to read, starts from 1, blocksize = 512 bytes |
||
458 | esi reserved, set as 1 |
||
459 | edi pointer to return/work area (atleast 20 000 bytes) |
||
460 | return: work_area+1024 <- requested block of 512 bytes |
||
461 | */ |
||
462 | inline fastcall dword sys_read_hd(dword EBX, ECX, EDX, ESI, EDI) |
||
463 | { |
||
464 | EAX = 30; |
||
465 | $int 0x40 |
||
466 | } |
||
467 | |||
468 | /* |
||
469 | 31 = START APP FROM HD |
||
470 | ebx pointer to file |
||
471 | ecx file lenght |
||
472 | edx pointer to return/work area (atleast 20 000 bytes) |
||
473 | ret eax=0 successful, eax<>0 errorcode |
||
474 | */ |
||
475 | inline fastcall dword sys_exec_app_hd() |
||
476 | { |
||
477 | EAX = 31; |
||
478 | $int 0x40 |
||
479 | } |
||
480 | |||
481 | /* |
||
482 | 32 = DELETE FILE FROM FLOPPY IMAGE IN MEMORY |
||
483 | ebx pointer to filename |
||
484 | */ |
||
485 | |||
486 | inline fastcall dword sys_floppy_delete(EBX) |
||
487 | { |
||
488 | EAX = 32; |
||
489 | $int 0x40 |
||
490 | } |
||
491 | |||
492 | /* |
||
493 | 33 = SAVE FILE TO FLOPPY IMAGE IN MEMORY |
||
494 | ebx pointer to file name |
||
495 | ecx pointer to data |
||
496 | edx count to write in bytes |
||
497 | esi 0 create new , ( 1 append - not implemented yet ) |
||
498 | */ |
||
499 | inline fastcall dword sys_floppy_save(EBX,ECX,EDX) |
||
500 | { |
||
501 | EAX = 33; |
||
502 | ESI = 0; |
||
503 | $int 0x40 |
||
504 | } |
||
505 | |||
506 | /* |
||
507 | 34 = READ DIRECTORY FROM FLOPPY |
||
508 | ebx reserved : set as zero |
||
509 | ecx reserved : set as zero |
||
510 | edx start 512 block to read |
||
511 | esi reserved : set as 1 |
||
512 | edi pointer to return area |
||
513 | |||
514 | |||
515 | 35 = READ SCREEN PIXEL |
||
516 | ebx = pixel count from top left of the screen |
||
517 | return : eax = 0x00RRGGBB |
||
518 | */ |
||
519 | |||
520 | /* |
||
521 | 37 = READ MOUSE POSITION |
||
522 | ebx=0 screen relative |
||
523 | ebx=1 window relative |
||
524 | ebx=2 buttons pressed |
||
525 | return in eax |
||
526 | */ |
||
527 | inline fastcall dword sys_read_mouse(dword EBX) |
||
528 | { |
||
529 | EAX = 37; |
||
530 | $int 0x40 |
||
531 | } |
||
532 | |||
533 | /* |
||
534 | 38 = DRAW LINE |
||
535 | ebx [x start] shl 16 + [x end] |
||
536 | ecx [y start] shl 16 + [y end] |
||
537 | edx colour 0x00RRGGBB |
||
538 | return : nothing changed |
||
539 | */ |
||
540 | inline fastcall void sys_draw_line(dword EBX, ECX, EDX) |
||
541 | { |
||
542 | EAX = 38; |
||
543 | $int 0x40 |
||
544 | } |
||
545 | |||
546 | /* |
||
547 | 39 = GET BACKGROUND |
||
548 | ebx=1 -> eax=[bgr x size] shl 16 + [bgr y size] |
||
549 | ebx=2 |
||
550 | ecx= postition of backgrounds memorymap to return in eax |
||
551 | ebx=4 -> eax=1 tiled, eax=2 stretched |
||
552 | */ |
||
553 | inline fastcall dword sys_get_background(dword EBX, ECX) |
||
554 | { |
||
555 | EAX = 39; |
||
556 | $int 0x40 |
||
557 | } |
||
558 | |||
559 | /* |
||
560 | 40 = SET BITFIELD FOR WANTED EVENTS |
||
561 | as default: |
||
562 | ebx = 00000000 00000000 00000000 00000111b events: |
||
563 | I window draw |
||
564 | I key in buffer |
||
565 | I button in buffer |
||
566 | I (end request) |
||
567 | I desktop background draw |
||
568 | I (mouse change) |
||
569 | I---------------I get irqs data |
||
570 | |||
571 | |||
572 | 41 = GET IRQ OWNER |
||
573 | ebx = irq |
||
574 | return : PID of the process |
||
575 | |||
576 | |||
577 | 42 = GET DATA READ BY IRQ |
||
578 | ebx IRQ number |
||
579 | return : eax number of bytes in buffer |
||
580 | bl data |
||
581 | ecx 0 = successful data read |
||
582 | 1 = no data in buffer |
||
583 | 2 = incorrect IRQ owner |
||
584 | |||
585 | |||
586 | 43 = SEND DATA TO DEVICE |
||
587 | bx : port |
||
588 | cl : data |
||
589 | return : eax = if 0 successful, other = error |
||
590 | |||
591 | |||
592 | 44 = PROGRAM IRQ's |
||
593 | ebx pointer to table |
||
594 | ecx irq number |
||
595 | |||
596 | |||
597 | 45 = RESERVE/FREE IRQ |
||
598 | ebx 0 reserve 1 free |
||
599 | ecx IRQ number |
||
600 | ret eax 0 successful, 1 error |
||
601 | |||
602 | |||
603 | 46 = RESERVE/FREE PORT AREA |
||
604 | ebx 0 reserve 1 free |
||
605 | ecx port area start |
||
606 | edx port area end |
||
607 | ret eax 0 successful, 1 error |
||
608 | */ |
||
609 | |||
610 | /* |
||
611 | 47 = DISPLAY NUMBER TO WINDOW |
||
612 | ebx = print type, bl=0 -> ecx is number |
||
613 | bl=1 -> ecx is pointer |
||
614 | bh=0 -> display decimal |
||
615 | bh=1 -> display hexadecimal |
||
616 | bh=2 -> display binary |
||
617 | bits 16-21 = number of digits to display (0-32) |
||
618 | bits 22-31 = reserved |
||
619 | ecx = number or pointer |
||
620 | edx = x shl 16 + y |
||
621 | esi = color |
||
622 | */ |
||
623 | inline fastcall void sys_write_number(dword EBX, ECX, EDX, ESI) |
||
624 | { |
||
625 | EAX = 47; |
||
626 | $int 0x40 |
||
627 | } |
||
628 | |||
629 | /* |
||
630 | 48 = DEFINE GENERAL WINDOW PROPERTIES |
||
631 | ebx = 0 apply/redraw |
||
632 | ecx = 0 , apply/redraw desktop |
||
633 | ebx = 1 define button style |
||
634 | ecx = 0 , set flat buttons |
||
635 | ecx = 1 , set 3d buttons |
||
636 | ebx = 2 define window colors |
||
637 | ecx = pointer to table |
||
638 | edx = number of bytes defined |
||
639 | ebx = 3 get define window colors |
||
640 | ecx = pointer to table |
||
641 | edx = number of bytes to get |
||
642 | */ |
||
643 | |||
644 | inline fastcall void sys_redraw_desktop() |
||
645 | { |
||
646 | EAX = 48; |
||
647 | EBX = ECX = 0; |
||
648 | $int 0x40 |
||
649 | } |
||
650 | |||
651 | inline fastcall void sys_set_button_style(dword ECX) |
||
652 | { |
||
653 | EAX = 48; |
||
654 | EBX = 1; |
||
655 | $int 0x40 |
||
656 | } |
||
657 | |||
658 | inline fastcall void sys_set_colors(dword ECX,EDX) |
||
659 | { |
||
660 | EAX = 48; |
||
661 | EBX = 2; |
||
662 | $int 0x40 |
||
663 | } |
||
664 | |||
665 | inline fastcall void sys_get_colors(dword ECX,EDX) |
||
666 | { |
||
667 | EAX = 48; |
||
668 | EBX = 3; |
||
669 | $int 0x40 |
||
670 | } |
||
671 | |||
672 | /* |
||
673 | 49 = DEFINE APPLICATIONS INTERNAL INTERRUPTS |
||
674 | ebx = 0 |
||
675 | ecx point to dword x 256 table of interrupt entries |
||
676 | inside the application |
||
677 | return : nothing changed |
||
678 | |||
679 | |||
680 | 50 = FREE FORM WINDOW SHAPE AND SCALE |
||
681 | ebx = 0 ; shape reference area |
||
682 | ecx = pointer to reference area |
||
683 | byte per pixel, 0 not used, 1=used, other = reserved |
||
684 | ebx = 1 ; scale of reference area (default 1:1) |
||
685 | ecx : scale is set to 2^ecx |
||
686 | return: nothing changed |
||
687 | |||
688 | |||
689 | 51 = CREATE THREAD |
||
690 | ebx = 1 ; create |
||
691 | ecx ; = thread entry point |
||
692 | edx ; = thread stack position |
||
693 | return : eax = pid or 0xfffffff0+ for error |
||
694 | */ |
||
695 | |||
696 | inline fastcall dword sys_create_thread(dword ECX,EDX) |
||
697 | { |
||
698 | EAX = 51; |
||
699 | EBX = 1; |
||
700 | $int 0x40 |
||
701 | } |
||
702 | |||
703 | /* |
||
704 | |||
705 | 52 = STACK DRIVER STATUS |
||
706 | - see stack.txt |
||
707 | |||
708 | |||
709 | 53 = SOCKET INTERFACE |
||
710 | - see stack.txt |
||
711 | |||
712 | |||
713 | 54 = USER EVENTS |
||
714 | - not ready yet |
||
715 | |||
716 | |||
717 | 55 = SOUND INTERFACE |
||
718 | ebx = 0 ; load 44 khz 8 bit mono sound block |
||
719 | ecx ; = pointer to 65536 byte soundblock |
||
720 | ebx = 1 ; play 44 khz 8 bit mono sound block |
||
721 | |||
722 | |||
723 | 56 = WRITE FILE TO HD |
||
724 | ebx pointer to 12 char filename |
||
725 | ecx bytes to write |
||
726 | edx pointer to data to write |
||
727 | esi pointer to path |
||
728 | path db 0 |
||
729 | |||
730 | |||
731 | 57 = DELETE FILE FROM HD |
||
732 | ebx pointer to filename : 11 capital letters |
||
733 | edx pointer to path : path db 0 |
||
734 | */ |
||
735 | |||
736 | |||
737 | /* |
||
738 | 58 = SYSTEM TREE ACCESS |
||
739 | ebx pointer to fileinfo block |
||
740 | fileinfo: |
||
741 | dd 0x0 ; 0=read (/write/delete/append) |
||
742 | dd 0x0 ; 512 block to read 0+ |
||
743 | dd 0x1 ; blocks to read (/bytes to write/append) |
||
744 | dd 0x20000 ; return data pointer |
||
745 | dd 0x10000 ; work area for os - 16384 bytes |
||
746 | db '/RAMDISK/FIRST/KERNEL.ASM',0 ; ASCIIZ dir & filename |
||
747 | */ |
||
748 | inline fastcall void sys_tree_access(dword EBX) |
||
749 | { |
||
750 | EAX = 58; |
||
751 | $int 0x40 |
||
752 | } |
||
753 | |||
754 | /* |
||
755 | 59 = TRACE FOR SYSTEM CALLS FROM PROCESSES |
||
756 | ebx = 0 ; get system events |
||
757 | ecx ; pointer to table -> ; 64 bytes/system call descriptor |
||
758 | ; +00 PID |
||
759 | ; +32 EDI |
||
760 | ; +36 ESI |
||
761 | ; +40 EBP |
||
762 | ; +44 ESP |
||
763 | ; +48 EBX |
||
764 | ; +52 EDX |
||
765 | ; +56 ECX |
||
766 | ; +60 EAX |
||
767 | edx ; number of bytes to return to table (currently max 16*64) |
||
768 | return: eax = number of system calls from start |
||
769 | latest call is saved to (eax mod 16)*64 in table |
||
770 | ebx = 0 : above format |
||
771 | */ |
||
772 | |||
773 | /* |
||
774 | 60 = IPC |
||
775 | ebx = 1 ; define receive area |
||
776 | ecx = pointer to start |
||
777 | edx = size of area |
||
778 | |||
779 | ebx = 2 ; send message |
||
780 | ecx = PID |
||
781 | edx = pointer to message |
||
782 | esi = length |
||
783 | */ |
||
784 | |||
785 | inline fastcall void sys_ipc_init(dword ECX, EDX) |
||
786 | { |
||
787 | EAX = 60; |
||
788 | EBX = 1; |
||
789 | $int 0x40 |
||
790 | } |
||
791 | |||
792 | inline fastcall void sys_ipc_send(dword ECX, EDX, ESI) |
||
793 | { |
||
794 | EAX = 60; |
||
795 | EBX = 2; |
||
796 | $int 0x40 |
||
797 | } |
||
798 | |||
799 | /* -1 = EXIT PROCESS */ |
||
800 | |||
801 | inline fastcall void sys_exit_process() |
||
802 | { |
||
803 | $xor eax,eax |
||
804 | $dec eax |
||
805 | $int 0x40 |
||
806 | }>-> |