Subversion Repositories Kolibri OS

Rev

Rev 837 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 837 Rev 2971
Line 1... Line 1...
1
SYSTEM FUNCTIONS of OS Kolibri 0.7.1.0
1
SYSTEM FUNCTIONS of OS Kolibri 0.7.5.0
Line 2... Line 2...
2
 
2
 
3
Number of the function is located in the register eax.
3
Number of the function is located in the register eax.
4
The call of the system function is executed by "int 0x40" command.
4
The call of the system function is executed by "int 0x40" command.
5
All registers except explicitly declared in the returned value,
5
All registers except explicitly declared in the returned value,
Line 217... Line 217...
217
Remarks:
217
Remarks:
218
  * Passing ebx=0 does not transfer control to the next process
218
  * Passing ebx=0 does not transfer control to the next process
219
    and does not make any operations at all. If it is really required
219
    and does not make any operations at all. If it is really required
220
    to transfer control to the next process (to complete a current
220
    to transfer control to the next process (to complete a current
221
    time slice), use subfunction 1 of function 68.
221
    time slice), use subfunction 1 of function 68.
222
  * At current implementation there will be an immediate return from
-
 
223
    the function, if the addition of ebx with current value of
-
 
224
    time counter will call 32-bit overflow.
-
 
Line 225... Line 222...
225
 
222
 
226
======================================================================
223
======================================================================
227
============== Function 6 - read the file from ramdisk. ==============
224
============== Function 6 - read the file from ramdisk. ==============
228
======================================================================
225
======================================================================
Line 611... Line 608...
611
Takes away the code of the pressed button from the buffer.
608
Takes away the code of the pressed button from the buffer.
612
Parameters:
609
Parameters:
613
  * eax = 17 - function number
610
  * eax = 17 - function number
614
Returned value:
611
Returned value:
615
  * if the buffer is empty, function returns eax=1
612
  * if the buffer is empty, function returns eax=1
616
  * if the buffer is not empty, function returns:
613
  * if the buffer is not empty:
617
    high 24 bits of eax contain button identifier (in particular, ah
614
    * high 24 bits of eax contain button identifier (in particular,
618
    contains low byte of the identifier; if all buttons have
615
      ah contains low byte of the identifier; if all buttons have
619
    the identifier less than 256, ah is enough to distinguish),
616
      the identifier less than 256, ah is enough to distinguish)
620
    and al contain 0 - if used left mouse button or bit of the used another mouse button
617
    * al = 0 - the button was pressed with left mouse button
-
 
618
    * al = bit corresponding to used mouse button otherwise
621
Remarks:
619
Remarks:
622
  * "Buffer" keeps only one button, at pressing the new button the
620
  * "Buffer" keeps only one button, at pressing the new button the
623
    information about old is lost.
621
    information about old is lost.
624
  * The call of this function by an application with inactive window
622
  * The call of this function by an application with inactive window
625
    will return answer "buffer is empty".
623
    will return answer "buffer is empty".
-
 
624
  * Returned value for al corresponds to the state of mouse buttons
-
 
625
    as in subfunction 2 of function 37 at the beginning
-
 
626
    of button press, excluding lower bit, which is cleared.
Line 626... Line 627...
626
 
627
 
627
======================================================================
628
======================================================================
628
= Function 18, subfunction 2 - terminate process/thread by the slot. =
629
= Function 18, subfunction 2 - terminate process/thread by the slot. =
629
======================================================================
630
======================================================================
Line 729... Line 730...
729
  * ecx = 2 - number of the subsubfunction
730
  * ecx = 2 - number of the subsubfunction
730
Returned value:
731
Returned value:
731
  * function does not return value
732
  * function does not return value
Line 732... Line 733...
732
 
733
 
733
======================================================================
734
======================================================================
734
============ Function 18, subfunction 9 - system shutdown. ===========
735
== Function 18, subfunction 9 - system shutdown with the parameter. ==
735
======================================================================
736
======================================================================
736
Parameters:
737
Parameters:
737
  * eax = 18 - function number
738
  * eax = 18 - function number
738
  * ebx = 9 - subfunction number
739
  * ebx = 9 - subfunction number
Line 745... Line 746...
745
  * by correct call function always returns eax=0
746
  * by correct call function always returns eax=0
746
    as the tag of success
747
    as the tag of success
747
Remarks:
748
Remarks:
748
  * Do not rely on returned value by incorrect call, it can be
749
  * Do not rely on returned value by incorrect call, it can be
749
    changed in future versions of the kernel.
750
    changed in future versions of the kernel.
750
  * It is possible to use subfunction 1, that on the last step
-
 
751
    the user makes choice himself.
-
 
-
 
751
 
752
======================================================================
752
======================================================================
753
===== Function 18, subfunction 10 - minimize application window. =====
753
===== Function 18, subfunction 10 - minimize application window. =====
754
======================================================================
754
======================================================================
755
Minimizes the own window.
755
Minimizes the own window.
756
Parameters:
756
Parameters:
Line 1125... Line 1125...
1125
Remarks:
1125
Remarks:
1126
  * CD base is used by function 24.
1126
  * CD base is used by function 24.
1127
  * To get CD base use subfunction 3 of function 26.
1127
  * To get CD base use subfunction 3 of function 26.
Line 1128... Line 1128...
1128
 
1128
 
1129
======================================================================
-
 
1130
====== Function 21, subfunction 4 - set Sound Blaster base port. =====
-
 
1131
======================================================================
-
 
1132
Removed
-
 
1133
 
-
 
1134
======================================================================
1129
======================================================================
1135
========== Function 21, subfunction 5 - set system language. =========
1130
========== Function 21, subfunction 5 - set system language. =========
1136
======================================================================
1131
======================================================================
1137
Parameters:
1132
Parameters:
1138
  * eax = 21 - function number
1133
  * eax = 21 - function number
Line 1190... Line 1185...
1190
  * To get the number of partitions of a hard disk use 
1185
  * To get the number of partitions of a hard disk use
1191
    subfunction 11 of function 18.
1186
    subfunction 11 of function 18.
1192
  * It is also necessary to define used HD base by subfunction 7.
1187
  * It is also necessary to define used HD base by subfunction 7.
Line 1193... Line 1188...
1193
 
1188
 
1194
======================================================================
-
 
1195
======== Function 21, subfunction 10 - set sound DMA channel. ========
-
 
1196
======================================================================
-
 
1197
Removed
-
 
1198
 
-
 
1199
======================================================================
1189
======================================================================
1200
 Function 21, subfunction 11 - enable/disable low-level access to HD. 
1190
 Function 21, subfunction 11 - enable/disable low-level access to HD.
1201
======================================================================
1191
======================================================================
1202
Parameters:
1192
Parameters:
1203
  * eax = 21 - function number
1193
  * eax = 21 - function number
Line 1482... Line 1472...
1482
Remarks:
1472
Remarks:
1483
  * The function is supported only for ATAPI devices (CD and DVD).
1473
  * The function is supported only for ATAPI devices (CD and DVD).
1484
  * An example of usage of the function is the application CD_tray.
1474
  * An example of usage of the function is the application CD_tray.
Line 1485... Line 1475...
1485
 
1475
 
1486
======================================================================
-
 
1487
=================== Function 25 - set SBPro volume. ==================
-
 
1488
======================================================================
-
 
1489
Removed
-
 
1490
 
-
 
1491
======================================================================
1476
======================================================================
1492
======== Function 26, subfunction 1 - get MPU MIDI base port. ========
1477
======== Function 26, subfunction 1 - get MPU MIDI base port. ========
1493
======================================================================
1478
======================================================================
1494
Parameters:
1479
Parameters:
1495
  * eax = 26 - function number
1480
  * eax = 26 - function number
Line 1546... Line 1531...
1546
Remarks:
1531
Remarks:
1547
  * CD base is used by function 24.
1532
  * CD base is used by function 24.
1548
  * To set CD base use subfunction 3 of function 21.
1533
  * To set CD base use subfunction 3 of function 21.
Line 1549... Line 1534...
1549
 
1534
 
1550
======================================================================
-
 
1551
====== Function 26, subfunction 4 - get Sound Blaster base port. =====
-
 
1552
======================================================================
-
 
1553
Removed
-
 
1554
 
-
 
1555
======================================================================
1535
======================================================================
1556
========== Function 26, subfunction 5 - get system language. =========
1536
========== Function 26, subfunction 5 - get system language. =========
1557
======================================================================
1537
======================================================================
1558
Parameters:
1538
Parameters:
1559
  * eax = 26 - function number
1539
  * eax = 26 - function number
Line 1613... Line 1593...
1613
  * Counter takes modulo 2^32, that correspond to a little more
1593
  * Counter takes modulo 2^32, that correspond to a little more
1614
    than 497 days.
1594
    than 497 days.
1615
  * To get system time use function 3.
1595
  * To get system time use function 3.
Line 1616... Line 1596...
1616
 
1596
 
1617
======================================================================
-
 
1618
======== Function 26, subfunction 10 - get sound DMA channel. ========
-
 
1619
======================================================================
-
 
1620
Removed
-
 
1621
 
-
 
1622
======================================================================
1597
======================================================================
1623
===================== Function 26, subfunction 11 ====================
1598
===================== Function 26, subfunction 11 ====================
1624
========== Find out whether low-level HD access is enabled. ==========
1599
========== Find out whether low-level HD access is enabled. ==========
1625
======================================================================
1600
======================================================================
1626
Parameters:
1601
Parameters:
Line 1645... Line 1620...
1645
  * Is used by operations with PCI bus (function 62).
1620
  * Is used by operations with PCI bus (function 62).
1646
  * The current implementation uses only low bit of ecx.
1621
  * The current implementation uses only low bit of ecx.
1647
  * To set the current state use subfunction 12 of function 21.
1622
  * To set the current state use subfunction 12 of function 21.
Line 1648... Line 1623...
1648
 
1623
 
1649
======================================================================
-
 
1650
=================== Function 28 - set SB16 volume. ===================
-
 
1651
======================================================================
-
 
1652
Removed
-
 
1653
 
-
 
1654
======================================================================
1624
======================================================================
1655
=================== Function 29 - get system date. ===================
1625
=================== Function 29 - get system date. ===================
1656
======================================================================
1626
======================================================================
1657
Parameters:
1627
Parameters:
1658
  * eax = 29 - function number
1628
  * eax = 29 - function number
Line 1688... Line 1658...
1688
Remarks:
1658
Remarks:
1689
  * If the buffer is too small to hold all data, only first (edx-1)
1659
  * If the buffer is too small to hold all data, only first (edx-1)
1690
    bytes are copied and than terminating 0 is inserted.
1660
    bytes are copied and than terminating 0 is inserted.
Line 1691... Line 1661...
1691
 
1661
 
-
 
1662
======================================================================
-
 
1663
=============== Function 32 - delete file from ramdisk. ==============
-
 
1664
======================================================================
-
 
1665
Parameters:
-
 
1666
  * eax = 32 - function number
-
 
1667
  * ebx = pointer to the filename
-
 
1668
Returned value:
-
 
1669
  * eax = 0 - success; otherwise file system error code
-
 
1670
Remarks:
-
 
1671
  * This function is obsolete; function 58 allows to fulfill
-
 
1672
    the same operations with the extended possibilities.
-
 
1673
  * The current implementation returns only values 0(success) and
-
 
1674
    5(file not found).
-
 
1675
  * The filename must be either in the format 8+3 characters
-
 
1676
    (first 8 characters - name itself, last 3 - extension,
-
 
1677
    the short names and extensions are supplemented with spaces),
-
 
1678
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
-
 
1679
    (name no more than 8 characters, dot, extension 3 characters
-
 
1680
    supplemented if necessary by spaces).
-
 
1681
    The filename must be written with capital letters. The terminating
-
 
1682
    character with code 0 is not necessary (not ASCIIZ-string).
-
 
1683
  * This function does not support folders on the ramdisk.
-
 
1684
 
-
 
1685
======================================================================
-
 
1686
================ Function 33 - write file to ramdisk. ================
-
 
1687
======================================================================
-
 
1688
Parameters:
-
 
1689
  * eax = 33 - function number
-
 
1690
  * ebx = pointer to the filename
-
 
1691
  * ecx = pointer to data for writing
-
 
1692
  * edx = number of bytes for writing
-
 
1693
  * should be set esi=0
-
 
1694
Returned value:
-
 
1695
  * eax = 0 - success, otherwise file system error code
-
 
1696
Remarks:
-
 
1697
  * This function is obsolete; function 70 allows to fulfil
-
 
1698
    the same operations with extended possibilities.
-
 
1699
  * If esi contains non-zero value and selected file already exists,
-
 
1700
    one more file with the same name will be created.
-
 
1701
  * Otherwise file will be overwritten.
-
 
1702
  * The filename must be either in the format 8+3 characters
-
 
1703
    (first 8 characters - name itself, last 3 - extension,
-
 
1704
    the short names and extensions are supplemented with spaces),
-
 
1705
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
-
 
1706
    (name no more than 8 characters, dot, extension 3 characters
-
 
1707
    supplemented if necessary by spaces).
-
 
1708
    The filename must be written with capital letters. The terminating
-
 
1709
    character with code 0 is not necessary (not ASCIIZ-string).
-
 
1710
  * This function does not support folders on the ramdisk.
-
 
1711
 
1692
======================================================================
1712
======================================================================
1693
======= Function 35 - read the color of a pixel on the screen. =======
1713
======= Function 35 - read the color of a pixel on the screen. =======
1694
======================================================================
1714
======================================================================
1695
Parameters:
1715
Parameters:
1696
  * eax = 35
1716
  * eax = 35
Line 1705... Line 1725...
1705
  * There is also direct access (without any system calls)
1725
  * There is also direct access (without any system calls)
1706
    to videomemory through the selector gs. To get parameters of
1726
    to videomemory through the selector gs. To get parameters of
1707
    the current videomode, use function 61.
1727
    the current videomode, use function 61.
Line 1708... Line 1728...
1708
 
1728
 
-
 
1729
======================================================================
-
 
1730
=================== Function 36 - read screen area. ==================
-
 
1731
======================================================================
-
 
1732
Paramters:
-
 
1733
  * eax = 36 - function number
-
 
1734
  * ebx = pointer to the previously allocated memory area,
-
 
1735
        where will be placed the image in the format BBGGRRBBGGRR...
-
 
1736
  * ecx = [size on axis x]*65536 + [size on axis y]
-
 
1737
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
-
 
1738
Returned value:
-
 
1739
  * function does not return value
-
 
1740
Remarks:
-
 
1741
  * Coordinates of the image are coordinates of the upper left corner
-
 
1742
    of the image relative to the screen.
-
 
1743
  * Size of the image in bytes is 3*xsize*ysize.
-
 
1744
 
1709
======================================================================
1745
======================================================================
1710
=================== Function 37 - work with mouse. ===================
1746
=================== Function 37 - work with mouse. ===================
Line 1711... Line 1747...
1711
======================================================================
1747
======================================================================
1712
 
1748
 
Line 1897... Line 1933...
1897
  * eax = owner PID
1933
  * eax = owner PID
1898
  * eax = 0, if there is no owner
1934
  * eax = 0, if there is no owner
1899
  * eax = -1 for incorrect ebx
1935
  * eax = -1 for incorrect ebx
Line 1900... Line 1936...
1900
 
1936
 
1901
======================================================================
1937
======================================================================
1902
==================== Function 42 - work with IRQ data. ===============
1938
================== Function 42 - work with IRQ data. =================
1903
======================================================================
-
 
1904
 
-
 
1905
------------------------ Reading data --------------------------------
-
 
1906
 
1939
======================================================================
1907
When an IRQ occurs, the system reads data from ports indicated
1940
When an IRQ occurs, the system reads data from ports indicated
1908
earlier by function 44 and writes this data to
1941
earlier by function 44 and writes this data to
-
 
1942
internal buffer. This function reads out data from that buffer.
1909
internal buffer. This function reads out data from that buffer
1943
 
1910
to the buffer specified as parameter.
1944
--------------------- Subfunction 0 - read data ----------------------
1911
Parameters:
1945
Parameters:
1912
  * eax = 42 - function number
1946
  * eax = 42 - function number
1913
  * bl = IRQ number, 0..15
1947
  * bl = IRQ number, 0..15
1914
  * bh = subfunction number, 0
1948
  * bh = 0 - subfunction number
1915
Other part of register ebx, must be zero.
1949
  * rest of ebx must be zeroed
1916
  * ecx = pointer to the receive buffer
1950
  * ecx = pointer to a buffer with size not less than 4000 bytes
1917
Returned value: (use value of eax to distinguish)
1951
Returned value: (use value of eax to distinguish)
1918
  * if the thread is not IRQ owner (or IRQ number is incorrect):
1952
  * if the thread is not IRQ owner
1919
    * eax = -1
1953
    (or IRQ number is incorrect): eax = -1
1920
  * if there is no data:
-
 
1921
    * eax = 0
1954
  * if there is no data: eax = 0
1922
  * if all is ok:
1955
  * if all is ok:
1923
    * eax = byte size of data, read from buffer
-
 
1924
 
-
 
1925
See remarks below.
-
 
1926
 
-
 
Line -... Line 1956...
-
 
1956
    eax = size of data read (in bytes)
1927
------------------------ Get data size -------------------------------
1957
 
1928
 
1958
------------- Subfunction 1 - get size of data in buffer -------------
1929
Parameters:
1959
Parameters:
1930
  * eax = 42 - function number
1960
  * eax = 42 - function number
1931
  * bl = IRQ number, 0..15
1961
  * bl = IRQ number, 0..15
1932
  * bh = subfunction number, 0
-
 
1933
Other part of register ebx, must be zero.
1962
  * bh = 0 - subfunction number
1934
  * ecx = pointer to receive buffer
1963
  * rest of ebx must be zeroed
1935
Returned value: (use value of eax to distinguish)
1964
Returned value:
1936
  * if the thread is not IRQ owner (or IRQ number is incorrect):
-
 
1937
    * eax = -1
1965
  * if the thread is not IRQ owner
1938
  * if all is ok:
-
 
1939
    * eax = byte size of data in buffer
1966
    (or IRQ number is incorrect): eax = -1
1940
 
1967
  * otherwise eax = size of data in buffer
1941
Remarks:
1968
Remarks:
1942
  * Previously the thread must reserve indicated IRQ for itself
1969
  * Previously the thread must reserve indicated IRQ for itself
1943
    by function 45.
1970
    by function 45.
Line 2560... Line 2587...
2560
Remarks:
2587
Remarks:
2561
  * The current implementation does not close automatically all
2588
  * The current implementation does not close automatically all
2562
    sockets of a thread at termination. In particular, one should not
2589
    sockets of a thread at termination. In particular, one should not
2563
    kill a thread with many opened sockets - there will be an outflow
2590
    kill a thread with many opened sockets - there will be an outflow
2564
    of resources.
2591
    of resources.
2565
  * The current implementation does no checks on correctness
-
 
2566
    (function returns error only if thread tries to close not opened
-
 
2567
    socket with correct handle).
-
 
Line 2568... Line 2592...
2568
 
2592
 
2569
======================================================================
2593
======================================================================
2570
============== Function 53, subfunction 2 - poll socket. =============
2594
============== Function 53, subfunction 2 - poll socket. =============
2571
======================================================================
2595
======================================================================
2572
Parameters:
2596
Parameters:
2573
  * eax = 53 - function number
2597
  * eax = 53 - function number
2574
  * ebx = 2 - subfunction number
2598
  * ebx = 2 - subfunction number
2575
  * ecx = socket handle
2599
  * ecx = socket handle
2576
Returned value:
2600
Returned value:
2577
  * eax = number of read bytes
2601
  * eax = number of read bytes, 0 for incorrect handle
2578
  * ebx destroyed
-
 
2579
Remarks:
-
 
Line 2580... Line 2602...
2580
  * There is no checks for correctness.
2602
  * ebx destroyed
2581
 
2603
 
2582
======================================================================
2604
======================================================================
2583
========= Function 53, subfunction 3 - read byte from socket. ========
2605
========= Function 53, subfunction 3 - read byte from socket. ========
2584
======================================================================
2606
======================================================================
2585
Parameters:
2607
Parameters:
2586
  * eax = 53 - function number
2608
  * eax = 53 - function number
2587
  * ebx = 3 - subfunction number
2609
  * ebx = 3 - subfunction number
2588
  * ecx = socket handle
2610
  * ecx = socket handle
2589
Returned value:
2611
Returned value:
2590
  * if there is no read data: eax=0, bl=0,
2612
  * if there is no read data or handle is incorrect: eax=0, bl=0,
2591
    other bytes of ebx are destroyed
2613
    other bytes of ebx are destroyed
2592
  * if there are read data: eax=number of rest bytes
-
 
2593
    (possibly 0), bl=read byte, other bytes of ebx are destroyed
-
 
Line 2594... Line 2614...
2594
Remarks:
2614
  * if there are read data: eax=number of rest bytes
2595
  * There is no checks for correctness.
2615
    (possibly 0), bl=read byte, other bytes of ebx are destroyed
2596
 
2616
 
2597
======================================================================
2617
======================================================================
Line 2602... Line 2622...
2602
  * ebx = 4 - subfunction number
2622
  * ebx = 4 - subfunction number
2603
  * ecx = socket handle
2623
  * ecx = socket handle
2604
  * edx = number of bytes to write
2624
  * edx = number of bytes to write
2605
  * esi = pointer to data to write
2625
  * esi = pointer to data to write
2606
Returned value:
2626
Returned value:
2607
  * eax = 0xffffffff - invalid handle
2627
  * eax = 0xffffffff - error (invalid handle or not enough memory)
2608
  * eax = 0xffff - not enough memory
-
 
2609
  * eax = 0 - success
2628
  * eax = 0 - success
2610
  * ebx destroyed
2629
  * ebx destroyed
2611
Remarks:
2630
Remarks:
2612
  * Check on validity of handle is minimal - only not very incorrect
-
 
2613
    not opened handles are eliminated.
-
 
2614
  * Number of bytes to write must not exceed 1500-28, though
2631
  * Number of bytes to write must not exceed 1500-28, though
2615
    the appropriate check is not made.
2632
    the appropriate check is not made.
Line 2616... Line 2633...
2616
 
2633
 
2617
======================================================================
2634
======================================================================
Line 2636... Line 2653...
2636
Parameters:
2653
Parameters:
2637
  * eax = 53 - function number
2654
  * eax = 53 - function number
2638
  * ebx = 6 - subfunction number
2655
  * ebx = 6 - subfunction number
2639
  * ecx = socket handle
2656
  * ecx = socket handle
2640
Returned value:
2657
Returned value:
2641
  * eax = socket status: one of
2658
  * eax = 0 for incorrect handle or socket status: one of
2642
  * TCB_LISTEN = 1
2659
  * TCB_LISTEN = 1
2643
  * TCB_SYN_SENT = 2
2660
  * TCB_SYN_SENT = 2
2644
  * TCB_SYN_RECEIVED = 3
2661
  * TCB_SYN_RECEIVED = 3
2645
  * TCB_ESTABLISHED = 4
2662
  * TCB_ESTABLISHED = 4
2646
  * TCB_FIN_WAIT_1 = 5
2663
  * TCB_FIN_WAIT_1 = 5
Line 2648... Line 2665...
2648
  * TCB_CLOSE_WAIT = 7
2665
  * TCB_CLOSE_WAIT = 7
2649
  * TCB_CLOSING = 8
2666
  * TCB_CLOSING = 8
2650
  * TCB_LAST_ASK = 9
2667
  * TCB_LAST_ASK = 9
2651
  * TCB_TIME_WAIT = 10
2668
  * TCB_TIME_WAIT = 10
2652
  * TCB_CLOSED = 11
2669
  * TCB_CLOSED = 11
2653
  * ebx destroys
2670
  * ebx destroyed
2654
Remarks:
-
 
2655
  * There is no checks for correctness.
-
 
Line 2656... Line 2671...
2656
 
2671
 
2657
======================================================================
2672
======================================================================
2658
========== Function 53, subfunction 7 - write to TCP-socket. =========
2673
========== Function 53, subfunction 7 - write to TCP-socket. =========
2659
======================================================================
2674
======================================================================
Line 2662... Line 2677...
2662
  * ebx = 7 - subfunction number
2677
  * ebx = 7 - subfunction number
2663
  * ecx = socket handle
2678
  * ecx = socket handle
2664
  * edx = number of bytes to write
2679
  * edx = number of bytes to write
2665
  * esi = pointer to data to write
2680
  * esi = pointer to data to write
2666
Returned value:
2681
Returned value:
2667
  * eax = 0xffffffff - error
-
 
2668
  * eax = 0xffff - not enough memory
2682
  * eax = 0xffffffff - error (invalid handle or not enough memory)
2669
  * eax = 0 - success
2683
  * eax = 0 - success
2670
  * ebx destroyed
2684
  * ebx destroyed
2671
Remarks:
2685
Remarks:
2672
  * Check on validity of handle is minimal - only not very incorrect
-
 
2673
    not opened handles are eliminated.
-
 
2674
  * Number of bytes to write must not exceed 1500-40, though
2686
  * Number of bytes to write must not exceed 1500-40, though
2675
    the appropriate check is not made.
2687
    the appropriate check is not made.
Line 2676... Line 2688...
2676
 
2688
 
2677
======================================================================
2689
======================================================================
Line 2680... Line 2692...
2680
Parameters:
2692
Parameters:
2681
  * eax = 53 - function number
2693
  * eax = 53 - function number
2682
  * ebx = 8 - subfunction number
2694
  * ebx = 8 - subfunction number
2683
  * ecx = socket handle
2695
  * ecx = socket handle
2684
Returned value:
2696
Returned value:
2685
  * eax = -1 - invalid handle
2697
  * eax = -1 - error (invalid handle or
2686
  * eax = 0xffff - not enough memory for socket close packet
2698
    not enough memory for socket close packet)
2687
  * eax = 0 - success
2699
  * eax = 0 - success
2688
  * in many cases eax is destroyed (the result of function 'queue'
-
 
2689
    is returned) - probably this is bug, which will be corrected
-
 
2690
  * ebx destroyed
2700
  * ebx destroyed
2691
Remarks:
2701
Remarks:
2692
  * The current implementation does not close automatically all
2702
  * The current implementation does not close automatically all
2693
    sockets of a thread at termination. In particular, one should not
2703
    sockets of a thread at termination. In particular, one should not
2694
    kill a thread with many opened sockets - there will be an outflow
2704
    kill a thread with many opened sockets - there will be an outflow
2695
    of resources.
2705
    of resources.
2696
  * The current implementation does no checks on correctness
-
 
2697
    (function returns error only if thread tries to close not opened
-
 
2698
    socket with correct handle).
-
 
Line 2699... Line 2706...
2699
 
2706
 
2700
======================================================================
2707
======================================================================
2701
=== Function 53, subfunction 9 - check whether local port is free. ===
2708
=== Function 53, subfunction 9 - check whether local port is free. ===
2702
======================================================================
2709
======================================================================
Line 2734... Line 2741...
2734
  * ecx = socket handle
2741
  * ecx = socket handle
2735
  * edx = pointer to buffer
2742
  * edx = pointer to buffer
2736
  * esi = number of bytes to read;
2743
  * esi = number of bytes to read;
2737
  * esi = 0 - read all data (maximum 4096 bytes)
2744
  * esi = 0 - read all data (maximum 4096 bytes)
2738
Returned value:
2745
Returned value:
2739
  * eax = number of bytes read
2746
  * eax = number of bytes read (0 for incorrect handle)
2740
  * ebx destroyed
2747
  * ebx destroyed
2741
Remakrs:
-
 
2742
  * There is no check on handle correctness.
-
 
Line 2743... Line 2748...
2743
 
2748
 
2744
======================================================================
2749
======================================================================
2745
= Function 53, subfunction 255 - debug information of network driver. 
2750
= Function 53, subfunction 255 - debug information of network driver.
2746
======================================================================
2751
======================================================================
Line 2771... Line 2776...
2771
  * 4: total number of dumped received packets
2776
  * 4: total number of dumped received packets
2772
  * 5: total number of received ARP-packets
2777
  * 5: total number of received ARP-packets
2773
  * 6: status of packet driver, 0=inactive, nonzero=active
2778
  * 6: status of packet driver, 0=inactive, nonzero=active
Line 2774... Line 2779...
2774
 
2779
 
2775
======================================================================
-
 
2776
========== Function 55, subfunction 0 - load data for SB16. ==========
-
 
2777
======================================================================
-
 
2778
Parameters:
-
 
2779
  * eax = 55 - function number
-
 
2780
  * ebx = 0 - subfunction number
-
 
2781
  * ecx = pointer to data (is copied 64 kilobytes, is used as much as
-
 
2782
    set by subfunction 2)
-
 
2783
Returned value:
-
 
2784
  * function does not return value
-
 
2785
Remarks:
-
 
2786
  * Format and size of data are set by subfunction 2.
-
 
2787
 
-
 
2788
======================================================================
-
 
2789
======== Function 55, subfunction 1 - begin play data on SB16. =======
-
 
2790
======================================================================
-
 
2791
Parameters:
-
 
2792
  * eax = 55 - function number
-
 
2793
  * ebx = 1 - subfunction number
-
 
2794
Returned value:
-
 
2795
  * function does not return value
-
 
2796
Remarks:
-
 
2797
  * Previously data must be loaded by subfunction 0 and
-
 
2798
    their format must be defined by subfunction 2.
-
 
2799
  * Function returns control, when playing of data began; after that
-
 
2800
    play goes independently from application (and does not use
-
 
2801
    processor time at all).
-
 
2802
  * Previously must be defined SB16 base port
-
 
2803
    (by subfunction 4 of function 21) and DMA channel
-
 
2804
    (by subfunction 10 of function 21).
-
 
2805
 
-
 
2806
======================================================================
-
 
2807
======== Function 55, subfunction 2 - set format of SB16 data. =======
-
 
2808
======================================================================
-
 
2809
Parameters:
-
 
2810
  * eax = 55 - function number
-
 
2811
  * ebx = 2 - subfunction number
-
 
2812
  * ecx = 0 - set digit capacity
-
 
2813
    * edx = 1 - 8bit mono
-
 
2814
    * edx = 2 - 8bit stereo
-
 
2815
  * ecx = 1 - set data size
-
 
2816
    * edx = size in bytes
-
 
2817
  * ecx = 2 - set play frequency
-
 
2818
    * edx = frequency
-
 
2819
Returned value:
-
 
2820
  * function does not return value
-
 
2821
Remarks:
-
 
2822
  * When the system boots, it sets following default parameters:
-
 
2823
    digit capacity - 8bit mono, size - 64 Kb, frequency - 44100 Hz.
-
 
2824
    Nevertheless it is recommended to set necessary values obviously
-
 
2825
    as they could be reset by some application.
-
 
2826
 
-
 
2827
======================================================================
2780
======================================================================
2828
 Function 55, subfunction 55 - begin to play data on built-in speaker. 
2781
 Function 55, subfunction 55 - begin to play data on built-in speaker.
2829
======================================================================
2782
======================================================================
2830
Parameters:
2783
Parameters:
2831
  * eax = 55 - function number
2784
  * eax = 55 - function number
Line 3373... Line 3326...
3373
Parameters:
3326
Parameters:
3374
  * eax = 65 - function number
3327
  * eax = 65 - function number
3375
  * ebx = pointer to the image
3328
  * ebx = pointer to the image
3376
  * ecx = [size on axis x]*65536 + [size on axis y]
3329
  * ecx = [size on axis x]*65536 + [size on axis y]
3377
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
3330
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
3378
  * esi = number of bits per pixel, must be 8, 24 or 32
3331
  * esi = number of bits per pixel, must be 1,2,4,8,15,16,24 or 32
3379
  * edi = pointer to palette (256 colors 0x00RRGGBB);
3332
  * edi = pointer to palette (2 to the power esi colors 0x00RRGGBB);
3380
          ignored when esi = 24 and 32
3333
          ignored when esi > 8
3381
  * ebp = offset of next row data relative to previous row data
3334
  * ebp = offset of next row data relative to previous row data
3382
Returned value:
3335
Returned value:
3383
  * function does not return value
3336
  * function does not return value
3384
Remarks:
3337
Remarks:
3385
  * Coordinates of the image are coordinates of the upper left corner
3338
  * Coordinates of the image are coordinates of the upper left corner
3386
    of the image relative to the window.
3339
    of the image relative to the window.
3387
  * Size of the image in bytes is xsize*ysize.
3340
  * Format of image with 1 bit per pixel: each byte of image
-
 
3341
    (possibly excluding last bytes in rows), contains information on
-
 
3342
    the color of 8 pixels, MSB corresponds to first pixel.
-
 
3343
  * Format of image with 2 bits per pixel: each byte of image
-
 
3344
    (possibly excluding last bytes in rows), contains information on
-
 
3345
    the color of 4 pixels, two MSBs correspond to first pixel.
-
 
3346
  * Format of image with 4 bits per pixel: each byte of image
-
 
3347
    excluding last bytes in rows (if width is odd) contains
-
 
3348
    information on the color of 2 pixels, high-order tetrad
-
 
3349
    corresponds to first pixel.
-
 
3350
  * Format of image with 8 bits per pixel: each byte of image is
3388
  * Each byte of image is index in the palette.
3351
    index in the palette.
3389
  * If the image uses less than 256 colors, palette size may be
3352
  * Format of image with 15 bits per pixel: the color of each pixel
-
 
3353
    is coded as (bit representation) 0RRRRRGGGGGBBBBB - 5 bits per
3390
    less than 256 too.
3354
    each color.
-
 
3355
  * Format of image with 16 bits per pixel: the color of each pixel
-
 
3356
    is coded as RRRRRGGGGGGBBBBB (5+6+5).
-
 
3357
  * Format of image with 24 bits per pixel: the color of each pixel
-
 
3358
    is coded as 3 bytes - sequentially blue, green, red components.
-
 
3359
  * Format of image with 32 bits per pixel: similar to 24, but
-
 
3360
    one additional ignored byte is present.
3391
  * The call to function 7 is equivalent to call to this function
3361
  * The call to function 7 is equivalent to call to this function
3392
    with esi=24, ebp=0.
3362
    with esi=24, ebp=0.
Line 3393... Line 3363...
3393
 
3363
 
3394
======================================================================
3364
======================================================================
Line 3641... Line 3611...
3641
Remarks:
3611
Remarks:
3642
  * The memory block must have been allocated by subfunction 12
3612
  * The memory block must have been allocated by subfunction 12
3643
    or subfunction 20.
3613
    or subfunction 20.
Line 3644... Line 3614...
3644
 
3614
 
3645
======================================================================
3615
======================================================================
-
 
3616
===================== Function 68, subfunction 14 ====================
3646
======== Function 68, subfunction 14 - wait for driver notify. =======
3617
====== Waiting delivering of signal from another program/driver ======
3647
======================================================================
3618
======================================================================
3648
Parameters:
3619
Parameters:
3649
  * eax = 68 - function number
3620
  * eax = 68 - function number
3650
  * ebx = 14 - subfunction number
3621
  * ebx = 14 - subfunction number
3651
  * ecx = pointer to the buffer for information (8 bytes)
3622
  * ecx = pointer to the buffer for information (24 bytes)
3652
Returned value:
3623
Returned value:
3653
  * buffer pointed to by ecx contains the following information:
3624
  * buffer pointed to by ecx contains the following information:
3654
    * +0: dword: constant EV_INTR = 1
-
 
3655
    * +4: dword: driver data
-
 
3656
Remarks:
3625
    * +0: dword: identifier for underlying data of signal
3657
  * The current implementation at wait time uses "heavy" operations
3626
    * +4: data of signal (20 bytes), format of which is defining by
Line 3658... Line 3627...
3658
    of task switch.
3627
          first dword
3659
 
3628
 
3660
======================================================================
3629
======================================================================
3661
====== Function 68, subfunction 15 - set FPU exception handler. ======
-
 
3662
======================================================================
3630
====== Function 68, subfunction 15 - set FPU exception handler. ======
3663
Parameters:
3631
======================================================================
3664
  * eax = 68 - function number
-
 
3665
  * ebx = 15 - subfunction number
-
 
3666
  * ecx = address of the new exception handler
-
 
Line 3667... Line 3632...
3667
Returned value:
3632
Deleted (in current implementation only 0 is returned).
3668
  * eax = address of the old exception handler (0, if it was not set)
3633
Using subfunctions 24, 25 is true.
3669
 
3634
 
3670
======================================================================
3635
======================================================================
Line 3697... Line 3662...
3697
    * +8: dword: pointer to input data
3662
    * +8: dword: pointer to input data
3698
    * +12 = +0xC: dword: size of input data
3663
    * +12 = +0xC: dword: size of input data
3699
    * +16 = +0x10: dword: pointer to output data
3664
    * +16 = +0x10: dword: pointer to output data
3700
    * +20 = +0x14: dword: size of output data
3665
    * +20 = +0x14: dword: size of output data
3701
Returned value:
3666
Returned value:
3702
  * eax = determined by driver
3667
  * eax =  error code
-
 
3668
      0  - successful call
-
 
3669
     -1  - any error.
-
 
3670
     -2, -3, -4, etc. reserved for kernel error codes
-
 
3671
      1, 2, 3, etc    driver specific error codes
3703
Remarks:
3672
Remarks:
3704
  * Function codes and the structure of input/output data
3673
  * Function codes and the structure of input/output data
3705
    are defined by driver.
3674
    are defined by driver.
3706
  * Previously one must obtain driver handle by subfunction 16.
3675
  * Previously one must obtain driver handle by subfunction 16.
Line 3707... Line 3676...
3707
 
3676
 
3708
======================================================================
3677
======================================================================
3709
====== Function 68, subfunction 18 - set SSE exception handler. ======
3678
====== Function 68, subfunction 18 - set SSE exception handler. ======
3710
======================================================================
-
 
3711
Parameters:
3679
======================================================================
3712
  * eax = 68 - function number
3680
Deleted (in current implementation only 0 is returned).
3713
  * ebx = 15 - subfunction number
-
 
3714
  * ecx = address of the new exception handler
-
 
3715
Returned value:
-
 
Line 3716... Line 3681...
3716
  * eax = address of the old exception handler (0, if it was not set)
3681
Using subfunctions 24, 25 is true.
3717
 
3682
 
3718
======================================================================
3683
======================================================================
3719
=============== Function 68, subfunction 19 - load DLL. ==============
3684
=============== Function 68, subfunction 19 - load DLL. ==============
Line 3752... Line 3717...
3752
  * If ecx=0, the function frees memory block at edx and returns 0.
3717
  * If ecx=0, the function frees memory block at edx and returns 0.
3753
  * The contents of the block are unchanged up to the shorter of
3718
  * The contents of the block are unchanged up to the shorter of
3754
    the new and old sizes.
3719
    the new and old sizes.
Line 3755... Line 3720...
3755
 
3720
 
-
 
3721
======================================================================
-
 
3722
====== Function 68, subfunction 24 - set new exceptions handler ======
-
 
3723
======================================================================
-
 
3724
Parameters:
-
 
3725
  * eax = 68 - function number
-
 
3726
  * ebx = 24 - subfunction number
-
 
3727
  * ecx = address of the new exception handler
-
 
3728
  * edx = the mask of processing exceptions
-
 
3729
Returned value:
-
 
3730
  * eax = address of the old exception handler (0, if it was not set)
-
 
3731
  * ebx = the old mask of exception handler
-
 
3732
Remarks:
-
 
3733
  * Bit number in mask of exceptions is correspond to exception number
-
 
3734
    by CPU-specification (Intel-PC). For example, FPU-exception have
-
 
3735
    number 16 (#MF), and SSE-exception - 19 (#XF)
-
 
3736
  * The current implementation ignore the inquiry for hook of 7
-
 
3737
    exception - system process #NM by one's own.
-
 
3738
  * User handler get exception number in stack parameter. So, correct
-
 
3739
    exit from handler is: RET 4. Return from handler is to the same
-
 
3740
    instruction, that was cause the exception
-
 
3741
  * When control is transfering to user handler, corresponding bit in
-
 
3742
    exception mask is clearing. Rising this exception in consequence
-
 
3743
    - reduce to default-handling. Exactly: terminating the application,
-
 
3744
    or suspending with debug-notify to owner.
-
 
3745
  * After completion of critical operations in user handler, it may be
-
 
3746
    rising corresponding bit in exception mask by using subfunction 25
-
 
3747
    Clearing exceptions flags in FPU and/or XMM modules - is
-
 
3748
    responsibility of user handler too.
-
 
3749
 
-
 
3750
======================================================================
-
 
3751
==== Function 68, subfunction 25 - change state of signal activity ===
-
 
3752
======================================================================
-
 
3753
Parameters:
-
 
3754
  * eax = 68 - function number
-
 
3755
  * ebx = 25 - subfunction number
-
 
3756
  * ecx = signal number
-
 
3757
  * edx = value of activity (0/1)
-
 
3758
Returned value:
-
 
3759
  * eax = value of old activity for this signal (0/1)
-
 
3760
Remarks:
-
 
3761
  * In current implementation, it is changed only exception mask for
-
 
3762
    user exception handler, wich was previously set by subfunction 24.
-
 
3763
    At that, number of signal correspond to exception number.
-
 
3764
 
3756
======================================================================
3765
======================================================================
3757
====================== Fucntion 69 - debugging. ======================
3766
====================== Fucntion 69 - debugging. ======================
3758
======================================================================
3767
======================================================================
3759
A process can load other process as debugged by set of corresponding
3768
A process can load other process as debugged by set of corresponding
3760
bit by call to subfunction 7 of function 70.
3769
bit by call to subfunction 7 of function 70.
Line 3782... Line 3791...
3782
    * process is suspended
3791
    * process is suspended
3783
When debugger terminates, all debugged processes are killed.
3792
When debugger terminates, all debugged processes are killed.
3784
If debugger does not want this, it must previously detach by
3793
If debugger does not want this, it must previously detach by
3785
subfunction 3.
3794
subfunction 3.
Line 3786... Line 3795...
3786
 
3795
 
3787
All subfunctions except 4 and 5 are applicable only to
-
 
3788
processes/threads started from the current by function 70
3796
All subfunctions are applicable only to processes/threads started
3789
with set debugging flag.
3797
from the current by function 70 with set debugging flag.
3790
Debugging of multithreaded programs is not supported yet.
3798
Debugging of multithreaded programs is not supported yet.
3791
The full list of subfunctions:
3799
The full list of subfunctions:
3792
  * subfunction 0 - define data area for debug messages
3800
  * subfunction 0 - define data area for debug messages
3793
  * subfunction 1 - get contents of registers of debugged thread
3801
  * subfunction 1 - get contents of registers of debugged thread
Line 3882... Line 3890...
3882
  * function does not return value
3890
  * function does not return value
3883
Remarks:
3891
Remarks:
3884
  * If the process was suspended, it resumes execution.
3892
  * If the process was suspended, it resumes execution.
Line 3885... Line 3893...
3885
 
3893
 
3886
======================================================================
3894
======================================================================
3887
============= Function 69, subfunction 4 - suspend thread. ===========
3895
======== Function 69, subfunction 4 - suspend debugged thread. =======
3888
======================================================================
3896
======================================================================
3889
Parameters:
3897
Parameters:
3890
  * eax = 69 - function number
3898
  * eax = 69 - function number
3891
  * ebx = 4 - subfunction number
3899
  * ebx = 4 - subfunction number
3892
  * ecx = thread identifier
3900
  * ecx = thread identifier
3893
Returned value:
3901
Returned value:
-
 
3902
  * function does not return value
-
 
3903
Remarks:
-
 
3904
  * Process must be loaded for debugging (as is shown in
Line 3894... Line 3905...
3894
  * function does not return value
3905
    general description).
3895
 
3906
 
3896
======================================================================
3907
======================================================================
3897
============= Function 69, subfunction 5 - resume thread. ============
3908
======== Function 69, subfunction 5 - resume debugged thread. ========
3898
======================================================================
3909
======================================================================
3899
Parameters:
3910
Parameters:
3900
  * eax = 69 - function number
3911
  * eax = 69 - function number
3901
  * ebx = 5 - subfunction number
3912
  * ebx = 5 - subfunction number
3902
  * ecx = thread identifier
3913
  * ecx = thread identifier
-
 
3914
Returned value:
-
 
3915
  * function does not return value
-
 
3916
Remarks:
Line 3903... Line 3917...
3903
Returned value:
3917
  * Process must be loaded for debugging (as is shown in
3904
  * function does not return value
3918
    general description).
3905
 
3919
 
3906
======================================================================
3920
======================================================================