Subversion Repositories Kolibri OS

Rev

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