Subversion Repositories Kolibri OS

Rev

Rev 963 | Rev 7661 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed

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