Subversion Repositories Kolibri OS

Rev

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