Rev 991 | Rev 1074 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 991 | Rev 1018 | ||
---|---|---|---|
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 | ||
1709 | ====================================================================== |
1729 | ====================================================================== |
1710 | =============== Function 36 - read screen area. =============== |
1730 | =================== Function 36 - read screen area. ================== |
1711 | ====================================================================== |
1731 | ====================================================================== |
1712 | Paramters: |
1732 | Paramters: |
1713 | * eax = 36 - function number |
1733 | * eax = 36 - function number |
1714 | * ebx = pointer on the previously allocated area of memory, |
1734 | * ebx = pointer to the previously allocated memory area, |
1715 | where will be placed the image in the format BBGGRRBBGGRR... |
1735 | where will be placed the image in the format BBGGRRBBGGRR... |
1716 | * ecx = [size on axis x]*65536 + [size on axis y] |
1736 | * ecx = [size on axis x]*65536 + [size on axis y] |
1717 | * edx = [coordinate on axis x]*65536 + [coordinate on axis y] |
1737 | * edx = [coordinate on axis x]*65536 + [coordinate on axis y] |
1718 | Returned value: |
1738 | Returned value: |
Line 1913... | Line 1933... | ||
1913 | * eax = owner PID |
1933 | * eax = owner PID |
1914 | * eax = 0, if there is no owner |
1934 | * eax = 0, if there is no owner |
1915 | * eax = -1 for incorrect ebx |
1935 | * eax = -1 for incorrect ebx |
Line 1916... | Line 1936... | ||
1916 | 1936 | ||
1917 | ====================================================================== |
1937 | ====================================================================== |
1918 | ==================== Function 42 - work with IRQ data. =============== |
1938 | ================== Function 42 - work with IRQ data. ================= |
1919 | ====================================================================== |
- | |
1920 | - | ||
1921 | ------------------------ Reading data -------------------------------- |
- | |
1922 | 1939 | ====================================================================== |
|
1923 | When an IRQ occurs, the system reads data from ports indicated |
1940 | When an IRQ occurs, the system reads data from ports indicated |
1924 | 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. |
|
1925 | internal buffer. This function reads out data from that buffer |
1943 | |
1926 | to the buffer specified as parameter. |
1944 | --------------------- Subfunction 0 - read data ---------------------- |
1927 | Parameters: |
1945 | Parameters: |
1928 | * eax = 42 - function number |
1946 | * eax = 42 - function number |
1929 | * bl = IRQ number, 0..15 |
1947 | * bl = IRQ number, 0..15 |
1930 | * bh = subfunction number, 0 |
1948 | * bh = 0 - subfunction number |
1931 | Other part of register ebx, must be zero. |
1949 | * rest of ebx must be zeroed |
1932 | * ecx = pointer to the receive buffer |
1950 | * ecx = pointer to a buffer with size not less than 4000 bytes |
1933 | Returned value: (use value of eax to distinguish) |
1951 | Returned value: (use value of eax to distinguish) |
1934 | * if the thread is not IRQ owner (or IRQ number is incorrect): |
1952 | * if the thread is not IRQ owner |
1935 | * eax = -1 |
1953 | (or IRQ number is incorrect): eax = -1 |
1936 | * if there is no data: |
- | |
1937 | * eax = 0 |
1954 | * if there is no data: eax = 0 |
1938 | * if all is ok: |
1955 | * if all is ok: |
1939 | * eax = byte size of data, read from buffer |
- | |
1940 | - | ||
1941 | See remarks below. |
- | |
1942 | - | ||
Line -... | Line 1956... | ||
- | 1956 | eax = size of data read (in bytes) |
|
1943 | ------------------------ Get data size ------------------------------- |
1957 | |
1944 | 1958 | ------------- Subfunction 1 - get size of data in buffer ------------- |
|
1945 | Parameters: |
1959 | Parameters: |
1946 | * eax = 42 - function number |
1960 | * eax = 42 - function number |
1947 | * bl = IRQ number, 0..15 |
1961 | * bl = IRQ number, 0..15 |
1948 | * bh = subfunction number, 0 |
- | |
1949 | Other part of register ebx, must be zero. |
1962 | * bh = 0 - subfunction number |
1950 | * ecx = pointer to receive buffer |
1963 | * rest of ebx must be zeroed |
1951 | Returned value: (use value of eax to distinguish) |
1964 | Returned value: |
1952 | * if the thread is not IRQ owner (or IRQ number is incorrect): |
- | |
1953 | * eax = -1 |
1965 | * if the thread is not IRQ owner |
1954 | * if all is ok: |
- | |
1955 | * eax = byte size of data in buffer |
1966 | (or IRQ number is incorrect): eax = -1 |
1956 | 1967 | * otherwise eax = size of data in buffer |
|
1957 | Remarks: |
1968 | Remarks: |
1958 | * Previously the thread must reserve indicated IRQ for itself |
1969 | * Previously the thread must reserve indicated IRQ for itself |
1959 | by function 45. |
1970 | by function 45. |
Line 2576... | Line 2587... | ||
2576 | Remarks: |
2587 | Remarks: |
2577 | * The current implementation does not close automatically all |
2588 | * The current implementation does not close automatically all |
2578 | sockets of a thread at termination. In particular, one should not |
2589 | sockets of a thread at termination. In particular, one should not |
2579 | 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 |
2580 | of resources. |
2591 | of resources. |
2581 | * The current implementation does no checks on correctness |
- | |
2582 | (function returns error only if thread tries to close not opened |
- | |
2583 | socket with correct handle). |
- | |
Line 2584... | Line 2592... | ||
2584 | 2592 | ||
2585 | ====================================================================== |
2593 | ====================================================================== |
2586 | ============== Function 53, subfunction 2 - poll socket. ============= |
2594 | ============== Function 53, subfunction 2 - poll socket. ============= |
2587 | ====================================================================== |
2595 | ====================================================================== |
2588 | Parameters: |
2596 | Parameters: |
2589 | * eax = 53 - function number |
2597 | * eax = 53 - function number |
2590 | * ebx = 2 - subfunction number |
2598 | * ebx = 2 - subfunction number |
2591 | * ecx = socket handle |
2599 | * ecx = socket handle |
2592 | Returned value: |
2600 | Returned value: |
2593 | * eax = number of read bytes |
2601 | * eax = number of read bytes, 0 for incorrect handle |
2594 | * ebx destroyed |
- | |
2595 | Remarks: |
- | |
Line 2596... | Line 2602... | ||
2596 | * There is no checks for correctness. |
2602 | * ebx destroyed |
2597 | 2603 | ||
2598 | ====================================================================== |
2604 | ====================================================================== |
2599 | ========= Function 53, subfunction 3 - read byte from socket. ======== |
2605 | ========= Function 53, subfunction 3 - read byte from socket. ======== |
2600 | ====================================================================== |
2606 | ====================================================================== |
2601 | Parameters: |
2607 | Parameters: |
2602 | * eax = 53 - function number |
2608 | * eax = 53 - function number |
2603 | * ebx = 3 - subfunction number |
2609 | * ebx = 3 - subfunction number |
2604 | * ecx = socket handle |
2610 | * ecx = socket handle |
2605 | Returned value: |
2611 | Returned value: |
2606 | * 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, |
2607 | other bytes of ebx are destroyed |
2613 | other bytes of ebx are destroyed |
2608 | * if there are read data: eax=number of rest bytes |
- | |
2609 | (possibly 0), bl=read byte, other bytes of ebx are destroyed |
- | |
Line 2610... | Line 2614... | ||
2610 | Remarks: |
2614 | * if there are read data: eax=number of rest bytes |
2611 | * There is no checks for correctness. |
2615 | (possibly 0), bl=read byte, other bytes of ebx are destroyed |
2612 | 2616 | ||
2613 | ====================================================================== |
2617 | ====================================================================== |
Line 2618... | Line 2622... | ||
2618 | * ebx = 4 - subfunction number |
2622 | * ebx = 4 - subfunction number |
2619 | * ecx = socket handle |
2623 | * ecx = socket handle |
2620 | * edx = number of bytes to write |
2624 | * edx = number of bytes to write |
2621 | * esi = pointer to data to write |
2625 | * esi = pointer to data to write |
2622 | Returned value: |
2626 | Returned value: |
2623 | * eax = 0xffffffff - invalid handle |
2627 | * eax = 0xffffffff - error (invalid handle or not enough memory) |
2624 | * eax = 0xffff - not enough memory |
- | |
2625 | * eax = 0 - success |
2628 | * eax = 0 - success |
2626 | * ebx destroyed |
2629 | * ebx destroyed |
2627 | Remarks: |
2630 | Remarks: |
2628 | * Check on validity of handle is minimal - only not very incorrect |
- | |
2629 | not opened handles are eliminated. |
- | |
2630 | * Number of bytes to write must not exceed 1500-28, though |
2631 | * Number of bytes to write must not exceed 1500-28, though |
2631 | the appropriate check is not made. |
2632 | the appropriate check is not made. |
Line 2632... | Line 2633... | ||
2632 | 2633 | ||
2633 | ====================================================================== |
2634 | ====================================================================== |
Line 2652... | Line 2653... | ||
2652 | Parameters: |
2653 | Parameters: |
2653 | * eax = 53 - function number |
2654 | * eax = 53 - function number |
2654 | * ebx = 6 - subfunction number |
2655 | * ebx = 6 - subfunction number |
2655 | * ecx = socket handle |
2656 | * ecx = socket handle |
2656 | Returned value: |
2657 | Returned value: |
2657 | * eax = socket status: one of |
2658 | * eax = 0 for incorrect handle or socket status: one of |
2658 | * TCB_LISTEN = 1 |
2659 | * TCB_LISTEN = 1 |
2659 | * TCB_SYN_SENT = 2 |
2660 | * TCB_SYN_SENT = 2 |
2660 | * TCB_SYN_RECEIVED = 3 |
2661 | * TCB_SYN_RECEIVED = 3 |
2661 | * TCB_ESTABLISHED = 4 |
2662 | * TCB_ESTABLISHED = 4 |
2662 | * TCB_FIN_WAIT_1 = 5 |
2663 | * TCB_FIN_WAIT_1 = 5 |
Line 2664... | Line 2665... | ||
2664 | * TCB_CLOSE_WAIT = 7 |
2665 | * TCB_CLOSE_WAIT = 7 |
2665 | * TCB_CLOSING = 8 |
2666 | * TCB_CLOSING = 8 |
2666 | * TCB_LAST_ASK = 9 |
2667 | * TCB_LAST_ASK = 9 |
2667 | * TCB_TIME_WAIT = 10 |
2668 | * TCB_TIME_WAIT = 10 |
2668 | * TCB_CLOSED = 11 |
2669 | * TCB_CLOSED = 11 |
2669 | * ebx destroys |
2670 | * ebx destroyed |
2670 | Remarks: |
- | |
2671 | * There is no checks for correctness. |
- | |
Line 2672... | Line 2671... | ||
2672 | 2671 | ||
2673 | ====================================================================== |
2672 | ====================================================================== |
2674 | ========== Function 53, subfunction 7 - write to TCP-socket. ========= |
2673 | ========== Function 53, subfunction 7 - write to TCP-socket. ========= |
2675 | ====================================================================== |
2674 | ====================================================================== |
Line 2678... | Line 2677... | ||
2678 | * ebx = 7 - subfunction number |
2677 | * ebx = 7 - subfunction number |
2679 | * ecx = socket handle |
2678 | * ecx = socket handle |
2680 | * edx = number of bytes to write |
2679 | * edx = number of bytes to write |
2681 | * esi = pointer to data to write |
2680 | * esi = pointer to data to write |
2682 | Returned value: |
2681 | Returned value: |
2683 | * eax = 0xffffffff - error |
- | |
2684 | * eax = 0xffff - not enough memory |
2682 | * eax = 0xffffffff - error (invalid handle or not enough memory) |
2685 | * eax = 0 - success |
2683 | * eax = 0 - success |
2686 | * ebx destroyed |
2684 | * ebx destroyed |
2687 | Remarks: |
2685 | Remarks: |
2688 | * Check on validity of handle is minimal - only not very incorrect |
- | |
2689 | not opened handles are eliminated. |
- | |
2690 | * Number of bytes to write must not exceed 1500-40, though |
2686 | * Number of bytes to write must not exceed 1500-40, though |
2691 | the appropriate check is not made. |
2687 | the appropriate check is not made. |
Line 2692... | Line 2688... | ||
2692 | 2688 | ||
2693 | ====================================================================== |
2689 | ====================================================================== |
Line 2696... | Line 2692... | ||
2696 | Parameters: |
2692 | Parameters: |
2697 | * eax = 53 - function number |
2693 | * eax = 53 - function number |
2698 | * ebx = 8 - subfunction number |
2694 | * ebx = 8 - subfunction number |
2699 | * ecx = socket handle |
2695 | * ecx = socket handle |
2700 | Returned value: |
2696 | Returned value: |
2701 | * eax = -1 - invalid handle |
2697 | * eax = -1 - error (invalid handle or |
2702 | * eax = 0xffff - not enough memory for socket close packet |
2698 | not enough memory for socket close packet) |
2703 | * eax = 0 - success |
2699 | * eax = 0 - success |
2704 | * in many cases eax is destroyed (the result of function 'queue' |
- | |
2705 | is returned) - probably this is bug, which will be corrected |
- | |
2706 | * ebx destroyed |
2700 | * ebx destroyed |
2707 | Remarks: |
2701 | Remarks: |
2708 | * The current implementation does not close automatically all |
2702 | * The current implementation does not close automatically all |
2709 | sockets of a thread at termination. In particular, one should not |
2703 | sockets of a thread at termination. In particular, one should not |
2710 | 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 |
2711 | of resources. |
2705 | of resources. |
2712 | * The current implementation does no checks on correctness |
- | |
2713 | (function returns error only if thread tries to close not opened |
- | |
2714 | socket with correct handle). |
- | |
Line 2715... | Line 2706... | ||
2715 | 2706 | ||
2716 | ====================================================================== |
2707 | ====================================================================== |
2717 | === Function 53, subfunction 9 - check whether local port is free. === |
2708 | === Function 53, subfunction 9 - check whether local port is free. === |
2718 | ====================================================================== |
2709 | ====================================================================== |
Line 2750... | Line 2741... | ||
2750 | * ecx = socket handle |
2741 | * ecx = socket handle |
2751 | * edx = pointer to buffer |
2742 | * edx = pointer to buffer |
2752 | * esi = number of bytes to read; |
2743 | * esi = number of bytes to read; |
2753 | * esi = 0 - read all data (maximum 4096 bytes) |
2744 | * esi = 0 - read all data (maximum 4096 bytes) |
2754 | Returned value: |
2745 | Returned value: |
2755 | * eax = number of bytes read |
2746 | * eax = number of bytes read (0 for incorrect handle) |
2756 | * ebx destroyed |
2747 | * ebx destroyed |
2757 | Remakrs: |
- | |
2758 | * There is no check on handle correctness. |
- | |
Line 2759... | Line 2748... | ||
2759 | 2748 | ||
2760 | ====================================================================== |
2749 | ====================================================================== |
2761 | = Function 53, subfunction 255 - debug information of network driver. |
2750 | = Function 53, subfunction 255 - debug information of network driver. |
2762 | ====================================================================== |
2751 | ====================================================================== |
Line 2787... | Line 2776... | ||
2787 | * 4: total number of dumped received packets |
2776 | * 4: total number of dumped received packets |
2788 | * 5: total number of received ARP-packets |
2777 | * 5: total number of received ARP-packets |
2789 | * 6: status of packet driver, 0=inactive, nonzero=active |
2778 | * 6: status of packet driver, 0=inactive, nonzero=active |
Line 2790... | Line 2779... | ||
2790 | 2779 | ||
2791 | ====================================================================== |
- | |
2792 | ========== Function 55, subfunction 0 - load data for SB16. ========== |
- | |
2793 | ====================================================================== |
- | |
2794 | Parameters: |
- | |
2795 | * eax = 55 - function number |
- | |
2796 | * ebx = 0 - subfunction number |
- | |
2797 | * ecx = pointer to data (is copied 64 kilobytes, is used as much as |
- | |
2798 | set by subfunction 2) |
- | |
2799 | Returned value: |
- | |
2800 | * function does not return value |
- | |
2801 | Remarks: |
- | |
2802 | * Format and size of data are set by subfunction 2. |
- | |
2803 | - | ||
2804 | ====================================================================== |
- | |
2805 | ======== Function 55, subfunction 1 - begin play data on SB16. ======= |
- | |
2806 | ====================================================================== |
- | |
2807 | Parameters: |
- | |
2808 | * eax = 55 - function number |
- | |
2809 | * ebx = 1 - subfunction number |
- | |
2810 | Returned value: |
- | |
2811 | * function does not return value |
- | |
2812 | Remarks: |
- | |
2813 | * Previously data must be loaded by subfunction 0 and |
- | |
2814 | their format must be defined by subfunction 2. |
- | |
2815 | * Function returns control, when playing of data began; after that |
- | |
2816 | play goes independently from application (and does not use |
- | |
2817 | processor time at all). |
- | |
2818 | * Previously must be defined SB16 base port |
- | |
2819 | (by subfunction 4 of function 21) and DMA channel |
- | |
2820 | (by subfunction 10 of function 21). |
- | |
2821 | - | ||
2822 | ====================================================================== |
- | |
2823 | ======== Function 55, subfunction 2 - set format of SB16 data. ======= |
- | |
2824 | ====================================================================== |
- | |
2825 | Parameters: |
- | |
2826 | * eax = 55 - function number |
- | |
2827 | * ebx = 2 - subfunction number |
- | |
2828 | * ecx = 0 - set digit capacity |
- | |
2829 | * edx = 1 - 8bit mono |
- | |
2830 | * edx = 2 - 8bit stereo |
- | |
2831 | * ecx = 1 - set data size |
- | |
2832 | * edx = size in bytes |
- | |
2833 | * ecx = 2 - set play frequency |
- | |
2834 | * edx = frequency |
- | |
2835 | Returned value: |
- | |
2836 | * function does not return value |
- | |
2837 | Remarks: |
- | |
2838 | * When the system boots, it sets following default parameters: |
- | |
2839 | digit capacity - 8bit mono, size - 64 Kb, frequency - 44100 Hz. |
- | |
2840 | Nevertheless it is recommended to set necessary values obviously |
- | |
2841 | as they could be reset by some application. |
- | |
2842 | - | ||
2843 | ====================================================================== |
2780 | ====================================================================== |
2844 | 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. |
2845 | ====================================================================== |
2782 | ====================================================================== |
2846 | Parameters: |
2783 | Parameters: |
2847 | * eax = 55 - function number |
2784 | * eax = 55 - function number |
Line 3389... | Line 3326... | ||
3389 | Parameters: |
3326 | Parameters: |
3390 | * eax = 65 - function number |
3327 | * eax = 65 - function number |
3391 | * ebx = pointer to the image |
3328 | * ebx = pointer to the image |
3392 | * ecx = [size on axis x]*65536 + [size on axis y] |
3329 | * ecx = [size on axis x]*65536 + [size on axis y] |
3393 | * edx = [coordinate on axis x]*65536 + [coordinate on axis y] |
3330 | * edx = [coordinate on axis x]*65536 + [coordinate on axis y] |
3394 | * 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 |
3395 | * edi = pointer to palette (256 colors 0x00RRGGBB); |
3332 | * edi = pointer to palette (2 to the power esi colors 0x00RRGGBB); |
3396 | ignored when esi = 24 and 32 |
3333 | ignored when esi > 8 |
3397 | * ebp = offset of next row data relative to previous row data |
3334 | * ebp = offset of next row data relative to previous row data |
3398 | Returned value: |
3335 | Returned value: |
3399 | * function does not return value |
3336 | * function does not return value |
3400 | Remarks: |
3337 | Remarks: |
3401 | * Coordinates of the image are coordinates of the upper left corner |
3338 | * Coordinates of the image are coordinates of the upper left corner |
3402 | of the image relative to the window. |
3339 | of the image relative to the window. |
3403 | * 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 |
|
3404 | * Each byte of image is index in the palette. |
3351 | index in the palette. |
3405 | * 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 |
|
3406 | 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. |
|
3407 | * 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 |
3408 | with esi=24, ebp=0. |
3362 | with esi=24, ebp=0. |
Line 3409... | Line 3363... | ||
3409 | 3363 | ||
3410 | ====================================================================== |
3364 | ====================================================================== |
Line 3768... | Line 3722... | ||
3768 | * If ecx=0, the function frees memory block at edx and returns 0. |
3722 | * If ecx=0, the function frees memory block at edx and returns 0. |
3769 | * The contents of the block are unchanged up to the shorter of |
3723 | * The contents of the block are unchanged up to the shorter of |
3770 | the new and old sizes. |
3724 | the new and old sizes. |
Line 3771... | Line 3725... | ||
3771 | 3725 | ||
3772 | ====================================================================== |
- | |
3773 | ======= Function 68, subfunction 22 - open memory block. ======= |
- | |
3774 | ====================================================================== |
- | |
3775 | Parameters: |
- | |
3776 | * eax = 68 - function number |
- | |
3777 | * ebx = 22 - subfunction number |
- | |
3778 | * ecx = pointer to already allocated block (max 32 symbols) |
- | |
3779 | * edx = block's size in bytes for SHM_CREATE and SHM_OPEN_ALWAYS |
- | |
3780 | * esi = flags for opening and getting access |
- | |
3781 | SHM_OPEN = 0x00 |
- | |
3782 | SHM_OPEN_ALWAYS = 0x04 |
- | |
3783 | SHM_CREATE = 0x08 |
- | |
3784 | SHM_READ = 0x00 |
- | |
3785 | SHM_WRITE = 0x01 |
- | |
3786 | Returned value: |
- | |
3787 | * eax = pointer to the readed block, 0 = error |
- | |
3788 | * edx = if SHM_CREATE, SHM_OPEN, or SHM_OPEN_ALWAYS active |
- | |
3789 | Error codes: |
- | |
3790 | * E_NOTFOUND = 5 |
- | |
3791 | * E_ACCESS = 10 |
- | |
3792 | * E_NOMEM = 30 |
- | |
3793 | * E_PARAM = 33 |
- | |
3794 | Remarks: |
- | |
3795 | * |
- | |
3796 | * |
- | |
3797 | - | ||
3798 | ====================================================================== |
- | |
3799 | ======= Function 68, subfunction 22 - close memory block. ======= |
- | |
3800 | ====================================================================== |
- | |
3801 | Parameters: |
- | |
3802 | * eax = 68 - function number |
- | |
3803 | * ebx = 23 - subfunction number |
- | |
3804 | * ecx = pointer to already allocated block (max 32 symbols) |
- | |
3805 | - | ||
3806 | Returned value: |
- | |
3807 | * not defined |
- | |
3808 | - | ||
3809 | ====================================================================== |
3726 | ====================================================================== |
3810 | ====================== Fucntion 69 - debugging. ====================== |
3727 | ====================== Fucntion 69 - debugging. ====================== |
3811 | ====================================================================== |
3728 | ====================================================================== |
3812 | A process can load other process as debugged by set of corresponding |
3729 | A process can load other process as debugged by set of corresponding |
3813 | bit by call to subfunction 7 of function 70. |
3730 | bit by call to subfunction 7 of function 70. |
Line 3835... | Line 3752... | ||
3835 | * process is suspended |
3752 | * process is suspended |
3836 | When debugger terminates, all debugged processes are killed. |
3753 | When debugger terminates, all debugged processes are killed. |
3837 | If debugger does not want this, it must previously detach by |
3754 | If debugger does not want this, it must previously detach by |
3838 | subfunction 3. |
3755 | subfunction 3. |
Line 3839... | Line 3756... | ||
3839 | 3756 | ||
3840 | All subfunctions except 4 and 5 are applicable only to |
- | |
3841 | processes/threads started from the current by function 70 |
3757 | All subfunctions are applicable only to processes/threads started |
3842 | with set debugging flag. |
3758 | from the current by function 70 with set debugging flag. |
3843 | Debugging of multithreaded programs is not supported yet. |
3759 | Debugging of multithreaded programs is not supported yet. |
3844 | The full list of subfunctions: |
3760 | The full list of subfunctions: |
3845 | * subfunction 0 - define data area for debug messages |
3761 | * subfunction 0 - define data area for debug messages |
3846 | * subfunction 1 - get contents of registers of debugged thread |
3762 | * subfunction 1 - get contents of registers of debugged thread |
Line 3935... | Line 3851... | ||
3935 | * function does not return value |
3851 | * function does not return value |
3936 | Remarks: |
3852 | Remarks: |
3937 | * If the process was suspended, it resumes execution. |
3853 | * If the process was suspended, it resumes execution. |
Line 3938... | Line 3854... | ||
3938 | 3854 | ||
3939 | ====================================================================== |
3855 | ====================================================================== |
3940 | ============= Function 69, subfunction 4 - suspend thread. =========== |
3856 | ======== Function 69, subfunction 4 - suspend debugged thread. ======= |
3941 | ====================================================================== |
3857 | ====================================================================== |
3942 | Parameters: |
3858 | Parameters: |
3943 | * eax = 69 - function number |
3859 | * eax = 69 - function number |
3944 | * ebx = 4 - subfunction number |
3860 | * ebx = 4 - subfunction number |
3945 | * ecx = thread identifier |
3861 | * ecx = thread identifier |
3946 | Returned value: |
3862 | Returned value: |
- | 3863 | * function does not return value |
|
- | 3864 | Remarks: |
|
- | 3865 | * Process must be loaded for debugging (as is shown in |
|
Line 3947... | Line 3866... | ||
3947 | * function does not return value |
3866 | general description). |
3948 | 3867 | ||
3949 | ====================================================================== |
3868 | ====================================================================== |
3950 | ============= Function 69, subfunction 5 - resume thread. ============ |
3869 | ======== Function 69, subfunction 5 - resume debugged thread. ======== |
3951 | ====================================================================== |
3870 | ====================================================================== |
3952 | Parameters: |
3871 | Parameters: |
3953 | * eax = 69 - function number |
3872 | * eax = 69 - function number |
3954 | * ebx = 5 - subfunction number |
3873 | * ebx = 5 - subfunction number |
3955 | * ecx = thread identifier |
3874 | * ecx = thread identifier |
- | 3875 | Returned value: |
|
- | 3876 | * function does not return value |
|
- | 3877 | Remarks: |
|
Line 3956... | Line 3878... | ||
3956 | Returned value: |
3878 | * Process must be loaded for debugging (as is shown in |
3957 | * function does not return value |
3879 | general description). |
3958 | 3880 | ||
3959 | ====================================================================== |
3881 | ====================================================================== |