Subversion Repositories Kolibri OS

Rev

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

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