Subversion Repositories Kolibri OS

Rev

Rev 9796 | Rev 9964 | 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 (en, fi, etc) 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.   * edx = language id: 1=en, 2=fi, 3=ge, 4=ru, 5=fr, 6=et, 7=ua, 8=it,
  1333.                        9=be, 10=sp, 11=ca
  1334. Returned value:
  1335.   * eax = 0 - success
  1336.   * eax = -1 - incorrect parameter
  1337. Remarks:
  1338.   * If Alt is pressed, the layout with Alt is used;
  1339.     if Alt is not pressed, but Shift is pressed,
  1340.     the layout with Shift is used;
  1341.     if Alt and Shift are not pressed, but Ctrl is pressed, the normal
  1342.     layout is used and then from the code is subtracted 0x60;
  1343.     if no control key is pressed, the normal layout is used.
  1344.   * To get layout and country identifier use
  1345.     subfunction 2 of function 26.
  1346.   * Country identifier is global system variable, which is not used
  1347.     by the kernel itself; however the application '@taskbar' displays
  1348.     the corresponding icon.
  1349.   * The application @taskbar switches layouts on user request.
  1350.  
  1351. ---------------------- Constants for registers: ----------------------
  1352.   eax - SF_SYSTEM_SET (21)
  1353.   ebx - SSF_KEYBOARD_LAYOUT (2)
  1354. ======================================================================
  1355. ========== Function 21, subfunction 5 - set system language. =========
  1356. ======================================================================
  1357. Parameters:
  1358.   * eax = 21 - function number
  1359.   * ebx = 5 - subfunction number
  1360.   * ecx = language id: 1=en, 2=fi, 3=ge, 4=ru, 5=fr, 6=et, 7=ua, 8=it,
  1361.                        9=be, 10=sp, 11=ca
  1362. Returned value:
  1363.   * eax = 0
  1364. Remarks:
  1365.   * System language is global system variable and is not used
  1366.     by the kernel itself, however application @taskbar draws the
  1367.     appropriate icon.
  1368.   * Function does not check for correctness, as the kernel does not
  1369.     use this variable.
  1370.   * To get system language use subfunction 5 of function 26.
  1371.  
  1372. ---------------------- Constants for registers: ----------------------
  1373.   eax - SF_SYSTEM_SET (21)
  1374.   ebx - SSF_SYS_LANG (5)
  1375. ======================================================================
  1376.  Function 21, subfunction 11 - enable/disable low-level access to HD.
  1377. ======================================================================
  1378. Parameters:
  1379.   * eax = 21 - function number
  1380.   * ebx = 11 - subfunction number
  1381.   * ecx = 0/1 - disable/enable
  1382. Returned value:
  1383.   * eax = 0
  1384. Remarks:
  1385.   * Is used in LBA-read (subfunction 8 of function 58).
  1386.   * The current implementation uses only low bit of ecx.
  1387.   * To get current status use subfunction 11 of function 26.
  1388.  
  1389. ---------------------- Constants for registers: ----------------------
  1390.   eax - SF_SYSTEM_SET (21)
  1391.   ebx - SSF_ACCESS_HD_LBA (11)
  1392. ======================================================================
  1393.  Function 21, subfunction 12 - enable/disable low-level access to PCI.
  1394. ======================================================================
  1395. Parameters:
  1396.   * eax = 21 - function number
  1397.   * ebx = 12 - subfunction number
  1398.   * ecx = 0/1 - disable/enable
  1399. Returned value:
  1400.   * eax = 0
  1401. Remarks:
  1402.   * Is used in operations with PCI bus (function 62).
  1403.   * The current implementation uses only low bit of ecx.
  1404.   * To get current status use subfunction 12 of function 26.
  1405.  
  1406. ---------------------- Constants for registers: ----------------------
  1407.   eax - SF_SYSTEM_SET (21)
  1408.   ebx - SSF_ACCESS_PCI (12)
  1409. ======================================================================
  1410. ================= Function 22 - set system date/time. ================
  1411. ======================================================================
  1412. Parameters:
  1413.   * eax = 22 - function number
  1414.   * ebx = 0 - set time
  1415.     * ecx = 0x00SSMMHH - time in the binary-decimal code (BCD):
  1416.     * HH=hour 00..23
  1417.     * MM=minute 00..59
  1418.     * SS=second 00..59
  1419.   * ebx = 1 - set date
  1420.     * ecx = 0x00DDMMYY - date in the binary-decimal code (BCD):
  1421.     * DD=day 01..31
  1422.     * MM=month 01..12
  1423.     * YY=year 00..99
  1424.   * ebx = 2 - set day of week
  1425.     * ecx = 1 for Sunday, ..., 7 for Saturday
  1426.   * ebx = 3 - set alarm clock
  1427.     * ecx = 0x00SSMMHH
  1428. Returned value:
  1429.   * eax = 0 - success
  1430.   * eax = 1 - incorrect parameter
  1431.   * eax = 2 - CMOS-battery was unloaded
  1432. Remarks:
  1433.   * Value of installation of day of week seems to be doubtful,
  1434.     as it a little where is used
  1435.     (day of week can be calculated by date).
  1436.   * Alarm clock can be set on operation in the given time every day.
  1437.     But there is no existing system function to disable it.
  1438.   * Operation of alarm clock consists in generation IRQ8.
  1439.   * Generally CMOS supports for alarm clock set of value 0xFF
  1440.     as one of parameters and it means that the appropriate parameter
  1441.     is ignored. But current implementation does not allow this
  1442.     (will return 1).
  1443.   * Alarm clock is a global system resource; the set of
  1444.     an alarm clock cancels automatically the previous set.
  1445.     However, at moment no program uses it.
  1446.  
  1447. ---------------------- Constants for registers: ----------------------
  1448.   eax - SF_SET_TIME_DATE (22)
  1449. ======================================================================
  1450. ============= Function 23 - wait for event with timeout. =============
  1451. ======================================================================
  1452. If the message queue is empty, waits for new message in the queue,
  1453. but no more than given time. Then reads out a message from the queue.
  1454.  
  1455. Parameters:
  1456.   * eax = 23 - function number
  1457.   * ebx = timeout (in 1/100 of second)
  1458. Returned value:
  1459.   * eax = 0 - the message queue is empty
  1460.   * otherwise eax = event (see the list of events)
  1461. Remarks:
  1462.   * Only those events are taken into account, which enter into
  1463.     the mask set by function 40. By default it is
  1464.     redraw, key and button events.
  1465.   * To check for presence of a message in the queue use function 11.
  1466.     To wait without timeout use function 10.
  1467.   * Transmission ebx=0 results in immediate returning eax=0.
  1468.   * Current implementation returns immediately with eax=0,
  1469.     if the addition of ebx with the current value of time counter
  1470.     makes 32-bit overflow.
  1471.  
  1472. ---------------------- Constants for registers: ----------------------
  1473.   eax - SF_WAIT_EVENT_TIMEOUT (23)
  1474. ======================================================================
  1475. ======= Function 24, subfunction 4 - eject tray of disk drive. =======
  1476. ======================================================================
  1477. Parameters:
  1478.   * eax = 24 - function number
  1479.   * ebx = 4 - subfunction number
  1480.   * ecx = position of CD/DVD-drive
  1481.     from 0=Primary Master to 3=Secondary Slave for first IDE contr.
  1482.     from 4=Primary Master to 7=Secondary Slave for second IDE contr.
  1483.     from 8=Primary Master to 11=Secondary Slave for third IDE contr.
  1484. Returned value:
  1485.   * function does not return value
  1486. Remarks:
  1487.   * The function is supported only for ATAPI devices (CD and DVD).
  1488.   * When the tray is being ejected,
  1489.     manual control of tray is unlocked.
  1490.   * When the tray is being ejected, the code clears the cache for
  1491.     corresponding device.
  1492.   * An example of usage of the function is the application CD_tray.
  1493.  
  1494. ---------------------- Constants for registers: ----------------------
  1495.   eax - SF_CD (24)
  1496.   ebx - SSF_EJECT_TRAY (4), SSF_INSERT_TRAY (5)
  1497. ======================================================================
  1498. ======== Function 24, subfunction 5 - load tray of disk drive. =======
  1499. ======================================================================
  1500. Parameters:
  1501.   * eax = 24 - function number
  1502.   * ebx = 5 - subfunction number
  1503.   * ecx = position of CD/DVD-drive
  1504.     from 0=Primary Master to 3=Secondary Slave for first IDE contr.
  1505.     from 4=Primary Master to 7=Secondary Slave for second IDE contr.
  1506.     from 8=Primary Master to 11=Secondary Slave for third IDE contr.
  1507. Returned value:
  1508.   * function does not return value
  1509. Remarks:
  1510.   * The function is supported only for ATAPI devices (CD and DVD).
  1511.   * An example of usage of the function is the application CD_tray.
  1512.  
  1513. ---------------------- Constants for registers: ----------------------
  1514.   eax - SF_CD (24)
  1515.   ebx - SSF_EJECT_TRAY (4), SSF_INSERT_TRAY (5)
  1516. ======================================================================
  1517. ======= Function 25 - put image area on the background layer. ========
  1518. ======================================================================
  1519. Parameters:
  1520.   * eax = 25 - function number
  1521.   * ebx = pointer to the previously allocated memory area,
  1522.         where placed the source images in a format BBGGRRTTBBGGRRTT...
  1523.   * ecx = [size on axis x]*65536 + [size on axis y]
  1524.   * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
  1525. Returned value:
  1526.   * function does not return value
  1527. Remarks:
  1528.   * Coordinates of the image are coordinates of the upper left corner
  1529.     of the image relative to the screen.
  1530.   * Size of the image in bytes is 4*xsize*ysize
  1531.   * TT - byte pointer of transparency, at current version:
  1532.          1 to FF - opaque, 0 - transparent.
  1533.   * The function places the image directly to LFB. It is not for
  1534.     background image f.15. Options f.15 to f.25 does not make sense.
  1535.  
  1536. ---------------------- Constants for registers: ----------------------
  1537.   eax - SF_SCREEN_PUT_IMAGE (25)
  1538. ======================================================================
  1539. ======== Function 26, subfunction 1 - get MPU MIDI base port. ========
  1540. ======================================================================
  1541. Parameters:
  1542.   * eax = 26 - function number
  1543.   * ebx = 1 - subfunction number
  1544. Returned value:
  1545.   * eax = port number
  1546. Parameters:
  1547.   * To set base port use subfunction 1 of function 21.
  1548.  
  1549. ---------------------- Constants for registers: ----------------------
  1550.   eax - SF_SYSTEM_GET (26)
  1551.   ebx - SSF_MPU_MIDI_BASE (1)
  1552. ======================================================================
  1553. ========== Function 26, subfunction 2 - get keyboard layout. =========
  1554. ======================================================================
  1555. The keyboard layout is used to convert keyboard scancodes to
  1556. ASCII-codes for function 2.
  1557. Parameters:
  1558.   * eax = 26 - function number
  1559.   * ebx = 2 - subfunction number
  1560.   * ecx = what layout to get:
  1561.     * 1 = normal layout
  1562.     * 2 = layout with pressed Shift
  1563.     * 3 = layout with pressed Alt
  1564.   * edx = pointer to the 128-bytes buffer, where the layout will be
  1565.     copied
  1566. Returned value:
  1567.   * function does not return value
  1568.     but if pointer in edx is illegal, for example,
  1569.     [edx, edx + 128) region intersects with kernel memory,
  1570.     then function returns -1
  1571. Or:
  1572.   * eax = 26 - function number
  1573.   * ebx = 2 - subfunction number
  1574.   * ecx = 9
  1575. Returned value:
  1576.   * eax = language id: 1=en, 2=fi, 3=ge, 4=ru, 5=fr, 6=et, 7=ua, 8=it,
  1577.                        9=be, 10=sp, 11=ca
  1578. Remarks:
  1579.   * If Alt is pressed, the layout with Alt is used;
  1580.     if Alt is not pressed, but Shift is pressed,
  1581.     the layout with Shift is used;
  1582.     if Alt and Shift are not pressed, but Ctrl is pressed, the normal
  1583.     layout is used and then from the code is subtracted 0x60;
  1584.     if no control key is pressed, the normal layout is used.
  1585.   * To set layout and country identifier use
  1586.     subfunction 2 of function 21.
  1587.   * Country identifier is global system variable, which is not used
  1588.     by the kernel itself; however the application '@taskbar' displays
  1589.     the corresponding icon (using this function).
  1590.   * The application @taskbar switches layouts on user request.
  1591.  
  1592. ---------------------- Constants for registers: ----------------------
  1593.   eax - SF_SYSTEM_GET (26)
  1594.   ebx - SSF_KEYBOARD_LAYOUT (2)
  1595. ======================================================================
  1596. ========== Function 26, subfunction 5 - get system language. =========
  1597. ======================================================================
  1598. Parameters:
  1599.   * eax = 26 - function number
  1600.   * ebx = 5 - subfunction number
  1601. Returned value:
  1602.   * eax = language id: 1=en, 2=fi, 3=ge, 4=ru, 5=fr, 6=et, 7=ua, 8=it,
  1603.                        9=be, 10=sp, 11=ca
  1604. Remarks:
  1605.   * System language is global system variable and is not used
  1606.     by the kernel itself, however application @taskbar draws the
  1607.     appropriate icon (using this function).
  1608.   * To set system language use subfunction 5 of function 21.
  1609.  
  1610. ---------------------- Constants for registers: ----------------------
  1611.   eax - SF_SYSTEM_GET (26)
  1612.   ebx - SSF_SYS_LANG (5)
  1613. ======================================================================
  1614. === Function 26, subfunction 9 - get the value of the time counter. ==
  1615. ======================================================================
  1616. Parameters:
  1617.   * eax = 26 - function number
  1618.   * ebx = 9 - subfunction number
  1619. Returned value:
  1620.   * eax = number of 1/100s of second, past from the system boot time
  1621. Remarks:
  1622.   * Counter takes modulo 2^32, that correspond to a little more
  1623.     than 497 days.
  1624.   * To get system time use function 3.
  1625.  
  1626. ---------------------- Constants for registers: ----------------------
  1627.   eax - SF_SYSTEM_GET (26)
  1628.   ebx - SSF_TIME_COUNT (9)
  1629. ======================================================================
  1630. ===================== Function 26, subfunction 10 ====================
  1631. ========== Get the value of the high precision time counter. =========
  1632. ======================================================================
  1633. Parameters:
  1634.   * eax = 26 - function number
  1635.   * ebx = 10 - subfunction number
  1636. Returned value:
  1637.   * eax = number of nanoseconds since system boot time (lower DWORD)
  1638.   * edx = number of nanoseconds since system boot time (high DWORD)
  1639. Remarks:
  1640.   * The counter is based on HPET, if HPET is not available, resolution
  1641.     will be reduced to 10 000 000 nanoseconds.
  1642.  
  1643. ---------------------- Constants for registers: ----------------------
  1644.   eax - SF_SYSTEM_GET (26)
  1645.   ebx - SSF_TIME_COUNT_PRO (10)
  1646. ======================================================================
  1647. ===================== Function 26, subfunction 11 ====================
  1648. ========== Find out whether low-level HD access is enabled. ==========
  1649. ======================================================================
  1650. Parameters:
  1651.   * eax = 26 - function number
  1652.   * ebx = 11 - subfunction number
  1653. Returned value:
  1654.   * eax = 0/1 - disabled/enabled
  1655. Remarks:
  1656.   * Is used in LBA read (subfunction 8 of function 58).
  1657.   * To set current state use subfunction 11 of function 21.
  1658.  
  1659. ---------------------- Constants for registers: ----------------------
  1660.   eax - SF_SYSTEM_GET (26)
  1661.   ebx - SSF_ACCESS_HD_LBA (11)
  1662. ======================================================================
  1663. ===================== Function 26, subfunction 12 ====================
  1664. ========== Find out whether low-level PCI access is enabled. =========
  1665. ======================================================================
  1666. Parameters:
  1667.   * eax = 26 - function number
  1668.   * ebx = 12 - subfunction number
  1669. Returned value:
  1670.   * eax = 0/1 - disabled/enabled
  1671. Remarks:
  1672.   * Is used by operations with PCI bus (function 62).
  1673.   * The current implementation uses only low bit of ecx.
  1674.   * To set the current state use subfunction 12 of function 21.
  1675.  
  1676. ---------------------- Constants for registers: ----------------------
  1677.   eax - SF_SYSTEM_GET (26)
  1678.   ebx - SSF_ACCESS_PCI (12)
  1679. ======================================================================
  1680. =================== Function 29 - get system date. ===================
  1681. ======================================================================
  1682. Parameters:
  1683.   * eax = 29 - function number
  1684. Returned value:
  1685.   * eax = 0x00DDMMYY, where
  1686.     (binary-decimal coding, BCD, is used)
  1687.   * YY = two low digits of year (00..99)
  1688.   * MM = month (01..12)
  1689.   * DD = day (01..31)
  1690. Remarks:
  1691.   * To set system date use function 22.
  1692.  
  1693. ---------------------- Constants for registers: ----------------------
  1694.   eax - SF_GET_SYS_DATE (29)
  1695. ======================================================================
  1696. ============= Function 30 - work with the current folder. ============
  1697. ======================================================================
  1698. --------- Subfunction 1 - set current folder for the thread. ---------
  1699. Parameters:
  1700.   * eax = 30 - function number
  1701.   * ebx = 1 - subfunction number
  1702.   * ecx = pointer to string with the path to new current folder,
  1703.     rules of path forming can be found in function 70 description.
  1704. Returned value:
  1705.   * function does not return value
  1706. ----------------------------------------------------------------------
  1707. --------- Subfunction 2 - get current folder for the thread. ---------
  1708. Parameters:
  1709.   * eax = 30 - function number
  1710.   * ebx = 2 - subfunction number
  1711.   * ecx = pointer to buffer
  1712.   * edx = size of buffer
  1713. Returned value:
  1714.   * eax = size of the string (including terminating 0)
  1715. Remarks:
  1716.   * If the buffer is too small to hold all path, only part of the string
  1717.     will be copied and terminated with 0.
  1718.   * By default, current folder for the thread is "/sys".
  1719.   * At process/thread creation the current folder will be inherited
  1720.     from the parent.
  1721. ----------------------------------------------------------------------
  1722. --- Subfunction 3 - install the add.system directory for the kernel --
  1723. Parameters:
  1724.   * eax = 30 - function number
  1725.   * ebx = 3 - subfunction number
  1726.   * ecx = pointer to a block of data:
  1727. key     rb  64
  1728. path    rb  64
  1729.     Example:
  1730. align 64
  1731. key     db  'kolibrios',0   ; key must be in lower case
  1732. align 64
  1733. path    db  'HD0/1',0
  1734.  
  1735. Returned value:
  1736.   * function does not return value
  1737. Remarks:
  1738.   * The function can be called only 1 time for 1 session of the OS.
  1739.   * On input the symbolic key is not changing by encoding.
  1740. ----------------------------------------------------------------------
  1741. ---- Subfunction 4 - set current folder, specifying the encoding. ----
  1742. Parameters:
  1743.   * eax = 30 - function number
  1744.   * ebx = 4 - subfunction number
  1745.   * ecx = pointer to string with the path to new current folder
  1746.   * edx = string encoding, details can be found in function 80 description.
  1747. Returned value:
  1748.   * function does not return value
  1749. ----------------------------------------------------------------------
  1750. ---- Subfunction 5 - get current folder, specifying the encoding. ----
  1751. Parameters:
  1752.   * eax = 30 - function number
  1753.   * ebx = 5 - subfunction number
  1754.   * ecx = pointer to buffer
  1755.   * edx = size of buffer
  1756.   * esi = string encoding
  1757. Returned value:
  1758.   * eax = size of the string in bytes (including terminating 0)
  1759. Remarks:
  1760.   * If the buffer is too small to hold all path, only part of the string
  1761.     will be copied and terminated with 0.
  1762.   * By default, current folder for the thread is "/sys".
  1763.   * At process/thread creation the current folder will be inherited
  1764.     from the parent.
  1765.  
  1766. ---------------------- Constants for registers: ----------------------
  1767.   eax - SF_CURRENT_FOLDER (30)
  1768.   ebx - SSF_SET_CF (1), SSF_GET_CF (2), SSF_ADD_SYS_FOLDER (3)
  1769. ======================================================================
  1770. ========= Function 34 - who owner the pixel on the screen. ===========
  1771. ======================================================================
  1772. Parameters:
  1773.   * eax = 34 - function number
  1774.   * ebx = x-coordinate (relative to the display)
  1775.   * ecx = y-coordinate (relative to the display)
  1776.  
  1777. Returned value:
  1778.   * eax = 0x000000XX - owner of pixel the slot window N
  1779.     If incorrect values ebx and ecx then function returns 0
  1780.   * The function takes the value from the area [_WinMapAddress]
  1781.  
  1782. ---------------------- Constants for registers: ----------------------
  1783.   eax - SF_GET_PIXEL_OWNER (34)
  1784. ======================================================================
  1785. ======= Function 35 - read the color of a pixel on the screen. =======
  1786. ======================================================================
  1787. Parameters:
  1788.   * eax = 35
  1789.   * ebx = y*xsize+x, where
  1790.   * (x,y) = coordinates of a pixel (beginning from 0)
  1791.   * xsize = horizontal screen size
  1792. Returned value:
  1793.   * eax = color 0x00RRGGBB
  1794. Remarks:
  1795.   * To get screen sizes use function 14. Pay attention,
  1796.     that it subtracts 1 from both sizes.
  1797.   * There is also direct access (without any system calls)
  1798.     to videomemory through the selector gs. To get parameters of
  1799.     the current videomode, use function 61.
  1800.  
  1801. ---------------------- Constants for registers: ----------------------
  1802.   eax - SF_GET_PIXEL (35)
  1803. ======================================================================
  1804. =================== Function 36 - read screen area. ==================
  1805. ======================================================================
  1806. Paramters:
  1807.   * eax = 36 - function number
  1808.   * ebx = pointer to the previously allocated memory area,
  1809.         where will be placed the image in the format BBGGRRBBGGRR...
  1810.   * ecx = [size on axis x]*65536 + [size on axis y]
  1811.   * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
  1812. Returned value:
  1813.   * function does not return value
  1814. Remarks:
  1815.   * Coordinates of the image are coordinates of the upper left corner
  1816.     of the image relative to the screen.
  1817.   * Size of the image in bytes is 3*xsize*ysize.
  1818.  
  1819. ---------------------- Constants for registers: ----------------------
  1820.   eax - SF_GET_IMAGE (36)
  1821. ======================================================================
  1822. =================== Function 37 - work with mouse. ===================
  1823. ======================================================================
  1824.  
  1825. -------- Subfunction 0 - get screen coordinates of the mouse ---------
  1826. Parameters:
  1827.   * eax = 37 - function number
  1828.   * ebx = 0 - subfunction number
  1829. Returned value:
  1830.   * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
  1831.     (beginning from 0)
  1832.  
  1833. -- Subfunction 1 - coordinates of the mouse relative to the window ---
  1834. Parameters:
  1835.   * eax = 37 - function number
  1836.   * ebx = 1 - subfunction number
  1837. Returned value:
  1838.   * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
  1839.     relative to the application window (beginning from 0)
  1840. Remarks:
  1841.   * The value is calculated by formula (x-xwnd)*65536 + (y-ywnd).
  1842.     If y>=ywnd, the low word is non-negative and contains
  1843.     relative y-coordinate, and the high word - relative x-coordinate
  1844.     (with correct sign). Otherwise the low word is negative and still
  1845.     contains relative y-coordinate, and to the high word
  1846.     1 should be added.
  1847.  
  1848. ----------- Subfunction 2 - get states of the mouse buttons ----------
  1849. Parameters:
  1850.   * eax = 37 - function number
  1851.   * ebx = 2 - subfunction number
  1852. Returned value:
  1853.   * eax = bits 0-4 equal to subfunction 3
  1854.  
  1855. ----- Subfunction 3 - get states and events of the mouse buttons -----
  1856. Parameters:
  1857.   * eax = 37 - function number
  1858.   * ebx = 3 - subfunction number
  1859. Returned value:
  1860.   * eax contains next information:
  1861.  
  1862. states:
  1863.   * bit 0 is set = left button is held
  1864.   * bit 1 is set = right button is held
  1865.   * bit 2 is set = middle button is held
  1866.   * bit 3 is set = 4th button is held
  1867.   * bit 4 is set = 5th button is held
  1868.  
  1869. events:
  1870.   * bit 8 is set = left button is pressed
  1871.   * bit 9 is set = right button is pressed
  1872.   * bit 10 is set = middle button is pressed
  1873.  
  1874.   * bit 15 is set = vertical scroll is used
  1875.  
  1876.   * bit 16 is set = left button is released
  1877.   * bit 17 is set = right button is released
  1878.   * bit 18 is set = middle button is released
  1879.  
  1880.   * bit 23 is set = horizontal scroll is used
  1881.  
  1882.   * bit 24 is set = doubleclick by left button
  1883.  
  1884. -------------------- Subfunction 4 - load cursor ---------------------
  1885. Parameters:
  1886.   * eax = 37 - function number
  1887.   * ebx = 4 - subfunction number
  1888.   * dx = data source:
  1889.   * dx = LOAD_FROM_FILE = 0 - data in a file
  1890.     * ecx = pointer to full path to the cursor file
  1891.     * the file must be in the format .cur, which is standard for
  1892.       MS Windows, at that of the size 32*32 pixels
  1893.   * dx = LOAD_FROM_MEM = 1 - data of file are already loaded in memory
  1894.     * ecx = pointer to data of the cursor file
  1895.     * the data format is the same as in the previous case
  1896.   * dx = LOAD_INDIRECT = 2 - data in memory
  1897.     * ecx = pointer to cursor image in the format ARGB 32*32 pixels
  1898.     * edx = 0xXXYY0002, where
  1899.       * XX = x-coordinate of cursor hotspot
  1900.       * YY = y-coordinate
  1901.       * 0 <= XX, YY <= 31
  1902. Returned value:
  1903.   * eax = 0 - failed
  1904.   * otherwise eax = cursor handle
  1905.  
  1906. --------------------- Subfunction 5 - set cursor ---------------------
  1907. Sets new cursor for the window of the current thread.
  1908. Parameters:
  1909.   * eax = 37 - function number
  1910.   * ebx = 5 - subfunction number
  1911.   * ecx = cursor handle
  1912. Returned value:
  1913.   * eax = handle of previous cursor
  1914. Remarks:
  1915.   * If the handle is incorrect, the function restores the default
  1916.     cursor (standard arrow). In particular, ecx=0 restores it.
  1917.  
  1918. ------------------- Subfunction 6 - delete cursor --------------------
  1919. Parameters:
  1920.   * eax = 37 - function number
  1921.   * ebx = 6 - subfunction number
  1922.   * ecx = cursor handle
  1923. Returned value:
  1924.   * eax destroyed
  1925. Remarks:
  1926.   * The cursor must be loaded previously by the current thread
  1927.     (with the call to subfunction 4). The function does not delete
  1928.     system cursors and cursors, loaded by another applications.
  1929.   * If the active cursor (set by subfunction 5) is deleted,
  1930.     the system restores the default cursor (standard arrow).
  1931.  
  1932. ------------------ Subfunction 7 - get scroll data -------------------
  1933. Parameters:
  1934.   * eax = 37 - function number
  1935.   * ebx = 7 - subfunction number
  1936. Returned value:
  1937.   * eax = [horizontal offset]*65536 + [vertical offset]
  1938. Remarks:
  1939.   * Scroll data is available for active window only.
  1940.   * Values are zeroed after reading.
  1941.   * Values are signed.
  1942.  
  1943. -------- Subfunction 8 - load cursor, specifying the encoding --------
  1944. Parameters:
  1945.   * eax = 37 - function number
  1946.   * ebx = 8 - subfunction number
  1947.   * ecx = pointer to the cursor file path string
  1948.   * edx = string encoding, details can be found in function 80
  1949.           description.
  1950. Returned value:
  1951.   * eax = cursor handle, 0 - failed
  1952.  
  1953. ---------------------- Constants for registers: ----------------------
  1954.   eax - SF_MOUSE_GET (37)
  1955.   ebx - SSF_SCREEN_POSITION (0), SSF_WINDOW_POSITION (1),
  1956.     SSF_BUTTON (2), SSF_BUTTON_EXT (3), SSF_LOAD_CURSOR (4),
  1957.     SSF_SET_CURSOR (5), SSF_DEL_CURSOR (6), SSF_SCROLL_DATA (7)
  1958. ======================================================================
  1959. ====================== Function 38 - draw line. ======================
  1960. ======================================================================
  1961. Parameters:
  1962.   * eax = 38 - function number
  1963.   * ebx = [start coordinate on axis x]*65536 +
  1964.               [end coordinate on axis x]
  1965.   * ecx = [start coordinate on axis y]*65536 +
  1966.               [end coordinate on axis y]
  1967.   * edx = 0x00RRGGBB - color
  1968.     edx = 0x01xxxxxx - draw inversed line
  1969.           (low 24 bits are ignored)
  1970. Returned value:
  1971.   * function does not return value
  1972. Remarks:
  1973.   * Coordinates are relative to the window.
  1974.   * End point is also drawn.
  1975.  
  1976. ---------------------- Constants for registers: ----------------------
  1977.   eax - SF_DRAW_LINE (38)
  1978. ======================================================================
  1979. == Function 39, subfunction 1 - get a size of the background image. ==
  1980. ======================================================================
  1981. Parameters:
  1982.   * eax = 39 - function number
  1983.   * ebx = 1 - subfunction number
  1984. Returned value:
  1985.   * eax = [width]*65536 + [height]
  1986. Remarks:
  1987.   * There is a pair function to set sizes of background image -
  1988.     subfunction 1 of function 15. After which it is necessary,
  1989.     of course, anew to define image.
  1990.  
  1991. ---------------------- Constants for registers: ----------------------
  1992.   eax - SF_BACKGROUND_GET (39)
  1993. ======================================================================
  1994. == Function 39, subfunction 2 - get pixel from the background image. =
  1995. ======================================================================
  1996. Parameters:
  1997.   * eax = 39 - function number
  1998.   * ebx = 2 - subfunction number
  1999.   * ecx = offset
  2000. Returned value:
  2001.   * eax = 0x00RRGGBB - pixel color, if offset is valid
  2002.     (less than 0x160000-16)
  2003.   * eax = 2 otherwise
  2004. Remarks:
  2005.   * Do not rely on returned value for invalid offsets, it may be
  2006.     changed in future kernel versions.
  2007.   * Offset for pixel with coordinates (x,y)
  2008.     is calculated as (x+y*xsize)*3.
  2009.   * There is a pair function to set pixel on the background image -
  2010.     subfunction 2 of function 15.
  2011.  
  2012. ---------------------- Constants for registers: ----------------------
  2013.   eax - SF_BACKGROUND_GET_RECT (39)
  2014. ======================================================================
  2015. == Function 39, subfunction 3 - get rect from the background image.  =
  2016. ======================================================================
  2017. Parameters:
  2018.   * eax = 39 - function number
  2019.   * ebx = 3 - subfunction number
  2020.   * ecx = [x]*65536 + [y]
  2021.   * edx = [width]*65536 + [height]
  2022.   * esi = buffer address
  2023. Returned value:
  2024.   * eax = 0 - success
  2025.   * eax = -1 - error
  2026. Remarks:
  2027.   * Function copies specified rectangle of background image to buffer
  2028.     in 0x00RRGGBB format
  2029.  
  2030. ---------------------- Constants for registers: ----------------------
  2031.   eax - SF_BACKGROUND_GET (39)
  2032. ======================================================================
  2033. == Function 39, subfunction 4 - get drawing mode for the background. =
  2034. ======================================================================
  2035. Parameters:
  2036.   * eax = 39 - function number
  2037.   * ebx = 4 - subfunction number
  2038. Returned value:
  2039.   * eax = 1 - tile
  2040.   * eax = 2 - stretch
  2041. Remarks:
  2042.   * There is a pair function to set drawing mode -
  2043.     subfunction 4 of function 15.
  2044.  
  2045. ---------------------- Constants for registers: ----------------------
  2046.   eax - SF_BACKGROUND_GET (39)
  2047. ======================================================================
  2048. =========== Function 40 - set the mask for expected events. ==========
  2049. ======================================================================
  2050. The mask for expected events affects function working with events
  2051. 10, 11, 23 - they notify only about events allowed by this mask.
  2052. Parameters:
  2053.   * eax = 40 - function number
  2054.   * ebx = mask: bit i corresponds to event i+1 (see list of events)
  2055.     (set bit permits notice on event)
  2056.     bit 31: mouse active/inactive filter
  2057.     bit 31 = 0 - inactive window receive mouse events
  2058.     bit 31 = 1 - inactive window does not receive mouse events
  2059.     bit 30: cursor position filter
  2060.     bit 30 = 0 = the window receive mouse events if cursor
  2061.                  outside window
  2062.     bit 30 = 1 - the window does not receive mouse events if cursor
  2063.                  outside window
  2064. Returned value:
  2065.   * eax = previous value of mask
  2066. Remarks:
  2067.   * Default mask (7=111b) enables notices about redraw,
  2068.     keys and buttons. This is enough for many applications.
  2069.   * Events prohibited in the mask are saved anyway, when come;
  2070.     they are simply not informed with event functions.
  2071.   * Event functions take into account the mask on moment of
  2072.     function call, not on moment of event arrival.
  2073.  
  2074. ---------------------- Constants for registers: ----------------------
  2075.   eax - SF_SET_EVENTS_MASK (40)
  2076. ======================================================================
  2077. ================ Function 43 - input/output to a port. ===============
  2078. ======================================================================
  2079.  
  2080. ------------------------ Output data to port -------------------------
  2081. Parameters:
  2082.   * eax = 43 - function number
  2083.   * bl = byte for output
  2084.   * ecx = port number 0xnnnn (from 0 to 0xFFFF)
  2085. Returned value:
  2086.   * eax = 0 - success
  2087.   * eax = 1 - the thread has not reserved the selected port
  2088.  
  2089. ------------------------ Input data from port ------------------------
  2090. Parameters:
  2091.   * eax = 43 - function number
  2092.   * ebx is ignored
  2093.   * ecx = 0x8000nnnn, where nnnn = port number (from 0 to 0xFFFF)
  2094. Returned value:
  2095.   * eax = 0 - success, thus ebx = entered byte
  2096.   * eax = 1 - the thread has not reserved the selected port
  2097. Remarks:
  2098.   * Previously the thread must reserve the selected port
  2099.     for itself by function 46.
  2100.   * Instead of call to this function it is better to use
  2101.     processor instructions in/out - this is much
  2102.     faster and a bit shorter and easier.
  2103.  
  2104. ---------------------- Constants for registers: ----------------------
  2105.   eax - SF_PORT_IN_OUT (43)
  2106. ======================================================================
  2107. ====== Function 46 - reserve/free a group of input/output ports. =====
  2108. ======================================================================
  2109. To work with reserved ports an application can access directly by
  2110. commands in/out (recommended way) and can use function 43
  2111. (not recommended way).
  2112. Parameters:
  2113.   * eax = 46 - function number
  2114.   * ebx = 0 - reserve, 1 - free
  2115.   * ecx = start port number
  2116.   * edx = end port number (inclusive)
  2117. Returned value:
  2118.   * eax = 0 - success
  2119.   * eax = 1 - error
  2120. Remarks:
  2121.   * For ports reservation: an error occurs if and only if
  2122.     one from the following condition satisfies:
  2123.     * start port is more than end port;
  2124.     * the selected range contains incorrect port number
  2125.       (correct are from 0 to 0xFFFF);
  2126.     * limit for the total number of reserved areas is exceeded
  2127.       (maximum 255 are allowed);
  2128.     * the selected range intersects with any of earlier reserved
  2129.   * For ports free: an error is an attempt to free range,
  2130.     that was not earlier reserved by this function
  2131.     (with same ecx,edx).
  2132.   * If an error occurs (for both cases) function performs no action.
  2133.   * At booting the system reserves for itself ports
  2134.     0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (inclusively).
  2135.   * When a thread terminates, all reserved by it ports
  2136.     are freed automatically.
  2137.  
  2138. ---------------------- Constants for registers: ----------------------
  2139.   eax - SF_SET_PORTS (46)
  2140. ======================================================================
  2141. ============= Function 47 - draw a number in the window. =============
  2142. ======================================================================
  2143. Parameters:
  2144.   * eax = 47 - function number
  2145.   * ebx = parameters of conversion number to text:
  2146.     * bl = 0 - ecx contains number
  2147.     * bl = 1 - ecx contains pointer to dword/qword-number
  2148.     * bh = 0 - display in decimal number system
  2149.     * bh = 1 - display in hexadecimal system
  2150.     * bh = 2 - display in binary system
  2151.     * bits 16-21 = how many digits to display
  2152.     * bits 22-29 reserved and must be set to 0
  2153.     * bit 30 set = display qword (64-bit) number (must be bl=1)
  2154.     * bit 31 set = do not display leading zeroes of the number
  2155.   * ecx = number (if bl=0) or pointer (if bl=1)
  2156.   * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
  2157.   * esi = 0xXXRRGGBB, where
  2158.     * RR, GG, BB specify text color
  2159.     * XX = 0B0FCSSS (bits):
  2160.       * B=1 - fill background (color = edi)
  2161.       * F specifies the font:
  2162.         0 = 6x9
  2163.         1 = 8x16
  2164.       * C=0 - draw to the window,
  2165.         C=1 - draw to the user buffer (edi)
  2166.       * SSS = (size multiplier)-1, so 0 = x1, 7 = x8
  2167. Returned value:
  2168.   * function does not return value
  2169. Remarks:
  2170.   * The given length must not exceed 60.
  2171.   * The exactly given amount of digits is output. If number is small
  2172.     and can be written by smaller amount of digits, it is supplemented
  2173.     by leading zeroes; if the number is big and can not be written by
  2174.     given amount of digits, extra digits are not drawn.
  2175.  
  2176. ---------------------- Constants for registers: ----------------------
  2177.   eax - SF_DRAW_NUMBER (47)
  2178. ======================================================================
  2179. ========= Function 48, subfunction 0 - apply screen settings. ========
  2180. ======================================================================
  2181. Parameters:
  2182.   * eax = 48 - function number
  2183.   * ebx = 0 - subfunction number
  2184.   * ecx = 0 - reserved
  2185. Returned value:
  2186.   * function does not return value
  2187. Remarks:
  2188.   * Function redraws the screen after parameters change by
  2189.     subfunctions 1 and 2.
  2190.   * Function call without prior call to one of indicated subfunctions
  2191.     is ignored.
  2192.   * Function call with nonzero ecx is ignored.
  2193.  
  2194. ---------------------- Constants for registers: ----------------------
  2195.   eax - SF_STYLE_SETTINGS (48)
  2196.   ebx - SSF_APPLY (0)
  2197. ======================================================================
  2198. =========== Function 48, subfunction 1 - set button style. ===========
  2199. ======================================================================
  2200. Parameters:
  2201.   * eax = 48 - function number
  2202.   * ebx = 1 - subfunction number
  2203.   * ecx = button style:
  2204.     * 0 = flat
  2205.     * 1 = 3d
  2206. Returned value:
  2207.   * function does not return value
  2208. Remarks:
  2209.   * After call to this function one should redraw the screen by
  2210.     subfunction 0.
  2211.   * Button style influences only to their draw of function 8.
  2212.  
  2213. ---------------------- Constants for registers: ----------------------
  2214.   eax - SF_STYLE_SETTINGS (48)
  2215.   ebx - SSF_SET_BUTTON_STYLE (1)
  2216. ======================================================================
  2217. ====== Function 48, subfunction 2 - set standard window colors. ======
  2218. ======================================================================
  2219. Parameters:
  2220.   * eax = 48 - function number
  2221.   * ebx = 2 - subfunction number
  2222.   * ecx = pointer to the color table
  2223.   * edx = size of the color table
  2224.     (must be 40 bytes for future compatibility)
  2225. Format of the color table is shown in description of subfunction 3.
  2226. Returned value:
  2227.   * function does not return value
  2228. Remarks:
  2229.   * After call to this function one should redraw the screen by
  2230.     subfunction 0.
  2231.   * Table of standard colors influences only to applications,
  2232.     which receive this table obviously (by subfunction 3)
  2233.     and use it (specifying colors from it to drawing functions).
  2234.   * Table of standard colors is included in skin and is installed
  2235.     anew with skin installation (by subfunction 8).
  2236.   * Color table can be viewed/changed interactively with
  2237.     the application 'desktop'.
  2238.  
  2239. ---------------------- Constants for registers: ----------------------
  2240.   eax - SF_STYLE_SETTINGS (48)
  2241.   ebx - SSF_SET_COLORS (2)
  2242. ======================================================================
  2243. ====== Function 48, subfunction 3 - get standard window colors. ======
  2244. ======================================================================
  2245. Parameters:
  2246.   * eax = 48 - function number
  2247.   * ebx = 3 - subfunction number
  2248.   * ecx = pointer to the buffer with size edx bytes,
  2249.     where table will be written
  2250.   * edx = size of color table
  2251.     (must be 40 bytes for future compatibility)
  2252. Returned value:
  2253.   * function does not return value
  2254. Format of the color table:
  2255. each item is dword-value for color 0x00RRGGBB
  2256.   * +0: dword: none - reserved
  2257.   * +4: dword: none - reserved
  2258.   * +8: dword: work_dark - dark color of working area
  2259.     used to give a user 3D-like feelings about interface elements
  2260.   * +12 = +0xC: dword: work_light - light color of working area
  2261.     used to give a user 3D-like feelings about interface elements
  2262.   * +16 = +0x10: dword: grab_text - color of text on header
  2263.   * +20 = +0x14: dword: work - color of working area
  2264.   * +24 = +0x18: dword: button - color of button in working area
  2265.   * +28 = +0x1C: dword: button_text - color of text on button
  2266.     in working area
  2267.   * +32 = +0x20: dword: work_text - color of text in working area
  2268.   * +36 = +0x24: dword: graph - color of graphics in working area
  2269. Remarks:
  2270.   * Structure of the color table is described in the standard
  2271.     include file 'macros.inc' as 'system_colors'; for example,
  2272.     it is possible to write:
  2273.         sc      system_colors           ; variable declaration
  2274.         ...                             ; somewhere one must call
  2275.                                         ; this function with ecx=sc
  2276.         mov     ecx, [sc.work_button_text]      ; read text color on
  2277.                                         ; button in working area
  2278.   * A program itself decides to use or not to use color table.
  2279.     For usage program must simply at calls to drawing functions select
  2280.     color taken from the table.
  2281.   * At change of the table of standard colors (by subfunction 2 with
  2282.     the subsequent application of changes by subfunction 0 or
  2283.     at skin set by subfunction 8) the system sends to all windows
  2284.     redraw message (the event with code 1).
  2285.   * Color table can be viewed/changed interactively with
  2286.     the application 'desktop'.
  2287.  
  2288. ---------------------- Constants for registers: ----------------------
  2289.   eax - SF_STYLE_SETTINGS (48)
  2290.   ebx - SSF_GET_COLORS (3)
  2291. ======================================================================
  2292. ============ Function 48, subfunction 4 - get skin height. ===========
  2293. ======================================================================
  2294. Parameters:
  2295.   * eax = 48 - function number
  2296.   * ebx = 4 - subfunction number
  2297. Returned value:
  2298.   * eax = skin height
  2299. Remarks:
  2300.   * Skin height is defined as the height of a header
  2301.     of skinned windows.
  2302.   * See also general structure of window in the description
  2303.     of function 0.
  2304.  
  2305. ---------------------- Constants for registers: ----------------------
  2306.   eax - SF_STYLE_SETTINGS (48)
  2307.   ebx - SSF_GET_SKIN_HEIGHT (4)
  2308. ======================================================================
  2309. ======== Function 48, subfunction 5 - get screen working area. =======
  2310. ======================================================================
  2311. Parameters:
  2312.   * eax = 48 - function number
  2313.   * ebx = 5 - subfunction number
  2314. Returned value:
  2315.   * eax = [left]*65536 + [right]
  2316.   * ebx = [top]*65536 + [bottom]
  2317. Remarks:
  2318.   * The screen working area defines position and coordinates of
  2319.     a maximized window.
  2320.   * The screen working area in view of normal work is all screen
  2321.     without taskbar ('@taskbar' application).
  2322.   * (left,top) are coordinates of the left upper corner,
  2323.     (right,bottom) are coordinates of the right lower one.
  2324.     Thus the size of working area on x axis can be calculated by
  2325.     formula right-left+1, on y axis - by formula bottom-top+1.
  2326.   * See also function 14,
  2327.     to get sizes of all screen.
  2328.   * There is a pair function to set working area - subfunction 6.
  2329.  
  2330. ---------------------- Constants for registers: ----------------------
  2331.   eax - SF_STYLE_SETTINGS (48)
  2332.   ebx - SSF_GET_SCREEN_AREA (5)
  2333. ======================================================================
  2334. ======== Function 48, subfunction 6 - set screen working area. =======
  2335. ======================================================================
  2336. Parameters:
  2337.   * eax = 48 - function number
  2338.   * ebx = 6 - subfunction number
  2339.   * ecx = [left]*65536 + [right]
  2340.   * edx = [top]*65536 + [bottom]
  2341. Returned value:
  2342.   * function does not return value
  2343. Remarks:
  2344.   * The screen working area defines position and coordinates of
  2345.     a maximized window.
  2346.   * This function is used only by the application '@taskbar',
  2347.     which set working area to all screen without taskbar.
  2348.   * (left,top) are coordinates of the left upper corner,
  2349.     (right,bottom) are coordinates of the right lower one.
  2350.     Thus the size of working area on x axis can be calculated by
  2351.     formula right-left+1, on y axis - by formula bottom-right+1.
  2352.   * If 'left'>='right', x-coordinate of working area is not changed.
  2353.     If 'left'<0, 'left' will not be set. If 'right' is greater than or
  2354.     equal to screen width, 'right' will not be set.
  2355.     Similarly on y axis.
  2356.   * See also function 14,
  2357.     to get sizes of all screen.
  2358.   * There is a pair function to get working area - subfunction 5.
  2359.   * This function redraws the screen automatically,
  2360.     updating coordinates and sizes of maximized windows.
  2361.     The system sends to all windows redraw message (the event 1).
  2362.  
  2363. ---------------------- Constants for registers: ----------------------
  2364.   eax - SF_STYLE_SETTINGS (48)
  2365.   ebx - SSF_SET_SCREEN_AREA (6)
  2366. ======================================================================
  2367. =========== Function 48, subfunction 7 - get skin margins. ===========
  2368. ======================================================================
  2369. Returns the area of a header of a skinned window, intended for
  2370. a text of a header.
  2371. Parameters:
  2372.   * eax = 48 - function number
  2373.   * ebx = 7 - subfunction number
  2374. Returned value:
  2375.   * eax = [left]*65536 + [right]
  2376.   * ebx = [top]*65536 + [bottom]
  2377. Remarks:
  2378.   * An application decides itself to use or not to use this function.
  2379.   * It is recommended to take into account returned value
  2380.     of this function for choice of a place for drawing header text
  2381.     (by function 4) or a substitute of header text
  2382.     (at the discretion of an application).
  2383.  
  2384. ---------------------- Constants for registers: ----------------------
  2385.   eax - SF_STYLE_SETTINGS (48)
  2386.   ebx - SSF_GET_SKIN_MARGINS (7)
  2387. ======================================================================
  2388. ============= Function 48, subfunction 8 - set used skin. ============
  2389. ======================================================================
  2390. Parameters:
  2391.   * eax = 48 - function number
  2392.   * ebx = 8 - subfunction number
  2393.   * ecx = pointer to filename of the skin
  2394. Returned value:
  2395.   * eax = 0 - success
  2396.   * otherwise eax = file system error code; if file does not
  2397.     contain valid skin, function returns error 3
  2398.     (unknown file system).
  2399. Remarks:
  2400.   * After successful skin loading the system sends to all windows
  2401.     redraw message (the event 1).
  2402.   * At booting the system reads skin from file 'default.skn'
  2403.     on ramdisk.
  2404.   * User can change the skin statically by creating hisself
  2405.     'default.skn' or dynamically with the application 'desktop'.
  2406.  
  2407. ---------------------- Constants for registers: ----------------------
  2408.   eax - SF_STYLE_SETTINGS (48)
  2409.   ebx - SSF_SET_SKIN (8)
  2410. ======================================================================
  2411. ====== Function 48, subfunction 9 - get font smoothing setting. ======
  2412. ======================================================================
  2413. Parameters:
  2414.   * eax = 48 - function number
  2415.   * ebx = 9 - subfunction number
  2416. Returned value:
  2417.   * eax = 2 - subpixel, 1 - anti-aliasing, 0 - off
  2418.  
  2419. ---------------------- Constants for registers: ----------------------
  2420.   eax - SF_STYLE_SETTINGS (48)
  2421.   ebx - SSF_GET_FONT_SMOOTH (9)
  2422. ======================================================================
  2423. ========== Function 48, subfunction 10 - set font smoothing. =========
  2424. ======================================================================
  2425. Parameters:
  2426.   * eax = 48 - function number
  2427.   * ebx = 10 - subfunction number
  2428.   * cl  = 2 - subpixel, 1 - anti-aliasing, 0 - off
  2429.  
  2430. ---------------------- Constants for registers: ----------------------
  2431.   eax - SF_STYLE_SETTINGS (48)
  2432.   ebx - SSF_SET_FONT_SMOOTH (10)
  2433. ======================================================================
  2434. ============ Function 48, subfunction 11 - get font size. ============
  2435. ======================================================================
  2436. Parameters:
  2437.   * eax = 48 - function number
  2438.   * ebx = 11 - subfunction number
  2439. Returned value:
  2440.   * eax = current font height in pixels
  2441.  
  2442. ---------------------- Constants for registers: ----------------------
  2443.   eax - SF_STYLE_SETTINGS (48)
  2444.   ebx - SSF_GET_FONT_SIZE (11)
  2445. ======================================================================
  2446. ============ Function 48, subfunction 12 - set font size. ============
  2447. ======================================================================
  2448. Parameters:
  2449.   * eax = 48 - function number
  2450.   * ebx = 12 - subfunction number
  2451.   * cl  = new font height in pixels
  2452.  
  2453. ---------------------- Constants for registers: ----------------------
  2454.   eax - SF_STYLE_SETTINGS (48)
  2455.   ebx - SSF_SET_FONT_SIZE (12)
  2456. ======================================================================
  2457. == Function 48, subfunction 13 - set skin, specifying the encoding. ==
  2458. ======================================================================
  2459. Parameters:
  2460.   * eax = 48 - function number
  2461.   * ebx = 13 - subfunction number
  2462.   * ecx = pointer to the skin file path string
  2463.   * edx = string encoding, details can be found in function 80 description.
  2464. Returned value:
  2465.   * eax = 0 - success
  2466.   * otherwise eax = file system error code; if file does not
  2467.     contain valid skin, function returns error 3
  2468.     (unknown file system).
  2469. Remarks:
  2470.   * After successful skin loading the system sends to all windows
  2471.     redraw message (the event 1).
  2472.   * At booting the system reads skin from file 'default.skn'
  2473.     on ramdisk.
  2474.   * User can change the skin statically by creating hisself
  2475.     'default.skn' or dynamically with the application 'desktop'.
  2476.  
  2477. ======================================================================
  2478. =========== Function 49 - Advanced Power Management (APM). ===========
  2479. ======================================================================
  2480. Parameters:
  2481.   * eax = 49 - function number
  2482.   * dx = number of the APM function
  2483.     (analogue of ax in APM specification)
  2484.   * bx, cx = parameters of the APM function
  2485. Returned value:
  2486.   * 16-bit registers ax, bx, cx, dx, si, di and carry flag CF
  2487.     are set according to the APM specification
  2488.   * high halves of 32-bit registers eax, ebx, ecx,
  2489.     edx, esi, edi are destroyed
  2490. Remarks:
  2491.   * APM 1.2 specification is described in the document
  2492.     "Advanced Power Management (APM) BIOS Specification"
  2493.     (Revision 1.2), available at
  2494.     http://www.microsoft.com/whdc/archive/amp_12.mspx;
  2495.     besides it is included in famous Interrupt List by Ralf Brown
  2496.     (http://www.pobox.com/~ralf/files.html,
  2497.     ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/).
  2498.  
  2499. ---------------------- Constants for registers: ----------------------
  2500.   eax - SF_APM (49)
  2501. ======================================================================
  2502. =================== Function 50 - set window shape. ==================
  2503. ======================================================================
  2504. Normal windows have rectangular shape. This function can give to
  2505. a window any shape. The shape is given by a set of points inside
  2506. the base rectangle belonging to a window. Position and coordinates
  2507. of the base rectangle are set by function 0
  2508. and changed by function 67.
  2509.  
  2510. --------------------------- Set shape data ---------------------------
  2511. Parameters:
  2512.   * eax = 50 - function number
  2513.   * ebx = 0 - subfunction number
  2514.   * ecx = pointer to shape data (array of bytes 0/1)
  2515. Returned value:
  2516.   * function does not return value
  2517.  
  2518. -------------------------- Set shape scale ---------------------------
  2519. Parameters:
  2520.   * eax = 50 - function number
  2521.   * ebx = 1 - subfunction number
  2522.   * ecx sets a scale: each byte of data defines
  2523.     (2^scale)*(2^scale) pixels
  2524. Returned value:
  2525.   * function does not return value
  2526. Remarks:
  2527.   * Default scale is 0 (scale factor is 1). If in the shape data
  2528.     one byte corresponds to one pixel, there is no necessity
  2529.     to set scale.
  2530.   * Let's designate xsize = window width (in pixels), ysize = height;
  2531.     pay attention, that they are one pixel more than defined by
  2532.     functions 0, 67.
  2533.   * On definition of scale xsize and ysize must be divisible
  2534.     on 2^scale.
  2535.   * Byte of data on offset 'a' must be 0/1 and defines belonging
  2536.     to a window of square with the side 2^scale (if scale=0,
  2537.     this is one pixel) and coordinates of the left upper corner
  2538.     (a mod (xsize shr scale), a div (xsize shr scale))
  2539.   * Data size: (xsize shr scale)*(ysize shr scale).
  2540.   * Data must be presented in the memory and not change
  2541.     after set of shape.
  2542.   * The system views the shape data at every window redraw by
  2543.     function 0.
  2544.   * The call of subfunction 0 with NULL pointer results in return
  2545.     to the rectangular shape.
  2546.  
  2547. ---------------------- Constants for registers: ----------------------
  2548.   eax - SF_SET_WINDOW_SHAPE (50)
  2549. ======================================================================
  2550. ==================== Function 51 - create thread. ====================
  2551. ======================================================================
  2552. Parameters:
  2553.   * eax = 51 - function number
  2554.   * ebx = 1 - unique subfunction
  2555.   * ecx = address of thread entry point (starting eip)
  2556.   * edx = pointer to thread stack (starting esp)
  2557. Returned value:
  2558.   * eax = -1 - error (there is too many threads)
  2559.   * otherwise eax = TID - thread identifier
  2560.  
  2561. ---------------------- Constants for registers: ----------------------
  2562.   eax - SF_CREATE_THREAD (51)
  2563. ======================================================================
  2564. ==================== Function 54, subfunction 0 ======================
  2565. ============== Get the number of slots in the clipboard. =============
  2566. ======================================================================
  2567. Parameters:
  2568.   * eax = 54 - function number
  2569.   * ebx = 0 - subfunction number
  2570. Returned value:
  2571.   * eax = slots in the clipboard
  2572.   * eax = -1 - main list area not found
  2573.  
  2574. ---------------------- Constants for registers: ----------------------
  2575.   eax - SF_CLIPBOARD (54)
  2576.   ebx - SSF_GET_SLOT_COUNT (0)
  2577. ======================================================================
  2578. ==================== Function 54, subfunction 1 ======================
  2579. ================= Read the data from the clipboard. ==================
  2580. ======================================================================
  2581. Parameters:
  2582.   * eax = 54 - function number
  2583.   * ebx = 1 - subfunction number
  2584.   * eсx = slot number
  2585. Returned value:
  2586.   * eax = if successful - pointer to a memory with data
  2587.   * eax = 1 - error
  2588.   * eax = -1 - main list area not found
  2589. Remarks:
  2590.   * The function must be used in conjunction with 68.11. The
  2591.     application must pre-initialize the local heap by calling 68.11.
  2592.  
  2593. ---------------------- Constants for registers: ----------------------
  2594.   eax - SF_CLIPBOARD (54)
  2595.   ebx - SSF_READ_CB (1)
  2596. ======================================================================
  2597. ==================== Function 54, subfunction 2 ======================
  2598. ================= Write the data to the clipboard. ===================
  2599. ======================================================================
  2600. Parameters:
  2601.   * eax = 54 - function number
  2602.   * ebx = 2 - subfunction number
  2603.   * eсx = the number of bytes to be copied
  2604.   * edx = a pointer to a buffer for data to be copied
  2605. Returned value:
  2606.   * eax = 0 - success
  2607.   * eax = 1 - error
  2608.   * eax = -1 - main list area not found
  2609.  
  2610. ---------------------- Constants for registers: ----------------------
  2611.   eax - SF_CLIPBOARD (54)
  2612.   ebx - SSF_WRITE_CB (2)
  2613. ======================================================================
  2614. ===================== Function 54, subfunction 3 =====================
  2615. ================ Delete the last slot in the clipboard ===============
  2616. ======================================================================
  2617. Parameters:
  2618.   * eax = 54 - function number
  2619.   * ebx = 3 - subfunction number
  2620. Returned value:
  2621.   * eax = 0 - success
  2622.   * eax = 1 - error
  2623.   * eax = -1 - main list area not found
  2624.  
  2625. ---------------------- Constants for registers: ----------------------
  2626.   eax - SF_CLIPBOARD (54)
  2627.   ebx - SSF_DEL_SLOT (3)
  2628. ======================================================================
  2629. ===================== Function 54, subfunction 4 =====================
  2630. ===================== Alarm reset the lock buffer ====================
  2631. ======================================================================
  2632. Parameters:
  2633.   * eax = 54 - function number
  2634.   * ebx = 4 - subfunction number
  2635. Returned value:
  2636.   * eax = 0 - success
  2637.   * eax = -1 - main list area not found or no blocking
  2638. Remarks:
  2639.   * Used in exceptional cases, where no responsible or killed
  2640.     application blocked the clipboard operations.
  2641.  
  2642. ---------------------- Constants for registers: ----------------------
  2643.   eax - SF_CLIPBOARD (54)
  2644.   ebx - SSF_UNLOCK_BUFFER (4)
  2645. ======================================================================
  2646.  Function 55, subfunction 55 - begin to play data on built-in speaker.
  2647. ======================================================================
  2648. Parameters:
  2649.   * eax = 55 - function number
  2650.   * ebx = 55 - subfunction number
  2651.   * esi = pointer to data
  2652. Returned value:
  2653.   * eax = 0 - success
  2654.   * eax = 55 - error (speaker is off or busy)
  2655. Data is an array of items with variable length.
  2656. Format of each item is defined by first byte:
  2657.   * 0 = end of data
  2658.   * 1..0x80 = sets sound duration on 1/100 of second; sound note
  2659.     is defined by immediate value of frequency
  2660.     * following word (2 bytes) contains frequency divider;
  2661.       frequency is defined as 1193180/divider
  2662.   * 0x81 = invalid
  2663.   * 0x82..0xFF = note is defined by octave and number:
  2664.     * duration in 1/100 of second = (first byte)-0x81
  2665.     * there is one more byte;
  2666.     * (second byte)=0xFF - delay
  2667.     * otherwise it looks like a*0x10+b, where b=number of the note in
  2668.       an octave from 1 to 12, a=number of octave (beginning from 0)
  2669. Remarks:
  2670.   * Speaker play can be disabled/enabled by
  2671.     subfunction 8 of function 18.
  2672.   * Function returns control, having informed the system
  2673.     an information on request. Play itself goes independently from
  2674.     the program.
  2675.   * The data must be kept in the memory at least up to the end
  2676.     of play.
  2677.  
  2678. ---------------------- Constants for registers: ----------------------
  2679.   eax - SF_SPEAKER_PLAY (55)
  2680. ======================================================================
  2681. ======================= Function 57 - PCI BIOS. ======================
  2682. ======================================================================
  2683. Parameters:
  2684.   * eax = 57 - function number
  2685.   * ebp corresponds to al in PCI BIOS specification
  2686.   * other registers are set according to PCI BIOS specification
  2687. Returned value:
  2688.   * CF is undefined
  2689.   * other registers are set according to PCI BIOS specification
  2690. Remarks:
  2691.   * Many effects of this function can be also achieved with
  2692.     corresponding subfunctions of function 62.
  2693.   * The function calls PCI32 BIOS extension, documented e.g. in
  2694.     http://alpha1.dyns.net/files/PCI/bios21.pdf.
  2695.   * If BIOS does not support this extension, its behavior is emulated
  2696.     (through kernel-mode analogues of subfunctions of function 62).
  2697.  
  2698. ---------------------- Constants for registers: ----------------------
  2699.   eax - SF_PCI_BIOS (57)
  2700. ======================================================================
  2701. ========== Function 60 - Inter Process Communication (IPC). ==========
  2702. ======================================================================
  2703. IPC is used for message dispatching from one process/thread to
  2704. another. Previously it is necessary to agree how to interpret
  2705. the concrete message.
  2706.  
  2707. ----------- Subfunction 1 - set the area for IPC receiving -----------
  2708. Is called by process-receiver.
  2709. Parameters:
  2710.   * eax = 60 - function number
  2711.   * ebx = 1 - subfunction number
  2712.   * ecx = pointer to the buffer
  2713.   * edx = size of the buffer
  2714. Returned value:
  2715.   * eax = 0 - always success
  2716. Format of IPC-buffer:
  2717.   * +0: dword: if nonzero, buffer is considered locked;
  2718.     lock/unlock the buffer, when you work with it and need that
  2719.     buffer data are not changed from outside (no new messages)
  2720.   * +4: dword: occupied place in the buffer (in bytes)
  2721.   * +8: first message
  2722.   * +8+n: second message
  2723.   * ...
  2724. Format of a message:
  2725.   * +0: dword: PID of sender
  2726.   * +4: dword: message length (not including this header)
  2727.   * +8: n*byte: message data
  2728.  
  2729. ------------------ Subfunction 2 - send IPC message ------------------
  2730. Is called by process-sender.
  2731. Parameters:
  2732.   * eax = 60 - function number
  2733.   * ebx = 2 - subfunction number
  2734.   * ecx = PID of receiver
  2735.   * edx = pointer to the message data
  2736.   * esi = message length (in bytes)
  2737. Returned value:
  2738.   * eax = 0 - success
  2739.   * eax = 1 - the receiver has not defined buffer for IPC messages
  2740.     (can be, still have no time,
  2741.     and can be, this is not right process)
  2742.   * eax = 2 - the receiver has blocked IPC-buffer; try to wait a bit
  2743.   * eax = 3 - overflow of IPC-buffer of the receiver
  2744.   * eax = 4 - process/thread with such PID does not exist
  2745. Remarks:
  2746.   * Immediately after writing of IPC-message to the buffer the system
  2747.     sends to the receiver the event with code 7 (see event codes).
  2748.  
  2749. ---------------------- Constants for registers: ----------------------
  2750.   eax - SF_IPC (60)
  2751.   ebx - SSF_SET_AREA (1), SSF_SEND_MESSAGE (2)
  2752. ======================================================================
  2753. ==== Function 61 - get parameters for the direct graphics access. ====
  2754. ======================================================================
  2755. The data of the graphics screen (the memory area which displays
  2756. screen contents) are accessible to a program directly, without
  2757. any system calls, through the selector gs:
  2758.         mov     eax, [gs:0]
  2759. places in eax the first dword of the buffer, which contains
  2760. information on color of the left upper point (and, possibly, colors
  2761. of several following).
  2762.         mov     [gs:0], eax
  2763. by work in VESA modes with LFB sets color of the left upper point
  2764. (and, possibly, colors of several following).
  2765. To interpret the data of graphics screen program needs to know
  2766. some parameters, returning by this function.
  2767. Remarks:
  2768.   * Graphics parameters changes very seldom at work.
  2769.   * At videomode change the system redraws all windows (event
  2770.     with code 1) and redraws the background (event 5).
  2771.     Same events occur in other cases too, which meet much more often,
  2772.     than videomode change.
  2773.   * By operation in videomodes with LFB the selector gs points to
  2774.     LFB itself, so reading/writing on gs result directly in
  2775.     change of screen contents. By operation in videomodes without
  2776.     LFB gs points to some data area in the kernel, and all functions
  2777.     of screen output fulfil honesty double operation on writing
  2778.     directly to the screen and writing to this buffer. In result
  2779.     at reading contents of this buffer the results correspond to
  2780.     screen contents (with, generally speaking, large color
  2781.     resolution), and writing is ignored.
  2782.     One exception is the mode 320*200, for which main loop of the
  2783.     system thread updates the screen according to mouse movements.
  2784.  
  2785. ------------------------- Screen resolution --------------------------
  2786. Parameters:
  2787.   * eax = 61 - function number
  2788.   * ebx = 1 - subfunction number
  2789. Returned value:
  2790.   * eax = [resolution on x axis]*65536 + [resolution on y axis]
  2791. Remarks:
  2792.   * One can use function 14 paying attention that
  2793.     it returns sizes on 1 pixel less. It is fully equivalent way.
  2794.  
  2795. ---------------------- Number of bits per pixel ----------------------
  2796. Parameters:
  2797.   * eax = 61 - function number
  2798.   * ebx = 2 - subfunction number
  2799. Returned value:
  2800.   * eax = number of bits per pixel (24 or 32)
  2801.  
  2802. -------------------- Number of bytes per scanline --------------------
  2803. Parameters:
  2804.   * eax = 61 - function number
  2805.   * ebx = 3 - subfunction number
  2806. Returned value:
  2807.   * eax = number of bytes occupied by one scanline
  2808.     (horizontal line on the screen)
  2809.  
  2810. ---------------------- Constants for registers: ----------------------
  2811.   eax - SF_GET_GRAPHICAL_PARAMS (61)
  2812.   ebx - SSF_SCREEN_SIZE (1), SSF_BITS_PER_PIXEL (2),
  2813.     SSF_BYTES_PER_LINE (3)
  2814. ======================================================================
  2815. ===== Function 62, subfunction 0 - get version of PCI-interface. =====
  2816. ======================================================================
  2817. Parameters:
  2818.   * eax = 62 - function number
  2819.   * bl = 0 - subfunction number
  2820. Returned value:
  2821.   * eax = -1 - PCI access is disabled; otherwise
  2822.   * ah.al = version of PCI-interface (ah=version, al=subversion)
  2823.   * high word of eax is zeroed
  2824. Remarks:
  2825.   * Previously low-level access to PCI for applications must be
  2826.     enabled by subfunction 12 of function 21.
  2827.   * If PCI BIOS is not supported, the value of ax is undefined.
  2828.  
  2829. ---------------------- Constants for registers: ----------------------
  2830.   eax - SF_PCI (62)
  2831.   ebx - SSF_GET_VERSION (0)
  2832. ======================================================================
  2833. ==== Function 62, subfunction 1 - get number of the last PCI-bus. ====
  2834. ======================================================================
  2835. Parameters:
  2836.   * eax = 62 - function number
  2837.   * bl = 1 - subfunction number
  2838. Returned value:
  2839.   * eax = -1 - access to PCI is disabled; otherwise
  2840.   * al = number of the last PCI-bus; other bytes of eax are destroyed
  2841. Remarks:
  2842.   * Previously low-level access to PCI for applications must be
  2843.     enabled by subfunction 12 of function 21.
  2844.   * If PCI BIOS is not supported, the value of ax is undefined.
  2845.  
  2846. ---------------------- Constants for registers: ----------------------
  2847.   eax - SF_PCI (62)
  2848.   ebx - SSF_GET_LAST_BUS (1)
  2849. ======================================================================
  2850. ===================== Function 62, subfunction 2 =====================
  2851. ===== Get mechanism of addressing to the PCI configuration space. ====
  2852. ======================================================================
  2853. Parameters:
  2854.   * eax = 62 - function number
  2855.   * bl = 2 - subfunction number
  2856. Returned value:
  2857.   * eax = -1 - access to PCI is disabled; otherwise
  2858.   * al = mechanism (1 or 2); other bytes of eax are destroyed
  2859. Remarks:
  2860.   * Previously low-level access to PCI for applications must be
  2861.     enabled by subfunction 12 of function 21.
  2862.   * Addressing mechanism is selected depending on
  2863.     equipment characteristics.
  2864.   * Subfunctions of read and write work automatically
  2865.     with the selected mechanism.
  2866.  
  2867. ---------------------- Constants for registers: ----------------------
  2868.   eax - SF_PCI (62)
  2869.   ebx - SSF_GET_ADRR_MODE (2)
  2870. ======================================================================
  2871. ======== Function 62, subfunctions 4,5,6 - read PCI-register. ========
  2872. ======================================================================
  2873. Parameters:
  2874.   * eax = 62 - function number
  2875.   * bl = 4 - read byte
  2876.   * bl = 5 - read word
  2877.   * bl = 6 - read dword
  2878.   * bh = number of PCI-bus
  2879.   * ch = dddddfff, where ddddd = number of the device on the bus,
  2880.     fff = function number of device
  2881.   * cl = number of register (must be even for bl=5,
  2882.     divisible by 4 for bl=6)
  2883. Returned value:
  2884.   * eax = -1 - error (access to PCI is disabled or parameters
  2885.     are not supported); otherwise
  2886.   * al/ax/eax (depending on requested size) contains the data;
  2887.     the other part of register eax is destroyed
  2888. Remarks:
  2889.   * Previously low-level access to PCI for applications must be
  2890.     enabled by subfunction 12 of function 21.
  2891.   * Access mechanism 2 supports only 16 devices on a bus and ignores
  2892.     function number. To get access mechanism use subfunction 2.
  2893.   * Some registers are standard and exist for all devices, some are
  2894.     defined by the concrete device. The list of registers of the
  2895.     first type can be found e.g. in famous
  2896.     Interrupt List by Ralf Brown
  2897.     (http://www.pobox.com/~ralf/files.html,
  2898.     ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/);
  2899.     registers of the second type must be listed
  2900.     in the device documentation.
  2901.  
  2902. ---------------------- Constants for registers: ----------------------
  2903.   eax - SF_PCI (62)
  2904.   ebx - SSF_READ_BYTE (4), SSF_READ_WORD (5), SSF_READ_DWORD (6)
  2905. ======================================================================
  2906. ====== Function 62, subfunctions 8,9,10 - write to PCI-register. =====
  2907. ======================================================================
  2908. Parameters:
  2909.   * eax = 62 - function number
  2910.   * bl = 8 - write byte
  2911.   * bl = 9 - write word
  2912.   * bl = 10 - write dword
  2913.   * bh = number of PCI-bus
  2914.   * ch = dddddfff, where ddddd = number of the device on the bus,
  2915.     fff = function number of device
  2916.   * cl = number of register (must be even for bl=9,
  2917.     divisible by 4 for bl=10)
  2918.   * dl/dx/edx (depending on requested size) contains
  2919.     the data to write
  2920. Returned value:
  2921.   * eax = -1 - error (access to PCI is disabled or parameters
  2922.     are not supported)
  2923.   * eax = 0 - success
  2924. Remarks:
  2925.   * Previously low-level access to PCI for applications must be
  2926.     enabled by subfunction 12 of function 21.
  2927.   * Access mechanism 2 supports only 16 devices on a bus and ignores
  2928.     function number. To get access mechanism use subfunction 2.
  2929.   * Some registers are standard and exist for all devices, some are
  2930.     defined by the concrete device. The list of registers of the
  2931.     first type can be found e.g. in famous Interrupt List by
  2932.     Ralf Brown; registers of the second type must be listed
  2933.     in the device documentation.
  2934.  
  2935. ---------------------- Constants for registers: ----------------------
  2936.   eax - SF_PCI (62)
  2937.   ebx - SSF_WRITE_BYTE (8), SSF_WRITE_WORD (9), SSF_WRITE_DWORD (10)
  2938. ======================================================================
  2939. ============== Function 63 - work with the debug board. ==============
  2940. ======================================================================
  2941. The debug board is the global system buffer (with the size
  2942. 1024 bytes), to which any program can write (generally speaking,
  2943. arbitrary) data and from which other program can read these data.
  2944. By the agreement written data are text strings interpreted as
  2945. debug messages on a course of program execution. The kernel in
  2946. some situations also writes to the debug board information on
  2947. execution of some functions; by the agreement kernel messages
  2948. begins from the prefix "K : ".
  2949. For view of the debug board the application 'board' was created,
  2950. which reads data from the buffer and displays them in its window.
  2951. 'board' interpretes the sequence of codes 13,10 as newline.
  2952. A character with null code in an end of line is not necessary,
  2953. but also does not prevent.
  2954. Because debugger has been written, the value of the debug board
  2955. has decreased, as debugger allows to inspect completely a course of
  2956. program execution without any efforts from the direction of program
  2957. itself. Nevertheless in some cases the debug board is still useful.
  2958.  
  2959. ----------------------------- Write byte -----------------------------
  2960. Parameters:
  2961.   * eax = 63 - function number
  2962.   * ebx = 1 - subfunction number
  2963.   * cl = data byte
  2964. Returned value:
  2965.   * function does not return value
  2966. Remarks:
  2967.   * Byte is written to the buffer. Buffer size is 512 bytes.
  2968.     At buffer overflow all obtained data are lost.
  2969.   * For output to the debug board of more complicated objects
  2970.     (strings, numbers) it is enough to call this function in cycle.
  2971.     It is possible not to write the appropriate code manually and use
  2972.     file 'debug.inc', which is included into the distributive.
  2973.  
  2974. ----------------------------- Read byte ------------------------------
  2975. Takes away byte from the buffer.
  2976. Parameters:
  2977.   * eax = 63 - function number
  2978.   * ebx = 2 - subfunction number
  2979. Returned value:
  2980.   * eax = ebx = 0 - the buffer is empty
  2981.   * eax = byte, ebx = 1 - byte was successfully read
  2982.  
  2983. ---------------------- Constants for registers: ----------------------
  2984.   eax - SF_BOARD (63)
  2985.   ebx - SSF_DEBUG_WRITE (1), SSF_DEBUG_READ (2)
  2986. ======================================================================
  2987. ============== Function 64 - resize application memory. ==============
  2988. ======================================================================
  2989. Parameters:
  2990.   * eax = 64 - function number
  2991.   * ebx = 1 - unique subfunction
  2992.   * ecx = new memory size
  2993. Returned value:
  2994.   * eax = 0 - success
  2995.   * eax = 1 - not enough memory
  2996. Remarks:
  2997.   * There is another way to dynamically allocate/free memory -
  2998.     subfunctions 12, 13 and 20 of function 68, but after creation
  2999.     of the process heap 64 function call will be ignored.
  3000.   * The function cannot be used together with 68.11, 68.12, 68.13.
  3001.     The function call will be ignored after creation of process heap
  3002.     with function 68.11.
  3003.        
  3004. ---------------------- Constants for registers: ----------------------
  3005.   eax - SF_MEMORY_RESIZE (64)
  3006. ======================================================================
  3007. ======== Function 65 - draw image with palette in the window. ========
  3008. ======================================================================
  3009. Parameters:
  3010.   * eax = 65 - function number
  3011.   * ebx = pointer to the image
  3012.   * ecx = [size on axis x]*65536 + [size on axis y]
  3013.   * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
  3014.   * esi = number of bits per pixel, must be 1,2,4,8,9,15,16,24 or 32;
  3015.   * edi = pointer to palette (2 to the power esi colors 0x00RRGGBB);
  3016.           ignored when esi > 8
  3017.   * ebp = offset of next row data relative to previous row data
  3018. Returned value:
  3019.   * function does not return value
  3020. Remarks:
  3021.   * Coordinates of the image are coordinates of the upper left corner
  3022.     of the image relative to the window.
  3023.   * Format of image with 1 bit per pixel: each byte of image
  3024.     (possibly excluding last bytes in rows), contains information on
  3025.     the color of 8 pixels, MSB corresponds to first pixel.
  3026.   * Format of image with 2 bits per pixel: each byte of image
  3027.     (possibly excluding last bytes in rows), contains information on
  3028.     the color of 4 pixels, two MSBs correspond to first pixel.
  3029.   * Format of image with 4 bits per pixel: each byte of image
  3030.     excluding last bytes in rows (if width is odd) contains
  3031.     information on the color of 2 pixels, high-order tetrad
  3032.     corresponds to first pixel.
  3033.   * Format of image with 8 bits per pixel: each byte of image is
  3034.     index in the palette.
  3035.   * Format of image with 9 bits per pixel: array of one byte values;
  3036.     each byte (8 bit) represents the intensity of gray for one pixel;
  3037.     this format is equal to 8bpp without palette.
  3038.   * Format of image with 15 bits per pixel: the color of each pixel
  3039.     is coded as (bit representation) 0RRRRRGGGGGBBBBB - 5 bits per
  3040.     each color.
  3041.   * Format of image with 16 bits per pixel: the color of each pixel
  3042.     is coded as RRRRRGGGGGGBBBBB (5+6+5).
  3043.   * Format of image with 24 bits per pixel: the color of each pixel
  3044.     is coded as 3 bytes - sequentially blue, green, red components.
  3045.   * Format of image with 32 bits per pixel: similar to 24, but
  3046.     one additional ignored byte is present. It's format is BGRX,
  3047.     where X is the ignored byte.
  3048.   * The call to function 7 is equivalent to call to this function
  3049.     with esi=24, ebp=0.
  3050.  
  3051. ---------------------- Constants for registers: ----------------------
  3052.   eax - SF_PUT_IMAGE_EXT (65)
  3053. ======================================================================
  3054. ================== Function 66 - work with keyboard. =================
  3055. ======================================================================
  3056. The input mode influences results of reading keys by function 2.
  3057. When a program loads, ASCII input mode is set for it.
  3058.  
  3059. -------------- Subfunction 1 - set keyboard input mode. --------------
  3060. Parameters:
  3061.   * eax = 66 - function number
  3062.   * ebx = 1 - subfunction number
  3063.   * ecx = mode:
  3064.     * 0 = normal (ASCII-characters)
  3065.     * 1 = scancodes
  3066. Returned value:
  3067.   * function does not return value
  3068.  
  3069. -------------- Subfunction 2 - get keyboard input mode. --------------
  3070. Parameters:
  3071.   * eax = 66 - function number
  3072.   * ebx = 2 - subfunction number
  3073. Returned value:
  3074.   * eax = current mode
  3075.  
  3076. ------------ Subfunction 3 - get status of control keys. -------------
  3077. Parameters:
  3078.   * eax = 66 - function number
  3079.   * ebx = 3 - subfunction number
  3080. Returned value:
  3081.   * eax = bit mask:
  3082.   * bit 0  (mask 1): left Shift is pressed
  3083.   * bit 1  (mask 2): right Shift is pressed
  3084.   * bit 2  (mask 4): left Ctrl is pressed
  3085.   * bit 3  (mask 8): right Ctrl is pressed
  3086.   * bit 4  (mask 0x10): left Alt is pressed
  3087.   * bit 5  (mask 0x20): right Alt is pressed
  3088.   * bit 6  (mask 0x40): CapsLock is on
  3089.   * bit 7  (mask 0x80): NumLock is on
  3090.   * bit 8  (mask 0x100): ScrollLock is on
  3091.   * bit 9  (mask 0x200): left Win is pressed
  3092.   * bit 10 (mask 0x400): right Win is pressed
  3093.   * other bits are cleared
  3094.  
  3095. -------------- Subfunction 4 - set system-wide hotkey. ---------------
  3096. When hotkey is pressed, the system notifies only those applications,
  3097. which have installed it; the active application (which receives
  3098. all normal input) does not receive such keys.
  3099. The notification consists in sending event with the code 2.
  3100. Reading hotkey is the same as reading normal key - by function 2.
  3101. Parameters:
  3102.   * eax = 66 - function number
  3103.   * ebx = 4 - subfunction number
  3104.   * cl determines key scancode;
  3105.     use cl=0 to give combinations such as Ctrl+Shift
  3106.   * edx = 0xXYZ determines possible states of control keys:
  3107.     * Z (low 4 bits) determines state of LShift and RShift:
  3108.       * 0 = no key must be pressed;
  3109.       * 1 = exactly one key must be pressed;
  3110.       * 2 = both keys must be pressed;
  3111.       * 3 = must be pressed LShift, but not RShift;
  3112.       * 4 = must be pressed RShift, but not LShift
  3113.     * Y - similar for LCtrl and RCtrl;
  3114.     * X - similar for LAlt and RAlt
  3115. Returned value:
  3116.   * eax=0 - success
  3117.   * eax=1 - too many hotkeys (maximum 256 are allowed)
  3118. Remarks:
  3119.   * Hotkey can work either at pressing or at release. Release
  3120.     scancode of a key is more on 128 than pressing scancode
  3121.     (i.e. high bit is set).
  3122.   * Several applications can set the same combination;
  3123.     all such applications will be informed on pressing
  3124.     such combination.
  3125.  
  3126. -------------- Subfunction 5 - delete installed hotkey. --------------
  3127. Parameters:
  3128.   * eax = 66 - function number
  3129.   * ebx = 5 - subfunction number
  3130.   * cl = scancode of key and edx = 0xXYZ the same as in subfunction 4
  3131. Returned value:
  3132.   * eax = 0 - success
  3133.   * eax = 1 - there is no such hotkey
  3134. Remarks:
  3135.   * When a process/thread terminates, all hotkey installed by it are
  3136.     deleted.
  3137.   * The call to this subfunction does not affect other applications.
  3138.     If other application has defined the same combination, it will
  3139.     still receive notices.
  3140.  
  3141. --------------- Subfunction 6 - block the normal input. --------------
  3142. Parameters:
  3143.   * eax = 66 - function number
  3144.   * ebx = 6 - subfunction number
  3145. Returned value:
  3146.   * function does not return value
  3147. Remarks:
  3148.   * Blocking the normal keyboard input for installed hotkeys
  3149.   * To emulate a mouse via the keyboard, the application MOUSEMUL
  3150.  
  3151. ------------ Subfunction 7 - unlock the normal input. ----------------
  3152. Parameters:
  3153.   * eax = 66 - function number
  3154.   * ebx = 7 - subfunction number
  3155. Returned value:
  3156.   * function does not return value
  3157. Remarks:
  3158.   * Unlocking the results of the f. 66.6
  3159.   * To emulate a mouse via the keyboard, the application MOUSEMUL
  3160.  
  3161. ---------------------- Constants for registers: ----------------------
  3162.   eax - SF_KEYBOARD (66)
  3163.   ebx - SSF_SET_INPUT_MODE (1), SSF_GET_INPUT_MODE (2),
  3164.     SSF_GET_CONTROL_KEYS (3), SSF_SET_SYS_HOTKEY (4),
  3165.     SSF_DEL_SYS_HOTKEY (5),  SSF_LOCK_INPUT (6), SSF_UNLOCK_INPUT (7)
  3166. ======================================================================
  3167. ========= Function 67 - change position/sizes of the window. =========
  3168. ======================================================================
  3169. Parameters:
  3170.   * eax = 67 - function number
  3171.   * ebx = new x-coordinate of the window
  3172.   * ecx = new y-coordinate of the window
  3173.   * edx = new x-size of the window
  3174.   * esi = new y-size of the window
  3175. Returned value:
  3176.   * function does not return value
  3177. Remarks:
  3178.   * The value -1 for a parameter means "do not change"; e.g. to move
  3179.     the window without resizing it is possible to specify edx=esi=-1.
  3180.   * Previously the window must be defined by function 0.
  3181.     It sets initial coordinates and sizes of the window.
  3182.   * Sizes of the window are understood in sense of function 0,
  3183.     that is one pixel less than real sizes.
  3184.   * The function call for maximized windows is simply ignored.
  3185.   * For windows of appropriate styles position and/or sizes can be
  3186.     changed by user; current position and sizes can be obtained by
  3187.     call to function 9.
  3188.   * The function sends to the window redraw event (with the code 1).
  3189.  
  3190. ---------------------- Constants for registers: ----------------------
  3191.   eax - SF_CHANGE_WINDOW (67)
  3192. ======================================================================
  3193. ====== Function 68, subfunction 0 - get the task switch counter. =====
  3194. ======================================================================
  3195. Parameters:
  3196.   * eax = 68 - function number
  3197.   * ebx = 0 - subfunction number
  3198. Returned value:
  3199.   * eax = number of task switches from the system booting
  3200.     (modulo 2^32)
  3201.  
  3202. ---------------------- Constants for registers: ----------------------
  3203.   eax - SF_SYS_MISC (68)
  3204.   ebx - SSF_GET_TASK_SWITCH_COUNT (0)
  3205. ======================================================================
  3206. ======= Function 68, subfunction 1 - switch to the next thread. ======
  3207. ======================================================================
  3208. The function completes the current time slice allocated to the
  3209. thread and switches to the next. (Which thread in which process
  3210. will be next, is unpredictable). Later, when execution queue
  3211. will reach the current thread, execution will be continued.
  3212. Parameters:
  3213.   * eax = 68 - function number
  3214.   * ebx = 1 - subfunction number
  3215. Returned value:
  3216.   * function does not return value
  3217.  
  3218. ---------------------- Constants for registers: ----------------------
  3219.   eax - SF_SYS_MISC (68)
  3220.   ebx - SSF_SWITCH_TASK (1)
  3221. ======================================================================
  3222. ============= Function 68, subfunction 2 - cache + rdpmc. ============
  3223. ======================================================================
  3224. Parameters:
  3225.   * eax = 68 - function number
  3226.   * ebx = 2 - subfunction number
  3227.   * ecx = required action:
  3228.     * ecx = 0 - enable instruction 'rdpmc'
  3229.       (ReaD Performance-Monitoring Counters) for applications
  3230.     * ecx = 1 - find out whether cache is disabled/enabled
  3231.     * ecx = 2 - enable cache
  3232.     * ecx = 3 - disable cache
  3233. Returned value:
  3234.   * for ecx=0:
  3235.     * eax = the value of cr4
  3236.   * for ecx=1:
  3237.     * eax = (cr0 and 0x60000000):
  3238.     * eax = 0 - cache is on
  3239.     * eax <> 0 - cache is off
  3240.   * for ecx=2 and ecx=3:
  3241.     * function does not return value
  3242.  
  3243. ---------------------- Constants for registers: ----------------------
  3244.   eax - SF_SYS_MISC (68)
  3245.   ebx - SSF_PERFORMANCE (2)
  3246.   ecx - SSSF_ALLOW_RDPMC (0), SSSF_CACHE_STATUS (1),
  3247.     SSSF_CACHE_ON (2), SSSF_CACHE_OFF (3)
  3248. ======================================================================
  3249. =========== Function 68, subfunction 3 - read MSR-register. ==========
  3250. ======================================================================
  3251. MSR = Model Specific Register; the complete list of MSR-registers
  3252. of a processor is included to the documentation on it (for example,
  3253. IA-32 Intel Architecture Software Developer's Manual,
  3254. Volume 3, Appendix B); each processor family has its own subset
  3255. of the MSR-registers.
  3256. Parameters:
  3257.   * eax = 68 - function number
  3258.   * ebx = 3 - subfunction number
  3259.   * ecx is ignored
  3260.   * edx = MSR address
  3261. Returned value:
  3262.   * ebx:eax = high:low dword of the result
  3263. Remarks:
  3264.   * If ecx contains nonexistent or not implemented for this processor
  3265.     MSR, processor will generate an exception in the kernel, which
  3266.     will kill the thread.
  3267.   * Previously it is necessary to check, whether MSRs are supported
  3268.     as a whole, with the instruction 'cpuid'. Otherwise processor
  3269.     will generate other exception in the kernel, which will anyway
  3270.     kill the thread.
  3271.  
  3272. ---------------------- Constants for registers: ----------------------
  3273.   eax - SF_SYS_MISC (68)
  3274.   ebx - SSF_READ_MSR (3)
  3275. ======================================================================
  3276. ========= Function 68, subfunction 4 - write to MSR-register. ========
  3277. ======================================================================
  3278. MSR = Model Specific Register; the complete list of MSR-registers
  3279. of a processor is included to the documentation on it (for example,
  3280. IA-32 Intel Architecture Software Developer's Manual,
  3281. Volume 3, Appendix B); each processor family has its own subset
  3282. of the MSR-registers.
  3283. Parameters:
  3284.   * eax = 68 - function number
  3285.   * ebx = 4 - subfunction number
  3286.   * ecx is ignored
  3287.   * edx = MSR address
  3288.   * esi:edi = high:low dword
  3289. Returned value:
  3290.   * function does not return value
  3291. Remarks:
  3292.   * If ecx contains nonexistent or not implemented for this processor
  3293.     MSR, processor will generate an exception in the kernel, which
  3294.     will kill the thread.
  3295.   * Previously it is necessary to check, whether MSRs are supported
  3296.     as a whole, with the instruction 'cpuid'. Otherwise processor
  3297.     will generate other exception in the kernel, which will anyway
  3298.     kill the thread.
  3299.  
  3300. ---------------------- Constants for registers: ----------------------
  3301.   eax - SF_SYS_MISC (68)
  3302.   ebx - SSF_WRITE_MSR (4)
  3303. ======================================================================
  3304. === Function 68, subfunction 11 - initialize process heap ============
  3305. ======================================================================
  3306. Parameters:
  3307.   * eax = 68 - function number
  3308.   * ebx = 11 - subfunction number
  3309. Returned value:
  3310.   * eax = 0 - failed
  3311.   * otherwise size of created heap
  3312. Remarks:
  3313.   * The function call initializes heap for subfunctions 12, 13 and 20.
  3314.   * If the process heap is already created, this function will return
  3315.     the size of the existing heap.
  3316.     Heap size is equal to total amount of free application memory.
  3317.   * After creation of the heap calls to function 64 will be ignored.
  3318.  
  3319. ---------------------- Constants for registers: ----------------------
  3320.   eax - SF_SYS_MISC (68)
  3321.   ebx - SSF_HEAP_INIT (11)
  3322. ======================================================================
  3323. ======== Function 68, subfunction 12 - allocate memory block. ========
  3324. ======================================================================
  3325. Parameters:
  3326.   * eax = 68 - function number
  3327.   * ebx = 12 - subfunction number
  3328.   * ecx = required size in bytes
  3329. Returned value:
  3330.   * eax = pointer to the allocated block
  3331. Remarks:
  3332.   * The function allocates an integer number of pages (4 Kb) in such
  3333.     way that the real size of allocated block is more than or equal to
  3334.     requested size.
  3335.  
  3336. ---------------------- Constants for registers: ----------------------
  3337.   eax - SF_SYS_MISC (68)
  3338.   ebx - SSF_MEM_ALLOC (12)
  3339. ======================================================================
  3340. ========== Function 68, subfunction 13 - free memory block. ==========
  3341. ======================================================================
  3342. Parameters:
  3343.   * eax = 68 - function number
  3344.   * ebx = 13 - subfunction number
  3345.   * ecx = pointer to the memory block
  3346. Returned value:
  3347.   * eax = 1 - success
  3348.   * eax = 0 - failed
  3349. Remarks:
  3350.   * The memory block must have been allocated by subfunction 12
  3351.     or subfunction 20.
  3352.  
  3353. ---------------------- Constants for registers: ----------------------
  3354.   eax - SF_SYS_MISC (68)
  3355.   ebx - SSF_MEM_FREE (13)
  3356. ======================================================================
  3357. ===================== Function 68, subfunction 14 ====================
  3358. ============ Wait for signal from another program/driver. ============
  3359. ======================================================================
  3360. Parameters:
  3361.   * eax = 68 - function number
  3362.   * ebx = 14 - subfunction number
  3363.   * ecx = pointer to the buffer for information (24 bytes)
  3364. Returned value:
  3365.   * buffer pointed to by ecx contains the following information:
  3366.     * +0: dword: identifier for following data of signal
  3367.     * +4: dword: data of signal (20 bytes), format of which is defined
  3368.           by the first dword
  3369.  
  3370. ---------------------- Constants for registers: ----------------------
  3371.   eax - SF_SYS_MISC (68)
  3372.   ebx - SSF_WAIT_SIGNAL (14)
  3373. ======================================================================
  3374. ============= Function 68, subfunction 16 - load driver. =============
  3375. ======================================================================
  3376. Parameters:
  3377.   * eax = 68 - function number
  3378.   * ebx = 16 - subfunction number
  3379.   * ecx = pointer to ASCIIZ-string with driver name
  3380. Returned value:
  3381.   * eax = 0 - failed
  3382.   * otherwise eax = driver handle
  3383. Remarks:
  3384.   * If the driver was not loaded yet, it is loaded;
  3385.     if the driver was loaded yet, nothing happens.
  3386.   * Driver name is case-sensitive.
  3387.     Maximum length of the name is 16 characters, including
  3388.     terminating null character, the rest is ignored.
  3389.   * Driver ABC is loaded from file /sys/drivers/ABC.sys.
  3390.  
  3391. ---------------------- Constants for registers: ----------------------
  3392.   eax - SF_SYS_MISC (68)
  3393.   ebx - SSF_LOAD_DRIVER (16)
  3394. ======================================================================
  3395. ============ Function 68, subfunction 17 - driver control. ===========
  3396. ======================================================================
  3397. Parameters:
  3398.   * eax = 68 - function number
  3399.   * ebx = 17 - subfunction number
  3400.   * ecx = pointer to the control structure:
  3401.     * +0: dword: handle of driver
  3402.     * +4: dword: code of driver function
  3403.     * +8: dword: pointer to input data
  3404.     * +12 = +0xC: dword: size of input data
  3405.     * +16 = +0x10: dword: pointer to output data
  3406.     * +20 = +0x14: dword: size of output data
  3407. Returned value:
  3408.   * eax = determined by driver
  3409. Remarks:
  3410.   * Function codes and the structure of input/output data
  3411.     are defined by driver.
  3412.   * Previously one must obtain driver handle by subfunction 16.
  3413.  
  3414. ---------------------- Constants for registers: ----------------------
  3415.   eax - SF_SYS_MISC (68)
  3416.   ebx - SSF_CONTROL_DRIVER (17)
  3417. ======================================================================
  3418. == Function 68, subfunction 18 - load DLL, specifying the encoding. ==
  3419. ======================================================================
  3420. Parameters:
  3421.   * eax = 68 - function number
  3422.   * ebx = 18 - subfunction number
  3423.   * ecx = pointer to the string with path to DLL
  3424.   * edx = string encoding, details can be found in function 80 description.
  3425. Returned value:
  3426.   * eax = 0 - failed
  3427.   * otherwise eax = pointer to DLL export table
  3428. Remarks:
  3429.   * Export table is an array of structures of 2 dword's, terminated
  3430.     by zero. The first dword in structure points to function name,
  3431.     the second dword contains address of function.
  3432.  
  3433. ======================================================================
  3434. =============== Function 68, subfunction 19 - load DLL. ==============
  3435. ======================================================================
  3436. Parameters:
  3437.   * eax = 68 - function number
  3438.   * ebx = 19 - subfunction number
  3439.   * ecx = pointer to the string with path to DLL,
  3440.     rules of path forming can be found in function 70 description.
  3441. Returned value:
  3442.   * eax = 0 - failed
  3443.   * otherwise eax = pointer to DLL export table
  3444.  
  3445. ---------------------- Constants for registers: ----------------------
  3446.   eax - SF_SYS_MISC (68)
  3447.   ebx - SSF_LOAD_DLL (19)
  3448. ======================================================================
  3449. ======= Function 68, subfunction 20 - reallocate memory block. =======
  3450. ======================================================================
  3451. Parameters:
  3452.   * eax = 68 - function number
  3453.   * ebx = 20 - subfunction number
  3454.   * ecx = new size in bytes
  3455.   * edx = pointer to already allocated block
  3456. Returned value:
  3457.   * eax = pointer to the reallocated block, 0 = error
  3458. Remarks:
  3459.   * Before this call one must initialize process heap by call to
  3460.     subfunction 11.
  3461.   * The function allocates an integer number of pages (4 Kb) in such
  3462.     way that the real size of allocated block is more than or equal to
  3463.     requested size.
  3464.   * If edx=0, the function call is equivalent to memory allocation
  3465.     with subfunction 12. Otherwise the block at edx
  3466.     must be allocated earlier with subfunction 12 or this subfunction.
  3467.   * If ecx=0, the function frees memory block at edx and returns 0.
  3468.   * The contents of the block are unchanged up to the shorter of
  3469.     the new and old sizes.
  3470.  
  3471. ---------------------- Constants for registers: ----------------------
  3472.   eax - SF_SYS_MISC (68)
  3473.   ebx - SSF_MEM_REALLOC (20)
  3474. ======================================================================
  3475. =========== Function 68, subfunction 21 - load driver PE. ============
  3476. ======================================================================
  3477. Parameters:
  3478.   * eax = 68 - function number
  3479.   * ebx = 21 - subfunction number
  3480.   * ecx = pointer to ASCIIZ-string with driver name
  3481.   * edx = pointer to command line
  3482. Returned value:
  3483.   * eax = 0 - failed
  3484.   * otherwise eax = driver handle
  3485. Remarks:
  3486.   * If the driver was not loaded yet, it is loaded;
  3487.     if the driver was loaded yet, nothing happens.
  3488.  
  3489. ---------------------- Constants for registers: ----------------------
  3490.   eax - SF_SYS_MISC (68)
  3491.   ebx - SSF_LOAD_DRIVER_PE (21)
  3492. ======================================================================
  3493. ======== Function 68, subfunction 22 - open named memory area. =======
  3494. ======================================================================
  3495. Parameters:
  3496.   * eax = 68 - function number
  3497.   * ebx = 22 - subfunction number
  3498.   * ecx = area name. Maximum of 31 characters with terminating zero
  3499.   * edx = area size in bytes for SHM_CREATE and SHM_OPEN_ALWAYS
  3500.   * esi = flags for open and access:
  3501.     * SHM_OPEN        = 0x00 - open existing memory area. If an area
  3502.                           with such name does not exist, the function
  3503.                           will return error code 5.
  3504.     * SHM_OPEN_ALWAYS = 0x04 - open existing or create new
  3505.                           memory area.
  3506.     * SHM_CREATE      = 0x08 - create new memory area. If an area
  3507.                           with such name already exists, the function
  3508.                           will return error code 10.
  3509.     * SHM_READ        = 0x00 - only read access
  3510.     * SHM_WRITE       = 0x01 - read and write access
  3511. Returned value:
  3512.   * eax = pointer to memory area, 0 if error has occurred
  3513.   * if new area is created (SHM_CREATE or SHM_OPEN_ALWAYS):
  3514.     edx = 0 - success, otherwise - error code
  3515.   * if existing area is opened (SHM_OPEN or SHM_OPEN_ALWAYS):
  3516.     edx = error code (if eax=0) or area size in bytes
  3517. Error codes:
  3518.   * E_NOTFOUND = 5
  3519.   * E_ACCESS = 10
  3520.   * E_NOMEM = 30
  3521.   * E_PARAM = 33
  3522. Remarks:
  3523.   * Before this call one must initialize process heap by call to
  3524.     subfunction 11.
  3525.   * If a new area is created, access flags set maximal rights
  3526.     for other processes. An attempt from other process to open
  3527.     with denied rights will fail with error code E_ACCESS.
  3528.   * The process which has created an area always has write access.
  3529.  
  3530. ---------------------- Constants for registers: ----------------------
  3531.   eax - SF_SYS_MISC (68)
  3532.   ebx - SSF_MEM_OPEN (22)
  3533. ======================================================================
  3534. ======= Function 68, subfunction 23 - close named memory area. =======
  3535. ======================================================================
  3536. Parameters:
  3537.   * eax = 68 - function number
  3538.   * ebx = 23 - subfunction number
  3539.   * ecx = area name. Maximum of 31 characters with terminating zero
  3540. Returned value:
  3541.   * eax destroyed
  3542. Remarks:
  3543.   * A memory area is physically freed (with deleting all data and
  3544.     freeing physical memory), when all threads which have opened
  3545.     this area will close it.
  3546.   * When thread is terminating, all opened by it areas are closed.
  3547.  
  3548. ---------------------- Constants for registers: ----------------------
  3549.   eax - SF_SYS_MISC (68)
  3550.   ebx - SSF_MEM_CLOSE (23)
  3551. ======================================================================
  3552. ======== Function 68, subfunction 24 - set exception handler. ========
  3553. ======================================================================
  3554. Parameters:
  3555.   * eax = 68 - function number
  3556.   * ebx = 24 - subfunction number
  3557.   * ecx = address of the new exception handler
  3558.   * edx = the mask of handled exceptions
  3559. Returned value:
  3560.   * eax = address of the old exception handler (0, if it was not set)
  3561.   * ebx = the old mask of handled exceptions
  3562. Remarks:
  3563.   * Bit number in mask of exceptions corresponds to exception number
  3564.     in CPU-specification (Intel-PC). For example, FPU exceptions have
  3565.     number 16 (#MF), and SSE exceptions - 19 (#XF).
  3566.   * The current implementation ignores the inquiry for hook of 7
  3567.     exception - the system handles #NM by its own.
  3568.   * The exception handler is called with exception number as first
  3569.     (and only) stack parameter. So, correct exit from the handler is
  3570.     RET 4. It returns to the instruction, that caused the exception,
  3571.     for faults, and to the next instruction for traps (see
  3572.     classification of exceptions in CPU specification).
  3573.   * When user handler receives control, the corresponding bit in
  3574.     the exception mask is cleared. Raising this exception
  3575.     in consequence leads to default handling, that is,
  3576.     terminating the application in absence of debugger or
  3577.     suspend with notification of debugger otherwise.
  3578.   * After user handler completes critical operations, it can set
  3579.     the corresponding bit in the exception mask with subfunction 25.
  3580.     Also user handler is responsible for clearing exceptions flags in
  3581.     FPU and/or SSE.
  3582.  
  3583. ---------------------- Constants for registers: ----------------------
  3584.   eax - SF_SYS_MISC (68)
  3585.   ebx - SSF_SET_EXCEPTION_HANDLER (24)
  3586. ======================================================================
  3587. ======== Function 68, subfunction 25 - set exception activity ========
  3588. ======================================================================
  3589. Parameters:
  3590.   * eax = 68 - function number
  3591.   * ebx = 25 - subfunction number
  3592.   * ecx = signal number
  3593.   * edx = value of activity (0/1)
  3594. Returned value:
  3595.   * eax = -1 - invalid signal number
  3596.   * otherwise eax = old value of activity for this signal (0/1)
  3597. Remarks:
  3598.   * In current implementation only mask for user exception handler,
  3599.     which has been previously set by subfunction 24,
  3600.     is changed. Signal number corresponds to exception number.
  3601.  
  3602. ---------------------- Constants for registers: ----------------------
  3603.   eax - SF_SYS_MISC (68)
  3604.   ebx - SSF_SET_EXCEPTION_STATE (25)
  3605. ======================================================================
  3606. ====== Function 68, subfunction 26 - release memory pages ============
  3607. ======================================================================
  3608. Parameters:
  3609.   * eax = 68 - function number
  3610.   * ebx = 26 - subfunction number
  3611.   * ecx = pointer to the memory block, allocated by subfunction 12
  3612.   * edx = offset from the block beginnings
  3613.   * esi = the size of the region of memory to release, in bytes
  3614. Remarks:
  3615.   * function release range of pages from ecx+edx to ecx+edx+esi
  3616.     and set virtual memory into reserved state.
  3617.  
  3618. ---------------------- Constants for registers: ----------------------
  3619.   eax - SF_SYS_MISC (68)
  3620.   ebx - SSF_MEM_FREE_EXT (26)
  3621. ======================================================================
  3622. ========== Function 68, subfunction 27 - load file ===================
  3623. ======================================================================
  3624. Parameters:
  3625.   * eax = 68 - function number
  3626.   * ebx = 27 - subfunction number
  3627.   * ecx = pointer to the string with path to file,
  3628.     rules of path forming can be found in function 70 description.
  3629. Returned value:
  3630.   * eax = pointer to the loaded file, or zero
  3631.   * edx = size of the loaded file, or zero
  3632. Remarks:
  3633.   * function loads file and unpacks, if necessary
  3634.   * Before this call one must initialize process heap by call to
  3635.     subfunction 11.  
  3636.  
  3637. ---------------------- Constants for registers: ----------------------
  3638.   eax - SF_SYS_MISC (68)
  3639.   ebx - SSF_LOAD_FILE (27)
  3640. ======================================================================
  3641. == Function 68, subfunction 28 - load file, specifying the encoding ==
  3642. ======================================================================
  3643. Parameters:
  3644.   * eax = 68 - function number
  3645.   * ebx = 28 - subfunction number
  3646.   * ecx = pointer to the string with path to file
  3647.   * edx = string encoding, details can be found in function 80 description.
  3648. Returned value:
  3649.   * eax = pointer to the loaded file, or zero
  3650.   * edx = size of the loaded file, or zero
  3651. Remarks:
  3652.   * function loads file and unpacks, if necessary
  3653. ======================================================================
  3654. ======== Function 68, subfunction 29 - allocate ring memory. =========
  3655. ======================================================================
  3656. Parameters:
  3657.   * eax = 68 - function number
  3658.   * ebx = 29 - subfunction number
  3659.   * ecx = required size in bytes
  3660. Returned value:
  3661.   * eax = 0 - failed
  3662.   * eax = pointer to the allocated ring
  3663. Remarks:
  3664.   * The requested size must be an exact multiple of pagesize (4 Kb)
  3665.   * The function allocates memory in such a way that you can read and
  3666.     write beyond the size of the allocated memory and will reach the
  3667.     beginning of the buffer again.
  3668.  
  3669. ---------------------- Constants for registers: ----------------------
  3670.   eax - SF_SYS_MISC (68)
  3671.   ebx - SSF_MEM_ALLOC_RING (29)  
  3672.  
  3673. ======================================================================
  3674. =========== Function 68, subfunction 31 - get driver data. ===========
  3675. ======================================================================
  3676. Driver structures are organized into a doubly linked list. Its head is
  3677. a dummy structure with the forward and backward pointers only. Other
  3678. structures, if any, are as follows:
  3679.   * +0: 16*byte: driver name, ASCIIZ
  3680.   * +16 = +0x10: dword: pointer to the next driver structure
  3681.   * +20 = +0x14: dword: pointer to the previous driver structure
  3682.   * +24 = +0x18: dword: driver's base address
  3683.   * +28 = +0x1C: dword: driver's entry point address
  3684.   * +32 = +0x20: dword: driver's service handler address
  3685.  
  3686. -------------- Subsubfunction 1 - get driver list head. --------------
  3687. Parameters:
  3688.   * eax = 68 - function number
  3689.   * ebx = 31 - subfunction number
  3690.   * ecx = 1 - subsubfunction number
  3691. Returned value:
  3692.   * ebx = pointer to the next driver structure
  3693.   * ecx = pointer to the previous driver structure
  3694.  
  3695. --------- Subsubfunction 2 - get driver list item by pointer. --------
  3696. Parameters:
  3697.   * eax = 68 - function number
  3698.   * ebx = 31 - subfunction number
  3699.   * ecx = 2 - subsubfunction number
  3700.   * edx = pointer to the list item
  3701.   * edi = pointer to memory for driver data
  3702. Returned value:
  3703.   * eax = 0 (ok), -1 (error)
  3704.  
  3705. ======================================================================
  3706. ====================== Function 69 - debugging. ======================
  3707. ======================================================================
  3708. A process can load other process as debugged by set of corresponding
  3709. bit by call to subfunction 7 of function 70.
  3710. A process can have only one debugger; one process can debug some
  3711. others. The system notifies debugger on events occurring with
  3712. debugged process. Messages are written to the buffer defined by
  3713. subfunction 0.
  3714. Format of a message:
  3715.   * +0: dword: message code
  3716.   * +4: dword: PID of debugged process
  3717.   * +8: there can be additional data depending on message code
  3718. Message codes:
  3719.   * 1 = exception
  3720.     * in addition dword-number of the exception is given
  3721.     * process is suspended
  3722.   * 2 = process has terminated
  3723.     * comes at any termination: both through the system function -1,
  3724.       and at "murder" by any other process (including debugger itself)
  3725.   * 3 = debug exception int 1 = #DB
  3726.     * in addition dword-image of the register DR6 is given:
  3727.       * bits 0-3: condition of the corresponding breakpoint (set by
  3728.         subfunction 9) is satisfied
  3729.       * bit 14: exception has occurred because of the trace mode
  3730.         (flag TF is set TF)
  3731.     * process is suspended
  3732. When debugger terminates, all debugged processes are killed.
  3733. If debugger does not want this, it must previously detach by
  3734. subfunction 3.
  3735.  
  3736. All subfunctions are applicable only to processes/threads started
  3737. from the current by function 70 with set debugging flag.
  3738. Debugging of multithreaded programs is not supported yet.
  3739. The full list of subfunctions:
  3740.   * subfunction 0 - define data area for debug messages
  3741.   * subfunction 1 - get contents of registers of debugged thread
  3742.   * subfunction 2 - set contents of registers of debugged thread
  3743.   * subfunction 3 - detach from debugged process
  3744.   * subfunction 4 - suspend debugged thread
  3745.   * subfunction 5 - resume debugged thread
  3746.   * subfunction 6 - read from the memory of debugged process
  3747.   * subfunction 7 - write to the memory of debugged process
  3748.   * subfunction 8 - terminate debugged thread
  3749.   * subfunction 9 - set/clear hardware breakpoint
  3750.  
  3751. ---------------------- Constants for registers: ----------------------
  3752.   eax - SF_DEBUG (69)
  3753.   ebx - SSF_SET_MESSAGE_AREA (0), SSF_GET_REGISTERS (1),
  3754.     SSF_SET_REGISTERS (2), SSF_DETACH (3), SSF_SUSPEND (4),
  3755.     SSF_RESUME (5), SSF_READ_MEMORY (6), SSF_WRITE_MEMORY (7),
  3756.     SSF_TERMINATE (8), SSF_DEFINE_BREAKPOINT (9)
  3757. ======================================================================
  3758. = Function 69, subfunction 0 - define data area for debug messages. ==
  3759. ======================================================================
  3760. Parameters:
  3761.   * eax = 69 - function number
  3762.   * ebx = 0 - subfunction number
  3763.   * ecx = pointer
  3764. Format of data area:
  3765.   * +0: dword: N = buffer size (not including this header)
  3766.   * +4: dword: occupied place
  3767.   * +8: N*byte: buffer
  3768. Returned value:
  3769.   * function does not return value
  3770. Remarks:
  3771.   * If the size field is negative, the buffer is considered locked
  3772.     and at arrival of new message the system will wait.
  3773.     For synchronization frame all work with the buffer by operations
  3774.     lock/unlock
  3775.         neg     [bufsize]
  3776.   * Data in the buffer are considered as array of items with variable
  3777.     length - messages. Format of a message is explained in
  3778.     general description.
  3779.  
  3780. ---------------------- Constants for registers: ----------------------
  3781.   eax - SF_DEBUG (69)
  3782.   ebx - SSF_SET_MESSAGE_AREA (0)
  3783. ======================================================================
  3784. ===================== Function 69, subfunction 1 =====================
  3785. ============ Get contents of registers of debugged thread. ===========
  3786. ======================================================================
  3787. Parameters:
  3788.   * eax = 69 - function number
  3789.   * ebx = 1 - subfunction number
  3790.   * ecx = thread identifier
  3791.   * edx = size of context structure, must be 0x28=40 bytes
  3792.   * esi = pointer to context structure
  3793. Returned value:
  3794.   * function does not return value
  3795. Format of context structure: (FPU is not supported yet)
  3796.   * +0: dword: eip
  3797.   * +4: dword: eflags
  3798.   * +8: dword: eax
  3799.   * +12 = +0xC: dword: ecx
  3800.   * +16 = +0x10: dword: edx
  3801.   * +20 = +0x14: dword: ebx
  3802.   * +24 = +0x18: dword: esp
  3803.   * +28 = +0x1C: dword: ebp
  3804.   * +32 = +0x20: dword: esi
  3805.   * +36 = +0x24: dword: edi
  3806. Remarks:
  3807.   * If the thread executes code of ring-0, the function returns
  3808.     contents of registers of ring-3.
  3809.   * Process must be loaded for debugging (as is shown in
  3810.     general description).
  3811.  
  3812. ---------------------- Constants for registers: ----------------------
  3813.   eax - SF_DEBUG (69)
  3814.   ebx - SSF_GET_REGISTERS (1)
  3815. ======================================================================
  3816. ===================== Function 69, subfunction 2 =====================
  3817. ============ Set contents of registers of debugged thread. ===========
  3818. ======================================================================
  3819. Parameters:
  3820.   * eax = 69 - function number
  3821.   * ebx = 2 - subfunction number
  3822.   * ecx = thread identifier
  3823.   * edx = size of context structure, must be 0x28=40 bytes
  3824.   * esi -> context structure
  3825. Returned value:
  3826.   * function does not return value
  3827. Format of context structure is shown in the description of
  3828. subfunction 1.
  3829. Remarks:
  3830.   * If the thread executes code of ring-0, the function returns
  3831.     contents of registers of ring-3.
  3832.   * Process must be loaded for debugging (as is shown in
  3833.     general description).
  3834.  
  3835. ---------------------- Constants for registers: ----------------------
  3836.   eax - SF_DEBUG (69)
  3837.   ebx - SSF_SET_REGISTERS (2)
  3838. ======================================================================
  3839. ===== Function 69, subfunction 3 - detach from debugged process. =====
  3840. ======================================================================
  3841. Parameters:
  3842.   * eax = 69 - function number
  3843.   * ebx = 3 - subfunction number
  3844.   * ecx = identifier
  3845. Returned value:
  3846.   * function does not return value
  3847. Remarks:
  3848.   * If the process was suspended, it resumes execution.
  3849.  
  3850. ---------------------- Constants for registers: ----------------------
  3851.   eax - SF_DEBUG (69)
  3852.   ebx - SSF_DETACH (3)
  3853. ======================================================================
  3854. ======== Function 69, subfunction 4 - suspend debugged thread. =======
  3855. ======================================================================
  3856. Parameters:
  3857.   * eax = 69 - function number
  3858.   * ebx = 4 - subfunction number
  3859.   * ecx = thread identifier
  3860. Returned value:
  3861.   * function does not return value
  3862. Remarks:
  3863.   * Process must be loaded for debugging (as is shown in
  3864.     general description).
  3865.  
  3866. ---------------------- Constants for registers: ----------------------
  3867.   eax - SF_DEBUG (69)
  3868.   ebx - SSF_SUSPEND (4)
  3869. ======================================================================
  3870. ======== Function 69, subfunction 5 - resume debugged thread. ========
  3871. ======================================================================
  3872. Parameters:
  3873.   * eax = 69 - function number
  3874.   * ebx = 5 - subfunction number
  3875.   * ecx = thread identifier
  3876. Returned value:
  3877.   * function does not return value
  3878. Remarks:
  3879.   * Process must be loaded for debugging (as is shown in
  3880.     general description).
  3881.  
  3882. ---------------------- Constants for registers: ----------------------
  3883.   eax - SF_DEBUG (69)
  3884.   ebx - SSF_RESUME (5)
  3885. ======================================================================
  3886. = Fucntion 69, subfunction 6 - read from memory of debugged process. =
  3887. ======================================================================
  3888. Parameters:
  3889.   * eax = 69 - function number
  3890.   * ebx = 6 - subfunction number
  3891.   * ecx = identifier
  3892.   * edx = number of bytes to read
  3893.   * esi = address in the memory of debugged process
  3894.   * edi = pointer to buffer for data
  3895. Returned value:
  3896.   * eax = -1 at an error (invalid PID or buffer)
  3897.   * otherwise eax = number of read bytes (possibly, 0,
  3898.     if esi is too large)
  3899. Remarks:
  3900.   * Process must be loaded for debugging (as is shown in
  3901.     general description).
  3902.  
  3903. ---------------------- Constants for registers: ----------------------
  3904.   eax - SF_DEBUG (69)
  3905.   ebx - SSF_READ_MEMORY (6)
  3906. ======================================================================
  3907. == Function 69, subfunction 7 - write to memory of debugged process. =
  3908. ======================================================================
  3909. Parameters:
  3910.   * eax = 69 - function number
  3911.   * ebx = 7 - subfunction number
  3912.   * ecx = identifier
  3913.   * edx = number of bytes to write
  3914.   * esi = address of memory in debugged process
  3915.   * edi = pointer to data
  3916. Returned value:
  3917.   * eax = -1 at an error (invalid PID or buffer)
  3918.   * otherwise eax = number of written bytes (possibly, 0,
  3919.     if esi is too large)
  3920. Remarks:
  3921.   * Process must be loaded for debugging (as is shown in
  3922.     general description).
  3923.  
  3924. ---------------------- Constants for registers: ----------------------
  3925.   eax - SF_DEBUG (69)
  3926.   ebx - SSF_WRITE_MEMORY (7)
  3927. ======================================================================
  3928. ======= Function 69, subfunction 8 - terminate debugged thread. ======
  3929. ======================================================================
  3930. Parameters:
  3931.   * eax = 69 - function number
  3932.   * ebx = 8 - subfunction number
  3933.   * ecx = identifier
  3934. Returned value:
  3935.   * function does not return value
  3936. Remarks:
  3937.   * Process must be loaded for debugging (as is shown in
  3938.     general description).
  3939.   * The function is similar to subfunction 2 of function 18
  3940.     with two differences: it requires first remark and
  3941.     accepts PID rather than slot number.
  3942.  
  3943. ---------------------- Constants for registers: ----------------------
  3944.   eax - SF_DEBUG (69)
  3945.   ebx - SSF_TERMINATE (8)
  3946. ======================================================================
  3947. ===== Function 69, subfunction 9 - set/clear hardware breakpoint. ====
  3948. ======================================================================
  3949. Parameters:
  3950.   * eax = 69 - function number
  3951.   * ebx = 9 - subfunction number
  3952.   * ecx = thread identifier
  3953.   * dl = index of breakpoint, from 0 to 3 inclusively
  3954.   * dh = flags:
  3955.     * if high bit is cleared - set breakpoint:
  3956.       * bits 0-1 - condition:
  3957.         * 00 = breakpoint on execution
  3958.         * 01 = breakpoint on read
  3959.         * 11 = breakpoint on read/write
  3960.       * bits 2-3 - length; for breakpoints on exception it must be
  3961.         00, otherwise one of
  3962.         * 00 = byte
  3963.         * 01 = word
  3964.         * 11 = dword
  3965.       * esi = breakpoint address; must be aligned according to
  3966.         the length (i.e. must be even for word breakpoints,
  3967.         divisible by 4 for dword)
  3968.     * if high bit is set - clear breakpoint
  3969. Returned value:
  3970.   * eax = 0 - success
  3971.   * eax = 1 - error in the input data
  3972.   * eax = 2 - (reserved, is never returned in the current
  3973.     implementation) a global breakpoint with that index is already set
  3974. Remarks:
  3975.   * Process must be loaded for debugging (as is shown in
  3976.     general description).
  3977.   * Hardware breakpoints are implemented through DRx-registers of
  3978.     the processor, all limitations results from this.
  3979.   * The function can reinstall the breakpoint, previously set
  3980.     by it (and it does not inform on this).
  3981.     Carry on the list of set breakpoints in the debugger.
  3982.   * Breakpoints generate debug exception #DB, on which the system
  3983.     notifies debugger.
  3984.   * Breakpoints on write and read/write act after
  3985.     execution of the caused it instruction.
  3986.  
  3987. ---------------------- Constants for registers: ----------------------
  3988.   eax - SF_DEBUG (69)
  3989.   ebx - SSF_DEFINE_BREAKPOINT (9)
  3990. ======================================================================
  3991. ==== Function 70 - work with file system with long names support. ====
  3992. ======================================================================
  3993. Parameters:
  3994.   * eax = 70
  3995.   * ebx = pointer to the information structure
  3996. Returned value:
  3997.   * eax = 0 - success; otherwise file system error code
  3998.   * some subfunctions return value in other registers too
  3999. General format of the information structure:
  4000.   * +0: dword: subfunction number
  4001.   * +4: dword: offset in file or folder
  4002.   * +8: dword: higher part of offset or flags
  4003.   * +12 = +0xC: dword: size of data
  4004.   * +16 = +0x10: dword: pointer to data
  4005.   * +20 = +0x14: ?: path - zero terminated string
  4006.   or
  4007.   * +20 = +0x14: byte: 0
  4008.   * +21 = +0x15: dword: pointer to string
  4009. Case sensitivity depends on filesystem.
  4010. If a path not begins with '/', it is considered a relative.
  4011. To get or set the current folder, use the sysfunction 30.
  4012. '../' in the path means a lift by one folder relatively current folder.
  4013. To set the encoding, put at the start of the string a byte with next values:
  4014.   * 1 = cp866
  4015.   * 2 = UTF-16LE
  4016.   * 3 = UTF-8
  4017.   otherwise will be used cp866. In an absolute path
  4018.   you may put this byte after the '/' or put an additional '/' before it.
  4019.   Also, you may use the sysfunction 80.
  4020. Format of an absolute path:
  4021.   /base/number/dir1/dir2/.../dirn/file,
  4022. where base/number identifies device, on which file is located:
  4023.   * RD/1 = ramdisk
  4024.   * FD/1 = first floppy drive,
  4025.     FD/2 = second floppy drive
  4026.   * HD0/x, HD1/x, HD2/x, HD3/x = hard drives accordingly on
  4027.     IDE0 (Primary Master), IDE1 (Primary Slave),
  4028.     IDE2 (Secondary Master), IDE3 (Secondary Slave);
  4029.     x - partition number on the selected hard drive, starts from 1
  4030.   * CD0/1, CD1/1, CD2/1, CD3/1 = same for cd
  4031.   * SYS = system folder (encoding inaffected key),
  4032.     second key may be set by sysfunction 30.3.
  4033. Examples:
  4034.   * '/sys/example.asm',0
  4035.   * '/rd/1/example.asm',0
  4036.   * '/HD0/1/folder/file.txt',0
  4037.   * '/hd2/2/pics/tanzania.bmp',0
  4038.   * 2,'/',0,'sys','/',0,'F',0,'I',0,'L',0,'E',0,0,0
  4039.  
  4040. Available subfunctions:
  4041.   * subfunction 0 - read file
  4042.   * subfunction 1 - read folder
  4043.   * subfunction 2 - create/rewrite file
  4044.   * subfunction 3 - write to existing file
  4045.   * subfunction 4 - set file size
  4046.   * subfunction 5 - get attributes of file/folder
  4047.   * subfunction 6 - set attributes of file/folder
  4048.   * subfunction 7 - start application
  4049.   * subfunction 8 - delete file/folder
  4050.   * subfunction 9 - create folder
  4051. For CD-drives due to hardware limitations only subfunctions
  4052. 0,1,5 and 7 are available, other subfunctions return error
  4053. with code 2.
  4054. At the first call of subfunctions 0,1,5,7 to ATAPI devices
  4055. (CD and DVD) the manual control of tray is locked due to caching
  4056. drive data. Unlocking is made when subfunction 4 of function 24
  4057. is called for corresponding device.
  4058.  
  4059. ---------------------- Constants for registers: ----------------------
  4060.   eax - SF_FILE (70)
  4061.  [ebx] - SSF_READ_FILE (0), SSF_READ_FOLDER (1), SSF_CREATE_FILE (2),
  4062.     SSF_WRITE_FILE (3), SSF_SET_END (4), SSF_GET_INFO (5),
  4063.     SSF_SET_INFO (6), SSF_START_APP (7), SSF_DELETE (8),
  4064.     SSF_CREATE_FOLDER (9)
  4065. ======================================================================
  4066. === Function 70, subfunction 0 - read file with long names support. ==
  4067. ======================================================================
  4068. Parameters:
  4069.   * eax = 70 - function number
  4070.   * ebx = pointer to the information structure
  4071. Format of the information structure:
  4072.   * +0: dword: 0 = subfunction number
  4073.   * +4: dword: file offset (in bytes)
  4074.   * +8: dword: 0 (reserved for high dword of offset)
  4075.   * +12 = +0xC: dword: number of bytes to read
  4076.   * +16 = +0x10: dword: pointer to buffer for data
  4077.   * +20 = +0x14: path, general rules of names forming
  4078. Returned value:
  4079.   * eax = 0 - success, otherwise file system error code
  4080.   * ebx = number of bytes read
  4081. Remarks:
  4082.   * If file was ended before last requested block was read,
  4083.     the function will read as many as it can, and after that return
  4084.     eax=6 (EOF).
  4085.   * The function does not allow to read folder (returns eax=10,
  4086.     access denied).
  4087.  
  4088. ---------------------- Constants for registers: ----------------------
  4089.   eax - SF_FILE (70)
  4090.  [ebx] - SSF_READ_FILE (0)
  4091. ======================================================================
  4092. == Function 70, subfunction 1 - read folder with long names support. =
  4093. ======================================================================
  4094. Parameters:
  4095.   * eax = 70 - function number
  4096.   * ebx = pointer to the information structure
  4097. Format of the information structure:
  4098.   * +0: dword: 1 = subfunction number
  4099.   * +4: dword: index of starting block (beginning from 0)
  4100.   * +8: dword: names encoding:
  4101.     0 = default
  4102.     1 = cp866
  4103.     2 = UTF-16LE
  4104.     3 = UTF-8
  4105.   * +12 = +0xC: dword: number of blocks to read
  4106.   * +16 = +0x10: dword: pointer to buffer for data
  4107.   * +20 = +0x14: path, general rules of names forming
  4108. Returned value:
  4109.   * eax = 0 - success, otherwise file system error code
  4110.   * ebx = number of file information blocks, written to the buffer
  4111. Structure of the buffer:
  4112.   * header (32 bytes)
  4113.   * block with information on file 1
  4114.   * block with information on file 2
  4115.   * ...
  4116. Structure of header:
  4117.   * +0: dword: version of structure (current is 1)
  4118.   * +4: dword: number of placed blocks; is not greater than requested
  4119.     in the field +12 of information structure; can be less, if
  4120.     there are no more files in folder (the same as in ebx)
  4121.   * +8: dword: total number of files in folder
  4122.   * +12 = +0xC: 20*byte: reserved (zeroed)
  4123. Structure of block of data for folder entry (BDFE):
  4124.   * +0: dword: attributes of file:
  4125.     * bit 0 (mask 1): file is read-only
  4126.     * bit 1 (mask 2): file is hidden
  4127.     * bit 2 (mask 4): file is system
  4128.     * bit 3 (mask 8): this is the volume label (using by subfunction 5)
  4129.     * bit 4 (mask 0x10): this is a folder
  4130.     * bit 5 (mask 0x20): file was not archived - many archivation
  4131.       programs have an option to archive only files with this bit set,
  4132.       and after archiving this bit is cleared - it can be useful
  4133.       for automatically creating of backup-archives as at writing
  4134.       this bit is usually set
  4135.   * +4: dword: encoding, equals to field +8 in the information structure
  4136.   * +8: 4*byte: time of file creation
  4137.   * +12 = +0xC: 4*byte: date of file creation
  4138.   * +16 = +0x10: 4*byte: time of last access (read or write)
  4139.   * +20 = +0x14: 4*byte: date of last access
  4140.   * +24 = +0x18: 4*byte: time of last modification
  4141.   * +28 = +0x1C: 4*byte: date of last modification
  4142.   * +32 = +0x20: qword: file size in bytes (up to 16777216 Tb)
  4143.   * +40 = +0x28: name, 264 bytes in cp866, otherwise - 520 bytes.
  4144. Time format:
  4145.   * +0: byte: seconds
  4146.   * +1: byte: minutes
  4147.   * +2: byte: hours
  4148.   * +3: byte: reserved (0)
  4149.   * for example, 23.59.59 is written as (in hex) 3B 3B 17 00
  4150. Date format:
  4151.   * +0: byte: day
  4152.   * +1: byte: month
  4153.   * +2: word: year
  4154.   * for example, 25.11.1979 is written as (in hex) 19 0B BB 07
  4155.     Some file systems start the date from 01.01.1980,
  4156.     for example: FAT12/16/32 and exFAT
  4157. Remarks:
  4158.   * If BDFE contains cp866 name, the length of BDFE is 304 bytes,
  4159.     otherwise - 560 bytes.
  4160.   * Name string is zero terminated, further data contain garbage.
  4161.   * If files in folder were ended before requested number was read,
  4162.     the function will read as many as it can, and after that return
  4163.     eax=6 (EOF).
  4164.   * Any folder on the disk, except for root, contains two special
  4165.     entries "." and "..", identifying accordingly the folder itself
  4166.     and the parent folder.
  4167.   * The function allows also to read virtual folders "/", "/rd",
  4168.     "/fd", "/hd[n]", thus attributes of subfolders are set to 0x10,
  4169.     and times and dates are zeroed. An alternative way to get the
  4170.     equipment information - subfunction 11 of function 18.
  4171.  
  4172. ---------------------- Constants for registers: ----------------------
  4173.   eax - SF_FILE (70)
  4174.  [ebx] - SSF_READ_FOLDER (1)
  4175. ======================================================================
  4176. ===================== Function 70, subfunction 2 =====================
  4177. ============ Create/rewrite file with long names support. ============
  4178. ======================================================================
  4179. Parameters:
  4180.   * eax = 70 - function number
  4181.   * ebx = pointer to the information structure
  4182. Format of the information structure:
  4183.   * +0: dword: 2 = subfunction number
  4184.   * +4: dword: 0 (reserved)
  4185.   * +8: dword: 0 (reserved)
  4186.   * +12 = +0xC: dword: number of bytes to write
  4187.   * +16 = +0x10: dword: pointer to data
  4188.   * +20 = +0x14: path, general rules of names forming
  4189. Returned value:
  4190.   * eax = 0 - success, otherwise file system error code
  4191.   * ebx = number of written bytes (possibly 0)
  4192. Remarks:
  4193.   * If a file with given name did not exist, it is created;
  4194.     if it existed, it is rewritten.
  4195.   * If there is not enough free space on disk, the function will
  4196.     write as many as can and then return error code 8.
  4197.   * The function is not supported for CD (returns error code 2).
  4198.  
  4199. ---------------------- Constants for registers: ----------------------
  4200.   eax - SF_FILE (70)
  4201.  [ebx] - SSF_CREATE_FILE (2)
  4202. ======================================================================
  4203. ===================== Function 70, subfunction 3 =====================
  4204. =========== Write to existing file with long names support. ==========
  4205. ======================================================================
  4206. Parameters:
  4207.   * eax = 70 - function number
  4208.   * ebx = pointer to the information structure
  4209. Format of the information structure:
  4210.   * +0: dword: 3 = subfunction number
  4211.   * +4: dword: file offset (in bytes)
  4212.   * +8: dword: high dword of offset (must be 0 for FAT)
  4213.   * +12 = +0xC: dword: number of bytes to write
  4214.   * +16 = +0x10: dword: pointer to data
  4215.   * +20 = +0x14: path, general rules of names forming
  4216. Returned value:
  4217.   * eax = 0 - success, otherwise file system error code
  4218.   * ebx = number of written bytes (possibly 0)
  4219. Remarks:
  4220.   * The file must already exist, otherwise function returns eax=5.
  4221.   * The only result of write 0 bytes is update in the file attributes
  4222.     date/time of modification and access to the current date/time.
  4223.   * If beginning and/or ending position is greater than file size
  4224.     (except for the previous case), the file is expanded to needed
  4225.     size with zero characters.
  4226.   * The function is not supported for CD (returns error code 2).
  4227.  
  4228. ---------------------- Constants for registers: ----------------------
  4229.   eax - SF_FILE (70)
  4230.  [ebx] - SSF_WRITE_FILE (3)
  4231. ======================================================================
  4232. ============ Function 70, subfunction 4 - set end of file. ===========
  4233. ======================================================================
  4234. Parameters:
  4235.   * eax = 70 - function number
  4236.   * ebx = pointer to the information structure
  4237. Format of the information structure:
  4238.   * +0: dword: 4 = subfunction number
  4239.   * +4: dword: low dword of new file size
  4240.   * +8: dword: high dword of new file size (must be 0 for FAT)
  4241.   * +12 = +0xC: dword: 0 (reserved)
  4242.   * +16 = +0x10: dword: 0 (reserved)
  4243.   * +20 = +0x14: path, general rules of names forming
  4244. Returned value:
  4245.   * eax = 0 - success, otherwise file system error code
  4246.   * ebx destroyed
  4247. Remarks:
  4248.   * If new file size is less than old one, file will be truncated.
  4249.     If new size is greater than old one, file will be expanded, and if
  4250.     size difference is up to 16 MB, new space will be cleared with 0.
  4251.   * If there is not enough free space on disk for expansion, the
  4252.     function will expand to maximum possible size and then return
  4253.     error code 8.
  4254.   * The function is not supported for CD (returns error code 2).
  4255.  
  4256. ---------------------- Constants for registers: ----------------------
  4257.   eax - SF_FILE (70)
  4258.  [ebx] - SSF_SET_END (4)
  4259. ======================================================================
  4260. ==== Function 70, subfunction 5 - get information on file/folder. ====
  4261. ======================================================================
  4262. Parameters:
  4263.   * eax = 70 - function number
  4264.   * ebx = pointer to the information structure
  4265. Format of the information structure:
  4266.   * +0: dword: 5 = subfunction number
  4267.   * +4: dword: 0 (reserved)
  4268.   * +8: dword: 0 or flags (for the root folder)
  4269.   * +12 = +0xC: dword: 0 (reserved)
  4270.   * +16 = +0x10: dword: pointer to buffer for data (40 bytes)
  4271.   * +20 = +0x14: path, general rules of names forming
  4272. Returned value:
  4273.   * eax = 0 - success, otherwise file system error code
  4274.   * ebx destroyed
  4275. Information on file is returned in the BDFE format (block of data
  4276. for folder entry), explained in the description of subfunction 1,
  4277. but without filename, except the root folder.
  4278. Remarks:
  4279.   * For the root folder returns the partition size,
  4280.     and if encoding byte is non-zero, the volume label.
  4281.   * For the device returns only the size.
  4282.  
  4283. ---------------------- Constants for registers: ----------------------
  4284.   eax - SF_FILE (70)
  4285.  [ebx] - SSF_GET_INFO (5)
  4286. ======================================================================
  4287. ===== Function 70, subfunction 6 - set attributes of file/folder. ====
  4288. ======================================================================
  4289. Parameters:
  4290.   * eax = 70 - function number
  4291.   * ebx = pointer to the information structure
  4292. Format of the information structure:
  4293.   * +0: dword: 6 = subfunction number
  4294.   * +4: dword: 0 (reserved)
  4295.   * +8: dword: 0 (reserved)
  4296.   * +12 = +0xC: dword: 0 (reserved)
  4297.   * +16 = +0x10: dword: pointer to buffer with attributes (32 bytes)
  4298.   * +20 = +0x14: path, general rules of names forming
  4299. Returned value:
  4300.   * eax = 0 - success, otherwise file system error code
  4301.   * ebx destroyed
  4302. File attributes are first 32 bytes in BDFE (block of data
  4303. for folder entry), explained in the description of subfunction 1
  4304. (that is, without name and size of file). Attribute
  4305. file/folder/volume label (bits 3,4 in dword +0) is not changed.
  4306. Byte +4 (name format) is ignored.
  4307. Remarks:
  4308.   * The function does not support virtual folders such as /, /rd and
  4309.     root folders like /rd/1.
  4310.   * The function is not supported for CD (returns error code 2).
  4311.  
  4312. ---------------------- Constants for registers: ----------------------
  4313.   eax - SF_FILE (70)
  4314.  [ebx] - SSF_SET_INFO (6)
  4315. ======================================================================
  4316. =========== Function 70, subfunction 7 - start application. ==========
  4317. ======================================================================
  4318. Parameters:
  4319.   * eax = 70 - function number
  4320.   * ebx = pointer to the information structure
  4321. Format of the information structure:
  4322.   * +0: dword: 7 = subfunction number
  4323.   * +4: dword: flags field:
  4324.     * bit 0: start process as debugged
  4325.     * other bits are reserved and must be set to 0
  4326.   * +8: dword: 0 or pointer to ASCIIZ-string with parameters
  4327.   * +12 = +0xC: dword: 0 (reserved)
  4328.   * +16 = +0x10: dword: 0 (reserved)
  4329.   * +20 = +0x14: path, general rules of names forming
  4330. Returned value:
  4331.   * eax > 0 - program is loaded, eax contains PID
  4332.   * eax < 0 - an error has occurred, -eax contains
  4333.     file system error code
  4334.   * ebx destroyed
  4335. Remarks:
  4336.   * Command line must be terminated by the character with the code 0
  4337.     (ASCIIZ-string); function takes into account either all characters
  4338.     up to terminating zero inclusively or first 256 character
  4339.     regarding what is less.
  4340.   * If the process is started as debugged, it is created in
  4341.     the suspended state; to run use subfunction 5 of function 69.
  4342.  
  4343. ---------------------- Constants for registers: ----------------------
  4344.   eax - SF_FILE (70)
  4345.  [ebx] - SSF_START_APP (7)
  4346. ======================================================================
  4347. ========== Function 70, subfunction 8 - delete file/folder. ==========
  4348. ======================================================================
  4349. Parameters:
  4350.   * eax = 70 - function number
  4351.   * ebx = pointer to the information structure
  4352. Format of the information structure:
  4353.   * +0: dword: 8 = subfunction number
  4354.   * +4: dword: 0 (reserved)
  4355.   * +8: dword: 0 (reserved)
  4356.   * +12 = +0xC: dword: 0 (reserved)
  4357.   * +16 = +0x10: dword: 0 (reserved)
  4358.   * +20 = +0x14: path, general rules of names forming
  4359. Returned value:
  4360.   * eax = 0 - success, otherwise file system error code
  4361.   * ebx destroyed
  4362. Remarks:
  4363.   * The function is not supported for CD (returns error code 2).
  4364.   * The function can delete only empty folders (attempt to delete
  4365.     nonempty folder results in error with code 10, "access denied").
  4366.  
  4367. ---------------------- Constants for registers: ----------------------
  4368.   eax - SF_FILE (70)
  4369.  [ebx] - SSF_DELETE (8)
  4370. ======================================================================
  4371. ============= Function 70, subfunction 9 - create folder. ============
  4372. ======================================================================
  4373. Parameters:
  4374.   * eax = 70 - function number
  4375.   * ebx = pointer to the information structure
  4376. Format of the information structure:
  4377.   * +0: dword: 9 = subfunction number
  4378.   * +4: dword: 0 (reserved)
  4379.   * +8: dword: 0 (reserved)
  4380.   * +12 = +0xC: dword: 0 (reserved)
  4381.   * +16 = +0x10: dword: 0 (reserved)
  4382.   * +20 = +0x14: path, general rules of names forming
  4383. Returned value:
  4384.   * eax = 0 - success, otherwise file system error code
  4385.   * ebx destroyed
  4386. Remarks:
  4387.   * The function is not supported for CD (returns error code 2).
  4388.   * The parent folder must already exist.
  4389.   * If target folder already exists, function returns success (eax=0).
  4390.  
  4391. ---------------------- Constants for registers: ----------------------
  4392.   eax - SF_FILE (70)
  4393.  [ebx] - SSF_CREATE_FOLDER (9)
  4394. ======================================================================
  4395. ============= Function 70, subfunction 10 - rename/move. =============
  4396. ======================================================================
  4397. Parameters:
  4398.   * eax = 70 - function number
  4399.   * ebx = pointer to the information structure
  4400. Format of the information structure:
  4401.   * +0: dword: 10 = subfunction number
  4402.   * +4: dword: 0 (reserved)
  4403.   * +8: dword: 0 (reserved)
  4404.   * +12 = +0xC: dword: 0 (reserved)
  4405.   * +16 = +0x10: dword: pointer to the new name/path string
  4406.   * +20 = +0x14: path, general rules of names forming
  4407. Returned value:
  4408.   * eax = 0 - success, otherwise file system error code
  4409.   * ebx destroyed
  4410. Remarks:
  4411.   * New path forming differs from general rules:
  4412.     relative path relates to the target's parent folder,
  4413.     absolute path relates to the partition's root folder.
  4414. ======================================================================
  4415. ================== Function 71 - set window caption ==================
  4416. ======================================================================
  4417. Parameters:
  4418.   * eax = 71 - function number
  4419.   * ebx = 1
  4420.   * ecx = pointer to zero terminated string,
  4421.     the string may start with an encoding byte:
  4422.     1 = cp866
  4423.     2 = UTF-16LE
  4424.     3 = UTF-8
  4425.   or:
  4426.   * ebx = 2
  4427.   * ecx = pointer to zero terminated string
  4428.   * dl  = string encoding
  4429. Returned value:
  4430.   * function does not return value
  4431. Remarks:
  4432.   * Pass NULL in ecx to remove caption.
  4433.  
  4434. ---------------------- Constants for registers: ----------------------
  4435.   eax - SF_SET_CAPTION (71)
  4436. ======================================================================
  4437. =============== Function 72 - send message to a window. ==============
  4438. ======================================================================
  4439.  
  4440. - Subfunction 1 - send message with parameter to the active window. --
  4441. Parameters:
  4442.   * eax = 72 - function number
  4443.   * ebx = 1 - subfunction number
  4444.   * ecx = event code: 2 or 3
  4445.   * edx = parameter: key code for ecx=2, button identifier for ecx=3
  4446. Returned value:
  4447.   * eax = 0 - success
  4448.   * eax = 1 - buffer is full
  4449.  
  4450. ---------------------- Constants for registers: ----------------------
  4451.   eax - SF_SEND_MESSAGE (72)
  4452. ======================================================================
  4453. ===================== Function 73 - blit bitmap  =====================
  4454. ======================================================================
  4455.  
  4456. Parameters:
  4457.   * eax = 73 - function number
  4458.  
  4459.   * ebx = ROP and optional flags
  4460.      31      30 29 28       6 5  4 3   0
  4461.      [reserved][CR][reserved][T][B][ROP]
  4462.      ROP - raster operation code
  4463.         0: Copy
  4464.      1-15: reserved
  4465.      B   - blit into the background surface
  4466.      T   - transparent blit
  4467.      CR  - blit client relative
  4468.  
  4469.   * ecx = pointer to the function parameters
  4470.         destination offset and clipping
  4471.      +0 signed dword: destination rectangle X offset from the window
  4472.                       top-left corner
  4473.      +4 signed dword: destination rectangle Y offset from the window
  4474.                       top-left corner
  4475.      +8 dword:        destination rectangle width
  4476.     +12 dword:        destination rectangle height
  4477.  
  4478.         source offset and clipping
  4479.     +16 signed dword: source rectangle X offset from the bitmap
  4480.                       top-left corner
  4481.     +20 signed dword: source rectangle Y offset from the bitmap
  4482.                       top-left corner
  4483.     +24 dword:        source rectangle width
  4484.     +28 dword:        source rectangle height
  4485.  
  4486.     +32: dword: bitmap data - must be 32bpp
  4487.     +36: dword: size of the bitmap row in bytes
  4488.  
  4489. Returned value:
  4490.   * function does not return value
  4491.  
  4492. ---------------------- Constants for registers: ----------------------
  4493.   eax - SF_BLITTER (73)
  4494. ======================================================================
  4495. = Function 74, Subfunction 255, Get number of active network devices. =
  4496. ======================================================================
  4497. Parameters:
  4498.   * eax = 74 - function number
  4499.   * bl = 255 - subfunction number
  4500. Returned value:
  4501.   * eax = number of active network devices
  4502.  
  4503. ---------------------- Constants for registers: ----------------------
  4504.   eax - SF_NETWORK_GET (74)
  4505.    bl - SSF_DEVICE_COUNT (255)
  4506. ======================================================================
  4507. ======== Function 74, Subfunction 0, Get network device type. ========
  4508. ======================================================================
  4509. Parameters:
  4510.   * eax = 74 - function number
  4511.   * bl = 0 - subfunction number
  4512.   * bh = device number
  4513. Returned value:
  4514.   * eax = device type number, -1 on error
  4515.  
  4516. ---------------------- Constants for registers: ----------------------
  4517.   eax - SF_NETWORK_GET (74)
  4518.    bl - SSF_DEVICE_TYPE (0)
  4519. ======================================================================
  4520. ======== Function 74, Subfunction 1, Get network device name. ========
  4521. ======================================================================
  4522. Parameters:
  4523.   * eax = 74 - function number
  4524.   * bl = 1 - subfunction number
  4525.   * bh = device number
  4526.   * ecx = pointer to 64 byte buffer
  4527. Returned value:
  4528.   * eax = -1 on error
  4529.   * The network device name is written into the buffer, on success
  4530.  
  4531. ---------------------- Constants for registers: ----------------------
  4532.   eax - SF_NETWORK_GET (74)
  4533.    bl - SSF_DEVICE_NAME (1)
  4534. ======================================================================
  4535. ========= Function 74, Subfunction 2, Reset network device. ==========
  4536. ======================================================================
  4537. Parameters:
  4538.   * eax = 74 - function number
  4539.   * bl = 2 - subfunction number
  4540.   * bh = device number
  4541. Returned value:
  4542.   * eax = -1 on error
  4543.  
  4544. ---------------------- Constants for registers: ----------------------
  4545.   eax - SF_NETWORK_GET (74)
  4546.    bl - SSF_RESET_DEVICE (2)
  4547. ======================================================================
  4548. ========== Function 74, Subfunction 3, Stop network device. ==========
  4549. ======================================================================
  4550. Parameters:
  4551.   * eax = 74 - function number
  4552.   * bl = 3 - subfunction number
  4553.   * bh = device number
  4554. Returned value:
  4555.   * eax = -1 on error
  4556.  
  4557. ---------------------- Constants for registers: ----------------------
  4558.   eax - SF_NETWORK_GET (74)
  4559.    bl - SSF_STOP_DEVICE (3)
  4560. ======================================================================
  4561. =========== Function 74, Subfunction 4, Get device pointer. ==========
  4562. ======================================================================
  4563. Parameters:
  4564.   * eax = 74 - function number
  4565.   * bl = 4 - subfunction number
  4566.   * bh = device number
  4567. Returned value:
  4568.   * eax = device pointer, -1 on error
  4569.  
  4570. ---------------------- Constants for registers: ----------------------
  4571.   eax - SF_NETWORK_GET (74)
  4572.    bl - SSF_DEVICE_POINTER (4)
  4573. ======================================================================
  4574. ========= Function 74, Subfunction 6, Get packet TX counter. =========
  4575. ======================================================================
  4576. Parameters:
  4577.   * eax = 74 - function number
  4578.   * bl = 6 - subfunction number
  4579.   * bh = device number
  4580. Returned value:
  4581.   * eax = Number of packets sent since device start, -1 on error
  4582.  
  4583. ---------------------- Constants for registers: ----------------------
  4584.   eax - SF_NETWORK_GET (74)
  4585.    bl - SSF_TX_PACKET_COUNT (6)
  4586. ======================================================================
  4587. ========= Function 74, Subfunction 7, Get packet RX counter. =========
  4588. ======================================================================
  4589. Parameters:
  4590.   * eax = 74 - function number
  4591.   * bl = 7 - subfunction number
  4592.   * bh = device number
  4593. Returned value:
  4594.   * eax = Number of packets received since device start, -1 on error
  4595.  
  4596. ---------------------- Constants for registers: ----------------------
  4597.   eax - SF_NETWORK_GET (74)
  4598.    bl - SSF_RX_PACKET_COUNT (7)
  4599. ======================================================================
  4600. ========== Function 74, Subfunction 8, Get TX byte counter. ==========
  4601. ======================================================================
  4602. Parameters:
  4603.   * eax = 74 - function number
  4604.   * bl = 8 - subfunction number
  4605.   * bh = device number
  4606. Returned value:
  4607.   * eax = Number of bytes sent since device start (lower dword)
  4608.           -1 on error
  4609.   * ebx = Number of bytes sent since device start (higher dword)
  4610.  
  4611. ---------------------- Constants for registers: ----------------------
  4612.   eax - SF_NETWORK_GET (74)
  4613.    bl - SSF_TX_BYTE_COUNT (8)
  4614. ======================================================================
  4615. ========== Function 74, Subfunction 9, Get RX byte counter. ==========
  4616. ======================================================================
  4617. Parameters:
  4618.   * eax = 74 - function number
  4619.   * bl = 9 - subfunction number
  4620.   * bh = device number
  4621. Returned value:
  4622.   * eax = Number of bytes received since device start (lower dword)
  4623.           -1 on error
  4624.   * ebx = Number of bytes received since device start (higher dword)
  4625.  
  4626. ---------------------- Constants for registers: ----------------------
  4627.   eax - SF_NETWORK_GET (74)
  4628.    bl - SSF_RX_BYTE_COUNT (9)
  4629. ======================================================================
  4630. ========== Function 74, Subfunction 10, Get link status. =============
  4631. ======================================================================
  4632. Parameters:
  4633.   * eax = 74 - function number
  4634.   * bl = 10 - subfunction number
  4635.   * bh = device number
  4636. Returned value:
  4637.   * eax = link status, -1 on error
  4638.  
  4639.   Link status:
  4640.     ETH_LINK_DOWN   =    0b         ; Link is down
  4641.     ETH_LINK_UNKNOWN=    1b         ; There could be an active link
  4642.     ETH_LINK_FD     =   10b         ; full duplex flag
  4643.     ETH_LINK_10M    =  100b         ; 10 mbit
  4644.     ETH_LINK_100M   = 1000b         ; 100 mbit
  4645.     ETH_LINK_1G     = 1100b         ; gigabit
  4646.  
  4647. ---------------------- Constants for registers: ----------------------
  4648.   eax - SF_NETWORK_GET (74)
  4649.    bl - SSF_LINK_STATUS (10)
  4650. ======================================================================
  4651. ==== Function 74, Subfunction 11, Get TX error packets counter. ======
  4652. ======================================================================
  4653. Parameters:
  4654.   * eax = 74 - function number
  4655.   * bl = 11 - subfunction number
  4656.   * bh = device number
  4657. Returned value:
  4658.   * eax = Number of erroneous packets received since device start, -1 on error
  4659.  
  4660. ---------------------- Constants for registers: ----------------------
  4661.   eax - SF_NETWORK_GET (74)
  4662.    bl - SSF_TX_PACKET_ERROR_COUNT (11)  
  4663. ======================================================================
  4664. === Function 74, Subfunction 12, Get TX dropped packets counter. =====
  4665. ======================================================================
  4666. Parameters:
  4667.   * eax = 74 - function number
  4668.   * bl = 12 - subfunction number
  4669.   * bh = device number
  4670. Returned value:
  4671.   * eax = Number of dropped packets since device start, -1 on error
  4672.  
  4673. ---------------------- Constants for registers: ----------------------
  4674.   eax - SF_NETWORK_GET (74)
  4675.    bl - SSF_TX_PACKET_DROP_COUNT (12)    
  4676. ======================================================================
  4677. ==== Function 74, Subfunction 13, Get TX missed packets counter. =====
  4678. ======================================================================
  4679. Parameters:
  4680.   * eax = 74 - function number
  4681.   * bl = 13 - subfunction number
  4682.   * bh = device number
  4683. Returned value:
  4684.   * eax = Number of missed packets since device start, -1 on error
  4685.  
  4686. ---------------------- Constants for registers: ----------------------
  4687.   eax - SF_NETWORK_GET (74)
  4688.    bl - SSF_TX_PACKET_MISS_COUNT (13)    
  4689.    ======================================================================
  4690. ==== Function 74, Subfunction 14, Get RX error packets counter. ======
  4691. ======================================================================
  4692. Parameters:
  4693.   * eax = 74 - function number
  4694.   * bl = 14 - subfunction number
  4695.   * bh = device number
  4696. Returned value:
  4697.   * eax = Number of erroneous packets received since device start, -1 on error
  4698.  
  4699. ---------------------- Constants for registers: ----------------------
  4700.   eax - SF_NETWORK_GET (74)
  4701.    bl - SSF_RX_PACKET_ERROR_COUNT (14)  
  4702. ======================================================================
  4703. === Function 74, Subfunction 15, Get RX dropped packets counter. =====
  4704. ======================================================================
  4705. Parameters:
  4706.   * eax = 74 - function number
  4707.   * bl = 15 - subfunction number
  4708.   * bh = device number
  4709. Returned value:
  4710.   * eax = Number of dropped packets since device start, -1 on error
  4711.  
  4712. ---------------------- Constants for registers: ----------------------
  4713.   eax - SF_NETWORK_GET (74)
  4714.    bl - SSF_RX_PACKET_DROP_COUNT (12)    
  4715. ======================================================================
  4716. ==== Function 74, Subfunction 16, Get RX missed packets counter. =====
  4717. ======================================================================
  4718. Parameters:
  4719.   * eax = 74 - function number
  4720.   * bl = 16 - subfunction number
  4721.   * bh = device number
  4722. Returned value:
  4723.   * eax = Number of missed packets since device start, -1 on error
  4724.  
  4725. ---------------------- Constants for registers: ----------------------
  4726.   eax - SF_NETWORK_GET (74)
  4727.    bl - SSF_RX_PACKET_MISS_COUNT (16)  
  4728. ======================================================================
  4729. ============== Function 75, Subfunction 0, Open socket. ==============
  4730. ======================================================================
  4731. Parameters:
  4732.   * eax = 75 - function number
  4733.   * bl = 0 - subfunction number
  4734.   * ecx = domain
  4735.   * edx = type
  4736.   * esi = protocol
  4737. Returned value:
  4738.   * eax = socket number, -1 on error
  4739.   * ebx = errorcode
  4740.  
  4741. ---------------------- Constants for registers: ----------------------
  4742.   eax - SF_NETWORK_SOCKET (75)
  4743.    bl - SSF_OPEN (0)
  4744. ======================================================================
  4745. ============= Function 75, Subfunction 1, Close socket. ==============
  4746. ======================================================================
  4747. Parameters:
  4748.   * eax = 75 - function number
  4749.   * bl = 1 - subfunction number
  4750.   * ecx = socket number
  4751. Returned value:
  4752.   * eax = -1 on error
  4753.   * ebx = errorcode
  4754.  
  4755. ---------------------- Constants for registers: ----------------------
  4756.   eax - SF_NETWORK_SOCKET (75)
  4757.    bl - SSF_CLOSE (1)
  4758. ======================================================================
  4759. ================== Function 75, Subfunction 2, Bind. =================
  4760. ======================================================================
  4761. Parameters:
  4762.   * eax = 75 - function number
  4763.   * bl = 2 - subfunction number
  4764.   * ecx = socket number
  4765.   * edx = pointer to sockaddr structure
  4766.   * esi = length of sockaddr structure
  4767. Format of SockAddr structure:
  4768.   * +0: Word: Family
  4769.   * +2: 14*Byte: Data
  4770. Returned value:
  4771.   * eax = -1 on error
  4772.   * ebx = errorcode
  4773.  
  4774. ---------------------- Constants for registers: ----------------------
  4775.   eax - SF_NETWORK_SOCKET (75)
  4776.    bl - SSF_BIND (2)
  4777. ======================================================================
  4778. ================= Function 75, Subfunction 3, Listen. ================
  4779. ======================================================================
  4780. Parameters:
  4781.   * eax = 75 - function number
  4782.   * bl = 3 - subfunction number
  4783.   * ecx = socket number
  4784.   * edx = backlog
  4785. Returned value:
  4786.   * eax = -1 on error
  4787.   * ebx = errorcode
  4788.  
  4789. ---------------------- Constants for registers: ----------------------
  4790.   eax - SF_NETWORK_SOCKET (75)
  4791.    bl - SSF_LISTEN (3)
  4792. ======================================================================
  4793. ================ Function 75, Subfunction 4, Connect. ================
  4794. ======================================================================
  4795. Parameters:
  4796.   * eax = 75 - function number
  4797.   * bl = 4 - subfunction number
  4798.   * ecx = socket number
  4799.   * edx = pointer to sockaddr structure
  4800.   * esi = length of sockaddr structure
  4801. Format of SockAddr structure:
  4802.   * +0: Word: Family
  4803.   * +2: 14*Byte: Data
  4804. Returned value:
  4805.   * eax = -1 on error
  4806.   * ebx = errorcode
  4807.  
  4808. ---------------------- Constants for registers: ----------------------
  4809.   eax - SF_NETWORK_SOCKET (75)
  4810.    bl - SSF_CONNECT (4)
  4811. ======================================================================
  4812. ================= Function 75, Subfunction 5, Accept. ================
  4813. ======================================================================
  4814. Parameters:
  4815.   * eax = 75 - function number
  4816.   * bl = 5 - subfunction number
  4817.   * ecx = socket number
  4818.   * edx = pointer to sockaddr structure
  4819.   * esi = length of sockaddr structure
  4820. Format of SockAddr structure:
  4821.   * +0: Word: Family
  4822.   * +2: 14*Byte: Data
  4823. Returned value:
  4824.   * eax = socket number of accepted socket, -1 on error
  4825.   * ebx = errorcode
  4826.  
  4827. ---------------------- Constants for registers: ----------------------
  4828.   eax - SF_NETWORK_SOCKET (75)
  4829.    bl - SSF_ACCEPT (5)
  4830. ======================================================================
  4831. ================== Function 75, Subfunction 6, Send. =================
  4832. ======================================================================
  4833. Parameters:
  4834.   * eax = 75 - function number
  4835.   * bl = 6 - subfunction number
  4836.   * ecx = socket number
  4837.   * edx = pointer to buffer
  4838.   * esi = length of buffer
  4839.   * edi = flags
  4840. Returned value:
  4841.   * eax = number of bytes copied, -1 on error
  4842.   * ebx = errorcode
  4843.  
  4844. ---------------------- Constants for registers: ----------------------
  4845.   eax - SF_NETWORK_SOCKET (75)
  4846.    bl - SSF_SEND (6)
  4847. ======================================================================
  4848. ================ Function 75, Subfunction 7, Receive. ================
  4849. ======================================================================
  4850. Parameters:
  4851.   * eax = 75 - function number
  4852.   * bl = 7 - subfunction number
  4853.   * ecx = socket number
  4854.   * edx = pointer to buffer
  4855.   * esi = length of buffer
  4856.   * edi = flags
  4857. Returned value:
  4858.   * eax = number of bytes copied, -1 on error
  4859.   * ebx = errorcode
  4860.  
  4861. ---------------------- Constants for registers: ----------------------
  4862.   eax - SF_NETWORK_SOCKET (75)
  4863.    bl - SSF_RECEIVE (7)
  4864. ======================================================================
  4865. =========== Function 75, Subfunction 8, Set socket options. ==========
  4866. ======================================================================
  4867. Parameters:
  4868.   * eax = 75 - function number
  4869.   * bl = 8 - subfunction number
  4870.   * ecx = socket number
  4871.   * edx = pointer to optstruct
  4872. Returned value:
  4873.   * eax = -1 on error
  4874.   * ebx = errorcode
  4875. Remarks:
  4876.  
  4877.   Optstruct:
  4878.     dd level
  4879.     dd optionname
  4880.     dd optlength
  4881.     db options...
  4882.  
  4883. ---------------------- Constants for registers: ----------------------
  4884.   eax - SF_NETWORK_SOCKET (75)
  4885.    bl - SSF_SET_OPTIONS (8)
  4886. ======================================================================
  4887. =========== Function 75, Subfunction 9, Get socket options. ==========
  4888. ======================================================================
  4889. Parameters:
  4890.   * eax = 75 - function number
  4891.   * bl = 9 - subfunction number
  4892.   * ecx = socket number
  4893.   * edx = pointer to optstruct
  4894. Returned value:
  4895.   * eax = -1 on error
  4896.   * ebx = errorcode
  4897. Remarks:
  4898.  
  4899.   Optstruct:
  4900.     dd level
  4901.     dd optionname
  4902.     dd optlength
  4903.     db options...
  4904.  
  4905. ---------------------- Constants for registers: ----------------------
  4906.   eax - SF_NETWORK_SOCKET (75)
  4907.    bl - SSF_GET_OPTIONS (9)
  4908. ======================================================================
  4909. ============ Function 75, Subfunction 10, Get socketpair. ============
  4910. ======================================================================
  4911. Parameters:
  4912.   * eax = 75 - function number
  4913.   * bl = 10 - subfunction number
  4914. Returned value:
  4915.   * eax = socketnum1, -1 on error
  4916.   * ebx = socketnum2, errorcode on error
  4917.  
  4918. ---------------------- Constants for registers: ----------------------
  4919.   eax - SF_NETWORK_SOCKET (75)
  4920.    bl - SSF_GET_PAIR (10)
  4921. ======================================================================
  4922. ============ Function 76, Network options and statistics. ============
  4923. ======================================================================
  4924. Parameters:
  4925.   * eax = 76 - function number
  4926.   * high half of ebx = protocol number
  4927.   * bh = device number
  4928.   * bl = subfunction number
  4929.  
  4930. ======================================================================
  4931. ==== Function 76, Protocol 0 - Ethernet, Subfunction 0, Read MAC. ====
  4932. ======================================================================
  4933. Parameters:
  4934.   * eax = 76 - function number
  4935.   * high half of ebx = 0 (Ethernet)
  4936.   * bh = device number
  4937.   * bl = 0 (Read MAC)
  4938. Returned value:
  4939.   * eax = -1 on error, otherwise lower bits of MAC
  4940.   * bx = upper bits of MAC
  4941.  
  4942. ======================================================================
  4943. = Function 76, Protocol 1 - IPv4, Subfunction 0, Read # Packets sent =
  4944. ======================================================================
  4945. Parameters:
  4946.   * eax = 76 - function number
  4947.   * high half of ebx = 1 (IPv4)
  4948.   * bh = device number
  4949.   * bl = 0 (Read # packets sent)
  4950. Returned value:
  4951.   * eax = number of packets sent (-1 on error)
  4952.  
  4953. ======================================================================
  4954. = Function 76, Protocol 1 - IPv4, Subfunction 1, Read # Packets rcvd =
  4955. ======================================================================
  4956. Parameters:
  4957.   * eax = 76 - function number
  4958.   * high half of ebx = 1 (IPv4)
  4959.   * bh = device number
  4960.   * bl = 1 (Read # packets received)
  4961. Returned value:
  4962.   * eax = number of packets received (-1 on error)
  4963.  
  4964. ======================================================================
  4965. === Function 76, Protocol 1 - IPv4, Subfunction 2, Read IP address ===
  4966. ======================================================================
  4967. Parameters:
  4968.   * eax = 76 - function number
  4969.   * high half of ebx = 1 (IPv4)
  4970.   * bh = device number
  4971.   * bl = 2 (Read IP address)
  4972. Returned value:
  4973.   * eax = IP address (-1 on error)
  4974.  
  4975. ======================================================================
  4976. === Function 76, Protocol 1 - IPv4, Subfunction 3, Set IP address ====
  4977. ======================================================================
  4978. Parameters:
  4979.   * eax = 76 - function number
  4980.   * high half of ebx = 1 (IPv4)
  4981.   * bh = device number
  4982.   * bl = 3 (Set IP address)
  4983.   * ecx = IP address
  4984. Returned value:
  4985.   * eax = -1 on error
  4986.  
  4987. ======================================================================
  4988. == Function 76, Protocol 1 - IPv4, Subfunction 4, Read DNS address ===
  4989. ======================================================================
  4990. Parameters:
  4991.   * eax = 76 - function number
  4992.   * high half of ebx = 1 (IPv4)
  4993.   * bh = device number
  4994.   * bl = 4 (Read DNS server IP address)
  4995. Returned value:
  4996.   * eax = DNS server IP address (-1 on error)
  4997.  
  4998. ======================================================================
  4999. === Function 76, Protocol 1 - IPv4, Subfunction 5, Set DNS address ===
  5000. ======================================================================
  5001. Parameters:
  5002.   * eax = 76 - function number
  5003.   * high half of ebx = 1 (IPv4)
  5004.   * bh = device number
  5005.   * bl = 5 (Set DNS address)
  5006.   * ecx = DNS server IP address
  5007. Returned value:
  5008.   * eax = -1 on error
  5009.  
  5010. ======================================================================
  5011. == Function 76, Protocol 1 - IPv4, Subfunction 6, Read subnet mask ===
  5012. ======================================================================
  5013. Parameters:
  5014.   * eax = 76 - function number
  5015.   * high half of ebx = 1 (IPv4)
  5016.   * bh = device number
  5017.   * bl = 6 (Read subnet mask)
  5018. Returned value:
  5019.   * eax = subnet mask (-1 on error)
  5020.  
  5021. ======================================================================
  5022. === Function 76, Protocol 1 - IPv4, Subfunction 7, Set subnet mask ===
  5023. ======================================================================
  5024. Parameters:
  5025.   * eax = 76 - function number
  5026.   * high half of ebx = 1 (IPv4)
  5027.   * bh = device number
  5028.   * bl = 7 (Set subnet mask)
  5029.   * ecx = subnet mask
  5030. Returned value:
  5031.   * eax = -1 on error
  5032.  
  5033. ======================================================================
  5034. ===== Function 76, Protocol 1 - IPv4, Subfunction 8, Read gateway ====
  5035. ======================================================================
  5036. Parameters:
  5037.   * eax = 76 - function number
  5038.   * high half of ebx = 1 (IPv4)
  5039.   * bh = device number
  5040.   * bl = 8 (Read gateway IP address)
  5041. Returned value:
  5042.   * eax = gateway IP address (-1 on error)
  5043.  
  5044. ======================================================================
  5045. ===== Function 76, Protocol 1 - IPv4, Subfunction 9, Set gateway =====
  5046. ======================================================================
  5047. Parameters:
  5048.   * eax = 76 - function number
  5049.   * high half of ebx = 1 (IPv4)
  5050.   * bh = device number
  5051.   * bl = 9 (Set getway address)
  5052.   * ecx = gateway IP address
  5053. Returned value:
  5054.   * eax = -1 on error
  5055.  
  5056. ======================================================================
  5057. = Function 76, Protocol 2 - ICMP, Subfunction 0, Read # Packets sent =
  5058. ======================================================================
  5059. Parameters:
  5060.   * eax = 76 - function number
  5061.   * high half of ebx = 2 (ICMP)
  5062.   * bh = device number
  5063.   * bl = 0 (Read # packets sent)
  5064. Returned value:
  5065.   * eax = number of packets sent (-1 on error)
  5066.  
  5067. ======================================================================
  5068. = Function 76, Protocol 2 - ICMP, Subfunction 1, Read # Packets rcvd =
  5069. ======================================================================
  5070. Parameters:
  5071.   * eax = 76 - function number
  5072.   * high half of ebx = 2 (ICMP)
  5073.   * bh = device number
  5074.   * bl = 1 (Read # packets received)
  5075. Returned value:
  5076.   * eax = number of packets received (-1 on error)
  5077.  
  5078. ======================================================================
  5079. = Function 76, Protocol 3 - UDP, Subfunction 0, Read # Packets sent ==
  5080. ======================================================================
  5081. Parameters:
  5082.   * eax = 76 - function number
  5083.   * high half of ebx = 3 (UDP)
  5084.   * bh = device number
  5085.   * bl = 0 (Read # packets sent)
  5086. Returned value:
  5087.   * eax = number of packets sent (-1 on error)
  5088.  
  5089. ======================================================================
  5090. = Function 76, Protocol 3 - UDP, Subfunction 1, Read # Packets rcvd ==
  5091. ======================================================================
  5092. Parameters:
  5093.   * eax = 76 - function number
  5094.   * high half of ebx = 3 (UDP)
  5095.   * bh = device number
  5096.   * bl = 1 (Read # packets received)
  5097. Returned value:
  5098.   * eax = number of packets received (-1 on error)
  5099.  
  5100. ======================================================================
  5101. = Function 76, Protocol 4 - TCP, Subfunction 0, Read # Packets sent ==
  5102. ======================================================================
  5103. Parameters:
  5104.   * eax = 76 - function number
  5105.   * high half of ebx = 4 (TCP)
  5106.   * bh = device number
  5107.   * bl = 0 (Read # packets sent)
  5108. Returned value:
  5109.   * eax = number of packets sent (-1 on error)
  5110.  
  5111. ======================================================================
  5112. = Function 76, Protocol 4 - TCP, Subfunction 1, Read # Packets rcvd ==
  5113. ======================================================================
  5114. Parameters:
  5115.   * eax = 76 - function number
  5116.   * high half of ebx = 4 (TCP)
  5117.   * bh = device number
  5118.   * bl = 1 (Read # packets received)
  5119. Returned value:
  5120.   * eax = number of packets received (-1 on error)
  5121.  
  5122. ======================================================================
  5123. = Function 76, Protocol 5 - ARP, Subfunction 0, Read # Packets sent ==
  5124. ======================================================================
  5125. Parameters:
  5126.   * eax = 76 - function number
  5127.   * high half of ebx = 5 (ARP)
  5128.   * bh = device number
  5129.   * bl = 0 (Read # packets sent)
  5130. Returned value:
  5131.   * eax = number of packets sent (-1 on error)
  5132.  
  5133. ======================================================================
  5134. = Function 76, Protocol 5 - ARP, Subfunction 1, Read # Packets rcvd ==
  5135. ======================================================================
  5136. Parameters:
  5137.   * eax = 76 - function number
  5138.   * high half of ebx = 5 (ARP)
  5139.   * bh = device number
  5140.   * bl = 1 (Read # packets received)
  5141. Returned value:
  5142.   * eax = number of packets received (-1 on error)
  5143.  
  5144. ======================================================================
  5145. == Function 76, Protocol 5 - ARP, Subfunction 2, Read # ARP entries ==
  5146. ======================================================================
  5147. Parameters:
  5148.   * eax = 76 - function number
  5149.   * high half of ebx = 5 (ARP)
  5150.   * bh = device number
  5151.   * bl = 2 (Read # current entries in the ARP table)
  5152. Returned value:
  5153.   * eax = number of entries (-1 on error)
  5154.  
  5155. ======================================================================
  5156. ==== Function 76, Protocol 5 - ARP, Subfunction 3, Read ARP entry ====
  5157. ======================================================================
  5158. Parameters:
  5159.   * eax = 76 - function number
  5160.   * high half of ebx = 5 (ARP)
  5161.   * bh = device number
  5162.   * bl = 3 (Read ARP entry)
  5163.   * ecx = ARP entry number (0 based)
  5164.   * edi = ptr to buffer where ARP entry will be written
  5165. Returned value:
  5166.   * eax = -1 on error
  5167. Remarks:
  5168.   * ARP_entry struct is defined in ARP.inc in kernel and currently
  5169.     looks like this:
  5170. struct  ARP_entry
  5171.         IP              dd ?
  5172.         MAC             dp ?
  5173.         Status          dw ?
  5174.         TTL             dw ?
  5175. ends
  5176.  
  5177. ======================================================================
  5178. ===== Function 76, Protocol 5 - ARP, Subfunction 4, Add ARP entry ====
  5179. ======================================================================
  5180. Parameters:
  5181.   * eax = 76 - function number
  5182.   * high half of ebx = 5 (ARP)
  5183.   * bh = device number
  5184.   * bl = 4 (Add ARP entry)
  5185.   * esi = ptr to buffer holding ARP entry
  5186. Returned value:
  5187.   * eax = -1 on error
  5188. Remarks:
  5189.   * See previous function for details on ARP entry.
  5190.  
  5191. ======================================================================
  5192. === Function 76, Protocol 5 - ARP, Subfunction 5, Remove ARP entry ===
  5193. ======================================================================
  5194. Parameters:
  5195.   * eax = 76 - function number
  5196.   * high half of ebx = 5 (ARP)
  5197.   * bh = device number
  5198.   * bl = 5 (Remove ARP entry)
  5199.   * ecx = ARP entry number (0 based), use -1 to clear whole ARP table.
  5200. Returned value:
  5201.   * eax = -1 on error
  5202.  
  5203. ======================================================================
  5204. === Function 76, Protocol 5 - ARP, Subfunction 6, Send ARP announce ==
  5205. ======================================================================
  5206. Parameters:
  5207.   * eax = 76 - function number
  5208.   * high half of ebx = 5 (ARP)
  5209.   * bh = device number
  5210.   * bl = 6 (Send ARP announce)
  5211. Returned value:
  5212.   * eax = -1 on error
  5213.  
  5214. ======================================================================
  5215. === Function 76, Protocol 5 - ARP, Subfunction 7, Read # conflicts ===
  5216. ======================================================================
  5217. Parameters:
  5218.   * eax = 76 - function number
  5219.   * high half of ebx = 5 (ARP)
  5220.   * bh = device number
  5221.   * bl = 7 (Read # IP address conflicts that have occured)
  5222. Returned value:
  5223.   * eax = # IP address conflicts (-1 on error)
  5224.  
  5225. ---------------------- Constants for registers: ----------------------
  5226.   eax - SF_NETWORK_PROTOCOL (76)
  5227. ======================================================================
  5228. ========== Function 77, Subfunction 0, Create futex object ===========
  5229. ======================================================================
  5230. Parameters:
  5231.   * eax = 77 - function number
  5232.   * ebx = 0 - subfunction number
  5233.   * ecx = pointer to futex dword
  5234. Returned value:
  5235.   * eax = futex handle, 0 on error
  5236. Remarks:
  5237.   * Use subfunction 1 to destroy the futex.
  5238.     The kernel destroys the futexes automatically when the process
  5239.     terminates.
  5240.  
  5241. ---------------------- Constants for registers: ----------------------
  5242.   eax - SF_FUTEX (77)
  5243.   ebx - SSF_CREATE (0)
  5244. ======================================================================
  5245. ========= Function 77, Subfunction 1, Destroy futex object ===========
  5246. ======================================================================
  5247. Parameters:
  5248.   * eax = 77 - function number
  5249.   * ebx = 1 - subfunction number
  5250.   * ecx = futex handle
  5251. Returned value:
  5252.   * eax = 0 - successfull, -1 on error
  5253. Remarks:
  5254.   * The futex handle must have been created by subfunction 0
  5255.  
  5256. ---------------------- Constants for registers: ----------------------
  5257.   eax - SF_FUTEX (77)
  5258.   ebx - SSF_DESTROY (1)
  5259. ======================================================================
  5260. =============== Function 77, Subfunction 2, Futex wait ===============
  5261. ======================================================================
  5262. Parameters:
  5263.   * eax = 77 - function number
  5264.   * ebx = 2 - subfunction number
  5265.   * ecx = futex handle
  5266.   * edx = control value
  5267.   * esi = timeout in system ticks or 0 for infinity
  5268. Returned value:
  5269.   * eax = 0 - successfull
  5270.          -1 - timeout
  5271.          -2 - futex dword does not have the same value as edx
  5272. Remarks:
  5273.   * This functionn tests that the value at the futex dword still
  5274.     contains the expected control value, and if so, then sleeps
  5275.     waiting for a wake operation on the futex.
  5276.   * The futex handle must have been created by subfunction 0
  5277.  
  5278. ---------------------- Constants for registers: ----------------------
  5279.   eax - SF_FUTEX (77)
  5280.   ebx - SSF_WAIT (2)
  5281. ======================================================================
  5282. =============== Function 77, Subfunction 3, Futex wake ===============
  5283. ======================================================================
  5284. Parameters:
  5285.   * eax = 77 - function number
  5286.   * ebx = 3 - subfunction number
  5287.   * ecx = futex handle
  5288.   * edx = number of waiters to wake
  5289. Returned value:
  5290.   * eax = number of waiters that were woken up
  5291.  
  5292. Remarks:
  5293.   * This function wakes at most edx of the waiters that are
  5294.     waiting (e.g., inside futex wait) on the futex dword
  5295.   * The futex handle must have been created by subfunction 0
  5296.  
  5297. ---------------------- Constants for registers: ----------------------
  5298.   eax - SF_FUTEX (77)
  5299.   ebx - SSF_WAKE (3)
  5300. ======================================================================
  5301. === Function 80 - file system interface with parameter of encoding ===
  5302. ======================================================================
  5303. Parameters:
  5304.   * eax = 80
  5305.   * ebx = pointer to the information structure
  5306. Returned value:
  5307.   * eax = 0 - success; otherwise file system error code
  5308.   * some subfunctions return value in other registers too
  5309. General format of the information structure:
  5310.   * +0: dword: subfunction number
  5311.   * +4: dword: offset in file or folder
  5312.   * +8: dword: higher part of offset or flags
  5313.   * +12 = +0xC: dword: size of data
  5314.   * +16 = +0x10: dword: pointer to data
  5315.   * +20 = +0x14: dword: string encoding:
  5316.     1 = cp866
  5317.     2 = UTF-16LE
  5318.     3 = UTF-8
  5319.     0 = default (supports encoding byte at the start of the string)
  5320.   * +24 = +0x18: dword: pointer to zero terminated string with path
  5321.  
  5322. The rest is similar to sysfunction 70.
  5323.  
  5324. ======================================================================
  5325. =============== Function -1 - terminate thread/process ===============
  5326. ======================================================================
  5327. Parameters:
  5328.   * eax = -1 - function number
  5329. Returned value:
  5330.   * function does not return neither value nor control
  5331. Remarks:
  5332.   * If the process did not create threads obviously, it has only
  5333.     one thread, which termination results in process termination.
  5334.   * If the current thread is last in the process, its termination
  5335.     also results in process terminates.
  5336.   * This function terminates the current thread. Other thread can be
  5337.     killed by call to subfunction 2 of function 18.
  5338.  
  5339. ---------------------- Constants for registers: ----------------------
  5340.   eax - SF_TERMINATE_PROCESS (-1)
  5341. ======================================================================
  5342. =========================== List of events ===========================
  5343. ======================================================================
  5344. Next event can be retrieved by the call of one from functions 10
  5345. (to wait for event), 11 (to check without waiting), 23
  5346. (to wait during the given time).
  5347. These functions return only those events, which enter into a mask set
  5348. by function 40. By default it is first three,
  5349. there is enough for most applications.
  5350. Codes of events:
  5351.   * 1 = redraw event (is reset by call to function 0)
  5352.   * 2 = key on keyboard is pressed (acts, only when the window is
  5353.     active) or hotkey is pressed; is reset, when all keys from
  5354.     the buffer are read out by function 2
  5355.   * 3 = button is pressed, defined earlier by function 8
  5356.     (or close button, created implicitly by function 0;
  5357.     minimize button is handled by the system and sends no message;
  5358.     acts, only when the window is active;
  5359.     is reset when all buttons from the buffer
  5360.     are read out by function 17)
  5361.   * 4 = reserved (in current implementation never comes even after
  5362.     unmasking by function 40)
  5363.   * 5 = kernel finished redrawing of the desktop background
  5364.   * 6 = mouse event (something happened - button pressing or moving;
  5365.     is reset at reading)
  5366.   * 7 = IPC event (see function 60 -
  5367.     Inter Process Communication; is reset at reading)
  5368.   * 8 = network event (is reset at reading)
  5369.   * 9 = debug event (is reset at reading; see
  5370.     debug subsystem)
  5371.   * 16..31 = event with appropriate IRQ
  5372.     (16=IRQ0, 31=IRQ15) (is reset after reading all IRQ data)
  5373.  
  5374. ======================================================================
  5375. =================== Error codes of the file system ===================
  5376. ======================================================================
  5377.   * 0 = success
  5378.   * 2 = function is not supported for the given file system
  5379.   * 3 = unknown file system
  5380.   * 5 = file not found
  5381.   * 6 = end of file, EOF
  5382.   * 7 = pointer lies outside of application memory
  5383.   * 8 = disk is full
  5384.   * 9 = file system error
  5385.   * 10 = access denied
  5386.   * 11 = device error
  5387.   * 12 = file system requires more memory
  5388.  
  5389. Application start functions can return also following errors:
  5390.   * 30 = 0x1E = not enough memory
  5391.   * 31 = 0x1F = file is not executable
  5392.   * 32 = 0x20 = too many processes
  5393.