Subversion Repositories Kolibri OS

Rev

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

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