Subversion Repositories Kolibri OS

Rev

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