Subversion Repositories Kolibri OS

Rev

Rev 193 | Rev 283 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 193 Rev 277
Line 1... Line 1...
1
SYSTEM FUNCTIONS of OS Kolibri 0.6.0.0
1
SYSTEM FUNCTIONS of OS Kolibri 0.6.3.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 678... Line 678...
678
      divided by '/')
678
      divided by '/')
679
Returned value:
679
Returned value:
680
  * eax = 0 - success
680
  * eax = 0 - success
681
  * else eax = error code of the file system
681
  * else eax = error code of the file system
682
Çàìå÷àíèÿ:
682
Çàìå÷àíèÿ:
683
  * Filename is fixed, "menuet.img" (global kernel variable
683
  * Filename is fixed, "kolibri.img" (global kernel variable
684
    'image_save' from 'preboot.inc')
684
    'image_save' from 'preboot.inc')
685
  * Drive and partition are defined by subfunction 7
685
  * Drive and partition are defined by subfunction 7
686
    and subfunction 8 of function 21.
686
    and subfunction 8 of function 21.
687
  * All folders in the given path must exist, otherwise function
687
  * All folders in the given path must exist, otherwise function
688
    returns value 5, "file not found".
688
    returns value 5, "file not found".
Line 810... Line 810...
810
    at accordingly IDE0,...,IDE3.
810
    at accordingly IDE0,...,IDE3.
811
    If the hard disk on IDEx is absent, appropriate byte is zero,
811
    If the hard disk on IDEx is absent, appropriate byte is zero,
812
    otherwise it shows number of the recognized partitions, which
812
    otherwise it shows number of the recognized partitions, which
813
    can be not presented (if the drive is not formatted or if
813
    can be not presented (if the drive is not formatted or if
814
    the file system is not supported). Current version of the kernel
814
    the file system is not supported). Current version of the kernel
815
    supports only FAT16 and FAT32 for hard disks.
815
    supports only FAT16, FAT32 and NTFS for hard disks.
816
  * +6: 4 db: reserved
816
  * +6: 4 db: reserved
817
Format of the table: full version:
817
Format of the table: full version:
818
  * +0: 10 db: same as for the short version
818
  * +0: 10 db: same as for the short version
819
  * +10: 100 db: data for the first partition
819
  * +10: 100 db: data for the first partition
820
  * +110: 100 db: data for the second partition
820
  * +110: 100 db: data for the second partition
Line 826... Line 826...
826
Format of the information about partition
826
Format of the information about partition
827
(at moment only FAT is supported):
827
(at moment only FAT is supported):
828
  * +0: dword: first physical sector of the partition
828
  * +0: dword: first physical sector of the partition
829
  * +4: dword: last physical sector of the partition
829
  * +4: dword: last physical sector of the partition
830
    (belongs to the partition)
830
    (belongs to the partition)
831
  * +8: dword: sectors per one copy of FAT
-
 
832
  * +12 = +0xC: dword: number of copies of FAT
-
 
833
  * +16 = +0x10: dword: number of sectors per cluster
-
 
834
  * +20 = +0x14: dword: bytes per sector;
831
  * +8: byte: file system type:
835
    current implementation expects 0x200 = 512 in this field
-
 
836
  * +24 = +0x18: dword: first root cluster in FAT32, 0 for FAT16
-
 
837
  * +28 = +0x1C: dword: first physical sector of FAT
-
 
838
  * +32 = +0x20: dword: first physical root sector for FAT16,
-
 
839
    ignored for FAT32
832
    16=FAT16, 32=FAT32, 1=NTFS
840
  * +36 = +0x24: dword: number of root sectors for FAT16,
-
 
841
    0 for FAT32
-
 
842
  * +40 = +0x28: dword: physical sector of the beginning of
833
  * other data are dependent on file system, are modified with
843
    the data area
-
 
844
  * +44 = +0x2C: dword: maximum number of a cluster
-
 
845
  * +48 = +0x30: dword: physical sector of the information
-
 
846
    about the file system for FAT32, ignored for FAT16
-
 
847
  * +52 = +0x34: dword: value used as boundary for special
-
 
848
    values in FAT
-
 
849
  * +56 = +0x38: dword: value used for bad clusters in FAT
-
 
850
  * +60 = +0x3C: dword: value used as the end marker for FAT chain
834
    kernel modifications and therefore are not described
851
  * +64 = +0x40: dword: mask for FAT items
-
 
852
  * +68 = +0x44: byte: file system type: 16 èëè 32
-
 
853
  * +69 = +0x45: 31 db: reserved
-
 
854
Remarks:
835
Remarks:
855
  * The short table can be used for obtaining the information about
836
  * The short table can be used for obtaining the information about
856
    available devices.
837
    available devices.
857
  * First two fields in the information about partition
-
 
858
    gives the parameters of partition, other - parameters of
-
 
859
    FAT file system. For other file systems (when they will be
-
 
860
    supported) specific for file system information will be, of
-
 
861
    course, another, but first two fields will have the same sense.
-
 
Line 862... Line 838...
862
 
838
 
863
======================================================================
839
======================================================================
864
========== Function 18, subfunction 13 - get kernel version. =========
840
========== Function 18, subfunction 13 - get kernel version. =========
865
======================================================================
841
======================================================================
Line 872... Line 848...
872
  * function does not return value
848
  * function does not return value
873
Structure of the buffer:
849
Structure of the buffer:
874
db a,b,c,d for version a.b.c.d
850
db a,b,c,d for version a.b.c.d
875
db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
851
db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
876
db 'name',0 - ASCIIZ-string with the name
852
db 'name',0 - ASCIIZ-string with the name
877
For Kolibri 0.5.8.1 kernel:
853
For Kolibri 0.6.3.0 kernel:
878
db 0,5,8,1
854
db 0,6,3,0
879
db 2
855
db 2
880
db 'Kolibri',0
856
db 'Kolibri',0
Line 881... Line 857...
881
 
857
 
882
======================================================================
858
======================================================================
Line 1138... Line 1114...
1138
  * Function does not check for correctness, as the kernel does not
1114
  * Function does not check for correctness, as the kernel does not
1139
    use this variable.
1115
    use this variable.
1140
  * To get system language use subfunction 5 of function 26.
1116
  * To get system language use subfunction 5 of function 26.
Line 1141... Line 1117...
1141
 
1117
 
1142
======================================================================
-
 
1143
=========== Function 21, subfunction 6 - set WSS base port. ==========
-
 
1144
======================================================================
-
 
1145
Parameters:
-
 
1146
  * eax = 21 - function number
-
 
1147
  * ebx = 6 - subfunction number
-
 
1148
  * ecx = base port
-
 
1149
Returned value:
-
 
1150
  * eax = 0 - success
-
 
1151
  * eax = -1 - erratic port number
-
 
1152
Remarks:
-
 
1153
  * Port number must satisfy to condition 0x100<=ecx.
-
 
1154
  * WSS base is used by function 27.
-
 
1155
  * To get WSS base port use subfunction 6 of function 26.
-
 
1156
 
-
 
1157
======================================================================
1118
======================================================================
1158
============== Function 21, subfunction 7 - set HD base. =============
1119
============== Function 21, subfunction 7 - set HD base. =============
1159
======================================================================
1120
======================================================================
1160
The HD base defines hard disk to write with usage of obsolete
1121
The HD base defines hard disk to write with usage of obsolete
1161
file system functions and functions implicitly using the hard disk
1122
file system functions and functions implicitly using the hard disk
Line 1573... Line 1534...
1573
    by the kernel itself, however application @panel draws the
1534
    by the kernel itself, however application @panel draws the
1574
    appropriate icon (using this function).
1535
    appropriate icon (using this function).
1575
  * To set system language use subfunction 5 of function 21.
1536
  * To set system language use subfunction 5 of function 21.
Line 1576... Line 1537...
1576
 
1537
 
1577
======================================================================
-
 
1578
=========== Function 26, subfunction 6 - get WSS base port. ==========
-
 
1579
======================================================================
-
 
1580
Parameters:
-
 
1581
  * eax = 26 - function number
-
 
1582
  * ebx = 6 - subfunction number
-
 
1583
Returned value:
-
 
1584
  * eax = base port
-
 
1585
Remarks:
-
 
1586
  * WSS base is used by function 27.
-
 
1587
  * To set WSS base port use subfunction 6 of function 21.
-
 
1588
 
-
 
1589
======================================================================
1538
======================================================================
1590
============== Function 26, subfunction 7 - get HD base. =============
1539
============== Function 26, subfunction 7 - get HD base. =============
1591
======================================================================
1540
======================================================================
1592
The HD base defines hard disk to write with usage of obsolete
1541
The HD base defines hard disk to write with usage of obsolete
1593
file system functions and functions implicitly using the hard disk
1542
file system functions and functions implicitly using the hard disk
Line 1675... Line 1624...
1675
  * Is used by operations with PCI bus (function 62).
1624
  * Is used by operations with PCI bus (function 62).
1676
  * The current implementation uses only low bit of ecx.
1625
  * The current implementation uses only low bit of ecx.
1677
  * To set the current state use subfunction 12 of function 21.
1626
  * To set the current state use subfunction 12 of function 21.
Line 1678... Line 1627...
1678
 
1627
 
1679
======================================================================
-
 
1680
======== Function 27 - set Windows Sound System (WSS) volume. ========
-
 
1681
======================================================================
-
 
1682
Parameters:
-
 
1683
  * eax = 27 - function number
-
 
1684
  * ebx = what to set:
-
 
1685
    * 1 - set common volume
-
 
1686
    * 2 - set Line In volume
-
 
1687
  * cl = volume level (0x0=highest, 0x1F=lowest,
-
 
1688
    if bit 0x80 is set=disable)
-
 
1689
Returned value:
-
 
1690
  * eax = 0 - success
-
 
1691
  * eax = 1 - WSS base is not defined
-
 
1692
  * eax = 2 - incorrect subfunction
-
 
1693
Remarks:
-
 
1694
  * Previously WSS base port must be defined by call to 
-
 
1695
    subfunction 6 of function 21.
-
 
1696
  * Set of common volume is ignored (function simply returns eax=0).
-
 
1697
  * Old documentation and kernel sources erraticly name function 2
-
 
1698
    as CD-audio volume.
-
 
1699
 
-
 
1700
======================================================================
1628
======================================================================
1701
=================== Function 28 - set SB16 volume. ===================
1629
=================== Function 28 - set SB16 volume. ===================
1702
======================================================================
1630
======================================================================
1703
Parameters:
1631
Parameters:
1704
  * eax = 28 - function number
1632
  * eax = 28 - function number
Line 1795... Line 1723...
1795
  * There is also direct access (without any system calls)
1723
  * There is also direct access (without any system calls)
1796
    to videomemory through the selector gs. To get parameters of
1724
    to videomemory through the selector gs. To get parameters of
1797
    the current videomode, use function 61.
1725
    the current videomode, use function 61.
Line 1798... Line 1726...
1798
 
1726
 
1799
======================================================================
1727
======================================================================
1800
========= Function 37 - get coordinates/status of the mouse. =========
1728
=================== Function 37 - work with mouse. ===================
Line 1801... Line 1729...
1801
======================================================================
1729
======================================================================
1802
 
1730
 
1803
---------- Subfunction 0 - screen coordinates of the mouse -----------
1731
---------- Subfunction 0 - screen coordinates of the mouse -----------
Line 1831... Line 1759...
1831
  * eax contains information on the pressed mouse buttons:
1759
  * eax contains information on the pressed mouse buttons:
1832
  * bit 0 is set = left button is pressed
1760
  * bit 0 is set = left button is pressed
1833
  * bit 1 is set = right button is pressed
1761
  * bit 1 is set = right button is pressed
1834
  * other bits are cleared
1762
  * other bits are cleared
Line -... Line 1763...
-
 
1763
 
-
 
1764
-------------------- Subfunction 4 - load cursor ---------------------
-
 
1765
Parameters:
-
 
1766
  * eax = 37 - function number
-
 
1767
  * ebx = 4 - subfunction number
-
 
1768
  * dx = data source:
-
 
1769
  * dx = LOAD_FROM_FILE = 0 - data in a file
-
 
1770
    * ecx = pointer to full path to the cursor file
-
 
1771
    * the file must be in the format .cur, which is standard for
-
 
1772
      MS Windows, at that of the size 32*32 pixels
-
 
1773
  * dx = LOAD_FROM_MEM = 1 - data of file are already loaded in memory
-
 
1774
    * ecx = pointer to data of the cursor file
-
 
1775
    * the data format is the same as in the previous case
-
 
1776
  * dx = LOAD_INDIRECT = 2 - data in memory
-
 
1777
    * ecx = pointer to cursor image in the format ARGB 32*32 pixels
-
 
1778
    * edx = 0xXXYY0002, where
-
 
1779
      * XX = x-coordinate of cursor hotspot
-
 
1780
      * YY = y-coordinate
-
 
1781
      * 0 <= XX, YY <= 31
-
 
1782
Returned value:
-
 
1783
  * eax = 0 - failed
-
 
1784
  * otherwise eax = cursor handle
-
 
1785
 
-
 
1786
--------------------- Subfunction 5 - set cursor ---------------------
-
 
1787
Sets new cursor for the window of the current thread.
-
 
1788
Parameters:
-
 
1789
  * eax = 37 - function number
-
 
1790
  * ebx = 5 - subfunction number
-
 
1791
  * ecx = cursor handle
-
 
1792
Returned value:
-
 
1793
  * eax = handle of previous cursor
-
 
1794
Remarks:
-
 
1795
  * If the handle is incorrect, the function restores the default
-
 
1796
    cursor (standard arrow). In particular, ecx=0 restores it.
-
 
1797
 
-
 
1798
------------------- Subfunction 6 - delete cursor --------------------
-
 
1799
Parameters:
-
 
1800
  * eax = 37 - function number
-
 
1801
  * ebx = 6 - subfunction number
-
 
1802
  * ecx = cursor handle
-
 
1803
Returned value:
-
 
1804
  * eax destroyed
-
 
1805
Remarks:
-
 
1806
  * The cursor must be loaded previously by the current thread
-
 
1807
    (with the call to subfunction 4). The function does not delete
-
 
1808
    system cursors and cursors, loaded by another applications.
-
 
1809
  * If the active cursor (set by subfunction 5) is deleted,
-
 
1810
    the system restores the default cursor (standard arrow).
1835
 
1811
 
1836
======================================================================
1812
======================================================================
1837
====================== Function 38 - draw line. ======================
1813
====================== Function 38 - draw line. ======================
1838
======================================================================
1814
======================================================================
1839
Parameters:
1815
Parameters:
Line 2049... Line 2025...
2049
    * the selected range intersects with any of earlier reserved
2025
    * the selected range intersects with any of earlier reserved
2050
  * For ports free: an error is an attempt to free range,
2026
  * For ports free: an error is an attempt to free range,
2051
    that was not earlier reserved by this function
2027
    that was not earlier reserved by this function
2052
    (with same ecx,edx).
2028
    (with same ecx,edx).
2053
  * If an error occurs (for both cases) function performs no action.
2029
  * If an error occurs (for both cases) function performs no action.
2054
  * At booting the system reserves for itself ports 0..0xff, and if
2030
  * At booting the system reserves for itself ports
2055
    COM-mouse is detected - additionally range of COM-ports
-
 
2056
    0x3f0..0x3ff and/or 0x2f0..0x2ff.
2031
    0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (inclusively).
2057
  * When a thread terminates, all reserved by it ports
2032
  * When a thread terminates, all reserved by it ports
2058
    are freed automatically.
2033
    are freed automatically.
Line 2059... Line 2034...
2059
 
2034
 
2060
======================================================================
2035
======================================================================
Line 2524... Line 2499...
2524
Returned value:
2499
Returned value:
2525
  * the current implementation returns eax=14, but this can be changed
2500
  * the current implementation returns eax=14, but this can be changed
2526
    in future versions
2501
    in future versions
Line 2527... Line 2502...
2527
 
2502
 
-
 
2503
======================================================================
-
 
2504
======== Function 52, subfunction 15 - get local MAC address. ========
-
 
2505
======================================================================
-
 
2506
Parameters:
-
 
2507
  * eax = 52 - function number
-
 
2508
  * ebx = 15 - subfunction number
-
 
2509
  * ecx = 0 - read first 4 bytes,
-
 
2510
    ecx = 4 - read last 2 bytes
-
 
2511
Returned value:
-
 
2512
  * for ecx=0: eax = first 4 bytes of MAC address
-
 
2513
  * for ecx=4: ax = last 2 bytes of MAC address,
-
 
2514
               high half of eax is destroyed
-
 
2515
  * for other ecx: eax = -1 indicates an error
-
 
2516
 
2528
======================================================================
2517
======================================================================
2529
============ Function 53, subfunction 0 - open UDP-socket. ===========
2518
============ Function 53, subfunction 0 - open UDP-socket. ===========
2530
======================================================================
2519
======================================================================
2531
Parameters:
2520
Parameters:
2532
  * eax = 53 - function number
2521
  * eax = 53 - function number
Line 2818... Line 2807...
2818
    the program.
2807
    the program.
2819
  * The data must be kept in the memory at least up to the end
2808
  * The data must be kept in the memory at least up to the end
2820
    of play.
2809
    of play.
Line 2821... Line 2810...
2821
 
2810
 
2822
======================================================================
-
 
2823
=============== Function 56 - write file to hard disk. ===============
-
 
2824
======================================================================
-
 
2825
Parameters:
-
 
2826
  * eax = 56 - function number
-
 
2827
  * ebx = pointer to the file name
-
 
2828
  * ecx = size of data to write (in bytes)
-
 
2829
  * edx = pointer to data to write
-
 
2830
  * esi = pointer to path (ASCIIZ-string)
-
 
2831
Returned value:
-
 
2832
  * eax = 0 - success, otherwise file system error code
-
 
2833
Remarks:
-
 
2834
  * This function is obsolete; function 70 allows to fulfil the same
-
 
2835
    operations with the extended possibilities.
-
 
2836
  * This function assumes that during its call by one application
-
 
2837
    no other application works with hard disk.
-
 
2838
  * The path to file is ASCIIZ-string, which may be empty
-
 
2839
    (if the file is created in the root folder) or have the format
-
 
2840
    /d1/d2/.../dn, where all folder names must have the 8+3 format,
-
 
2841
    i.e. 8 characters of name and 3 characters of the extension
-
 
2842
    without separator, supplemented by blanks if necessary;
-
 
2843
    all letters must be capital.
-
 
2844
  * The file name must also have the format 8+3.
-
 
2845
 
-
 
2846
======================================================================
2811
======================================================================
2847
================ Function 58 - work with file system. ================
2812
================ Function 58 - work with file system. ================
2848
======================================================================
2813
======================================================================
2849
Parameters:
2814
Parameters:
2850
  * eax = 58
2815
  * eax = 58
Line 3755... Line 3720...
3755
    Maximum length of the name is 16 characters, including
3720
    Maximum length of the name is 16 characters, including
3756
    terminating null character, the rest is ignored.
3721
    terminating null character, the rest is ignored.
3757
  * The function can load only drivers which are registered in the
3722
  * The function can load only drivers which are registered in the
3758
    system; the current implementation contains
3723
    system; the current implementation contains
3759
    exactly 2 such drivers:
3724
    exactly 2 such drivers:
3760
    * name SOUND, file /rd/1/unisound.obj
3725
    * name SOUND, file /rd/1/drivers/unisound.obj
3761
    * name INFINITY, file /rd/1/infinity.obj
3726
    * name INFINITY, file /rd/1/drivers/infinity.obj
Line 3762... Line 3727...
3762
 
3727
 
3763
======================================================================
3728
======================================================================
3764
============ Function 68, subfunction 17 - driver control. ===========
3729
============ Function 68, subfunction 17 - driver control. ===========
3765
======================================================================
3730
======================================================================
Line 3789... Line 3754...
3789
  * ecx = address of the new exception handler
3754
  * ecx = address of the new exception handler
3790
Returned value:
3755
Returned value:
3791
  * eax = address of the old exception handler (0, if it was not set)
3756
  * eax = address of the old exception handler (0, if it was not set)
Line 3792... Line 3757...
3792
 
3757
 
-
 
3758
======================================================================
-
 
3759
=============== Function 68, subfunction 19 - load DLL. ==============
-
 
3760
======================================================================
-
 
3761
Parameters:
-
 
3762
  * eax = 68 - function number
-
 
3763
  * ebx = 19 - subfunction number
-
 
3764
  * ecx = pointer to ASCIIZ-string with the full path to DLL
-
 
3765
Returned value:
-
 
3766
  * eax = 0 - failed
-
 
3767
  * otherwise eax = pointer to DLL export table
-
 
3768
Remarks:
-
 
3769
  * Export table is an array of structures of 2 dword's, terminated
-
 
3770
    by zero. The first dword in structure points to function name,
-
 
3771
    the second dword contains address of function.
-
 
3772
 
3793
======================================================================
3773
======================================================================
3794
====================== Fucntion 69 - debugging. ======================
3774
====================== Fucntion 69 - debugging. ======================
3795
======================================================================
3775
======================================================================
3796
A process can load other process as debugged by set of corresponding
3776
A process can load other process as debugged by set of corresponding
3797
bit by call to subfunction 7 of function 70.
3777
bit by call to subfunction 7 of function 70.