Subversion Repositories Kolibri OS

Rev

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

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