Subversion Repositories Kolibri OS

Rev

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