Subversion Repositories Kolibri OS

Rev

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

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