Subversion Repositories Kolibri OS

Rev

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

  1. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  2. ;;                                                              ;;
  3. ;; Copyright (C) KolibriOS team 2004-2021. All rights reserved. ;;
  4. ;; Distributed under terms of the GNU General Public License    ;;
  5. ;;                                                              ;;
  6. ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
  7.  
  8. SYSTEM FUNCTIONS of OS Kolibri 0.7.7.0
  9.  
  10. Number of the function is located in the register eax.
  11. The call of the system function is executed by "int 0x40" command.
  12. All registers except explicitly declared in the returned value,
  13.     including eflags, are preserved.
  14.  
  15.  
  16. ======================================================================
  17. ============== Function 0 - define and draw the window. ==============
  18. ======================================================================
  19. Defines an application window. Draws a frame of the window, header and
  20. working area. For skinned windows defines standard close and minimize
  21. buttons.
  22. Parameters:
  23.   * eax = 0 - function number
  24.   * ebx = [coordinate on axis x]*65536 + [size on axis x]
  25.   * ecx = [coordinate on axis y]*65536 + [size on axis y]
  26.   * edx = 0xXYRRGGBB, where:
  27.     * Y = style of the window:
  28.       * Y=1 - only define window area, draw nothing
  29.       * Y=3 - skinned window
  30.       * Y=4 - skinned fixed-size window
  31.       * Y=0,2 window types are outdated and should not be used anymore,
  32.         they are retained for compatibility with old programs.
  33.       * other possible values (from 5 to 15) are reserved,
  34.         function call with such Y is ignored
  35.     * RR, GG, BB = accordingly red, green, blue components of a color
  36.       of the working area of the window (are ignored for style Y=1)
  37.     * X = DCBA (bits)
  38.       * A = 1 - window has caption
  39.       * B = 1 - coordinates of all graphics primitives are relative to
  40.                   window client area
  41.       * C = 1 - don't fill working area on window draw
  42.       * D = 0 - normal filling of the working area, 1 - gradient
  43.     The following parameters are intended for windows
  44.     of a type I and II, and ignored for styles Y=1,3:
  45.   * esi = 0xXYRRGGBB - color of the header
  46.     * RR, GG, BB define color
  47.     * Y=0 - usual window, Y=1 - unmovable window (works for all window styles)
  48.     * X not used, other values of Y are reserved
  49.   * edi = caption string for styles Y=3,4 (also can be set by func 71.1)
  50. Returned value:
  51.   * function does not return value
  52. Remarks:
  53.   * Position and sizes of the window are installed by the first
  54.     call of this function and are ignored at subsequent; to change
  55.     position and/or sizes of already created window use function 67.
  56.   * For windows with styles Y=3,4 and caption (A=1) caption string
  57.     is set by the first call of this function and is ignored
  58.     at subsequent (strictly speaking, is ignored after a call to
  59.     subfunction 2 of function 12 - end redraw); to change caption of
  60.     already created window use subfunction 1 of function 71.
  61.   * If the window has appropriate styles, position and/or sizes can be
  62.     changed by user. Current position and sizes can be obtained
  63.     by function 9.
  64.   * The window must fit on the screen. If the transferred
  65.     coordinates and sizes do not satisfy to this condition,
  66.     appropriate coordinate (or, probably, both) is considered as zero,
  67.     and if it does not help too, the appropriate size
  68.     (or, probably, both) is installed in a size of the screen.
  69.  
  70.     Further let us designate xpos,ypos,xsize,ysize - values passed
  71.     in ebx,ecx. The coordinates are resulted concerning
  72.     the left upper corner of the window, which, thus, is set as (0,0),
  73.     coordinates of the right lower corner essence (xsize,ysize).
  74.   * The sizes of the window are understood in sense of coordinates
  75.     of the right lower corner. This concerns all other functions too.
  76.     It means, that the real sizes are on 1 pixel more.
  77.   * The window of style Y=1 looks as follows:
  78.     * completely defined by the application
  79.   * The skinned window Y=3,4 looks as follows:
  80.     * draw external frame of width 1 pixel
  81.       with color 'outer' from the skin
  82.     * draw intermediate frame of width 3 pixel
  83.       with color 'frame' from the skin
  84.     * draw internal frame of width 1 pixel
  85.       with color 'inner' from the skin
  86.     * draw header (on bitmaps from the skin) in a rectangle
  87.       (0,0) - (xsize,_skinh-1)
  88.     * if ysize>=26, fill the working area of the window -
  89.       rectangle with the left upper corner (5,_skinh) and right lower
  90.       (xsize-5,ysize-5) with color indicated in edx
  91.       (taking a gradient into account)
  92.     * define two standard buttons: close and minimize
  93.       (see function 8)
  94.     * if A=1 and edi contains (nonzero) pointer to caption string,
  95.       it is drawn in place in header defined in the skin
  96.     * value _skinh is accessible as the result of call
  97.       subfunction 4 of function 48
  98.  
  99. ---------------------- Constants for registers: ----------------------
  100.   eax - SF_CREATE_WINDOW (0)
  101. ======================================================================
  102. ================ Function 1 - put pixel in the window. ===============
  103. ======================================================================
  104. Parameters:
  105.   * eax = 1 - function number
  106.   * ebx = x-coordinate (relative to the window)
  107.   * ecx = y-coordinate (relative to the window)
  108.   * edx = 0x00RRGGBB - color of a pixel
  109.     edx = 0x01xxxxxx - invert color of a pixel
  110.           (low 24 bits are ignored)
  111. Returned value:
  112.   * function does not return value
  113.  
  114. ---------------------- Constants for registers: ----------------------
  115.   eax - SF_PUT_PIXEL (1)
  116. ======================================================================
  117. ============ Function 2 - get the code of the pressed key. ===========
  118. ======================================================================
  119. Takes away the code of the pressed key from the buffer.
  120. Parameters:
  121.   * eax = 2 - function number
  122. Returned value:
  123.   * if the buffer is empty, function returns eax=1
  124.   * if the buffer is not empty, function returns al=0,
  125.     ah=code of the pressed key,
  126.     bits 16-23 = contain scancode for pressed key in ASCII mode,
  127.                  in the scancodes mode this bits cleared.
  128.     bits 23-31 = zero
  129.   * if there is "hotkey", function returns al=2,
  130.     ah=scancode of the pressed key (0 for control keys),
  131.     high word of eax contains a status of control keys at the moment
  132.     of pressing a hotkey
  133. Remarks:
  134.   * There is a common system buffer of the pressed keys
  135.     by a size of 120 bytes, organized as queue.
  136.   * There is one more common system buffer on 120 "hotkeys".
  137.   * If the application with the inactive window calls this function,
  138.     the buffer of the pressed keys is considered to be empty.
  139.   * By default this function returns ASCII-codes; to switch
  140.     to the scancodes mode (and back) use function 66.
  141.     However, hotkeys are always notificated as scancodes.
  142.   * To find out, what keys correspond to what codes, start
  143.     the application keyascii and scancode.
  144.   * Scancodes come directly from keyboard and are fixed;
  145.     ASCII-codes turn out with usage of the conversion tables,
  146.     which can be set by subfunction 2 of function 21
  147.     and get by subfunction 2 of function 26.
  148.   * As a consequence, ASCII-codes take into account current
  149.     keyboard layout (rus/en) as opposed to scancodes.
  150.   * This function notifies only about those hotkeys, which were
  151.     defined by this thread by subfunction 4 of function 66.
  152.  
  153. ---------------------- Constants for registers: ----------------------
  154.   eax - SF_GET_KEY (2)
  155. ======================================================================
  156. ==================== Function 3 - get system time. ===================
  157. ======================================================================
  158. Parameters:
  159.   * eax = 3 - function number
  160. Returned value:
  161.   * eax = 0x00SSMMHH, where HH:MM:SS = Hours:Minutes:Seconds
  162.   * each item is BCD-number, for example,
  163.     for time 23:59:59 function returns 0x00595923
  164. Remarks:
  165.   * See also subfunction 9 of function 26 - get time from
  166.     the moment of start of the system; it is more convenient, because
  167.     returns simply DWORD-value of the time counter.
  168.   * System time can be set by function 22.
  169.  
  170. ---------------------- Constants for registers: ----------------------
  171.   eax - SF_GET_SYS_TIME (3)
  172. ======================================================================
  173. =================== Function 4 - draw text string. ===================
  174. ======================================================================
  175. Parameters:
  176.   * eax = 4 - function number
  177.   * ebx = X*65536+Y, coordinates in the window or buffer
  178.   * ecx = 0xXXRRGGBB, where
  179.     * RR, GG, BB specify text color
  180.     * XX = ABFFCSSS (bits):
  181.       * A=1 - output zero terminated string
  182.       * B=1 - fill background (color = edi)
  183.       * FF specifies the font and encoding:
  184.         0 = 6x9  cp866
  185.         1 = 8x16 cp866
  186.         2 = 8x16 UTF-16LE
  187.         3 = 8x16 UTF-8
  188.       * C=0 - draw to the window,
  189.         C=1 - draw to the user buffer (edi)
  190.       * SSS = (size multiplier)-1, so 0 = x1, 7 = x8
  191.   * edx = pointer to the beginning of the string
  192.   * esi = for A=0 length of the string, for A=1 is ignored
  193.   * edi = for B=1 color to fill background,
  194.           for C=1 pointer to user buffer
  195.  
  196. Returned value:
  197.   * function does not return value
  198. Remarks:
  199.   * You can not use B=1 and C=1 at the same time, since both use edi.
  200.   * When SSS=0, font may be smoothed, depending on system setting.
  201.   * User buffer structure:
  202. Xsize       dd
  203. Ysize       dd
  204. picture     rb  Xsize*Ysize*4  ; 32 bpp
  205.  
  206. ---------------------- Constants for registers: ----------------------
  207.   eax - SF_DRAW_TEXT (4)
  208. ======================================================================
  209. ========================= Function 5 - delay. ========================
  210. ======================================================================
  211. Delays execution of the program on the given time.
  212. Parameters:
  213.   * eax = 5 - function number
  214.   * ebx = time in the 1/100 of second
  215. Returned value:
  216.   * function does not return value
  217. Remarks:
  218.   * Passing ebx=0 does not transfer control to the next process
  219.     and does not make any operations at all. If it is really required
  220.     to transfer control to the next process (to complete a current
  221.     time slice), use subfunction 1 of function 68.
  222.  
  223. ---------------------- Constants for registers: ----------------------
  224.   eax - SF_SLEEP (5)
  225. ======================================================================
  226. =============== Function 7 - draw image in the window. ===============
  227. ======================================================================
  228. Paramters:
  229.   * eax = 7 - function number
  230.   * ebx = pointer to the image in the format BBGGRRBBGGRR...
  231.   * ecx = [size on axis x]*65536 + [size on axis y]
  232.   * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
  233. Returned value:
  234.   * function does not return value
  235. Remarks:
  236.   * Coordinates of the image are coordinates of the upper left corner
  237.     of the image relative to the window.
  238.   * Size of the image in bytes is 3*xsize*ysize.
  239.  
  240. ---------------------- Constants for registers: ----------------------
  241.   eax - SF_PUT_IMAGE (7)
  242. ======================================================================
  243. =============== Function 8 - define/delete the button. ===============
  244. ======================================================================
  245. Parameters for button definition:
  246.   * eax = 8 - function number
  247.   * ebx = [coordinate on axis x]*65536 + [size on axis x]
  248.   * ecx = [coordinate on axis y]*65536 + [size on axis y]
  249.   * edx = 0xXYnnnnnn, where:
  250.     * nnnnnn = identifier of the button
  251.     * high (31st) bit of edx is cleared
  252.     * if 30th bit of edx is set - do not draw the button
  253.     * if 29th bit of edx is set - do not draw a frame
  254.       at pressing the button
  255.   * esi = 0x00RRGGBB - color of the button
  256. Parameters for button deleting:
  257.   * eax = 8 - function number
  258.   * edx = 0x80nnnnnn, where nnnnnn - identifier of the button
  259. Returned value:
  260.   * function does not return value
  261. Remarks:
  262.   * Sizes of the button must be more than 0 and less than 0x8000.
  263.   * For skinned windows definition of the window
  264.     (call of 0th function) creates two standard buttons -
  265.     for close of the window with identifier 1 and
  266.     for minimize of the window with identifier 0xffff.
  267.   * The creation of two buttons with same identifiers is admitted.
  268.   * The button with the identifier 0xffff at pressing is interpreted
  269.     by the system as the button of minimization, the system handles
  270.     such pressing independently, not accessing to the application.
  271.     In rest it is usual button.
  272.   * Total number of buttons for all applications is limited to 4095.
  273.  
  274. ---------------------- Constants for registers: ----------------------
  275.   eax - SF_DEFINE_BUTTON (8)
  276. ======================================================================
  277. ============ Function 9 - information on execution thread. ===========
  278. ======================================================================
  279. Parameters:
  280.   * eax = 9 - function number
  281.   * ebx = pointer to 1-Kb buffer
  282.   * ecx = number of the slot of the thread
  283.     ecx = -1 - get information on the current thread
  284. Returned value:
  285.   * eax = maximum number of the slot of a thread
  286.     but if pointer in ebx is illegal, for example,
  287.     [ebx, ebx + 0x4C) region intersects with kernel memory,
  288.     then function returns -1
  289.   * buffer pointed to by ebx contains the following information:
  290.     * +0: dword: usage of the processor (how many time units
  291.       per second leaves on execution of this thread)
  292.     * +4: word: position of the window of thread in the window stack
  293.     * +6: word: (has no relation to the specified thread)
  294.       number of the thread slot, which window has in the window stack
  295.       position ecx
  296.     * +8: word: reserved
  297.     * +10 = +0xA: 11 bytes: name of the process
  298.       (name of the started file - executable file without extension)
  299.     * +21 = +0x15: byte: reserved, this byte is not changed
  300.     * +22 = +0x16: dword: address of the process in memory
  301.     * +26 = +0x1A: dword: size of used memory - 1
  302.     * +30 = +0x1E: dword: identifier (PID/TID)
  303.     * +34 = +0x22: dword: coordinate of the thread window on axis x
  304.     * +38 = +0x26: dword: coordinate of the thread window on axis y
  305.     * +42 = +0x2A: dword: size of the thread window on axis x
  306.     * +46 = +0x2E: dword: size of the thread window on axis y
  307.     * +50 = +0x32: word: status of the thread slot:
  308.       * 0 = thread is running
  309.       * 1 = thread is suspended
  310.       * 2 = thread is suspended while waiting for event
  311.       * 3 = thread is terminating as a result of call to function -1
  312.         or under duress as a result of call to subfunction 2
  313.         of function 18 or termination of the system
  314.       * 4 = thread is terminating as a result of exception
  315.       * 5 = thread waits for event
  316.       * 9 = requested slot is free, all other information on the slot
  317.         is not meaningful
  318.     * +52 = +0x34: word: reserved, this word is not changed
  319.     * +54 = +0x36: dword: coordinate of the client area on axis x
  320.     * +58 = +0x3A: dword: coordinate of the client area on axis y
  321.     * +62 = +0x3E: dword: width of the client area
  322.     * +66 = +0x42: dword: height of the client area
  323.     * +70 = +0x46: byte: state of the window - bitfield
  324.       * bit 0 (mask 1): window is maximized
  325.       * bit 1 (mask 2): window is minimized to panel
  326.       * bit 2 (mask 4): window is rolled up
  327.     * +71 = +0x47: dword: event mask
  328.     * +75 = +0x4B: byte: keyboard mode(ASCII = 0; SCAN = 1)
  329. Remarks:
  330.   * Slots are numbered starting from 1.
  331.   * Returned value is not a total number of threads, because there
  332.     can be free slots.
  333.   * When process is starting, system automatically creates
  334.     execution thread.
  335.   * Function gives information on the thread. Each process has
  336.     at least one thread. One process can create many threads,
  337.     in this case each thread has its own slot and the fields
  338.     +10, +22, +26 in these slots coincide.
  339.     Applications have no common way to define whether two threads
  340.     belong to one process.
  341.   * The active window - window on top of the window stack -
  342.     receives the messages on a keyboard input. For such window
  343.     the position in the window stack coincides with returned value.
  344.   * Slot 1 corresponds to special system thread, for which:
  345.     * the window is in the bottom of the window stack, the fields
  346.       +4 and +6 contain value 1
  347.     * name of the process - "OS/IDLE" (supplemented by spaces)
  348.     * address of the process in memory is 0, size of used memory is
  349.       16 Mb (0x1000000)
  350.     * PID=1
  351.     * coordinates and sizes of the window and the client area are by
  352.       convention set to 0
  353.     * status of the slot is always 0 (running)
  354.     * the execution time adds of time leaving on operations itself
  355.       and idle time in waiting for interrupt (which can be got by call
  356.       to subfunction 4 of function 18).
  357.   * Beginning from slot 2, the normal applications are placed.
  358.   * The normal applications are placed in memory at the address
  359.     0 (kernel constant 'std_application_base_address').
  360.     There is no intersection, as each process has its own page table.
  361.   * At creation of the thread it is assigned the slot
  362.     in the system table and identifier (Process/Thread IDentifier =
  363.     PID/TID), which do not vary with time for given thread.
  364.     After completion of the thread its slot can be anew used
  365.     for another thread. The thread identifier can not be assigned
  366.     to other thread even after completion of this thread.
  367.     Identifiers, assigned to new threads, grow monotonously.
  368.   * If the thread has not yet defined the window by call to
  369.     function 0, the position and the sizes
  370.     of its window are considered to be zero.
  371.   * Coordinates of the client area are relative to the window.
  372.   * At the moment only the part of the buffer by a size
  373.     76 = 0x4C bytes is used. Nevertheless it is recommended to use
  374.     1-Kb buffer for the future compatibility, in the future
  375.     some fields can be added.
  376.  
  377. ---------------------- Constants for registers: ----------------------
  378.   eax - SF_THREAD_INFO (9)
  379. ======================================================================
  380. ==================== Function 10 - wait for event. ===================
  381. ======================================================================
  382. If the message queue is empty, waits for appearance of the message
  383. in queue. In this state thread does not consume CPU time.
  384. Then reads out the message from queue.
  385.  
  386. Parameters:
  387.   * eax = 10 - function number
  388. Returned value:
  389.   * eax = event (see the list of events)
  390. Remarks:
  391.   * Those events are taken into account only which enter into
  392.     a mask set by function 40. By default it is
  393.     redraw, key and button events.
  394.   * To check, whether there is a message in queue, use function 11.
  395.     To wait for no more than given time, use function 23.
  396.  
  397. ---------------------- Constants for registers: ----------------------
  398.   eax - SF_WAIT_EVENT (10)
  399. ======================================================================
  400. =============== Function 11 - check for event, no wait. ==============
  401. ======================================================================
  402. If the message queue contains event, function reads out
  403. and return it. If the queue is empty, function returns 0.
  404. Parameters:
  405.   * eax = 11 - function number
  406. Returned value:
  407.   * eax = 0 - message queue is empty
  408.   * else eax = event (see the list of events)
  409. Remarks:
  410.   * Those events are taken into account only, which enter into
  411.     a mask set by function 40. By default it is
  412.     redraw, key and button events.
  413.   * To wait for event, use function 10.
  414.     To wait for no more than given time, use function 23.
  415.  
  416. ---------------------- Constants for registers: ----------------------
  417.   eax - SF_CHECK_EVENT (11)
  418. ======================================================================
  419. =============== Function 12 - begin/end window redraw. ===============
  420. ======================================================================
  421.  
  422. ---------------- Subfunction 1 - begin window redraw. ----------------
  423. Parameters:
  424.   * eax = 12 - function number
  425.   * ebx = 1 - subfunction number
  426. Returned value:
  427.   * function does not return value
  428.  
  429. ----------------- Subfunction 2 - end window redraw. -----------------
  430. Parameters:
  431.   * eax = 12 - function number
  432.   * ebx = 2 - subfunction number
  433. Returned value:
  434.   * function does not return value
  435. Remarks:
  436.   * Subfunction 1 deletes all buttons defined with
  437.     function 8, they must be defined again.
  438.  
  439. ---------------------- Constants for registers: ----------------------
  440.   eax - SF_REDRAW (12)
  441.   ebx - SSF_BEGIN_DRAW (1), SSF_END_DRAW (2)
  442. ======================================================================
  443. ============ Function 13 - draw a rectangle in the window. ===========
  444. ======================================================================
  445. Parameters:
  446.   * eax = 13 - function number
  447.   * ebx = [coordinate on axis x]*65536 + [size on axis x]
  448.   * ecx = [coordinate on axis y]*65536 + [size on axis y]
  449.   * edx = color 0xRRGGBB or 0x80RRGGBB for gradient fill
  450. Returned value:
  451.   * function does not return value
  452. Remarks:
  453.   * Coordinates are understood as coordinates of the left upper corner
  454.     of a rectangle relative to the window.
  455.  
  456. ---------------------- Constants for registers: ----------------------
  457.   eax - SF_DRAW_RECT (13)
  458. ======================================================================
  459. =================== Function 14 - get screen size. ===================
  460. ======================================================================
  461. Parameters:
  462.   * eax = 14 - function number
  463. Returned value:
  464.   * eax = [xsize]*65536 + [ysize], where
  465.   * xsize = x-coordinate of the right lower corner of the screen =
  466.             horizontal size - 1
  467.   * ysize = y-coordinate of the right lower corner of the screen =
  468.             vertical size - 1
  469. Remarks:
  470.   * See also subfunction 5 of function 48 - get sizes of
  471.     working area of the screen.
  472.  
  473. ---------------------- Constants for registers: ----------------------
  474.   eax - SF_GET_SCREEN_SIZE (14)
  475. ======================================================================
  476. == Function 15, subfunction 1 - set a size of the background image. ==
  477. ======================================================================
  478. Parameters:
  479.   * eax = 15 - function number
  480.   * ebx = 1 - subfunction number
  481.   * ecx = width of the image
  482.   * edx = height of the image
  483. Returned value:
  484.   * function does not return value
  485. Remarks:
  486.   * Before calling subfunctions 2 and 5 you should call this function
  487.     to set image size!
  488.   * For update of the screen (after completion of a series of commands
  489.     working with a background) call subfunction 3.
  490.   * There is a pair function for get size of the background image -
  491.     subfunction 1 of function 39.
  492.  
  493. ---------------------- Constants for registers: ----------------------
  494.   eax - SF_BACKGROUND_SET (15)
  495.   ebx - SSF_SIZE_BG (1)
  496. ======================================================================
  497. === Function 15, subfunction 2 - put pixel on the background image. ==
  498. ======================================================================
  499. Parameters:
  500.   * eax = 15 - function number
  501.   * ebx = 2 - subfunction number
  502.   * ecx = offset
  503.   * edx = color of a pixel 0xRRGGBB
  504. Returned value:
  505.   * function does not return value
  506. Remarks:
  507.   * Offset for a pixel with coordinates (x,y) is calculated as
  508.     (x+y*xsize)*3.
  509.   * If the given offset exceeds size set by subfunction 1,
  510.     the call is ignored.
  511.   * For update of the screen (after completion of a series of commands
  512.     working with a background) call subfunction 3.
  513.   * There is a pair function for get pixel on the background image -
  514.     subfunction 2 of function 39.
  515.  
  516. ---------------------- Constants for registers: ----------------------
  517.   eax - SF_BACKGROUND_SET (15)
  518.   ebx - SSF_PIXEL_BG (2)
  519. ======================================================================
  520. =========== Function 15, subfunction 3 - redraw background. ==========
  521. ======================================================================
  522. Parameters:
  523.   * eax = 15 - function number
  524.   * ebx = 3 - subfunction number
  525. Returned value:
  526.   * function does not return value
  527.  
  528. ---------------------- Constants for registers: ----------------------
  529.   eax - SF_BACKGROUND_SET (15)
  530.   ebx - SSF_REDRAW_BG (3)
  531. ======================================================================
  532. == Function 15, subfunction 4 - set drawing mode for the background. =
  533. ======================================================================
  534. Parameters:
  535.   * eax = 15 - function number
  536.   * ebx = 4 - subfunction number
  537.   * ecx = drawing mode:
  538.     * 1 = tile
  539.     * 2 = stretch
  540. Returned value:
  541.   * function does not return value
  542. Remarks:
  543.   * For update of the screen (after completion of a series of commands
  544.     working with a background) call subfunction 3.
  545.   * There is a pair function for get drawing mode of the background -
  546.     subfunction 4 of function 39.
  547.  
  548. ---------------------- Constants for registers: ----------------------
  549.   eax - SF_BACKGROUND_SET (15)
  550.   ebx - SSF_MODE_BG (4)
  551. ======================================================================
  552. ===================== Function 15, subfunction 5 =====================
  553. ============ Put block of pixels on the background image. ============
  554. ======================================================================
  555. Parameters:
  556.   * eax = 15 - function number
  557.   * ebx = 5 - subfunction number
  558.   * ecx = pointer to the data in the format BBGGRRBBGGRR...
  559.   * edx = offset in data of the background image
  560.   * esi = size of data in bytes = 3 * number of pixels
  561. Returned value:
  562.   * function does not return value
  563. Remarks:
  564.   * Offset and size are not checked for correctness.
  565.   * Color of each pixel is stored as 3-bytes value BBGGRR.
  566.   * Pixels of the background image are written sequentially
  567.     from left to right, from up to down.
  568.   * Offset of pixel with coordinates (x,y) is (x+y*xsize)*3.
  569.   * For update of the screen (after completion of a series of commands
  570.     working with a background) call subfunction 3.
  571.  
  572. ---------------------- Constants for registers: ----------------------
  573.   eax - SF_BACKGROUND_SET (15)
  574.   ebx - SSF_IMAGE_BG (5)
  575. ======================================================================
  576. ===================== Function 15, subfunction 6 =====================
  577. ======== Map background data to the address space of process. ========
  578. ======================================================================
  579. Parameters:
  580.   * eax = 15 - function number
  581.   * ebx = 6 - subfunction number
  582. Returned value:
  583.   * eax = pointer to background data, 0 if error
  584. Remarks:
  585.   * Mapped data are available for read and write.
  586.   * Size of background data is 3*xsize*ysize. The system blocks
  587.     changes of background sizes while process works with mapped data.
  588.   * Color of each pixel is stored as 3-bytes value BBGGRR.
  589.   * Pixels of the background image are written sequentially
  590.     from left to right, from up to down.
  591.  
  592. ---------------------- Constants for registers: ----------------------
  593.   eax - SF_BACKGROUND_SET (15)
  594.   ebx - SSF_MAP_BG (6)
  595. ======================================================================
  596. ===== Function 15, subfunction 7 - close mapped background data. =====
  597. ======================================================================
  598. Parameters:
  599.   * eax = 15 - function number
  600.   * ebx = 7 - subfunction number
  601.   * ecx = pointer to mapped data
  602. Returned value:
  603.   * eax = 1 - success, 0 - error
  604.  
  605. ---------------------- Constants for registers: ----------------------
  606.   eax - SF_BACKGROUND_SET (15)
  607.   ebx - SSF_UNMAP_BG (7)
  608. ======================================================================
  609. ===================== Function 15, subfunction 8 =====================
  610. ============= Get coordinates of last draw the background ============
  611. ======================================================================
  612. Parameters:
  613.   * eax = 15 - function number
  614.   * ebx = 8 - subfunction number
  615. Returned value:
  616.   * eax = [left]*65536 + [right]
  617.   * ebx = [top]*65536 + [bottom]
  618. Remarks:
  619.   * (left,top) are coordinates of the left upper corner,
  620.     (right,bottom) are coordinates of the right lower one.
  621.   * For receiving more reliable information, call the function
  622.     immediately after the event:
  623.              5 = kernel finished redrawing of the desktop background
  624.  
  625. ---------------------- Constants for registers: ----------------------
  626.   eax - SF_BACKGROUND_SET (15)
  627.   ebx - SSF_LAST_DRAW (8)
  628. ======================================================================
  629. ===================== Function 15, subfunction 9 =====================
  630. ============= Redraws a rectangular part of the background ===========
  631. ======================================================================
  632. Parameters:
  633.   * eax = 15 - function number
  634.   * ebx = 9 - subfunction number
  635.   * ecx = [left]*65536 + [right]
  636.   * edx = [top]*65536 + [bottom]
  637. Returned value:
  638.   * function does not return value
  639. Remarks:
  640.   * (left,top) are coordinates of the left upper corner,
  641.     (right,bottom) are coordinates of the right lower one.
  642.   * If parameters are set incorrectly then background is not redrawn.
  643.  
  644. ---------------------- Constants for registers: ----------------------
  645.   eax - SF_BACKGROUND_SET (15)
  646.   ebx - SSF_REDRAW_RECT (9)
  647. ======================================================================
  648. =============== Function 16 - save ramdisk on a floppy. ==============
  649. ======================================================================
  650. Parameters:
  651.   * eax = 16 - function number
  652.   * ebx = 1 or ebx = 2 - on which floppy save
  653. Returned value:
  654.   * eax = 0 - success
  655.   * eax = 1 - error
  656.  
  657. ---------------------- Constants for registers: ----------------------
  658.   eax - SF_RD_TO_FLOPPY (16)
  659. ======================================================================
  660. ======= Function 17 - get the identifier of the pressed button. ======
  661. ======================================================================
  662. Takes away the code of the pressed button from the buffer.
  663. Parameters:
  664.   * eax = 17 - function number
  665. Returned value:
  666.   * if the buffer is empty, function returns eax=1
  667.   * if the buffer is not empty:
  668.     * high 24 bits of eax contain button identifier (in particular,
  669.       ah contains low byte of the identifier; if all buttons have
  670.       the identifier less than 256, ah is enough to distinguish)
  671.     * al = 0 - the button was pressed with left mouse button
  672.     * al = bit corresponding to used mouse button otherwise
  673. Remarks:
  674.   * "Buffer" keeps only one button, at pressing the new button the
  675.     information about old is lost.
  676.   * The call of this function by an application with inactive window
  677.     will return answer "buffer is empty".
  678.   * Returned value for al corresponds to the state of mouse buttons
  679.     as in subfunction 2 of function 37 at the beginning
  680.     of button press, excluding lower bit, which is cleared.
  681.  
  682. ---------------------- Constants for registers: ----------------------
  683.   eax - SF_GET_BUTTON (17)
  684. ======================================================================
  685. ===================== Function 18, subfunction 1 =====================
  686. ============= Make deactive the window of the given thread. ==========
  687. ======================================================================
  688. Parameters:
  689.   * eax = 18 - function number
  690.   * ebx = 1 - subfunction number
  691.   * ecx = number of the thread slot
  692. Returned value:
  693.   * function does not return value
  694.  
  695. ---------------------- Constants for registers: ----------------------
  696.   eax - SF_SYSTEM (18)
  697.   ebx - SSF_UNFOCUS_WINDOW (1)
  698. ======================================================================
  699. = Function 18, subfunction 2 - terminate process/thread by the slot. =
  700. ======================================================================
  701. Parameters:
  702.   * eax = 18 - function number
  703.   * ebx = 2 - subfunction number
  704.   * ecx = number of the slot of process/thread
  705. Returned value:
  706.   * function does not return value
  707. Remarks:
  708.   * It is impossible to terminate system thread OS/IDLE (with
  709.     number of the slot 1),
  710.     it is possible to terminate any normal process/thread.
  711.   * See also subfunction 18 - terminate
  712.     process/thread by the identifier.
  713.  
  714. ---------------------- Constants for registers: ----------------------
  715.   eax - SF_SYSTEM (18)
  716.   ebx - SSF_TERMINATE_THREAD (2)
  717. ======================================================================
  718. ===================== Function 18, subfunction 3 =====================
  719. ============= Make active the window of the given thread. ============
  720. ======================================================================
  721. Parameters:
  722.   * eax = 18 - function number
  723.   * ebx = 3 - subfunction number
  724.   * ecx = number of the thread slot
  725. Returned value:
  726.   * function does not return value
  727. Remarks:
  728.   * If correct, but nonexistent slot is given,
  729.     some window is made active.
  730.   * To find out, which window is active, use subfunction 7.
  731.  
  732. ---------------------- Constants for registers: ----------------------
  733.   eax - SF_SYSTEM (18)
  734.   ebx - SSF_FOCUS_WINDOW (3)
  735. ======================================================================
  736. ===================== Function 18, subfunction 4 =====================
  737. =========== Get counter of idle time units per one second. ===========
  738. ======================================================================
  739. Idle time units are units, in which the processor stands idle
  740. in waiting for interrupt (in the command 'hlt').
  741.  
  742. Parameters:
  743.   * eax = 18 - function number
  744.   * ebx = 4 - subfunction number
  745. Returned value:
  746.   * eax = value of the counter of idle time units per one second
  747.  
  748. ---------------------- Constants for registers: ----------------------
  749.   eax - SF_SYSTEM (18)
  750.   ebx - SSF_GET_IDLE_COUNT (4)
  751. ======================================================================
  752. ========== Function 18, subfunction 5 - get CPU clock rate. ==========
  753. ======================================================================
  754. Parameters:
  755.   * eax = 18 - function number
  756.   * ebx = 5 - subfunction number
  757. Returned value:
  758.   * eax = clock rate (modulo 2^32 clock ticks = 4GHz)
  759.  
  760. ---------------------- Constants for registers: ----------------------
  761.   eax - SF_SYSTEM (18)
  762.   ebx - SSF_GET_CPU_FREQUENCY (5)
  763. ======================================================================
  764.  Function 18, subfunction 6 - save ramdisk to the file on hard drive.
  765. ======================================================================
  766. Parameters:
  767.   * eax = 18 - function number
  768.   * ebx = 6 - subfunction number
  769.   * ecx = pointer to the full path to file
  770.     (for example, "/hd0/1/kolibri/kolibri.img")
  771. Returned value:
  772.   * eax = 0 - success
  773.   * else eax = error code of the file system
  774. Remarks:
  775.   * All folders in the given path must exist, otherwise function
  776.     returns value 5, "file not found".
  777.  
  778. ---------------------- Constants for registers: ----------------------
  779.   eax - SF_SYSTEM (18)
  780.   ebx - SSF_RD_TO_HDD (6)
  781. ======================================================================
  782. =========== Function 18, subfunction 7 - get active window. ==========
  783. ======================================================================
  784. Parameters:
  785.   * eax = 18 - function number
  786.   * ebx = 7 - subfunction number
  787. Returned value:
  788.   * eax = number of the active window
  789.     (number of the slot of the thread with active window)
  790. Remarks:
  791.   * Active window is at the top of the window stack and receives
  792.     messages on all keyboard input.
  793.   * To make a window active, use subfunction 3.
  794.  
  795. ---------------------- Constants for registers: ----------------------
  796.   eax - SF_SYSTEM (18)
  797.   ebx - SSF_GET_ACTIVE_WINDOW (7)
  798. ======================================================================
  799. == Function 18, subfunction 8 - disable/enable the internal speaker. =
  800. ======================================================================
  801. If speaker sound is disabled, all calls to subfunction 55 of
  802. function 55 are ignored. If speaker sound is enabled,
  803. they are routed on builtin speaker.
  804.  
  805. ------------------- Subsubfunction 1 - get status. -------------------
  806. Parameters:
  807.   * eax = 18 - function number
  808.   * ebx = 8 - subfunction number
  809.   * ecx = 1 - number of the subsubfunction
  810. Returned value:
  811.   * eax = 0 - speaker sound is enabled; 1 - disabled
  812.  
  813. ----------------- Subsubfunction 2 - toggle status. ------------------
  814. Toggles states of disable/enable.
  815. Parameters:
  816.   * eax = 18 - function number
  817.   * ebx = 8 - subfunction number
  818.   * ecx = 2 - number of the subsubfunction
  819. Returned value:
  820.   * function does not return value
  821.  
  822. ---------------------- Constants for registers: ----------------------
  823.   eax - SF_SYSTEM (18)
  824.   ebx - SSF_SPEAKER (8)
  825.   ecx - SSSF_GET_STATE (1), SSSF_TOGGLE (2)
  826. ======================================================================
  827. == Function 18, subfunction 9 - system shutdown with the parameter. ==
  828. ======================================================================
  829. Parameters:
  830.   * eax = 18 - function number
  831.   * ebx = 9 - subfunction number
  832.   * ecx = parameter:
  833.     * 2 = turn off computer
  834.     * 3 = reboot computer
  835.     * 4 = restart the kernel from the file 'kernel.mnt' on ramdisk
  836. Returned value:
  837.   * at incorrect ecx the registers do not change (i.e. eax=18)
  838.   * by correct call function always returns eax=0
  839.     as the tag of success
  840. Remarks:
  841.   * Do not rely on returned value by incorrect call, it can be
  842.     changed in future versions of the kernel.
  843.  
  844. ---------------------- Constants for registers: ----------------------
  845.   eax - SF_SYSTEM (18)
  846.   ebx - SSF_SHUTDOWN (9)
  847. ======================================================================
  848. ======= Function 18, subfunction 10 - minimize topmost window. =======
  849. ======================================================================
  850. Minimizes the topmost (active) window.
  851. Parameters:
  852.   * eax = 18 - function number
  853.   * ebx = 10 - subfunction number
  854. Returned value:
  855.   * function does not return value
  856. Remarks:
  857.   * The minimized window from the point of view of function 9
  858.     keeps position and sizes.
  859.   * Restoring of an application window occurs at its activation by
  860.     subfunction 3.
  861.   * Usually there is no necessity to minimize/restore a window
  862.     explicitly: minimization of a window is carried out by the system
  863.     at pressing the minimization button (for skinned windows
  864.     it is defined automatically by function 0,
  865.     for other windows it can be defined manually by function 8),
  866.     restore of a window is done by the application '@taskbar'.
  867.  
  868. ---------------------- Constants for registers: ----------------------
  869.   eax - SF_SYSTEM (18)
  870.   ebx - SSF_MINIMIZE_WINDOW (10)
  871. ======================================================================
  872.  Function 18, subfunction 11 - get information on the disk subsystem.
  873. ======================================================================
  874. Parameters:
  875.   * eax = 18 - function number
  876.   * ebx = 11 - subfunction number
  877.   * ecx = type of the table:
  878.     * 1 = short version, 16 bytes
  879.   * edx = pointer to the buffer (in the application) for the table
  880. Returned value:
  881.   * function does not return value
  882. Format of the table: short version:
  883.   * +0: byte: information about FDD's (drives for floppies),
  884.     AAAABBBB, where AAAA gives type of the first drive, BBBB -
  885.     of the second regarding to the following list:
  886.     * 0 = there is no drive
  887.     * 1 = 360Kb, 5.25''
  888.     * 2 = 1.2Mb, 5.25''
  889.     * 3 = 720Kb, 3.5''
  890.     * 4 = 1.44Mb, 3.5''
  891.     * 5 = 2.88Mb, 3.5'' (such drives are not used anymore)
  892.     For example, for the standard configuration from one 1.44-drive
  893.     here will be 40h, and for the case 1.2Mb on A: and 1.44Mb on B:
  894.     the value is 24h.
  895.  
  896.   First IDE controller:
  897.   * +1: byte: information about hard disks and CD-drives, AABBCCDD,
  898.     where AA corresponds to the controller IDE0, ..., DD - IDE3:
  899.     * 0 = device not found
  900.     * 1 = hard drive
  901.     * 2 = CD-drive
  902.     For example, in the case HD on IDE0 and CD on IDE2
  903.     this field contains 48h.
  904.   * +2: 4 db: number of the retrieved partitions on hard disks
  905.     at accordingly IDE0,...,IDE3.
  906.  
  907.   Second IDE controller:
  908.   * +6: byte: information about hard disks and CD-drives, AABBCCDD,
  909.     where AA corresponds to the controller IDE4, ..., DD - IDE7:
  910.     * 0 = device not found
  911.     * 1 = hard drive
  912.     * 2 = CD-drive
  913.     For example, in the case HD on IDE4 and CD on IDE6
  914.     this field contains 48h.
  915.   * +7: 4 db: number of the retrieved partitions on hard disks
  916.     at accordingly IDE4,...,IDE7.
  917.  
  918.   Third IDE controller:
  919.   * +11: byte: information about hard disks and CD-drives, AABBCCDD,
  920.     where AA corresponds to the controller IDE8, ..., DD - IDE11:
  921.     * 0 = device not found
  922.     * 1 = hard drive
  923.     * 2 = CD-drive
  924.     For example, in the case HD on IDE8 and CD on IDE10
  925.     this field contains 48h.
  926.   * +12: 4 db: number of the retrieved partitions on hard disks
  927.     at accordingly IDE8,...,IDE11.
  928.  
  929.     If the hard disk on IDEx is absent, appropriate byte is zero,
  930.     otherwise it shows number of the recognized partitions, which
  931.     can be not presented (if the drive is not formatted or if
  932.     the file system is not supported). Current version of the kernel
  933.     supports only FAT12/16/32, NTFS, ext2/3/4 and XFS for hard disks.
  934.  
  935. Remarks:
  936.   * The table can be used for obtaining the information about
  937.     available devices.
  938.  
  939. ---------------------- Constants for registers: ----------------------
  940.   eax - SF_SYSTEM (18)
  941.   ebx - SSF_INFO_DISC_SYS (11)
  942. ======================================================================
  943. ========== Function 18, subfunction 13 - get kernel version. =========
  944. ======================================================================
  945. Parameters:
  946.   * eax = 18 - function number
  947.   * ebx = 13 - subfunction number
  948.   * ecx = pointer to the buffer (not less than 16 bytes), where
  949.     the information will be placed
  950. Returned value:
  951.   * function does not return value
  952.     but if pointer in ecx is illegal, for example,
  953.     [ecx, ecx + 9) region intersects with kernel memory,
  954.     then function returns -1
  955. Remarks:
  956.   * At the moment only the part of the buffer by a size
  957.     9 bytes is used. Nevertheless it is recommended to use
  958.     16 byte buffer for the future compatibility, in the future
  959.     some fields can be added.
  960. Structure of the buffer:
  961. db a,b,c,d for version a.b.c.d
  962. db 0: reserved
  963. dd REV - kernel SVN revision number
  964. For Kolibri 0.7.7.0+ kernel:
  965. db 0,7,7,0
  966. db 0
  967. dd 1675
  968.  
  969. ---------------------- Constants for registers: ----------------------
  970.   eax - SF_SYSTEM (18)
  971.   ebx - SSF_KERNEL_VERSION (13)
  972. ======================================================================
  973. ======= Function 18, subfunction 14 - wait for screen retrace. =======
  974. ======================================================================
  975. Waits for the beginning of retrace of the scanning ray of the screen
  976. monitor.
  977. Parameters:
  978.   * eax = 18 - function number
  979.   * ebx = 14 - subfunction number
  980. Returned value:
  981.   * eax = 0 as the tag of success
  982. Remarks:
  983.   * Function is intended only for active high-efficiency graphics
  984.     applications; is used for smooth output of a graphics.
  985.  
  986. ---------------------- Constants for registers: ----------------------
  987.   eax - SF_SYSTEM (18)
  988.   ebx - SSF_WAIT_RETRACE (14)
  989. ======================================================================
  990. == Function 18, subfunction 15 - center mouse cursor on the screen. ==
  991. ======================================================================
  992. Parameters:
  993.   * eax = 18 - function number
  994.   * ebx = 15 - subfunction number
  995. Returned value:
  996.   * eax = 0 as the tag of success
  997.  
  998. ---------------------- Constants for registers: ----------------------
  999.   eax - SF_SYSTEM (18)
  1000.   ebx - SSF_CURSOR_CENTER (15)
  1001. ======================================================================
  1002. ========= Function 18, subfunction 16 - get size of free RAM. ========
  1003. ======================================================================
  1004. Parameters:
  1005.   * eax = 18 - function number
  1006.   * ebx = 16 - subfunction number
  1007. Returned value:
  1008.   * eax = size of free memory in kilobytes
  1009.  
  1010. ---------------------- Constants for registers: ----------------------
  1011.   eax - SF_SYSTEM (18)
  1012.   ebx - SSF_GET_FREE_RAM (16)
  1013. ======================================================================
  1014. ======== Function 18, subfunction 17 - get full amount of RAM. =======
  1015. ======================================================================
  1016. Parameters:
  1017.   * eax = 18 - function number
  1018.   * ebx = 17 - subfunction number
  1019. Returned value:
  1020.   * eax = total size of existing memory in kilobytes
  1021.  
  1022. ---------------------- Constants for registers: ----------------------
  1023.   eax - SF_SYSTEM (18)
  1024.   ebx - SSF_GET_TOTAL_RAM (17)
  1025. ======================================================================
  1026. ===================== Function 18, subfunction 18 ====================
  1027. ============= Terminate process/thread by the identifier. ============
  1028. ======================================================================
  1029. Parameters:
  1030.   * eax = 18 - function number
  1031.   * ebx = 18 - subfunction number
  1032.   * ecx = identifier of process/thread (PID/TID)
  1033. Returned value:
  1034.   * eax = 0 - success
  1035.   * eax = -1 - error (process is not found or is system)
  1036. Remarks:
  1037.   * It is impossible to terminate system thread OS/IDLE (identifier
  1038.     1), it is possible to terminate any normal process/thread.
  1039.   * See also subfunction 2 - terminate
  1040.     process/thread by given slot.
  1041.  
  1042. ---------------------- Constants for registers: ----------------------
  1043.   eax - SF_SYSTEM (18)
  1044.   ebx - SSF_TERMINATE_THREAD_ID (18)
  1045. ======================================================================
  1046. ======== Function 18, subfunction 19 - get/set mouse features. =======
  1047. ======================================================================
  1048.  
  1049. ---------------- Subsubfunction 0 - get mouse speed. -----------------
  1050. Parameters:
  1051.   * eax = 18 - function number
  1052.   * ebx = 19 - subfunction number
  1053.   * ecx = 0 - subsubfunction number
  1054. Returned value:
  1055.   * eax = current speed divider
  1056.  
  1057. ---------------- Subsubfunction 1 - set mouse speed. -----------------
  1058. Parameters:
  1059.   * eax = 18 - function number
  1060.   * ebx = 19 - subfunction number
  1061.   * ecx = 1 - subsubfunction number
  1062.   * edx = new value for speed divider
  1063. Returned value:
  1064.   * function does not return value
  1065.  
  1066. Remark: recommended speed divider = 4
  1067.  
  1068. -------------- Subsubfunction 2 - get mouse sensitivity --------------
  1069. Parameters:
  1070.   * eax = 18 - function number
  1071.   * ebx = 19 - subfunction number
  1072.   * ecx = 2 - subsubfunction number
  1073. Returned value:
  1074.   * eax = current sensitivity
  1075.  
  1076. -------------- Subsubfunction 3 - set mouse sensitivity --------------
  1077. Parameters:
  1078.   * eax = 18 - function number
  1079.   * ebx = 19 - subfunction number
  1080.   * ecx = 3 - subsubfunction number
  1081.   * edx = new value for sensitivity
  1082. Returned value:
  1083.   * function does not return value
  1084.  
  1085. Remark: recommended sensitivity = 3
  1086.  
  1087. ----------- Subsubfunction 4 - set mouse pointer position. -----------
  1088. Parameters:
  1089.   * eax = 18 - function number
  1090.   * ebx = 19 - subfunction number
  1091.   * ecx = 4 - subsubfunction number
  1092.   * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
  1093. Returned value:
  1094.   * function does not return value
  1095.  
  1096. -------- Subsubfunction 5 - simulate state of mouse buttons. ---------
  1097. Parameters:
  1098.   * eax = 18 - function number
  1099.   * ebx = 19 - subfunction number
  1100.   * ecx = 5 - subsubfunction number
  1101.   * edx = information about emulated state of mouse buttons:
  1102.     (same as return value in subfunction 2 of function 37)
  1103.     * bit 0 is set = left button is pressed
  1104.     * bit 1 is set = right button is pressed
  1105.     * bit 2 is set = middle button is pressed
  1106.     * bit 3 is set = 4th button is pressed
  1107.     * bit 4 is set = 5th button is pressed
  1108. Returned value:
  1109.   * function does not return value
  1110.  
  1111. -------------- Subsubfunction 6 - get doubleclick delay. -------------
  1112. Parameters:
  1113.   * eax = 18 - function number
  1114.   * ebx = 19 - subfunction number
  1115.   * ecx = 6 - subsubfunction number
  1116. Returned value:
  1117.   * eax = current doubleclick delay (100 = 1 second)
  1118.  
  1119. -------------- Subsubfunction 7 - set doubleclick delay. -------------
  1120. Parameters:
  1121.   * eax = 18 - function number
  1122.   * ebx = 19 - subfunction number
  1123.   * ecx = 7 - subsubfunction number
  1124.   * dl  = new value for doubleclick delay (100 = 1 second)
  1125. Returned value:
  1126.   * function does not return value
  1127.  
  1128. Remark: mouse settings can be modified in the application mouse_cfg.
  1129.  
  1130. ---------------------- Constants for registers: ----------------------
  1131.   eax - SF_SYSTEM (18)
  1132.   ebx - SSF_MOUSE_SETTINGS (19)
  1133.   ecx - SSSF_GET_SPEED (0), SSSF_SET_SPEED (1), SSSF_GET_SPEEDUP (2),
  1134.     SSSF_SET_SPEEDUP (3), SSSF_SET_POS (4), SSSF_SET_BUTTON (5),
  1135.     SSSF_GET_DOUBLE_CLICK_DELAY (6), SSSF_SET_DOUBLE_CLICK_DELAY (7)
  1136. ======================================================================
  1137. ======== Function 18, subfunction 20 - get information on RAM. =======
  1138. ======================================================================
  1139. Parameters:
  1140.   * eax = 18 - function number
  1141.   * ebx = 20 - subfunction number
  1142.   * ecx = pointer to the buffer for information (36 bytes)
  1143. Returned value:
  1144.   * eax = total size of existing RAM in pages
  1145.     or -1 if error has occurred
  1146.   * buffer pointed to by ecx contains the following information:
  1147.     * +0:  dword: total size of existing RAM in pages
  1148.     * +4:  dword: size of free RAM in pages
  1149.     * +8:  dword: number of page faults (exceptions #PF)
  1150.                  in applications
  1151.     * +12: dword: size of kernel heap in bytes
  1152.     * +16: dword: free in kernel heap in bytes
  1153.     * +20: dword: total number of memory blocks in kernel heap
  1154.     * +24: dword: number of free memory blocks in kernel heap
  1155.     * +28: dword: size of maximum free block in kernel heap
  1156.                  (reserved)
  1157.     * +32: dword: size of maximum allocated block in kernel heap
  1158.                  (reserved)
  1159.  
  1160. ---------------------- Constants for registers: ----------------------
  1161.   eax - SF_SYSTEM (18)
  1162.   ebx - SSF_GET_RAM_INFO (20)
  1163. ======================================================================
  1164. ===================== Function 18, subfunction 21 ====================
  1165. ======== Get slot number of process/thread by the identifier. ========
  1166. ======================================================================
  1167. Parameters:
  1168.   * eax = 18 - function number
  1169.   * ebx = 21 - subfunction number
  1170.   * ecx = identifier of process/thread (PID/TID)
  1171. Returned value:
  1172.   * eax = 0 - error (invalid identifier)
  1173.   * otherwise eax = slot number
  1174.  
  1175. ---------------------- Constants for registers: ----------------------
  1176.   eax - SF_SYSTEM (18)
  1177.   ebx - SSF_GET_THREAD_SLOT (21)
  1178. ======================================================================
  1179. ===================== Function 18, subfunction 22 ====================
  1180. ============== Operations with window of another thread. =============
  1181. ======================================================================
  1182. Parameters:
  1183.   * eax = 18 - function number
  1184.   * ebx = 22 - subfunction number
  1185.   * ecx = operation type:
  1186.     * 0 = minimize window of the thread with given slot number
  1187.     * 1 = minimize window of the thread with given identifier
  1188.     * 2 = restore window of the thread with given slot number
  1189.     * 3 = restore window of the thread with given identifier
  1190.   * edx = parameter (slot number or PID/TID)
  1191. Returned value:
  1192.   * eax = 0 - success
  1193.   * eax = -1 - error (invalid identifier)
  1194. Remarks:
  1195.   * The thread can minimize its window with subfunction 10.
  1196.   * One can restore and activate window simultaneously with
  1197.     subfunction 3 (which requires slot number).
  1198.  
  1199. ---------------------- Constants for registers: ----------------------
  1200.   eax - SF_SYSTEM (18)
  1201.   ebx - SSF_FOREIGN_WINDOW (22)
  1202.   ecx - SSSF_MINIMIZE (0), SSSF_MINIMIZE_ID (1), SSSF_RESTORE (2),
  1203.     SSSF_RESTORE_ID (3)
  1204. ======================================================================
  1205. ======== Function 18, subfunction 23 - minimize all windows. ==========
  1206. ======================================================================
  1207. Parameters:
  1208.   * eax = 18 - function number
  1209.   * ebx = 23 - subfunction number
  1210. Returned value:
  1211.   * eax = 0 - all windows have been minimized before a function call
  1212.   * eax = N - number of windows minimized from function
  1213. Remarks:
  1214.   * Window of special thread (name begin to symbol @) is not minimize.
  1215.  
  1216. ---------------------- Constants for registers: ----------------------
  1217.   eax - SF_SYSTEM (18)
  1218.   ebx - SSF_MINIMIZE_ALL (23)
  1219. ======================================================================
  1220. ======= Function 18, subfunction 24 - set limits of screen. ==========
  1221. ======================================================================
  1222. Parameters:
  1223.   * eax = 18 - function number
  1224.   * ebx = 24 - subfunction number
  1225.   * ecx = new X size
  1226.   * edx = new Y size
  1227. Returned value:
  1228.   * function does not return value
  1229. Remarks:
  1230.   * The function does not change the physical size of the video mode.
  1231.     It is designed for non-standard displays which display the image
  1232.     partially.
  1233.   * The sizes specified in the function should not exceed the sizes
  1234.     of the current video mode, otherwise the function will not change
  1235.     anything.
  1236.  
  1237. ---------------------- Constants for registers: ----------------------
  1238.   eax - SF_SYSTEM (18)
  1239.   ebx - SSF_SET_SCREEN_LIMITS (24)
  1240. ======================================================================
  1241. ===================== Function 18, subfunction 25 ====================
  1242. ===== Control position of the window relative to other windows. ======
  1243. ======================================================================
  1244.  
  1245. ------------- Subsubfunction 1 - get position  -----------------------
  1246. Parameters:
  1247.   * eax = 18 - function number
  1248.   * ebx = 25 - subfunction number
  1249.   * ecx = 1 - subsubfunction number
  1250.   * edx = -1(for current window) or PID application
  1251. Returned value:
  1252.   * eax = one of the constants window position
  1253.  
  1254. ------------- Subsubfunction 2 - set position  -----------------------
  1255. Parameters:
  1256.   * eax = 18 - function number
  1257.   * ebx = 25 - subfunction number
  1258.   * ecx = 2 - subsubfunction number
  1259.   * edx = -1(for current window) or PID application
  1260.   * esi = new window position (one of the constants below)
  1261. Returned value:
  1262.   * eax = 0 - error
  1263.   * eax = 1 - success
  1264.  
  1265. Constant position of the window relative to other windows:
  1266.  ZPOS_DESKTOP     = -2 - on the background
  1267.  ZPOS_ALWAYS_BACK = -1 - behind all the windows
  1268.  ZPOS_NORMAL      = 0  - normal
  1269.  ZPOS_ALWAYS_TOP  = 1  - on top of all windows
  1270.  
  1271. ---------------------- Constants for registers: ----------------------
  1272.   eax - SF_SYSTEM (18)
  1273.   ebx - SSF_WINDOW_BEHAVIOR (25)
  1274.   ecx - SSSF_GET_WB (1), SSSF_SET_WB (2)
  1275. ======================================================================
  1276. ==================== Function 20 - MIDI interface. ===================
  1277. ======================================================================
  1278.  
  1279. ----------------------- Subfunction 1 - reset ------------------------
  1280. Parameters:
  1281.   * eax = 20 - function number
  1282.   * ebx = 1 - subfunction number
  1283.  
  1284. -------------------- Subfunction 2 - output byte ---------------------
  1285. Parameters:
  1286.   * eax = 20 - function number
  1287.   * ebx = 2 - subfunction number
  1288.   * cl = byte for output
  1289. Returned value (is the same for both subfunctions):
  1290.   * eax = 0 - success
  1291.   * eax = 1 - base port is not defined
  1292. Remarks:
  1293.   * Previously the base port must be defined by
  1294.     subfunction 1 of function 21.
  1295.  
  1296. ---------------------- Constants for registers: ----------------------
  1297.   eax - SF_MIDI (20)
  1298.   ebx - SSF_RESET (1), SSF_OUTPUT (2)
  1299. ======================================================================
  1300. ======== Function 21, subfunction 1 - set MPU MIDI base port. ========
  1301. ======================================================================
  1302. Parameters:
  1303.   * eax = 21 - function number
  1304.   * ebx = 1 - subfunction number
  1305.   * ecx = number of base port
  1306. Returned value
  1307.   * eax = 0 - success
  1308.   * eax = -1 - erratic number of a port
  1309. Remarks:
  1310.   * Number of a port must satisfy to conditions 0x100<=ecx<=0xFFFF.
  1311.   * The installation of base is necessary for function 20.
  1312.   * To get base port use subfunction 1 of function 26.
  1313.  
  1314. ---------------------- Constants for registers: ----------------------
  1315.   eax - SF_SYSTEM_SET (21)
  1316.   ebx - SSF_MPU_MIDI_BASE (1)
  1317. ======================================================================
  1318. ========== Function 21, subfunction 2 - set keyboard layout. =========
  1319. ======================================================================
  1320. Keyboard layout is used to convert keyboard scancodes to ASCII-codes,
  1321. which will be read by function 2.
  1322. Parameters:
  1323.   * eax = 21 - function number
  1324.   * ebx = 2 - subfunction number
  1325.   * ecx = which layout to set:
  1326.     * 1 = normal layout
  1327.     * 2 = layout at pressed Shift
  1328.     * 3 = layout at pressed Alt
  1329.   * edx = pointer to layout - table of length 128 bytes
  1330. Or:
  1331.   * ecx = 9
  1332.   * dx = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
  1333. Returned value:
  1334.   * eax = 0 - success
  1335.   * eax = 1 - incorrect parameter
  1336. Remarks:
  1337.   * If Alt is pressed, the layout with Alt is used;
  1338.     if Alt is not pressed, but Shift is pressed,
  1339.     the layout with Shift is used;
  1340.     if Alt and Shift are not pressed, but Ctrl is pressed, the normal
  1341.     layout is used and then from the code is subtracted 0x60;
  1342.     if no control key is pressed, the normal layout is used.
  1343.   * To get layout and country identifier use
  1344.     subfunction 2 of function 26.
  1345.   * Country identifier is global system variable, which is not used
  1346.     by the kernel itself; however the application '@taskbar' displays
  1347.     the corresponding icon.
  1348.   * The application @taskbar switches layouts on user request.
  1349.  
  1350. ---------------------- Constants for registers: ----------------------
  1351.   eax - SF_SYSTEM_SET (21)
  1352.   ebx - SSF_KEYBOARD_LAYOUT (2)
  1353. ======================================================================
  1354. ========== Function 21, subfunction 5 - set system language. =========
  1355. ======================================================================
  1356. Parameters:
  1357.   * eax = 21 - function number
  1358.   * ebx = 5 - subfunction number
  1359.   * ecx = system language (1=eng, 2=fi, 3=ger, 4=rus)
  1360. Returned value:
  1361.   * eax = 0
  1362. Remarks:
  1363.   * System language is global system variable and is not used
  1364.     by the kernel itself, however application @taskbar draws the
  1365.     appropriate icon.
  1366.   * Function does not check for correctness, as the kernel does not
  1367.     use this variable.
  1368.   * To get system language use subfunction 5 of function 26.
  1369.  
  1370. ---------------------- Constants for registers: ----------------------
  1371.   eax - SF_SYSTEM_SET (21)
  1372.   ebx - SSF_SYS_LANG (5)
  1373. ======================================================================
  1374.  Function 21, subfunction 11 - enable/disable low-level access to HD.
  1375. ======================================================================
  1376. Parameters:
  1377.   * eax = 21 - function number
  1378.   * ebx = 11 - subfunction number
  1379.   * ecx = 0/1 - disable/enable
  1380. Returned value:
  1381.   * eax = 0
  1382. Remarks:
  1383.   * Is used in LBA-read (subfunction 8 of function 58).
  1384.   * The current implementation uses only low bit of ecx.
  1385.   * To get current status use subfunction 11 of function 26.
  1386.  
  1387. ---------------------- Constants for registers: ----------------------
  1388.   eax - SF_SYSTEM_SET (21)
  1389.   ebx - SSF_ACCESS_HD_LBA (11)
  1390. ======================================================================
  1391.  Function 21, subfunction 12 - enable/disable low-level access to PCI.
  1392. ======================================================================
  1393. Parameters:
  1394.   * eax = 21 - function number
  1395.   * ebx = 12 - subfunction number
  1396.   * ecx = 0/1 - disable/enable
  1397. Returned value:
  1398.   * eax = 0
  1399. Remarks:
  1400.   * Is used in operations with PCI bus (function 62).
  1401.   * The current implementation uses only low bit of ecx.
  1402.   * To get current status use subfunction 12 of function 26.
  1403.  
  1404. ---------------------- Constants for registers: ----------------------
  1405.   eax - SF_SYSTEM_SET (21)
  1406.   ebx - SSF_ACCESS_PCI (12)
  1407. ======================================================================
  1408. ================= Function 22 - set system date/time. ================
  1409. ======================================================================
  1410. Parameters:
  1411.   * eax = 22 - function number
  1412.   * ebx = 0 - set time
  1413.     * ecx = 0x00SSMMHH - time in the binary-decimal code (BCD):
  1414.     * HH=hour 00..23
  1415.     * MM=minute 00..59
  1416.     * SS=second 00..59
  1417.   * ebx = 1 - set date
  1418.     * ecx = 0x00DDMMYY - date in the binary-decimal code (BCD):
  1419.     * DD=day 01..31
  1420.     * MM=month 01..12
  1421.     * YY=year 00..99
  1422.   * ebx = 2 - set day of week
  1423.     * ecx = 1 for Sunday, ..., 7 for Saturday
  1424.   * ebx = 3 - set alarm clock
  1425.     * ecx = 0x00SSMMHH
  1426. Returned value:
  1427.   * eax = 0 - success
  1428.   * eax = 1 - incorrect parameter
  1429.   * eax = 2 - CMOS-battery was unloaded
  1430. Remarks:
  1431.   * Value of installation of day of week seems to be doubtful,
  1432.     as it a little where is used
  1433.     (day of week can be calculated by date).
  1434.   * Alarm clock can be set on operation in the given time every day.
  1435.     But there is no existing system function to disable it.
  1436.   * Operation of alarm clock consists in generation IRQ8.
  1437.   * Generally CMOS supports for alarm clock set of value 0xFF
  1438.     as one of parameters and it means that the appropriate parameter
  1439.     is ignored. But current implementation does not allow this
  1440.     (will return 1).
  1441.   * Alarm clock is a global system resource; the set of
  1442.     an alarm clock cancels automatically the previous set.
  1443.     However, at moment no program uses it.
  1444.  
  1445. ---------------------- Constants for registers: ----------------------
  1446.   eax - SF_SET_TIME_DATE (22)
  1447. ======================================================================
  1448. ============= Function 23 - wait for event with timeout. =============
  1449. ======================================================================
  1450. If the message queue is empty, waits for new message in the queue,
  1451. but no more than given time. Then reads out a message from the queue.
  1452.  
  1453. Parameters:
  1454.   * eax = 23 - function number
  1455.   * ebx = timeout (in 1/100 of second)
  1456. Returned value:
  1457.   * eax = 0 - the message queue is empty
  1458.   * otherwise eax = event (see the list of events)
  1459. Remarks:
  1460.   * Only those events are taken into account, which enter into
  1461.     the mask set by function 40. By default it is
  1462.     redraw, key and button events.
  1463.   * To check for presence of a message in the queue use function 11.
  1464.     To wait without timeout use function 10.
  1465.   * Transmission ebx=0 results in immediate returning eax=0.
  1466.   * Current implementation returns immediately with eax=0,
  1467.     if the addition of ebx with the current value of time counter
  1468.     makes 32-bit overflow.
  1469.  
  1470. ---------------------- Constants for registers: ----------------------
  1471.   eax - SF_WAIT_EVENT_TIMEOUT (23)
  1472. ======================================================================
  1473. ======= Function 24, subfunction 4 - eject tray of disk drive. =======
  1474. ======================================================================
  1475. Parameters:
  1476.   * eax = 24 - function number
  1477.   * ebx = 4 - subfunction number
  1478.   * ecx = position of CD/DVD-drive
  1479.     from 0=Primary Master to 3=Secondary Slave for first IDE contr.
  1480.     from 4=Primary Master to 7=Secondary Slave for second IDE contr.
  1481.     from 8=Primary Master to 11=Secondary Slave for third IDE contr.
  1482. Returned value:
  1483.   * function does not return value
  1484. Remarks:
  1485.   * The function is supported only for ATAPI devices (CD and DVD).
  1486.   * When the tray is being ejected,
  1487.     manual control of tray is unlocked.
  1488.   * When the tray is being ejected, the code clears the cache for
  1489.     corresponding device.
  1490.   * An example of usage of the function is the application CD_tray.
  1491.  
  1492. ---------------------- Constants for registers: ----------------------
  1493.   eax - SF_CD (24)
  1494.   ebx - SSF_EJECT_TRAY (4), SSF_INSERT_TRAY (5)
  1495. ======================================================================
  1496. ======== Function 24, subfunction 5 - load tray of disk drive. =======
  1497. ======================================================================
  1498. Parameters:
  1499.   * eax = 24 - function number
  1500.   * ebx = 5 - subfunction number
  1501.   * ecx = position of CD/DVD-drive
  1502.     from 0=Primary Master to 3=Secondary Slave for first IDE contr.
  1503.     from 4=Primary Master to 7=Secondary Slave for second IDE contr.
  1504.     from 8=Primary Master to 11=Secondary Slave for third IDE contr.
  1505. Returned value:
  1506.   * function does not return value
  1507. Remarks:
  1508.   * The function is supported only for ATAPI devices (CD and DVD).
  1509.   * An example of usage of the function is the application CD_tray.
  1510.  
  1511. ---------------------- Constants for registers: ----------------------
  1512.   eax - SF_CD (24)
  1513.   ebx - SSF_EJECT_TRAY (4), SSF_INSERT_TRAY (5)
  1514. ======================================================================
  1515. ======= Function 25 - put image area on the background layer. ========
  1516. ======================================================================
  1517. Parameters:
  1518.   * eax = 25 - function number
  1519.   * ebx = pointer to the previously allocated memory area,
  1520.         where placed the source images in a format BBGGRRTTBBGGRRTT...
  1521.   * ecx = [size on axis x]*65536 + [size on axis y]
  1522.   * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
  1523. Returned value:
  1524.   * function does not return value
  1525. Remarks:
  1526.   * Coordinates of the image are coordinates of the upper left corner
  1527.     of the image relative to the screen.
  1528.   * Size of the image in bytes is 4*xsize*ysize
  1529.   * TT - byte pointer of transparency, at current version:
  1530.          1 to FF - opaque, 0 - transparent.
  1531.   * The function places the image directly to LFB. It is not for
  1532.     background image f.15. Options f.15 to f.25 does not make sense.
  1533.  
  1534. ---------------------- Constants for registers: ----------------------
  1535.   eax - SF_SCREEN_PUT_IMAGE (25)
  1536. ======================================================================
  1537. ======== Function 26, subfunction 1 - get MPU MIDI base port. ========
  1538. ======================================================================
  1539. Parameters:
  1540.   * eax = 26 - function number
  1541.   * ebx = 1 - subfunction number
  1542. Returned value:
  1543.   * eax = port number
  1544. Parameters:
  1545.   * To set base port use subfunction 1 of function 21.
  1546.  
  1547. ---------------------- Constants for registers: ----------------------
  1548.   eax - SF_SYSTEM_GET (26)
  1549.   ebx - SSF_MPU_MIDI_BASE (1)
  1550. ======================================================================
  1551. ========== Function 26, subfunction 2 - get keyboard layout. =========
  1552. ======================================================================
  1553. The keyboard layout is used to convert keyboard scancodes to
  1554. ASCII-codes for function 2.
  1555. Parameters:
  1556.   * eax = 26 - function number
  1557.   * ebx = 2 - subfunction number
  1558.   * ecx = what layout to get:
  1559.     * 1 = normal layout
  1560.     * 2 = layout with pressed Shift
  1561.     * 3 = layout with pressed Alt
  1562.   * edx = pointer to the 128-bytes buffer, where the layout will be
  1563.     copied
  1564. Returned value:
  1565.   * function does not return value
  1566.     but if pointer in edx is illegal, for example,
  1567.     [edx, edx + 128) region intersects with kernel memory,
  1568.     then function returns -1
  1569. Or:
  1570.   * eax = 26 - function number
  1571.   * ebx = 2 - subfunction number
  1572.   * ecx = 9
  1573. Returned value:
  1574.   * eax = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
  1575. Remarks:
  1576.   * If Alt is pressed, the layout with Alt is used;
  1577.     if Alt is not pressed, but Shift is pressed,
  1578.     the layout with Shift is used;
  1579.     if Alt and Shift are not pressed, but Ctrl is pressed, the normal
  1580.     layout is used and then from the code is subtracted 0x60;
  1581.     if no control key is pressed, the normal layout is used.
  1582.   * To set layout and country identifier use
  1583.     subfunction 2 of function 21.
  1584.   * Country identifier is global system variable, which is not used
  1585.     by the kernel itself; however the application '@taskbar' displays
  1586.     the corresponding icon (using this function).
  1587.   * The application @taskbar switches layouts on user request.
  1588.  
  1589. ---------------------- Constants for registers: ----------------------
  1590.   eax - SF_SYSTEM_GET (26)
  1591.   ebx - SSF_KEYBOARD_LAYOUT (2)
  1592. ======================================================================
  1593. ========== Function 26, subfunction 5 - get system language. =========
  1594. ======================================================================
  1595. Parameters:
  1596.   * eax = 26 - function number
  1597.   * ebx = 5 - subfunction number
  1598. Returned value:
  1599.   * eax = system language (1=eng, 2=fi, 3=ger, 4=rus)
  1600. Remarks:
  1601.   * System language is global system variable and is not used
  1602.     by the kernel itself, however application @taskbar draws the
  1603.     appropriate icon (using this function).
  1604.   * To set system language use subfunction 5 of function 21.
  1605.  
  1606. ---------------------- Constants for registers: ----------------------
  1607.   eax - SF_SYSTEM_GET (26)
  1608.   ebx - SSF_SYS_LANG (5)
  1609. ======================================================================
  1610. === Function 26, subfunction 9 - get the value of the time counter. ==
  1611. ======================================================================
  1612. Parameters:
  1613.   * eax = 26 - function number
  1614.   * ebx = 9 - subfunction number
  1615. Returned value:
  1616.   * eax = number of 1/100s of second, past from the system boot time
  1617. Remarks:
  1618.   * Counter takes modulo 2^32, that correspond to a little more
  1619.     than 497 days.
  1620.   * To get system time use function 3.
  1621.  
  1622. ---------------------- Constants for registers: ----------------------
  1623.   eax - SF_SYSTEM_GET (26)
  1624.   ebx - SSF_TIME_COUNT (9)
  1625. ======================================================================
  1626. ===================== Function 26, subfunction 10 ====================
  1627. ========== Get the value of the high precision time counter. =========
  1628. ======================================================================
  1629. Parameters:
  1630.   * eax = 26 - function number
  1631.   * ebx = 10 - subfunction number
  1632. Returned value:
  1633.   * eax = number of nanoseconds since system boot time (lower DWORD)
  1634.   * edx = number of nanoseconds since system boot time (high DWORD)
  1635. Remarks:
  1636.   * The counter is based on HPET, if HPET is not available, resolution
  1637.     will be reduced to 10 000 000 nanoseconds.
  1638.  
  1639. ---------------------- Constants for registers: ----------------------
  1640.   eax - SF_SYSTEM_GET (26)
  1641.   ebx - SSF_TIME_COUNT_PRO (10)
  1642. ======================================================================
  1643. ===================== Function 26, subfunction 11 ====================
  1644. ========== Find out whether low-level HD access is enabled. ==========
  1645. ======================================================================
  1646. Parameters:
  1647.   * eax = 26 - function number
  1648.   * ebx = 11 - subfunction number
  1649. Returned value:
  1650.   * eax = 0/1 - disabled/enabled
  1651. Remarks:
  1652.   * Is used in LBA read (subfunction 8 of function 58).
  1653.   * To set current state use subfunction 11 of function 21.
  1654.  
  1655. ---------------------- Constants for registers: ----------------------
  1656.   eax - SF_SYSTEM_GET (26)
  1657.   ebx - SSF_ACCESS_HD_LBA (11)
  1658. ======================================================================
  1659. ===================== Function 26, subfunction 12 ====================
  1660. ========== Find out whether low-level PCI access is enabled. =========
  1661. ======================================================================
  1662. Parameters:
  1663.   * eax = 26 - function number
  1664.   * ebx = 12 - subfunction number
  1665. Returned value:
  1666.   * eax = 0/1 - disabled/enabled
  1667. Remarks:
  1668.   * Is used by operations with PCI bus (function 62).
  1669.   * The current implementation uses only low bit of ecx.
  1670.   * To set the current state use subfunction 12 of function 21.
  1671.  
  1672. ---------------------- Constants for registers: ----------------------
  1673.   eax - SF_SYSTEM_GET (26)
  1674.   ebx - SSF_ACCESS_PCI (12)
  1675. ======================================================================
  1676. =================== Function 29 - get system date. ===================
  1677. ======================================================================
  1678. Parameters:
  1679.   * eax = 29 - function number
  1680. Returned value:
  1681.   * eax = 0x00DDMMYY, where
  1682.     (binary-decimal coding, BCD, is used)
  1683.   * YY = two low digits of year (00..99)
  1684.   * MM = month (01..12)
  1685.   * DD = day (01..31)
  1686. Remarks:
  1687.   * To set system date use function 22.
  1688.  
  1689. ---------------------- Constants for registers: ----------------------
  1690.   eax - SF_GET_SYS_DATE (29)
  1691. ======================================================================
  1692. ============= Function 30 - work with the current folder. ============
  1693. ======================================================================
  1694. --------- Subfunction 1 - set current folder for the thread. ---------
  1695. Parameters:
  1696.   * eax = 30 - function number
  1697.   * ebx = 1 - subfunction number
  1698.   * ecx = pointer to string with the path to new current folder,
  1699.     rules of path forming can be found in function 70 description.
  1700. Returned value:
  1701.   * function does not return value
  1702. ----------------------------------------------------------------------
  1703. --------- Subfunction 2 - get current folder for the thread. ---------
  1704. Parameters:
  1705.   * eax = 30 - function number
  1706.   * ebx = 2 - subfunction number
  1707.   * ecx = pointer to buffer
  1708.   * edx = size of buffer
  1709. Returned value:
  1710.   * eax = size of the string (including terminating 0)
  1711. Remarks:
  1712.   * If the buffer is too small to hold all path, only part of the string
  1713.     will be copied and terminated with 0.
  1714.   * By default, current folder for the thread is "/sys".
  1715.   * At process/thread creation the current folder will be inherited
  1716.     from the parent.
  1717. ----------------------------------------------------------------------
  1718. --- Subfunction 3 - install the add.system directory for the kernel --
  1719. Parameters:
  1720.   * eax = 30 - function number
  1721.   * ebx = 3 - subfunction number
  1722.   * ecx = pointer to a block of data:
  1723. key     rb  64
  1724. path    rb  64
  1725.     Example:
  1726. align 64
  1727. key     db  'kolibrios',0   ; key must be in lower case
  1728. align 64
  1729. path    db  'HD0/1',0
  1730.  
  1731. Returned value:
  1732.   * function does not return value
  1733. Remarks:
  1734.   * The function can be called only 1 time for 1 session of the OS.
  1735.   * On input the symbolic key is not changing by encoding.
  1736. ----------------------------------------------------------------------
  1737. ---- Subfunction 4 - set current folder, specifying the encoding. ----
  1738. Parameters:
  1739.   * eax = 30 - function number
  1740.   * ebx = 4 - subfunction number
  1741.   * ecx = pointer to string with the path to new current folder
  1742.   * edx = string encoding, details can be found in function 80 description.
  1743. Returned value:
  1744.   * function does not return value
  1745. ----------------------------------------------------------------------
  1746. ---- Subfunction 5 - get current folder, specifying the encoding. ----
  1747. Parameters:
  1748.   * eax = 30 - function number
  1749.   * ebx = 5 - subfunction number
  1750.   * ecx = pointer to buffer
  1751.   * edx = size of buffer
  1752.   * esi = string encoding
  1753. Returned value:
  1754.   * eax = size of the string in bytes (including terminating 0)
  1755. Remarks:
  1756.   * If the buffer is too small to hold all path, only part of the string
  1757.     will be copied and terminated with 0.
  1758.   * By default, current folder for the thread is "/sys".
  1759.   * At process/thread creation the current folder will be inherited
  1760.     from the parent.
  1761.  
  1762. ---------------------- Constants for registers: ----------------------
  1763.   eax - SF_CURRENT_FOLDER (30)
  1764.   ebx - SSF_SET_CF (1), SSF_GET_CF (2), SSF_ADD_SYS_FOLDER (3)
  1765. ======================================================================
  1766. ========= Function 34 - who owner the pixel on the screen. ===========
  1767. ======================================================================
  1768. Parameters:
  1769.   * eax = 34 - function number
  1770.   * ebx = x-coordinate (relative to the display)
  1771.   * ecx = y-coordinate (relative to the display)
  1772.  
  1773. Returned value:
  1774.   * eax = 0x000000XX - owner of pixel the slot window N
  1775.     If incorrect values ebx and ecx then function returns 0
  1776.   * The function takes the value from the area [_WinMapAddress]
  1777.  
  1778. ---------------------- Constants for registers: ----------------------
  1779.   eax - SF_GET_PIXEL_OWNER (34)
  1780. ======================================================================
  1781. ======= Function 35 - read the color of a pixel on the screen. =======
  1782. ======================================================================
  1783. Parameters:
  1784.   * eax = 35
  1785.   * ebx = y*xsize+x, where
  1786.   * (x,y) = coordinates of a pixel (beginning from 0)
  1787.   * xsize = horizontal screen size
  1788. Returned value:
  1789.   * eax = color 0x00RRGGBB
  1790. Remarks:
  1791.   * To get screen sizes use function 14. Pay attention,
  1792.     that it subtracts 1 from both sizes.
  1793.   * There is also direct access (without any system calls)
  1794.     to videomemory through the selector gs. To get parameters of
  1795.     the current videomode, use function 61.
  1796.  
  1797. ---------------------- Constants for registers: ----------------------
  1798.   eax - SF_GET_PIXEL (35)
  1799. ======================================================================
  1800. =================== Function 36 - read screen area. ==================
  1801. ======================================================================
  1802. Paramters:
  1803.   * eax = 36 - function number
  1804.   * ebx = pointer to the previously allocated memory area,
  1805.         where will be placed the image in the format BBGGRRBBGGRR...
  1806.   * ecx = [size on axis x]*65536 + [size on axis y]
  1807.   * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
  1808. Returned value:
  1809.   * function does not return value
  1810. Remarks:
  1811.   * Coordinates of the image are coordinates of the upper left corner
  1812.     of the image relative to the screen.
  1813.   * Size of the image in bytes is 3*xsize*ysize.
  1814.  
  1815. ---------------------- Constants for registers: ----------------------
  1816.   eax - SF_GET_IMAGE (36)
  1817. ======================================================================
  1818. =================== Function 37 - work with mouse. ===================
  1819. ======================================================================
  1820.  
  1821. ---------- Subfunction 0 - screen coordinates of the mouse -----------
  1822. Parameters:
  1823.   * eax = 37 - function number
  1824.   * ebx = 0 - subfunction number
  1825. Returned value:
  1826.   * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
  1827.     (beginning from 0)
  1828.  
  1829. -- Subfunction 1 - coordinates of the mouse relative to the window ---
  1830. Parameters:
  1831.   * eax = 37 - function number
  1832.   * ebx = 1 - subfunction number
  1833. Returned value:
  1834.   * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
  1835.     relative to the application window (beginning from 0)
  1836. Remarks:
  1837.   * The value is calculated by formula (x-xwnd)*65536 + (y-ywnd).
  1838.     If y>=ywnd, the low word is non-negative and contains
  1839.     relative y-coordinate, and the high word - relative x-coordinate
  1840.     (with correct sign). Otherwise the low word is negative and still
  1841.     contains relative y-coordinate, and to the high word
  1842.     1 should be added.
  1843.  
  1844. ------------- Subfunction 2 - states of the mouse buttons ------------
  1845. Parameters:
  1846.   * eax = 37 - function number
  1847.   * ebx = 2 - subfunction number
  1848. Returned value:
  1849.   * eax = bits 0-4 equal to subfunction 3
  1850.  
  1851. ------- Subfunction 3 - states and events of the mouse buttons -------
  1852. Parameters:
  1853.   * eax = 37 - function number
  1854.   * ebx = 3 - subfunction number
  1855. Returned value:
  1856.   * eax contains next information:
  1857.  
  1858. states:
  1859.   * bit 0 is set = left button is held
  1860.   * bit 1 is set = right button is held
  1861.   * bit 2 is set = middle button is held
  1862.   * bit 3 is set = 4th button is held
  1863.   * bit 4 is set = 5th button is held
  1864.  
  1865. events:
  1866.   * bit 8 is set = left button is pressed
  1867.   * bit 9 is set = right button is pressed
  1868.   * bit 10 is set = middle button is pressed
  1869.  
  1870.   * bit 15 is set = vertical scroll is used
  1871.  
  1872.   * bit 16 is set = left button is released
  1873.   * bit 17 is set = right button is released
  1874.   * bit 18 is set = middle button is released
  1875.  
  1876.   * bit 23 is set = horizontal scroll is used
  1877.  
  1878.   * bit 24 is set = doubleclick by left button
  1879.  
  1880. -------------------- Subfunction 4 - load cursor ---------------------
  1881. Parameters:
  1882.   * eax = 37 - function number
  1883.   * ebx = 4 - subfunction number
  1884.   * dx = data source:
  1885.   * dx = LOAD_FROM_FILE = 0 - data in a file
  1886.     * ecx = pointer to full path to the cursor file
  1887.     * the file must be in the format .cur, which is standard for
  1888.       MS Windows, at that of the size 32*32 pixels
  1889.   * dx = LOAD_FROM_MEM = 1 - data of file are already loaded in memory
  1890.     * ecx = pointer to data of the cursor file
  1891.     * the data format is the same as in the previous case
  1892.   * dx = LOAD_INDIRECT = 2 - data in memory
  1893.     * ecx = pointer to cursor image in the format ARGB 32*32 pixels
  1894.     * edx = 0xXXYY0002, where
  1895.       * XX = x-coordinate of cursor hotspot
  1896.       * YY = y-coordinate
  1897.       * 0 <= XX, YY <= 31
  1898. Returned value:
  1899.   * eax = 0 - failed
  1900.   * otherwise eax = cursor handle
  1901.  
  1902. --------------------- Subfunction 5 - set cursor ---------------------
  1903. Sets new cursor for the window of the current thread.
  1904. Parameters:
  1905.   * eax = 37 - function number
  1906.   * ebx = 5 - subfunction number
  1907.   * ecx = cursor handle
  1908. Returned value:
  1909.   * eax = handle of previous cursor
  1910. Remarks:
  1911.   * If the handle is incorrect, the function restores the default
  1912.     cursor (standard arrow). In particular, ecx=0 restores it.
  1913.  
  1914. ------------------- Subfunction 6 - delete cursor --------------------
  1915. Parameters:
  1916.   * eax = 37 - function number
  1917.   * ebx = 6 - subfunction number
  1918.   * ecx = cursor handle
  1919. Returned value:
  1920.   * eax destroyed
  1921. Remarks:
  1922.   * The cursor must be loaded previously by the current thread
  1923.     (with the call to subfunction 4). The function does not delete
  1924.     system cursors and cursors, loaded by another applications.
  1925.   * If the active cursor (set by subfunction 5) is deleted,
  1926.     the system restores the default cursor (standard arrow).
  1927.  
  1928. ------------------ Subfunction 7 - get scroll data -------------------
  1929. Parameters:
  1930.   * eax = 37 - function number
  1931.   * ebx = 7 - subfunction number
  1932. Returned value:
  1933.   * eax = [horizontal offset]*65536 + [vertical offset]
  1934. Remarks:
  1935.   * Scroll data is available for active window only.
  1936.   * Values are zeroed after reading.
  1937.   * Values are signed.
  1938.  
  1939. -------- Subfunction 8 - load cursor, specifying the encoding --------
  1940. Parameters:
  1941.   * eax = 37 - function number
  1942.   * ebx = 8 - subfunction number
  1943.   * ecx = pointer to the cursor file path string
  1944.   * edx = string encoding, details can be found in function 80 description.
  1945. Returned value:
  1946.   * eax = cursor handle, 0 - failed
  1947.  
  1948. ---------------------- Constants for registers: ----------------------
  1949.   eax - SF_MOUSE_GET (37)
  1950.   ebx - SSF_SCREEN_POSITION (0), SSF_WINDOW_POSITION (1),
  1951.     SSF_BUTTON (2), SSF_BUTTON_EXT (3), SSF_LOAD_CURSOR (4),
  1952.     SSF_SET_CURSOR (5), SSF_DEL_CURSOR (6), SSF_SCROLL_DATA (7)
  1953. ======================================================================
  1954. ====================== Function 38 - draw line. ======================
  1955. ======================================================================
  1956. Parameters:
  1957.   * eax = 38 - function number
  1958.   * ebx = [start coordinate on axis x]*65536 +
  1959.               [end coordinate on axis x]
  1960.   * ecx = [start coordinate on axis y]*65536 +
  1961.               [end coordinate on axis y]
  1962.   * edx = 0x00RRGGBB - color
  1963.     edx = 0x01xxxxxx - draw inversed line
  1964.           (low 24 bits are ignored)
  1965. Returned value:
  1966.   * function does not return value
  1967. Remarks:
  1968.   * Coordinates are relative to the window.
  1969.   * End point is also drawn.
  1970.  
  1971. ---------------------- Constants for registers: ----------------------
  1972.   eax - SF_DRAW_LINE (38)
  1973. ======================================================================
  1974. == Function 39, subfunction 1 - get a size of the background image. ==
  1975. ======================================================================
  1976. Parameters:
  1977.   * eax = 39 - function number
  1978.   * ebx = 1 - subfunction number
  1979. Returned value:
  1980.   * eax = [width]*65536 + [height]
  1981. Remarks:
  1982.   * There is a pair function to set sizes of background image -
  1983.     subfunction 1 of function 15. After which it is necessary,
  1984.     of course, anew to define image.
  1985.  
  1986. ---------------------- Constants for registers: ----------------------
  1987.   eax - SF_BACKGROUND_GET (39)
  1988. ======================================================================
  1989. == Function 39, subfunction 2 - get pixel from the background image. =
  1990. ======================================================================
  1991. Parameters:
  1992.   * eax = 39 - function number
  1993.   * ebx = 2 - subfunction number
  1994.   * ecx = offset
  1995. Returned value:
  1996.   * eax = 0x00RRGGBB - pixel color, if offset is valid
  1997.     (less than 0x160000-16)
  1998.   * eax = 2 otherwise
  1999. Remarks:
  2000.   * Do not rely on returned value for invalid offsets, it may be
  2001.     changed in future kernel versions.
  2002.   * Offset for pixel with coordinates (x,y)
  2003.     is calculated as (x+y*xsize)*3.
  2004.   * There is a pair function to set pixel on the background image -
  2005.     subfunction 2 of function 15.
  2006.  
  2007. ---------------------- Constants for registers: ----------------------
  2008.   eax - SF_BACKGROUND_GET (39)
  2009. ======================================================================
  2010. == Function 39, subfunction 4 - get drawing mode for the background. =
  2011. ======================================================================
  2012. Parameters:
  2013.   * eax = 39 - function number
  2014.   * ebx = 4 - subfunction number
  2015. Returned value:
  2016.   * eax = 1 - tile
  2017.   * eax = 2 - stretch
  2018. Remarks:
  2019.   * There is a pair function to set drawing mode -
  2020.     subfunction 4 of function 15.
  2021.  
  2022. ---------------------- Constants for registers: ----------------------
  2023.   eax - SF_BACKGROUND_GET (39)
  2024. ======================================================================
  2025. =========== Function 40 - set the mask for expected events. ==========
  2026. ======================================================================
  2027. The mask for expected events affects function working with events
  2028. 10, 11, 23 - they notify only about events allowed by this mask.
  2029. Parameters:
  2030.   * eax = 40 - function number
  2031.   * ebx = mask: bit i corresponds to event i+1 (see list of events)
  2032.     (set bit permits notice on event)
  2033.     bit 31: mouse active/inactive filter
  2034.     bit 31 = 0 - inactive window receive mouse events
  2035.     bit 31 = 1 - inactive window does not receive mouse events
  2036.     bit 30: cursor position filter
  2037.     bit 30 = 0 = the window receive mouse events if cursor
  2038.                  outside window
  2039.     bit 30 = 1 - the window does not receive mouse events if cursor
  2040.                  outside window
  2041. Returned value:
  2042.   * eax = previous value of mask
  2043. Remarks:
  2044.   * Default mask (7=111b) enables notices about redraw,
  2045.     keys and buttons. This is enough for many applications.
  2046.   * Events prohibited in the mask are saved anyway, when come;
  2047.     they are simply not informed with event functions.
  2048.   * Event functions take into account the mask on moment of
  2049.     function call, not on moment of event arrival.
  2050.  
  2051. ---------------------- Constants for registers: ----------------------
  2052.   eax - SF_SET_EVENTS_MASK (40)
  2053. ======================================================================
  2054. ================ Function 43 - input/output to a port. ===============
  2055. ======================================================================
  2056.  
  2057. ------------------------ Output data to port -------------------------
  2058. Parameters:
  2059.   * eax = 43 - function number
  2060.   * bl = byte for output
  2061.   * ecx = port number 0xnnnn (from 0 to 0xFFFF)
  2062. Returned value:
  2063.   * eax = 0 - success
  2064.   * eax = 1 - the thread has not reserved the selected port
  2065.  
  2066. ------------------------ Input data from port ------------------------
  2067. Parameters:
  2068.   * eax = 43 - function number
  2069.   * ebx is ignored
  2070.   * ecx = 0x8000nnnn, where nnnn = port number (from 0 to 0xFFFF)
  2071. Returned value:
  2072.   * eax = 0 - success, thus ebx = entered byte
  2073.   * eax = 1 - the thread has not reserved the selected port
  2074. Remarks:
  2075.   * Previously the thread must reserve the selected port
  2076.     for itself by function 46.
  2077.   * Instead of call to this function it is better to use
  2078.     processor instructions in/out - this is much
  2079.     faster and a bit shorter and easier.
  2080.  
  2081. ---------------------- Constants for registers: ----------------------
  2082.   eax - SF_PORT_IN_OUT (43)
  2083. ======================================================================
  2084. ====== Function 46 - reserve/free a group of input/output ports. =====
  2085. ======================================================================
  2086. To work with reserved ports an application can access directly by
  2087. commands in/out (recommended way) and can use function 43
  2088. (not recommended way).
  2089. Parameters:
  2090.   * eax = 46 - function number
  2091.   * ebx = 0 - reserve, 1 - free
  2092.   * ecx = start port number
  2093.   * edx = end port number (inclusive)
  2094. Returned value:
  2095.   * eax = 0 - success
  2096.   * eax = 1 - error
  2097. Remarks:
  2098.   * For ports reservation: an error occurs if and only if
  2099.     one from the following condition satisfies:
  2100.     * start port is more than end port;
  2101.     * the selected range contains incorrect port number
  2102.       (correct are from 0 to 0xFFFF);
  2103.     * limit for the total number of reserved areas is exceeded
  2104.       (maximum 255 are allowed);
  2105.     * the selected range intersects with any of earlier reserved
  2106.   * For ports free: an error is an attempt to free range,
  2107.     that was not earlier reserved by this function
  2108.     (with same ecx,edx).
  2109.   * If an error occurs (for both cases) function performs no action.
  2110.   * At booting the system reserves for itself ports
  2111.     0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (inclusively).
  2112.   * When a thread terminates, all reserved by it ports
  2113.     are freed automatically.
  2114.  
  2115. ---------------------- Constants for registers: ----------------------
  2116.   eax - SF_SET_PORTS (46)
  2117. ======================================================================
  2118. ============= Function 47 - draw a number in the window. =============
  2119. ======================================================================
  2120. Parameters:
  2121.   * eax = 47 - function number
  2122.   * ebx = parameters of conversion number to text:
  2123.     * bl = 0 - ecx contains number
  2124.     * bl = 1 - ecx contains pointer to dword/qword-number
  2125.     * bh = 0 - display in decimal number system
  2126.     * bh = 1 - display in hexadecimal system
  2127.     * bh = 2 - display in binary system
  2128.     * bits 16-21 = how many digits to display
  2129.     * bits 22-29 reserved and must be set to 0
  2130.     * bit 30 set = display qword (64-bit) number (must be bl=1)
  2131.     * bit 31 set = do not display leading zeroes of the number
  2132.   * ecx = number (if bl=0) or pointer (if bl=1)
  2133.   * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
  2134.   * esi = 0xXXRRGGBB, where
  2135.     * RR, GG, BB specify text color
  2136.     * XX = 0B0FCSSS (bits):
  2137.       * B=1 - fill background (color = edi)
  2138.       * F specifies the font:
  2139.         0 = 6x9
  2140.         1 = 8x16
  2141.       * C=0 - draw to the window,
  2142.         C=1 - draw to the user buffer (edi)
  2143.       * SSS = (size multiplier)-1, so 0 = x1, 7 = x8
  2144. Returned value:
  2145.   * function does not return value
  2146. Remarks:
  2147.   * The given length must not exceed 60.
  2148.   * The exactly given amount of digits is output. If number is small
  2149.     and can be written by smaller amount of digits, it is supplemented
  2150.     by leading zeroes; if the number is big and can not be written by
  2151.     given amount of digits, extra digits are not drawn.
  2152.  
  2153. ---------------------- Constants for registers: ----------------------
  2154.   eax - SF_DRAW_NUMBER (47)
  2155. ======================================================================
  2156. ========= Function 48, subfunction 0 - apply screen settings. ========
  2157. ======================================================================
  2158. Parameters:
  2159.   * eax = 48 - function number
  2160.   * ebx = 0 - subfunction number
  2161.   * ecx = 0 - reserved
  2162. Returned value:
  2163.   * function does not return value
  2164. Remarks:
  2165.   * Function redraws the screen after parameters change by
  2166.     subfunctions 1 and 2.
  2167.   * Function call without prior call to one of indicated subfunctions
  2168.     is ignored.
  2169.   * Function call with nonzero ecx is ignored.
  2170.  
  2171. ---------------------- Constants for registers: ----------------------
  2172.   eax - SF_STYLE_SETTINGS (48)
  2173.   ebx - SSF_APPLY (0)
  2174. ======================================================================
  2175. =========== Function 48, subfunction 1 - set button style. ===========
  2176. ======================================================================
  2177. Parameters:
  2178.   * eax = 48 - function number
  2179.   * ebx = 1 - subfunction number
  2180.   * ecx = button style:
  2181.     * 0 = flat
  2182.     * 1 = 3d
  2183. Returned value:
  2184.   * function does not return value
  2185. Remarks:
  2186.   * After call to this function one should redraw the screen by
  2187.     subfunction 0.
  2188.   * Button style influences only to their draw of function 8.
  2189.  
  2190. ---------------------- Constants for registers: ----------------------
  2191.   eax - SF_STYLE_SETTINGS (48)
  2192.   ebx - SSF_SET_BUTTON_STYLE (1)
  2193. ======================================================================
  2194. ====== Function 48, subfunction 2 - set standard window colors. ======
  2195. ======================================================================
  2196. Parameters:
  2197.   * eax = 48 - function number
  2198.   * ebx = 2 - subfunction number
  2199.   * ecx = pointer to the color table
  2200.   * edx = size of the color table
  2201.     (must be 40 bytes for future compatibility)
  2202. Format of the color table is shown in description of subfunction 3.
  2203. Returned value:
  2204.   * function does not return value
  2205. Remarks:
  2206.   * After call to this function one should redraw the screen by
  2207.     subfunction 0.
  2208.   * Table of standard colors influences only to applications,
  2209.     which receive this table obviously (by subfunction 3)
  2210.     and use it (specifying colors from it to drawing functions).
  2211.   * Table of standard colors is included in skin and is installed
  2212.     anew with skin installation (by subfunction 8).
  2213.   * Color table can be viewed/changed interactively with
  2214.     the application 'desktop'.
  2215.  
  2216. ---------------------- Constants for registers: ----------------------
  2217.   eax - SF_STYLE_SETTINGS (48)
  2218.   ebx - SSF_SET_COLORS (2)
  2219. ======================================================================
  2220. ====== Function 48, subfunction 3 - get standard window colors. ======
  2221. ======================================================================
  2222. Parameters:
  2223.   * eax = 48 - function number
  2224.   * ebx = 3 - subfunction number
  2225.   * ecx = pointer to the buffer with size edx bytes,
  2226.     where table will be written
  2227.   * edx = size of color table
  2228.     (must be 40 bytes for future compatibility)
  2229. Returned value:
  2230.   * function does not return value
  2231. Format of the color table:
  2232. each item is dword-value for color 0x00RRGGBB
  2233.   * +0: dword: frames - color of frame
  2234.   * +4: dword: grab - color of header
  2235.   * +8: dword: grab_button - color of button on header bar
  2236.   * +12 = +0xC: dword: grab_button_text - color of text on button
  2237.     on header bar
  2238.   * +16 = +0x10: dword: grab_text - color of text on header
  2239.   * +20 = +0x14: dword: work - color of working area
  2240.   * +24 = +0x18: dword: work_button - color of button in working area
  2241.   * +28 = +0x1C: dword: work_button_text - color of text on button
  2242.     in working area
  2243.   * +32 = +0x20: dword: work_text - color of text in working area
  2244.   * +36 = +0x24: dword: work_graph - color of graphics in working area
  2245. Remarks:
  2246.   * Structure of the color table is described in the standard
  2247.     include file 'macros.inc' as 'system_colors'; for example,
  2248.     it is possible to write:
  2249.         sc      system_colors           ; variable declaration
  2250.         ...                             ; somewhere one must call
  2251.                                         ; this function with ecx=sc
  2252.         mov     ecx, [sc.work_button_text]      ; read text color on
  2253.                                         ; button in working area
  2254.   * A program itself decides to use or not to use color table.
  2255.     For usage program must simply at calls to drawing functions select
  2256.     color taken from the table.
  2257.   * At change of the table of standard colors (by subfunction 2 with
  2258.     the subsequent application of changes by subfunction 0 or
  2259.     at skin set by subfunction 8) the system sends to all windows
  2260.     redraw message (the event with code 1).
  2261.   * Color table can be viewed/changed interactively with
  2262.     the application 'desktop'.
  2263.  
  2264. ---------------------- Constants for registers: ----------------------
  2265.   eax - SF_STYLE_SETTINGS (48)
  2266.   ebx - SSF_GET_COLORS (3)
  2267. ======================================================================
  2268. ============ Function 48, subfunction 4 - get skin height. ===========
  2269. ======================================================================
  2270. Parameters:
  2271.   * eax = 48 - function number
  2272.   * ebx = 4 - subfunction number
  2273. Returned value:
  2274.   * eax = skin height
  2275. Remarks:
  2276.   * Skin height is defined as the height of a header
  2277.     of skinned windows.
  2278.   * See also general structure of window in the description
  2279.     of function 0.
  2280.  
  2281. ---------------------- Constants for registers: ----------------------
  2282.   eax - SF_STYLE_SETTINGS (48)
  2283.   ebx - SSF_GET_SKIN_HEIGHT (4)
  2284. ======================================================================
  2285. ======== Function 48, subfunction 5 - get screen working area. =======
  2286. ======================================================================
  2287. Parameters:
  2288.   * eax = 48 - function number
  2289.   * ebx = 5 - subfunction number
  2290. Returned value:
  2291.   * eax = [left]*65536 + [right]
  2292.   * ebx = [top]*65536 + [bottom]
  2293. Remarks:
  2294.   * The screen working area defines position and coordinates of
  2295.     a maximized window.
  2296.   * The screen working area in view of normal work is all screen
  2297.     without taskbar ('@taskbar' application).
  2298.   * (left,top) are coordinates of the left upper corner,
  2299.     (right,bottom) are coordinates of the right lower one.
  2300.     Thus the size of working area on x axis can be calculated by
  2301.     formula right-left+1, on y axis - by formula bottom-top+1.
  2302.   * See also function 14,
  2303.     to get sizes of all screen.
  2304.   * There is a pair function to set working area - subfunction 6.
  2305.  
  2306. ---------------------- Constants for registers: ----------------------
  2307.   eax - SF_STYLE_SETTINGS (48)
  2308.   ebx - SSF_GET_SCREEN_AREA (5)
  2309. ======================================================================
  2310. ======== Function 48, subfunction 6 - set screen working area. =======
  2311. ======================================================================
  2312. Parameters:
  2313.   * eax = 48 - function number
  2314.   * ebx = 6 - subfunction number
  2315.   * ecx = [left]*65536 + [right]
  2316.   * edx = [top]*65536 + [bottom]
  2317. Returned value:
  2318.   * function does not return value
  2319. Remarks:
  2320.   * The screen working area defines position and coordinates of
  2321.     a maximized window.
  2322.   * This function is used only by the application '@taskbar',
  2323.     which set working area to all screen without taskbar.
  2324.   * (left,top) are coordinates of the left upper corner,
  2325.     (right,bottom) are coordinates of the right lower one.
  2326.     Thus the size of working area on x axis can be calculated by
  2327.     formula right-left+1, on y axis - by formula bottom-right+1.
  2328.   * If 'left'>='right', x-coordinate of working area is not changed.
  2329.     If 'left'<0, 'left' will not be set. If 'right' is greater than or
  2330.     equal to screen width, 'right' will not be set.
  2331.     Similarly on y axis.
  2332.   * See also function 14,
  2333.     to get sizes of all screen.
  2334.   * There is a pair function to get working area - subfunction 5.
  2335.   * This function redraws the screen automatically,
  2336.     updating coordinates and sizes of maximized windows.
  2337.     The system sends to all windows redraw message (the event 1).
  2338.  
  2339. ---------------------- Constants for registers: ----------------------
  2340.   eax - SF_STYLE_SETTINGS (48)
  2341.   ebx - SSF_SET_SCREEN_AREA (6)
  2342. ======================================================================
  2343. =========== Function 48, subfunction 7 - get skin margins. ===========
  2344. ======================================================================
  2345. Returns the area of a header of a skinned window, intended for
  2346. a text of a header.
  2347. Parameters:
  2348.   * eax = 48 - function number
  2349.   * ebx = 7 - subfunction number
  2350. Returned value:
  2351.   * eax = [left]*65536 + [right]
  2352.   * ebx = [top]*65536 + [bottom]
  2353. Remarks:
  2354.   * An application decides itself to use or not to use this function.
  2355.   * It is recommended to take into account returned value
  2356.     of this function for choice of a place for drawing header text
  2357.     (by function 4) or a substitute of header text
  2358.     (at the discretion of an application).
  2359.  
  2360. ---------------------- Constants for registers: ----------------------
  2361.   eax - SF_STYLE_SETTINGS (48)
  2362.   ebx - SSF_GET_SKIN_MARGINS (7)
  2363. ======================================================================
  2364. ============= Function 48, subfunction 8 - set used skin. ============
  2365. ======================================================================
  2366. Parameters:
  2367.   * eax = 48 - function number
  2368.   * ebx = 8 - subfunction number
  2369.   * ecx = pointer to filename of the skin
  2370. Returned value:
  2371.   * eax = 0 - success
  2372.   * otherwise eax = file system error code; if file does not
  2373.     contain valid skin, function returns error 3
  2374.     (unknown file system).
  2375. Remarks:
  2376.   * After successful skin loading the system sends to all windows
  2377.     redraw message (the event 1).
  2378.   * At booting the system reads skin from file 'default.skn'
  2379.     on ramdisk.
  2380.   * User can change the skin statically by creating hisself
  2381.     'default.skn' or dynamically with the application 'desktop'.
  2382.  
  2383. ---------------------- Constants for registers: ----------------------
  2384.   eax - SF_STYLE_SETTINGS (48)
  2385.   ebx - SSF_SET_SKIN (8)
  2386. ======================================================================
  2387. ====== Function 48, subfunction 9 - get font smoothing setting. ======
  2388. ======================================================================
  2389. Parameters:
  2390.   * eax = 48 - function number
  2391.   * ebx = 9 - subfunction number
  2392. Returned value:
  2393.   * eax = 2 - subpixel, 1 - anti-aliasing, 0 - off
  2394.  
  2395. ---------------------- Constants for registers: ----------------------
  2396.   eax - SF_STYLE_SETTINGS (48)
  2397.   ebx - SSF_GET_FONT_SMOOTH (9)
  2398. ======================================================================
  2399. ========== Function 48, subfunction 10 - set font smoothing. =========
  2400. ======================================================================
  2401. Parameters:
  2402.   * eax = 48 - function number
  2403.   * ebx = 10 - subfunction number
  2404.   * cl  = 2 - subpixel, 1 - anti-aliasing, 0 - off
  2405.  
  2406. ---------------------- Constants for registers: ----------------------
  2407.   eax - SF_STYLE_SETTINGS (48)
  2408.   ebx - SSF_SET_FONT_SMOOTH (10)
  2409. ======================================================================
  2410. ============ Function 48, subfunction 11 - get font size. ============
  2411. ======================================================================
  2412. Parameters:
  2413.   * eax = 48 - function number
  2414.   * ebx = 11 - subfunction number
  2415. Returned value:
  2416.   * eax = current font height in pixels
  2417.  
  2418. ---------------------- Constants for registers: ----------------------
  2419.   eax - SF_STYLE_SETTINGS (48)
  2420.   ebx - SSF_GET_FONT_SIZE (11)
  2421. ======================================================================
  2422. ============ Function 48, subfunction 12 - set font size. ============
  2423. ======================================================================
  2424. Parameters:
  2425.   * eax = 48 - function number
  2426.   * ebx = 12 - subfunction number
  2427.   * cl  = new font height in pixels
  2428.  
  2429. ---------------------- Constants for registers: ----------------------
  2430.   eax - SF_STYLE_SETTINGS (48)
  2431.   ebx - SSF_SET_FONT_SIZE (12)
  2432. ======================================================================
  2433. == Function 48, subfunction 13 - set skin, specifying the encoding. ==
  2434. ======================================================================
  2435. Parameters:
  2436.   * eax = 48 - function number
  2437.   * ebx = 13 - subfunction number
  2438.   * ecx = pointer to the skin file path string
  2439.   * edx = string encoding, details can be found in function 80 description.
  2440. Returned value:
  2441.   * eax = 0 - success
  2442.   * otherwise eax = file system error code; if file does not
  2443.     contain valid skin, function returns error 3
  2444.     (unknown file system).
  2445. Remarks:
  2446.   * After successful skin loading the system sends to all windows
  2447.     redraw message (the event 1).
  2448.   * At booting the system reads skin from file 'default.skn'
  2449.     on ramdisk.
  2450.   * User can change the skin statically by creating hisself
  2451.     'default.skn' or dynamically with the application 'desktop'.
  2452.  
  2453. ======================================================================
  2454. =========== Function 49 - Advanced Power Management (APM). ===========
  2455. ======================================================================
  2456. Parameters:
  2457.   * eax = 49 - function number
  2458.   * dx = number of the APM function
  2459.     (analogue of ax in APM specification)
  2460.   * bx, cx = parameters of the APM function
  2461. Returned value:
  2462.   * 16-bit registers ax, bx, cx, dx, si, di and carry flag CF
  2463.     are set according to the APM specification
  2464.   * high halves of 32-bit registers eax, ebx, ecx,
  2465.     edx, esi, edi are destroyed
  2466. Remarks:
  2467.   * APM 1.2 specification is described in the document
  2468.     "Advanced Power Management (APM) BIOS Specification"
  2469.     (Revision 1.2), available at
  2470.     http://www.microsoft.com/whdc/archive/amp_12.mspx;
  2471.     besides it is included in famous Interrupt List by Ralf Brown
  2472.     (http://www.pobox.com/~ralf/files.html,
  2473.     ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/).
  2474.  
  2475. ---------------------- Constants for registers: ----------------------
  2476.   eax - SF_APM (49)
  2477. ======================================================================
  2478. =================== Function 50 - set window shape. ==================
  2479. ======================================================================
  2480. Normal windows have rectangular shape. This function can give to
  2481. a window any shape. The shape is given by a set of points inside
  2482. the base rectangle belonging to a window. Position and coordinates
  2483. of the base rectangle are set by function 0
  2484. and changed by function 67.
  2485.  
  2486. --------------------------- Set shape data ---------------------------
  2487. Parameters:
  2488.   * eax = 50 - function number
  2489.   * ebx = 0 - subfunction number
  2490.   * ecx = pointer to shape data (array of bytes 0/1)
  2491. Returned value:
  2492.   * function does not return value
  2493.  
  2494. -------------------------- Set shape scale ---------------------------
  2495. Parameters:
  2496.   * eax = 50 - function number
  2497.   * ebx = 1 - subfunction number
  2498.   * ecx sets a scale: each byte of data defines
  2499.     (2^scale)*(2^scale) pixels
  2500. Returned value:
  2501.   * function does not return value
  2502. Remarks:
  2503.   * Default scale is 0 (scale factor is 1). If in the shape data
  2504.     one byte corresponds to one pixel, there is no necessity
  2505.     to set scale.
  2506.   * Let's designate xsize = window width (in pixels), ysize = height;
  2507.     pay attention, that they are one pixel more than defined by
  2508.     functions 0, 67.
  2509.   * On definition of scale xsize and ysize must be divisible
  2510.     on 2^scale.
  2511.   * Byte of data on offset 'a' must be 0/1 and defines belonging
  2512.     to a window of square with the side 2^scale (if scale=0,
  2513.     this is one pixel) and coordinates of the left upper corner
  2514.     (a mod (xsize shr scale), a div (xsize shr scale))
  2515.   * Data size: (xsize shr scale)*(ysize shr scale).
  2516.   * Data must be presented in the memory and not change
  2517.     after set of shape.
  2518.   * The system views the shape data at every window redraw by
  2519.     function 0.
  2520.   * The call of subfunction 0 with NULL pointer results in return
  2521.     to the rectangular shape.
  2522.  
  2523. ---------------------- Constants for registers: ----------------------
  2524.   eax - SF_SET_WINDOW_SHAPE (50)
  2525. ======================================================================
  2526. ==================== Function 51 - create thread. ====================
  2527. ======================================================================
  2528. Parameters:
  2529.   * eax = 51 - function number
  2530.   * ebx = 1 - unique subfunction
  2531.   * ecx = address of thread entry point (starting eip)
  2532.   * edx = pointer to thread stack (starting esp)
  2533. Returned value:
  2534.   * eax = -1 - error (there is too many threads)
  2535.   * otherwise eax = TID - thread identifier
  2536.  
  2537. ---------------------- Constants for registers: ----------------------
  2538.   eax - SF_CREATE_THREAD (51)
  2539. ======================================================================
  2540. ==================== Function 54, subfunction 0 ======================
  2541. ============== Get the number of slots in the clipboard. =============
  2542. ======================================================================
  2543. Parameters:
  2544.   * eax = 54 - function number
  2545.   * ebx = 0 - subfunction number
  2546. Returned value:
  2547.   * eax = slots in the clipboard
  2548.   * eax = -1 - main list area not found
  2549.  
  2550. ---------------------- Constants for registers: ----------------------
  2551.   eax - SF_CLIPBOARD (54)
  2552.   ebx - SSF_GET_SLOT_COUNT (0)
  2553. ======================================================================
  2554. ==================== Function 54, subfunction 1 ======================
  2555. ================= Read the data from the clipboard. ==================
  2556. ======================================================================
  2557. Parameters:
  2558.   * eax = 54 - function number
  2559.   * ebx = 1 - subfunction number
  2560.   * eсx = slot number
  2561. Returned value:
  2562.   * eax = if successful - pointer to a memory with data
  2563.   * eax = 1 - error
  2564.   * eax = -1 - main list area not found
  2565. Remarks:
  2566.   * The function must be used in conjunction with 68.11. The
  2567.     application must pre-initialize the local heap by calling 68.11.
  2568.  
  2569. ---------------------- Constants for registers: ----------------------
  2570.   eax - SF_CLIPBOARD (54)
  2571.   ebx - SSF_READ_CB (1)
  2572. ======================================================================
  2573. ==================== Function 54, subfunction 2 ======================
  2574. ================= Write the data to the clipboard. ===================
  2575. ======================================================================
  2576. Parameters:
  2577.   * eax = 54 - function number
  2578.   * ebx = 2 - subfunction number
  2579.   * eсx = the number of bytes to be copied
  2580.   * edx = a pointer to a buffer for data to be copied
  2581. Returned value:
  2582.   * eax = 0 - success
  2583.   * eax = 1 - error
  2584.   * eax = -1 - main list area not found
  2585.  
  2586. ---------------------- Constants for registers: ----------------------
  2587.   eax - SF_CLIPBOARD (54)
  2588.   ebx - SSF_WRITE_CB (2)
  2589. ======================================================================
  2590. ===================== Function 54, subfunction 3 =====================
  2591. ================ Delete the last slot in the clipboard ===============
  2592. ======================================================================
  2593. Parameters:
  2594.   * eax = 54 - function number
  2595.   * ebx = 3 - subfunction number
  2596. Returned value:
  2597.   * eax = 0 - success
  2598.   * eax = 1 - error
  2599.   * eax = -1 - main list area not found
  2600.  
  2601. ---------------------- Constants for registers: ----------------------
  2602.   eax - SF_CLIPBOARD (54)
  2603.   ebx - SSF_DEL_SLOT (3)
  2604. ======================================================================
  2605. ===================== Function 54, subfunction 4 =====================
  2606. ===================== Alarm reset the lock buffer ====================
  2607. ======================================================================
  2608. Parameters:
  2609.   * eax = 54 - function number
  2610.   * ebx = 4 - subfunction number
  2611. Returned value:
  2612.   * eax = 0 - success
  2613.   * eax = -1 - main list area not found or no blocking
  2614. Remarks:
  2615.   * Used in exceptional cases, where no responsible or killed
  2616.     application blocked the clipboard operations.
  2617.  
  2618. ---------------------- Constants for registers: ----------------------
  2619.   eax - SF_CLIPBOARD (54)
  2620.   ebx - SSF_UNLOCK_BUFFER (4)
  2621. ======================================================================
  2622.  Function 55, subfunction 55 - begin to play data on built-in speaker.
  2623. ======================================================================
  2624. Parameters:
  2625.   * eax = 55 - function number
  2626.   * ebx = 55 - subfunction number
  2627.   * esi = pointer to data
  2628. Returned value:
  2629.   * eax = 0 - success
  2630.   * eax = 55 - error (speaker is off or busy)
  2631. Data is an array of items with variable length.
  2632. Format of each item is defined by first byte:
  2633.   * 0 = end of data
  2634.   * 1..0x80 = sets sound duration on 1/100 of second; sound note
  2635.     is defined by immediate value of frequency
  2636.     * following word (2 bytes) contains frequency divider;
  2637.       frequency is defined as 1193180/divider
  2638.   * 0x81 = invalid
  2639.   * 0x82..0xFF = note is defined by octave and number:
  2640.     * duration in 1/100 of second = (first byte)-0x81
  2641.     * there is one more byte;
  2642.     * (second byte)=0xFF - delay
  2643.     * otherwise it looks like a*0x10+b, where b=number of the note in
  2644.       an octave from 1 to 12, a=number of octave (beginning from 0)
  2645. Remarks:
  2646.   * Speaker play can be disabled/enabled by
  2647.     subfunction 8 of function 18.
  2648.   * Function returns control, having informed the system
  2649.     an information on request. Play itself goes independently from
  2650.     the program.
  2651.   * The data must be kept in the memory at least up to the end
  2652.     of play.
  2653.  
  2654. ---------------------- Constants for registers: ----------------------
  2655.   eax - SF_SPEAKER_PLAY (55)
  2656. ======================================================================
  2657. ======================= Function 57 - PCI BIOS. ======================
  2658. ======================================================================
  2659. Parameters:
  2660.   * eax = 57 - function number
  2661.   * ebp corresponds to al in PCI BIOS specification
  2662.   * other registers are set according to PCI BIOS specification
  2663. Returned value:
  2664.   * CF is undefined
  2665.   * other registers are set according to PCI BIOS specification
  2666. Remarks:
  2667.   * Many effects of this function can be also achieved with
  2668.     corresponding subfunctions of function 62.
  2669.   * The function calls PCI32 BIOS extension, documented e.g. in
  2670.     http://alpha1.dyns.net/files/PCI/bios21.pdf.
  2671.   * If BIOS does not support this extension, its behavior is emulated
  2672.     (through kernel-mode analogues of subfunctions of function 62).
  2673.  
  2674. ---------------------- Constants for registers: ----------------------
  2675.   eax - SF_PCI_BIOS (57)
  2676. ======================================================================
  2677. ========== Function 60 - Inter Process Communication (IPC). ==========
  2678. ======================================================================
  2679. IPC is used for message dispatching from one process/thread to
  2680. another. Previously it is necessary to agree how to interpret
  2681. the concrete message.
  2682.  
  2683. ----------- Subfunction 1 - set the area for IPC receiving -----------
  2684. Is called by process-receiver.
  2685. Parameters:
  2686.   * eax = 60 - function number
  2687.   * ebx = 1 - subfunction number
  2688.   * ecx = pointer to the buffer
  2689.   * edx = size of the buffer
  2690. Returned value:
  2691.   * eax = 0 - always success
  2692. Format of IPC-buffer:
  2693.   * +0: dword: if nonzero, buffer is considered locked;
  2694.     lock/unlock the buffer, when you work with it and need that
  2695.     buffer data are not changed from outside (no new messages)
  2696.   * +4: dword: occupied place in the buffer (in bytes)
  2697.   * +8: first message
  2698.   * +8+n: second message
  2699.   * ...
  2700. Format of a message:
  2701.   * +0: dword: PID of sender
  2702.   * +4: dword: message length (not including this header)
  2703.   * +8: n*byte: message data
  2704.  
  2705. ------------------ Subfunction 2 - send IPC message ------------------
  2706. Is called by process-sender.
  2707. Parameters:
  2708.   * eax = 60 - function number
  2709.   * ebx = 2 - subfunction number
  2710.   * ecx = PID of receiver
  2711.   * edx = pointer to the message data
  2712.   * esi = message length (in bytes)
  2713. Returned value:
  2714.   * eax = 0 - success
  2715.   * eax = 1 - the receiver has not defined buffer for IPC messages
  2716.     (can be, still have no time,
  2717.     and can be, this is not right process)
  2718.   * eax = 2 - the receiver has blocked IPC-buffer; try to wait a bit
  2719.   * eax = 3 - overflow of IPC-buffer of the receiver
  2720.   * eax = 4 - process/thread with such PID does not exist
  2721. Remarks:
  2722.   * Immediately after writing of IPC-message to the buffer the system
  2723.     sends to the receiver the event with code 7 (see event codes).
  2724.  
  2725. ---------------------- Constants for registers: ----------------------
  2726.   eax - SF_IPC (60)
  2727.   ebx - SSF_SET_AREA (1), SSF_SEND_MESSAGE (2)
  2728. ======================================================================
  2729. ==== Function 61 - get parameters for the direct graphics access. ====
  2730. ======================================================================
  2731. The data of the graphics screen (the memory area which displays
  2732. screen contents) are accessible to a program directly, without
  2733. any system calls, through the selector gs:
  2734.         mov     eax, [gs:0]
  2735. places in eax the first dword of the buffer, which contains
  2736. information on color of the left upper point (and, possibly, colors
  2737. of several following).
  2738.         mov     [gs:0], eax
  2739. by work in VESA modes with LFB sets color of the left upper point
  2740. (and, possibly, colors of several following).
  2741. To interpret the data of graphics screen program needs to know
  2742. some parameters, returning by this function.
  2743. Remarks:
  2744.   * Graphics parameters changes very seldom at work.
  2745.   * At videomode change the system redraws all windows (event
  2746.     with code 1) and redraws the background (event 5).
  2747.     Same events occur in other cases too, which meet much more often,
  2748.     than videomode change.
  2749.   * By operation in videomodes with LFB the selector gs points to
  2750.     LFB itself, so reading/writing on gs result directly in
  2751.     change of screen contents. By operation in videomodes without
  2752.     LFB gs points to some data area in the kernel, and all functions
  2753.     of screen output fulfil honesty double operation on writing
  2754.     directly to the screen and writing to this buffer. In result
  2755.     at reading contents of this buffer the results correspond to
  2756.     screen contents (with, generally speaking, large color
  2757.     resolution), and writing is ignored.
  2758.     One exception is the mode 320*200, for which main loop of the
  2759.     system thread updates the screen according to mouse movements.
  2760.  
  2761. ------------------------- Screen resolution --------------------------
  2762. Parameters:
  2763.   * eax = 61 - function number
  2764.   * ebx = 1 - subfunction number
  2765. Returned value:
  2766.   * eax = [resolution on x axis]*65536 + [resolution on y axis]
  2767. Remarks:
  2768.   * One can use function 14 paying attention that
  2769.     it returns sizes on 1 pixel less. It is fully equivalent way.
  2770.  
  2771. ---------------------- Number of bits per pixel ----------------------
  2772. Parameters:
  2773.   * eax = 61 - function number
  2774.   * ebx = 2 - subfunction number
  2775. Returned value:
  2776.   * eax = number of bits per pixel (24 or 32)
  2777.  
  2778. -------------------- Number of bytes per scanline --------------------
  2779. Parameters:
  2780.   * eax = 61 - function number
  2781.   * ebx = 3 - subfunction number
  2782. Returned value:
  2783.   * eax = number of bytes occupied by one scanline
  2784.     (horizontal line on the screen)
  2785.  
  2786. ---------------------- Constants for registers: ----------------------
  2787.   eax - SF_GET_GRAPHICAL_PARAMS (61)
  2788.   ebx - SSF_SCREEN_SIZE (1), SSF_BITS_PER_PIXEL (2),
  2789.     SSF_BYTES_PER_LINE (3)
  2790. ======================================================================
  2791. ===== Function 62, subfunction 0 - get version of PCI-interface. =====
  2792. ======================================================================
  2793. Parameters:
  2794.   * eax = 62 - function number
  2795.   * bl = 0 - subfunction number
  2796. Returned value:
  2797.   * eax = -1 - PCI access is disabled; otherwise
  2798.   * ah.al = version of PCI-interface (ah=version, al=subversion)
  2799.   * high word of eax is zeroed
  2800. Remarks:
  2801.   * Previously low-level access to PCI for applications must be
  2802.     enabled by subfunction 12 of function 21.
  2803.   * If PCI BIOS is not supported, the value of ax is undefined.
  2804.  
  2805. ---------------------- Constants for registers: ----------------------
  2806.   eax - SF_PCI (62)
  2807.   ebx - SSF_GET_VERSION (0)
  2808. ======================================================================
  2809. ==== Function 62, subfunction 1 - get number of the last PCI-bus. ====
  2810. ======================================================================
  2811. Parameters:
  2812.   * eax = 62 - function number
  2813.   * bl = 1 - subfunction number
  2814. Returned value:
  2815.   * eax = -1 - access to PCI is disabled; otherwise
  2816.   * al = number of the last PCI-bus; other bytes of eax are destroyed
  2817. Remarks:
  2818.   * Previously low-level access to PCI for applications must be
  2819.     enabled by subfunction 12 of function 21.
  2820.   * If PCI BIOS is not supported, the value of ax is undefined.
  2821.  
  2822. ---------------------- Constants for registers: ----------------------
  2823.   eax - SF_PCI (62)
  2824.   ebx - SSF_GET_LAST_BUS (1)
  2825. ======================================================================
  2826. ===================== Function 62, subfunction 2 =====================
  2827. ===== Get mechanism of addressing to the PCI configuration space. ====
  2828. ======================================================================
  2829. Parameters:
  2830.   * eax = 62 - function number
  2831.   * bl = 2 - subfunction number
  2832. Returned value:
  2833.   * eax = -1 - access to PCI is disabled; otherwise
  2834.   * al = mechanism (1 or 2); other bytes of eax are destroyed
  2835. Remarks:
  2836.   * Previously low-level access to PCI for applications must be
  2837.     enabled by subfunction 12 of function 21.
  2838.   * Addressing mechanism is selected depending on
  2839.     equipment characteristics.
  2840.   * Subfunctions of read and write work automatically
  2841.     with the selected mechanism.
  2842.  
  2843. ---------------------- Constants for registers: ----------------------
  2844.   eax - SF_PCI (62)
  2845.   ebx - SSF_GET_ADRR_MODE (2)
  2846. ======================================================================
  2847. ======== Function 62, subfunctions 4,5,6 - read PCI-register. ========
  2848. ======================================================================
  2849. Parameters:
  2850.   * eax = 62 - function number
  2851.   * bl = 4 - read byte
  2852.   * bl = 5 - read word
  2853.   * bl = 6 - read dword
  2854.   * bh = number of PCI-bus
  2855.   * ch = dddddfff, where ddddd = number of the device on the bus,
  2856.     fff = function number of device
  2857.   * cl = number of register (must be even for bl=5,
  2858.     divisible by 4 for bl=6)
  2859. Returned value:
  2860.   * eax = -1 - error (access to PCI is disabled or parameters
  2861.     are not supported); otherwise
  2862.   * al/ax/eax (depending on requested size) contains the data;
  2863.     the other part of register eax is destroyed
  2864. Remarks:
  2865.   * Previously low-level access to PCI for applications must be
  2866.     enabled by subfunction 12 of function 21.
  2867.   * Access mechanism 2 supports only 16 devices on a bus and ignores
  2868.     function number. To get access mechanism use subfunction 2.
  2869.   * Some registers are standard and exist for all devices, some are
  2870.     defined by the concrete device. The list of registers of the
  2871.     first type can be found e.g. in famous
  2872.     Interrupt List by Ralf Brown
  2873.     (http://www.pobox.com/~ralf/files.html,
  2874.     ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/);
  2875.     registers of the second type must be listed
  2876.     in the device documentation.
  2877.  
  2878. ---------------------- Constants for registers: ----------------------
  2879.   eax - SF_PCI (62)
  2880.   ebx - SSF_READ_BYTE (4), SSF_READ_WORD (5), SSF_READ_DWORD (6)
  2881. ======================================================================
  2882. ====== Function 62, subfunctions 8,9,10 - write to PCI-register. =====
  2883. ======================================================================
  2884. Parameters:
  2885.   * eax = 62 - function number
  2886.   * bl = 8 - write byte
  2887.   * bl = 9 - write word
  2888.   * bl = 10 - write dword
  2889.   * bh = number of PCI-bus
  2890.   * ch = dddddfff, where ddddd = number of the device on the bus,
  2891.     fff = function number of device
  2892.   * cl = number of register (must be even for bl=9,
  2893.     divisible by 4 for bl=10)
  2894.   * dl/dx/edx (depending on requested size) contains
  2895.     the data to write
  2896. Returned value:
  2897.   * eax = -1 - error (access to PCI is disabled or parameters
  2898.     are not supported)
  2899.   * eax = 0 - success
  2900. Remarks:
  2901.   * Previously low-level access to PCI for applications must be
  2902.     enabled by subfunction 12 of function 21.
  2903.   * Access mechanism 2 supports only 16 devices on a bus and ignores
  2904.     function number. To get access mechanism use subfunction 2.
  2905.   * Some registers are standard and exist for all devices, some are
  2906.     defined by the concrete device. The list of registers of the
  2907.     first type can be found e.g. in famous Interrupt List by
  2908.     Ralf Brown; registers of the second type must be listed
  2909.     in the device documentation.
  2910.  
  2911. ---------------------- Constants for registers: ----------------------
  2912.   eax - SF_PCI (62)
  2913.   ebx - SSF_WRITE_BYTE (8), SSF_WRITE_WORD (9), SSF_WRITE_DWORD (10)
  2914. ======================================================================
  2915. ============== Function 63 - work with the debug board. ==============
  2916. ======================================================================
  2917. The debug board is the global system buffer (with the size
  2918. 1024 bytes), to which any program can write (generally speaking,
  2919. arbitrary) data and from which other program can read these data.
  2920. By the agreement written data are text strings interpreted as
  2921. debug messages on a course of program execution. The kernel in
  2922. some situations also writes to the debug board information on
  2923. execution of some functions; by the agreement kernel messages
  2924. begins from the prefix "K : ".
  2925. For view of the debug board the application 'board' was created,
  2926. which reads data from the buffer and displays them in its window.
  2927. 'board' interpretes the sequence of codes 13,10 as newline.
  2928. A character with null code in an end of line is not necessary,
  2929. but also does not prevent.
  2930. Because debugger has been written, the value of the debug board
  2931. has decreased, as debugger allows to inspect completely a course of
  2932. program execution without any efforts from the direction of program
  2933. itself. Nevertheless in some cases the debug board is still useful.
  2934.  
  2935. ----------------------------- Write byte -----------------------------
  2936. Parameters:
  2937.   * eax = 63 - function number
  2938.   * ebx = 1 - subfunction number
  2939.   * cl = data byte
  2940. Returned value:
  2941.   * function does not return value
  2942. Remarks:
  2943.   * Byte is written to the buffer. Buffer size is 512 bytes.
  2944.     At buffer overflow all obtained data are lost.
  2945.   * For output to the debug board of more complicated objects
  2946.     (strings, numbers) it is enough to call this function in cycle.
  2947.     It is possible not to write the appropriate code manually and use
  2948.     file 'debug.inc', which is included into the distributive.
  2949.  
  2950. ----------------------------- Read byte ------------------------------
  2951. Takes away byte from the buffer.
  2952. Parameters:
  2953.   * eax = 63 - function number
  2954.   * ebx = 2 - subfunction number
  2955. Returned value:
  2956.   * eax = ebx = 0 - the buffer is empty
  2957.   * eax = byte, ebx = 1 - byte was successfully read
  2958.  
  2959. ---------------------- Constants for registers: ----------------------
  2960.   eax - SF_BOARD (63)
  2961.   ebx - SSF_DEBUG_WRITE (1), SSF_DEBUG_READ (2)
  2962. ======================================================================
  2963. ============== Function 64 - resize application memory. ==============
  2964. ======================================================================
  2965. Parameters:
  2966.   * eax = 64 - function number
  2967.   * ebx = 1 - unique subfunction
  2968.   * ecx = new memory size
  2969. Returned value:
  2970.   * eax = 0 - success
  2971.   * eax = 1 - not enough memory
  2972. Remarks:
  2973.   * There is another way to dynamically allocate/free memory -
  2974.     subfunctions 12, 13 and 20 of function 68, but after creation
  2975.     of the process heap 64 function call will be ignored.
  2976.   * The function cannot be used together with 68.11, 68.12, 68.13.
  2977.     The function call will be ignored after creation of process heap
  2978.     with function 68.11.
  2979.        
  2980. ---------------------- Constants for registers: ----------------------
  2981.   eax - SF_MEMORY_RESIZE (64)
  2982. ======================================================================
  2983. ======== Function 65 - draw image with palette in the window. ========
  2984. ======================================================================
  2985. Parameters:
  2986.   * eax = 65 - function number
  2987.   * ebx = pointer to the image
  2988.   * ecx = [size on axis x]*65536 + [size on axis y]
  2989.   * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
  2990.   * esi = number of bits per pixel, must be 1,2,4,8,9,15,16,24 or 32;
  2991.   * edi = pointer to palette (2 to the power esi colors 0x00RRGGBB);
  2992.           ignored when esi > 8
  2993.   * ebp = offset of next row data relative to previous row data
  2994. Returned value:
  2995.   * function does not return value
  2996. Remarks:
  2997.   * Coordinates of the image are coordinates of the upper left corner
  2998.     of the image relative to the window.
  2999.   * Format of image with 1 bit per pixel: each byte of image
  3000.     (possibly excluding last bytes in rows), contains information on
  3001.     the color of 8 pixels, MSB corresponds to first pixel.
  3002.   * Format of image with 2 bits per pixel: each byte of image
  3003.     (possibly excluding last bytes in rows), contains information on
  3004.     the color of 4 pixels, two MSBs correspond to first pixel.
  3005.   * Format of image with 4 bits per pixel: each byte of image
  3006.     excluding last bytes in rows (if width is odd) contains
  3007.     information on the color of 2 pixels, high-order tetrad
  3008.     corresponds to first pixel.
  3009.   * Format of image with 8 bits per pixel: each byte of image is
  3010.     index in the palette.
  3011.   * Format of image with 9 bits per pixel: array of one byte values;
  3012.     each byte (8 bit) represents the intensity of gray for one pixel;
  3013.     this format is equal to 8bpp without palette.
  3014.   * Format of image with 15 bits per pixel: the color of each pixel
  3015.     is coded as (bit representation) 0RRRRRGGGGGBBBBB - 5 bits per
  3016.     each color.
  3017.   * Format of image with 16 bits per pixel: the color of each pixel
  3018.     is coded as RRRRRGGGGGGBBBBB (5+6+5).
  3019.   * Format of image with 24 bits per pixel: the color of each pixel
  3020.     is coded as 3 bytes - sequentially blue, green, red components.
  3021.   * Format of image with 32 bits per pixel: similar to 24, but
  3022.     one additional ignored byte is present. It's format is BGRX,
  3023.     where X is the ignored byte.
  3024.   * The call to function 7 is equivalent to call to this function
  3025.     with esi=24, ebp=0.
  3026.  
  3027. ---------------------- Constants for registers: ----------------------
  3028.   eax - SF_PUT_IMAGE_EXT (65)
  3029. ======================================================================
  3030. ================== Function 66 - work with keyboard. =================
  3031. ======================================================================
  3032. The input mode influences results of reading keys by function 2.
  3033. When a program loads, ASCII input mode is set for it.
  3034.  
  3035. -------------- Subfunction 1 - set keyboard input mode. --------------
  3036. Parameters:
  3037.   * eax = 66 - function number
  3038.   * ebx = 1 - subfunction number
  3039.   * ecx = mode:
  3040.     * 0 = normal (ASCII-characters)
  3041.     * 1 = scancodes
  3042. Returned value:
  3043.   * function does not return value
  3044.  
  3045. -------------- Subfunction 2 - get keyboard input mode. --------------
  3046. Parameters:
  3047.   * eax = 66 - function number
  3048.   * ebx = 2 - subfunction number
  3049. Returned value:
  3050.   * eax = current mode
  3051.  
  3052. ------------ Subfunction 3 - get status of control keys. -------------
  3053. Parameters:
  3054.   * eax = 66 - function number
  3055.   * ebx = 3 - subfunction number
  3056. Returned value:
  3057.   * eax = bit mask:
  3058.   * bit 0  (mask 1): left Shift is pressed
  3059.   * bit 1  (mask 2): right Shift is pressed
  3060.   * bit 2  (mask 4): left Ctrl is pressed
  3061.   * bit 3  (mask 8): right Ctrl is pressed
  3062.   * bit 4  (mask 0x10): left Alt is pressed
  3063.   * bit 5  (mask 0x20): right Alt is pressed
  3064.   * bit 6  (mask 0x40): CapsLock is on
  3065.   * bit 7  (mask 0x80): NumLock is on
  3066.   * bit 8  (mask 0x100): ScrollLock is on
  3067.   * bit 9  (mask 0x200): left Win is pressed
  3068.   * bit 10 (mask 0x400): right Win is pressed
  3069.   * other bits are cleared
  3070.  
  3071. -------------- Subfunction 4 - set system-wide hotkey. ---------------
  3072. When hotkey is pressed, the system notifies only those applications,
  3073. which have installed it; the active application (which receives
  3074. all normal input) does not receive such keys.
  3075. The notification consists in sending event with the code 2.
  3076. Reading hotkey is the same as reading normal key - by function 2.
  3077. Parameters:
  3078.   * eax = 66 - function number
  3079.   * ebx = 4 - subfunction number
  3080.   * cl determines key scancode;
  3081.     use cl=0 to give combinations such as Ctrl+Shift
  3082.   * edx = 0xXYZ determines possible states of control keys:
  3083.     * Z (low 4 bits) determines state of LShift and RShift:
  3084.       * 0 = no key must be pressed;
  3085.       * 1 = exactly one key must be pressed;
  3086.       * 2 = both keys must be pressed;
  3087.       * 3 = must be pressed LShift, but not RShift;
  3088.       * 4 = must be pressed RShift, but not LShift
  3089.     * Y - similar for LCtrl and RCtrl;
  3090.     * X - similar for LAlt and RAlt
  3091. Returned value:
  3092.   * eax=0 - success
  3093.   * eax=1 - too many hotkeys (maximum 256 are allowed)
  3094. Remarks:
  3095.   * Hotkey can work either at pressing or at release. Release
  3096.     scancode of a key is more on 128 than pressing scancode
  3097.     (i.e. high bit is set).
  3098.   * Several applications can set the same combination;
  3099.     all such applications will be informed on pressing
  3100.     such combination.
  3101.  
  3102. -------------- Subfunction 5 - delete installed hotkey. --------------
  3103. Parameters:
  3104.   * eax = 66 - function number
  3105.   * ebx = 5 - subfunction number
  3106.   * cl = scancode of key and edx = 0xXYZ the same as in subfunction 4
  3107. Returned value:
  3108.   * eax = 0 - success
  3109.   * eax = 1 - there is no such hotkey
  3110. Remarks:
  3111.   * When a process/thread terminates, all hotkey installed by it are
  3112.     deleted.
  3113.   * The call to this subfunction does not affect other applications.
  3114.     If other application has defined the same combination, it will
  3115.     still receive notices.
  3116.  
  3117. --------------- Subfunction 6 - block the normal input. --------------
  3118. Parameters:
  3119.   * eax = 66 - function number
  3120.   * ebx = 6 - subfunction number
  3121. Returned value:
  3122.   * function does not return value
  3123. Remarks:
  3124.   * Blocking the normal keyboard input for installed hotkeys
  3125.   * To emulate a mouse via the keyboard, the application MOUSEMUL
  3126.  
  3127. ------------ Subfunction 7 - unlock the normal input. ----------------
  3128. Parameters:
  3129.   * eax = 66 - function number
  3130.   * ebx = 7 - subfunction number
  3131. Returned value:
  3132.   * function does not return value
  3133. Remarks:
  3134.   * Unlocking the results of the f. 66.6
  3135.   * To emulate a mouse via the keyboard, the application MOUSEMUL
  3136.  
  3137. ---------------------- Constants for registers: ----------------------
  3138.   eax - SF_KEYBOARD (66)
  3139.   ebx - SSF_SET_INPUT_MODE (1), SSF_GET_INPUT_MODE (2),
  3140.     SSF_GET_CONTROL_KEYS (3), SSF_SET_SYS_HOTKEY (4),
  3141.     SSF_DEL_SYS_HOTKEY (5),  SSF_LOCK_INPUT (6), SSF_UNLOCK_INPUT (7)
  3142. ======================================================================
  3143. ========= Function 67 - change position/sizes of the window. =========
  3144. ======================================================================
  3145. Parameters:
  3146.   * eax = 67 - function number
  3147.   * ebx = new x-coordinate of the window
  3148.   * ecx = new y-coordinate of the window
  3149.   * edx = new x-size of the window
  3150.   * esi = new y-size of the window
  3151. Returned value:
  3152.   * function does not return value
  3153. Remarks:
  3154.   * The value -1 for a parameter means "do not change"; e.g. to move
  3155.     the window without resizing it is possible to specify edx=esi=-1.
  3156.   * Previously the window must be defined by function 0.
  3157.     It sets initial coordinates and sizes of the window.
  3158.   * Sizes of the window are understood in sense of function 0,
  3159.     that is one pixel less than real sizes.
  3160.   * The function call for maximized windows is simply ignored.
  3161.   * For windows of appropriate styles position and/or sizes can be
  3162.     changed by user; current position and sizes can be obtained by
  3163.     call to function 9.
  3164.   * The function sends to the window redraw event (with the code 1).
  3165.  
  3166. ---------------------- Constants for registers: ----------------------
  3167.   eax - SF_CHANGE_WINDOW (67)
  3168. ======================================================================
  3169. ====== Function 68, subfunction 0 - get the task switch counter. =====
  3170. ======================================================================
  3171. Parameters:
  3172.   * eax = 68 - function number
  3173.   * ebx = 0 - subfunction number
  3174. Returned value:
  3175.   * eax = number of task switches from the system booting
  3176.     (modulo 2^32)
  3177.  
  3178. ---------------------- Constants for registers: ----------------------
  3179.   eax - SF_SYS_MISC (68)
  3180.   ebx - SSF_GET_TASK_SWITCH_COUNT (0)
  3181. ======================================================================
  3182. ======= Function 68, subfunction 1 - switch to the next thread. ======
  3183. ======================================================================
  3184. The function completes the current time slice allocated to the
  3185. thread and switches to the next. (Which thread in which process
  3186. will be next, is unpredictable). Later, when execution queue
  3187. will reach the current thread, execution will be continued.
  3188. Parameters:
  3189.   * eax = 68 - function number
  3190.   * ebx = 1 - subfunction number
  3191. Returned value:
  3192.   * function does not return value
  3193.  
  3194. ---------------------- Constants for registers: ----------------------
  3195.   eax - SF_SYS_MISC (68)
  3196.   ebx - SSF_SWITCH_TASK (1)
  3197. ======================================================================
  3198. ============= Function 68, subfunction 2 - cache + rdpmc. ============
  3199. ======================================================================
  3200. Parameters:
  3201.   * eax = 68 - function number
  3202.   * ebx = 2 - subfunction number
  3203.   * ecx = required action:
  3204.     * ecx = 0 - enable instruction 'rdpmc'
  3205.       (ReaD Performance-Monitoring Counters) for applications
  3206.     * ecx = 1 - find out whether cache is disabled/enabled
  3207.     * ecx = 2 - enable cache
  3208.     * ecx = 3 - disable cache
  3209. Returned value:
  3210.   * for ecx=0:
  3211.     * eax = the value of cr4
  3212.   * for ecx=1:
  3213.     * eax = (cr0 and 0x60000000):
  3214.     * eax = 0 - cache is on
  3215.     * eax <> 0 - cache is off
  3216.   * for ecx=2 and ecx=3:
  3217.     * function does not return value
  3218.  
  3219. ---------------------- Constants for registers: ----------------------
  3220.   eax - SF_SYS_MISC (68)
  3221.   ebx - SSF_PERFORMANCE (2)
  3222.   ecx - SSSF_ALLOW_RDPMC (0), SSSF_CACHE_STATUS (1),
  3223.     SSSF_CACHE_ON (2), SSSF_CACHE_OFF (3)
  3224. ======================================================================
  3225. =========== Function 68, subfunction 3 - read MSR-register. ==========
  3226. ======================================================================
  3227. MSR = Model Specific Register; the complete list of MSR-registers
  3228. of a processor is included to the documentation on it (for example,
  3229. IA-32 Intel Architecture Software Developer's Manual,
  3230. Volume 3, Appendix B); each processor family has its own subset
  3231. of the MSR-registers.
  3232. Parameters:
  3233.   * eax = 68 - function number
  3234.   * ebx = 3 - subfunction number
  3235.   * ecx is ignored
  3236.   * edx = MSR address
  3237. Returned value:
  3238.   * ebx:eax = high:low dword of the result
  3239. Remarks:
  3240.   * If ecx contains nonexistent or not implemented for this processor
  3241.     MSR, processor will generate an exception in the kernel, which
  3242.     will kill the thread.
  3243.   * Previously it is necessary to check, whether MSRs are supported
  3244.     as a whole, with the instruction 'cpuid'. Otherwise processor
  3245.     will generate other exception in the kernel, which will anyway
  3246.     kill the thread.
  3247.  
  3248. ---------------------- Constants for registers: ----------------------
  3249.   eax - SF_SYS_MISC (68)
  3250.   ebx - SSF_READ_MSR (3)
  3251. ======================================================================
  3252. ========= Function 68, subfunction 4 - write to MSR-register. ========
  3253. ======================================================================
  3254. MSR = Model Specific Register; the complete list of MSR-registers
  3255. of a processor is included to the documentation on it (for example,
  3256. IA-32 Intel Architecture Software Developer's Manual,
  3257. Volume 3, Appendix B); each processor family has its own subset
  3258. of the MSR-registers.
  3259. Parameters:
  3260.   * eax = 68 - function number
  3261.   * ebx = 4 - subfunction number
  3262.   * ecx is ignored
  3263.   * edx = MSR address
  3264.   * esi:edi = high:low dword
  3265. Returned value:
  3266.   * function does not return value
  3267. Remarks:
  3268.   * If ecx contains nonexistent or not implemented for this processor
  3269.     MSR, processor will generate an exception in the kernel, which
  3270.     will kill the thread.
  3271.   * Previously it is necessary to check, whether MSRs are supported
  3272.     as a whole, with the instruction 'cpuid'. Otherwise processor
  3273.     will generate other exception in the kernel, which will anyway
  3274.     kill the thread.
  3275.  
  3276. ---------------------- Constants for registers: ----------------------
  3277.   eax - SF_SYS_MISC (68)
  3278.   ebx - SSF_WRITE_MSR (4)
  3279. ======================================================================
  3280. === Function 68, subfunction 11 - initialize process heap ============
  3281. ======================================================================
  3282. Parameters:
  3283.   * eax = 68 - function number
  3284.   * ebx = 11 - subfunction number
  3285. Returned value:
  3286.   * eax = 0 - failed
  3287.   * otherwise size of created heap
  3288. Remarks:
  3289.   * The function call initializes heap for subfunctions 12, 13 and 20.
  3290.   * If the process heap is already created, this function will return
  3291.     the size of the existing heap.
  3292.     Heap size is equal to total amount of free application memory.
  3293.   * After creation of the heap calls to function 64 will be ignored.
  3294.  
  3295. ---------------------- Constants for registers: ----------------------
  3296.   eax - SF_SYS_MISC (68)
  3297.   ebx - SSF_HEAP_INIT (11)
  3298. ======================================================================
  3299. ======== Function 68, subfunction 12 - allocate memory block. ========
  3300. ======================================================================
  3301. Parameters:
  3302.   * eax = 68 - function number
  3303.   * ebx = 12 - subfunction number
  3304.   * ecx = required size in bytes
  3305. Returned value:
  3306.   * eax = pointer to the allocated block
  3307. Remarks:
  3308.   * The function allocates an integer number of pages (4 Kb) in such
  3309.     way that the real size of allocated block is more than or equal to
  3310.     requested size.
  3311.  
  3312. ---------------------- Constants for registers: ----------------------
  3313.   eax - SF_SYS_MISC (68)
  3314.   ebx - SSF_MEM_ALLOC (12)
  3315. ======================================================================
  3316. ========== Function 68, subfunction 13 - free memory block. ==========
  3317. ======================================================================
  3318. Parameters:
  3319.   * eax = 68 - function number
  3320.   * ebx = 13 - subfunction number
  3321.   * ecx = pointer to the memory block
  3322. Returned value:
  3323.   * eax = 1 - success
  3324.   * eax = 0 - failed
  3325. Remarks:
  3326.   * The memory block must have been allocated by subfunction 12
  3327.     or subfunction 20.
  3328.  
  3329. ---------------------- Constants for registers: ----------------------
  3330.   eax - SF_SYS_MISC (68)
  3331.   ebx - SSF_MEM_FREE (13)
  3332. ======================================================================
  3333. ===================== Function 68, subfunction 14 ====================
  3334. ============ Wait for signal from another program/driver. ============
  3335. ======================================================================
  3336. Parameters:
  3337.   * eax = 68 - function number
  3338.   * ebx = 14 - subfunction number
  3339.   * ecx = pointer to the buffer for information (24 bytes)
  3340. Returned value:
  3341.   * buffer pointed to by ecx contains the following information:
  3342.     * +0: dword: identifier for following data of signal
  3343.     * +4: dword: data of signal (20 bytes), format of which is defined
  3344.           by the first dword
  3345.  
  3346. ---------------------- Constants for registers: ----------------------
  3347.   eax - SF_SYS_MISC (68)
  3348.   ebx - SSF_WAIT_SIGNAL (14)
  3349. ======================================================================
  3350. ============= Function 68, subfunction 16 - load driver. =============
  3351. ======================================================================
  3352. Parameters:
  3353.   * eax = 68 - function number
  3354.   * ebx = 16 - subfunction number
  3355.   * ecx = pointer to ASCIIZ-string with driver name
  3356. Returned value:
  3357.   * eax = 0 - failed
  3358.   * otherwise eax = driver handle
  3359. Remarks:
  3360.   * If the driver was not loaded yet, it is loaded;
  3361.     if the driver was loaded yet, nothing happens.
  3362.   * Driver name is case-sensitive.
  3363.     Maximum length of the name is 16 characters, including
  3364.     terminating null character, the rest is ignored.
  3365.   * Driver ABC is loaded from file /sys/drivers/ABC.sys.
  3366.  
  3367. ---------------------- Constants for registers: ----------------------
  3368.   eax - SF_SYS_MISC (68)
  3369.   ebx - SSF_LOAD_DRIVER (16)
  3370. ======================================================================
  3371. ============ Function 68, subfunction 17 - driver control. ===========
  3372. ======================================================================
  3373. Parameters:
  3374.   * eax = 68 - function number
  3375.   * ebx = 17 - subfunction number
  3376.   * ecx = pointer to the control structure:
  3377.     * +0: dword: handle of driver
  3378.     * +4: dword: code of driver function
  3379.     * +8: dword: pointer to input data
  3380.     * +12 = +0xC: dword: size of input data
  3381.     * +16 = +0x10: dword: pointer to output data
  3382.     * +20 = +0x14: dword: size of output data
  3383. Returned value:
  3384.   * eax = determined by driver
  3385. Remarks:
  3386.   * Function codes and the structure of input/output data
  3387.     are defined by driver.
  3388.   * Previously one must obtain driver handle by subfunction 16.
  3389.  
  3390. ---------------------- Constants for registers: ----------------------
  3391.   eax - SF_SYS_MISC (68)
  3392.   ebx - SSF_CONTROL_DRIVER (17)
  3393. ======================================================================
  3394. == Function 68, subfunction 18 - load DLL, specifying the encoding. ==
  3395. ======================================================================
  3396. Parameters:
  3397.   * eax = 68 - function number
  3398.   * ebx = 18 - subfunction number
  3399.   * ecx = pointer to the string with path to DLL
  3400.   * edx = string encoding, details can be found in function 80 description.
  3401. Returned value:
  3402.   * eax = 0 - failed
  3403.   * otherwise eax = pointer to DLL export table
  3404. Remarks:
  3405.   * Export table is an array of structures of 2 dword's, terminated
  3406.     by zero. The first dword in structure points to function name,
  3407.     the second dword contains address of function.
  3408.  
  3409. ======================================================================
  3410. =============== Function 68, subfunction 19 - load DLL. ==============
  3411. ======================================================================
  3412. Parameters:
  3413.   * eax = 68 - function number
  3414.   * ebx = 19 - subfunction number
  3415.   * ecx = pointer to the string with path to DLL,
  3416.     rules of path forming can be found in function 70 description.
  3417. Returned value:
  3418.   * eax = 0 - failed
  3419.   * otherwise eax = pointer to DLL export table
  3420.  
  3421. ---------------------- Constants for registers: ----------------------
  3422.   eax - SF_SYS_MISC (68)
  3423.   ebx - SSF_LOAD_DLL (19)
  3424. ======================================================================
  3425. ======= Function 68, subfunction 20 - reallocate memory block. =======
  3426. ======================================================================
  3427. Parameters:
  3428.   * eax = 68 - function number
  3429.   * ebx = 20 - subfunction number
  3430.   * ecx = new size in bytes
  3431.   * edx = pointer to already allocated block
  3432. Returned value:
  3433.   * eax = pointer to the reallocated block, 0 = error
  3434. Remarks:
  3435.   * Before this call one must initialize process heap by call to
  3436.     subfunction 11.
  3437.   * The function allocates an integer number of pages (4 Kb) in such
  3438.     way that the real size of allocated block is more than or equal to
  3439.     requested size.
  3440.   * If edx=0, the function call is equivalent to memory allocation
  3441.     with subfunction 12. Otherwise the block at edx
  3442.     must be allocated earlier with subfunction 12 or this subfunction.
  3443.   * If ecx=0, the function frees memory block at edx and returns 0.
  3444.   * The contents of the block are unchanged up to the shorter of
  3445.     the new and old sizes.
  3446.  
  3447. ---------------------- Constants for registers: ----------------------
  3448.   eax - SF_SYS_MISC (68)
  3449.   ebx - SSF_MEM_REALLOC (20)
  3450. ======================================================================
  3451. =========== Function 68, subfunction 21 - load driver PE. ============
  3452. ======================================================================
  3453. Parameters:
  3454.   * eax = 68 - function number
  3455.   * ebx = 21 - subfunction number
  3456.   * ecx = pointer to ASCIIZ-string with driver name
  3457.   * edx = pointer to command line
  3458. Returned value:
  3459.   * eax = 0 - failed
  3460.   * otherwise eax = driver handle
  3461. Remarks:
  3462.   * If the driver was not loaded yet, it is loaded;
  3463.     if the driver was loaded yet, nothing happens.
  3464.  
  3465. ---------------------- Constants for registers: ----------------------
  3466.   eax - SF_SYS_MISC (68)
  3467.   ebx - SSF_LOAD_DRIVER_PE (21)
  3468. ======================================================================
  3469. ======== Function 68, subfunction 22 - open named memory area. =======
  3470. ======================================================================
  3471. Parameters:
  3472.   * eax = 68 - function number
  3473.   * ebx = 22 - subfunction number
  3474.   * ecx = area name. Maximum of 31 characters with terminating zero
  3475.   * edx = area size in bytes for SHM_CREATE and SHM_OPEN_ALWAYS
  3476.   * esi = flags for open and access:
  3477.     * SHM_OPEN        = 0x00 - open existing memory area. If an area
  3478.                           with such name does not exist, the function
  3479.                           will return error code 5.
  3480.     * SHM_OPEN_ALWAYS = 0x04 - open existing or create new
  3481.                           memory area.
  3482.     * SHM_CREATE      = 0x08 - create new memory area. If an area
  3483.                           with such name already exists, the function
  3484.                           will return error code 10.
  3485.     * SHM_READ        = 0x00 - only read access
  3486.     * SHM_WRITE       = 0x01 - read and write access
  3487. Returned value:
  3488.   * eax = pointer to memory area, 0 if error has occurred
  3489.   * if new area is created (SHM_CREATE or SHM_OPEN_ALWAYS):
  3490.     edx = 0 - success, otherwise - error code
  3491.   * if existing area is opened (SHM_OPEN or SHM_OPEN_ALWAYS):
  3492.     edx = error code (if eax=0) or area size in bytes
  3493. Error codes:
  3494.   * E_NOTFOUND = 5
  3495.   * E_ACCESS = 10
  3496.   * E_NOMEM = 30
  3497.   * E_PARAM = 33
  3498. Remarks:
  3499.   * Before this call one must initialize process heap by call to
  3500.     subfunction 11.
  3501.   * If a new area is created, access flags set maximal rights
  3502.     for other processes. An attempt from other process to open
  3503.     with denied rights will fail with error code E_ACCESS.
  3504.   * The process which has created an area always has write access.
  3505.  
  3506. ---------------------- Constants for registers: ----------------------
  3507.   eax - SF_SYS_MISC (68)
  3508.   ebx - SSF_MEM_OPEN (22)
  3509. ======================================================================
  3510. ======= Function 68, subfunction 23 - close named memory area. =======
  3511. ======================================================================
  3512. Parameters:
  3513.   * eax = 68 - function number
  3514.   * ebx = 23 - subfunction number
  3515.   * ecx = area name. Maximum of 31 characters with terminating zero
  3516. Returned value:
  3517.   * eax destroyed
  3518. Remarks:
  3519.   * A memory area is physically freed (with deleting all data and
  3520.     freeing physical memory), when all threads which have opened
  3521.     this area will close it.
  3522.   * When thread is terminating, all opened by it areas are closed.
  3523.  
  3524. ---------------------- Constants for registers: ----------------------
  3525.   eax - SF_SYS_MISC (68)
  3526.   ebx - SSF_MEM_CLOSE (23)
  3527. ======================================================================
  3528. ======== Function 68, subfunction 24 - set exception handler. ========
  3529. ======================================================================
  3530. Parameters:
  3531.   * eax = 68 - function number
  3532.   * ebx = 24 - subfunction number
  3533.   * ecx = address of the new exception handler
  3534.   * edx = the mask of handled exceptions
  3535. Returned value:
  3536.   * eax = address of the old exception handler (0, if it was not set)
  3537.   * ebx = the old mask of handled exceptions
  3538. Remarks:
  3539.   * Bit number in mask of exceptions corresponds to exception number
  3540.     in CPU-specification (Intel-PC). For example, FPU exceptions have
  3541.     number 16 (#MF), and SSE exceptions - 19 (#XF).
  3542.   * The current implementation ignores the inquiry for hook of 7
  3543.     exception - the system handles #NM by its own.
  3544.   * The exception handler is called with exception number as first
  3545.     (and only) stack parameter. So, correct exit from the handler is
  3546.     RET 4. It returns to the instruction, that caused the exception,
  3547.     for faults, and to the next instruction for traps (see
  3548.     classification of exceptions in CPU specification).
  3549.   * When user handler receives control, the corresponding bit in
  3550.     the exception mask is cleared. Raising this exception
  3551.     in consequence leads to default handling, that is,
  3552.     terminating the application in absence of debugger or
  3553.     suspend with notification of debugger otherwise.
  3554.   * After user handler completes critical operations, it can set
  3555.     the corresponding bit in the exception mask with subfunction 25.
  3556.     Also user handler is responsible for clearing exceptions flags in
  3557.     FPU and/or SSE.
  3558.  
  3559. ---------------------- Constants for registers: ----------------------
  3560.   eax - SF_SYS_MISC (68)
  3561.   ebx - SSF_SET_EXCEPTION_HANDLER (24)
  3562. ======================================================================
  3563. ======== Function 68, subfunction 25 - set exception activity ========
  3564. ======================================================================
  3565. Parameters:
  3566.   * eax = 68 - function number
  3567.   * ebx = 25 - subfunction number
  3568.   * ecx = signal number
  3569.   * edx = value of activity (0/1)
  3570. Returned value:
  3571.   * eax = -1 - invalid signal number
  3572.   * otherwise eax = old value of activity for this signal (0/1)
  3573. Remarks:
  3574.   * In current implementation only mask for user exception handler,
  3575.     which has been previously set by subfunction 24,
  3576.     is changed. Signal number corresponds to exception number.
  3577.  
  3578. ---------------------- Constants for registers: ----------------------
  3579.   eax - SF_SYS_MISC (68)
  3580.   ebx - SSF_SET_EXCEPTION_STATE (25)
  3581. ======================================================================
  3582. ====== Function 68, subfunction 26 - release memory pages ============
  3583. ======================================================================
  3584. Parameters:
  3585.   * eax = 68 - function number
  3586.   * ebx = 26 - subfunction number
  3587.   * ecx = pointer to the memory block, allocated by subfunction 12
  3588.   * edx = offset from the block beginnings
  3589.   * esi = the size of the region of memory to release, in bytes
  3590. Remarks:
  3591.   * function release range of pages from ecx+edx to ecx+edx+esi
  3592.     and set virtual memory into reserved state.
  3593.  
  3594. ---------------------- Constants for registers: ----------------------
  3595.   eax - SF_SYS_MISC (68)
  3596.   ebx - SSF_MEM_FREE_EXT (26)
  3597. ======================================================================
  3598. ========== Function 68, subfunction 27 - load file ===================
  3599. ======================================================================
  3600. Parameters:
  3601.   * eax = 68 - function number
  3602.   * ebx = 27 - subfunction number
  3603.   * ecx = pointer to the string with path to file,
  3604.     rules of path forming can be found in function 70 description.
  3605. Returned value:
  3606.   * eax = pointer to the loaded file, or zero
  3607.   * edx = size of the loaded file, or zero
  3608. Remarks:
  3609.   * function loads file and unpacks, if necessary
  3610.   * Before this call one must initialize process heap by call to
  3611.     subfunction 11.  
  3612.  
  3613. ---------------------- Constants for registers: ----------------------
  3614.   eax - SF_SYS_MISC (68)
  3615.   ebx - SSF_LOAD_FILE (27)
  3616. ======================================================================
  3617. == Function 68, subfunction 28 - load file, specifying the encoding ==
  3618. ======================================================================
  3619. Parameters:
  3620.   * eax = 68 - function number
  3621.   * ebx = 28 - subfunction number
  3622.   * ecx = pointer to the string with path to file
  3623.   * edx = string encoding, details can be found in function 80 description.
  3624. Returned value:
  3625.   * eax = pointer to the loaded file, or zero
  3626.   * edx = size of the loaded file, or zero
  3627. Remarks:
  3628.   * function loads file and unpacks, if necessary
  3629. ======================================================================
  3630. ======== Function 68, subfunction 29 - allocate ring memory. =========
  3631. ======================================================================
  3632. Parameters:
  3633.   * eax = 68 - function number
  3634.   * ebx = 29 - subfunction number
  3635.   * ecx = required size in bytes
  3636. Returned value:
  3637.   * eax = 0 - failed
  3638.   * eax = pointer to the allocated ring
  3639. Remarks:
  3640.   * The requested size must be an exact multiple of pagesize (4 Kb)
  3641.   * The function allocates memory in such a way that you can read and
  3642.     write beyond the size of the allocated memory and will reach the
  3643.     beginning of the buffer again.
  3644.  
  3645. ---------------------- Constants for registers: ----------------------
  3646.   eax - SF_SYS_MISC (68)
  3647.   ebx - SSF_MEM_ALLOC_RING (29)  
  3648.  
  3649. ======================================================================
  3650. ====================== Function 69 - debugging. ======================
  3651. ======================================================================
  3652. A process can load other process as debugged by set of corresponding
  3653. bit by call to subfunction 7 of function 70.
  3654. A process can have only one debugger; one process can debug some
  3655. others. The system notifies debugger on events occurring with
  3656. debugged process. Messages are written to the buffer defined by
  3657. subfunction 0.
  3658. Format of a message:
  3659.   * +0: dword: message code
  3660.   * +4: dword: PID of debugged process
  3661.   * +8: there can be additional data depending on message code
  3662. Message codes:
  3663.   * 1 = exception
  3664.     * in addition dword-number of the exception is given
  3665.     * process is suspended
  3666.   * 2 = process has terminated
  3667.     * comes at any termination: both through the system function -1,
  3668.       and at "murder" by any other process (including debugger itself)
  3669.   * 3 = debug exception int 1 = #DB
  3670.     * in addition dword-image of the register DR6 is given:
  3671.       * bits 0-3: condition of the corresponding breakpoint (set by
  3672.         subfunction 9) is satisfied
  3673.       * bit 14: exception has occurred because of the trace mode
  3674.         (flag TF is set TF)
  3675.     * process is suspended
  3676. When debugger terminates, all debugged processes are killed.
  3677. If debugger does not want this, it must previously detach by
  3678. subfunction 3.
  3679.  
  3680. All subfunctions are applicable only to processes/threads started
  3681. from the current by function 70 with set debugging flag.
  3682. Debugging of multithreaded programs is not supported yet.
  3683. The full list of subfunctions:
  3684.   * subfunction 0 - define data area for debug messages
  3685.   * subfunction 1 - get contents of registers of debugged thread
  3686.   * subfunction 2 - set contents of registers of debugged thread
  3687.   * subfunction 3 - detach from debugged process
  3688.   * subfunction 4 - suspend debugged thread
  3689.   * subfunction 5 - resume debugged thread
  3690.   * subfunction 6 - read from the memory of debugged process
  3691.   * subfunction 7 - write to the memory of debugged process
  3692.   * subfunction 8 - terminate debugged thread
  3693.   * subfunction 9 - set/clear hardware breakpoint
  3694.  
  3695. ---------------------- Constants for registers: ----------------------
  3696.   eax - SF_DEBUG (69)
  3697.   ebx - SSF_SET_MESSAGE_AREA (0), SSF_GET_REGISTERS (1),
  3698.     SSF_SET_REGISTERS (2), SSF_DETACH (3), SSF_SUSPEND (4),
  3699.     SSF_RESUME (5), SSF_READ_MEMORY (6), SSF_WRITE_MEMORY (7),
  3700.     SSF_TERMINATE (8), SSF_DEFINE_BREAKPOINT (9)
  3701. ======================================================================
  3702. = Function 69, subfunction 0 - define data area fror debug messages. =
  3703. ======================================================================
  3704. Parameters:
  3705.   * eax = 69 - function number
  3706.   * ebx = 0 - subfunction number
  3707.   * ecx = pointer
  3708. Format of data area:
  3709.   * +0: dword: N = buffer size (not including this header)
  3710.   * +4: dword: occupied place
  3711.   * +8: N*byte: buffer
  3712. Returned value:
  3713.   * function does not return value
  3714. Remarks:
  3715.   * If the size field is negative, the buffer is considered locked
  3716.     and at arrival of new message the system will wait.
  3717.     For synchronization frame all work with the buffer by operations
  3718.     lock/unlock
  3719.         neg     [bufsize]
  3720.   * Data in the buffer are considered as array of items with variable
  3721.     length - messages. Format of a message is explained in
  3722.     general description.
  3723.  
  3724. ---------------------- Constants for registers: ----------------------
  3725.   eax - SF_DEBUG (69)
  3726.   ebx - SSF_SET_MESSAGE_AREA (0)
  3727. ======================================================================
  3728. ===================== Function 69, subfunction 1 =====================
  3729. ============ Get contents of registers of debugged thread. ===========
  3730. ======================================================================
  3731. Parameters:
  3732.   * eax = 69 - function number
  3733.   * ebx = 1 - subfunction number
  3734.   * ecx = thread identifier
  3735.   * edx = size of context structure, must be 0x28=40 bytes
  3736.   * esi = pointer to context structure
  3737. Returned value:
  3738.   * function does not return value
  3739. Format of context structure: (FPU is not supported yet)
  3740.   * +0: dword: eip
  3741.   * +4: dword: eflags
  3742.   * +8: dword: eax
  3743.   * +12 = +0xC: dword: ecx
  3744.   * +16 = +0x10: dword: edx
  3745.   * +20 = +0x14: dword: ebx
  3746.   * +24 = +0x18: dword: esp
  3747.   * +28 = +0x1C: dword: ebp
  3748.   * +32 = +0x20: dword: esi
  3749.   * +36 = +0x24: dword: edi
  3750. Remarks:
  3751.   * If the thread executes code of ring-0, the function returns
  3752.     contents of registers of ring-3.
  3753.   * Process must be loaded for debugging (as is shown in
  3754.     general description).
  3755.  
  3756. ---------------------- Constants for registers: ----------------------
  3757.   eax - SF_DEBUG (69)
  3758.   ebx - SSF_GET_REGISTERS (1)
  3759. ======================================================================
  3760. ===================== Function 69, subfunction 2 =====================
  3761. ============ Set contents of registers of debugged thread. ===========
  3762. ======================================================================
  3763. Parameters:
  3764.   * eax = 69 - function number
  3765.   * ebx = 2 - subfunction number
  3766.   * ecx = thread identifier
  3767.   * edx = size of context structure, must be 0x28=40 bytes
  3768.   * esi -> context structure
  3769. Returned value:
  3770.   * function does not return value
  3771. Format of context structure is shown in the description of
  3772. subfunction 1.
  3773. Remarks:
  3774.   * If the thread executes code of ring-0, the function returns
  3775.     contents of registers of ring-3.
  3776.   * Process must be loaded for debugging (as is shown in
  3777.     general description).
  3778.  
  3779. ---------------------- Constants for registers: ----------------------
  3780.   eax - SF_DEBUG (69)
  3781.   ebx - SSF_SET_REGISTERS (2)
  3782. ======================================================================
  3783. ===== Function 69, subfunction 3 - detach from debugged process. =====
  3784. ======================================================================
  3785. Parameters:
  3786.   * eax = 69 - function number
  3787.   * ebx = 3 - subfunction number
  3788.   * ecx = identifier
  3789. Returned value:
  3790.   * function does not return value
  3791. Remarks:
  3792.   * If the process was suspended, it resumes execution.
  3793.  
  3794. ---------------------- Constants for registers: ----------------------
  3795.   eax - SF_DEBUG (69)
  3796.   ebx - SSF_DETACH (3)
  3797. ======================================================================
  3798. ======== Function 69, subfunction 4 - suspend debugged thread. =======
  3799. ======================================================================
  3800. Parameters:
  3801.   * eax = 69 - function number
  3802.   * ebx = 4 - subfunction number
  3803.   * ecx = thread identifier
  3804. Returned value:
  3805.   * function does not return value
  3806. Remarks:
  3807.   * Process must be loaded for debugging (as is shown in
  3808.     general description).
  3809.  
  3810. ---------------------- Constants for registers: ----------------------
  3811.   eax - SF_DEBUG (69)
  3812.   ebx - SSF_SUSPEND (4)
  3813. ======================================================================
  3814. ======== Function 69, subfunction 5 - resume debugged thread. ========
  3815. ======================================================================
  3816. Parameters:
  3817.   * eax = 69 - function number
  3818.   * ebx = 5 - subfunction number
  3819.   * ecx = thread identifier
  3820. Returned value:
  3821.   * function does not return value
  3822. Remarks:
  3823.   * Process must be loaded for debugging (as is shown in
  3824.     general description).
  3825.  
  3826. ---------------------- Constants for registers: ----------------------
  3827.   eax - SF_DEBUG (69)
  3828.   ebx - SSF_RESUME (5)
  3829. ======================================================================
  3830. = Fucntion 69, subfunction 6 - read from memory of debugged process. =
  3831. ======================================================================
  3832. Parameters:
  3833.   * eax = 69 - function number
  3834.   * ebx = 6 - subfunction number
  3835.   * ecx = identifier
  3836.   * edx = number of bytes to read
  3837.   * esi = address in the memory of debugged process
  3838.   * edi = pointer to buffer for data
  3839. Returned value:
  3840.   * eax = -1 at an error (invalid PID or buffer)
  3841.   * otherwise eax = number of read bytes (possibly, 0,
  3842.     if esi is too large)
  3843. Remarks:
  3844.   * Process must be loaded for debugging (as is shown in
  3845.     general description).
  3846.  
  3847. ---------------------- Constants for registers: ----------------------
  3848.   eax - SF_DEBUG (69)
  3849.   ebx - SSF_READ_MEMORY (6)
  3850. ======================================================================
  3851. == Function 69, subfunction 7 - write to memory of debugged process. =
  3852. ======================================================================
  3853. Parameters:
  3854.   * eax = 69 - function number
  3855.   * ebx = 7 - subfunction number
  3856.   * ecx = identifier
  3857.   * edx = number of bytes to write
  3858.   * esi = address of memory in debugged process
  3859.   * edi = pointer to data
  3860. Returned value:
  3861.   * eax = -1 at an error (invalid PID or buffer)
  3862.   * otherwise eax = number of written bytes (possibly, 0,
  3863.     if esi is too large)
  3864. Remarks:
  3865.   * Process must be loaded for debugging (as is shown in
  3866.     general description).
  3867.  
  3868. ---------------------- Constants for registers: ----------------------
  3869.   eax - SF_DEBUG (69)
  3870.   ebx - SSF_WRITE_MEMORY (7)
  3871. ======================================================================
  3872. ======= Function 69, subfunction 8 - terminate debugged thread. ======
  3873. ======================================================================
  3874. Parameters:
  3875.   * eax = 69 - function number
  3876.   * ebx = 8 - subfunction number
  3877.   * ecx = identifier
  3878. Returned value:
  3879.   * function does not return value
  3880. Remarks:
  3881.   * Process must be loaded for debugging (as is shown in
  3882.     general description).
  3883.   * The function is similar to subfunction 2 of function 18
  3884.     with two differences: it requires first remark and
  3885.     accepts PID rather than slot number.
  3886.  
  3887. ---------------------- Constants for registers: ----------------------
  3888.   eax - SF_DEBUG (69)
  3889.   ebx - SSF_TERMINATE (8)
  3890. ======================================================================
  3891. ===== Function 69, subfunction 9 - set/clear hardware breakpoint. ====
  3892. ======================================================================
  3893. Parameters:
  3894.   * eax = 69 - function number
  3895.   * ebx = 9 - subfunction number
  3896.   * ecx = thread identifier
  3897.   * dl = index of breakpoint, from 0 to 3 inclusively
  3898.   * dh = flags:
  3899.     * if high bit is cleared - set breakpoint:
  3900.       * bits 0-1 - condition:
  3901.         * 00 = breakpoint on execution
  3902.         * 01 = breakpoint on read
  3903.         * 11 = breakpoint on read/write
  3904.       * bits 2-3 - length; for breakpoints on exception it must be
  3905.         00, otherwise one of
  3906.         * 00 = byte
  3907.         * 01 = word
  3908.         * 11 = dword
  3909.       * esi = breakpoint address; must be aligned according to
  3910.         the length (i.e. must be even for word breakpoints,
  3911.         divisible by 4 for dword)
  3912.     * if high bit is set - clear breakpoint
  3913. Returned value:
  3914.   * eax = 0 - success
  3915.   * eax = 1 - error in the input data
  3916.   * eax = 2 - (reserved, is never returned in the current
  3917.     implementation) a global breakpoint with that index is already set
  3918. Remarks:
  3919.   * Process must be loaded for debugging (as is shown in
  3920.     general description).
  3921.   * Hardware breakpoints are implemented through DRx-registers of
  3922.     the processor, all limitations results from this.
  3923.   * The function can reinstall the breakpoint, previously set
  3924.     by it (and it does not inform on this).
  3925.     Carry on the list of set breakpoints in the debugger.
  3926.   * Breakpoints generate debug exception #DB, on which the system
  3927.     notifies debugger.
  3928.   * Breakpoints on write and read/write act after
  3929.     execution of the caused it instruction.
  3930.  
  3931. ---------------------- Constants for registers: ----------------------
  3932.   eax - SF_DEBUG (69)
  3933.   ebx - SSF_DEFINE_BREAKPOINT (9)
  3934. ======================================================================
  3935. ==== Function 70 - work with file system with long names support. ====
  3936. ======================================================================
  3937. Parameters:
  3938.   * eax = 70
  3939.   * ebx = pointer to the information structure
  3940. Returned value:
  3941.   * eax = 0 - success; otherwise file system error code
  3942.   * some subfunctions return value in other registers too
  3943. General format of the information structure:
  3944.   * +0: dword: subfunction number
  3945.   * +4: dword: offset in file or folder
  3946.   * +8: dword: higher part of offset or flags
  3947.   * +12 = +0xC: dword: size of data
  3948.   * +16 = +0x10: dword: pointer to data
  3949.   * +20 = +0x14: ?: path - zero terminated string
  3950.   or
  3951.   * +20 = +0x14: byte: 0
  3952.   * +21 = +0x15: dword: pointer to string
  3953. Case sensitivity depends on filesystem.
  3954. If a path not begins with '/', it is considered a relative.
  3955. To get or set the current folder, use the sysfunction 30.
  3956. '../' in the path means a lift by one folder relatively current folder.
  3957. To set the encoding, put at the start of the string a byte with next values:
  3958.   * 1 = cp866
  3959.   * 2 = UTF-16LE
  3960.   * 3 = UTF-8
  3961.   otherwise will be used cp866. In an absolute path
  3962.   you may put this byte after the '/' or put an additional '/' before it.
  3963.   Also, you may use the sysfunction 80.
  3964. Format of an absolute path:
  3965.   /base/number/dir1/dir2/.../dirn/file,
  3966. where base/number identifies device, on which file is located:
  3967.   * RD/1 = ramdisk
  3968.   * FD/1 = first floppy drive,
  3969.     FD/2 = second floppy drive
  3970.   * HD0/x, HD1/x, HD2/x, HD3/x = hard drives accordingly on
  3971.     IDE0 (Primary Master), IDE1 (Primary Slave),
  3972.     IDE2 (Secondary Master), IDE3 (Secondary Slave);
  3973.     x - partition number on the selected hard drive, starts from 1
  3974.   * CD0/1, CD1/1, CD2/1, CD3/1 = same for cd
  3975.   * SYS = system folder (encoding inaffected key),
  3976.     second key may be set by sysfunction 30.3.
  3977. Examples:
  3978.   * '/sys/example.asm',0
  3979.   * '/rd/1/example.asm',0
  3980.   * '/HD0/1/folder/file.txt',0
  3981.   * '/hd2/2/pics/tanzania.bmp',0
  3982.   * 2,'/',0,'sys','/',0,'F',0,'I',0,'L',0,'E',0,0,0
  3983.  
  3984. Available subfunctions:
  3985.   * subfunction 0 - read file
  3986.   * subfunction 1 - read folder
  3987.   * subfunction 2 - create/rewrite file
  3988.   * subfunction 3 - write to existing file
  3989.   * subfunction 4 - set file size
  3990.   * subfunction 5 - get attributes of file/folder
  3991.   * subfunction 6 - set attributes of file/folder
  3992.   * subfunction 7 - start application
  3993.   * subfunction 8 - delete file/folder
  3994.   * subfunction 9 - create folder
  3995. For CD-drives due to hardware limitations only subfunctions
  3996. 0,1,5 and 7 are available, other subfunctions return error
  3997. with code 2.
  3998. At the first call of subfunctions 0,1,5,7 to ATAPI devices
  3999. (CD and DVD) the manual control of tray is locked due to caching
  4000. drive data. Unlocking is made when subfunction 4 of function 24
  4001. is called for corresponding device.
  4002.  
  4003. ---------------------- Constants for registers: ----------------------
  4004.   eax - SF_FILE (70)
  4005.  [ebx] - SSF_READ_FILE (0), SSF_READ_FOLDER (1), SSF_CREATE_FILE (2),
  4006.     SSF_WRITE_FILE (3), SSF_SET_END (4), SSF_GET_INFO (5),
  4007.     SSF_SET_INFO (6), SSF_START_APP (7), SSF_DELETE (8),
  4008.     SSF_CREATE_FOLDER (9)
  4009. ======================================================================
  4010. === Function 70, subfunction 0 - read file with long names support. ==
  4011. ======================================================================
  4012. Parameters:
  4013.   * eax = 70 - function number
  4014.   * ebx = pointer to the information structure
  4015. Format of the information structure:
  4016.   * +0: dword: 0 = subfunction number
  4017.   * +4: dword: file offset (in bytes)
  4018.   * +8: dword: 0 (reserved for high dword of offset)
  4019.   * +12 = +0xC: dword: number of bytes to read
  4020.   * +16 = +0x10: dword: pointer to buffer for data
  4021.   * +20 = +0x14: path, general rules of names forming
  4022. Returned value:
  4023.   * eax = 0 - success, otherwise file system error code
  4024.   * ebx = number of bytes read
  4025. Remarks:
  4026.   * If file was ended before last requested block was read,
  4027.     the function will read as many as it can, and after that return
  4028.     eax=6 (EOF).
  4029.   * The function does not allow to read folder (returns eax=10,
  4030.     access denied).
  4031.  
  4032. ---------------------- Constants for registers: ----------------------
  4033.   eax - SF_FILE (70)
  4034.  [ebx] - SSF_READ_FILE (0)
  4035. ======================================================================
  4036. == Function 70, subfunction 1 - read folder with long names support. =
  4037. ======================================================================
  4038. Parameters:
  4039.   * eax = 70 - function number
  4040.   * ebx = pointer to the information structure
  4041. Format of the information structure:
  4042.   * +0: dword: 1 = subfunction number
  4043.   * +4: dword: index of starting block (beginning from 0)
  4044.   * +8: dword: names encoding:
  4045.     0 = default
  4046.     1 = cp866
  4047.     2 = UTF-16LE
  4048.     3 = UTF-8
  4049.   * +12 = +0xC: dword: number of blocks to read
  4050.   * +16 = +0x10: dword: pointer to buffer for data
  4051.   * +20 = +0x14: path, general rules of names forming
  4052. Returned value:
  4053.   * eax = 0 - success, otherwise file system error code
  4054.   * ebx = number of file information blocks, written to the buffer
  4055. Structure of the buffer:
  4056.   * header (32 bytes)
  4057.   * block with information on file 1
  4058.   * block with information on file 2
  4059.   * ...
  4060. Structure of header:
  4061.   * +0: dword: version of structure (current is 1)
  4062.   * +4: dword: number of placed blocks; is not greater than requested
  4063.     in the field +12 of information structure; can be less, if
  4064.     there are no more files in folder (the same as in ebx)
  4065.   * +8: dword: total number of files in folder
  4066.   * +12 = +0xC: 20*byte: reserved (zeroed)
  4067. Structure of block of data for folder entry (BDFE):
  4068.   * +0: dword: attributes of file:
  4069.     * bit 0 (mask 1): file is read-only
  4070.     * bit 1 (mask 2): file is hidden
  4071.     * bit 2 (mask 4): file is system
  4072.     * bit 3 (mask 8): this is the volume label (using by subfunction 5)
  4073.     * bit 4 (mask 0x10): this is a folder
  4074.     * bit 5 (mask 0x20): file was not archived - many archivation
  4075.       programs have an option to archive only files with this bit set,
  4076.       and after archiving this bit is cleared - it can be useful
  4077.       for automatically creating of backup-archives as at writing
  4078.       this bit is usually set
  4079.   * +4: dword: encoding, equals to field +8 in the information structure
  4080.   * +8: 4*byte: time of file creation
  4081.   * +12 = +0xC: 4*byte: date of file creation
  4082.   * +16 = +0x10: 4*byte: time of last access (read or write)
  4083.   * +20 = +0x14: 4*byte: date of last access
  4084.   * +24 = +0x18: 4*byte: time of last modification
  4085.   * +28 = +0x1C: 4*byte: date of last modification
  4086.   * +32 = +0x20: qword: file size in bytes (up to 16777216 Tb)
  4087.   * +40 = +0x28: name, 264 bytes in cp866, otherwise - 520 bytes.
  4088. Time format:
  4089.   * +0: byte: seconds
  4090.   * +1: byte: minutes
  4091.   * +2: byte: hours
  4092.   * +3: byte: reserved (0)
  4093.   * for example, 23.59.59 is written as (in hex) 3B 3B 17 00
  4094. Date format:
  4095.   * +0: byte: day
  4096.   * +1: byte: month
  4097.   * +2: word: year
  4098.   * for example, 25.11.1979 is written as (in hex) 19 0B BB 07
  4099. Remarks:
  4100.   * If BDFE contains cp866 name, the length of BDFE is 304 bytes,
  4101.     otherwise - 560 bytes.
  4102.   * Name string is zero terminated, further data contain garbage.
  4103.   * If files in folder were ended before requested number was read,
  4104.     the function will read as many as it can, and after that return
  4105.     eax=6 (EOF).
  4106.   * Any folder on the disk, except for root, contains two special
  4107.     entries "." and "..", identifying accordingly the folder itself
  4108.     and the parent folder.
  4109.   * The function allows also to read virtual folders "/", "/rd",
  4110.     "/fd", "/hd[n]", thus attributes of subfolders are set to 0x10,
  4111.     and times and dates are zeroed. An alternative way to get the
  4112.     equipment information - subfunction 11 of function 18.
  4113.  
  4114. ---------------------- Constants for registers: ----------------------
  4115.   eax - SF_FILE (70)
  4116.  [ebx] - SSF_READ_FOLDER (1)
  4117. ======================================================================
  4118. ===================== Function 70, subfunction 2 =====================
  4119. ============ Create/rewrite file with long names support. ============
  4120. ======================================================================
  4121. Parameters:
  4122.   * eax = 70 - function number
  4123.   * ebx = pointer to the information structure
  4124. Format of the information structure:
  4125.   * +0: dword: 2 = subfunction number
  4126.   * +4: dword: 0 (reserved)
  4127.   * +8: dword: 0 (reserved)
  4128.   * +12 = +0xC: dword: number of bytes to write
  4129.   * +16 = +0x10: dword: pointer to data
  4130.   * +20 = +0x14: path, general rules of names forming
  4131. Returned value:
  4132.   * eax = 0 - success, otherwise file system error code
  4133.   * ebx = number of written bytes (possibly 0)
  4134. Remarks:
  4135.   * If a file with given name did not exist, it is created;
  4136.     if it existed, it is rewritten.
  4137.   * If there is not enough free space on disk, the function will
  4138.     write as many as can and then return error code 8.
  4139.   * The function is not supported for CD (returns error code 2).
  4140.  
  4141. ---------------------- Constants for registers: ----------------------
  4142.   eax - SF_FILE (70)
  4143.  [ebx] - SSF_CREATE_FILE (2)
  4144. ======================================================================
  4145. ===================== Function 70, subfunction 3 =====================
  4146. =========== Write to existing file with long names support. ==========
  4147. ======================================================================
  4148. Parameters:
  4149.   * eax = 70 - function number
  4150.   * ebx = pointer to the information structure
  4151. Format of the information structure:
  4152.   * +0: dword: 3 = subfunction number
  4153.   * +4: dword: file offset (in bytes)
  4154.   * +8: dword: high dword of offset (must be 0 for FAT)
  4155.   * +12 = +0xC: dword: number of bytes to write
  4156.   * +16 = +0x10: dword: pointer to data
  4157.   * +20 = +0x14: path, general rules of names forming
  4158. Returned value:
  4159.   * eax = 0 - success, otherwise file system error code
  4160.   * ebx = number of written bytes (possibly 0)
  4161. Remarks:
  4162.   * The file must already exist, otherwise function returns eax=5.
  4163.   * The only result of write 0 bytes is update in the file attributes
  4164.     date/time of modification and access to the current date/time.
  4165.   * If beginning and/or ending position is greater than file size
  4166.     (except for the previous case), the file is expanded to needed
  4167.     size with zero characters.
  4168.   * The function is not supported for CD (returns error code 2).
  4169.  
  4170. ---------------------- Constants for registers: ----------------------
  4171.   eax - SF_FILE (70)
  4172.  [ebx] - SSF_WRITE_FILE (3)
  4173. ======================================================================
  4174. ============ Function 70, subfunction 4 - set end of file. ===========
  4175. ======================================================================
  4176. Parameters:
  4177.   * eax = 70 - function number
  4178.   * ebx = pointer to the information structure
  4179. Format of the information structure:
  4180.   * +0: dword: 4 = subfunction number
  4181.   * +4: dword: low dword of new file size
  4182.   * +8: dword: high dword of new file size (must be 0 for FAT)
  4183.   * +12 = +0xC: dword: 0 (reserved)
  4184.   * +16 = +0x10: dword: 0 (reserved)
  4185.   * +20 = +0x14: path, general rules of names forming
  4186. Returned value:
  4187.   * eax = 0 - success, otherwise file system error code
  4188.   * ebx destroyed
  4189. Remarks:
  4190.   * If new file size is less than old one, file will be truncated.
  4191.     If new size is greater than old one, file will be expanded, and if
  4192.     size difference is up to 16 MB, new space will be cleared with 0.
  4193.   * If there is not enough free space on disk for expansion, the
  4194.     function will expand to maximum possible size and then return
  4195.     error code 8.
  4196.   * The function is not supported for CD (returns error code 2).
  4197.  
  4198. ---------------------- Constants for registers: ----------------------
  4199.   eax - SF_FILE (70)
  4200.  [ebx] - SSF_SET_END (4)
  4201. ======================================================================
  4202. ==== Function 70, subfunction 5 - get information on file/folder. ====
  4203. ======================================================================
  4204. Parameters:
  4205.   * eax = 70 - function number
  4206.   * ebx = pointer to the information structure
  4207. Format of the information structure:
  4208.   * +0: dword: 5 = subfunction number
  4209.   * +4: dword: 0 (reserved)
  4210.   * +8: dword: 0 or flags (for the root folder)
  4211.   * +12 = +0xC: dword: 0 (reserved)
  4212.   * +16 = +0x10: dword: pointer to buffer for data (40 bytes)
  4213.   * +20 = +0x14: path, general rules of names forming
  4214. Returned value:
  4215.   * eax = 0 - success, otherwise file system error code
  4216.   * ebx destroyed
  4217. Information on file is returned in the BDFE format (block of data
  4218. for folder entry), explained in the description of subfunction 1,
  4219. but without filename, except the root folder.
  4220. Remarks:
  4221.   * For the root folder returns the partition size,
  4222.     and if encoding byte is non-zero, the volume label.
  4223.   * For the device returns only the size.
  4224.  
  4225. ---------------------- Constants for registers: ----------------------
  4226.   eax - SF_FILE (70)
  4227.  [ebx] - SSF_GET_INFO (5)
  4228. ======================================================================
  4229. ===== Function 70, subfunction 6 - set attributes of file/folder. ====
  4230. ======================================================================
  4231. Parameters:
  4232.   * eax = 70 - function number
  4233.   * ebx = pointer to the information structure
  4234. Format of the information structure:
  4235.   * +0: dword: 6 = subfunction number
  4236.   * +4: dword: 0 (reserved)
  4237.   * +8: dword: 0 (reserved)
  4238.   * +12 = +0xC: dword: 0 (reserved)
  4239.   * +16 = +0x10: dword: pointer to buffer with attributes (32 bytes)
  4240.   * +20 = +0x14: path, general rules of names forming
  4241. Returned value:
  4242.   * eax = 0 - success, otherwise file system error code
  4243.   * ebx destroyed
  4244. File attributes are first 32 bytes in BDFE (block of data
  4245. for folder entry), explained in the description of subfunction 1
  4246. (that is, without name and size of file). Attribute
  4247. file/folder/volume label (bits 3,4 in dword +0) is not changed.
  4248. Byte +4 (name format) is ignored.
  4249. Remarks:
  4250.   * The function does not support virtual folders such as /, /rd and
  4251.     root folders like /rd/1.
  4252.   * The function is not supported for CD (returns error code 2).
  4253.  
  4254. ---------------------- Constants for registers: ----------------------
  4255.   eax - SF_FILE (70)
  4256.  [ebx] - SSF_SET_INFO (6)
  4257. ======================================================================
  4258. =========== Function 70, subfunction 7 - start application. ==========
  4259. ======================================================================
  4260. Parameters:
  4261.   * eax = 70 - function number
  4262.   * ebx = pointer to the information structure
  4263. Format of the information structure:
  4264.   * +0: dword: 7 = subfunction number
  4265.   * +4: dword: flags field:
  4266.     * bit 0: start process as debugged
  4267.     * other bits are reserved and must be set to 0
  4268.   * +8: dword: 0 or pointer to ASCIIZ-string with parameters
  4269.   * +12 = +0xC: dword: 0 (reserved)
  4270.   * +16 = +0x10: dword: 0 (reserved)
  4271.   * +20 = +0x14: path, general rules of names forming
  4272. Returned value:
  4273.   * eax > 0 - program is loaded, eax contains PID
  4274.   * eax < 0 - an error has occurred, -eax contains
  4275.     file system error code
  4276.   * ebx destroyed
  4277. Remarks:
  4278.   * Command line must be terminated by the character with the code 0
  4279.     (ASCIIZ-string); function takes into account either all characters
  4280.     up to terminating zero inclusively or first 256 character
  4281.     regarding what is less.
  4282.   * If the process is started as debugged, it is created in
  4283.     the suspended state; to run use subfunction 5 of function 69.
  4284.  
  4285. ---------------------- Constants for registers: ----------------------
  4286.   eax - SF_FILE (70)
  4287.  [ebx] - SSF_START_APP (7)
  4288. ======================================================================
  4289. ========== Function 70, subfunction 8 - delete file/folder. ==========
  4290. ======================================================================
  4291. Parameters:
  4292.   * eax = 70 - function number
  4293.   * ebx = pointer to the information structure
  4294. Format of the information structure:
  4295.   * +0: dword: 8 = subfunction number
  4296.   * +4: dword: 0 (reserved)
  4297.   * +8: dword: 0 (reserved)
  4298.   * +12 = +0xC: dword: 0 (reserved)
  4299.   * +16 = +0x10: dword: 0 (reserved)
  4300.   * +20 = +0x14: path, general rules of names forming
  4301. Returned value:
  4302.   * eax = 0 - success, otherwise file system error code
  4303.   * ebx destroyed
  4304. Remarks:
  4305.   * The function is not supported for CD (returns error code 2).
  4306.   * The function can delete only empty folders (attempt to delete
  4307.     nonempty folder results in error with code 10, "access denied").
  4308.  
  4309. ---------------------- Constants for registers: ----------------------
  4310.   eax - SF_FILE (70)
  4311.  [ebx] - SSF_DELETE (8)
  4312. ======================================================================
  4313. ============= Function 70, subfunction 9 - create folder. ============
  4314. ======================================================================
  4315. Parameters:
  4316.   * eax = 70 - function number
  4317.   * ebx = pointer to the information structure
  4318. Format of the information structure:
  4319.   * +0: dword: 9 = subfunction number
  4320.   * +4: dword: 0 (reserved)
  4321.   * +8: dword: 0 (reserved)
  4322.   * +12 = +0xC: dword: 0 (reserved)
  4323.   * +16 = +0x10: dword: 0 (reserved)
  4324.   * +20 = +0x14: path, general rules of names forming
  4325. Returned value:
  4326.   * eax = 0 - success, otherwise file system error code
  4327.   * ebx destroyed
  4328. Remarks:
  4329.   * The function is not supported for CD (returns error code 2).
  4330.   * The parent folder must already exist.
  4331.   * If target folder already exists, function returns success (eax=0).
  4332.  
  4333. ---------------------- Constants for registers: ----------------------
  4334.   eax - SF_FILE (70)
  4335.  [ebx] - SSF_CREATE_FOLDER (9)
  4336. ======================================================================
  4337. ============= Function 70, subfunction 10 - rename/move. =============
  4338. ======================================================================
  4339. Parameters:
  4340.   * eax = 70 - function number
  4341.   * ebx = pointer to the information structure
  4342. Format of the information structure:
  4343.   * +0: dword: 10 = subfunction number
  4344.   * +4: dword: 0 (reserved)
  4345.   * +8: dword: 0 (reserved)
  4346.   * +12 = +0xC: dword: 0 (reserved)
  4347.   * +16 = +0x10: dword: pointer to the new name/path string
  4348.   * +20 = +0x14: path, general rules of names forming
  4349. Returned value:
  4350.   * eax = 0 - success, otherwise file system error code
  4351.   * ebx destroyed
  4352. Remarks:
  4353.   * New path forming differs from general rules:
  4354.     relative path relates to the target's parent folder,
  4355.     absolute path relates to the partition's root folder.
  4356. ======================================================================
  4357. ================== Function 71 - set window caption ==================
  4358. ======================================================================
  4359. Parameters:
  4360.   * eax = 71 - function number
  4361.   * ebx = 1
  4362.   * ecx = pointer to zero terminated string,
  4363.     the string may start with an encoding byte:
  4364.     1 = cp866
  4365.     2 = UTF-16LE
  4366.     3 = UTF-8
  4367.   or:
  4368.   * ebx = 2
  4369.   * ecx = pointer to zero terminated string
  4370.   * dl  = string encoding
  4371. Returned value:
  4372.   * function does not return value
  4373. Remarks:
  4374.   * Pass NULL in ecx to remove caption.
  4375.  
  4376. ---------------------- Constants for registers: ----------------------
  4377.   eax - SF_SET_CAPTION (71)
  4378. ======================================================================
  4379. =============== Function 72 - send message to a window. ==============
  4380. ======================================================================
  4381.  
  4382. - Subfunction 1 - send message with parameter to the active window. --
  4383. Parameters:
  4384.   * eax = 72 - function number
  4385.   * ebx = 1 - subfunction number
  4386.   * ecx = event code: 2 or 3
  4387.   * edx = parameter: key code for ecx=2, button identifier for ecx=3
  4388. Returned value:
  4389.   * eax = 0 - success
  4390.   * eax = 1 - buffer is full
  4391.  
  4392. ---------------------- Constants for registers: ----------------------
  4393.   eax - SF_SEND_MESSAGE (72)
  4394. ======================================================================
  4395. ===================== Function 73 - blit bitmap  =====================
  4396. ======================================================================
  4397.  
  4398. Parameters:
  4399.   * eax = 73 - function number
  4400.  
  4401.   * ebx = ROP and optional flags
  4402.      31      30 29 28       6 5  4 3   0
  4403.      [reserved][CR][reserved][T][B][ROP]
  4404.      ROP - raster operation code
  4405.         0: Copy
  4406.      1-15: reserved
  4407.      B   - blit into the background surface
  4408.      T   - transparent blit
  4409.      CR  - blit client relative
  4410.  
  4411.   * ecx = pointer to the function parameters
  4412.         destination offset and clipping
  4413.      +0 signed dword: destination rectangle X offset from the window
  4414.                       top-left corner
  4415.      +4 signed dword: destination rectangle Y offset from the window
  4416.                       top-left corner
  4417.      +8 dword:        destination rectangle width
  4418.     +12 dword:        destination rectangle height
  4419.  
  4420.         source offset and clipping
  4421.     +16 signed dword: source rectangle X offset from the bitmap
  4422.                       top-left corner
  4423.     +20 signed dword: source rectangle Y offset from the bitmap
  4424.                       top-left corner
  4425.     +24 dword:        source rectangle width
  4426.     +28 dword:        source rectangle height
  4427.  
  4428.     +32: dword: bitmap data - must be 32bpp
  4429.     +36: dword: size of the bitmap row in bytes
  4430.  
  4431. Returned value:
  4432.   * function does not return value
  4433.  
  4434. ---------------------- Constants for registers: ----------------------
  4435.   eax - SF_BLITTER (73)
  4436. ======================================================================
  4437. = Function 74, Subfunction 255, Get number of active network devices. =
  4438. ======================================================================
  4439. Parameters:
  4440.   * eax = 74 - function number
  4441.   * bl = 255 - subfunction number
  4442. Returned value:
  4443.   * eax = number of active network devices
  4444.  
  4445. ---------------------- Constants for registers: ----------------------
  4446.   eax - SF_NETWORK_GET (74)
  4447.    bl - SSF_DEVICE_COUNT (255)
  4448. ======================================================================
  4449. ======== Function 74, Subfunction 0, Get network device type. ========
  4450. ======================================================================
  4451. Parameters:
  4452.   * eax = 74 - function number
  4453.   * bl = 0 - subfunction number
  4454.   * bh = device number
  4455. Returned value:
  4456.   * eax = device type number, -1 on error
  4457.  
  4458. ---------------------- Constants for registers: ----------------------
  4459.   eax - SF_NETWORK_GET (74)
  4460.    bl - SSF_DEVICE_TYPE (0)
  4461. ======================================================================
  4462. ======== Function 74, Subfunction 1, Get network device name. ========
  4463. ======================================================================
  4464. Parameters:
  4465.   * eax = 74 - function number
  4466.   * bl = 1 - subfunction number
  4467.   * bh = device number
  4468.   * ecx = pointer to 64 byte buffer
  4469. Returned value:
  4470.   * eax = -1 on error
  4471.   * The network device name is written into the buffer, on success
  4472.  
  4473. ---------------------- Constants for registers: ----------------------
  4474.   eax - SF_NETWORK_GET (74)
  4475.    bl - SSF_DEVICE_NAME (1)
  4476. ======================================================================
  4477. ========= Function 74, Subfunction 2, Reset network device. ==========
  4478. ======================================================================
  4479. Parameters:
  4480.   * eax = 74 - function number
  4481.   * bl = 2 - subfunction number
  4482.   * bh = device number
  4483. Returned value:
  4484.   * eax = -1 on error
  4485.  
  4486. ---------------------- Constants for registers: ----------------------
  4487.   eax - SF_NETWORK_GET (74)
  4488.    bl - SSF_RESET_DEVICE (2)
  4489. ======================================================================
  4490. ========== Function 74, Subfunction 3, Stop network device. ==========
  4491. ======================================================================
  4492. Parameters:
  4493.   * eax = 74 - function number
  4494.   * bl = 3 - subfunction number
  4495.   * bh = device number
  4496. Returned value:
  4497.   * eax = -1 on error
  4498.  
  4499. ---------------------- Constants for registers: ----------------------
  4500.   eax - SF_NETWORK_GET (74)
  4501.    bl - SSF_STOP_DEVICE (3)
  4502. ======================================================================
  4503. =========== Function 74, Subfunction 4, Get device pointer. ==========
  4504. ======================================================================
  4505. Parameters:
  4506.   * eax = 74 - function number
  4507.   * bl = 4 - subfunction number
  4508.   * bh = device number
  4509. Returned value:
  4510.   * eax = device pointer, -1 on error
  4511.  
  4512. ---------------------- Constants for registers: ----------------------
  4513.   eax - SF_NETWORK_GET (74)
  4514.    bl - SSF_DEVICE_POINTER (4)
  4515. ======================================================================
  4516. ========= Function 74, Subfunction 6, Get packet TX counter. =========
  4517. ======================================================================
  4518. Parameters:
  4519.   * eax = 74 - function number
  4520.   * bl = 6 - subfunction number
  4521.   * bh = device number
  4522. Returned value:
  4523.   * eax = Number of packets sent since device start, -1 on error
  4524.  
  4525. ---------------------- Constants for registers: ----------------------
  4526.   eax - SF_NETWORK_GET (74)
  4527.    bl - SSF_TX_PACKET_COUNT (6)
  4528. ======================================================================
  4529. ========= Function 74, Subfunction 7, Get packet RX counter. =========
  4530. ======================================================================
  4531. Parameters:
  4532.   * eax = 74 - function number
  4533.   * bl = 7 - subfunction number
  4534.   * bh = device number
  4535. Returned value:
  4536.   * eax = Number of packets received since device start, -1 on error
  4537.  
  4538. ---------------------- Constants for registers: ----------------------
  4539.   eax - SF_NETWORK_GET (74)
  4540.    bl - SSF_RX_PACKET_COUNT (7)
  4541. ======================================================================
  4542. ========== Function 74, Subfunction 8, Get TX byte counter. ==========
  4543. ======================================================================
  4544. Parameters:
  4545.   * eax = 74 - function number
  4546.   * bl = 8 - subfunction number
  4547.   * bh = device number
  4548. Returned value:
  4549.   * eax = Number of bytes sent since device start (lower dword)
  4550.           -1 on error
  4551.   * ebx = Number of bytes sent since device start (higher dword)
  4552.  
  4553. ---------------------- Constants for registers: ----------------------
  4554.   eax - SF_NETWORK_GET (74)
  4555.    bl - SSF_TX_BYTE_COUNT (8)
  4556. ======================================================================
  4557. ========== Function 74, Subfunction 9, Get RX byte counter. ==========
  4558. ======================================================================
  4559. Parameters:
  4560.   * eax = 74 - function number
  4561.   * bl = 9 - subfunction number
  4562.   * bh = device number
  4563. Returned value:
  4564.   * eax = Number of bytes received since device start (lower dword)
  4565.           -1 on error
  4566.   * ebx = Number of bytes received since device start (higher dword)
  4567.  
  4568. ---------------------- Constants for registers: ----------------------
  4569.   eax - SF_NETWORK_GET (74)
  4570.    bl - SSF_RX_BYTE_COUNT (9)
  4571. ======================================================================
  4572. ========== Function 74, Subfunction 10, Get link status. =============
  4573. ======================================================================
  4574. Parameters:
  4575.   * eax = 74 - function number
  4576.   * bl = 10 - subfunction number
  4577.   * bh = device number
  4578. Returned value:
  4579.   * eax = link status, -1 on error
  4580.  
  4581.   Link status:
  4582.     ETH_LINK_DOWN   =    0b         ; Link is down
  4583.     ETH_LINK_UNKNOWN=    1b         ; There could be an active link
  4584.     ETH_LINK_FD     =   10b         ; full duplex flag
  4585.     ETH_LINK_10M    =  100b         ; 10 mbit
  4586.     ETH_LINK_100M   = 1000b         ; 100 mbit
  4587.     ETH_LINK_1G     = 1100b         ; gigabit
  4588.  
  4589. ---------------------- Constants for registers: ----------------------
  4590.   eax - SF_NETWORK_GET (74)
  4591.    bl - SSF_LINK_STATUS (10)
  4592. ======================================================================
  4593. ==== Function 74, Subfunction 11, Get TX error packets counter. ======
  4594. ======================================================================
  4595. Parameters:
  4596.   * eax = 74 - function number
  4597.   * bl = 11 - subfunction number
  4598.   * bh = device number
  4599. Returned value:
  4600.   * eax = Number of erroneous packets received since device start, -1 on error
  4601.  
  4602. ---------------------- Constants for registers: ----------------------
  4603.   eax - SF_NETWORK_GET (74)
  4604.    bl - SSF_TX_PACKET_ERROR_COUNT (11)  
  4605. ======================================================================
  4606. === Function 74, Subfunction 12, Get TX dropped packets counter. =====
  4607. ======================================================================
  4608. Parameters:
  4609.   * eax = 74 - function number
  4610.   * bl = 12 - subfunction number
  4611.   * bh = device number
  4612. Returned value:
  4613.   * eax = Number of dropped packets since device start, -1 on error
  4614.  
  4615. ---------------------- Constants for registers: ----------------------
  4616.   eax - SF_NETWORK_GET (74)
  4617.    bl - SSF_TX_PACKET_DROP_COUNT (12)    
  4618. ======================================================================
  4619. ==== Function 74, Subfunction 13, Get TX missed packets counter. =====
  4620. ======================================================================
  4621. Parameters:
  4622.   * eax = 74 - function number
  4623.   * bl = 13 - subfunction number
  4624.   * bh = device number
  4625. Returned value:
  4626.   * eax = Number of missed packets since device start, -1 on error
  4627.  
  4628. ---------------------- Constants for registers: ----------------------
  4629.   eax - SF_NETWORK_GET (74)
  4630.    bl - SSF_TX_PACKET_MISS_COUNT (13)    
  4631.    ======================================================================
  4632. ==== Function 74, Subfunction 14, Get RX error packets counter. ======
  4633. ======================================================================
  4634. Parameters:
  4635.   * eax = 74 - function number
  4636.   * bl = 14 - subfunction number
  4637.   * bh = device number
  4638. Returned value:
  4639.   * eax = Number of erroneous packets received since device start, -1 on error
  4640.  
  4641. ---------------------- Constants for registers: ----------------------
  4642.   eax - SF_NETWORK_GET (74)
  4643.    bl - SSF_RX_PACKET_ERROR_COUNT (14)  
  4644. ======================================================================
  4645. === Function 74, Subfunction 15, Get RX dropped packets counter. =====
  4646. ======================================================================
  4647. Parameters:
  4648.   * eax = 74 - function number
  4649.   * bl = 15 - subfunction number
  4650.   * bh = device number
  4651. Returned value:
  4652.   * eax = Number of dropped packets since device start, -1 on error
  4653.  
  4654. ---------------------- Constants for registers: ----------------------
  4655.   eax - SF_NETWORK_GET (74)
  4656.    bl - SSF_RX_PACKET_DROP_COUNT (12)    
  4657. ======================================================================
  4658. ==== Function 74, Subfunction 16, Get RX missed packets counter. =====
  4659. ======================================================================
  4660. Parameters:
  4661.   * eax = 74 - function number
  4662.   * bl = 16 - subfunction number
  4663.   * bh = device number
  4664. Returned value:
  4665.   * eax = Number of missed packets since device start, -1 on error
  4666.  
  4667. ---------------------- Constants for registers: ----------------------
  4668.   eax - SF_NETWORK_GET (74)
  4669.    bl - SSF_RX_PACKET_MISS_COUNT (16)  
  4670. ======================================================================
  4671. ============== Function 75, Subfunction 0, Open socket. ==============
  4672. ======================================================================
  4673. Parameters:
  4674.   * eax = 75 - function number
  4675.   * bl = 0 - subfunction number
  4676.   * ecx = domain
  4677.   * edx = type
  4678.   * esi = protocol
  4679. Returned value:
  4680.   * eax = socket number, -1 on error
  4681.   * ebx = errorcode
  4682.  
  4683. ---------------------- Constants for registers: ----------------------
  4684.   eax - SF_NETWORK_SOCKET (75)
  4685.    bl - SSF_OPEN (0)
  4686. ======================================================================
  4687. ============= Function 75, Subfunction 1, Close socket. ==============
  4688. ======================================================================
  4689. Parameters:
  4690.   * eax = 75 - function number
  4691.   * bl = 1 - subfunction number
  4692.   * ecx = socket number
  4693. Returned value:
  4694.   * eax = -1 on error
  4695.   * ebx = errorcode
  4696.  
  4697. ---------------------- Constants for registers: ----------------------
  4698.   eax - SF_NETWORK_SOCKET (75)
  4699.    bl - SSF_CLOSE (1)
  4700. ======================================================================
  4701. ================== Function 75, Subfunction 2, Bind. =================
  4702. ======================================================================
  4703. Parameters:
  4704.   * eax = 75 - function number
  4705.   * bl = 2 - subfunction number
  4706.   * ecx = socket number
  4707.   * edx = pointer to sockaddr structure
  4708.   * esi = length of sockaddr structure
  4709. Format of SockAddr structure:
  4710.   * +0: Word: Family
  4711.   * +2: 14*Byte: Data
  4712. Returned value:
  4713.   * eax = -1 on error
  4714.   * ebx = errorcode
  4715.  
  4716. ---------------------- Constants for registers: ----------------------
  4717.   eax - SF_NETWORK_SOCKET (75)
  4718.    bl - SSF_BIND (2)
  4719. ======================================================================
  4720. ================= Function 75, Subfunction 3, Listen. ================
  4721. ======================================================================
  4722. Parameters:
  4723.   * eax = 75 - function number
  4724.   * bl = 3 - subfunction number
  4725.   * ecx = socket number
  4726.   * edx = backlog
  4727. Returned value:
  4728.   * eax = -1 on error
  4729.   * ebx = errorcode
  4730.  
  4731. ---------------------- Constants for registers: ----------------------
  4732.   eax - SF_NETWORK_SOCKET (75)
  4733.    bl - SSF_LISTEN (3)
  4734. ======================================================================
  4735. ================ Function 75, Subfunction 4, Connect. ================
  4736. ======================================================================
  4737. Parameters:
  4738.   * eax = 75 - function number
  4739.   * bl = 4 - subfunction number
  4740.   * ecx = socket number
  4741.   * edx = pointer to sockaddr structure
  4742.   * esi = length of sockaddr structure
  4743. Format of SockAddr structure:
  4744.   * +0: Word: Family
  4745.   * +2: 14*Byte: Data
  4746. Returned value:
  4747.   * eax = -1 on error
  4748.   * ebx = errorcode
  4749.  
  4750. ---------------------- Constants for registers: ----------------------
  4751.   eax - SF_NETWORK_SOCKET (75)
  4752.    bl - SSF_CONNECT (4)
  4753. ======================================================================
  4754. ================= Function 75, Subfunction 5, Accept. ================
  4755. ======================================================================
  4756. Parameters:
  4757.   * eax = 75 - function number
  4758.   * bl = 5 - subfunction number
  4759.   * ecx = socket number
  4760.   * edx = pointer to sockaddr structure
  4761.   * esi = length of sockaddr structure
  4762. Format of SockAddr structure:
  4763.   * +0: Word: Family
  4764.   * +2: 14*Byte: Data
  4765. Returned value:
  4766.   * eax = socket number of accepted socket, -1 on error
  4767.   * ebx = errorcode
  4768.  
  4769. ---------------------- Constants for registers: ----------------------
  4770.   eax - SF_NETWORK_SOCKET (75)
  4771.    bl - SSF_ACCEPT (5)
  4772. ======================================================================
  4773. ================== Function 75, Subfunction 6, Send. =================
  4774. ======================================================================
  4775. Parameters:
  4776.   * eax = 75 - function number
  4777.   * bl = 6 - subfunction number
  4778.   * ecx = socket number
  4779.   * edx = pointer to buffer
  4780.   * esi = length of buffer
  4781.   * edi = flags
  4782. Returned value:
  4783.   * eax = number of bytes copied, -1 on error
  4784.   * ebx = errorcode
  4785.  
  4786. ---------------------- Constants for registers: ----------------------
  4787.   eax - SF_NETWORK_SOCKET (75)
  4788.    bl - SSF_SEND (6)
  4789. ======================================================================
  4790. ================ Function 75, Subfunction 7, Receive. ================
  4791. ======================================================================
  4792. Parameters:
  4793.   * eax = 75 - function number
  4794.   * bl = 7 - subfunction number
  4795.   * ecx = socket number
  4796.   * edx = pointer to buffer
  4797.   * esi = length of buffer
  4798.   * edi = flags
  4799. Returned value:
  4800.   * eax = number of bytes copied, -1 on error
  4801.   * ebx = errorcode
  4802.  
  4803. ---------------------- Constants for registers: ----------------------
  4804.   eax - SF_NETWORK_SOCKET (75)
  4805.    bl - SSF_RECEIVE (7)
  4806. ======================================================================
  4807. =========== Function 75, Subfunction 8, Set socket options. ==========
  4808. ======================================================================
  4809. Parameters:
  4810.   * eax = 75 - function number
  4811.   * bl = 8 - subfunction number
  4812.   * ecx = socket number
  4813.   * edx = pointer to optstruct
  4814. Returned value:
  4815.   * eax = -1 on error
  4816.   * ebx = errorcode
  4817. Remarks:
  4818.  
  4819.   Optstruct:
  4820.     dd level
  4821.     dd optionname
  4822.     dd optlength
  4823.     db options...
  4824.  
  4825. ---------------------- Constants for registers: ----------------------
  4826.   eax - SF_NETWORK_SOCKET (75)
  4827.    bl - SSF_SET_OPTIONS (8)
  4828. ======================================================================
  4829. =========== Function 75, Subfunction 9, Get socket options. ==========
  4830. ======================================================================
  4831. Parameters:
  4832.   * eax = 75 - function number
  4833.   * bl = 9 - subfunction number
  4834.   * ecx = socket number
  4835.   * edx = pointer to optstruct
  4836. Returned value:
  4837.   * eax = -1 on error
  4838.   * ebx = errorcode
  4839. Remarks:
  4840.  
  4841.   Optstruct:
  4842.     dd level
  4843.     dd optionname
  4844.     dd optlength
  4845.     db options...
  4846.  
  4847. ---------------------- Constants for registers: ----------------------
  4848.   eax - SF_NETWORK_SOCKET (75)
  4849.    bl - SSF_GET_OPTIONS (9)
  4850. ======================================================================
  4851. ============ Function 75, Subfunction 10, Get socketpair. ============
  4852. ======================================================================
  4853. Parameters:
  4854.   * eax = 75 - function number
  4855.   * bl = 10 - subfunction number
  4856. Returned value:
  4857.   * eax = socketnum1, -1 on error
  4858.   * ebx = socketnum2, errorcode on error
  4859.  
  4860. ---------------------- Constants for registers: ----------------------
  4861.   eax - SF_NETWORK_SOCKET (75)
  4862.    bl - SSF_GET_PAIR (10)
  4863. ======================================================================
  4864. ============ Function 76, Network options and statistics. ============
  4865. ======================================================================
  4866. Parameters:
  4867.   * eax = 76 - function number
  4868.   * high half of ebx = protocol number
  4869.   * bh = device number
  4870.   * bl = subfunction number
  4871.  
  4872. ======================================================================
  4873. ==== Function 76, Protocol 0 - Ethernet, Subfunction 0, Read MAC. ====
  4874. ======================================================================
  4875. Parameters:
  4876.   * eax = 76 - function number
  4877.   * high half of ebx = 0 (Ethernet)
  4878.   * bh = device number
  4879.   * bl = 0 (Read MAC)
  4880. Returned value:
  4881.   * eax = -1 on error, otherwise lower bits of MAC
  4882.   * bx = upper bits of MAC
  4883.  
  4884. ======================================================================
  4885. = Function 76, Protocol 1 - IPv4, Subfunction 0, Read # Packets sent =
  4886. ======================================================================
  4887. Parameters:
  4888.   * eax = 76 - function number
  4889.   * high half of ebx = 1 (IPv4)
  4890.   * bh = device number
  4891.   * bl = 0 (Read # packets sent)
  4892. Returned value:
  4893.   * eax = number of packets sent (-1 on error)
  4894.  
  4895. ======================================================================
  4896. = Function 76, Protocol 1 - IPv4, Subfunction 1, Read # Packets rcvd =
  4897. ======================================================================
  4898. Parameters:
  4899.   * eax = 76 - function number
  4900.   * high half of ebx = 1 (IPv4)
  4901.   * bh = device number
  4902.   * bl = 1 (Read # packets received)
  4903. Returned value:
  4904.   * eax = number of packets received (-1 on error)
  4905.  
  4906. ======================================================================
  4907. === Function 76, Protocol 1 - IPv4, Subfunction 2, Read IP address ===
  4908. ======================================================================
  4909. Parameters:
  4910.   * eax = 76 - function number
  4911.   * high half of ebx = 1 (IPv4)
  4912.   * bh = device number
  4913.   * bl = 2 (Read IP address)
  4914. Returned value:
  4915.   * eax = IP address (-1 on error)
  4916.  
  4917. ======================================================================
  4918. === Function 76, Protocol 1 - IPv4, Subfunction 3, Set IP address ====
  4919. ======================================================================
  4920. Parameters:
  4921.   * eax = 76 - function number
  4922.   * high half of ebx = 1 (IPv4)
  4923.   * bh = device number
  4924.   * bl = 3 (Set IP address)
  4925.   * ecx = IP address
  4926. Returned value:
  4927.   * eax = -1 on error
  4928.  
  4929. ======================================================================
  4930. == Function 76, Protocol 1 - IPv4, Subfunction 4, Read DNS address ===
  4931. ======================================================================
  4932. Parameters:
  4933.   * eax = 76 - function number
  4934.   * high half of ebx = 1 (IPv4)
  4935.   * bh = device number
  4936.   * bl = 4 (Read DNS server IP address)
  4937. Returned value:
  4938.   * eax = DNS server IP address (-1 on error)
  4939.  
  4940. ======================================================================
  4941. === Function 76, Protocol 1 - IPv4, Subfunction 5, Set DNS address ===
  4942. ======================================================================
  4943. Parameters:
  4944.   * eax = 76 - function number
  4945.   * high half of ebx = 1 (IPv4)
  4946.   * bh = device number
  4947.   * bl = 5 (Set DNS address)
  4948.   * ecx = DNS server IP address
  4949. Returned value:
  4950.   * eax = -1 on error
  4951.  
  4952. ======================================================================
  4953. == Function 76, Protocol 1 - IPv4, Subfunction 6, Read subnet mask ===
  4954. ======================================================================
  4955. Parameters:
  4956.   * eax = 76 - function number
  4957.   * high half of ebx = 1 (IPv4)
  4958.   * bh = device number
  4959.   * bl = 6 (Read subnet mask)
  4960. Returned value:
  4961.   * eax = subnet mask (-1 on error)
  4962.  
  4963. ======================================================================
  4964. === Function 76, Protocol 1 - IPv4, Subfunction 7, Set subnet mask ===
  4965. ======================================================================
  4966. Parameters:
  4967.   * eax = 76 - function number
  4968.   * high half of ebx = 1 (IPv4)
  4969.   * bh = device number
  4970.   * bl = 7 (Set subnet mask)
  4971.   * ecx = subnet mask
  4972. Returned value:
  4973.   * eax = -1 on error
  4974.  
  4975. ======================================================================
  4976. ===== Function 76, Protocol 1 - IPv4, Subfunction 8, Read gateway ====
  4977. ======================================================================
  4978. Parameters:
  4979.   * eax = 76 - function number
  4980.   * high half of ebx = 1 (IPv4)
  4981.   * bh = device number
  4982.   * bl = 8 (Read gateway IP address)
  4983. Returned value:
  4984.   * eax = gateway IP address (-1 on error)
  4985.  
  4986. ======================================================================
  4987. ===== Function 76, Protocol 1 - IPv4, Subfunction 9, Set gateway =====
  4988. ======================================================================
  4989. Parameters:
  4990.   * eax = 76 - function number
  4991.   * high half of ebx = 1 (IPv4)
  4992.   * bh = device number
  4993.   * bl = 9 (Set getway address)
  4994.   * ecx = gateway IP address
  4995. Returned value:
  4996.   * eax = -1 on error
  4997.  
  4998. ======================================================================
  4999. = Function 76, Protocol 2 - ICMP, Subfunction 0, Read # Packets sent =
  5000. ======================================================================
  5001. Parameters:
  5002.   * eax = 76 - function number
  5003.   * high half of ebx = 2 (ICMP)
  5004.   * bh = device number
  5005.   * bl = 0 (Read # packets sent)
  5006. Returned value:
  5007.   * eax = number of packets sent (-1 on error)
  5008.  
  5009. ======================================================================
  5010. = Function 76, Protocol 2 - ICMP, Subfunction 1, Read # Packets rcvd =
  5011. ======================================================================
  5012. Parameters:
  5013.   * eax = 76 - function number
  5014.   * high half of ebx = 2 (ICMP)
  5015.   * bh = device number
  5016.   * bl = 1 (Read # packets received)
  5017. Returned value:
  5018.   * eax = number of packets received (-1 on error)
  5019.  
  5020. ======================================================================
  5021. = Function 76, Protocol 3 - UDP, Subfunction 0, Read # Packets sent ==
  5022. ======================================================================
  5023. Parameters:
  5024.   * eax = 76 - function number
  5025.   * high half of ebx = 3 (UDP)
  5026.   * bh = device number
  5027.   * bl = 0 (Read # packets sent)
  5028. Returned value:
  5029.   * eax = number of packets sent (-1 on error)
  5030.  
  5031. ======================================================================
  5032. = Function 76, Protocol 3 - UDP, Subfunction 1, Read # Packets rcvd ==
  5033. ======================================================================
  5034. Parameters:
  5035.   * eax = 76 - function number
  5036.   * high half of ebx = 3 (UDP)
  5037.   * bh = device number
  5038.   * bl = 1 (Read # packets received)
  5039. Returned value:
  5040.   * eax = number of packets received (-1 on error)
  5041.  
  5042. ======================================================================
  5043. = Function 76, Protocol 4 - TCP, Subfunction 0, Read # Packets sent ==
  5044. ======================================================================
  5045. Parameters:
  5046.   * eax = 76 - function number
  5047.   * high half of ebx = 4 (TCP)
  5048.   * bh = device number
  5049.   * bl = 0 (Read # packets sent)
  5050. Returned value:
  5051.   * eax = number of packets sent (-1 on error)
  5052.  
  5053. ======================================================================
  5054. = Function 76, Protocol 4 - TCP, Subfunction 1, Read # Packets rcvd ==
  5055. ======================================================================
  5056. Parameters:
  5057.   * eax = 76 - function number
  5058.   * high half of ebx = 4 (TCP)
  5059.   * bh = device number
  5060.   * bl = 1 (Read # packets received)
  5061. Returned value:
  5062.   * eax = number of packets received (-1 on error)
  5063.  
  5064. ======================================================================
  5065. = Function 76, Protocol 5 - ARP, Subfunction 0, Read # Packets sent ==
  5066. ======================================================================
  5067. Parameters:
  5068.   * eax = 76 - function number
  5069.   * high half of ebx = 5 (ARP)
  5070.   * bh = device number
  5071.   * bl = 0 (Read # packets sent)
  5072. Returned value:
  5073.   * eax = number of packets sent (-1 on error)
  5074.  
  5075. ======================================================================
  5076. = Function 76, Protocol 5 - ARP, Subfunction 1, Read # Packets rcvd ==
  5077. ======================================================================
  5078. Parameters:
  5079.   * eax = 76 - function number
  5080.   * high half of ebx = 5 (ARP)
  5081.   * bh = device number
  5082.   * bl = 1 (Read # packets received)
  5083. Returned value:
  5084.   * eax = number of packets received (-1 on error)
  5085.  
  5086. ======================================================================
  5087. == Function 76, Protocol 5 - ARP, Subfunction 2, Read # ARP entries ==
  5088. ======================================================================
  5089. Parameters:
  5090.   * eax = 76 - function number
  5091.   * high half of ebx = 5 (ARP)
  5092.   * bh = device number
  5093.   * bl = 2 (Read # current entries in the ARP table)
  5094. Returned value:
  5095.   * eax = number of entries (-1 on error)
  5096.  
  5097. ======================================================================
  5098. ==== Function 76, Protocol 5 - ARP, Subfunction 3, Read ARP entry ====
  5099. ======================================================================
  5100. Parameters:
  5101.   * eax = 76 - function number
  5102.   * high half of ebx = 5 (ARP)
  5103.   * bh = device number
  5104.   * bl = 3 (Read ARP entry)
  5105.   * ecx = ARP entry number (0 based)
  5106.   * edi = ptr to buffer where ARP entry will be written
  5107. Returned value:
  5108.   * eax = -1 on error
  5109. Remarks:
  5110.   * ARP_entry struct is defined in ARP.inc in kernel and currently
  5111.     looks like this:
  5112. struct  ARP_entry
  5113.         IP              dd ?
  5114.         MAC             dp ?
  5115.         Status          dw ?
  5116.         TTL             dw ?
  5117. ends
  5118.  
  5119. ======================================================================
  5120. ===== Function 76, Protocol 5 - ARP, Subfunction 4, Add ARP entry ====
  5121. ======================================================================
  5122. Parameters:
  5123.   * eax = 76 - function number
  5124.   * high half of ebx = 5 (ARP)
  5125.   * bh = device number
  5126.   * bl = 4 (Add ARP entry)
  5127.   * esi = ptr to buffer holding ARP entry
  5128. Returned value:
  5129.   * eax = -1 on error
  5130. Remarks:
  5131.   * See previous function for details on ARP entry.
  5132.  
  5133. ======================================================================
  5134. === Function 76, Protocol 5 - ARP, Subfunction 5, Remove ARP entry ===
  5135. ======================================================================
  5136. Parameters:
  5137.   * eax = 76 - function number
  5138.   * high half of ebx = 5 (ARP)
  5139.   * bh = device number
  5140.   * bl = 5 (Remove ARP entry)
  5141.   * ecx = ARP entry number (0 based), use -1 to clear whole ARP table.
  5142. Returned value:
  5143.   * eax = -1 on error
  5144.  
  5145. ======================================================================
  5146. === Function 76, Protocol 5 - ARP, Subfunction 6, Send ARP announce ==
  5147. ======================================================================
  5148. Parameters:
  5149.   * eax = 76 - function number
  5150.   * high half of ebx = 5 (ARP)
  5151.   * bh = device number
  5152.   * bl = 6 (Send ARP announce)
  5153. Returned value:
  5154.   * eax = -1 on error
  5155.  
  5156. ======================================================================
  5157. === Function 76, Protocol 5 - ARP, Subfunction 7, Read # conflicts ===
  5158. ======================================================================
  5159. Parameters:
  5160.   * eax = 76 - function number
  5161.   * high half of ebx = 5 (ARP)
  5162.   * bh = device number
  5163.   * bl = 7 (Read # IP address conflicts that have occured)
  5164. Returned value:
  5165.   * eax = # IP address conflicts (-1 on error)
  5166.  
  5167. ---------------------- Constants for registers: ----------------------
  5168.   eax - SF_NETWORK_PROTOCOL (76)
  5169. ======================================================================
  5170. ========== Function 77, Subfunction 0, Create futex object ===========
  5171. ======================================================================
  5172. Parameters:
  5173.   * eax = 77 - function number
  5174.   * ebx = 0 - subfunction number
  5175.   * ecx = pointer to futex dword
  5176. Returned value:
  5177.   * eax = futex handle, 0 on error
  5178. Remarks:
  5179.   * Use subfunction 1 to destroy the futex.
  5180.     The kernel destroys the futexes automatically when the process
  5181.     terminates.
  5182.  
  5183. ---------------------- Constants for registers: ----------------------
  5184.   eax - SF_FUTEX (77)
  5185.   ebx - SSF_CREATE (0)
  5186. ======================================================================
  5187. ========= Function 77, Subfunction 1, Destroy futex object ===========
  5188. ======================================================================
  5189. Parameters:
  5190.   * eax = 77 - function number
  5191.   * ebx = 1 - subfunction number
  5192.   * ecx = futex handle
  5193. Returned value:
  5194.   * eax = 0 - successfull, -1 on error
  5195. Remarks:
  5196.   * The futex handle must have been created by subfunction 0
  5197.  
  5198. ---------------------- Constants for registers: ----------------------
  5199.   eax - SF_FUTEX (77)
  5200.   ebx - SSF_DESTROY (1)
  5201. ======================================================================
  5202. =============== Function 77, Subfunction 2, Futex wait ===============
  5203. ======================================================================
  5204. Parameters:
  5205.   * eax = 77 - function number
  5206.   * ebx = 2 - subfunction number
  5207.   * ecx = futex handle
  5208.   * edx = control value
  5209.   * esi = timeout in system ticks or 0 for infinity
  5210. Returned value:
  5211.   * eax = 0 - successfull
  5212.          -1 - timeout
  5213.          -2 - futex dword does not have the same value as edx
  5214. Remarks:
  5215.   * This functionn tests that the value at the futex dword still
  5216.     contains the expected control value, and if so, then sleeps
  5217.     waiting for a wake operation on the futex.
  5218.   * The futex handle must have been created by subfunction 0
  5219.  
  5220. ---------------------- Constants for registers: ----------------------
  5221.   eax - SF_FUTEX (77)
  5222.   ebx - SSF_WAIT (2)
  5223. ======================================================================
  5224. =============== Function 77, Subfunction 3, Futex wake ===============
  5225. ======================================================================
  5226. Parameters:
  5227.   * eax = 77 - function number
  5228.   * ebx = 3 - subfunction number
  5229.   * ecx = futex handle
  5230.   * edx = number of waiters to wake
  5231. Returned value:
  5232.   * eax = number of waiters that were woken up
  5233.  
  5234. Remarks:
  5235.   * This function wakes at most edx of the waiters that are
  5236.     waiting (e.g., inside futex wait) on the futex dword
  5237.   * The futex handle must have been created by subfunction 0
  5238.  
  5239. ---------------------- Constants for registers: ----------------------
  5240.   eax - SF_FUTEX (77)
  5241.   ebx - SSF_WAKE (3)
  5242. ======================================================================
  5243. === Function 80 - file system interface with parameter of encoding ===
  5244. ======================================================================
  5245. Parameters:
  5246.   * eax = 80
  5247.   * ebx = pointer to the information structure
  5248. Returned value:
  5249.   * eax = 0 - success; otherwise file system error code
  5250.   * some subfunctions return value in other registers too
  5251. General format of the information structure:
  5252.   * +0: dword: subfunction number
  5253.   * +4: dword: offset in file or folder
  5254.   * +8: dword: higher part of offset or flags
  5255.   * +12 = +0xC: dword: size of data
  5256.   * +16 = +0x10: dword: pointer to data
  5257.   * +20 = +0x14: dword: string encoding:
  5258.     1 = cp866
  5259.     2 = UTF-16LE
  5260.     3 = UTF-8
  5261.     0 = default (supports encoding byte at the start of the string)
  5262.   * +24 = +0x18: dword: pointer to zero terminated string with path
  5263.  
  5264. The rest is similar to sysfunction 70.
  5265.  
  5266. ======================================================================
  5267. =============== Function -1 - terminate thread/process ===============
  5268. ======================================================================
  5269. Parameters:
  5270.   * eax = -1 - function number
  5271. Returned value:
  5272.   * function does not return neither value nor control
  5273. Remarks:
  5274.   * If the process did not create threads obviously, it has only
  5275.     one thread, which termination results in process termination.
  5276.   * If the current thread is last in the process, its termination
  5277.     also results in process terminates.
  5278.   * This function terminates the current thread. Other thread can be
  5279.     killed by call to subfunction 2 of function 18.
  5280.  
  5281. ---------------------- Constants for registers: ----------------------
  5282.   eax - SF_TERMINATE_PROCESS (-1)
  5283. ======================================================================
  5284. =========================== List of events ===========================
  5285. ======================================================================
  5286. Next event can be retrieved by the call of one from functions 10
  5287. (to wait for event), 11 (to check without waiting), 23
  5288. (to wait during the given time).
  5289. These functions return only those events, which enter into a mask set
  5290. by function 40. By default it is first three,
  5291. there is enough for most applications.
  5292. Codes of events:
  5293.   * 1 = redraw event (is reset by call to function 0)
  5294.   * 2 = key on keyboard is pressed (acts, only when the window is
  5295.     active) or hotkey is pressed; is reset, when all keys from
  5296.     the buffer are read out by function 2
  5297.   * 3 = button is pressed, defined earlier by function 8
  5298.     (or close button, created implicitly by function 0;
  5299.     minimize button is handled by the system and sends no message;
  5300.     acts, only when the window is active;
  5301.     is reset when all buttons from the buffer
  5302.     are read out by function 17)
  5303.   * 4 = reserved (in current implementation never comes even after
  5304.     unmasking by function 40)
  5305.   * 5 = kernel finished redrawing of the desktop background
  5306.   * 6 = mouse event (something happened - button pressing or moving;
  5307.     is reset at reading)
  5308.   * 7 = IPC event (see function 60 -
  5309.     Inter Process Communication; is reset at reading)
  5310.   * 8 = network event (is reset at reading)
  5311.   * 9 = debug event (is reset at reading; see
  5312.     debug subsystem)
  5313.   * 16..31 = event with appropriate IRQ
  5314.     (16=IRQ0, 31=IRQ15) (is reset after reading all IRQ data)
  5315.  
  5316. ======================================================================
  5317. =================== Error codes of the file system ===================
  5318. ======================================================================
  5319.   * 0 = success
  5320.   * 2 = function is not supported for the given file system
  5321.   * 3 = unknown file system
  5322.   * 5 = file not found
  5323.   * 6 = end of file, EOF
  5324.   * 7 = pointer lies outside of application memory
  5325.   * 8 = disk is full
  5326.   * 9 = file system error
  5327.   * 10 = access denied
  5328.   * 11 = device error
  5329.   * 12 = file system requires more memory
  5330.  
  5331. Application start functions can return also following errors:
  5332.   * 30 = 0x1E = not enough memory
  5333.   * 31 = 0x1F = file is not executable
  5334.   * 32 = 0x20 = too many processes
  5335.