Subversion Repositories Kolibri OS

Rev

Rev 340 | Rev 346 | Go to most recent revision | Only display areas with differences | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 340 Rev 341
1
SYSTEM FUNCTIONS of OS Kolibri 0.6.4.0
1
SYSTEM FUNCTIONS of OS Kolibri 0.6.4.0
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,
6
    including eflags, are preserved.
6
    including eflags, are preserved.
7
 
7
 
8
 
8
 
9
======================================================================
9
======================================================================
10
============== Function 0 - define and draw the window. ==============
10
============== Function 0 - define and draw the window. ==============
11
======================================================================
11
======================================================================
12
Defines an application window. Draws a frame of the window, header and
12
Defines an application window. Draws a frame of the window, header and
13
working area. For skinned windows defines standard close and minimize
13
working area. For skinned windows defines standard close and minimize
14
buttons.
14
buttons.
15
Parameters:
15
Parameters:
16
  * eax = 0 - function number
16
  * eax = 0 - function number
17
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
17
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
18
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
18
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
19
  * edx = 0xXYRRGGBB, where:
19
  * edx = 0xXYRRGGBB, where:
20
    * Y = style of the window:
20
    * Y = style of the window:
21
      * Y=0 - type I - fixed-size window
21
      * Y=0 - type I - fixed-size window
22
      * Y=1 - only define window area, draw nothing
22
      * Y=1 - only define window area, draw nothing
23
      * Y=2 - type II - variable-size window
23
      * Y=2 - type II - variable-size window
24
      * Y=3 - skinned window
24
      * Y=3 - skinned window
25
      * other possible values (from 4 up to 15) are reserved,
25
      * other possible values (from 4 up to 15) are reserved,
26
        function call with such Y is ignored
26
        function call with such Y is ignored
27
    * RR, GG, BB = accordingly red, green, blue components of a color
27
    * RR, GG, BB = accordingly red, green, blue components of a color
28
      of the working area of the window (are ignored for style Y=2)
28
      of the working area of the window (are ignored for style Y=2)
29
    * X = DCBA (bits)
29
    * X = DCBA (bits)
30
      * A = 1 - window has caption; for style Y=3 caption string
30
      * A = 1 - window has caption; for style Y=3 caption string
31
                  must be passed in edi, for other styles use
31
                  must be passed in edi, for other styles use
32
                  subfunction 1 of function 71
32
                  subfunction 1 of function 71
33
      * B = 1 - coordinates of all graphics primitives are relative to
33
      * B = 1 - coordinates of all graphics primitives are relative to
34
                  window client area
34
                  window client area
35
      * C = 1 - don't fill working area on window draw
35
      * C = 1 - don't fill working area on window draw
36
      * D = 0 - normal filling of the working area, 1 - gradient
36
      * D = 0 - normal filling of the working area, 1 - gradient
37
    The following parameters are intended for windows
37
    The following parameters are intended for windows
38
    of a type I and II, and ignored for styles Y=1,3:
38
    of a type I and II, and ignored for styles Y=1,3:
39
  * esi = 0xXYRRGGBB - color of the header
39
  * esi = 0xXYRRGGBB - color of the header
40
    * RR, GG, BB define color
40
    * RR, GG, BB define color
41
    * Y=0 - usual window, Y=1 - unmovable window
41
    * Y=0 - usual window, Y=1 - unmovable window
42
    * X defines a gradient of header: X=0 - no gradient,
42
    * X defines a gradient of header: X=0 - no gradient,
43
      X=8 - usual gradient,
43
      X=8 - usual gradient,
44
      for windows of a type II X=4 - negative gradient
44
      for windows of a type II X=4 - negative gradient
45
    * other values of X and Y are reserved
45
    * other values of X and Y are reserved
46
  * edi = 0x00RRGGBB - color of the frame
46
  * edi = 0x00RRGGBB - color of the frame
47
Returned value:
47
Returned value:
48
  * function does not return value
48
  * function does not return value
49
Remarks:
49
Remarks:
50
  * Position and sizes of the window are installed by the first
50
  * Position and sizes of the window are installed by the first
51
    call of this function and are ignored at subsequent; to change
51
    call of this function and are ignored at subsequent; to change
52
    position and/or sizes of already created window use function 67.
52
    position and/or sizes of already created window use function 67.
53
  * For windows with style Y=3 and caption (A=1) caption string is set
53
  * For windows with style Y=3 and caption (A=1) caption string is set
54
    by the first call of this function and is ignored at subsequent
54
    by the first call of this function and is ignored at subsequent
55
    (strictly speaking, is ignored after a call to subfunction 2
55
    (strictly speaking, is ignored after a call to subfunction 2
56
    of function 12 - end redraw); to change caption of already created
56
    of function 12 - end redraw); to change caption of already created
57
    window use subfunction 1 of function 71.
57
    window use subfunction 1 of function 71.
58
  * If the window has appropriate styles, position and/or sizes can be
58
  * If the window has appropriate styles, position and/or sizes can be
59
    changed by user. Current position and sizes can be obtained
59
    changed by user. Current position and sizes can be obtained
60
    by function 9.
60
    by function 9.
61
  * The window must fit on the screen. If the transferred
61
  * The window must fit on the screen. If the transferred
62
    coordinates and sizes do not satisfy to this condition,
62
    coordinates and sizes do not satisfy to this condition,
63
    appropriate coordinate (or, probably, both) is considered as zero,
63
    appropriate coordinate (or, probably, both) is considered as zero,
64
    and if it does not help too, the appropriate size
64
    and if it does not help too, the appropriate size
65
    (or, probably, both) is installed in a size of the screen.
65
    (or, probably, both) is installed in a size of the screen.
66
    
66
    
67
    Further let us designate xpos,ypos,xsize,ysize - values passed
67
    Further let us designate xpos,ypos,xsize,ysize - values passed
68
    in ebx,ecx. The coordinates are resulted concerning
68
    in ebx,ecx. The coordinates are resulted concerning
69
    the left upper corner of the window, which, thus, is set as (0,0),
69
    the left upper corner of the window, which, thus, is set as (0,0),
70
    coordinates of the right lower corner essence (xsize,ysize).
70
    coordinates of the right lower corner essence (xsize,ysize).
71
  * The sizes of the window are understood in sence of coordinates
71
  * The sizes of the window are understood in sence of coordinates
72
    of the right lower corner. This concerns all other functions too.
72
    of the right lower corner. This concerns all other functions too.
73
    It means, that the real sizes are on 1 pixel more.
73
    It means, that the real sizes are on 1 pixel more.
74
  * The window of type I looks as follows:
74
  * The window of type I looks as follows:
75
    * draw external frame of color indicated in edi, 1 pixel in width
75
    * draw external frame of color indicated in edi, 1 pixel in width
76
    * draw header - rectangle with the left upper corner (1,1) and
76
    * draw header - rectangle with the left upper corner (1,1) and
77
      right lower (xsize-1,min(25,ysize)) color indicated in esi
77
      right lower (xsize-1,min(25,ysize)) color indicated in esi
78
      (taking a gradient into account)
78
      (taking a gradient into account)
79
    * if ysize>=26, fill the working area of the window -
79
    * if ysize>=26, fill the working area of the window -
80
      rectangle with the left upper corner (1,21) and right lower
80
      rectangle with the left upper corner (1,21) and right lower
81
      (xsize-1,ysize-1) (sizes (xsize-1)*(ysize-21)) with color
81
      (xsize-1,ysize-1) (sizes (xsize-1)*(ysize-21)) with color
82
      indicated in edx (taking a gradient into account)
82
      indicated in edx (taking a gradient into account)
83
    * if A=1 and caption has been already set by subfunction 1
83
    * if A=1 and caption has been already set by subfunction 1
84
      of function 71, it is drawn in the corresponding place of header
84
      of function 71, it is drawn in the corresponding place of header
85
  * The window of style Y=1 looks as follows:
85
  * The window of style Y=1 looks as follows:
86
    * completely defined by the application
86
    * completely defined by the application
87
  * The window of type II looks as follows:
87
  * The window of type II looks as follows:
88
    * draw external frame of width 1 pixel with the "shaded" color
88
    * draw external frame of width 1 pixel with the "shaded" color
89
      edi (all components of the color decrease twice)
89
      edi (all components of the color decrease twice)
90
    * draw intermediate frame of width 3 pixels with color edi
90
    * draw intermediate frame of width 3 pixels with color edi
91
    * draw internal frame of width 1 pixel with the "shaded" color edi
91
    * draw internal frame of width 1 pixel with the "shaded" color edi
92
    * draw header - rectangle with the left upper corner (4,4)
92
    * draw header - rectangle with the left upper corner (4,4)
93
      and right lower (xsize-4,min(20,ysize)) color, indicated in esi
93
      and right lower (xsize-4,min(20,ysize)) color, indicated in esi
94
      (taking a gradient into account)
94
      (taking a gradient into account)
95
    * if ysize>=26, fill the working area of the window -
95
    * if ysize>=26, fill the working area of the window -
96
      rectangle with the left upper corner (5,20) and right lower
96
      rectangle with the left upper corner (5,20) and right lower
97
      (xsize-5,ysize-5) with color indicated in edx
97
      (xsize-5,ysize-5) with color indicated in edx
98
      (taking a gradient into account)
98
      (taking a gradient into account)
99
    * if A=1 and caption has been already set by subfunction 1
99
    * if A=1 and caption has been already set by subfunction 1
100
      of function 71, it is drawn in the corresponding place of header
100
      of function 71, it is drawn in the corresponding place of header
101
  * The skinned window looks as follows:
101
  * The skinned window looks as follows:
102
    * draw external frame of width 1 pixel
102
    * draw external frame of width 1 pixel
103
      with color 'outer' from the skin
103
      with color 'outer' from the skin
104
    * draw intermediate frame of width 3 pixel
104
    * draw intermediate frame of width 3 pixel
105
      with color 'frame' from the skin
105
      with color 'frame' from the skin
106
    * draw internal frame of width 1 pixel
106
    * draw internal frame of width 1 pixel
107
      with color 'inner' from the skin
107
      with color 'inner' from the skin
108
    * draw header (on bitmaps from the skin) in a rectangle
108
    * draw header (on bitmaps from the skin) in a rectangle
109
      (0,0) - (xsize,_skinh-1)
109
      (0,0) - (xsize,_skinh-1)
110
    * if ysize>=26, fill the working area of the window -
110
    * if ysize>=26, fill the working area of the window -
111
      rectangle with the left upper corner (5,_skinh) and right lower
111
      rectangle with the left upper corner (5,_skinh) and right lower
112
      (xsize-5,ysize-5) with color indicated in edx
112
      (xsize-5,ysize-5) with color indicated in edx
113
      (taking a gradient into account)
113
      (taking a gradient into account)
114
    * define two standard buttons: close and minimize
114
    * define two standard buttons: close and minimize
115
      (see function 8)
115
      (see function 8)
116
    * if A=1 and edi contains (nonzero) pointer to caption string,
116
    * if A=1 and edi contains (nonzero) pointer to caption string,
117
      it is drawn in place in header defined in the skin
117
      it is drawn in place in header defined in the skin
118
    * value _skinh is accessible as the result of call
118
    * value _skinh is accessible as the result of call
119
      subfunction 4 of function 48
119
      subfunction 4 of function 48
120
 
120
 
121
======================================================================
121
======================================================================
122
================ Function 1 - put pixel in the window. ===============
122
================ Function 1 - put pixel in the window. ===============
123
======================================================================
123
======================================================================
124
Parameters:
124
Parameters:
125
  * eax = 1 - function number
125
  * eax = 1 - function number
126
  * ebx = x-coordinate (relative to the window)
126
  * ebx = x-coordinate (relative to the window)
127
  * ecx = y-coordinate (relative to the window)
127
  * ecx = y-coordinate (relative to the window)
128
  * edx = 0x00RRGGBB - color of a pixel
128
  * edx = 0x00RRGGBB - color of a pixel
129
    edx = 0x01xxxxxx - invert color of a pixel
129
    edx = 0x01xxxxxx - invert color of a pixel
130
          (low 24 bits are ignored)
130
          (low 24 bits are ignored)
131
Returned value:
131
Returned value:
132
  * function does not return value
132
  * function does not return value
133
 
133
 
134
======================================================================
134
======================================================================
135
============ Function 2 - get the code of the pressed key. ===========
135
============ Function 2 - get the code of the pressed key. ===========
136
======================================================================
136
======================================================================
137
Takes away the code of the pressed key from the buffer.
137
Takes away the code of the pressed key from the buffer.
138
Parameters:
138
Parameters:
139
  * eax = 2 - function number
139
  * eax = 2 - function number
140
Returned value:
140
Returned value:
141
  * if the buffer is empty, function returns eax=1
141
  * if the buffer is empty, function returns eax=1
142
  * if the buffer is not empty, function returns al=0,
142
  * if the buffer is not empty, function returns al=0,
143
    ah=code of the pressed key, high word of eax is zero
143
    ah=code of the pressed key, high word of eax is zero
144
  * if there is "hotkey", function returns al=2,
144
  * if there is "hotkey", function returns al=2,
145
    ah=scancode of the pressed key (0 for control keys),
145
    ah=scancode of the pressed key (0 for control keys),
146
    high word of eax contains a status of control keys at the moment
146
    high word of eax contains a status of control keys at the moment
147
    of pressing a hotkey
147
    of pressing a hotkey
148
Remarks:
148
Remarks:
149
  * There is a common system buffer of the pressed keys
149
  * There is a common system buffer of the pressed keys
150
    by a size of 120 bytes, organized as queue.
150
    by a size of 120 bytes, organized as queue.
151
  * There is one more common system buffer on 120 "hotkeys".
151
  * There is one more common system buffer on 120 "hotkeys".
152
  * If the application with the inactive window calls this function,
152
  * If the application with the inactive window calls this function,
153
    the buffer of the pressed keys is considered to be empty.
153
    the buffer of the pressed keys is considered to be empty.
154
  * By default this function returns ASCII-codes; to switch
154
  * By default this function returns ASCII-codes; to switch
155
    to the scancodes mode (and back) use function 66.
155
    to the scancodes mode (and back) use function 66.
156
    However, hotkeys are always notificated as scancodes.
156
    However, hotkeys are always notificated as scancodes.
157
  * To find out, what keys correspond to what codes, start
157
  * To find out, what keys correspond to what codes, start
158
    the application keyascii and scancode.
158
    the application keyascii and scancode.
159
  * Scancodes come directly from keyboard and are fixed;
159
  * Scancodes come directly from keyboard and are fixed;
160
    ASCII-codes turn out with usage of the conversion tables,
160
    ASCII-codes turn out with usage of the conversion tables,
161
    which can be set by subfunction 2 of function 21
161
    which can be set by subfunction 2 of function 21
162
    and get by subfunction 2 of function 26.
162
    and get by subfunction 2 of function 26.
163
  * As a consequence, ASCII-codes take into account current
163
  * As a consequence, ASCII-codes take into account current
164
    keyboard layout (rus/en) as opposed to scancodes.
164
    keyboard layout (rus/en) as opposed to scancodes.
165
  * This function notifies only about those hotkeys, which were
165
  * This function notifies only about those hotkeys, which were
166
    defined by this thread by subfunction 4 of function 66.
166
    defined by this thread by subfunction 4 of function 66.
167
 
167
 
168
======================================================================
168
======================================================================
169
==================== Function 3 - get system time. ===================
169
==================== Function 3 - get system time. ===================
170
======================================================================
170
======================================================================
171
Parameters:
171
Parameters:
172
  * eax = 3 - function number
172
  * eax = 3 - function number
173
Returned value:
173
Returned value:
174
  * eax = 0x00SSMMHH, where HH:MM:SS = Hours:Minutes:Seconds
174
  * eax = 0x00SSMMHH, where HH:MM:SS = Hours:Minutes:Seconds
175
  * each item is BCD-number, for example,
175
  * each item is BCD-number, for example,
176
    for time 23:59:59 function returns 0x00595923
176
    for time 23:59:59 function returns 0x00595923
177
Remarks:
177
Remarks:
178
  * See also subfunction 9 of function 26 - get time from
178
  * See also subfunction 9 of function 26 - get time from
179
    the moment of start of the system; it is more convenient, because
179
    the moment of start of the system; it is more convenient, because
180
    returns simply DWORD-value of the time counter.
180
    returns simply DWORD-value of the time counter.
181
  * System time can be set by function 22.
181
  * System time can be set by function 22.
182
 
182
 
183
======================================================================
183
======================================================================
184
============ Function 4 - draw text string in the window. ============
184
============ Function 4 - draw text string in the window. ============
185
======================================================================
185
======================================================================
186
Parameters:
186
Parameters:
187
  * eax = 4 - function number
187
  * eax = 4 - function number
188
  * ebx = [coordinate on axis x]*65536 + [coordinate on axis y]
188
  * ebx = [coordinate on axis x]*65536 + [coordinate on axis y]
189
  * ecx = 0xX0RRGGBB, where
189
  * ecx = 0xX0RRGGBB, where
190
    * RR, GG, BB specify text color
190
    * RR, GG, BB specify text color
191
    * X=ABnn (bits):
191
    * X=ABnn (bits):
192
    * nn specifies the used font: 0=system monospaced,
192
    * nn specifies the used font: 0=system monospaced,
193
      1=system font of variable width
193
      1=system font of variable width
194
    * A=0 - output esi characters, A=1 - output ASCIIZ-string
194
    * A=0 - output esi characters, A=1 - output ASCIIZ-string
195
    * B=1 - fill background with the color edi
195
    * B=1 - fill background with the color edi
196
  * edx = pointer to the beginning of the string
196
  * edx = pointer to the beginning of the string
197
  * esi = for A=0 length of the string, must not exceed 255;
197
  * esi = for A=0 length of the string, must not exceed 255;
198
          for A=1 is ignored
198
          for A=1 is ignored
199
Returned value:
199
Returned value:
200
  * function does not return value
200
  * function does not return value
201
Remarks:
201
Remarks:
202
  * First system font is read out at loading from the file char.mt,
202
  * First system font is read out at loading from the file char.mt,
203
    second - from char2.mt.
203
    second - from char2.mt.
204
  * Both fonts have height 9 pixels, width of the monospaced font
204
  * Both fonts have height 9 pixels, width of the monospaced font
205
    is equal to 6 pixels.
205
    is equal to 6 pixels.
206
 
206
 
207
======================================================================
207
======================================================================
208
========================= Function 5 - delay. ========================
208
========================= Function 5 - delay. ========================
209
======================================================================
209
======================================================================
210
Delays execution of the program on the given time.
210
Delays execution of the program on the given time.
211
Parameters:
211
Parameters:
212
  * eax = 5 - function number
212
  * eax = 5 - function number
213
  * ebx = time in the 1/100 of second
213
  * ebx = time in the 1/100 of second
214
Returned value:
214
Returned value:
215
  * function does not return value
215
  * function does not return value
216
Remarks:
216
Remarks:
217
  * Passing ebx=0 does not transfer control to the next process
217
  * Passing ebx=0 does not transfer control to the next process
218
    and does not make any operations at all. If it is really required
218
    and does not make any operations at all. If it is really required
219
    to transfer control to the next process (to complete a current
219
    to transfer control to the next process (to complete a current
220
    time slice), use subfunction 1 of function 68.
220
    time slice), use subfunction 1 of function 68.
221
  * At current implementation there will be an immediate return from
221
  * At current implementation there will be an immediate return from
222
    the function, if the addition of ebx with current value of
222
    the function, if the addition of ebx with current value of
223
    time counter will call 32-bit overflow.
223
    time counter will call 32-bit overflow.
224
 
224
 
225
======================================================================
225
======================================================================
226
============== Function 6 - read the file from ramdisk. ==============
226
============== Function 6 - read the file from ramdisk. ==============
227
======================================================================
227
======================================================================
228
Parameters:
228
Parameters:
229
  * eax = 6 - function number
229
  * eax = 6 - function number
230
  * ebx = pointer to the filename
230
  * ebx = pointer to the filename
231
  * ecx = number of start block, beginning from 1;
231
  * ecx = number of start block, beginning from 1;
232
    ecx=0 - read from the beginning of the file (same as ecx=1)
232
    ecx=0 - read from the beginning of the file (same as ecx=1)
233
  * edx = number of blocks to read;
233
  * edx = number of blocks to read;
234
    edx=0 - read one block (same as edx=1)
234
    edx=0 - read one block (same as edx=1)
235
  * esi = pointer to memory area for the data
235
  * esi = pointer to memory area for the data
236
Returned value:
236
Returned value:
237
  * eax = file size in bytes, if the file was successfully read
237
  * eax = file size in bytes, if the file was successfully read
238
  * eax = -1, if the file was not found
238
  * eax = -1, if the file was not found
239
Remarks:
239
Remarks:
240
  * This function is out-of-date; function 70 allows
240
  * This function is out-of-date; function 70 allows
241
    to fulfil the same operations with the extended possibilities.
241
    to fulfil the same operations with the extended possibilities.
242
  * Block = 512 bytes.
242
  * Block = 512 bytes.
243
  * For reading all file you can specify the certainly large value
243
  * For reading all file you can specify the certainly large value
244
    in edx, for example, edx = -1; but in this case be ready that
244
    in edx, for example, edx = -1; but in this case be ready that
245
    the program will "fall", if the file will appear too large and can
245
    the program will "fall", if the file will appear too large and can
246
    not be placed in the program memory.
246
    not be placed in the program memory.
247
  * The filename must be either in the format 8+3 characters
247
  * The filename must be either in the format 8+3 characters
248
    (first 8 characters - name itself, last 3 - extension,
248
    (first 8 characters - name itself, last 3 - extension,
249
    the short names and extensions are supplemented with spaces),
249
    the short names and extensions are supplemented with spaces),
250
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
250
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
251
    (name no more than 8 characters, dot, extension 3 characters
251
    (name no more than 8 characters, dot, extension 3 characters
252
    supplemented if necessary by spaces).
252
    supplemented if necessary by spaces).
253
    The filename must be written with capital letters. The terminating
253
    The filename must be written with capital letters. The terminating
254
    character with code 0 is not necessary (not ASCIIZ-string).
254
    character with code 0 is not necessary (not ASCIIZ-string).
255
  * This function does not support folders on the ramdisk.
255
  * This function does not support folders on the ramdisk.
256
 
256
 
257
======================================================================
257
======================================================================
258
=============== Function 7 - draw image in the window. ===============
258
=============== Function 7 - draw image in the window. ===============
259
======================================================================
259
======================================================================
260
Paramters:
260
Paramters:
261
  * eax = 7 - function number
261
  * eax = 7 - function number
262
  * ebx = pointer to the image in the format BBGGRRBBGGRR...
262
  * ebx = pointer to the image in the format BBGGRRBBGGRR...
263
  * ecx = [size on axis x]*65536 + [size on axis y]
263
  * ecx = [size on axis x]*65536 + [size on axis y]
264
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
264
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
265
Returned value:
265
Returned value:
266
  * function does not return value
266
  * function does not return value
267
Remarks:
267
Remarks:
268
  * Coordinates of the image are coordinates of the upper left corner
268
  * Coordinates of the image are coordinates of the upper left corner
269
    of the image relative to the window.
269
    of the image relative to the window.
270
  * Size of the image in bytes is 3*xsize*ysize.
270
  * Size of the image in bytes is 3*xsize*ysize.
271
 
271
 
272
======================================================================
272
======================================================================
273
=============== Function 8 - define/delete the button. ===============
273
=============== Function 8 - define/delete the button. ===============
274
======================================================================
274
======================================================================
275
Parameters for button definition:
275
Parameters for button definition:
276
  * eax = 8 - function number
276
  * eax = 8 - function number
277
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
277
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
278
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
278
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
279
  * edx = 0xXYnnnnnn, where:
279
  * edx = 0xXYnnnnnn, where:
280
    * nnnnnn = identifier of the button
280
    * nnnnnn = identifier of the button
281
    * high (31st) bit of edx is cleared
281
    * high (31st) bit of edx is cleared
282
    * if 30th bit of edx is set - do not draw the button
282
    * if 30th bit of edx is set - do not draw the button
283
    * if 29th bit of edx is set - do not draw a frame
283
    * if 29th bit of edx is set - do not draw a frame
284
      at pressing the button
284
      at pressing the button
285
  * esi = 0x00RRGGBB - color of the button
285
  * esi = 0x00RRGGBB - color of the button
286
Parameters for button deleting:
286
Parameters for button deleting:
287
  * eax = 8 - function number
287
  * eax = 8 - function number
288
  * edx = 0x80nnnnnn, where nnnnnn - identifier of the button
288
  * edx = 0x80nnnnnn, where nnnnnn - identifier of the button
289
Returned value:
289
Returned value:
290
  * function does not return value
290
  * function does not return value
291
Remarks:
291
Remarks:
292
  * Sizes of the button must be more than 0 and less than 0x8000.
292
  * Sizes of the button must be more than 0 and less than 0x8000.
293
  * For skinned windows definition of the window
293
  * For skinned windows definition of the window
294
    (call of 0th function) creates two standard buttons -
294
    (call of 0th function) creates two standard buttons -
295
    for close of the window with identifier 1 and
295
    for close of the window with identifier 1 and
296
    for minimize of the window with identifier 0xffff.
296
    for minimize of the window with identifier 0xffff.
297
  * The creation of two buttons with same identifiers is admitted.
297
  * The creation of two buttons with same identifiers is admitted.
298
  * The button with the identifier 0xffff at pressing is interpreted
298
  * The button with the identifier 0xffff at pressing is interpreted
299
    by the system as the button of minimization, the system handles
299
    by the system as the button of minimization, the system handles
300
    such pressing independently, not accessing to the application.
300
    such pressing independently, not accessing to the application.
301
    In rest it is usual button.
301
    In rest it is usual button.
302
  * Total number of buttons for all applications is limited to 4095.
302
  * Total number of buttons for all applications is limited to 4095.
303
 
303
 
304
======================================================================
304
======================================================================
305
============ Function 9 - information on execution thread. ===========
305
============ Function 9 - information on execution thread. ===========
306
======================================================================
306
======================================================================
307
Parameters:
307
Parameters:
308
  * eax = 9 - function number
308
  * eax = 9 - function number
309
  * ebx = pointer to 1-Kb buffer
309
  * ebx = pointer to 1-Kb buffer
310
  * ecx = number of the slot of the thread
310
  * ecx = number of the slot of the thread
311
    ecx = -1 - get information on the current thread
311
    ecx = -1 - get information on the current thread
312
Returned value:
312
Returned value:
313
  * eax = maximum number of the slot of a thread
313
  * eax = maximum number of the slot of a thread
314
  * buffer pointed to by ebx contains the following information:
314
  * buffer pointed to by ebx contains the following information:
315
    * +0: dword: usage of the processor (how many time units
315
    * +0: dword: usage of the processor (how many time units
316
      per second leaves on execution of this thread)
316
      per second leaves on execution of this thread)
317
    * +4: word: position of the window of thread in the window stack
317
    * +4: word: position of the window of thread in the window stack
318
    * +6: word: (has no relation to the specified thread)
318
    * +6: word: (has no relation to the specified thread)
319
      number of the thread slot, which window has in the window stack
319
      number of the thread slot, which window has in the window stack
320
      position ecx
320
      position ecx
321
    * +8: word: reserved
321
    * +8: word: reserved
322
    * +10 = +0xA: 11 bytes: name of the process
322
    * +10 = +0xA: 11 bytes: name of the process
323
      (name of corresponding executable file in the format 8+3)
323
      (name of corresponding executable file in the format 8+3)
324
    * +21 = +0x15: byte: reserved, this byte is not changed
324
    * +21 = +0x15: byte: reserved, this byte is not changed
325
    * +22 = +0x16: dword: address of the process in memory
325
    * +22 = +0x16: dword: address of the process in memory
326
    * +26 = +0x1A: dword: size of used memory - 1
326
    * +26 = +0x1A: dword: size of used memory - 1
327
    * +30 = +0x1E: dword: identifier (PID/TID)
327
    * +30 = +0x1E: dword: identifier (PID/TID)
328
    * +34 = +0x22: dword: coordinate of the thread window on axis x
328
    * +34 = +0x22: dword: coordinate of the thread window on axis x
329
    * +38 = +0x26: dword: coordinate of the thread window on axis y
329
    * +38 = +0x26: dword: coordinate of the thread window on axis y
330
    * +42 = +0x2A: dword: size of the thread window on axis x
330
    * +42 = +0x2A: dword: size of the thread window on axis x
331
    * +46 = +0x2E: dword: size of the thread window on axis y
331
    * +46 = +0x2E: dword: size of the thread window on axis y
332
    * +50 = +0x32: word: status of the thread slot:
332
    * +50 = +0x32: word: status of the thread slot:
333
      * 0 = thread is running
333
      * 0 = thread is running
334
      * 1 = thread is suspended
334
      * 1 = thread is suspended
335
      * 2 = thread is suspended while waiting for event
335
      * 2 = thread is suspended while waiting for event
336
      * 3 = thread is terminating as a result of call to function -1
336
      * 3 = thread is terminating as a result of call to function -1
337
        or under duress as a result of call to subfunction 2
337
        or under duress as a result of call to subfunction 2
338
        of function 18 or termination of the system
338
        of function 18 or termination of the system
339
      * 4 = thread is terminating as a result of exception
339
      * 4 = thread is terminating as a result of exception
340
      * 5 = thread waits for event
340
      * 5 = thread waits for event
341
      * 9 = requested slot is free, all other information on the slot
341
      * 9 = requested slot is free, all other information on the slot
342
        is not meaningful
342
        is not meaningful
343
    * +52 = +0x34: word: reserved, this word is not changed
343
    * +52 = +0x34: word: reserved, this word is not changed
344
    * +54 = +0x36: dword: coordinate of the client area on axis x
344
    * +54 = +0x36: dword: coordinate of the client area on axis x
345
    * +58 = +0x3A: dword: coordinate of the client area on axis y
345
    * +58 = +0x3A: dword: coordinate of the client area on axis y
346
    * +62 = +0x3E: dword: width of the client area
346
    * +62 = +0x3E: dword: width of the client area
347
    * +66 = +0x42: dword: height of the client area
347
    * +66 = +0x42: dword: height of the client area
348
    * +70 = +0x46: byte: state of the window - bitfield
348
    * +70 = +0x46: byte: state of the window - bitfield
349
      * bit 0 (mask 1): window is maximized
349
      * bit 0 (mask 1): window is maximized
350
      * bit 1 (mask 2): window is minimized to panel
350
      * bit 1 (mask 2): window is minimized to panel
351
      * bit 2 (mask 4): window is rolled up
351
      * bit 2 (mask 4): window is rolled up
352
Remarks:
352
Remarks:
353
  * Slots are numbered starting from 1.
353
  * Slots are numbered starting from 1.
354
  * Returned value is not a total number of threads, because there
354
  * Returned value is not a total number of threads, because there
355
    can be free slots.
355
    can be free slots.
356
  * When process is starting, system automatically creates
356
  * When process is starting, system automatically creates
357
    execution thread.
357
    execution thread.
358
  * Function gives information on the thread. Each process has
358
  * Function gives information on the thread. Each process has
359
    at least one thread. One process can create many threads,
359
    at least one thread. One process can create many threads,
360
    in this case each thread has its own slot and the fields
360
    in this case each thread has its own slot and the fields
361
    +10, +22, +26 in these slots coincide.
361
    +10, +22, +26 in these slots coincide.
362
    Applications have no common way to define whether two threads
362
    Applications have no common way to define whether two threads
363
    belong to one process.
363
    belong to one process.
364
  * The active window - window on top of the window stack -
364
  * The active window - window on top of the window stack -
365
    receives the messages on a keyboard input. For such window
365
    receives the messages on a keyboard input. For such window
366
    the position in the window stack coincides with returned value.
366
    the position in the window stack coincides with returned value.
367
  * Slot 1 corresponds to special system thread, for which:
367
  * Slot 1 corresponds to special system thread, for which:
368
    * the window is in the bottom of the window stack, the fields
368
    * the window is in the bottom of the window stack, the fields
369
      +4 and +6 contain value 1
369
      +4 and +6 contain value 1
370
    * name of the process - "OS/IDLE" (supplemented by spaces)
370
    * name of the process - "OS/IDLE" (supplemented by spaces)
371
    * address of the process in memory is 0, size of used memory is
371
    * address of the process in memory is 0, size of used memory is
372
      16 Mb (0x1000000)
372
      16 Mb (0x1000000)
373
    * PID=1
373
    * PID=1
374
    * coordinates and sizes of the window and the client area are by
374
    * coordinates and sizes of the window and the client area are by
375
      convention set to 0
375
      convention set to 0
376
    * status of the slot is always 0 (running)
376
    * status of the slot is always 0 (running)
377
    * the execution time adds of time leaving on operations itself
377
    * the execution time adds of time leaving on operations itself
378
      and idle time in waiting for interrupt (which can be got by call
378
      and idle time in waiting for interrupt (which can be got by call
379
      to subfunction 4 of function 18).
379
      to subfunction 4 of function 18).
380
  * Beginning from slot 2, the normal applications are placed.
380
  * Beginning from slot 2, the normal applications are placed.
381
  * The normal applications are placed in memory at the address
381
  * The normal applications are placed in memory at the address
382
    0x60400000 (kernel constant 'std_application_base_address').
382
    0x60400000 (kernel constant 'std_application_base_address').
383
    There is no intersection, as each process has its own page table.
383
    There is no intersection, as each process has its own page table.
384
  * At creation of the thread it is assigned the slot
384
  * At creation of the thread it is assigned the slot
385
    in the system table and identifier (Process/Thread IDentifier =
385
    in the system table and identifier (Process/Thread IDentifier =
386
    PID/TID), which do not vary with time for given thread.
386
    PID/TID), which do not vary with time for given thread.
387
    After completion of the thread its slot can be anew used
387
    After completion of the thread its slot can be anew used
388
    for another thread. The thread identifier can not be assigned
388
    for another thread. The thread identifier can not be assigned
389
    to other thread even after completion of this thread.
389
    to other thread even after completion of this thread.
390
    Identifiers, assigned to new threads, grow monotonously.
390
    Identifiers, assigned to new threads, grow monotonously.
391
  * If the thread has not yet defined the window by call to
391
  * If the thread has not yet defined the window by call to
392
    function 0, the position and the sizes
392
    function 0, the position and the sizes
393
    of its window are considered to be zero.
393
    of its window are considered to be zero.
394
  * Coordinates of the client area are relative to the window.
394
  * Coordinates of the client area are relative to the window.
395
  * At the moment only the part of the buffer by a size
395
  * At the moment only the part of the buffer by a size
396
    71 = 0x37 bytes is used. Nevertheless it is recommended to use
396
    71 = 0x37 bytes is used. Nevertheless it is recommended to use
397
    1-Kb buffer for the future compatibility, in the future
397
    1-Kb buffer for the future compatibility, in the future
398
    some fields can be added.
398
    some fields can be added.
399
 
399
 
400
======================================================================
400
======================================================================
401
==================== Function 10 - wait for event. ===================
401
==================== Function 10 - wait for event. ===================
402
======================================================================
402
======================================================================
403
If the message queue is empty, waits for appearance of the message
403
If the message queue is empty, waits for appearance of the message
404
in queue. In this state thread does not consume CPU time.
404
in queue. In this state thread does not consume CPU time.
405
Then reads out the message from queue.
405
Then reads out the message from queue.
406
 
406
 
407
Parameters:
407
Parameters:
408
  * eax = 10 - function number
408
  * eax = 10 - function number
409
Returned value:
409
Returned value:
410
  * eax = event (see the list of events)
410
  * eax = event (see the list of events)
411
Remarks:
411
Remarks:
412
  * Those events are taken into account only which enter into
412
  * Those events are taken into account only which enter into
413
    a mask set by function 40. By default it is
413
    a mask set by function 40. By default it is
414
    redraw, key and button events.
414
    redraw, key and button events.
415
  * To check, whether there is a message in queue, use function 11.
415
  * To check, whether there is a message in queue, use function 11.
416
    To wait for no more than given time, use function 23.
416
    To wait for no more than given time, use function 23.
417
 
417
 
418
======================================================================
418
======================================================================
419
=============== Function 11 - check for event, no wait. ==============
419
=============== Function 11 - check for event, no wait. ==============
420
======================================================================
420
======================================================================
421
If the message queue contains event, function reads out
421
If the message queue contains event, function reads out
422
and return it. If the queue is empty, function returns 0.
422
and return it. If the queue is empty, function returns 0.
423
Parameters:
423
Parameters:
424
  * eax = 11 - function number
424
  * eax = 11 - function number
425
Returned value:
425
Returned value:
426
  * eax = 0 - message queue is empty
426
  * eax = 0 - message queue is empty
427
  * else eax = event (see the list of events)
427
  * else eax = event (see the list of events)
428
Remarks:
428
Remarks:
429
  * Those events are taken into account only, which enter into
429
  * Those events are taken into account only, which enter into
430
    a mask set by function 40. By default it is
430
    a mask set by function 40. By default it is
431
    redraw, key and button events.
431
    redraw, key and button events.
432
  * To wait for event, use function 10.
432
  * To wait for event, use function 10.
433
    To wait for no more than given time, use function 23.
433
    To wait for no more than given time, use function 23.
434
 
434
 
435
======================================================================
435
======================================================================
436
=============== Function 12 - begin/end window redraw. ===============
436
=============== Function 12 - begin/end window redraw. ===============
437
======================================================================
437
======================================================================
438
 
438
 
439
---------------- Subfunction 1 - begin window redraw. ----------------
439
---------------- Subfunction 1 - begin window redraw. ----------------
440
Parameters:
440
Parameters:
441
  * eax = 12 - function number
441
  * eax = 12 - function number
442
  * ebx = 1 - subfunction number
442
  * ebx = 1 - subfunction number
443
Returned value:
443
Returned value:
444
  * function does not return value
444
  * function does not return value
445
 
445
 
446
----------------- Subfunction 2 - end window redraw. -----------------
446
----------------- Subfunction 2 - end window redraw. -----------------
447
Parameters:
447
Parameters:
448
  * eax = 12 - function number
448
  * eax = 12 - function number
449
  * ebx = 2 - subfunction number
449
  * ebx = 2 - subfunction number
450
Returned value:
450
Returned value:
451
  * function does not return value
451
  * function does not return value
452
Remarks:
452
Remarks:
453
  * Subfunction 1 deletes all buttons defined with
453
  * Subfunction 1 deletes all buttons defined with
454
    function 8, they must be defined again.
454
    function 8, they must be defined again.
455
 
455
 
456
======================================================================
456
======================================================================
457
============ Function 13 - draw a rectangle in the window. ===========
457
============ Function 13 - draw a rectangle in the window. ===========
458
======================================================================
458
======================================================================
459
Parameters:
459
Parameters:
460
  * eax = 13 - function number
460
  * eax = 13 - function number
461
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
461
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
462
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
462
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
463
  * edx = color 0xRRGGBB or 0x80RRGGBB for gradient fill
463
  * edx = color 0xRRGGBB or 0x80RRGGBB for gradient fill
464
Returned value:
464
Returned value:
465
  * function does not return value
465
  * function does not return value
466
Remarks:
466
Remarks:
467
  * Coordinates are understood as coordinates of the left upper corner
467
  * Coordinates are understood as coordinates of the left upper corner
468
    of a rectangle relative to the window.
468
    of a rectangle relative to the window.
469
 
469
 
470
======================================================================
470
======================================================================
471
=================== Function 14 - get screen size. ===================
471
=================== Function 14 - get screen size. ===================
472
======================================================================
472
======================================================================
473
Parameters:
473
Parameters:
474
  * eax = 14 - function number
474
  * eax = 14 - function number
475
Returned value:
475
Returned value:
476
  * eax = [xsize]*65536 + [ysize], where
476
  * eax = [xsize]*65536 + [ysize], where
477
  * xsize = x-coordinate of the right lower corner of the screen =
477
  * xsize = x-coordinate of the right lower corner of the screen =
478
            horizontal size - 1
478
            horizontal size - 1
479
  * ysize = y-coordinate of the right lower corner of the screen =
479
  * ysize = y-coordinate of the right lower corner of the screen =
480
            vertical size - 1
480
            vertical size - 1
481
Remarks:
481
Remarks:
482
  * See also subfunction 5 of function 48 - get sizes of
482
  * See also subfunction 5 of function 48 - get sizes of
483
    working area of the screen.
483
    working area of the screen.
484
 
484
 
485
======================================================================
485
======================================================================
486
== Function 15, subfunction 1 - set a size of the background image. ==
486
== Function 15, subfunction 1 - set a size of the background image. ==
487
======================================================================
487
======================================================================
488
Parameters:
488
Parameters:
489
  * eax = 15 - function number
489
  * eax = 15 - function number
490
  * ebx = 1 - subfunction number
490
  * ebx = 1 - subfunction number
491
  * ecx = width of the image
491
  * ecx = width of the image
492
  * edx = height of the image
492
  * edx = height of the image
493
Returned value:
493
Returned value:
494
  * function does not return value
494
  * function does not return value
495
Remarks:
495
Remarks:
496
  * There is no checks for correctness. The setting of too large
496
  * There is no checks for correctness. The setting of too large
497
    values will result that the background will contain data abroad
497
    values will result that the background will contain data abroad
498
    of buffer for the background image. Buffer size = 0x160000-0x10,
498
    of buffer for the background image. Buffer size = 0x160000-0x10,
499
    that corresponds to maximum size 800*600. (800*600*3=0x15F900)
499
    that corresponds to maximum size 800*600. (800*600*3=0x15F900)
500
  * For update of the screen (after completion of a series of commands
500
  * For update of the screen (after completion of a series of commands
501
    working with a background) call subfunction 3.
501
    working with a background) call subfunction 3.
502
  * There is a pair function for get size of the background image -
502
  * There is a pair function for get size of the background image -
503
    subfunction 1 of function 39.
503
    subfunction 1 of function 39.
504
 
504
 
505
======================================================================
505
======================================================================
506
=== Function 15, subfunction 2 - put pixel on the background image. ==
506
=== Function 15, subfunction 2 - put pixel on the background image. ==
507
======================================================================
507
======================================================================
508
Parameters:
508
Parameters:
509
  * eax = 15 - function number
509
  * eax = 15 - function number
510
  * ebx = 2 - subfunction number
510
  * ebx = 2 - subfunction number
511
  * ecx = offset
511
  * ecx = offset
512
  * edx = color of a pixel 0xRRGGBB
512
  * edx = color of a pixel 0xRRGGBB
513
Returned value:
513
Returned value:
514
  * function does not return value
514
  * function does not return value
515
Remarks:
515
Remarks:
516
  * Offset for a pixel with coordinates (x,y) is calculated as
516
  * Offset for a pixel with coordinates (x,y) is calculated as
517
    (x+y*xsize)*3.
517
    (x+y*xsize)*3.
518
  * If the given offset exceeds 0x160000-16 = 1.375 Mb - 16 bytes,
518
  * If the given offset exceeds 0x160000-16 = 1.375 Mb - 16 bytes,
519
    the call is ignored.
519
    the call is ignored.
520
  * For update of the screen (after completion of a series of commands
520
  * For update of the screen (after completion of a series of commands
521
    working with a background) call subfunction 3.
521
    working with a background) call subfunction 3.
522
  * There is a pair function for get pixel on the background image -
522
  * There is a pair function for get pixel on the background image -
523
    subfunction 2 of function 39.
523
    subfunction 2 of function 39.
524
 
524
 
525
======================================================================
525
======================================================================
526
=========== Function 15, subfunction 3 - redraw background. ==========
526
=========== Function 15, subfunction 3 - redraw background. ==========
527
======================================================================
527
======================================================================
528
Parameters:
528
Parameters:
529
  * eax = 15 - function number
529
  * eax = 15 - function number
530
  * ebx = 3 - subfunction number
530
  * ebx = 3 - subfunction number
531
Returned value:
531
Returned value:
532
  * function does not return value
532
  * function does not return value
533
 
533
 
534
======================================================================
534
======================================================================
535
== Function 15, subfunction 4 - set drawing mode for the background. =
535
== Function 15, subfunction 4 - set drawing mode for the background. =
536
======================================================================
536
======================================================================
537
Parameters:
537
Parameters:
538
  * eax = 15 - function number
538
  * eax = 15 - function number
539
  * ebx = 4 - subfunction number
539
  * ebx = 4 - subfunction number
540
  * ecx = drawing mode:
540
  * ecx = drawing mode:
541
    * 1 = tile
541
    * 1 = tile
542
    * 2 = stretch
542
    * 2 = stretch
543
Returned value:
543
Returned value:
544
  * function does not return value
544
  * function does not return value
545
Remarks:
545
Remarks:
546
  * For update of the screen (after completion of a series of commands
546
  * For update of the screen (after completion of a series of commands
547
    working with a background) call subfunction 3.
547
    working with a background) call subfunction 3.
548
  * There is a pair function for get drawing mode of the background -
548
  * There is a pair function for get drawing mode of the background -
549
    subfunction 4 of function 39.
549
    subfunction 4 of function 39.
550
 
550
 
551
======================================================================
551
======================================================================
552
===================== Function 15, subfunction 5 =====================
552
===================== Function 15, subfunction 5 =====================
553
============ Put block of pixels on the background image. ============
553
============ Put block of pixels on the background image. ============
554
======================================================================
554
======================================================================
555
Parameters:
555
Parameters:
556
  * eax = 15 - function number
556
  * eax = 15 - function number
557
  * ebx = 5 - subfunction number
557
  * ebx = 5 - subfunction number
558
  * ecx = pointer to the data in the format BBGGRRBBGGRR...
558
  * ecx = pointer to the data in the format BBGGRRBBGGRR...
559
  * edx = offset in data of the background image
559
  * edx = offset in data of the background image
560
  * esi = size of data in bytes = 3 * number of pixels
560
  * esi = size of data in bytes = 3 * number of pixels
561
Returned value:
561
Returned value:
562
  * function does not return value
562
  * function does not return value
563
Remarks:
563
Remarks:
564
  * If the block gets out abroad 0x160000-16 = 1.375 Mb - 16 bytes,
564
  * If the block gets out abroad 0x160000-16 = 1.375 Mb - 16 bytes,
565
    the call is ignored.
565
    the call is ignored.
566
  * Color of each pixel is stored as 3-bytes value BBGGRR.
566
  * Color of each pixel is stored as 3-bytes value BBGGRR.
567
  * Pixels of the background image are written sequentially
567
  * Pixels of the background image are written sequentially
568
    from left to right, from up to down.
568
    from left to right, from up to down.
569
  * Offset of pixel with coordinates (x,y) is (x+y*xsize)*3.
569
  * Offset of pixel with coordinates (x,y) is (x+y*xsize)*3.
570
  * For update of the screen (after completion of a series of commands
570
  * For update of the screen (after completion of a series of commands
571
    working with a background) call subfunction 3.
571
    working with a background) call subfunction 3.
572
 
572
 
573
======================================================================
573
======================================================================
574
=============== Function 16 - save ramdisk on a floppy. ==============
574
=============== Function 16 - save ramdisk on a floppy. ==============
575
======================================================================
575
======================================================================
576
Parameters:
576
Parameters:
577
  * eax = 16 - function number
577
  * eax = 16 - function number
578
  * ebx = 1 or ebx = 2 - on which floppy save
578
  * ebx = 1 or ebx = 2 - on which floppy save
579
Returned value:
579
Returned value:
580
  * eax = 0 - success
580
  * eax = 0 - success
581
  * eax = 1 - error
581
  * eax = 1 - error
582
 
582
 
583
======================================================================
583
======================================================================
584
======= Function 17 - get the identifier of the pressed button. ======
584
======= Function 17 - get the identifier of the pressed button. ======
585
======================================================================
585
======================================================================
586
Takes away the code of the pressed button from the buffer.
586
Takes away the code of the pressed button from the buffer.
587
Parameters:
587
Parameters:
588
  * eax = 17 - function number
588
  * eax = 17 - function number
589
Returned value:
589
Returned value:
590
  * if the buffer is empty, function returns eax=1
590
  * if the buffer is empty, function returns eax=1
591
  * if the buffer is not empty, function returns al=0,
591
  * if the buffer is not empty, function returns al=0,
592
    high 24 bits of eax contain button identifier (in particular, ah
592
    high 24 bits of eax contain button identifier (in particular, ah
593
    contains low byte of the identifier; if all buttons have
593
    contains low byte of the identifier; if all buttons have
594
    the identifier less than 256, ah is enough to distinguish).
594
    the identifier less than 256, ah is enough to distinguish).
595
Remarks:
595
Remarks:
596
  * "Buffer" keeps only one button, at pressing the new button the
596
  * "Buffer" keeps only one button, at pressing the new button the
597
    information about old is lost.
597
    information about old is lost.
598
  * The call of this function by an application with inactive window
598
  * The call of this function by an application with inactive window
599
    will return answer "buffer is empty".
599
    will return answer "buffer is empty".
600
 
600
 
601
======================================================================
601
======================================================================
602
============ Function 18, subfunction 1 - system shutdown. ===========
602
============ Function 18, subfunction 1 - system shutdown. ===========
603
======================================================================
603
======================================================================
604
Parameters:
604
Parameters:
605
  * eax = 18 - function number
605
  * eax = 18 - function number
606
  * ebx = 1 - subfunction number
606
  * ebx = 1 - subfunction number
607
Returned value:
607
Returned value:
608
  * function always return eax = 0 as tag of success
608
  * function always return eax = 0 as tag of success
609
Remarks:
609
Remarks:
610
  * On the last step menu of exit from the system appears and waits
610
  * On the last step menu of exit from the system appears and waits
611
    response of the user.
611
    response of the user.
612
  * See also subfunction 9, system shutdown with
612
  * See also subfunction 9, system shutdown with
613
    the parameter to force the choice in the exit menu.
613
    the parameter to force the choice in the exit menu.
614
 
614
 
615
======================================================================
615
======================================================================
616
= Function 18, subfunction 2 - terminate process/thread by the slot. =
616
= Function 18, subfunction 2 - terminate process/thread by the slot. =
617
======================================================================
617
======================================================================
618
Parameters:
618
Parameters:
619
  * eax = 18 - function number
619
  * eax = 18 - function number
620
  * ebx = 2 - subfunction number
620
  * ebx = 2 - subfunction number
621
  * ecx = number of the slot of process/thread
621
  * ecx = number of the slot of process/thread
622
Returned value:
622
Returned value:
623
  * function does not return value
623
  * function does not return value
624
Remarks:
624
Remarks:
625
  * It is impossible to terminate system thread OS/IDLE (with
625
  * It is impossible to terminate system thread OS/IDLE (with
626
    number of the slot 1),
626
    number of the slot 1),
627
    it is possible to terminate any normal process/thread.
627
    it is possible to terminate any normal process/thread.
628
  * See also subfunction 18 - terminate
628
  * See also subfunction 18 - terminate
629
    process/thread by the identifier.
629
    process/thread by the identifier.
630
 
630
 
631
======================================================================
631
======================================================================
632
===================== Function 18, subfunction 3 =====================
632
===================== Function 18, subfunction 3 =====================
633
============= Make active the window of the given thread. ============
633
============= Make active the window of the given thread. ============
634
======================================================================
634
======================================================================
635
Parameters:
635
Parameters:
636
  * eax = 18 - function number
636
  * eax = 18 - function number
637
  * ebx = 3 - subfunction number
637
  * ebx = 3 - subfunction number
638
  * ecx = number of the thread slot
638
  * ecx = number of the thread slot
639
Returned value:
639
Returned value:
640
  * function does not return value
640
  * function does not return value
641
Remarks:
641
Remarks:
642
  * If correct, but nonexistent slot is given,
642
  * If correct, but nonexistent slot is given,
643
    some window is made active.
643
    some window is made active.
644
  * To find out, which window is active, use subfunction 7.
644
  * To find out, which window is active, use subfunction 7.
645
 
645
 
646
======================================================================
646
======================================================================
647
===================== Function 18, subfunction 4 =====================
647
===================== Function 18, subfunction 4 =====================
648
=========== Get counter of idle time units per one second. ===========
648
=========== Get counter of idle time units per one second. ===========
649
======================================================================
649
======================================================================
650
Idle time units are units, in which the processor stands idle
650
Idle time units are units, in which the processor stands idle
651
in waiting for interrupt (in the command 'hlt').
651
in waiting for interrupt (in the command 'hlt').
652
 
652
 
653
Parameters:
653
Parameters:
654
  * eax = 18 - function number
654
  * eax = 18 - function number
655
  * ebx = 4 - subfunction number
655
  * ebx = 4 - subfunction number
656
Returned value:
656
Returned value:
657
  * eax = value of the counter of idle time units per one second
657
  * eax = value of the counter of idle time units per one second
658
 
658
 
659
======================================================================
659
======================================================================
660
========== Function 18, subfunction 5 - get CPU clock rate. ==========
660
========== Function 18, subfunction 5 - get CPU clock rate. ==========
661
======================================================================
661
======================================================================
662
Parameters:
662
Parameters:
663
  * eax = 18 - function number
663
  * eax = 18 - function number
664
  * ebx = 5 - subfunction number
664
  * ebx = 5 - subfunction number
665
Returned value:
665
Returned value:
666
  * eax = clock rate (modulo 2^32 clock ticks = 4GHz)
666
  * eax = clock rate (modulo 2^32 clock ticks = 4GHz)
667
 
667
 
668
======================================================================
668
======================================================================
669
 Function 18, subfunction 6 - save ramdisk to the file on hard drive. 
669
 Function 18, subfunction 6 - save ramdisk to the file on hard drive. 
670
======================================================================
670
======================================================================
671
Parameters:
671
Parameters:
672
  * eax = 18 - function number
672
  * eax = 18 - function number
673
  * ebx = 6 - subfunction number
673
  * ebx = 6 - subfunction number
674
  * ecx defines path to the file:
674
  * ecx = pointer to the full path to file
675
    * 1 = in the folder "/KOLIBRI"
675
    (for example, "/hd0/1/kolibri/kolibri.img")
676
    * 2 = in the root folder
-
 
677
    * 3 = edx points to the path (names of folders in the format 8+3,
-
 
678
      divided by '/')
-
 
679
Returned value:
676
Returned value:
680
  * eax = 0 - success
677
  * eax = 0 - success
681
  * else eax = error code of the file system
678
  * else eax = error code of the file system
682
Çàìå÷àíèÿ:
679
Remarks:
683
  * Filename is fixed, "kolibri.img" (global kernel variable
-
 
684
    'image_save' from 'preboot.inc')
-
 
685
  * Drive and partition are defined by subfunction 7
-
 
686
    and subfunction 8 of function 21.
-
 
687
  * All folders in the given path must exist, otherwise function
680
  * All folders in the given path must exist, otherwise function
688
    returns value 5, "file not found".
681
    returns value 5, "file not found".
689
 
682
 
690
======================================================================
683
======================================================================
691
=========== Function 18, subfunction 7 - get active window. ==========
684
=========== Function 18, subfunction 7 - get active window. ==========
692
======================================================================
685
======================================================================
693
Parameters:
686
Parameters:
694
  * eax = 18 - function number
687
  * eax = 18 - function number
695
  * ebx = 7 - subfunction number
688
  * ebx = 7 - subfunction number
696
Returned value:
689
Returned value:
697
  * eax = number of the active window
690
  * eax = number of the active window
698
    (number of the slot of the thread with active window)
691
    (number of the slot of the thread with active window)
699
Remarks:
692
Remarks:
700
  * Active window is at the top of the window stack and receives
693
  * Active window is at the top of the window stack and receives
701
    messages on all keyboard input.
694
    messages on all keyboard input.
702
  * To make a window active, use subfunction 3.
695
  * To make a window active, use subfunction 3.
703
 
696
 
704
======================================================================
697
======================================================================
705
== Function 18, subfunction 8 - disable/enable the internal speaker. =
698
== Function 18, subfunction 8 - disable/enable the internal speaker. =
706
======================================================================
699
======================================================================
707
If speaker sound is disabled, all calls to subfunction 55 of
700
If speaker sound is disabled, all calls to subfunction 55 of
708
function 55 are ignored. If speaker sound is enabled,
701
function 55 are ignored. If speaker sound is enabled,
709
they are routed on builtin speaker.
702
they are routed on builtin speaker.
710
 
703
 
711
------------------- Subsubfunction 1 - get status. -------------------
704
------------------- Subsubfunction 1 - get status. -------------------
712
Parameters:
705
Parameters:
713
  * eax = 18 - function number
706
  * eax = 18 - function number
714
  * ebx = 8 - subfunction number
707
  * ebx = 8 - subfunction number
715
  * ecx = 1 - number of the subsubfunction
708
  * ecx = 1 - number of the subsubfunction
716
Returned value:
709
Returned value:
717
  * eax = 0 - speaker sound is enabled; 1 - disabled
710
  * eax = 0 - speaker sound is enabled; 1 - disabled
718
 
711
 
719
----------------- Subsubfunction 2 - toggle status. ------------------
712
----------------- Subsubfunction 2 - toggle status. ------------------
720
Toggles states of disable/enable.
713
Toggles states of disable/enable.
721
Parameters:
714
Parameters:
722
  * eax = 18 - function number
715
  * eax = 18 - function number
723
  * ebx = 8 - subfunction number
716
  * ebx = 8 - subfunction number
724
  * ecx = 2 - number of the subsubfunction
717
  * ecx = 2 - number of the subsubfunction
725
Returned value:
718
Returned value:
726
  * function does not return value
719
  * function does not return value
727
 
720
 
728
======================================================================
721
======================================================================
729
== Function 18, subfunction 9 - system shutdown with the parameter. ==
722
== Function 18, subfunction 9 - system shutdown with the parameter. ==
730
======================================================================
723
======================================================================
731
Parameters:
724
Parameters:
732
  * eax = 18 - function number
725
  * eax = 18 - function number
733
  * ebx = 9 - subfunction number
726
  * ebx = 9 - subfunction number
734
  * ecx = parameter:
727
  * ecx = parameter:
735
    * 1 = on the last step of shutdown save ramdisk on a floppy and
728
    * 1 = on the last step of shutdown save ramdisk on a floppy and
736
      then show the exit menu and request further operations
729
      then show the exit menu and request further operations
737
      from the user
730
      from the user
738
    * 2 = turn off computer
731
    * 2 = turn off computer
739
    * 3 = reboot computer
732
    * 3 = reboot computer
740
    * 4 = restart the kernel from the file 'kernel.mnt' on ramdisk
733
    * 4 = restart the kernel from the file 'kernel.mnt' on ramdisk
741
Returned value:
734
Returned value:
742
  * at incorrect ecx the registers do not change (i.e. eax=18)
735
  * at incorrect ecx the registers do not change (i.e. eax=18)
743
  * by correct call function always returns eax=0
736
  * by correct call function always returns eax=0
744
    as the tag of success
737
    as the tag of success
745
Remarks:
738
Remarks:
746
  * Do not rely on returned value by incorrect call, it can be
739
  * Do not rely on returned value by incorrect call, it can be
747
    changed in future versions of the kernel.
740
    changed in future versions of the kernel.
748
  * It is possible to use subfunction 1, that on the last step
741
  * It is possible to use subfunction 1, that on the last step
749
    the user makes choice himself.
742
    the user makes choice himself.
750
  * It is not recommended to use value ecx=1 (to not irritate the user
743
  * It is not recommended to use value ecx=1 (to not irritate the user
751
    with excessive questions); to save ramdisk on a floppy use
744
    with excessive questions); to save ramdisk on a floppy use
752
    function 16 (which admits specification, on which floppy to
745
    function 16 (which admits specification, on which floppy to
753
    write), and to shutdown with the exit menu use already mentioned
746
    write), and to shutdown with the exit menu use already mentioned
754
    subfunction 1.
747
    subfunction 1.
755
 
748
 
756
======================================================================
749
======================================================================
757
===== Function 18, subfunction 10 - minimize application window. =====
750
===== Function 18, subfunction 10 - minimize application window. =====
758
======================================================================
751
======================================================================
759
Minimizes the own window.
752
Minimizes the own window.
760
Parameters:
753
Parameters:
761
  * eax = 18 - function number
754
  * eax = 18 - function number
762
  * ebx = 10 - subfunction number
755
  * ebx = 10 - subfunction number
763
Returned value:
756
Returned value:
764
  * function does not return value
757
  * function does not return value
765
Remarks:
758
Remarks:
766
  * The minimized window from the point of view of function 9
759
  * The minimized window from the point of view of function 9
767
    keeps position and sizes.
760
    keeps position and sizes.
768
  * Restoring of an application window occurs at its activation by 
761
  * Restoring of an application window occurs at its activation by 
769
    subfunction 3.
762
    subfunction 3.
770
  * Usually there is no necessity to minimize/restire a window
763
  * Usually there is no necessity to minimize/restire a window
771
    obviously: minimization of a window is carried out by the system
764
    obviously: minimization of a window is carried out by the system
772
    at pressing the minimization button (for skinned windows
765
    at pressing the minimization button (for skinned windows
773
    it is defined automatically by function 0,
766
    it is defined automatically by function 0,
774
    for other windows it can be defined manually by function 8),
767
    for other windows it can be defined manually by function 8),
775
    restore of a window is done by the application '@panel'.
768
    restore of a window is done by the application '@panel'.
776
 
769
 
777
======================================================================
770
======================================================================
778
 Function 18, subfunction 11 - get information on the disk subsystem. 
771
 Function 18, subfunction 11 - get information on the disk subsystem. 
779
======================================================================
772
======================================================================
780
Parameters:
773
Parameters:
781
  * eax = 18 - function number
774
  * eax = 18 - function number
782
  * ebx = 11 - subfunction number
775
  * ebx = 11 - subfunction number
783
  * ecx = type of the table:
776
  * ecx = type of the table:
784
    * 1 = short version, 10 bytes
777
    * 1 = short version, 10 bytes
785
    * 2 = full version, 65536 bytes
778
    * 2 = full version, 65536 bytes
786
  * edx = pointer to the buffer (in the application) for the table
779
  * edx = pointer to the buffer (in the application) for the table
787
Returned value:
780
Returned value:
788
  * function does not return value
781
  * function does not return value
789
Format of the table: short version:
782
Format of the table: short version:
790
  * +0: byte: information about FDD's (drives for floppies),
783
  * +0: byte: information about FDD's (drives for floppies),
791
    AAAABBBB, where AAAA gives type of the first drive, BBBB -
784
    AAAABBBB, where AAAA gives type of the first drive, BBBB -
792
    of the second regarding to the following list:
785
    of the second regarding to the following list:
793
    * 0 = there is no drive
786
    * 0 = there is no drive
794
    * 1 = 360Kb, 5.25''
787
    * 1 = 360Kb, 5.25''
795
    * 2 = 1.2Mb, 5.25''
788
    * 2 = 1.2Mb, 5.25''
796
    * 3 = 720Kb, 3.5''
789
    * 3 = 720Kb, 3.5''
797
    * 4 = 1.44Mb, 3.5''
790
    * 4 = 1.44Mb, 3.5''
798
    * 5 = 2.88Mb, 3.5'' (such drives are not used anymore)
791
    * 5 = 2.88Mb, 3.5'' (such drives are not used anymore)
799
    For example, for the standard configuration from one 1.44-drive
792
    For example, for the standard configuration from one 1.44-drive
800
    here will be 40h, and for the case 1.2Mb on A: and 1.44Mb on B:
793
    here will be 40h, and for the case 1.2Mb on A: and 1.44Mb on B:
801
    the value is 24h.
794
    the value is 24h.
802
  * +1: byte: information about hard disks and CD-drives, AABBCCDD,
795
  * +1: byte: information about hard disks and CD-drives, AABBCCDD,
803
    where AA corresponds to the controller IDE0, ..., DD - IDE3:
796
    where AA corresponds to the controller IDE0, ..., DD - IDE3:
804
    * 0 = device is absent
797
    * 0 = device is absent
805
    * 1 = hard drive
798
    * 1 = hard drive
806
    * 2 = CD-drive
799
    * 2 = CD-drive
807
    For example, in the case HD on IDE0 and CD on IDE2
800
    For example, in the case HD on IDE0 and CD on IDE2
808
    this field contains 48h.
801
    this field contains 48h.
809
  * +2: 4 db: number of the retrieved partitions on hard disks
802
  * +2: 4 db: number of the retrieved partitions on hard disks
810
    at accordingly IDE0,...,IDE3.
803
    at accordingly IDE0,...,IDE3.
811
    If the hard disk on IDEx is absent, appropriate byte is zero,
804
    If the hard disk on IDEx is absent, appropriate byte is zero,
812
    otherwise it shows number of the recognized partitions, which
805
    otherwise it shows number of the recognized partitions, which
813
    can be not presented (if the drive is not formatted or if
806
    can be not presented (if the drive is not formatted or if
814
    the file system is not supported). Current version of the kernel
807
    the file system is not supported). Current version of the kernel
815
    supports only FAT16, FAT32 and NTFS for hard disks.
808
    supports only FAT16, FAT32 and NTFS for hard disks.
816
  * +6: 4 db: reserved
809
  * +6: 4 db: reserved
817
Format of the table: full version:
810
Format of the table: full version:
818
  * +0: 10 db: same as for the short version
811
  * +0: 10 db: same as for the short version
819
  * +10: 100 db: data for the first partition
812
  * +10: 100 db: data for the first partition
820
  * +110: 100 db: data for the second partition
813
  * +110: 100 db: data for the second partition
821
  * ...
814
  * ...
822
  * +10+100*(n-1): 100 db: data for the last partition
815
  * +10+100*(n-1): 100 db: data for the last partition
823
The partitions are located as follows: at first sequentially all
816
The partitions are located as follows: at first sequentially all
824
recoginzed partitions on HD on IDE0 (if present),
817
recoginzed partitions on HD on IDE0 (if present),
825
then on HD on IDE1 (if present) and so on up to IDE3.
818
then on HD on IDE1 (if present) and so on up to IDE3.
826
Format of the information about partition
819
Format of the information about partition
827
(at moment only FAT is supported):
820
(at moment only FAT is supported):
828
  * +0: dword: first physical sector of the partition
821
  * +0: dword: first physical sector of the partition
829
  * +4: dword: last physical sector of the partition
822
  * +4: dword: last physical sector of the partition
830
    (belongs to the partition)
823
    (belongs to the partition)
831
  * +8: byte: file system type:
824
  * +8: byte: file system type:
832
    16=FAT16, 32=FAT32, 1=NTFS
825
    16=FAT16, 32=FAT32, 1=NTFS
833
  * other data are dependent on file system, are modified with
826
  * other data are dependent on file system, are modified with
834
    kernel modifications and therefore are not described
827
    kernel modifications and therefore are not described
835
Remarks:
828
Remarks:
836
  * The short table can be used for obtaining the information about
829
  * The short table can be used for obtaining the information about
837
    available devices.
830
    available devices.
838
 
831
 
839
======================================================================
832
======================================================================
840
========== Function 18, subfunction 13 - get kernel version. =========
833
========== Function 18, subfunction 13 - get kernel version. =========
841
======================================================================
834
======================================================================
842
Parameters:
835
Parameters:
843
  * eax = 18 - function number
836
  * eax = 18 - function number
844
  * ebx = 13 - subfunction number
837
  * ebx = 13 - subfunction number
845
  * ecx = pointer to the buffer (not less than 16 bytes), where
838
  * ecx = pointer to the buffer (not less than 16 bytes), where
846
    the information will be placed
839
    the information will be placed
847
Returned value:
840
Returned value:
848
  * function does not return value
841
  * function does not return value
849
Structure of the buffer:
842
Structure of the buffer:
850
db a,b,c,d for version a.b.c.d
843
db a,b,c,d for version a.b.c.d
851
db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
844
db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
852
db 'name',0 - ASCIIZ-string with the name
845
db 'name',0 - ASCIIZ-string with the name
853
For Kolibri 0.6.4.0 kernel:
846
For Kolibri 0.6.4.0 kernel:
854
db 0,6,4,0
847
db 0,6,4,0
855
db 2
848
db 2
856
db 'Kolibri',0
849
db 'Kolibri',0
857
 
850
 
858
======================================================================
851
======================================================================
859
======= Function 18, subfunction 14 - wait for screen retrace. =======
852
======= Function 18, subfunction 14 - wait for screen retrace. =======
860
======================================================================
853
======================================================================
861
Waits for the beginning of retrace of the scanning ray of the screen
854
Waits for the beginning of retrace of the scanning ray of the screen
862
monitor.
855
monitor.
863
Parameters:
856
Parameters:
864
  * eax = 18 - function number
857
  * eax = 18 - function number
865
  * ebx = 14 - subfunction number
858
  * ebx = 14 - subfunction number
866
Returned value:
859
Returned value:
867
  * eax = 0 as the tag of success
860
  * eax = 0 as the tag of success
868
Remarks:
861
Remarks:
869
  * Function is intended only for active high-efficiency graphics
862
  * Function is intended only for active high-efficiency graphics
870
    applications; is used for smooth output of a graphics.
863
    applications; is used for smooth output of a graphics.
871
 
864
 
872
======================================================================
865
======================================================================
873
== Function 18, subfunction 15 - center mouse cursor on the screen. ==
866
== Function 18, subfunction 15 - center mouse cursor on the screen. ==
874
======================================================================
867
======================================================================
875
Parameters:
868
Parameters:
876
  * eax = 18 - function number
869
  * eax = 18 - function number
877
  * ebx = 15 - subfunction number
870
  * ebx = 15 - subfunction number
878
Returned value:
871
Returned value:
879
  * eax = 0 as the tag of success
872
  * eax = 0 as the tag of success
880
 
873
 
881
======================================================================
874
======================================================================
882
========= Function 18, subfunction 16 - get size of free RAM. ========
875
========= Function 18, subfunction 16 - get size of free RAM. ========
883
======================================================================
876
======================================================================
884
Parameters:
877
Parameters:
885
  * eax = 18 - function number
878
  * eax = 18 - function number
886
  * ebx = 16 - subfunction number
879
  * ebx = 16 - subfunction number
887
Returned value:
880
Returned value:
888
  * eax = size of free memory in kilobytes
881
  * eax = size of free memory in kilobytes
889
 
882
 
890
======================================================================
883
======================================================================
891
======== Function 18, subfunction 17 - get full amount of RAM. =======
884
======== Function 18, subfunction 17 - get full amount of RAM. =======
892
======================================================================
885
======================================================================
893
Parameters:
886
Parameters:
894
  * eax = 18 - function number
887
  * eax = 18 - function number
895
  * ebx = 17 - subfunction number
888
  * ebx = 17 - subfunction number
896
Returned value:
889
Returned value:
897
  * eax = total size of existing memory in kilobytes
890
  * eax = total size of existing memory in kilobytes
898
 
891
 
899
======================================================================
892
======================================================================
900
===================== Function 18, subfunction 18 ====================
893
===================== Function 18, subfunction 18 ====================
901
============= Terminate process/thread by the identifier. ============
894
============= Terminate process/thread by the identifier. ============
902
======================================================================
895
======================================================================
903
Parameters:
896
Parameters:
904
  * eax = 18 - function number
897
  * eax = 18 - function number
905
  * ebx = 18 - subfunction number
898
  * ebx = 18 - subfunction number
906
  * ecx = identifer of process/thread (PID/TID)
899
  * ecx = identifer of process/thread (PID/TID)
907
Returned value:
900
Returned value:
908
  * eax = 0 - success
901
  * eax = 0 - success
909
  * eax = -1 - error (process is not found or is system)
902
  * eax = -1 - error (process is not found or is system)
910
Remarks:
903
Remarks:
911
  * It is impossible to terminate system thread OS/IDLE (identifier
904
  * It is impossible to terminate system thread OS/IDLE (identifier
912
    1), it is possible to terminate any normal process/thread.
905
    1), it is possible to terminate any normal process/thread.
913
  * See also subfunction 2 - terminate
906
  * See also subfunction 2 - terminate
914
    process/thread by given slot.
907
    process/thread by given slot.
915
 
908
 
916
======================================================================
909
======================================================================
917
======== Function 18, subfunction 19 - get/set mouse features. =======
910
======== Function 18, subfunction 19 - get/set mouse features. =======
918
======================================================================
911
======================================================================
919
 
912
 
920
---------------- Subsubfunction 0 - get mouse speed. -----------------
913
---------------- Subsubfunction 0 - get mouse speed. -----------------
921
Parameters:
914
Parameters:
922
  * eax = 18 - function number
915
  * eax = 18 - function number
923
  * ebx = 19 - subfunction number
916
  * ebx = 19 - subfunction number
924
  * ecx = 0 - subsubfunction number
917
  * ecx = 0 - subsubfunction number
925
Returned value:
918
Returned value:
926
  * eax = current mouse speed
919
  * eax = current mouse speed
927
 
920
 
928
---------------- Subsubfunction 1 - set mouse speed. -----------------
921
---------------- Subsubfunction 1 - set mouse speed. -----------------
929
Parameters:
922
Parameters:
930
  * eax = 18 - function number
923
  * eax = 18 - function number
931
  * ebx = 19 - subfunction number
924
  * ebx = 19 - subfunction number
932
  * ecx = 1 - subsubfunction number
925
  * ecx = 1 - subsubfunction number
933
  * edx = new value for speed
926
  * edx = new value for speed
934
Returned value:
927
Returned value:
935
  * function does not return value
928
  * function does not return value
936
 
929
 
937
---------------- Subsubfunction 2 - get mouse delay. -----------------
930
---------------- Subsubfunction 2 - get mouse delay. -----------------
938
Parameters:
931
Parameters:
939
  * eax = 18 - function number
932
  * eax = 18 - function number
940
  * ebx = 19 - subfunction number
933
  * ebx = 19 - subfunction number
941
  * ecx = 2 - subsubfunction number
934
  * ecx = 2 - subsubfunction number
942
Returned value:
935
Returned value:
943
  * eax = current mouse delay
936
  * eax = current mouse delay
944
 
937
 
945
---------------- Subsubfunction 3 - set mouse delay. -----------------
938
---------------- Subsubfunction 3 - set mouse delay. -----------------
946
Parameters:
939
Parameters:
947
  * eax = 18 - function number
940
  * eax = 18 - function number
948
  * ebx = 19 - subfunction number
941
  * ebx = 19 - subfunction number
949
  * ecx = 3 - subsubfunction number
942
  * ecx = 3 - subsubfunction number
950
  * edx = new value for mouse delay
943
  * edx = new value for mouse delay
951
Returned value:
944
Returned value:
952
  * function does not return value
945
  * function does not return value
953
 
946
 
954
----------- Subsubfunction 4 - set mouse pointer position. -----------
947
----------- Subsubfunction 4 - set mouse pointer position. -----------
955
Parameters:
948
Parameters:
956
  * eax = 18 - function number
949
  * eax = 18 - function number
957
  * ebx = 19 - subfunction number
950
  * ebx = 19 - subfunction number
958
  * ecx = 4 - subsubfunction number
951
  * ecx = 4 - subsubfunction number
959
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
952
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
960
Returned value:
953
Returned value:
961
  * function does not return value
954
  * function does not return value
962
Remarks:
955
Remarks:
963
  * It is recommended to set speed of the mouse (in subsubfunction 1)
956
  * It is recommended to set speed of the mouse (in subsubfunction 1)
964
    from 1 up to 9. The installed value is not inspected by the kernel
957
    from 1 up to 9. The installed value is not inspected by the kernel
965
    code, so set it carefully, at incorrect value the cursor
958
    code, so set it carefully, at incorrect value the cursor
966
    can "freeze". Speed of the mouse can be regulated through the
959
    can "freeze". Speed of the mouse can be regulated through the
967
    application SETUP.
960
    application SETUP.
968
  * Recommended delay of the mouse (in subsubfunction 3) = 10. Lower
961
  * Recommended delay of the mouse (in subsubfunction 3) = 10. Lower
969
    value is not handled by COM mice. At the very large values the
962
    value is not handled by COM mice. At the very large values the
970
    movement of the mouse on 1 pixel is impossible and the cursor will
963
    movement of the mouse on 1 pixel is impossible and the cursor will
971
    jump on the value of installed speed (subsubfunction 1). The
964
    jump on the value of installed speed (subsubfunction 1). The
972
    installed value is not inspected by the kernel code.
965
    installed value is not inspected by the kernel code.
973
    Mouse delay can be regulated through the application SETUP.
966
    Mouse delay can be regulated through the application SETUP.
974
  * The subsubfunction 4 does not check the passed value. Before
967
  * The subsubfunction 4 does not check the passed value. Before
975
    its call find out current screen resolution (with function 14)
968
    its call find out current screen resolution (with function 14)
976
    and check that the value of position is inside the limits of the
969
    and check that the value of position is inside the limits of the
977
    screen.
970
    screen.
978
 
971
 
979
======================================================================
972
======================================================================
980
======== Function 18, subfunction 20 - get information on RAM. =======
973
======== Function 18, subfunction 20 - get information on RAM. =======
981
======================================================================
974
======================================================================
982
Parameters:
975
Parameters:
983
  * eax = 18 - function number
976
  * eax = 18 - function number
984
  * ebx = 20 - subfunction number
977
  * ebx = 20 - subfunction number
985
  * ecx = pointer to the buffer for information (36 bytes)
978
  * ecx = pointer to the buffer for information (36 bytes)
986
Returned value:
979
Returned value:
987
  * eax = total size of existing RAM in pages
980
  * eax = total size of existing RAM in pages
988
    or -1 if error has occured
981
    or -1 if error has occured
989
  * buffer pointed to by ecx contains the following information:
982
  * buffer pointed to by ecx contains the following information:
990
    * +0:  dword: total size of existing RAM in pages
983
    * +0:  dword: total size of existing RAM in pages
991
    * +4:  dword: size of free RAM in pages
984
    * +4:  dword: size of free RAM in pages
992
    * +8:  dword: number of page faults (exceptions #PF)
985
    * +8:  dword: number of page faults (exceptions #PF)
993
                 in applications
986
                 in applications
994
    * +12: dword: size of kernel heap in bytes
987
    * +12: dword: size of kernel heap in bytes
995
    * +16: dword: free in kernel heap in bytes
988
    * +16: dword: free in kernel heap in bytes
996
    * +20: dword: total number of memory blocks in kernel heap
989
    * +20: dword: total number of memory blocks in kernel heap
997
    * +24: dword: number of free memory blocks in kernel heap
990
    * +24: dword: number of free memory blocks in kernel heap
998
    * +28: dword: size of maximum free block in kernel heap
991
    * +28: dword: size of maximum free block in kernel heap
999
                 (reserved)
992
                 (reserved)
1000
    * +32: dword: size of maximum allocated block in kernel heap
993
    * +32: dword: size of maximum allocated block in kernel heap
1001
                 (reserved)
994
                 (reserved)
1002
 
995
 
1003
======================================================================
996
======================================================================
1004
==================== Function 20 - MIDI interface. ===================
997
==================== Function 20 - MIDI interface. ===================
1005
======================================================================
998
======================================================================
1006
 
999
 
1007
----------------------- Subfunction 1 - reset ------------------------
1000
----------------------- Subfunction 1 - reset ------------------------
1008
Parameters:
1001
Parameters:
1009
  * eax = 20 - function number
1002
  * eax = 20 - function number
1010
  * ebx = 1 - subfunction number
1003
  * ebx = 1 - subfunction number
1011
 
1004
 
1012
-------------------- Subfunction 2 - output byte ---------------------
1005
-------------------- Subfunction 2 - output byte ---------------------
1013
Parameters:
1006
Parameters:
1014
  * eax = 20 - function number
1007
  * eax = 20 - function number
1015
  * ebx = 2 - subfunction number
1008
  * ebx = 2 - subfunction number
1016
  * cl = byte for output
1009
  * cl = byte for output
1017
Returned value (is the same for both subfunctions):
1010
Returned value (is the same for both subfunctions):
1018
  * eax = 0 - success
1011
  * eax = 0 - success
1019
  * eax = 1 - base port is not defined
1012
  * eax = 1 - base port is not defined
1020
Remarks:
1013
Remarks:
1021
  * Previously the base port must be defined by 
1014
  * Previously the base port must be defined by 
1022
    subfunction 1 of function 21.
1015
    subfunction 1 of function 21.
1023
 
1016
 
1024
======================================================================
1017
======================================================================
1025
======== Function 21, subfunction 1 - set MPU MIDI base port. ========
1018
======== Function 21, subfunction 1 - set MPU MIDI base port. ========
1026
======================================================================
1019
======================================================================
1027
Parameters:
1020
Parameters:
1028
  * eax = 21 - function number
1021
  * eax = 21 - function number
1029
  * ebx = 1 - subfunction number
1022
  * ebx = 1 - subfunction number
1030
  * ecx = number of base port
1023
  * ecx = number of base port
1031
Returned value
1024
Returned value
1032
  * eax = 0 - success
1025
  * eax = 0 - success
1033
  * eax = -1 - erratic number of a port
1026
  * eax = -1 - erratic number of a port
1034
Remarks:
1027
Remarks:
1035
  * Number of a port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1028
  * Number of a port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1036
  * The installation of base is necessary for function 20.
1029
  * The installation of base is necessary for function 20.
1037
  * To get base port use subfunction 1 of function 26.
1030
  * To get base port use subfunction 1 of function 26.
1038
 
1031
 
1039
======================================================================
1032
======================================================================
1040
========== Function 21, subfunction 2 - set keyboard layout. =========
1033
========== Function 21, subfunction 2 - set keyboard layout. =========
1041
======================================================================
1034
======================================================================
1042
Keyboard layout is used to convert keyboard scancodes to ASCII-codes,
1035
Keyboard layout is used to convert keyboard scancodes to ASCII-codes,
1043
which will be read by function 2.
1036
which will be read by function 2.
1044
Parameters:
1037
Parameters:
1045
  * eax = 21 - function number
1038
  * eax = 21 - function number
1046
  * ebx = 2 - subfunction number
1039
  * ebx = 2 - subfunction number
1047
  * ecx = which layout to set:
1040
  * ecx = which layout to set:
1048
    * 1 = normal layout
1041
    * 1 = normal layout
1049
    * 2 = layout at pressed Shift
1042
    * 2 = layout at pressed Shift
1050
    * 3 = layout at pressed Alt
1043
    * 3 = layout at pressed Alt
1051
  * edx = pointer to layout - table of length 128 bytes
1044
  * edx = pointer to layout - table of length 128 bytes
1052
Or:
1045
Or:
1053
  * ecx = 9
1046
  * ecx = 9
1054
  * dx = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1047
  * dx = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1055
Returned value:
1048
Returned value:
1056
  * eax = 0 - success
1049
  * eax = 0 - success
1057
  * eax = 1 - incorrect parameter
1050
  * eax = 1 - incorrect parameter
1058
Remarks:
1051
Remarks:
1059
  * If Alt is pressed, the layout with Alt is used;
1052
  * If Alt is pressed, the layout with Alt is used;
1060
    if Alt is not pressed, but Shift is pressed,
1053
    if Alt is not pressed, but Shift is pressed,
1061
    the layout with Shift is used;
1054
    the layout with Shift is used;
1062
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1055
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1063
    layout is used and then from the code is subtracted 0x60;
1056
    layout is used and then from the code is subtracted 0x60;
1064
    if no control key is pressed, the normal layout is used.
1057
    if no control key is pressed, the normal layout is used.
1065
  * To get layout and country identifier use 
1058
  * To get layout and country identifier use 
1066
    subfunction 2 of function 26.
1059
    subfunction 2 of function 26.
1067
  * Country identifier is global system variable, which is not used
1060
  * Country identifier is global system variable, which is not used
1068
    by the kernel itself; however the application '@panel' displays
1061
    by the kernel itself; however the application '@panel' displays
1069
    the corresponding icon.
1062
    the corresponding icon.
1070
  * The application @panel switches layouts on user request.
1063
  * The application @panel switches layouts on user request.
1071
 
1064
 
1072
======================================================================
1065
======================================================================
1073
============== Function 21, subfunction 3 - set CD base. =============
1066
============== Function 21, subfunction 3 - set CD base. =============
1074
======================================================================
1067
======================================================================
1075
Parameters:
1068
Parameters:
1076
  * eax = 21 - function number
1069
  * eax = 21 - function number
1077
  * ebx = 3 - subfunction number
1070
  * ebx = 3 - subfunction number
1078
  * ecx = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1071
  * ecx = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1079
Returned value:
1072
Returned value:
1080
  * eax = 0
1073
  * eax = 0
1081
Remarks:
1074
Remarks:
1082
  * CD base is used by function 24.
1075
  * CD base is used by function 24.
1083
  * To get CD base use subfunction 3 of function 26.
1076
  * To get CD base use subfunction 3 of function 26.
1084
 
1077
 
1085
======================================================================
1078
======================================================================
1086
====== Function 21, subfunction 4 - set Sound Blaster base port. =====
1079
====== Function 21, subfunction 4 - set Sound Blaster base port. =====
1087
======================================================================
1080
======================================================================
1088
Parameters:
1081
Parameters:
1089
  * eax = 21 - function number
1082
  * eax = 21 - function number
1090
  * ebx = 4 - subfunction number
1083
  * ebx = 4 - subfunction number
1091
  * ecx = number of the base port
1084
  * ecx = number of the base port
1092
Returned value:
1085
Returned value:
1093
  * eax = 0 - success
1086
  * eax = 0 - success
1094
  * eax = -1 - erratic port number
1087
  * eax = -1 - erratic port number
1095
Remarks:
1088
Remarks:
1096
  * Number of the port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1089
  * Number of the port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1097
  * The installation of the base is necessary for
1090
  * The installation of the base is necessary for
1098
    functions 25, 28, 55.
1091
    functions 25, 28, 55.
1099
  * To get base port use subfunction 4 of function 26.
1092
  * To get base port use subfunction 4 of function 26.
1100
 
1093
 
1101
======================================================================
1094
======================================================================
1102
========== Function 21, subfunction 5 - set system language. =========
1095
========== Function 21, subfunction 5 - set system language. =========
1103
======================================================================
1096
======================================================================
1104
Parameters:
1097
Parameters:
1105
  * eax = 21 - function number
1098
  * eax = 21 - function number
1106
  * ebx = 5 - subfunction number
1099
  * ebx = 5 - subfunction number
1107
  * ecx = system language (1=eng, 2=fi, 3=ger, 4=rus)
1100
  * ecx = system language (1=eng, 2=fi, 3=ger, 4=rus)
1108
Returned value:
1101
Returned value:
1109
  * eax = 0
1102
  * eax = 0
1110
Remarks:
1103
Remarks:
1111
  * System language is global system variable and is not used
1104
  * System language is global system variable and is not used
1112
    by the kernel itself, however application @panel draws the
1105
    by the kernel itself, however application @panel draws the
1113
    appropriate icon.
1106
    appropriate icon.
1114
  * Function does not check for correctness, as the kernel does not
1107
  * Function does not check for correctness, as the kernel does not
1115
    use this variable.
1108
    use this variable.
1116
  * To get system language use subfunction 5 of function 26.
1109
  * To get system language use subfunction 5 of function 26.
1117
 
1110
 
1118
======================================================================
1111
======================================================================
1119
============== Function 21, subfunction 7 - set HD base. =============
1112
============== Function 21, subfunction 7 - set HD base. =============
1120
======================================================================
1113
======================================================================
1121
The HD base defines hard disk to write with usage of obsolete
1114
The HD base defines hard disk to write with usage of obsolete
1122
file system functions and functions implicitly using the hard disk
1115
file system functions and functions implicitly using the hard disk
1123
(such as subfunction 6 of function 18);
1116
(such as subfunction 6 of function 18);
1124
at usage of function 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1117
at usage of function 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1125
these function set base themselves.
1118
these function set base themselves.
1126
Parameters:
1119
Parameters:
1127
  * eax = 21 - function number
1120
  * eax = 21 - function number
1128
  * ebx = 7 - subfunction number
1121
  * ebx = 7 - subfunction number
1129
  * ecx = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1122
  * ecx = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1130
Returned value:
1123
Returned value:
1131
  * eax = 0
1124
  * eax = 0
1132
Remarks:
1125
Remarks:
1133
  * Any application at any time can change the base.
1126
  * Any application at any time can change the base.
1134
  * Do not change base, when any application works with hard disk.
1127
  * Do not change base, when any application works with hard disk.
1135
    If you do not want system bugs.
1128
    If you do not want system bugs.
1136
  * To get HD base use subfunction 7 of function 26.
1129
  * To get HD base use subfunction 7 of function 26.
1137
  * It is also necessary to define used partition of hard disk by 
1130
  * It is also necessary to define used partition of hard disk by 
1138
    subfunction 8.
1131
    subfunction 8.
1139
 
1132
 
1140
======================================================================
1133
======================================================================
1141
========= Function 21, subfunction 8 - set used HD partition. ========
1134
========= Function 21, subfunction 8 - set used HD partition. ========
1142
======================================================================
1135
======================================================================
1143
The HD partition defines partition of the hard disk to write with
1136
The HD partition defines partition of the hard disk to write with
1144
usage of obsolete file system functions and functions implicitly
1137
usage of obsolete file system functions and functions implicitly
1145
using the hard disk (such as subfunction 6 of function 18);
1138
using the hard disk (such as subfunction 6 of function 18);
1146
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1139
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1147
these functions set base and partition themselves.
1140
these functions set base and partition themselves.
1148
Parameters:
1141
Parameters:
1149
  * eax = 21 - function number
1142
  * eax = 21 - function number
1150
  * ebx = 8 - subfunction number
1143
  * ebx = 8 - subfunction number
1151
  * ecx = HD partition (beginning from 1)
1144
  * ecx = HD partition (beginning from 1)
1152
Return value:
1145
Return value:
1153
  * eax = 0
1146
  * eax = 0
1154
Remarks:
1147
Remarks:
1155
  * Any application at any time can change partition.
1148
  * Any application at any time can change partition.
1156
  * Do not change partition when any application works with hard disk.
1149
  * Do not change partition when any application works with hard disk.
1157
    If you do not want system bugs.
1150
    If you do not want system bugs.
1158
  * To get used partition use subfunction 8 of function 26.
1151
  * To get used partition use subfunction 8 of function 26.
1159
  * There is no correctness checks.
1152
  * There is no correctness checks.
1160
  * To get the number of partitions of a hard disk use 
1153
  * To get the number of partitions of a hard disk use 
1161
    subfunction 11 of function 18.
1154
    subfunction 11 of function 18.
1162
  * It is also necessary to define used HD base by subfunction 7.
1155
  * It is also necessary to define used HD base by subfunction 7.
1163
 
1156
 
1164
======================================================================
1157
======================================================================
1165
======== Function 21, subfunction 10 - set sound DMA channel. ========
1158
======== Function 21, subfunction 10 - set sound DMA channel. ========
1166
======================================================================
1159
======================================================================
1167
Parameters:
1160
Parameters:
1168
  * eax = 21 - function number
1161
  * eax = 21 - function number
1169
  * ebx = 10 - subfunction number
1162
  * ebx = 10 - subfunction number
1170
  * ecx = number of channel (from 0 up to 3 inclusively)
1163
  * ecx = number of channel (from 0 up to 3 inclusively)
1171
Returned value:
1164
Returned value:
1172
  * eax = 0 - success
1165
  * eax = 0 - success
1173
  * eax = -1 - incorrect channel number
1166
  * eax = -1 - incorrect channel number
1174
Remarks:
1167
Remarks:
1175
  * Number of DMA channel is used in subfunction 1 of function 55.
1168
  * Number of DMA channel is used in subfunction 1 of function 55.
1176
  * To get sound DMA channel use subfunction 10 of function 26.
1169
  * To get sound DMA channel use subfunction 10 of function 26.
1177
 
1170
 
1178
======================================================================
1171
======================================================================
1179
 Function 21, subfunction 11 - enable/disable low-level access to HD. 
1172
 Function 21, subfunction 11 - enable/disable low-level access to HD. 
1180
======================================================================
1173
======================================================================
1181
Parameters:
1174
Parameters:
1182
  * eax = 21 - function number
1175
  * eax = 21 - function number
1183
  * ebx = 11 - subfunction number
1176
  * ebx = 11 - subfunction number
1184
  * ecx = 0/1 - disable/enable
1177
  * ecx = 0/1 - disable/enable
1185
Returned value:
1178
Returned value:
1186
  * eax = 0
1179
  * eax = 0
1187
Remarks:
1180
Remarks:
1188
  * Is used in LBA-read (subfunction 8 of function 58).
1181
  * Is used in LBA-read (subfunction 8 of function 58).
1189
  * The current implementation uses only low bit of ecx.
1182
  * The current implementation uses only low bit of ecx.
1190
  * To get current status use subfunction 11 of function 26.
1183
  * To get current status use subfunction 11 of function 26.
1191
 
1184
 
1192
======================================================================
1185
======================================================================
1193
 Function 21, subfunction 12 - enable/disable low-level access to PCI. 
1186
 Function 21, subfunction 12 - enable/disable low-level access to PCI. 
1194
======================================================================
1187
======================================================================
1195
Parameters:
1188
Parameters:
1196
  * eax = 21 - function number
1189
  * eax = 21 - function number
1197
  * ebx = 12 - subfunction number
1190
  * ebx = 12 - subfunction number
1198
  * ecx = 0/1 - disable/enable
1191
  * ecx = 0/1 - disable/enable
1199
Returned value:
1192
Returned value:
1200
  * eax = 0
1193
  * eax = 0
1201
Remarks:
1194
Remarks:
1202
  * Is used in operations with PCI bus (function 62).
1195
  * Is used in operations with PCI bus (function 62).
1203
  * The current implementation uses only low bit of ecx.
1196
  * The current implementation uses only low bit of ecx.
1204
  * To get current status use subfunction 12 of function 26.
1197
  * To get current status use subfunction 12 of function 26.
1205
 
1198
 
1206
======================================================================
1199
======================================================================
1207
============ Function 21, subfunction 13, subsubfunction 1 ===========
1200
============ Function 21, subfunction 13, subsubfunction 1 ===========
1208
======== Initialize + get information on the driver vmode.mdr. =======
1201
======== Initialize + get information on the driver vmode.mdr. =======
1209
======================================================================
1202
======================================================================
1210
Parameters:
1203
Parameters:
1211
  * eax = 21 - function number
1204
  * eax = 21 - function number
1212
  * ebx = 13 - subfunction number
1205
  * ebx = 13 - subfunction number
1213
  * ecx = 1 - number of the driver function
1206
  * ecx = 1 - number of the driver function
1214
  * edx = pointer to 512-bytes buffer
1207
  * edx = pointer to 512-bytes buffer
1215
Returned value:
1208
Returned value:
1216
  * if driver is not loaded
1209
  * if driver is not loaded
1217
    (never happens in the current implementation):
1210
    (never happens in the current implementation):
1218
    * eax = -1
1211
    * eax = -1
1219
    * ebx, ecx destroyed
1212
    * ebx, ecx destroyed
1220
  * if driver is loaded:
1213
  * if driver is loaded:
1221
    * eax = 'MDAZ' (in fasm style, that is 'M' - low byte, 'Z' - high)
1214
    * eax = 'MDAZ' (in fasm style, that is 'M' - low byte, 'Z' - high)
1222
      - signature
1215
      - signature
1223
    * ebx = current frequency of the scanning (in Hz)
1216
    * ebx = current frequency of the scanning (in Hz)
1224
    * ecx destroyed
1217
    * ecx destroyed
1225
    * buffer pointed to by edx is filled
1218
    * buffer pointed to by edx is filled
1226
Format of the buffer:
1219
Format of the buffer:
1227
  * +0: 32*byte: driver name, "Trans VideoDriver"
1220
  * +0: 32*byte: driver name, "Trans VideoDriver"
1228
    (without quotes, supplemented by spaces)
1221
    (without quotes, supplemented by spaces)
1229
  * +32 = +0x20: dword: driver version (version x.y is encoded as
1222
  * +32 = +0x20: dword: driver version (version x.y is encoded as
1230
    y*65536+x), for the current implementation is 1 (1.0)
1223
    y*65536+x), for the current implementation is 1 (1.0)
1231
  * +36 = +0x24: 7*dword: reserved (0 in the current implementation)
1224
  * +36 = +0x24: 7*dword: reserved (0 in the current implementation)
1232
  * +64 = +0x40: 32*word: list of supported videomodes (each word
1225
  * +64 = +0x40: 32*word: list of supported videomodes (each word
1233
    is number of a videomode, after list itself there are zeroes)
1226
    is number of a videomode, after list itself there are zeroes)
1234
  * +128 = +0x80: 32*(5*word): list of supported frequences of the
1227
  * +128 = +0x80: 32*(5*word): list of supported frequences of the
1235
    scannings for videomodes: for each videomode listed in the
1228
    scannings for videomodes: for each videomode listed in the
1236
    previous field up to 5 supported frequences are given
1229
    previous field up to 5 supported frequences are given
1237
    (unused positions contain zeroes)
1230
    (unused positions contain zeroes)
1238
Remarks:
1231
Remarks:
1239
  * Function initializes the driver (if it is not initialized yet)
1232
  * Function initializes the driver (if it is not initialized yet)
1240
    and must be called first, before others (otherwise they will do
1233
    and must be called first, before others (otherwise they will do
1241
    nothing and return -1).
1234
    nothing and return -1).
1242
  * The current implementation supports only one frequency
1235
  * The current implementation supports only one frequency
1243
    of the scanning on videomode.
1236
    of the scanning on videomode.
1244
 
1237
 
1245
======================================================================
1238
======================================================================
1246
============ Function 21, subfunction 13, subsubfunction 2 ===========
1239
============ Function 21, subfunction 13, subsubfunction 2 ===========
1247
================ Get information on current videomode. ===============
1240
================ Get information on current videomode. ===============
1248
======================================================================
1241
======================================================================
1249
Parameters:
1242
Parameters:
1250
  * eax = 21 - function number
1243
  * eax = 21 - function number
1251
  * ebx = 13 - subfunction number
1244
  * ebx = 13 - subfunction number
1252
  * ecx = 2 - number of the driver function
1245
  * ecx = 2 - number of the driver function
1253
Returned value:
1246
Returned value:
1254
  * eax = -1 - driver is not loaded or not initialized;
1247
  * eax = -1 - driver is not loaded or not initialized;
1255
    ebx,ecx are destroyed
1248
    ebx,ecx are destroyed
1256
  * eax = [width]*65536 + [height]
1249
  * eax = [width]*65536 + [height]
1257
  * ebx = frequency of the vertical scanning (in Hz)
1250
  * ebx = frequency of the vertical scanning (in Hz)
1258
  * ecx = number of current videomode
1251
  * ecx = number of current videomode
1259
Remarks:
1252
Remarks:
1260
  * Driver must be initialized by call to 
1253
  * Driver must be initialized by call to 
1261
    driver function 1.
1254
    driver function 1.
1262
  * If only screen sizes are required, it is more expedient to use
1255
  * If only screen sizes are required, it is more expedient to use
1263
    function 14 taking into account that it
1256
    function 14 taking into account that it
1264
    returns sizes on 1 less.
1257
    returns sizes on 1 less.
1265
 
1258
 
1266
======================================================================
1259
======================================================================
1267
=== Function 21, subfunction 13, subsubfunction 3 - set videomode. ===
1260
=== Function 21, subfunction 13, subsubfunction 3 - set videomode. ===
1268
======================================================================
1261
======================================================================
1269
Parameters:
1262
Parameters:
1270
  * eax = 21 - function number
1263
  * eax = 21 - function number
1271
  * ebx = 13 - subfunction number
1264
  * ebx = 13 - subfunction number
1272
  * ecx = 3 - number of the driver function
1265
  * ecx = 3 - number of the driver function
1273
  * edx = [scanning frequency]*65536 + [videomode number]
1266
  * edx = [scanning frequency]*65536 + [videomode number]
1274
Returned value:
1267
Returned value:
1275
  * eax = -1 - driver is not loaded, not initialized or
1268
  * eax = -1 - driver is not loaded, not initialized or
1276
    an error has occured
1269
    an error has occured
1277
  * eax = 0 - success
1270
  * eax = 0 - success
1278
  * ebx, ecx destroyed
1271
  * ebx, ecx destroyed
1279
Remarks:
1272
Remarks:
1280
  * Driver must be initialized by driver function 1.
1273
  * Driver must be initialized by driver function 1.
1281
  * The videomode number and frequency must be in the table
1274
  * The videomode number and frequency must be in the table
1282
    returned by driver function 1.
1275
    returned by driver function 1.
1283
 
1276
 
1284
======================================================================
1277
======================================================================
1285
============ Function 21, subfunction 13, subsubfunction 4 ===========
1278
============ Function 21, subfunction 13, subsubfunction 4 ===========
1286
================== Return to the initial videomode. ==================
1279
================== Return to the initial videomode. ==================
1287
======================================================================
1280
======================================================================
1288
Returns the screen to the videomode set at system boot.
1281
Returns the screen to the videomode set at system boot.
1289
Parameters:
1282
Parameters:
1290
  * eax = 21 - function number
1283
  * eax = 21 - function number
1291
  * ebx = 13 - subfunction number
1284
  * ebx = 13 - subfunction number
1292
  * ecx = 4 - number of the driver function
1285
  * ecx = 4 - number of the driver function
1293
Returned value:
1286
Returned value:
1294
  * eax = -1 - driver is not loaded or not initialized
1287
  * eax = -1 - driver is not loaded or not initialized
1295
  * eax = 0 - success
1288
  * eax = 0 - success
1296
  * ebx, ecx destroyed
1289
  * ebx, ecx destroyed
1297
Remarks:
1290
Remarks:
1298
  * Driver must be initialized by call to driver function 1.
1291
  * Driver must be initialized by call to driver function 1.
1299
 
1292
 
1300
======================================================================
1293
======================================================================
1301
============ Function 21, subfunction 13, subsubfunction 5 ===========
1294
============ Function 21, subfunction 13, subsubfunction 5 ===========
1302
===== Increase/decrease the size of the visible area of monitor. =====
1295
===== Increase/decrease the size of the visible area of monitor. =====
1303
======================================================================
1296
======================================================================
1304
Parameters:
1297
Parameters:
1305
  * eax = 21 - function number
1298
  * eax = 21 - function number
1306
  * ebx = 13 - subfunction number
1299
  * ebx = 13 - subfunction number
1307
  * ecx = 5 - number of the driver function
1300
  * ecx = 5 - number of the driver function
1308
  * edx = 0/1 - decrease/increase horizontal size on 1 position
1301
  * edx = 0/1 - decrease/increase horizontal size on 1 position
1309
  * edx = 2/3 - is not supported in the current implementation;
1302
  * edx = 2/3 - is not supported in the current implementation;
1310
    is planned as decrease/increase vertical size on 1 position
1303
    is planned as decrease/increase vertical size on 1 position
1311
Returned value:
1304
Returned value:
1312
  * eax = -1 - driver is not loaded or not initialized
1305
  * eax = -1 - driver is not loaded or not initialized
1313
  * eax = 0 - success
1306
  * eax = 0 - success
1314
  * ebx, ecx destroyed
1307
  * ebx, ecx destroyed
1315
Remarks:
1308
Remarks:
1316
  * Driver must be initialized by call to driver function 1.
1309
  * Driver must be initialized by call to driver function 1.
1317
  * Function influences only the physical size of the screen image;
1310
  * Function influences only the physical size of the screen image;
1318
    the logical size (number of pixels) does not change.
1311
    the logical size (number of pixels) does not change.
1319
 
1312
 
1320
======================================================================
1313
======================================================================
1321
================= Function 22 - set system date/time. ================
1314
================= Function 22 - set system date/time. ================
1322
======================================================================
1315
======================================================================
1323
Parameters:
1316
Parameters:
1324
  * eax = 22 - function number
1317
  * eax = 22 - function number
1325
  * ebx = 0 - set time
1318
  * ebx = 0 - set time
1326
    * ecx = 0x00SSMMHH - time in the binary-decimal code (BCD):
1319
    * ecx = 0x00SSMMHH - time in the binary-decimal code (BCD):
1327
    * HH=hour 00..23
1320
    * HH=hour 00..23
1328
    * MM=minute 00..59
1321
    * MM=minute 00..59
1329
    * SS=second 00..59
1322
    * SS=second 00..59
1330
  * ebx = 1 - set date
1323
  * ebx = 1 - set date
1331
    * ecx = 0x00DDMMYY - date in the binary-decimal code (BCD):
1324
    * ecx = 0x00DDMMYY - date in the binary-decimal code (BCD):
1332
    * DD=day 01..31
1325
    * DD=day 01..31
1333
    * MM=month 01..12
1326
    * MM=month 01..12
1334
    * YY=year 00..99
1327
    * YY=year 00..99
1335
  * ebx = 2 - set day of week
1328
  * ebx = 2 - set day of week
1336
    * ecx = 1 for Sunday, ..., 7 for Saturday
1329
    * ecx = 1 for Sunday, ..., 7 for Saturday
1337
  * ebx = 3 - set alarm clock
1330
  * ebx = 3 - set alarm clock
1338
    * ecx = 0x00SSMMHH
1331
    * ecx = 0x00SSMMHH
1339
Returned value:
1332
Returned value:
1340
  * eax = 0 - success
1333
  * eax = 0 - success
1341
  * eax = 1 - incorrect parameter
1334
  * eax = 1 - incorrect parameter
1342
  * eax = 2 - CMOS-battery was unloaded
1335
  * eax = 2 - CMOS-battery was unloaded
1343
Remarks:
1336
Remarks:
1344
  * Value of installation of day of week seems to be doubtful,
1337
  * Value of installation of day of week seems to be doubtful,
1345
    as it a little where is used
1338
    as it a little where is used
1346
    (day of week can be calculated by date).
1339
    (day of week can be calculated by date).
1347
  * Alarm clock can be set on operation in the given time every day.
1340
  * Alarm clock can be set on operation in the given time every day.
1348
    But there is no existing system function to disable it.
1341
    But there is no existing system function to disable it.
1349
  * Operation of alarm clock consists in generation IRQ8.
1342
  * Operation of alarm clock consists in generation IRQ8.
1350
  * Generally CMOS supports for alarm clock set of value 0xFF
1343
  * Generally CMOS supports for alarm clock set of value 0xFF
1351
    as one of parameters and it means that the appropriate parameter
1344
    as one of parameters and it means that the appropriate parameter
1352
    is ignored. But current implementation does not allow this
1345
    is ignored. But current implementation does not allow this
1353
    (will return 1).
1346
    (will return 1).
1354
  * Alarm clock is a global system resource; the set of
1347
  * Alarm clock is a global system resource; the set of
1355
    an alarm clock cancels automatically the previous set.
1348
    an alarm clock cancels automatically the previous set.
1356
    However, at moment no program uses it.
1349
    However, at moment no program uses it.
1357
 
1350
 
1358
======================================================================
1351
======================================================================
1359
============= Function 23 - wait for event with timeout. =============
1352
============= Function 23 - wait for event with timeout. =============
1360
======================================================================
1353
======================================================================
1361
If the message queue is empty, waits for new message in the queue,
1354
If the message queue is empty, waits for new message in the queue,
1362
but no more than given time. Then reads out a message from the queue.
1355
but no more than given time. Then reads out a message from the queue.
1363
 
1356
 
1364
Parameters:
1357
Parameters:
1365
  * eax = 23 - function number
1358
  * eax = 23 - function number
1366
  * ebx = timeout (in 1/100 of second)
1359
  * ebx = timeout (in 1/100 of second)
1367
Returned value:
1360
Returned value:
1368
  * eax = 0 - the message queue is empty
1361
  * eax = 0 - the message queue is empty
1369
  * otherwise eax = event (see the list of events)
1362
  * otherwise eax = event (see the list of events)
1370
Remarks:
1363
Remarks:
1371
  * Only those events are taken into account, which enter into
1364
  * Only those events are taken into account, which enter into
1372
    the mask set by function 40. By default it is
1365
    the mask set by function 40. By default it is
1373
    redraw, key and button events.
1366
    redraw, key and button events.
1374
  * To check for presence of a message in the queue use function 11.
1367
  * To check for presence of a message in the queue use function 11.
1375
    To wait without timeout use function 10.
1368
    To wait without timeout use function 10.
1376
  * Transmission ebx=0 results in immediate returning eax=0.
1369
  * Transmission ebx=0 results in immediate returning eax=0.
1377
  * Current implementation returns immediately with eax=0,
1370
  * Current implementation returns immediately with eax=0,
1378
    if the addition of ebx with the current value of time counter
1371
    if the addition of ebx with the current value of time counter
1379
    makes 32-bit overflow.
1372
    makes 32-bit overflow.
1380
 
1373
 
1381
======================================================================
1374
======================================================================
1382
======== Function 24, subfunction 1 - begin to play CD-audio. ========
1375
======== Function 24, subfunction 1 - begin to play CD-audio. ========
1383
======================================================================
1376
======================================================================
1384
Parameters:
1377
Parameters:
1385
  * eax = 24 - function number
1378
  * eax = 24 - function number
1386
  * ebx = 1 - subfunction number
1379
  * ebx = 1 - subfunction number
1387
  * ecx = 0x00FRSSMM, where
1380
  * ecx = 0x00FRSSMM, where
1388
    * MM = starting minute
1381
    * MM = starting minute
1389
    * SS = starting second
1382
    * SS = starting second
1390
    * FR = starting frame
1383
    * FR = starting frame
1391
Returned value:
1384
Returned value:
1392
  * eax = 0 - success
1385
  * eax = 0 - success
1393
  * eax = 1 - CD base is not defined
1386
  * eax = 1 - CD base is not defined
1394
Remarks:
1387
Remarks:
1395
  * Previously CD base must be defined by the call to 
1388
  * Previously CD base must be defined by the call to 
1396
    subfunction 3 of function 21.
1389
    subfunction 3 of function 21.
1397
  * One second includes 75 frames, one minute includes 60 seconds.
1390
  * One second includes 75 frames, one minute includes 60 seconds.
1398
  * The function is asynchronous (returns control, when play begins).
1391
  * The function is asynchronous (returns control, when play begins).
1399
 
1392
 
1400
======================================================================
1393
======================================================================
1401
======= Function 24, subfunction 2 - get information on tracks. ======
1394
======= Function 24, subfunction 2 - get information on tracks. ======
1402
======================================================================
1395
======================================================================
1403
Parameters:
1396
Parameters:
1404
  * eax = 24 - function number
1397
  * eax = 24 - function number
1405
  * ebx = 2 - subfunction number
1398
  * ebx = 2 - subfunction number
1406
  * ecx = pointer to the buffer for the table
1399
  * ecx = pointer to the buffer for the table
1407
    (maximum 8*64h+4 bytes=100 tracks)
1400
    (maximum 8*64h+4 bytes=100 tracks)
1408
Returned value:
1401
Returned value:
1409
  * eax = 0 - success
1402
  * eax = 0 - success
1410
  * eax = 1 - CD base is not defined
1403
  * eax = 1 - CD base is not defined
1411
Remarks:
1404
Remarks:
1412
  * The format of the table with tracks information is the same as
1405
  * The format of the table with tracks information is the same as
1413
    for ATAPI-CD command 43h (READ TOC), usual table (subcommand 00h).
1406
    for ATAPI-CD command 43h (READ TOC), usual table (subcommand 00h).
1414
    Function returns addresses in MSF.
1407
    Function returns addresses in MSF.
1415
  * Previously CD base port must be set by call to 
1408
  * Previously CD base port must be set by call to 
1416
    subfunction 3 of function 21.
1409
    subfunction 3 of function 21.
1417
  * Function returns information only about no more than 100
1410
  * Function returns information only about no more than 100
1418
    first tracks. In most cases it is enough.
1411
    first tracks. In most cases it is enough.
1419
 
1412
 
1420
======================================================================
1413
======================================================================
1421
========== Function 24, subfunction 3 - stop play CD-audio. ==========
1414
========== Function 24, subfunction 3 - stop play CD-audio. ==========
1422
======================================================================
1415
======================================================================
1423
Parameters:
1416
Parameters:
1424
  * eax = 24 - function number
1417
  * eax = 24 - function number
1425
  * ebx = 1 - subfunction number
1418
  * ebx = 1 - subfunction number
1426
Returned value:
1419
Returned value:
1427
  * eax = 0 - success
1420
  * eax = 0 - success
1428
  * eax = 1 - CD base is not defined
1421
  * eax = 1 - CD base is not defined
1429
Çàìå÷àíèÿ:
1422
Çàìå÷àíèÿ:
1430
  * Previously CD base port must be defined by call to 
1423
  * Previously CD base port must be defined by call to 
1431
    subfunction 3 of function 21.
1424
    subfunction 3 of function 21.
1432
 
1425
 
1433
======================================================================
1426
======================================================================
1434
=================== Function 25 - set SBPro volume. ==================
1427
=================== Function 25 - set SBPro volume. ==================
1435
======================================================================
1428
======================================================================
1436
Parameters:
1429
Parameters:
1437
  * eax = 25 - function number
1430
  * eax = 25 - function number
1438
  * ebx = what to set:
1431
  * ebx = what to set:
1439
    * 1 - set common volume
1432
    * 1 - set common volume
1440
    * 2 - set CD-audio volume
1433
    * 2 - set CD-audio volume
1441
  * cl = volume level: high 4 bits for the left column,
1434
  * cl = volume level: high 4 bits for the left column,
1442
    low 4 bits for the right one
1435
    low 4 bits for the right one
1443
Returned value:
1436
Returned value:
1444
  * eax = 0 - success
1437
  * eax = 0 - success
1445
  * eax = 1 - SB base is not defined
1438
  * eax = 1 - SB base is not defined
1446
  * eax = 2 - incorrect subfunction
1439
  * eax = 2 - incorrect subfunction
1447
Remarks:
1440
Remarks:
1448
  * Previously SB base port must be defined by 
1441
  * Previously SB base port must be defined by 
1449
    subfunction 4 of function 21.
1442
    subfunction 4 of function 21.
1450
  * See also function 28 which sets
1443
  * See also function 28 which sets
1451
    volume for the later standard SB16.
1444
    volume for the later standard SB16.
1452
 
1445
 
1453
======================================================================
1446
======================================================================
1454
======== Function 26, subfunction 1 - get MPU MIDI base port. ========
1447
======== Function 26, subfunction 1 - get MPU MIDI base port. ========
1455
======================================================================
1448
======================================================================
1456
Parameters:
1449
Parameters:
1457
  * eax = 26 - function number
1450
  * eax = 26 - function number
1458
  * ebx = 1 - subfunction number
1451
  * ebx = 1 - subfunction number
1459
Returned value:
1452
Returned value:
1460
  * eax = port number
1453
  * eax = port number
1461
Parameters:
1454
Parameters:
1462
  * To set base port use subfunction 1 of function 21.
1455
  * To set base port use subfunction 1 of function 21.
1463
 
1456
 
1464
======================================================================
1457
======================================================================
1465
========== Function 26, subfunction 2 - get keyboard layout. =========
1458
========== Function 26, subfunction 2 - get keyboard layout. =========
1466
======================================================================
1459
======================================================================
1467
The keyboard layout is used to convert keyboard scancodes to
1460
The keyboard layout is used to convert keyboard scancodes to
1468
ASCII-codes for function 2.
1461
ASCII-codes for function 2.
1469
Parameters:
1462
Parameters:
1470
  * eax = 26 - function number
1463
  * eax = 26 - function number
1471
  * ebx = 2 - subfunction number
1464
  * ebx = 2 - subfunction number
1472
  * ecx = what layout to get:
1465
  * ecx = what layout to get:
1473
    * 1 = normal layout
1466
    * 1 = normal layout
1474
    * 2 = layout with pressed Shift
1467
    * 2 = layout with pressed Shift
1475
    * 3 = layout with pressed Alt
1468
    * 3 = layout with pressed Alt
1476
  * edx = pointer to the 128-bytes buffer, where the layout will be
1469
  * edx = pointer to the 128-bytes buffer, where the layout will be
1477
    copied
1470
    copied
1478
Returned value:
1471
Returned value:
1479
  * function does not return value
1472
  * function does not return value
1480
Or:
1473
Or:
1481
  * eax = 26 - function number
1474
  * eax = 26 - function number
1482
  * ebx = 2 - subfunction number
1475
  * ebx = 2 - subfunction number
1483
  * ecx = 9
1476
  * ecx = 9
1484
Returned value:
1477
Returned value:
1485
  * eax = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1478
  * eax = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1486
Remarks:
1479
Remarks:
1487
  * If Alt is pressed, the layout with Alt is used;
1480
  * If Alt is pressed, the layout with Alt is used;
1488
    if Alt is not pressed, but Shift is pressed,
1481
    if Alt is not pressed, but Shift is pressed,
1489
    the layout with Shift is used;
1482
    the layout with Shift is used;
1490
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1483
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1491
    layout is used and then from the code is subtracted 0x60;
1484
    layout is used and then from the code is subtracted 0x60;
1492
    if no control key is pressed, the normal layout is used.
1485
    if no control key is pressed, the normal layout is used.
1493
  * To set layout and country identifier use 
1486
  * To set layout and country identifier use 
1494
    subfunction 2 of function 21.
1487
    subfunction 2 of function 21.
1495
  * Country identifier is global system variable, which is not used
1488
  * Country identifier is global system variable, which is not used
1496
    by the kernel itself; however the application '@panel' displays
1489
    by the kernel itself; however the application '@panel' displays
1497
    the corresponding icon (using this function).
1490
    the corresponding icon (using this function).
1498
  * The application @panel switches layouts on user request.
1491
  * The application @panel switches layouts on user request.
1499
 
1492
 
1500
======================================================================
1493
======================================================================
1501
============== Function 26, subfunction 3 - get CD base. =============
1494
============== Function 26, subfunction 3 - get CD base. =============
1502
======================================================================
1495
======================================================================
1503
Parameters:
1496
Parameters:
1504
  * eax = 26 - function number
1497
  * eax = 26 - function number
1505
  * ebx = 3 - subfunction number
1498
  * ebx = 3 - subfunction number
1506
Returned value:
1499
Returned value:
1507
  * eax = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1500
  * eax = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1508
Remarks:
1501
Remarks:
1509
  * CD base is used by function 24.
1502
  * CD base is used by function 24.
1510
  * To set CD base use subfunction 3 of function 21.
1503
  * To set CD base use subfunction 3 of function 21.
1511
 
1504
 
1512
======================================================================
1505
======================================================================
1513
====== Function 26, subfunction 4 - get Sound Blaster base port. =====
1506
====== Function 26, subfunction 4 - get Sound Blaster base port. =====
1514
======================================================================
1507
======================================================================
1515
Parameters:
1508
Parameters:
1516
  * eax = 26 - function number
1509
  * eax = 26 - function number
1517
  * ebx = 4 - subfunction number
1510
  * ebx = 4 - subfunction number
1518
Returned value:
1511
Returned value:
1519
  * eax = base port number
1512
  * eax = base port number
1520
Remarks:
1513
Remarks:
1521
  * Bae port is used by functions 25, 55.
1514
  * Bae port is used by functions 25, 55.
1522
  * To set base port use subfunction 4 of function 21.
1515
  * To set base port use subfunction 4 of function 21.
1523
 
1516
 
1524
======================================================================
1517
======================================================================
1525
========== Function 26, subfunction 5 - get system language. =========
1518
========== Function 26, subfunction 5 - get system language. =========
1526
======================================================================
1519
======================================================================
1527
Parameters:
1520
Parameters:
1528
  * eax = 26 - function number
1521
  * eax = 26 - function number
1529
  * ebx = 5 - subfunction number
1522
  * ebx = 5 - subfunction number
1530
Returned value:
1523
Returned value:
1531
  * eax = system language (1=eng, 2=fi, 3=ger, 4=rus)
1524
  * eax = system language (1=eng, 2=fi, 3=ger, 4=rus)
1532
Remarks:
1525
Remarks:
1533
  * System language is global system variable and is not used
1526
  * System language is global system variable and is not used
1534
    by the kernel itself, however application @panel draws the
1527
    by the kernel itself, however application @panel draws the
1535
    appropriate icon (using this function).
1528
    appropriate icon (using this function).
1536
  * To set system language use subfunction 5 of function 21.
1529
  * To set system language use subfunction 5 of function 21.
1537
 
1530
 
1538
======================================================================
1531
======================================================================
1539
============== Function 26, subfunction 7 - get HD base. =============
1532
============== Function 26, subfunction 7 - get HD base. =============
1540
======================================================================
1533
======================================================================
1541
The HD base defines hard disk to write with usage of obsolete
1534
The HD base defines hard disk to write with usage of obsolete
1542
file system functions and functions implicitly using the hard disk
1535
file system functions and functions implicitly using the hard disk
1543
(such as subfunction 6 of function 18);
1536
(such as subfunction 6 of function 18);
1544
at usage of function 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1537
at usage of function 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1545
these function set base themselves.
1538
these function set base themselves.
1546
Parameters:
1539
Parameters:
1547
  * eax = 26 - function number
1540
  * eax = 26 - function number
1548
  * ebx = 7 - subfunction number
1541
  * ebx = 7 - subfunction number
1549
Returned value:
1542
Returned value:
1550
  * eax = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1543
  * eax = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1551
Remarks:
1544
Remarks:
1552
  * Any application in any time can change HD base.
1545
  * Any application in any time can change HD base.
1553
  * To set base use subfunction 7 of function 21.
1546
  * To set base use subfunction 7 of function 21.
1554
  * To get used partition of hard disk use subfunction 8.
1547
  * To get used partition of hard disk use subfunction 8.
1555
 
1548
 
1556
======================================================================
1549
======================================================================
1557
========= Function 26, subfunction 8 - get used HD partition. ========
1550
========= Function 26, subfunction 8 - get used HD partition. ========
1558
======================================================================
1551
======================================================================
1559
The HD partition defines partition of the hard disk to write with
1552
The HD partition defines partition of the hard disk to write with
1560
usage of obsolete file system functions and functions implicitly
1553
usage of obsolete file system functions and functions implicitly
1561
using the hard disk (such as subfunction 6 of function 18);
1554
using the hard disk (such as subfunction 6 of function 18);
1562
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1555
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1563
these functions set base and partition themselves.
1556
these functions set base and partition themselves.
1564
Parameters:
1557
Parameters:
1565
  * eax = 26 - function number
1558
  * eax = 26 - function number
1566
  * ebx = 8 - subfunction number
1559
  * ebx = 8 - subfunction number
1567
Returned value:
1560
Returned value:
1568
  * eax = HD partition (beginning from 1)
1561
  * eax = HD partition (beginning from 1)
1569
Remarks:
1562
Remarks:
1570
  * Any application in any time can change partition.
1563
  * Any application in any time can change partition.
1571
  * To set partition use subfunction 8 of function 21.
1564
  * To set partition use subfunction 8 of function 21.
1572
  * To get number of partitions on a hard disk use
1565
  * To get number of partitions on a hard disk use
1573
    subfunction 11 of function 18.
1566
    subfunction 11 of function 18.
1574
  * To get base of used hard disk, use subfunction 7.
1567
  * To get base of used hard disk, use subfunction 7.
1575
 
1568
 
1576
======================================================================
1569
======================================================================
1577
=== Function 26, subfunction 9 - get the value of the time counter. ==
1570
=== Function 26, subfunction 9 - get the value of the time counter. ==
1578
======================================================================
1571
======================================================================
1579
Parameters:
1572
Parameters:
1580
  * eax = 26 - function number
1573
  * eax = 26 - function number
1581
  * ebx = 9 - subfunction number
1574
  * ebx = 9 - subfunction number
1582
Returned value:
1575
Returned value:
1583
  * eax = number of 1/100s of second, past from the system boot time
1576
  * eax = number of 1/100s of second, past from the system boot time
1584
Remarks:
1577
Remarks:
1585
  * Counter takes modulo 2^32, that correspond to a little more
1578
  * Counter takes modulo 2^32, that correspond to a little more
1586
    than 497 days.
1579
    than 497 days.
1587
  * To get system time use function 3.
1580
  * To get system time use function 3.
1588
 
1581
 
1589
======================================================================
1582
======================================================================
1590
======== Function 26, subfunction 10 - get sound DMA channel. ========
1583
======== Function 26, subfunction 10 - get sound DMA channel. ========
1591
======================================================================
1584
======================================================================
1592
Parameters:
1585
Parameters:
1593
  * eax = 26 - function number
1586
  * eax = 26 - function number
1594
  * ebx = 10 - subfunction number
1587
  * ebx = 10 - subfunction number
1595
Returned value:
1588
Returned value:
1596
  * eax = number of the channel (from 0 to 3 inclusive)
1589
  * eax = number of the channel (from 0 to 3 inclusive)
1597
Remarks:
1590
Remarks:
1598
  * Number of the DMA channel is used by subfunction 1 of function 55.
1591
  * Number of the DMA channel is used by subfunction 1 of function 55.
1599
  * To set the sound DMA channel use subfunction 10 of function 21.
1592
  * To set the sound DMA channel use subfunction 10 of function 21.
1600
 
1593
 
1601
======================================================================
1594
======================================================================
1602
===================== Function 26, subfunction 11 ====================
1595
===================== Function 26, subfunction 11 ====================
1603
========== Find out whether low-level HD access is enabled. ==========
1596
========== Find out whether low-level HD access is enabled. ==========
1604
======================================================================
1597
======================================================================
1605
Parameters:
1598
Parameters:
1606
  * eax = 26 - function number
1599
  * eax = 26 - function number
1607
  * ebx = 11 - subfunction number
1600
  * ebx = 11 - subfunction number
1608
Returned value:
1601
Returned value:
1609
  * eax = 0/1 - disabled/enabled
1602
  * eax = 0/1 - disabled/enabled
1610
Remarks:
1603
Remarks:
1611
  * Is used in LBA read (subfunction 8 of function 58).
1604
  * Is used in LBA read (subfunction 8 of function 58).
1612
  * To set current state use subfunction 11 of function 21.
1605
  * To set current state use subfunction 11 of function 21.
1613
 
1606
 
1614
======================================================================
1607
======================================================================
1615
===================== Function 26, subfunction 12 ====================
1608
===================== Function 26, subfunction 12 ====================
1616
========== Find out whether low-level PCI access is enabled. =========
1609
========== Find out whether low-level PCI access is enabled. =========
1617
======================================================================
1610
======================================================================
1618
Parameters:
1611
Parameters:
1619
  * eax = 26 - function number
1612
  * eax = 26 - function number
1620
  * ebx = 12 - subfunction number
1613
  * ebx = 12 - subfunction number
1621
Returned value:
1614
Returned value:
1622
  * eax = 0/1 - disabled/enabled
1615
  * eax = 0/1 - disabled/enabled
1623
Remarks:
1616
Remarks:
1624
  * Is used by operations with PCI bus (function 62).
1617
  * Is used by operations with PCI bus (function 62).
1625
  * The current implementation uses only low bit of ecx.
1618
  * The current implementation uses only low bit of ecx.
1626
  * To set the current state use subfunction 12 of function 21.
1619
  * To set the current state use subfunction 12 of function 21.
1627
 
1620
 
1628
======================================================================
1621
======================================================================
1629
=================== Function 28 - set SB16 volume. ===================
1622
=================== Function 28 - set SB16 volume. ===================
1630
======================================================================
1623
======================================================================
1631
Parameters:
1624
Parameters:
1632
  * eax = 28 - function number
1625
  * eax = 28 - function number
1633
  * ebx = what to install:
1626
  * ebx = what to install:
1634
    * 1 - install common volume
1627
    * 1 - install common volume
1635
    * 2 - install CD-audio volume
1628
    * 2 - install CD-audio volume
1636
  * cl = volume level (0=off, 0xFF=max)
1629
  * cl = volume level (0=off, 0xFF=max)
1637
Returned value:
1630
Returned value:
1638
  * eax = 0 - success
1631
  * eax = 0 - success
1639
  * eax = 1 - SB base is not defined
1632
  * eax = 1 - SB base is not defined
1640
  * eax = 2 - incorrect subfunction
1633
  * eax = 2 - incorrect subfunction
1641
Remarks:
1634
Remarks:
1642
  * Previously SB base port must be defined by
1635
  * Previously SB base port must be defined by
1643
    subfunction 4 of function 21.
1636
    subfunction 4 of function 21.
1644
  * This function gives more variants for volume, that function 25.
1637
  * This function gives more variants for volume, that function 25.
1645
 
1638
 
1646
======================================================================
1639
======================================================================
1647
=================== Function 29 - get system date. ===================
1640
=================== Function 29 - get system date. ===================
1648
======================================================================
1641
======================================================================
1649
Parameters:
1642
Parameters:
1650
  * eax = 29 - function number
1643
  * eax = 29 - function number
1651
Returned value:
1644
Returned value:
1652
  * eax = 0x00DDMMYY, where
1645
  * eax = 0x00DDMMYY, where
1653
    (binary-decimal coding, BCD, is used)
1646
    (binary-decimal coding, BCD, is used)
1654
  * YY = two low digits of year (00..99)
1647
  * YY = two low digits of year (00..99)
1655
  * MM = month (01..12)
1648
  * MM = month (01..12)
1656
  * DD = day (01..31)
1649
  * DD = day (01..31)
1657
Remarks:
1650
Remarks:
1658
  * To set system date use function 22.
1651
  * To set system date use function 22.
1659
 
1652
 
1660
======================================================================
1653
======================================================================
1661
=============== Function 32 - delete file from ramdisk. ==============
1654
=============== Function 32 - delete file from ramdisk. ==============
1662
======================================================================
1655
======================================================================
1663
Parameters:
1656
Parameters:
1664
  * eax = 32 - function number
1657
  * eax = 32 - function number
1665
  * ebx = pointer to the filename
1658
  * ebx = pointer to the filename
1666
Returned value:
1659
Returned value:
1667
  * eax = 0 - success; otherwise file system error code
1660
  * eax = 0 - success; otherwise file system error code
1668
Remarks:
1661
Remarks:
1669
  * This function is obsolete; function 58 allows to fulfill
1662
  * This function is obsolete; function 58 allows to fulfill
1670
    the same operations with the extended possibilities.
1663
    the same operations with the extended possibilities.
1671
  * The current implementation returns only values 0(success) and
1664
  * The current implementation returns only values 0(success) and
1672
    5(file not found).
1665
    5(file not found).
1673
  * The filename must be either in the format 8+3 characters
1666
  * The filename must be either in the format 8+3 characters
1674
    (first 8 characters - name itself, last 3 - extension,
1667
    (first 8 characters - name itself, last 3 - extension,
1675
    the short names and extensions are supplemented with spaces),
1668
    the short names and extensions are supplemented with spaces),
1676
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1669
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1677
    (name no more than 8 characters, dot, extension 3 characters
1670
    (name no more than 8 characters, dot, extension 3 characters
1678
    supplemented if necessary by spaces).
1671
    supplemented if necessary by spaces).
1679
    The filename must be written with capital letters. The terminating
1672
    The filename must be written with capital letters. The terminating
1680
    character with code 0 is not necessary (not ASCIIZ-string).
1673
    character with code 0 is not necessary (not ASCIIZ-string).
1681
  * This function does not support folders on the ramdisk.
1674
  * This function does not support folders on the ramdisk.
1682
 
1675
 
1683
======================================================================
1676
======================================================================
1684
================ Function 33 - write file to ramdisk. ================
1677
================ Function 33 - write file to ramdisk. ================
1685
======================================================================
1678
======================================================================
1686
Parameters:
1679
Parameters:
1687
  * eax = 33 - function number
1680
  * eax = 33 - function number
1688
  * ebx = pointer to the filename
1681
  * ebx = pointer to the filename
1689
  * ecx = pointer to data for writing
1682
  * ecx = pointer to data for writing
1690
  * edx = number of bytes for writing
1683
  * edx = number of bytes for writing
1691
  * should be set esi=0
1684
  * should be set esi=0
1692
Returned value:
1685
Returned value:
1693
  * eax = 0 - success, otherwise file system error code
1686
  * eax = 0 - success, otherwise file system error code
1694
Remarks:
1687
Remarks:
1695
  * This function is obsolete; function 70 allows to fulfil
1688
  * This function is obsolete; function 70 allows to fulfil
1696
    the same operations with extended possibilities.
1689
    the same operations with extended possibilities.
1697
  * If esi contains non-zero value and selected file already exists,
1690
  * If esi contains non-zero value and selected file already exists,
1698
    one more file with the same name will be created.
1691
    one more file with the same name will be created.
1699
  * Otherwise file will be overwritten.
1692
  * Otherwise file will be overwritten.
1700
  * The filename must be either in the format 8+3 characters
1693
  * The filename must be either in the format 8+3 characters
1701
    (first 8 characters - name itself, last 3 - extension,
1694
    (first 8 characters - name itself, last 3 - extension,
1702
    the short names and extensions are supplemented with spaces),
1695
    the short names and extensions are supplemented with spaces),
1703
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1696
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1704
    (name no more than 8 characters, dot, extension 3 characters
1697
    (name no more than 8 characters, dot, extension 3 characters
1705
    supplemented if necessary by spaces).
1698
    supplemented if necessary by spaces).
1706
    The filename must be written with capital letters. The terminating
1699
    The filename must be written with capital letters. The terminating
1707
    character with code 0 is not necessary (not ASCIIZ-string).
1700
    character with code 0 is not necessary (not ASCIIZ-string).
1708
  * This function does not support folders on the ramdisk.
1701
  * This function does not support folders on the ramdisk.
1709
 
1702
 
1710
======================================================================
1703
======================================================================
1711
======= Function 35 - read the color of a pixel on the screen. =======
1704
======= Function 35 - read the color of a pixel on the screen. =======
1712
======================================================================
1705
======================================================================
1713
Parameters:
1706
Parameters:
1714
  * eax = 35
1707
  * eax = 35
1715
  * ebx = y*xsize+x, where
1708
  * ebx = y*xsize+x, where
1716
  * (x,y) = coordinates of a pixel (beginning from 0)
1709
  * (x,y) = coordinates of a pixel (beginning from 0)
1717
  * xsize = horizontal screen size
1710
  * xsize = horizontal screen size
1718
Returned value:
1711
Returned value:
1719
  * eax = color 0x00RRGGBB
1712
  * eax = color 0x00RRGGBB
1720
Remarks:
1713
Remarks:
1721
  * To get screen sizes use function 14. Pay attention,
1714
  * To get screen sizes use function 14. Pay attention,
1722
    that it subtracts 1 from both sizes.
1715
    that it subtracts 1 from both sizes.
1723
  * There is also direct access (without any system calls)
1716
  * There is also direct access (without any system calls)
1724
    to videomemory through the selector gs. To get parameters of
1717
    to videomemory through the selector gs. To get parameters of
1725
    the current videomode, use function 61.
1718
    the current videomode, use function 61.
1726
 
1719
 
1727
======================================================================
1720
======================================================================
1728
=================== Function 37 - work with mouse. ===================
1721
=================== Function 37 - work with mouse. ===================
1729
======================================================================
1722
======================================================================
1730
 
1723
 
1731
---------- Subfunction 0 - screen coordinates of the mouse -----------
1724
---------- Subfunction 0 - screen coordinates of the mouse -----------
1732
Parameters:
1725
Parameters:
1733
  * eax = 37 - function number
1726
  * eax = 37 - function number
1734
  * ebx = 0 - subfunction number
1727
  * ebx = 0 - subfunction number
1735
Returned value:
1728
Returned value:
1736
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1729
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1737
    (beginning from 0)
1730
    (beginning from 0)
1738
 
1731
 
1739
-- Subfunction 1 - coordinates of the mouse relative to the window ---
1732
-- Subfunction 1 - coordinates of the mouse relative to the window ---
1740
Parameters:
1733
Parameters:
1741
  * eax = 37 - function number
1734
  * eax = 37 - function number
1742
  * ebx = 1 - subfunction number
1735
  * ebx = 1 - subfunction number
1743
Returned value:
1736
Returned value:
1744
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1737
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1745
    relative to the application window (beginning from 0)
1738
    relative to the application window (beginning from 0)
1746
Remarks:
1739
Remarks:
1747
  * The value is calculated by formula (x-xwnd)*65536 + (y-ywnd).
1740
  * The value is calculated by formula (x-xwnd)*65536 + (y-ywnd).
1748
    If y>=ywnd, the low word is non-negative and contains
1741
    If y>=ywnd, the low word is non-negative and contains
1749
    relative y-coordinate, and the high word - relative x-coordinate
1742
    relative y-coordinate, and the high word - relative x-coordinate
1750
    (with correct sign). Otherwise the low word is negative and still
1743
    (with correct sign). Otherwise the low word is negative and still
1751
    contains relative y-coordinate, and to the high word
1744
    contains relative y-coordinate, and to the high word
1752
    1 should be added.
1745
    1 should be added.
1753
 
1746
 
1754
------------ Subfunction 2 - pressed buttons of the mouse ------------
1747
------------ Subfunction 2 - pressed buttons of the mouse ------------
1755
Parameters:
1748
Parameters:
1756
  * eax = 37 - function number
1749
  * eax = 37 - function number
1757
  * ebx = 2 - subfunction number
1750
  * ebx = 2 - subfunction number
1758
Returned value:
1751
Returned value:
1759
  * eax contains information on the pressed mouse buttons:
1752
  * eax contains information on the pressed mouse buttons:
1760
  * bit 0 is set = left button is pressed
1753
  * bit 0 is set = left button is pressed
1761
  * bit 1 is set = right button is pressed
1754
  * bit 1 is set = right button is pressed
1762
  * other bits are cleared
1755
  * other bits are cleared
1763
 
1756
 
1764
-------------------- Subfunction 4 - load cursor ---------------------
1757
-------------------- Subfunction 4 - load cursor ---------------------
1765
Parameters:
1758
Parameters:
1766
  * eax = 37 - function number
1759
  * eax = 37 - function number
1767
  * ebx = 4 - subfunction number
1760
  * ebx = 4 - subfunction number
1768
  * dx = data source:
1761
  * dx = data source:
1769
  * dx = LOAD_FROM_FILE = 0 - data in a file
1762
  * dx = LOAD_FROM_FILE = 0 - data in a file
1770
    * ecx = pointer to full path to the cursor file
1763
    * ecx = pointer to full path to the cursor file
1771
    * the file must be in the format .cur, which is standard for
1764
    * the file must be in the format .cur, which is standard for
1772
      MS Windows, at that of the size 32*32 pixels
1765
      MS Windows, at that of the size 32*32 pixels
1773
  * dx = LOAD_FROM_MEM = 1 - data of file are already loaded in memory
1766
  * dx = LOAD_FROM_MEM = 1 - data of file are already loaded in memory
1774
    * ecx = pointer to data of the cursor file
1767
    * ecx = pointer to data of the cursor file
1775
    * the data format is the same as in the previous case
1768
    * the data format is the same as in the previous case
1776
  * dx = LOAD_INDIRECT = 2 - data in memory
1769
  * dx = LOAD_INDIRECT = 2 - data in memory
1777
    * ecx = pointer to cursor image in the format ARGB 32*32 pixels
1770
    * ecx = pointer to cursor image in the format ARGB 32*32 pixels
1778
    * edx = 0xXXYY0002, where
1771
    * edx = 0xXXYY0002, where
1779
      * XX = x-coordinate of cursor hotspot
1772
      * XX = x-coordinate of cursor hotspot
1780
      * YY = y-coordinate
1773
      * YY = y-coordinate
1781
      * 0 <= XX, YY <= 31
1774
      * 0 <= XX, YY <= 31
1782
Returned value:
1775
Returned value:
1783
  * eax = 0 - failed
1776
  * eax = 0 - failed
1784
  * otherwise eax = cursor handle
1777
  * otherwise eax = cursor handle
1785
 
1778
 
1786
--------------------- Subfunction 5 - set cursor ---------------------
1779
--------------------- Subfunction 5 - set cursor ---------------------
1787
Sets new cursor for the window of the current thread.
1780
Sets new cursor for the window of the current thread.
1788
Parameters:
1781
Parameters:
1789
  * eax = 37 - function number
1782
  * eax = 37 - function number
1790
  * ebx = 5 - subfunction number
1783
  * ebx = 5 - subfunction number
1791
  * ecx = cursor handle
1784
  * ecx = cursor handle
1792
Returned value:
1785
Returned value:
1793
  * eax = handle of previous cursor
1786
  * eax = handle of previous cursor
1794
Remarks:
1787
Remarks:
1795
  * If the handle is incorrect, the function restores the default
1788
  * If the handle is incorrect, the function restores the default
1796
    cursor (standard arrow). In particular, ecx=0 restores it.
1789
    cursor (standard arrow). In particular, ecx=0 restores it.
1797
 
1790
 
1798
------------------- Subfunction 6 - delete cursor --------------------
1791
------------------- Subfunction 6 - delete cursor --------------------
1799
Parameters:
1792
Parameters:
1800
  * eax = 37 - function number
1793
  * eax = 37 - function number
1801
  * ebx = 6 - subfunction number
1794
  * ebx = 6 - subfunction number
1802
  * ecx = cursor handle
1795
  * ecx = cursor handle
1803
Returned value:
1796
Returned value:
1804
  * eax destroyed
1797
  * eax destroyed
1805
Remarks:
1798
Remarks:
1806
  * The cursor must be loaded previously by the current thread
1799
  * The cursor must be loaded previously by the current thread
1807
    (with the call to subfunction 4). The function does not delete
1800
    (with the call to subfunction 4). The function does not delete
1808
    system cursors and cursors, loaded by another applications.
1801
    system cursors and cursors, loaded by another applications.
1809
  * If the active cursor (set by subfunction 5) is deleted,
1802
  * If the active cursor (set by subfunction 5) is deleted,
1810
    the system restores the default cursor (standard arrow).
1803
    the system restores the default cursor (standard arrow).
1811
 
1804
 
1812
======================================================================
1805
======================================================================
1813
====================== Function 38 - draw line. ======================
1806
====================== Function 38 - draw line. ======================
1814
======================================================================
1807
======================================================================
1815
Parameters:
1808
Parameters:
1816
  * eax = 38 - function number
1809
  * eax = 38 - function number
1817
  * ebx = [start coordinate on axis x]*65536 +
1810
  * ebx = [start coordinate on axis x]*65536 +
1818
              [end coordinate on axis x]
1811
              [end coordinate on axis x]
1819
  * ecx = [start coordinate on axis y]*65536 +
1812
  * ecx = [start coordinate on axis y]*65536 +
1820
              [end coordinate on axis y]
1813
              [end coordinate on axis y]
1821
  * edx = 0x00RRGGBB - color
1814
  * edx = 0x00RRGGBB - color
1822
    edx = 0x01xxxxxx - draw inversed line
1815
    edx = 0x01xxxxxx - draw inversed line
1823
          (low 24 bits are ignored)
1816
          (low 24 bits are ignored)
1824
Returned value:
1817
Returned value:
1825
  * function does not return value
1818
  * function does not return value
1826
Remarks:
1819
Remarks:
1827
  * Coordinates are relative to the window.
1820
  * Coordinates are relative to the window.
1828
  * End point is also drawn.
1821
  * End point is also drawn.
1829
 
1822
 
1830
======================================================================
1823
======================================================================
1831
== Function 39, subfunction 1 - get a size of the background image. ==
1824
== Function 39, subfunction 1 - get a size of the background image. ==
1832
======================================================================
1825
======================================================================
1833
Parameters:
1826
Parameters:
1834
  * eax = 39 - function number
1827
  * eax = 39 - function number
1835
  * ebx = 1 - subfunction number
1828
  * ebx = 1 - subfunction number
1836
Returned value:
1829
Returned value:
1837
  * eax = [width]*65536 + [height]
1830
  * eax = [width]*65536 + [height]
1838
Remarks:
1831
Remarks:
1839
  * There is a pair function to set sizes of background image -
1832
  * There is a pair function to set sizes of background image -
1840
    subfunction 1 of function 15. After which it is necessary,
1833
    subfunction 1 of function 15. After which it is necessary,
1841
    of course, anew to define image.
1834
    of course, anew to define image.
1842
 
1835
 
1843
======================================================================
1836
======================================================================
1844
== Function 39, subfunction 2 - get pixel from the background image. =
1837
== Function 39, subfunction 2 - get pixel from the background image. =
1845
======================================================================
1838
======================================================================
1846
Parameters:
1839
Parameters:
1847
  * eax = 39 - function number
1840
  * eax = 39 - function number
1848
  * ebx = 2 - subfunction number
1841
  * ebx = 2 - subfunction number
1849
  * ecx = offset
1842
  * ecx = offset
1850
Returned value:
1843
Returned value:
1851
  * eax = 0x00RRGGBB - pixel color, if offset is valid
1844
  * eax = 0x00RRGGBB - pixel color, if offset is valid
1852
    (less than 0x160000-16)
1845
    (less than 0x160000-16)
1853
  * eax = 2 otherwise
1846
  * eax = 2 otherwise
1854
Remarks:
1847
Remarks:
1855
  * Do not rely on returned value for invalid offsets, it may be
1848
  * Do not rely on returned value for invalid offsets, it may be
1856
    changed in future kernel versions.
1849
    changed in future kernel versions.
1857
  * Offset for pixel with coordinates (x,y)
1850
  * Offset for pixel with coordinates (x,y)
1858
    is calculated as (x+y*xsize)*3.
1851
    is calculated as (x+y*xsize)*3.
1859
  * There is a pair function to set pixel on the background image - 
1852
  * There is a pair function to set pixel on the background image - 
1860
    subfunction 2 of function 15.
1853
    subfunction 2 of function 15.
1861
 
1854
 
1862
======================================================================
1855
======================================================================
1863
== Function 39, subfunction 4 - get drawing mode for the background. =
1856
== Function 39, subfunction 4 - get drawing mode for the background. =
1864
======================================================================
1857
======================================================================
1865
Parameters:
1858
Parameters:
1866
  * eax = 39 - function number
1859
  * eax = 39 - function number
1867
  * ebx = 4 - subfunction number
1860
  * ebx = 4 - subfunction number
1868
Returned value:
1861
Returned value:
1869
  * eax = 1 - tile
1862
  * eax = 1 - tile
1870
  * eax = 2 - stretch
1863
  * eax = 2 - stretch
1871
Remarks:
1864
Remarks:
1872
  * There is a pair function to set drawing mode - 
1865
  * There is a pair function to set drawing mode - 
1873
    subfunction 4 of function 15.
1866
    subfunction 4 of function 15.
1874
 
1867
 
1875
======================================================================
1868
======================================================================
1876
=========== Function 40 - set the mask for expected events. ==========
1869
=========== Function 40 - set the mask for expected events. ==========
1877
======================================================================
1870
======================================================================
1878
The mask for expected events affects function working with events
1871
The mask for expected events affects function working with events
1879
10, 11, 23 - they notify only about events allowed by this mask.
1872
10, 11, 23 - they notify only about events allowed by this mask.
1880
Parameters:
1873
Parameters:
1881
  * eax = 40 - function number
1874
  * eax = 40 - function number
1882
  * ebx = mask: bit i corresponds to event i+1 (see list of events)
1875
  * ebx = mask: bit i corresponds to event i+1 (see list of events)
1883
    (set bit permits notice on event)
1876
    (set bit permits notice on event)
1884
Returned value:
1877
Returned value:
1885
  * function does not return value
1878
  * function does not return value
1886
Remarks:
1879
Remarks:
1887
  * Default mask (7=111b) enables nofices about redraw,
1880
  * Default mask (7=111b) enables nofices about redraw,
1888
    keys and buttons. This is enough for many applications.
1881
    keys and buttons. This is enough for many applications.
1889
  * Events prohibited in the mask are saved anyway, when come;
1882
  * Events prohibited in the mask are saved anyway, when come;
1890
    they are simply not informed with event functions.
1883
    they are simply not informed with event functions.
1891
  * Event functions take into account the mask on moment of
1884
  * Event functions take into account the mask on moment of
1892
    function call, not on moment of event arrival.
1885
    function call, not on moment of event arrival.
1893
 
1886
 
1894
======================================================================
1887
======================================================================
1895
==================== Function 41 - get IRQ owner. ====================
1888
==================== Function 41 - get IRQ owner. ====================
1896
======================================================================
1889
======================================================================
1897
Parameters:
1890
Parameters:
1898
  * eax = 41 - function number
1891
  * eax = 41 - function number
1899
  * ebx = IRQ number, 0..15
1892
  * ebx = IRQ number, 0..15
1900
Returned value:
1893
Returned value:
1901
  * eax = owner PID
1894
  * eax = owner PID
1902
  * eax = 0, if there is no owner
1895
  * eax = 0, if there is no owner
1903
  * eax = -1 for incorrect ebx
1896
  * eax = -1 for incorrect ebx
1904
 
1897
 
1905
======================================================================
1898
======================================================================
1906
==================== Function 42 - read IRQ data. ====================
1899
==================== Function 42 - read IRQ data. ====================
1907
======================================================================
1900
======================================================================
1908
When an IRQ occurs, the system reads data from ports indicated
1901
When an IRQ occurs, the system reads data from ports indicated
1909
earlier by function 44 and writes this data to
1902
earlier by function 44 and writes this data to
1910
internal buffer. This function reads out data from that buffer
1903
internal buffer. This function reads out data from that buffer
1911
bytewise.
1904
bytewise.
1912
Parameters:
1905
Parameters:
1913
  * eax = 42 - function number
1906
  * eax = 42 - function number
1914
  * ebx = IRQ number, 0..15
1907
  * ebx = IRQ number, 0..15
1915
Returned value: (use value of ecx to distinguish)
1908
Returned value: (use value of ecx to distinguish)
1916
  * if the thread is not IRQ owner (or IRQ number is incorrect):
1909
  * if the thread is not IRQ owner (or IRQ number is incorrect):
1917
    * ecx = 2
1910
    * ecx = 2
1918
  * if there is no data:
1911
  * if there is no data:
1919
    * eax = 0
1912
    * eax = 0
1920
    * ecx = 1
1913
    * ecx = 1
1921
    * ebx destroyed
1914
    * ebx destroyed
1922
  * if all is ok:
1915
  * if all is ok:
1923
    * eax = byte size of data, not yet read from buffer
1916
    * eax = byte size of data, not yet read from buffer
1924
    * ecx = 0
1917
    * ecx = 0
1925
    * ebx = current byte
1918
    * ebx = current byte
1926
Remarks:
1919
Remarks:
1927
  * Previously the thread must reserve indicated IRQ for itself
1920
  * Previously the thread must reserve indicated IRQ for itself
1928
    by function 45.
1921
    by function 45.
1929
  * The size of data buffer is 4000 bytes, on overflow
1922
  * The size of data buffer is 4000 bytes, on overflow
1930
    "fresh" data cease to be written in the buffer.
1923
    "fresh" data cease to be written in the buffer.
1931
 
1924
 
1932
======================================================================
1925
======================================================================
1933
================ Function 43 - input/output to a port. ===============
1926
================ Function 43 - input/output to a port. ===============
1934
======================================================================
1927
======================================================================
1935
 
1928
 
1936
------------------------ Output data to port -------------------------
1929
------------------------ Output data to port -------------------------
1937
Parameters:
1930
Parameters:
1938
  * eax = 43 - function number
1931
  * eax = 43 - function number
1939
  * bl = byte for output
1932
  * bl = byte for output
1940
  * ecx = port number 0xnnnn (from 0 to 0xFFFF)
1933
  * ecx = port number 0xnnnn (from 0 to 0xFFFF)
1941
Returned value:
1934
Returned value:
1942
  * eax = 0 - success
1935
  * eax = 0 - success
1943
  * eax = 1 - the thread has not reserved the selected port
1936
  * eax = 1 - the thread has not reserved the selected port
1944
 
1937
 
1945
------------------------ Input data from port ------------------------
1938
------------------------ Input data from port ------------------------
1946
Parameters:
1939
Parameters:
1947
  * eax = 43 - function number
1940
  * eax = 43 - function number
1948
  * ebx is ignored
1941
  * ebx is ignored
1949
  * ecx = 0x8000nnnn, where nnnn = port number (from 0 to 0xFFFF)
1942
  * ecx = 0x8000nnnn, where nnnn = port number (from 0 to 0xFFFF)
1950
Returned value:
1943
Returned value:
1951
  * eax = 0 - success, thus ebx = entered byte
1944
  * eax = 0 - success, thus ebx = entered byte
1952
  * eax = 1 - the thread has not reserved the selected port
1945
  * eax = 1 - the thread has not reserved the selected port
1953
Remarks:
1946
Remarks:
1954
  * Previously the thread must reserve the selected port
1947
  * Previously the thread must reserve the selected port
1955
    for itself by function 46.
1948
    for itself by function 46.
1956
  * Instead of call to this function it is better to use
1949
  * Instead of call to this function it is better to use
1957
    processor instructions in/out - this is much
1950
    processor instructions in/out - this is much
1958
    faster and a bit shorter and easier.
1951
    faster and a bit shorter and easier.
1959
 
1952
 
1960
======================================================================
1953
======================================================================
1961
=========== Function 44 - define operations at IRQ arrival. ==========
1954
=========== Function 44 - define operations at IRQ arrival. ==========
1962
======================================================================
1955
======================================================================
1963
At IRQ arrival the system can read the data from ports defined
1956
At IRQ arrival the system can read the data from ports defined
1964
by this function and write these data to internal buffer, whence
1957
by this function and write these data to internal buffer, whence
1965
they can be read by ôóíêöèåé 42.
1958
they can be read by ôóíêöèåé 42.
1966
Parameters:
1959
Parameters:
1967
  * eax = 44 - function number
1960
  * eax = 44 - function number
1968
  * ebx = pointer to the array of structures each describing one port:
1961
  * ebx = pointer to the array of structures each describing one port:
1969
    * +0: word: 0 means end of array, otherwise port number
1962
    * +0: word: 0 means end of array, otherwise port number
1970
    * +2: byte: reserved (ignored)
1963
    * +2: byte: reserved (ignored)
1971
    * +3: byte: 1=read byte from this port, 2=read word
1964
    * +3: byte: 1=read byte from this port, 2=read word
1972
  * ecx = IRQ number, 0..15
1965
  * ecx = IRQ number, 0..15
1973
Returned value:
1966
Returned value:
1974
  * eax = 0 - success
1967
  * eax = 0 - success
1975
  * eax = 1 - the thread is not owner of selected IRQ
1968
  * eax = 1 - the thread is not owner of selected IRQ
1976
Remarks:
1969
Remarks:
1977
  * Previously the thread must reserve for itself selected IRQ
1970
  * Previously the thread must reserve for itself selected IRQ
1978
    by function 45.
1971
    by function 45.
1979
  * First 16 ports are considered only.
1972
  * First 16 ports are considered only.
1980
  * The current implementation considers incorrect value of field +3
1973
  * The current implementation considers incorrect value of field +3
1981
    as a signal to terminate IRQ processing.
1974
    as a signal to terminate IRQ processing.
1982
 
1975
 
1983
======================================================================
1976
======================================================================
1984
=================== Function 45 - reserve/free IRQ. ==================
1977
=================== Function 45 - reserve/free IRQ. ==================
1985
======================================================================
1978
======================================================================
1986
Parameters:
1979
Parameters:
1987
  * eax = 45 - function number
1980
  * eax = 45 - function number
1988
  * ebx = 0 - reserve, 1 = free
1981
  * ebx = 0 - reserve, 1 = free
1989
  * ecx = IRQ number, 0..15
1982
  * ecx = IRQ number, 0..15
1990
Returned value:
1983
Returned value:
1991
  * eax = 0 - success
1984
  * eax = 0 - success
1992
  * eax = 1 - error (invalid IRQ number
1985
  * eax = 1 - error (invalid IRQ number
1993
    or attempt to reserve not free IRQ
1986
    or attempt to reserve not free IRQ
1994
    or to free IRQ, not reserved by this thread)
1987
    or to free IRQ, not reserved by this thread)
1995
Remarks:
1988
Remarks:
1996
  * IRQ reservation is required for functions 42 and 44.
1989
  * IRQ reservation is required for functions 42 and 44.
1997
  * Only one thread can reserve the specific IRQ.
1990
  * Only one thread can reserve the specific IRQ.
1998
  * IRQs, handled by the system itself, are reserved by the system
1991
  * IRQs, handled by the system itself, are reserved by the system
1999
    (thread 1) at booting.
1992
    (thread 1) at booting.
2000
  * When a thread terminates, all reserved by it IRQs
1993
  * When a thread terminates, all reserved by it IRQs
2001
    are freed automatically.
1994
    are freed automatically.
2002
 
1995
 
2003
======================================================================
1996
======================================================================
2004
====== Function 46 - reserve/free a group of input/output ports. =====
1997
====== Function 46 - reserve/free a group of input/output ports. =====
2005
======================================================================
1998
======================================================================
2006
To work with reserved ports an application can access directly by
1999
To work with reserved ports an application can access directly by
2007
commands in/out (recommended way) and can use function 43
2000
commands in/out (recommended way) and can use function 43
2008
(not recommended way).
2001
(not recommended way).
2009
Parameters:
2002
Parameters:
2010
  * eax = 46 - function number
2003
  * eax = 46 - function number
2011
  * ebx = 0 - reserve, 1 - free
2004
  * ebx = 0 - reserve, 1 - free
2012
  * ecx = start port number
2005
  * ecx = start port number
2013
  * edx = end port number (inclusive)
2006
  * edx = end port number (inclusive)
2014
Returned value:
2007
Returned value:
2015
  * eax = 0 - success
2008
  * eax = 0 - success
2016
  * eax = 1 - error
2009
  * eax = 1 - error
2017
Remarks:
2010
Remarks:
2018
  * For ports reservation: an error occurs if and only if
2011
  * For ports reservation: an error occurs if and only if
2019
    one from the following condition satisfies:
2012
    one from the following condition satisfies:
2020
    * start port is more than end port;
2013
    * start port is more than end port;
2021
    * the selected range contains incorrect port number
2014
    * the selected range contains incorrect port number
2022
      (correct are from 0 to 0xFFFF);
2015
      (correct are from 0 to 0xFFFF);
2023
    * limit for the total number of reserved areas is exceeded
2016
    * limit for the total number of reserved areas is exceeded
2024
      (maximum 255 are allowed);
2017
      (maximum 255 are allowed);
2025
    * the selected range intersects with any of earlier reserved
2018
    * the selected range intersects with any of earlier reserved
2026
  * For ports free: an error is an attempt to free range,
2019
  * For ports free: an error is an attempt to free range,
2027
    that was not earlier reserved by this function
2020
    that was not earlier reserved by this function
2028
    (with same ecx,edx).
2021
    (with same ecx,edx).
2029
  * If an error occurs (for both cases) function performs no action.
2022
  * If an error occurs (for both cases) function performs no action.
2030
  * At booting the system reserves for itself ports
2023
  * At booting the system reserves for itself ports
2031
    0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (inclusively).
2024
    0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (inclusively).
2032
  * When a thread terminates, all reserved by it ports
2025
  * When a thread terminates, all reserved by it ports
2033
    are freed automatically.
2026
    are freed automatically.
2034
 
2027
 
2035
======================================================================
2028
======================================================================
2036
============= Function 47 - draw a number in the window. =============
2029
============= Function 47 - draw a number in the window. =============
2037
======================================================================
2030
======================================================================
2038
Parameters:
2031
Parameters:
2039
  * eax = 47 - function number
2032
  * eax = 47 - function number
2040
  * ebx = parameters of conversion number to text:
2033
  * ebx = parameters of conversion number to text:
2041
    * bl = 0 - ecx contains number
2034
    * bl = 0 - ecx contains number
2042
    * bl = 1 - ecx contains pointer to dword-number
2035
    * bl = 1 - ecx contains pointer to dword-number
2043
    * bh = 0 - display in decimal number system
2036
    * bh = 0 - display in decimal number system
2044
    * bh = 1 - display in hexadecimal system
2037
    * bh = 1 - display in hexadecimal system
2045
    * bh = 2 - display in binary system
2038
    * bh = 2 - display in binary system
2046
    * áèòû 16-21 = how many digits to display
2039
    * áèòû 16-21 = how many digits to display
2047
    * áèòû 22-31 reserved and must be set to 0
2040
    * áèòû 22-31 reserved and must be set to 0
2048
  * ecx = number (if bl=0) or pointer (if bl=1)
2041
  * ecx = number (if bl=0) or pointer (if bl=1)
2049
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
2042
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
2050
  * esi = 0xX0RRGGBB:
2043
  * esi = 0xX0RRGGBB:
2051
    * RR, GG, BB specify the color
2044
    * RR, GG, BB specify the color
2052
    * X = ABnn (bits)
2045
    * X = ABnn (bits)
2053
    * nn = font (0/1)
2046
    * nn = font (0/1)
2054
    * A is ignored
2047
    * A is ignored
2055
    * B=1 - fill background with the color edi
2048
    * B=1 - fill background with the color edi
2056
Returned value:
2049
Returned value:
2057
  * function does not return value
2050
  * function does not return value
2058
Remarks:
2051
Remarks:
2059
  * The given length must not exceed 60.
2052
  * The given length must not exceed 60.
2060
  * The exactly given amount of digits is output. If number is small
2053
  * The exactly given amount of digits is output. If number is small
2061
    and can be written by smaller amount of digits, it is supplemented
2054
    and can be written by smaller amount of digits, it is supplemented
2062
    by leading zeroes; if the number is big and can not be written by
2055
    by leading zeroes; if the number is big and can not be written by
2063
    given amount of digits, extra digits are not drawn.
2056
    given amount of digits, extra digits are not drawn.
2064
  * Parameters of fonts are shown in the description of function 4
2057
  * Parameters of fonts are shown in the description of function 4
2065
    (text output).
2058
    (text output).
2066
 
2059
 
2067
======================================================================
2060
======================================================================
2068
========= Function 48, subfunction 0 - apply screen settings. ========
2061
========= Function 48, subfunction 0 - apply screen settings. ========
2069
======================================================================
2062
======================================================================
2070
Parameters:
2063
Parameters:
2071
  * eax = 48 - function number
2064
  * eax = 48 - function number
2072
  * ebx = 0 - subfunction number
2065
  * ebx = 0 - subfunction number
2073
  * ecx = 0 - reserved
2066
  * ecx = 0 - reserved
2074
Returned value:
2067
Returned value:
2075
  * function does not return value
2068
  * function does not return value
2076
Remarks:
2069
Remarks:
2077
  * Function redraws the screen after parameters change by
2070
  * Function redraws the screen after parameters change by
2078
    subfunctions 1 and 2.
2071
    subfunctions 1 and 2.
2079
  * Function call without prior call to one of indicated subfunctions
2072
  * Function call without prior call to one of indicated subfunctions
2080
    is ignored.
2073
    is ignored.
2081
  * Function call with nonzero ecx is ignored.
2074
  * Function call with nonzero ecx is ignored.
2082
 
2075
 
2083
======================================================================
2076
======================================================================
2084
=========== Function 48, subfunction 1 - set button style. ===========
2077
=========== Function 48, subfunction 1 - set button style. ===========
2085
======================================================================
2078
======================================================================
2086
Parameters:
2079
Parameters:
2087
  * eax = 48 - function number
2080
  * eax = 48 - function number
2088
  * ebx = 1 - subfunction number
2081
  * ebx = 1 - subfunction number
2089
  * ecx = button style:
2082
  * ecx = button style:
2090
    * 0 = flat
2083
    * 0 = flat
2091
    * 1 = 3d
2084
    * 1 = 3d
2092
Returned value:
2085
Returned value:
2093
  * function does not return value
2086
  * function does not return value
2094
Remarks:
2087
Remarks:
2095
  * After call to this function one should redraw the screen by
2088
  * After call to this function one should redraw the screen by
2096
    subfunction 0.
2089
    subfunction 0.
2097
  * Button style influences only to their draw of function 8.
2090
  * Button style influences only to their draw of function 8.
2098
 
2091
 
2099
======================================================================
2092
======================================================================
2100
====== Function 48, subfunction 2 - set standard window colors. ======
2093
====== Function 48, subfunction 2 - set standard window colors. ======
2101
======================================================================
2094
======================================================================
2102
Parameters:
2095
Parameters:
2103
  * eax = 48 - function number
2096
  * eax = 48 - function number
2104
  * ebx = 2 - subfunction number
2097
  * ebx = 2 - subfunction number
2105
  * ecx = pointer to the color table
2098
  * ecx = pointer to the color table
2106
  * edx = size of the color table
2099
  * edx = size of the color table
2107
    (must be 40 bytes for future compatibility)
2100
    (must be 40 bytes for future compatibility)
2108
Format of the color table is shown in description of subfunction 3.
2101
Format of the color table is shown in description of subfunction 3.
2109
Returned value:
2102
Returned value:
2110
  * function does not return value
2103
  * function does not return value
2111
Remarks:
2104
Remarks:
2112
  * After call to this function one should redraw the screen by
2105
  * After call to this function one should redraw the screen by
2113
    subfunction 0.
2106
    subfunction 0.
2114
  * Table of standard colors influences only to applications,
2107
  * Table of standard colors influences only to applications,
2115
    which receive this table obviously (by subfunction 3)
2108
    which receive this table obviously (by subfunction 3)
2116
    and use it (specifying colors from it to drawing functions).
2109
    and use it (specifying colors from it to drawing functions).
2117
  * Table of standard colors is included in skin and is installed
2110
  * Table of standard colors is included in skin and is installed
2118
    anew with skin installation (by subfunction 8).
2111
    anew with skin installation (by subfunction 8).
2119
  * Color table can be viewed/changed interactively with
2112
  * Color table can be viewed/changed interactively with
2120
    the application 'desktop'.
2113
    the application 'desktop'.
2121
 
2114
 
2122
======================================================================
2115
======================================================================
2123
====== Function 48, subfunction 3 - get standard window colors. ======
2116
====== Function 48, subfunction 3 - get standard window colors. ======
2124
======================================================================
2117
======================================================================
2125
Parameters:
2118
Parameters:
2126
  * eax = 48 - function number
2119
  * eax = 48 - function number
2127
  * ebx = 3 - subfunction number
2120
  * ebx = 3 - subfunction number
2128
  * ecx = pointer to the buffer with size edx bytes,
2121
  * ecx = pointer to the buffer with size edx bytes,
2129
    where table will be written
2122
    where table will be written
2130
  * edx = size of color table
2123
  * edx = size of color table
2131
    (must be 40 bytes for future compatibility)
2124
    (must be 40 bytes for future compatibility)
2132
Returned value:
2125
Returned value:
2133
  * function does not return value
2126
  * function does not return value
2134
Format of the color table:
2127
Format of the color table:
2135
each item is dword-value for color 0x00RRGGBB
2128
each item is dword-value for color 0x00RRGGBB
2136
  * +0: dword: frames - color of frame
2129
  * +0: dword: frames - color of frame
2137
  * +4: dword: grab - color of header
2130
  * +4: dword: grab - color of header
2138
  * +8: dword: grab_button - color of button on header bar
2131
  * +8: dword: grab_button - color of button on header bar
2139
  * +12 = +0xC: dword: grab_button_text - color of text on button
2132
  * +12 = +0xC: dword: grab_button_text - color of text on button
2140
    on header bar
2133
    on header bar
2141
  * +16 = +0x10: dword: grab_text - color of text on header
2134
  * +16 = +0x10: dword: grab_text - color of text on header
2142
  * +20 = +0x14: dword: work - color of working area
2135
  * +20 = +0x14: dword: work - color of working area
2143
  * +24 = +0x18: dword: work_button - color of button in working area
2136
  * +24 = +0x18: dword: work_button - color of button in working area
2144
  * +28 = +0x1C: dword: work_button_text - color of text on button
2137
  * +28 = +0x1C: dword: work_button_text - color of text on button
2145
    in working area
2138
    in working area
2146
  * +32 = +0x20: dword: work_text - color of text in working area
2139
  * +32 = +0x20: dword: work_text - color of text in working area
2147
  * +36 = +0x24: dword: work_graph - color of graphics in working area
2140
  * +36 = +0x24: dword: work_graph - color of graphics in working area
2148
Remarks:
2141
Remarks:
2149
  * Structure of the color table is described in the standard
2142
  * Structure of the color table is described in the standard
2150
    include file 'macros.inc' as 'system_colors'; for example,
2143
    include file 'macros.inc' as 'system_colors'; for example,
2151
    it is possible to write:
2144
    it is possible to write:
2152
    	sc	system_colors		; variable declaration
2145
    	sc	system_colors		; variable declaration
2153
    	...				; somewhere one must call
2146
    	...				; somewhere one must call
2154
    					; this function with ecx=sc
2147
    					; this function with ecx=sc
2155
    	mov	ecx, [sc.work_button_text]	; read text color on
2148
    	mov	ecx, [sc.work_button_text]	; read text color on
2156
    					; buttin in working area
2149
    					; buttin in working area
2157
  * A program itself desides to use or not to use color table.
2150
  * A program itself desides to use or not to use color table.
2158
    For usage program must simply at calls to drawing functions select
2151
    For usage program must simply at calls to drawing functions select
2159
    color taken from the table.
2152
    color taken from the table.
2160
  * At change of the table of standard colors (by subfunction 2 with
2153
  * At change of the table of standard colors (by subfunction 2 with
2161
    the subsequent application of changes by subfunction 0 or
2154
    the subsequent application of changes by subfunction 0 or
2162
    at skin set by subfunction 8) the system sends to all windows
2155
    at skin set by subfunction 8) the system sends to all windows
2163
    redraw message (the event with code 1).
2156
    redraw message (the event with code 1).
2164
  * Color table can be viewed/changed interactively with
2157
  * Color table can be viewed/changed interactively with
2165
    the application 'desktop'.
2158
    the application 'desktop'.
2166
 
2159
 
2167
======================================================================
2160
======================================================================
2168
============ Function 48, subfunction 4 - get skin height. ===========
2161
============ Function 48, subfunction 4 - get skin height. ===========
2169
======================================================================
2162
======================================================================
2170
Parameters:
2163
Parameters:
2171
  * eax = 48 - function number
2164
  * eax = 48 - function number
2172
  * ebx = 4 - subfunction number
2165
  * ebx = 4 - subfunction number
2173
Returned value:
2166
Returned value:
2174
  * eax = skin height
2167
  * eax = skin height
2175
Remarks:
2168
Remarks:
2176
  * Skin height is defined as the height of a header
2169
  * Skin height is defined as the height of a header
2177
    of skinned windows.
2170
    of skinned windows.
2178
  * See also general structure of window in the description
2171
  * See also general structure of window in the description
2179
    of function 0.
2172
    of function 0.
2180
 
2173
 
2181
======================================================================
2174
======================================================================
2182
======== Function 48, subfunction 5 - get screen working area. =======
2175
======== Function 48, subfunction 5 - get screen working area. =======
2183
======================================================================
2176
======================================================================
2184
Parameters:
2177
Parameters:
2185
  * eax = 48 - function number
2178
  * eax = 48 - function number
2186
  * ebx = 5 - subfunction number
2179
  * ebx = 5 - subfunction number
2187
Returned value:
2180
Returned value:
2188
  * eax = [left]*65536 + [right]
2181
  * eax = [left]*65536 + [right]
2189
  * ebx = [top]*65536 + [bottom]
2182
  * ebx = [top]*65536 + [bottom]
2190
Remarks:
2183
Remarks:
2191
  * The screen working area defines position and coordinates of
2184
  * The screen working area defines position and coordinates of
2192
    a maximized window.
2185
    a maximized window.
2193
  * The screen working area in view of normal work is all screen
2186
  * The screen working area in view of normal work is all screen
2194
    without system panel (the application '@panel').
2187
    without system panel (the application '@panel').
2195
  * (left,top) are coordinates of the left upper corner,
2188
  * (left,top) are coordinates of the left upper corner,
2196
    (right,bottom) are coordinates of the right lower one.
2189
    (right,bottom) are coordinates of the right lower one.
2197
    Thus the size of working area on x axis can be calculated by
2190
    Thus the size of working area on x axis can be calculated by
2198
    formula right-left+1, on y axis - by formula bottom-right+1.
2191
    formula right-left+1, on y axis - by formula bottom-right+1.
2199
  * See also function 14,
2192
  * See also function 14,
2200
    to get sizes of all screen.
2193
    to get sizes of all screen.
2201
  * There is a pair function to set working area - subfunction 6.
2194
  * There is a pair function to set working area - subfunction 6.
2202
 
2195
 
2203
======================================================================
2196
======================================================================
2204
======== Function 48, subfunction 6 - set screen working area. =======
2197
======== Function 48, subfunction 6 - set screen working area. =======
2205
======================================================================
2198
======================================================================
2206
Parameters:
2199
Parameters:
2207
  * eax = 48 - function number
2200
  * eax = 48 - function number
2208
  * ebx = 6 - subfunction number
2201
  * ebx = 6 - subfunction number
2209
  * ecx = [left]*65536 + [right]
2202
  * ecx = [left]*65536 + [right]
2210
  * edx = [top]*65536 + [bottom]
2203
  * edx = [top]*65536 + [bottom]
2211
Returned value:
2204
Returned value:
2212
  * function does not return value
2205
  * function does not return value
2213
Remarks:
2206
Remarks:
2214
  * The screen working area defines position and coordinates of
2207
  * The screen working area defines position and coordinates of
2215
    a maximized window.
2208
    a maximized window.
2216
  * This function is used only by the application '@panel',
2209
  * This function is used only by the application '@panel',
2217
    which set working area to all screen without system panel.
2210
    which set working area to all screen without system panel.
2218
  * (left,top) are coordinates of the left upper corner,
2211
  * (left,top) are coordinates of the left upper corner,
2219
    (right,bottom) are coordinates of the right lower one.
2212
    (right,bottom) are coordinates of the right lower one.
2220
    Thus the size of working area on x axis can be calculated by
2213
    Thus the size of working area on x axis can be calculated by
2221
    formula right-left+1, on y axis - by formula bottom-right+1.
2214
    formula right-left+1, on y axis - by formula bottom-right+1.
2222
  * If 'left'>='right', x-coordinate of working area is not changed.
2215
  * If 'left'>='right', x-coordinate of working area is not changed.
2223
    If 'left'<0, 'left' will not be set. If 'right' is greater than or
2216
    If 'left'<0, 'left' will not be set. If 'right' is greater than or
2224
    equal to screen width, 'right' will not be set.
2217
    equal to screen width, 'right' will not be set.
2225
    Similarly on y axis.
2218
    Similarly on y axis.
2226
  * See also function 14,
2219
  * See also function 14,
2227
    to get sizes of all screen.
2220
    to get sizes of all screen.
2228
  * There is a pair function to get working area - subfunction 5.
2221
  * There is a pair function to get working area - subfunction 5.
2229
  * This function redraws the screen automatically,
2222
  * This function redraws the screen automatically,
2230
    updating coordinates and sizes of maximized windows.
2223
    updating coordinates and sizes of maximized windows.
2231
    The system sends to all windows redraw message (the event 1).
2224
    The system sends to all windows redraw message (the event 1).
2232
 
2225
 
2233
======================================================================
2226
======================================================================
2234
=========== Function 48, subfunction 7 - get skin margins. ===========
2227
=========== Function 48, subfunction 7 - get skin margins. ===========
2235
======================================================================
2228
======================================================================
2236
Returns the area of a header of a skinned window, intended for
2229
Returns the area of a header of a skinned window, intended for
2237
a text of a header.
2230
a text of a header.
2238
Parameters:
2231
Parameters:
2239
  * eax = 48 - function number
2232
  * eax = 48 - function number
2240
  * ebx = 7 - subfunction number
2233
  * ebx = 7 - subfunction number
2241
Returned value:
2234
Returned value:
2242
  * eax = [left]*65536 + [right]
2235
  * eax = [left]*65536 + [right]
2243
  * ebx = [top]*65536 + [bottom]
2236
  * ebx = [top]*65536 + [bottom]
2244
Remarks:
2237
Remarks:
2245
  * An application decides itself to use or not to use this function.
2238
  * An application decides itself to use or not to use this function.
2246
  * It is recommended to take into account returned value
2239
  * It is recommended to take into account returned value
2247
    of this function for choice of a place for drawing header text
2240
    of this function for choice of a place for drawing header text
2248
    (by function 4) or a substitute of header text
2241
    (by function 4) or a substitute of header text
2249
    (at the discretion of an application).
2242
    (at the discretion of an application).
2250
 
2243
 
2251
======================================================================
2244
======================================================================
2252
============= Function 48, subfunction 8 - set used skin. ============
2245
============= Function 48, subfunction 8 - set used skin. ============
2253
======================================================================
2246
======================================================================
2254
Parameters:
2247
Parameters:
2255
  * eax = 48 - function number
2248
  * eax = 48 - function number
2256
  * ebx = 8 - subfunction number
2249
  * ebx = 8 - subfunction number
2257
  * ecx = pointer to a block for function 58, in
2250
  * ecx = pointer to a block for function 58, in
2258
    which the fields of intermediate buffer and file name are filled
2251
    which the fields of intermediate buffer and file name are filled
2259
Returned value:
2252
Returned value:
2260
  * eax = 0 - success
2253
  * eax = 0 - success
2261
  * otherwise eax = file system error code; if file does not
2254
  * otherwise eax = file system error code; if file does not
2262
    contain valid skin, function returns error 3
2255
    contain valid skin, function returns error 3
2263
    (unknown file system).
2256
    (unknown file system).
2264
Remarks:
2257
Remarks:
2265
  * After successful skin loading the system sends to all windows
2258
  * After successful skin loading the system sends to all windows
2266
    redraw message (the event 1).
2259
    redraw message (the event 1).
2267
  * At booting the system reads skin from file 'default.skn'
2260
  * At booting the system reads skin from file 'default.skn'
2268
    on ramdisk.
2261
    on ramdisk.
2269
  * User can change the skin statically by creating hisself
2262
  * User can change the skin statically by creating hisself
2270
    'default.skn' or dynamically with the application 'desktop'.
2263
    'default.skn' or dynamically with the application 'desktop'.
2271
 
2264
 
2272
======================================================================
2265
======================================================================
2273
=========== Function 49 - Advanced Power Management (APM). ===========
2266
=========== Function 49 - Advanced Power Management (APM). ===========
2274
======================================================================
2267
======================================================================
2275
Parameters:
2268
Parameters:
2276
  * eax = 49 - function number
2269
  * eax = 49 - function number
2277
  * dx = number of the APM function
2270
  * dx = number of the APM function
2278
    (analogue of ax in APM specification)
2271
    (analogue of ax in APM specification)
2279
  * bx, cx = parameters of the APM function
2272
  * bx, cx = parameters of the APM function
2280
Returned value:
2273
Returned value:
2281
  * 16-bit registers ax, bx, cx, dx, si, di and carry flag CF
2274
  * 16-bit registers ax, bx, cx, dx, si, di and carry flag CF
2282
    are set according to the APM specification
2275
    are set according to the APM specification
2283
  * high halves of 32-bit registers eax, ebx, ecx,
2276
  * high halves of 32-bit registers eax, ebx, ecx,
2284
    edx, esi, edi are destroyed
2277
    edx, esi, edi are destroyed
2285
Remarks:
2278
Remarks:
2286
  * APM 1.2 specification is described in the document
2279
  * APM 1.2 specification is described in the document
2287
    "Advanced Power Management (APM) BIOS Specification"
2280
    "Advanced Power Management (APM) BIOS Specification"
2288
    (Revision 1.2), available at
2281
    (Revision 1.2), available at
2289
    http://www.microsoft.com/whdc/archive/amp_12.mspx;
2282
    http://www.microsoft.com/whdc/archive/amp_12.mspx;
2290
    besides it is included in famous Interrupt List by Ralf Brown
2283
    besides it is included in famous Interrupt List by Ralf Brown
2291
    (http://www.pobox.com/~ralf/files.html,
2284
    (http://www.pobox.com/~ralf/files.html,
2292
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/).
2285
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/).
2293
 
2286
 
2294
======================================================================
2287
======================================================================
2295
=================== Function 50 - set window shape. ==================
2288
=================== Function 50 - set window shape. ==================
2296
======================================================================
2289
======================================================================
2297
Normal windows have rectangular shape. This function can give to
2290
Normal windows have rectangular shape. This function can give to
2298
a window any shape. The shape is given by a set of points inside
2291
a window any shape. The shape is given by a set of points inside
2299
the base rectangle belonging to a window. Position and coordinates
2292
the base rectangle belonging to a window. Position and coordinates
2300
of the base rectangle are set by function 0
2293
of the base rectangle are set by function 0
2301
and changed by function 67.
2294
and changed by function 67.
2302
 
2295
 
2303
--------------------------- Set shape data ---------------------------
2296
--------------------------- Set shape data ---------------------------
2304
Parameters:
2297
Parameters:
2305
  * eax = 50 - function number
2298
  * eax = 50 - function number
2306
  * ebx = 0 - subfunction number
2299
  * ebx = 0 - subfunction number
2307
  * ecx = pointer to shape data (array of bytes 0/1)
2300
  * ecx = pointer to shape data (array of bytes 0/1)
2308
Returned value:
2301
Returned value:
2309
  * function does not return value
2302
  * function does not return value
2310
 
2303
 
2311
-------------------------- Set shape scale ---------------------------
2304
-------------------------- Set shape scale ---------------------------
2312
Parameters:
2305
Parameters:
2313
  * eax = 50 - function number
2306
  * eax = 50 - function number
2314
  * ebx = 1 - subfunction number
2307
  * ebx = 1 - subfunction number
2315
  * ecx sets a scale: each byte of data defines
2308
  * ecx sets a scale: each byte of data defines
2316
    (2^scale)*(2^scale) pixels
2309
    (2^scale)*(2^scale) pixels
2317
Returned value:
2310
Returned value:
2318
  * function does not return value
2311
  * function does not return value
2319
Remarks:
2312
Remarks:
2320
  * Default scale is 0 (scale factor is 1). If in the shape data
2313
  * Default scale is 0 (scale factor is 1). If in the shape data
2321
    one byte corresponds to one pixel, there is no necessity
2314
    one byte corresponds to one pixel, there is no necessity
2322
    to set scale.
2315
    to set scale.
2323
  * Let's designate xsize = window width (in pixels), ysize = height;
2316
  * Let's designate xsize = window width (in pixels), ysize = height;
2324
    pay attention, that they are one pixel more than defined by
2317
    pay attention, that they are one pixel more than defined by
2325
    functions 0, 67.
2318
    functions 0, 67.
2326
  * On definition of scale xsize and ysize must be divisible
2319
  * On definition of scale xsize and ysize must be divisible
2327
    on 2^scale.
2320
    on 2^scale.
2328
  * Byte of data on offset 'a' must be 0/1 and defines belonging
2321
  * Byte of data on offset 'a' must be 0/1 and defines belonging
2329
    to a window of square with the side 2^scale (if scale=0,
2322
    to a window of square with the side 2^scale (if scale=0,
2330
    this is one pixel) and coordinates of the left upper corner
2323
    this is one pixel) and coordinates of the left upper corner
2331
    (a mod (xsize shr scale), a div (xsize shr scale))
2324
    (a mod (xsize shr scale), a div (xsize shr scale))
2332
  * Data size: (xsize shr scale)*(ysize shr scale).
2325
  * Data size: (xsize shr scale)*(ysize shr scale).
2333
  * Data must be presented in the memory and not change
2326
  * Data must be presented in the memory and not change
2334
    after set of shape.
2327
    after set of shape.
2335
  * The system views the shape data at every window redraw by
2328
  * The system views the shape data at every window redraw by
2336
    function 0.
2329
    function 0.
2337
  * The call of subfunction 0 with NULL pointer results in return
2330
  * The call of subfunction 0 with NULL pointer results in return
2338
    to the rectangular shape.
2331
    to the rectangular shape.
2339
 
2332
 
2340
======================================================================
2333
======================================================================
2341
==================== Function 51 - create thread. ====================
2334
==================== Function 51 - create thread. ====================
2342
======================================================================
2335
======================================================================
2343
Parameters:
2336
Parameters:
2344
  * eax = 51 - function number
2337
  * eax = 51 - function number
2345
  * ebx = 1 - unique subfunction
2338
  * ebx = 1 - unique subfunction
2346
  * ecx = address of thread entry point (starting eip)
2339
  * ecx = address of thread entry point (starting eip)
2347
  * edx = pointer to thread stack (starting esp)
2340
  * edx = pointer to thread stack (starting esp)
2348
Returned value:
2341
Returned value:
2349
  * eax = -1 - error (there is too many threads)
2342
  * eax = -1 - error (there is too many threads)
2350
  * otherwise eax = TID - thread identifier
2343
  * otherwise eax = TID - thread identifier
2351
         
2344
         
2352
 
2345
 
2353
======================================================================
2346
======================================================================
2354
=== Function 52, subfunction 0 - get network driver configuration. ===
2347
=== Function 52, subfunction 0 - get network driver configuration. ===
2355
======================================================================
2348
======================================================================
2356
Parameters:
2349
Parameters:
2357
  * eax = 52 - function number
2350
  * eax = 52 - function number
2358
  * ebx = 0 - subfunction number
2351
  * ebx = 0 - subfunction number
2359
Returned value:
2352
Returned value:
2360
  * eax = configuration dword
2353
  * eax = configuration dword
2361
Remarks:
2354
Remarks:
2362
  * Configuration dword can be set by subfunction 2.
2355
  * Configuration dword can be set by subfunction 2.
2363
  * The kernel does not use this variable. The value of this
2356
  * The kernel does not use this variable. The value of this
2364
    variable and working with it subfunctions 0 and 2 is represented
2357
    variable and working with it subfunctions 0 and 2 is represented
2365
    doubtful.
2358
    doubtful.
2366
 
2359
 
2367
======================================================================
2360
======================================================================
2368
========= Function 52, subfunction 1 - get local IP-address. =========
2361
========= Function 52, subfunction 1 - get local IP-address. =========
2369
======================================================================
2362
======================================================================
2370
Parameters:
2363
Parameters:
2371
  * eax = 52 - function number
2364
  * eax = 52 - function number
2372
  * ebx = 1 - subfunction number
2365
  * ebx = 1 - subfunction number
2373
Returned value:
2366
Returned value:
2374
  * eax = IP-address (4 bytes)
2367
  * eax = IP-address (4 bytes)
2375
Remarks:
2368
Remarks:
2376
  * Local IP-address is set by subfunction 3.
2369
  * Local IP-address is set by subfunction 3.
2377
 
2370
 
2378
======================================================================
2371
======================================================================
2379
=== Function 52, subfunction 2 - set network driver configuration. ===
2372
=== Function 52, subfunction 2 - set network driver configuration. ===
2380
======================================================================
2373
======================================================================
2381
Parameters:
2374
Parameters:
2382
  * eax = 52 - function number
2375
  * eax = 52 - function number
2383
  * ebx = 2 - subfunction number
2376
  * ebx = 2 - subfunction number
2384
  * ecx = configuration dword; if low 7 bits derivate the number 3,
2377
  * ecx = configuration dword; if low 7 bits derivate the number 3,
2385
    function [re-]initializes Ethernet-card, otherwise
2378
    function [re-]initializes Ethernet-card, otherwise
2386
    Ethernet turns off
2379
    Ethernet turns off
2387
Returned value:
2380
Returned value:
2388
  * if Ethernet-interface is not requested, function returns eax=2,
2381
  * if Ethernet-interface is not requested, function returns eax=2,
2389
    but this can be changed in future kernel versions
2382
    but this can be changed in future kernel versions
2390
  * if Ethernet-interface is requested, eax=0 means error
2383
  * if Ethernet-interface is requested, eax=0 means error
2391
    (absence of Ethernet-card), and nonzero value - success
2384
    (absence of Ethernet-card), and nonzero value - success
2392
Remarks:
2385
Remarks:
2393
  * Configuration dword can be read by subfunction 0.
2386
  * Configuration dword can be read by subfunction 0.
2394
  * The kernel does not use this variable. The value of this
2387
  * The kernel does not use this variable. The value of this
2395
    variable, subfunction 0 and part of subfunction 2, which set it,
2388
    variable, subfunction 0 and part of subfunction 2, which set it,
2396
    is represented doubtful.
2389
    is represented doubtful.
2397
 
2390
 
2398
======================================================================
2391
======================================================================
2399
========= Function 52, subfunction 3 - set local IP-address. =========
2392
========= Function 52, subfunction 3 - set local IP-address. =========
2400
======================================================================
2393
======================================================================
2401
Parameters:
2394
Parameters:
2402
  * eax = 52 - function number
2395
  * eax = 52 - function number
2403
  * ebx = 3 - subfunction number
2396
  * ebx = 3 - subfunction number
2404
  * ecx = IP-address (4 bytes)
2397
  * ecx = IP-address (4 bytes)
2405
Returned value:
2398
Returned value:
2406
  * the current implementation returns eax=3, but this can be changed
2399
  * the current implementation returns eax=3, but this can be changed
2407
    in future versions
2400
    in future versions
2408
Remarks:
2401
Remarks:
2409
  * Local IP-address can be get by subfunction 1.
2402
  * Local IP-address can be get by subfunction 1.
2410
 
2403
 
2411
======================================================================
2404
======================================================================
2412
= Function 52, subfunction 6 - add data to the stack of input queue. =
2405
= Function 52, subfunction 6 - add data to the stack of input queue. =
2413
======================================================================
2406
======================================================================
2414
Parameters:
2407
Parameters:
2415
  * eax = 52 - function number
2408
  * eax = 52 - function number
2416
  * ebx = 6 - subfunction number
2409
  * ebx = 6 - subfunction number
2417
  * edx = data size
2410
  * edx = data size
2418
  * esi = data pointer
2411
  * esi = data pointer
2419
Returned value:
2412
Returned value:
2420
  * eax = -1 - error
2413
  * eax = -1 - error
2421
  * eax = 0 - success
2414
  * eax = 0 - success
2422
Remarks:
2415
Remarks:
2423
  * This function is intended only for slow network drivers
2416
  * This function is intended only for slow network drivers
2424
    (PPP, SLIP).
2417
    (PPP, SLIP).
2425
  * Data size must not exceed 1500 bytes, though function
2418
  * Data size must not exceed 1500 bytes, though function
2426
    performs no checks on correctness.
2419
    performs no checks on correctness.
2427
 
2420
 
2428
======================================================================
2421
======================================================================
2429
 Function 52, subfunction 8 - read data from the network output queue. 
2422
 Function 52, subfunction 8 - read data from the network output queue. 
2430
======================================================================
2423
======================================================================
2431
Parameters:
2424
Parameters:
2432
  * eax = 52 - function number
2425
  * eax = 52 - function number
2433
  * ebx = 8 - subfunction number
2426
  * ebx = 8 - subfunction number
2434
  * esi = pointer to 1500-byte buffer
2427
  * esi = pointer to 1500-byte buffer
2435
Returned value:
2428
Returned value:
2436
  * eax = number of read bytes (in the current implementation
2429
  * eax = number of read bytes (in the current implementation
2437
    either 0 = no data or 1500)
2430
    either 0 = no data or 1500)
2438
  * data was copied in buffer
2431
  * data was copied in buffer
2439
Remarks:
2432
Remarks:
2440
  * This function is intended only for slow network drivers
2433
  * This function is intended only for slow network drivers
2441
    (PPP, SLIP).
2434
    (PPP, SLIP).
2442
 
2435
 
2443
======================================================================
2436
======================================================================
2444
============ Function 52, subfunction 9 - get gateway IP. ============
2437
============ Function 52, subfunction 9 - get gateway IP. ============
2445
======================================================================
2438
======================================================================
2446
Parameters:
2439
Parameters:
2447
  * eax = 52 - function number
2440
  * eax = 52 - function number
2448
  * ebx = 9 - subfunction number
2441
  * ebx = 9 - subfunction number
2449
Returned value:
2442
Returned value:
2450
  * eax = gateway IP (4 bytes)
2443
  * eax = gateway IP (4 bytes)
2451
 
2444
 
2452
======================================================================
2445
======================================================================
2453
=========== Function 52, subfunction 10 - get subnet mask. ===========
2446
=========== Function 52, subfunction 10 - get subnet mask. ===========
2454
======================================================================
2447
======================================================================
2455
Parameters:
2448
Parameters:
2456
  * eax = 52 - function number
2449
  * eax = 52 - function number
2457
  * ebx = 10 - subfunction number
2450
  * ebx = 10 - subfunction number
2458
Returned value:
2451
Returned value:
2459
  * eax = subnet mask
2452
  * eax = subnet mask
2460
 
2453
 
2461
======================================================================
2454
======================================================================
2462
============ Function 52, subfunction 11 - set gateway IP. ===========
2455
============ Function 52, subfunction 11 - set gateway IP. ===========
2463
======================================================================
2456
======================================================================
2464
Parameters:
2457
Parameters:
2465
  * eax = 52 - function number
2458
  * eax = 52 - function number
2466
  * ebx = 11 - subfunction number
2459
  * ebx = 11 - subfunction number
2467
  * ecx = gateway IP (4 bytes)
2460
  * ecx = gateway IP (4 bytes)
2468
Returned value:
2461
Returned value:
2469
  * the current implementation returns eax=11, but this can be changed
2462
  * the current implementation returns eax=11, but this can be changed
2470
    in future versions
2463
    in future versions
2471
 
2464
 
2472
======================================================================
2465
======================================================================
2473
=========== Function 52, subfunction 12 - set subnet mask. ===========
2466
=========== Function 52, subfunction 12 - set subnet mask. ===========
2474
======================================================================
2467
======================================================================
2475
Parameters:
2468
Parameters:
2476
  * eax = 52 - function number
2469
  * eax = 52 - function number
2477
  * ebx = 12 - subfunction number
2470
  * ebx = 12 - subfunction number
2478
  * ecx = subnet mask
2471
  * ecx = subnet mask
2479
Returned value:
2472
Returned value:
2480
  * the current implementation returns eax=12, but this can be changed
2473
  * the current implementation returns eax=12, but this can be changed
2481
    in future versions
2474
    in future versions
2482
 
2475
 
2483
======================================================================
2476
======================================================================
2484
============== Function 52, subfunction 13 - get DNS IP. =============
2477
============== Function 52, subfunction 13 - get DNS IP. =============
2485
======================================================================
2478
======================================================================
2486
Parameters:
2479
Parameters:
2487
  * eax = 52 - function number
2480
  * eax = 52 - function number
2488
  * ebx = 13 - subfunction number
2481
  * ebx = 13 - subfunction number
2489
Returned value:
2482
Returned value:
2490
  * eax = DNS IP (4 bytes)
2483
  * eax = DNS IP (4 bytes)
2491
 
2484
 
2492
======================================================================
2485
======================================================================
2493
============== Function 52, subfunction 14 - set DNS IP. =============
2486
============== Function 52, subfunction 14 - set DNS IP. =============
2494
======================================================================
2487
======================================================================
2495
Parameters:
2488
Parameters:
2496
  * eax = 52 - function number
2489
  * eax = 52 - function number
2497
  * ebx = 14 - subfunction number
2490
  * ebx = 14 - subfunction number
2498
  * ecx = DNS IP (4 bytes)
2491
  * ecx = DNS IP (4 bytes)
2499
Returned value:
2492
Returned value:
2500
  * the current implementation returns eax=14, but this can be changed
2493
  * the current implementation returns eax=14, but this can be changed
2501
    in future versions
2494
    in future versions
2502
 
2495
 
2503
======================================================================
2496
======================================================================
2504
======== Function 52, subfunction 15 - get local MAC address. ========
2497
======== Function 52, subfunction 15 - get local MAC address. ========
2505
======================================================================
2498
======================================================================
2506
Parameters:
2499
Parameters:
2507
  * eax = 52 - function number
2500
  * eax = 52 - function number
2508
  * ebx = 15 - subfunction number
2501
  * ebx = 15 - subfunction number
2509
  * ecx = 0 - read first 4 bytes,
2502
  * ecx = 0 - read first 4 bytes,
2510
    ecx = 4 - read last 2 bytes
2503
    ecx = 4 - read last 2 bytes
2511
Returned value:
2504
Returned value:
2512
  * for ecx=0: eax = first 4 bytes of MAC address
2505
  * for ecx=0: eax = first 4 bytes of MAC address
2513
  * for ecx=4: ax = last 2 bytes of MAC address,
2506
  * for ecx=4: ax = last 2 bytes of MAC address,
2514
               high half of eax is destroyed
2507
               high half of eax is destroyed
2515
  * for other ecx: eax = -1 indicates an error
2508
  * for other ecx: eax = -1 indicates an error
2516
 
2509
 
2517
======================================================================
2510
======================================================================
2518
============ Function 53, subfunction 0 - open UDP-socket. ===========
2511
============ Function 53, subfunction 0 - open UDP-socket. ===========
2519
======================================================================
2512
======================================================================
2520
Parameters:
2513
Parameters:
2521
  * eax = 53 - function number
2514
  * eax = 53 - function number
2522
  * ebx = 0 - subfunction number
2515
  * ebx = 0 - subfunction number
2523
  * ecx = local port (only low word is taken into account)
2516
  * ecx = local port (only low word is taken into account)
2524
  * edx = remote port (only low word is taken into account)
2517
  * edx = remote port (only low word is taken into account)
2525
  * esi = remote IP
2518
  * esi = remote IP
2526
Returned value:
2519
Returned value:
2527
  * eax = -1 = 0xFFFFFFFF - error; ebx destroyed
2520
  * eax = -1 = 0xFFFFFFFF - error; ebx destroyed
2528
  * eax = socket handle (some number which unambiguously identifies
2521
  * eax = socket handle (some number which unambiguously identifies
2529
    socket and have sense only for the system) - success;
2522
    socket and have sense only for the system) - success;
2530
    ebx destroyed
2523
    ebx destroyed
2531
 
2524
 
2532
======================================================================
2525
======================================================================
2533
=========== Function 53, subfunction 1 - close UDP-socket. ===========
2526
=========== Function 53, subfunction 1 - close UDP-socket. ===========
2534
======================================================================
2527
======================================================================
2535
Parameters:
2528
Parameters:
2536
  * eax = 53 - function number
2529
  * eax = 53 - function number
2537
  * ebx = 1 - subfunction number
2530
  * ebx = 1 - subfunction number
2538
  * ecx = socket handle
2531
  * ecx = socket handle
2539
Returned value:
2532
Returned value:
2540
  * eax = -1 - incorrect handle
2533
  * eax = -1 - incorrect handle
2541
  * eax = 0 - success
2534
  * eax = 0 - success
2542
  * ebx destroyed
2535
  * ebx destroyed
2543
Remarks:
2536
Remarks:
2544
  * The current implementation does not close automatically all
2537
  * The current implementation does not close automatically all
2545
    sockets of a thread at termination. In particular, one should not
2538
    sockets of a thread at termination. In particular, one should not
2546
    kill a thread with many opened sockets - there will be an outflow
2539
    kill a thread with many opened sockets - there will be an outflow
2547
    of resources.
2540
    of resources.
2548
  * The current implementation does no checks on correctness
2541
  * The current implementation does no checks on correctness
2549
    (function returns error only if thread tries to close not opened
2542
    (function returns error only if thread tries to close not opened
2550
    socket with correct handle).
2543
    socket with correct handle).
2551
 
2544
 
2552
======================================================================
2545
======================================================================
2553
============== Function 53, subfunction 2 - poll socket. =============
2546
============== Function 53, subfunction 2 - poll socket. =============
2554
======================================================================
2547
======================================================================
2555
Parameters:
2548
Parameters:
2556
  * eax = 53 - function number
2549
  * eax = 53 - function number
2557
  * ebx = 2 - subfunction number
2550
  * ebx = 2 - subfunction number
2558
  * ecx = socket handle
2551
  * ecx = socket handle
2559
Returned value:
2552
Returned value:
2560
  * eax = number of read bytes
2553
  * eax = number of read bytes
2561
  * ebx destroyed
2554
  * ebx destroyed
2562
Remarks:
2555
Remarks:
2563
  * There is no checks for correctness.
2556
  * There is no checks for correctness.
2564
 
2557
 
2565
======================================================================
2558
======================================================================
2566
========= Function 53, subfunction 3 - read byte from socket. ========
2559
========= Function 53, subfunction 3 - read byte from socket. ========
2567
======================================================================
2560
======================================================================
2568
Parameters:
2561
Parameters:
2569
  * eax = 53 - function number
2562
  * eax = 53 - function number
2570
  * ebx = 3 - subfunction number
2563
  * ebx = 3 - subfunction number
2571
  * ecx = socket handle
2564
  * ecx = socket handle
2572
Returned value:
2565
Returned value:
2573
  * if there is no read data: eax=0, bl=0,
2566
  * if there is no read data: eax=0, bl=0,
2574
    other bytes of ebx are destroyed
2567
    other bytes of ebx are destroyed
2575
  * if there are read data: eax=number of rest bytes
2568
  * if there are read data: eax=number of rest bytes
2576
    (possibly 0), bl=read byte, other bytes of ebx are destroyed
2569
    (possibly 0), bl=read byte, other bytes of ebx are destroyed
2577
Remarks:
2570
Remarks:
2578
  * There is no checks for correctness.
2571
  * There is no checks for correctness.
2579
 
2572
 
2580
======================================================================
2573
======================================================================
2581
========== Function 53, subfunction 4 - write to UDP-socket. =========
2574
========== Function 53, subfunction 4 - write to UDP-socket. =========
2582
======================================================================
2575
======================================================================
2583
Parameters:
2576
Parameters:
2584
  * eax = 53 - function number
2577
  * eax = 53 - function number
2585
  * ebx = 4 - subfunction number
2578
  * ebx = 4 - subfunction number
2586
  * ecx = socket handle
2579
  * ecx = socket handle
2587
  * edx = number of bytes to write
2580
  * edx = number of bytes to write
2588
  * esi = pointer to data to write
2581
  * esi = pointer to data to write
2589
Returned value:
2582
Returned value:
2590
  * eax = 0xffffffff - invalid handle
2583
  * eax = 0xffffffff - invalid handle
2591
  * eax = 0xffff - not enough memory
2584
  * eax = 0xffff - not enough memory
2592
  * eax = 0 - success
2585
  * eax = 0 - success
2593
  * ebx destroyed
2586
  * ebx destroyed
2594
Remarks:
2587
Remarks:
2595
  * Check on validity of handle is minimal - only not very incorrect
2588
  * Check on validity of handle is minimal - only not very incorrect
2596
    not opened handles are eliminated.
2589
    not opened handles are eliminated.
2597
  * Number of bytes to write must not exceed 1500-28, though
2590
  * Number of bytes to write must not exceed 1500-28, though
2598
    the appropriate check is not made.
2591
    the appropriate check is not made.
2599
 
2592
 
2600
======================================================================
2593
======================================================================
2601
============ Function 53, subfunction 5 - open TCP-socket. ===========
2594
============ Function 53, subfunction 5 - open TCP-socket. ===========
2602
======================================================================
2595
======================================================================
2603
Parameters:
2596
Parameters:
2604
  * eax = 53 - function number
2597
  * eax = 53 - function number
2605
  * ebx = 5 - subfunction number
2598
  * ebx = 5 - subfunction number
2606
  * ecx = local port (only low word is taken into account)
2599
  * ecx = local port (only low word is taken into account)
2607
  * edx = remote port (only low word is taken into account)
2600
  * edx = remote port (only low word is taken into account)
2608
  * esi = remote IP
2601
  * esi = remote IP
2609
  * edi = open mode: SOCKET_PASSIVE=0 or SOCKET_ACTIVE=1
2602
  * edi = open mode: SOCKET_PASSIVE=0 or SOCKET_ACTIVE=1
2610
Returned value:
2603
Returned value:
2611
  * eax = -1 = 0xFFFFFFFF - error; ebx destroys
2604
  * eax = -1 = 0xFFFFFFFF - error; ebx destroys
2612
  * eax = socket handle (some number which unambiguously identifies
2605
  * eax = socket handle (some number which unambiguously identifies
2613
    socket and have sense only for the system) - success;
2606
    socket and have sense only for the system) - success;
2614
    ebx destroyed
2607
    ebx destroyed
2615
 
2608
 
2616
======================================================================
2609
======================================================================
2617
========= Function 53, subfunction 6 - get TCP-socket status. ========
2610
========= Function 53, subfunction 6 - get TCP-socket status. ========
2618
======================================================================
2611
======================================================================
2619
Parameters:
2612
Parameters:
2620
  * eax = 53 - function number
2613
  * eax = 53 - function number
2621
  * ebx = 6 - subfunction number
2614
  * ebx = 6 - subfunction number
2622
  * ecx = socket handle
2615
  * ecx = socket handle
2623
Returned value:
2616
Returned value:
2624
  * eax = socket status: one of
2617
  * eax = socket status: one of
2625
  * TCB_LISTEN = 1
2618
  * TCB_LISTEN = 1
2626
  * TCB_SYN_SENT = 2
2619
  * TCB_SYN_SENT = 2
2627
  * TCB_SYN_RECEIVED = 3
2620
  * TCB_SYN_RECEIVED = 3
2628
  * TCB_ESTABLISHED = 4
2621
  * TCB_ESTABLISHED = 4
2629
  * TCB_FIN_WAIT_1 = 5
2622
  * TCB_FIN_WAIT_1 = 5
2630
  * TCB_FIN_WAIT_2 = 6
2623
  * TCB_FIN_WAIT_2 = 6
2631
  * TCB_CLOSE_WAIT = 7
2624
  * TCB_CLOSE_WAIT = 7
2632
  * TCB_CLOSING = 8
2625
  * TCB_CLOSING = 8
2633
  * TCB_LAST_ASK = 9
2626
  * TCB_LAST_ASK = 9
2634
  * TCB_TIME_WAIT = 10
2627
  * TCB_TIME_WAIT = 10
2635
  * TCB_CLOSED = 11
2628
  * TCB_CLOSED = 11
2636
  * ebx destroys
2629
  * ebx destroys
2637
Remarks:
2630
Remarks:
2638
  * There is no checks for correctness.
2631
  * There is no checks for correctness.
2639
 
2632
 
2640
======================================================================
2633
======================================================================
2641
========== Function 53, subfunction 7 - write to TCP-socket. =========
2634
========== Function 53, subfunction 7 - write to TCP-socket. =========
2642
======================================================================
2635
======================================================================
2643
Parameters:
2636
Parameters:
2644
  * eax = 53 - function number
2637
  * eax = 53 - function number
2645
  * ebx = 7 - subfunction number
2638
  * ebx = 7 - subfunction number
2646
  * ecx = socket handle
2639
  * ecx = socket handle
2647
  * edx = number of bytes to write
2640
  * edx = number of bytes to write
2648
  * esi = pointer to data to write
2641
  * esi = pointer to data to write
2649
Returned value:
2642
Returned value:
2650
  * eax = 0xffffffff - error
2643
  * eax = 0xffffffff - error
2651
  * eax = 0xffff - not enough memory
2644
  * eax = 0xffff - not enough memory
2652
  * eax = 0 - success
2645
  * eax = 0 - success
2653
  * ebx destroyed
2646
  * ebx destroyed
2654
Remarks:
2647
Remarks:
2655
  * Check on validity of handle is minimal - only not very incorrect
2648
  * Check on validity of handle is minimal - only not very incorrect
2656
    not opened handles are eliminated.
2649
    not opened handles are eliminated.
2657
  * Number of bytes to write must not exceed 1500-40, though
2650
  * Number of bytes to write must not exceed 1500-40, though
2658
    the appropriate check is not made.
2651
    the appropriate check is not made.
2659
 
2652
 
2660
======================================================================
2653
======================================================================
2661
=========== Function 53, subfunction 8 - close TCP-socket. ===========
2654
=========== Function 53, subfunction 8 - close TCP-socket. ===========
2662
======================================================================
2655
======================================================================
2663
Parameters:
2656
Parameters:
2664
  * eax = 53 - function number
2657
  * eax = 53 - function number
2665
  * ebx = 8 - subfunction number
2658
  * ebx = 8 - subfunction number
2666
  * ecx = socket handle
2659
  * ecx = socket handle
2667
Returned value:
2660
Returned value:
2668
  * eax = -1 - invalid handle
2661
  * eax = -1 - invalid handle
2669
  * eax = 0xffff - not enough memory for socket close packet
2662
  * eax = 0xffff - not enough memory for socket close packet
2670
  * eax = 0 - success
2663
  * eax = 0 - success
2671
  * in many cases eax is destroyed (the result of function 'queue'
2664
  * in many cases eax is destroyed (the result of function 'queue'
2672
    is returned) - probably this is bug, which will be corrected
2665
    is returned) - probably this is bug, which will be corrected
2673
  * ebx destroyed
2666
  * ebx destroyed
2674
Remarks:
2667
Remarks:
2675
  * The current implementation does not close automatically all
2668
  * The current implementation does not close automatically all
2676
    sockets of a thread at termination. In particular, one should not
2669
    sockets of a thread at termination. In particular, one should not
2677
    kill a thread with many opened sockets - there will be an outflow
2670
    kill a thread with many opened sockets - there will be an outflow
2678
    of resources.
2671
    of resources.
2679
  * The current implementation does no checks on correctness
2672
  * The current implementation does no checks on correctness
2680
    (function returns error only if thread tries to close not opened
2673
    (function returns error only if thread tries to close not opened
2681
    socket with correct handle).
2674
    socket with correct handle).
2682
 
2675
 
2683
======================================================================
2676
======================================================================
2684
=== Function 53, subfunction 9 - check whether local port is free. ===
2677
=== Function 53, subfunction 9 - check whether local port is free. ===
2685
======================================================================
2678
======================================================================
2686
Parameters:
2679
Parameters:
2687
  * eax = 53 - function number
2680
  * eax = 53 - function number
2688
  * ebx = 9 - subfunction number
2681
  * ebx = 9 - subfunction number
2689
  * ecx = local port number (low 16 bits are used only)
2682
  * ecx = local port number (low 16 bits are used only)
2690
Returned value:
2683
Returned value:
2691
  * eax = 0 - port is used
2684
  * eax = 0 - port is used
2692
  * eax = 1 - port is free
2685
  * eax = 1 - port is free
2693
  * ebx destroyed
2686
  * ebx destroyed
2694
 
2687
 
2695
======================================================================
2688
======================================================================
2696
===== Function 53, subfunction 10 - query Ethernet cable status. =====
2689
===== Function 53, subfunction 10 - query Ethernet cable status. =====
2697
======================================================================
2690
======================================================================
2698
Parameters:
2691
Parameters:
2699
  * eax = 53 - function number
2692
  * eax = 53 - function number
2700
  * ebx = 10 - subfunction number
2693
  * ebx = 10 - subfunction number
2701
Returned value:
2694
Returned value:
2702
  * al = -1 - a network driver is not loaded or
2695
  * al = -1 - a network driver is not loaded or
2703
              does not support this function
2696
              does not support this function
2704
  * al = 0 - Ethernet cable is unplugged
2697
  * al = 0 - Ethernet cable is unplugged
2705
  * al = 1 - Ethernet cable is plugged
2698
  * al = 1 - Ethernet cable is plugged
2706
Remarks:
2699
Remarks:
2707
  * The current kernel implementation supports this function
2700
  * The current kernel implementation supports this function
2708
    only for RTL8139 network cards.
2701
    only for RTL8139 network cards.
2709
 
2702
 
2710
======================================================================
2703
======================================================================
2711
===== Function 53, subfunction 10 - read data from stack.        =====
2704
===== Function 53, subfunction 10 - read data from stack.        =====
2712
======================================================================
2705
======================================================================
2713
Parameters:
2706
Parameters:
2714
  * eax = 53
2707
  * eax = 53
2715
  * ebx = 11
2708
  * ebx = 11
2716
  * ecx = socket number
2709
  * ecx = socket number
2717
  * edx = pointer to where data must be written
2710
  * edx = pointer to where data must be written
2718
  * esi = buffer size (max bytes of data to copy)
2711
  * esi = buffer size (max bytes of data to copy)
2719
Returned value: 
2712
Returned value: 
2720
  * eax = number of bytes copied
2713
  * eax = number of bytes copied
2721
Remarks:
2714
Remarks:
2722
  * if buffer size is zero, all data will be copied 
2715
  * if buffer size is zero, all data will be copied 
2723
    (this will be max 4096 bytes)
2716
    (this will be max 4096 bytes)
2724
 
2717
 
2725
======================================================================
2718
======================================================================
2726
= Function 53, subfunction 255 - debug information of network driver. 
2719
= Function 53, subfunction 255 - debug information of network driver. 
2727
======================================================================
2720
======================================================================
2728
Parameters:
2721
Parameters:
2729
  * eax = 53 - function number
2722
  * eax = 53 - function number
2730
  * ebx = 255 - subfunction number
2723
  * ebx = 255 - subfunction number
2731
  * ecx = type of requested information (see below)
2724
  * ecx = type of requested information (see below)
2732
Returned value:
2725
Returned value:
2733
  * eax = requested information
2726
  * eax = requested information
2734
  * ebx destroyed
2727
  * ebx destroyed
2735
Possible values for ecx:
2728
Possible values for ecx:
2736
  * 100: length of queue 0 (empty queue)
2729
  * 100: length of queue 0 (empty queue)
2737
  * 101: length of queue 1 (ip-out queue)
2730
  * 101: length of queue 1 (ip-out queue)
2738
  * 102: length of queue 2 (ip-in queue)
2731
  * 102: length of queue 2 (ip-in queue)
2739
  * 103: length of queue 3 (net1out queue)
2732
  * 103: length of queue 3 (net1out queue)
2740
  * 200: number of items in the ARP table
2733
  * 200: number of items in the ARP table
2741
  * 201: size of the ARP table (in items) (20 for current version)
2734
  * 201: size of the ARP table (in items) (20 for current version)
2742
  * 202: read item at edx of the ARP table to the temporary buffer,
2735
  * 202: read item at edx of the ARP table to the temporary buffer,
2743
    whence 5 following types take information;
2736
    whence 5 following types take information;
2744
    in this case eax is not defined
2737
    in this case eax is not defined
2745
  * 203: IP-address saved by type 202
2738
  * 203: IP-address saved by type 202
2746
  * 204: high dword of MAC-address saved by type 202
2739
  * 204: high dword of MAC-address saved by type 202
2747
  * 205: low word of MAC-address saved by type 202
2740
  * 205: low word of MAC-address saved by type 202
2748
  * 206: status word saved by type 202
2741
  * 206: status word saved by type 202
2749
  * 207: ttl word saved by type 202
2742
  * 207: ttl word saved by type 202
2750
  * 2: total number of received IP-packets
2743
  * 2: total number of received IP-packets
2751
  * 3: total number of transferred IP-packets
2744
  * 3: total number of transferred IP-packets
2752
  * 4: total number of dumped received packets
2745
  * 4: total number of dumped received packets
2753
  * 5: total number of received ARP-packets
2746
  * 5: total number of received ARP-packets
2754
  * 6: status of packet driver, 0=inactive, nonzero=active
2747
  * 6: status of packet driver, 0=inactive, nonzero=active
2755
 
2748
 
2756
======================================================================
2749
======================================================================
2757
========== Function 55, subfunction 0 - load data for SB16. ==========
2750
========== Function 55, subfunction 0 - load data for SB16. ==========
2758
======================================================================
2751
======================================================================
2759
Parameters:
2752
Parameters:
2760
  * eax = 55 - function number
2753
  * eax = 55 - function number
2761
  * ebx = 0 - subfunction number
2754
  * ebx = 0 - subfunction number
2762
  * ecx = pointer to data (is copied 64 kilobytes, is used as much as
2755
  * ecx = pointer to data (is copied 64 kilobytes, is used as much as
2763
    set by subfunction 2)
2756
    set by subfunction 2)
2764
Returned value:
2757
Returned value:
2765
  * function does not return value
2758
  * function does not return value
2766
Remarks:
2759
Remarks:
2767
  * Format and size of data are set by subfunction 2.
2760
  * Format and size of data are set by subfunction 2.
2768
 
2761
 
2769
======================================================================
2762
======================================================================
2770
======== Function 55, subfunction 1 - begin play data on SB16. =======
2763
======== Function 55, subfunction 1 - begin play data on SB16. =======
2771
======================================================================
2764
======================================================================
2772
Parameters:
2765
Parameters:
2773
  * eax = 55 - function number
2766
  * eax = 55 - function number
2774
  * ebx = 1 - subfunction number
2767
  * ebx = 1 - subfunction number
2775
Returned value:
2768
Returned value:
2776
  * function does not return value
2769
  * function does not return value
2777
Remarks:
2770
Remarks:
2778
  * Previously data must be loaded by subfunction 0 and
2771
  * Previously data must be loaded by subfunction 0 and
2779
    their format must be defined by subfunction 2.
2772
    their format must be defined by subfunction 2.
2780
  * Function returns control, when playing of data began; after that
2773
  * Function returns control, when playing of data began; after that
2781
    play goes independently from application (and does not use
2774
    play goes independently from application (and does not use
2782
    processor time at all).
2775
    processor time at all).
2783
  * Previously must be defined SB16 base port
2776
  * Previously must be defined SB16 base port
2784
    (by subfunction 4 of function 21) and DMA channel
2777
    (by subfunction 4 of function 21) and DMA channel
2785
    (by subfunction 10 of function 21).
2778
    (by subfunction 10 of function 21).
2786
 
2779
 
2787
======================================================================
2780
======================================================================
2788
======== Function 55, subfunction 2 - set format of SB16 data. =======
2781
======== Function 55, subfunction 2 - set format of SB16 data. =======
2789
======================================================================
2782
======================================================================
2790
Parameters:
2783
Parameters:
2791
  * eax = 55 - function number
2784
  * eax = 55 - function number
2792
  * ebx = 2 - subfunction number
2785
  * ebx = 2 - subfunction number
2793
  * ecx = 0 - set digit capacity
2786
  * ecx = 0 - set digit capacity
2794
    * edx = 1 - 8bit mono
2787
    * edx = 1 - 8bit mono
2795
    * edx = 2 - 8bit stereo
2788
    * edx = 2 - 8bit stereo
2796
  * ecx = 1 - set data size
2789
  * ecx = 1 - set data size
2797
    * edx = size in bytes
2790
    * edx = size in bytes
2798
  * ecx = 2 - set play frequency
2791
  * ecx = 2 - set play frequency
2799
    * edx = frequency
2792
    * edx = frequency
2800
Returned value:
2793
Returned value:
2801
  * function does not return value
2794
  * function does not return value
2802
Remarks:
2795
Remarks:
2803
  * When the system boots, it sets following default parameters:
2796
  * When the system boots, it sets following default parameters:
2804
    digit capacity - 8bit mono, size - 64 Kb, frequency - 44100 Hz.
2797
    digit capacity - 8bit mono, size - 64 Kb, frequency - 44100 Hz.
2805
    Nevertheless it is recommended to set necessary values obviously
2798
    Nevertheless it is recommended to set necessary values obviously
2806
    as they could be reset by some application.
2799
    as they could be reset by some application.
2807
 
2800
 
2808
======================================================================
2801
======================================================================
2809
 Function 55, subfunction 55 - begin to play data on built-in speaker. 
2802
 Function 55, subfunction 55 - begin to play data on built-in speaker. 
2810
======================================================================
2803
======================================================================
2811
Parameters:
2804
Parameters:
2812
  * eax = 55 - function number
2805
  * eax = 55 - function number
2813
  * ebx = 55 - subfunction number
2806
  * ebx = 55 - subfunction number
2814
  * esi = pointer to data
2807
  * esi = pointer to data
2815
Returned value:
2808
Returned value:
2816
  * eax = 0 - success
2809
  * eax = 0 - success
2817
  * eax = 55 - error (speaker is off or busy)
2810
  * eax = 55 - error (speaker is off or busy)
2818
Data is an array of items with variable length.
2811
Data is an array of items with variable length.
2819
Format of each item is defined by first byte:
2812
Format of each item is defined by first byte:
2820
  * 0 = end of data
2813
  * 0 = end of data
2821
  * 1..0x80 = sets sound duration on 1/100 of second; sound note
2814
  * 1..0x80 = sets sound duration on 1/100 of second; sound note
2822
    is defined by immediate value of frequency
2815
    is defined by immediate value of frequency
2823
    * following word (2 bytes) contains frequency divider;
2816
    * following word (2 bytes) contains frequency divider;
2824
      frequency is defined as 1193180/divider
2817
      frequency is defined as 1193180/divider
2825
  * 0x81 = invalid
2818
  * 0x81 = invalid
2826
  * 0x82..0xFF = note is defined by octave and number:
2819
  * 0x82..0xFF = note is defined by octave and number:
2827
    * duration in 1/100 of second = (first byte)-0x81
2820
    * duration in 1/100 of second = (first byte)-0x81
2828
    * there is one more byte;
2821
    * there is one more byte;
2829
    * (second byte)=0xFF - delay
2822
    * (second byte)=0xFF - delay
2830
    * otherwise it looks like a*0x10+b, where b=number of the note in
2823
    * otherwise it looks like a*0x10+b, where b=number of the note in
2831
      an octave from 1 to 12, a=number of octave (beginning from 0)
2824
      an octave from 1 to 12, a=number of octave (beginning from 0)
2832
Remarks:
2825
Remarks:
2833
  * Speaker play can be disabled/enabled by
2826
  * Speaker play can be disabled/enabled by
2834
    subfunction 8 of function 18.
2827
    subfunction 8 of function 18.
2835
  * Function returns control, having informed the system
2828
  * Function returns control, having informed the system
2836
    an information on request. Play itself goes independently from
2829
    an information on request. Play itself goes independently from
2837
    the program.
2830
    the program.
2838
  * The data must be kept in the memory at least up to the end
2831
  * The data must be kept in the memory at least up to the end
2839
    of play.
2832
    of play.
2840
 
2833
 
2841
======================================================================
2834
======================================================================
2842
================ Function 58 - work with file system. ================
2835
================ Function 58 - work with file system. ================
2843
======================================================================
2836
======================================================================
2844
Parameters:
2837
Parameters:
2845
  * eax = 58
2838
  * eax = 58
2846
  * ebx = pointer to the information structure
2839
  * ebx = pointer to the information structure
2847
Returned value:
2840
Returned value:
2848
  * eax = 0 - success; otherwise file system error code
2841
  * eax = 0 - success; otherwise file system error code
2849
  * some subfunctions return value in other registers too
2842
  * some subfunctions return value in other registers too
2850
General format of the information structure:
2843
General format of the information structure:
2851
  * +0: dword: subfunction number
2844
  * +0: dword: subfunction number
2852
  * +4: dword: number of block
2845
  * +4: dword: number of block
2853
  * +8: dword: size
2846
  * +8: dword: size
2854
  * +12 = +0xC: dword: pointer to data
2847
  * +12 = +0xC: dword: pointer to data
2855
  * +16 = +0x10: dword: pointer to a memory for system operations
2848
  * +16 = +0x10: dword: pointer to a memory for system operations
2856
    (4096 bytes)
2849
    (4096 bytes)
2857
  * +20 = +0x14: n db: ASCIIZ-string with the file name
2850
  * +20 = +0x14: n db: ASCIIZ-string with the file name
2858
Specifications - in documentation on the appropriate subfunction.
2851
Specifications - in documentation on the appropriate subfunction.
2859
Filename is case-insensitive for latin letters, russian letters
2852
Filename is case-insensitive for latin letters, russian letters
2860
must be capital.
2853
must be capital.
2861
Format of filename:
2854
Format of filename:
2862
/base/number/dir1/dir2/.../dirn/file,
2855
/base/number/dir1/dir2/.../dirn/file,
2863
where /base/number identifies device, on which file is located:
2856
where /base/number identifies device, on which file is located:
2864
one of
2857
one of
2865
  * /RD/1 = /RAMDISK/1 to access ramdisk
2858
  * /RD/1 = /RAMDISK/1 to access ramdisk
2866
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
2859
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
2867
    /FD/2 = /FLOPPYDISK/2 to access second one
2860
    /FD/2 = /FLOPPYDISK/2 to access second one
2868
  * /HD/x = /HARDDISK/x - obsolete variant of access to hard disk
2861
  * /HD/x = /HARDDISK/x - obsolete variant of access to hard disk
2869
    (in this case base is defined by subfunction 7 of function 21),
2862
    (in this case base is defined by subfunction 7 of function 21),
2870
    x - partition number (beginning from 1)
2863
    x - partition number (beginning from 1)
2871
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
2864
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
2872
    IDE0 (Primary Master), IDE1 (Primary Slave),
2865
    IDE0 (Primary Master), IDE1 (Primary Slave),
2873
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
2866
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
2874
    x - partition number on the selected hard drive, varies from 1
2867
    x - partition number on the selected hard drive, varies from 1
2875
    to 255 (on each hard drive the indexing starts from 1)
2868
    to 255 (on each hard drive the indexing starts from 1)
2876
Remarks:
2869
Remarks:
2877
  * In the first two cases it is also possible to use FIRST
2870
  * In the first two cases it is also possible to use FIRST
2878
    instead of 1, SECOND instead of 2, but it is not recommended
2871
    instead of 1, SECOND instead of 2, but it is not recommended
2879
    for convenience of transition to the future extensions.
2872
    for convenience of transition to the future extensions.
2880
  * Limitation n<=39 is imposed.
2873
  * Limitation n<=39 is imposed.
2881
  * Names of folders and file dir1,...,dirn,file must have the
2874
  * Names of folders and file dir1,...,dirn,file must have the
2882
    format 8.3: name no more than 8 characters, dot, extension no
2875
    format 8.3: name no more than 8 characters, dot, extension no
2883
    more than 3 characters. Trailing spaces are ignored, no other
2876
    more than 3 characters. Trailing spaces are ignored, no other
2884
    spaces is allowed. If name occupies equally 8 characters,
2877
    spaces is allowed. If name occupies equally 8 characters,
2885
    dot may be omitted (though it is not recommended to use this
2878
    dot may be omitted (though it is not recommended to use this
2886
    feature for convenience of transition to the future extensions).
2879
    feature for convenience of transition to the future extensions).
2887
  * This function does not support folders on ramdisk.
2880
  * This function does not support folders on ramdisk.
2888
Examples:
2881
Examples:
2889
  * '/RAMDISK/FIRST/KERNEL.ASM',0
2882
  * '/RAMDISK/FIRST/KERNEL.ASM',0
2890
    '/rd/1/kernel.asm',0
2883
    '/rd/1/kernel.asm',0
2891
  * '/HD0/1/kernel.asm',0
2884
  * '/HD0/1/kernel.asm',0
2892
  * '/hd0/1/menuet/pics/tanzania.bmp',0
2885
  * '/hd0/1/menuet/pics/tanzania.bmp',0
2893
Existing subfunctions:
2886
Existing subfunctions:
2894
  * subfunction 0 - read file/folder
2887
  * subfunction 0 - read file/folder
2895
  * subfunction 1 - rewrite file
2888
  * subfunction 1 - rewrite file
2896
  * subfunction 8 - LBA-read from device
2889
  * subfunction 8 - LBA-read from device
2897
  * subfunction 15 - get file system information
2890
  * subfunction 15 - get file system information
2898
 
2891
 
2899
======================================================================
2892
======================================================================
2900
=========== Function 58, subfunction 0 - read file/folder. ===========
2893
=========== Function 58, subfunction 0 - read file/folder. ===========
2901
======================================================================
2894
======================================================================
2902
Parameters:
2895
Parameters:
2903
  * eax = 58
2896
  * eax = 58
2904
  * ebx = pointer to the information structure
2897
  * ebx = pointer to the information structure
2905
Format of the information structure:
2898
Format of the information structure:
2906
  * +0: dword: 0 = subfunction number
2899
  * +0: dword: 0 = subfunction number
2907
  * +4: dword: first block to read (beginning from 0)
2900
  * +4: dword: first block to read (beginning from 0)
2908
  * +8: dword: amount of blocks to read
2901
  * +8: dword: amount of blocks to read
2909
  * +12 = +0xC: dword: pointer to buffer for data
2902
  * +12 = +0xC: dword: pointer to buffer for data
2910
  * +16 = +0x10: dword: pointer to buffer for system operations
2903
  * +16 = +0x10: dword: pointer to buffer for system operations
2911
    (4096 bytes)
2904
    (4096 bytes)
2912
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2905
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2913
    given in the general description
2906
    given in the general description
2914
Returned value:
2907
Returned value:
2915
  * eax = 0 - success, otherwise file system error code
2908
  * eax = 0 - success, otherwise file system error code
2916
  * ebx = file size (in bytes) or -1=0xffffffff, if file was not found
2909
  * ebx = file size (in bytes) or -1=0xffffffff, if file was not found
2917
Remarks:
2910
Remarks:
2918
  * Block size is 512 bytes.
2911
  * Block size is 512 bytes.
2919
  * This function is obsolete, for reading files use subfunction 0
2912
  * This function is obsolete, for reading files use subfunction 0
2920
    of function 70, for reading folders - subfunction 1 of
2913
    of function 70, for reading folders - subfunction 1 of
2921
    function 70.
2914
    function 70.
2922
  * Function can read contents of a folder. Only FAT file system is
2915
  * Function can read contents of a folder. Only FAT file system is
2923
    supported. The format of FAT-folder is described
2916
    supported. The format of FAT-folder is described
2924
    in any FAT documentation.
2917
    in any FAT documentation.
2925
  * Size of a folder is determined by size of FAT clusters chain.
2918
  * Size of a folder is determined by size of FAT clusters chain.
2926
  * If file was ended before last requested block was read,
2919
  * If file was ended before last requested block was read,
2927
    the function will read as many as it can, and after that return
2920
    the function will read as many as it can, and after that return
2928
    eax=6 (EOF).
2921
    eax=6 (EOF).
2929
  * Function can read root folders /rd/1,/fd/x,/hd[n]/x, but
2922
  * Function can read root folders /rd/1,/fd/x,/hd[n]/x, but
2930
    in the first two cases the current implementation does not follow
2923
    in the first two cases the current implementation does not follow
2931
    to the declared rules:
2924
    to the declared rules:
2932
    for /rd/1:
2925
    for /rd/1:
2933
    * if one want to read 0 blocks, function considers,
2926
    * if one want to read 0 blocks, function considers,
2934
      that he requested 1;
2927
      that he requested 1;
2935
    * if one requests more than 14 blocks or starting block is
2928
    * if one requests more than 14 blocks or starting block is
2936
      not less than 14, function returns eax=5 (not found) è ebx=-1;
2929
      not less than 14, function returns eax=5 (not found) è ebx=-1;
2937
    * size of ramdisk root folder is 14 blocks, 
2930
    * size of ramdisk root folder is 14 blocks, 
2938
      0x1C00=7168 áàéò; but function returns ebx=0
2931
      0x1C00=7168 áàéò; but function returns ebx=0
2939
      (except of the case of previous item);
2932
      (except of the case of previous item);
2940
    * strangely enough, it is possible to read 14th block (which
2933
    * strangely enough, it is possible to read 14th block (which
2941
      generally contains a garbage - I remind, the indexing begins
2934
      generally contains a garbage - I remind, the indexing begins
2942
      from 0);
2935
      from 0);
2943
    * if some block with the number not less than 14 was requested,
2936
    * if some block with the number not less than 14 was requested,
2944
      function returns eax=6(EOF); otherwise eax=0.
2937
      function returns eax=6(EOF); otherwise eax=0.
2945
    For /fd/x:
2938
    For /fd/x:
2946
    * if the start block is not less than 14, function returns
2939
    * if the start block is not less than 14, function returns
2947
      eax=5 (not found) and ebx=0;
2940
      eax=5 (not found) and ebx=0;
2948
    * note that format of FAT12 allows floppies with the root size
2941
    * note that format of FAT12 allows floppies with the root size
2949
      more or less than 14 blocks;
2942
      more or less than 14 blocks;
2950
    * check for length is not performed;
2943
    * check for length is not performed;
2951
    * if data was successful read, function returns
2944
    * if data was successful read, function returns
2952
      eax=0,ebx=0; otherwise eax=10 (access denied), ebx=-1.
2945
      eax=0,ebx=0; otherwise eax=10 (access denied), ebx=-1.
2953
  * The function handles reading of special folders /,/rd,/fd,/hd[n];
2946
  * The function handles reading of special folders /,/rd,/fd,/hd[n];
2954
    but the result does not correspond to expected (on operations with
2947
    but the result does not correspond to expected (on operations with
2955
    normal files/folders), does not follow the declared rules,
2948
    normal files/folders), does not follow the declared rules,
2956
    may be changed in future versions of the kernel and consequently
2949
    may be changed in future versions of the kernel and consequently
2957
    is not described. To obtain the information about the equipment
2950
    is not described. To obtain the information about the equipment
2958
    use subfunction 11 of function 18 or
2951
    use subfunction 11 of function 18 or
2959
    read corresponding folder with subfunction 1 of function 70.
2952
    read corresponding folder with subfunction 1 of function 70.
2960
 
2953
 
2961
======================================================================
2954
======================================================================
2962
============= Function 58, subfunction 1 - rewrite file. =============
2955
============= Function 58, subfunction 1 - rewrite file. =============
2963
======================================================================
2956
======================================================================
2964
If the file does not exist, it is created.
2957
If the file does not exist, it is created.
2965
If the file exists, it is rewritten.
2958
If the file exists, it is rewritten.
2966
Parameters:
2959
Parameters:
2967
  * eax = 58 - function number
2960
  * eax = 58 - function number
2968
  * ebx = pointer to the information structure
2961
  * ebx = pointer to the information structure
2969
Format of the information structure:
2962
Format of the information structure:
2970
  * +0: dword: 1 = subfunction number
2963
  * +0: dword: 1 = subfunction number
2971
  * +4: dword: ignored (set to 0)
2964
  * +4: dword: ignored (set to 0)
2972
  * +8: dword: number of bytes to write
2965
  * +8: dword: number of bytes to write
2973
  * +12 = +0xC: dword: pointer to data to write
2966
  * +12 = +0xC: dword: pointer to data to write
2974
  * +16 = +0x10: dword: pointer to buffer for system operations
2967
  * +16 = +0x10: dword: pointer to buffer for system operations
2975
    (4096 bytes)
2968
    (4096 bytes)
2976
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2969
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2977
    given in the general description
2970
    given in the general description
2978
Returned value:
2971
Returned value:
2979
  * eax = 0 - success, otherwise file system error code
2972
  * eax = 0 - success, otherwise file system error code
2980
  * ebx destroyed
2973
  * ebx destroyed
2981
Remarks:
2974
Remarks:
2982
  * This function is obsolete, use subfunction 2 of function 70.
2975
  * This function is obsolete, use subfunction 2 of function 70.
2983
 
2976
 
2984
======================================================================
2977
======================================================================
2985
========= Function 58, subfunction 8 - LBA-read from device. =========
2978
========= Function 58, subfunction 8 - LBA-read from device. =========
2986
======================================================================
2979
======================================================================
2987
Parameters:
2980
Parameters:
2988
  * eax = 58 - function number
2981
  * eax = 58 - function number
2989
  * ebx = pointer to the information structure
2982
  * ebx = pointer to the information structure
2990
Format of the information structure:
2983
Format of the information structure:
2991
  * +0: dword: 8 = subfunction number
2984
  * +0: dword: 8 = subfunction number
2992
  * +4: dword: number of block to read (beginning from 0)
2985
  * +4: dword: number of block to read (beginning from 0)
2993
  * +8: dword: ignored (set to 1)
2986
  * +8: dword: ignored (set to 1)
2994
  * +12 = +0xC: dword: pointer to buffer for data (512 bytes)
2987
  * +12 = +0xC: dword: pointer to buffer for data (512 bytes)
2995
  * +16 = +0x10: dword: pointer to buffer for system operations
2988
  * +16 = +0x10: dword: pointer to buffer for system operations
2996
    (4096 bytes)
2989
    (4096 bytes)
2997
  * +20 = +0x14: ASCIIZ-name of device: case-insensitive, one of
2990
  * +20 = +0x14: ASCIIZ-name of device: case-insensitive, one of
2998
    /rd/1 = /RamDisk/1, /hd/n = /HardDisk/n,
2991
    /rd/1 = /RamDisk/1, /hd/n = /HardDisk/n,
2999
    1<=n<=4 - number of device: 1=IDE0, ..., 4=IDE3.
2992
    1<=n<=4 - number of device: 1=IDE0, ..., 4=IDE3.
3000
    Instead of digits it is allowed, though not recommended for
2993
    Instead of digits it is allowed, though not recommended for
3001
    convenience of transition to future extensions, to use
2994
    convenience of transition to future extensions, to use
3002
    'first','second','third','fourth'.
2995
    'first','second','third','fourth'.
3003
Returned value:
2996
Returned value:
3004
  * for device name /hd/xxx, where xxx is not in the list above:
2997
  * for device name /hd/xxx, where xxx is not in the list above:
3005
    * eax = ebx = 1
2998
    * eax = ebx = 1
3006
  * for invalid device name (except for the previous case):
2999
  * for invalid device name (except for the previous case):
3007
    * eax = 5
3000
    * eax = 5
3008
    * ebx does not change
3001
    * ebx does not change
3009
  * if LBA-access is disabled by subfunction 11 of function 21:
3002
  * if LBA-access is disabled by subfunction 11 of function 21:
3010
    * eax = 2
3003
    * eax = 2
3011
    * ebx destroyed
3004
    * ebx destroyed
3012
  * for ramdisk: attempt to read block outside ramdisk
3005
  * for ramdisk: attempt to read block outside ramdisk
3013
    (18*2*80 blocks) results in
3006
    (18*2*80 blocks) results in
3014
    * eax = 3
3007
    * eax = 3
3015
    * ebx = 0
3008
    * ebx = 0
3016
  * for successful read:
3009
  * for successful read:
3017
    * eax = ebx = 0
3010
    * eax = ebx = 0
3018
Remarks:
3011
Remarks:
3019
  * Block size is 512 bytes; function reads one block.
3012
  * Block size is 512 bytes; function reads one block.
3020
  * Do not depend on returned value, it can be changed
3013
  * Do not depend on returned value, it can be changed
3021
    in future versions.
3014
    in future versions.
3022
  * Function requires that LBA-access to devices is enabled by 
3015
  * Function requires that LBA-access to devices is enabled by 
3023
    subfunction 11 of function 21. To check this one can use 
3016
    subfunction 11 of function 21. To check this one can use 
3024
    subfunction 11 of function 26.
3017
    subfunction 11 of function 26.
3025
  * LBA-read of floppy is not supported.
3018
  * LBA-read of floppy is not supported.
3026
  * Function reads data on physical hard drive; if for any reason
3019
  * Function reads data on physical hard drive; if for any reason
3027
    data of the concrete partition are required, application must
3020
    data of the concrete partition are required, application must
3028
    define starting sector of this partition (either directly
3021
    define starting sector of this partition (either directly
3029
    through MBR, or from the full structure returned by
3022
    through MBR, or from the full structure returned by
3030
    ïîäôóíêöèåé 11 ôóíêöèè 18).
3023
    ïîäôóíêöèåé 11 ôóíêöèè 18).
3031
  * Function does not check error code of hard disk, so request of
3024
  * Function does not check error code of hard disk, so request of
3032
    nonexisting sector reads something (most probably it will be
3025
    nonexisting sector reads something (most probably it will be
3033
    zeroes, but this is defined by device) and this is considered
3026
    zeroes, but this is defined by device) and this is considered
3034
    as success (eax=0).
3027
    as success (eax=0).
3035
 
3028
 
3036
======================================================================
3029
======================================================================
3037
==== Function 58, subfunction 15 - get information on file system. ===
3030
==== Function 58, subfunction 15 - get information on file system. ===
3038
======================================================================
3031
======================================================================
3039
Parameters:
3032
Parameters:
3040
  * eax = 58 - function number
3033
  * eax = 58 - function number
3041
  * ebx = pointer to the information structure
3034
  * ebx = pointer to the information structure
3042
Format of the information structure:
3035
Format of the information structure:
3043
  * +0: dword: 15 = subfunction number
3036
  * +0: dword: 15 = subfunction number
3044
  * +4: dword: ignored
3037
  * +4: dword: ignored
3045
  * +8: dword: ignored
3038
  * +8: dword: ignored
3046
  * +12 = +0xC: dword: ignored
3039
  * +12 = +0xC: dword: ignored
3047
  * +16 = +0x10: dword: ignored
3040
  * +16 = +0x10: dword: ignored
3048
  * +20 = +0x14: (only second character is checked)
3041
  * +20 = +0x14: (only second character is checked)
3049
    /rd=/RAMDISK or /hd=/HARDDISK
3042
    /rd=/RAMDISK or /hd=/HARDDISK
3050
Returned value:
3043
Returned value:
3051
  * if the second character does not belong to set {'r','R','h','H'}:
3044
  * if the second character does not belong to set {'r','R','h','H'}:
3052
    * eax = 3
3045
    * eax = 3
3053
    * ebx = ecx = dword [fileinfo] = 0
3046
    * ebx = ecx = dword [fileinfo] = 0
3054
  * for ramdisk:
3047
  * for ramdisk:
3055
    * eax = 0 (success)
3048
    * eax = 0 (success)
3056
    * ebx = total number of clusters = 2847
3049
    * ebx = total number of clusters = 2847
3057
    * ecx = number of free clusters
3050
    * ecx = number of free clusters
3058
    * dword [fileinfo] = cluster size = 512
3051
    * dword [fileinfo] = cluster size = 512
3059
  * for hard disk: base and partition are defined by subfunctions
3052
  * for hard disk: base and partition are defined by subfunctions
3060
    7 and 8 of function 21:
3053
    7 and 8 of function 21:
3061
    * eax = 0 (success)
3054
    * eax = 0 (success)
3062
    * ebx = total number of clusters
3055
    * ebx = total number of clusters
3063
    * ecx = number of free clusters
3056
    * ecx = number of free clusters
3064
    * dword [fileinfo] = cluster size (in bytes)
3057
    * dword [fileinfo] = cluster size (in bytes)
3065
Remarks:
3058
Remarks:
3066
  * Be not surprised to strange layout of 4th returned parameter
3059
  * Be not surprised to strange layout of 4th returned parameter
3067
    - when this code was writing, at system calls application got
3060
    - when this code was writing, at system calls application got
3068
    only registers eax,ebx,ecx (from pushad-structure transmitted
3061
    only registers eax,ebx,ecx (from pushad-structure transmitted
3069
    as argument to the system function). Now it is corrected, so,
3062
    as argument to the system function). Now it is corrected, so,
3070
    probably, it is meaningful to return cluster size in edx, while
3063
    probably, it is meaningful to return cluster size in edx, while
3071
    this function is not used yet.
3064
    this function is not used yet.
3072
  * There exists also subfunction 11 of function 18,
3065
  * There exists also subfunction 11 of function 18,
3073
    which returns information on file system. From the full table
3066
    which returns information on file system. From the full table
3074
    of disk subsystem it is possible to deduce cluster size (there
3067
    of disk subsystem it is possible to deduce cluster size (there
3075
    it is stored in sectors) and total number of clusters
3068
    it is stored in sectors) and total number of clusters
3076
    for hard disks.
3069
    for hard disks.
3077
 
3070
 
3078
======================================================================
3071
======================================================================
3079
========== Function 60 - Inter Process Communication (IPC). ==========
3072
========== Function 60 - Inter Process Communication (IPC). ==========
3080
======================================================================
3073
======================================================================
3081
IPC is used for message dispatching from one process/thread to
3074
IPC is used for message dispatching from one process/thread to
3082
another. Previously it is necessary to agree how to interpret
3075
another. Previously it is necessary to agree how to interpret
3083
the concrete message.
3076
the concrete message.
3084
 
3077
 
3085
----------- Subfunction 1 - set the area for IPC receiving -----------
3078
----------- Subfunction 1 - set the area for IPC receiving -----------
3086
Is called by process-receiver.
3079
Is called by process-receiver.
3087
Parameters:
3080
Parameters:
3088
  * eax = 60 - function number
3081
  * eax = 60 - function number
3089
  * ebx = 1 - subfunction number
3082
  * ebx = 1 - subfunction number
3090
  * ecx = pointer to the buffer
3083
  * ecx = pointer to the buffer
3091
  * edx = size of the buffer
3084
  * edx = size of the buffer
3092
Returned value:
3085
Returned value:
3093
  * eax = 0 - always success
3086
  * eax = 0 - always success
3094
Format of IPC-buffer:
3087
Format of IPC-buffer:
3095
  * +0: dword: if nonzero, buffer is considered locked;
3088
  * +0: dword: if nonzero, buffer is considered locked;
3096
    lock/unlock the buffer, when you work with it and need that
3089
    lock/unlock the buffer, when you work with it and need that
3097
    buffer data are not changed from outside (no new messages)
3090
    buffer data are not changed from outside (no new messages)
3098
  * +4: dword: occupied place in the buffer (in bytes)
3091
  * +4: dword: occupied place in the buffer (in bytes)
3099
  * +8: first message
3092
  * +8: first message
3100
  * +8+n: second message
3093
  * +8+n: second message
3101
  * ...
3094
  * ...
3102
Format of a message:
3095
Format of a message:
3103
  * +0: dword: PID of sender
3096
  * +0: dword: PID of sender
3104
  * +4: dword: message length (not including this header)
3097
  * +4: dword: message length (not including this header)
3105
  * +8: n*byte: message data
3098
  * +8: n*byte: message data
3106
 
3099
 
3107
------------------ Subfunction 2 - send IPC message ------------------
3100
------------------ Subfunction 2 - send IPC message ------------------
3108
Is called by process-sender.
3101
Is called by process-sender.
3109
Parameters:
3102
Parameters:
3110
  * eax = 60 - function number
3103
  * eax = 60 - function number
3111
  * ebx = 2 - subfunction number
3104
  * ebx = 2 - subfunction number
3112
  * ecx = PID of receiver
3105
  * ecx = PID of receiver
3113
  * edx = pointer to the message data
3106
  * edx = pointer to the message data
3114
  * esi = message length (in bytes)
3107
  * esi = message length (in bytes)
3115
Returned value:
3108
Returned value:
3116
  * eax = 0 - success
3109
  * eax = 0 - success
3117
  * eax = 1 - the receiver has not defined buffer for IPC messages
3110
  * eax = 1 - the receiver has not defined buffer for IPC messages
3118
    (can be, still have no time,
3111
    (can be, still have no time,
3119
    and can be, this is not right process)
3112
    and can be, this is not right process)
3120
  * eax = 2 - the receiver has blocked IPC-buffer; try to wait a bit
3113
  * eax = 2 - the receiver has blocked IPC-buffer; try to wait a bit
3121
  * eax = 3 - overflow of IPC-buffer of the receiver
3114
  * eax = 3 - overflow of IPC-buffer of the receiver
3122
  * eax = 4 - process/thread with such PID does not exist
3115
  * eax = 4 - process/thread with such PID does not exist
3123
Remarks:
3116
Remarks:
3124
  * Immediately after writing of IPC-message to the buffer the system
3117
  * Immediately after writing of IPC-message to the buffer the system
3125
    sends to the receiver the event with code 7 (see event codes).
3118
    sends to the receiver the event with code 7 (see event codes).
3126
 
3119
 
3127
======================================================================
3120
======================================================================
3128
==== Function 61 - get parameters for the direct graphics access. ====
3121
==== Function 61 - get parameters for the direct graphics access. ====
3129
======================================================================
3122
======================================================================
3130
The data of the graphics screen (the memory area which displays
3123
The data of the graphics screen (the memory area which displays
3131
screen contents) are accessible to a program directly, without
3124
screen contents) are accessible to a program directly, without
3132
any system calls, through the selector gs:
3125
any system calls, through the selector gs:
3133
	mov	eax, [gs:0]
3126
	mov	eax, [gs:0]
3134
places in eax the first dword of the buffer, which contains
3127
places in eax the first dword of the buffer, which contains
3135
information on color of the left upper point (and, possibly, colors
3128
information on color of the left upper point (and, possibly, colors
3136
of several following).
3129
of several following).
3137
	mov	[gs:0], eax
3130
	mov	[gs:0], eax
3138
by work in VESA modes with LFB sets color of the left upper point
3131
by work in VESA modes with LFB sets color of the left upper point
3139
(and, possibly, colors of several following).
3132
(and, possibly, colors of several following).
3140
To interpret the data of graphics screen program needs to know
3133
To interpret the data of graphics screen program needs to know
3141
some parameters, returning by this function.
3134
some parameters, returning by this function.
3142
Remarks:
3135
Remarks:
3143
  * Graphics parameters changes very seldom at work,
3136
  * Graphics parameters changes very seldom at work,
3144
    namely, only in cases, when user works with the application VRR.
3137
    namely, only in cases, when user works with the application VRR.
3145
  * At videomode change the system redraws all windows (event
3138
  * At videomode change the system redraws all windows (event
3146
    with code 1) and redraws the background (event 5).
3139
    with code 1) and redraws the background (event 5).
3147
    Same events occur in other cases too, which meet much more often,
3140
    Same events occur in other cases too, which meet much more often,
3148
    than videomode change.
3141
    than videomode change.
3149
  * By operation in videomodes with LFB the selector gs points to
3142
  * By operation in videomodes with LFB the selector gs points to
3150
    LFB itself, so reading/writing on gs result directly in
3143
    LFB itself, so reading/writing on gs result directly in
3151
    change of screen contents. By operation in videomodes without
3144
    change of screen contents. By operation in videomodes without
3152
    LFB gs points to some data area in the kernel, and all functions
3145
    LFB gs points to some data area in the kernel, and all functions
3153
    of screen output fulfil honesty double operation on writing
3146
    of screen output fulfil honesty double operation on writing
3154
    directly to the screen and writing to this buffer. In result
3147
    directly to the screen and writing to this buffer. In result
3155
    at reading contents of this buffer the results correspond to
3148
    at reading contents of this buffer the results correspond to
3156
    screen contents (with, generally speaking, large color
3149
    screen contents (with, generally speaking, large color
3157
    resolution), and writing is ignored.
3150
    resolution), and writing is ignored.
3158
    One exception is the mode 320*200, for which main loop of the
3151
    One exception is the mode 320*200, for which main loop of the
3159
    system thread updates the screen according to mouse movements.
3152
    system thread updates the screen according to mouse movements.
3160
 
3153
 
3161
------------------------- Screen resolution --------------------------
3154
------------------------- Screen resolution --------------------------
3162
Parameters:
3155
Parameters:
3163
  * eax = 61 - function number
3156
  * eax = 61 - function number
3164
  * ebx = 1 - subfunction number
3157
  * ebx = 1 - subfunction number
3165
Returned value:
3158
Returned value:
3166
  * eax = [resolution on x axis]*65536 + [resolution on y axis]
3159
  * eax = [resolution on x axis]*65536 + [resolution on y axis]
3167
Remarks:
3160
Remarks:
3168
  * One can use function 14 paying attention that
3161
  * One can use function 14 paying attention that
3169
    it returns sizes on 1 pixel less. It is fully equivalent way.
3162
    it returns sizes on 1 pixel less. It is fully equivalent way.
3170
 
3163
 
3171
---------------------- Number of bits per pixel ----------------------
3164
---------------------- Number of bits per pixel ----------------------
3172
Parameters:
3165
Parameters:
3173
  * eax = 61 - function number
3166
  * eax = 61 - function number
3174
  * ebx = 2 - subfunction number
3167
  * ebx = 2 - subfunction number
3175
Returned value:
3168
Returned value:
3176
  * eax = number of bits per pixel (24 or 32)
3169
  * eax = number of bits per pixel (24 or 32)
3177
 
3170
 
3178
-------------------- Number of bytes per scanline --------------------
3171
-------------------- Number of bytes per scanline --------------------
3179
Parameters:
3172
Parameters:
3180
  * eax = 61 - function number
3173
  * eax = 61 - function number
3181
  * ebx = 3 - subfunction number
3174
  * ebx = 3 - subfunction number
3182
Returned value:
3175
Returned value:
3183
  * eax = number of bytes occupied by one scanline
3176
  * eax = number of bytes occupied by one scanline
3184
    (horizontal line on the screen)
3177
    (horizontal line on the screen)
3185
 
3178
 
3186
======================================================================
3179
======================================================================
3187
===== Function 62, subfunction 0 - get version of PCI-interface. =====
3180
===== Function 62, subfunction 0 - get version of PCI-interface. =====
3188
======================================================================
3181
======================================================================
3189
Parameters:
3182
Parameters:
3190
  * eax = 62 - function number
3183
  * eax = 62 - function number
3191
  * bl = 0 - subfunction number
3184
  * bl = 0 - subfunction number
3192
Returned value:
3185
Returned value:
3193
  * eax = -1 - PCI access is disabled; otherwise
3186
  * eax = -1 - PCI access is disabled; otherwise
3194
  * ah.al = version of PCI-interface (ah=version, al=subversion)
3187
  * ah.al = version of PCI-interface (ah=version, al=subversion)
3195
  * high word of eax is zeroed
3188
  * high word of eax is zeroed
3196
Remarks:
3189
Remarks:
3197
  * Previously low-level access to PCI for applications must be
3190
  * Previously low-level access to PCI for applications must be
3198
    enabled by subfunction 12 of function 21.
3191
    enabled by subfunction 12 of function 21.
3199
  * If PCI BIOS is not supported, the value of ax is undefined.
3192
  * If PCI BIOS is not supported, the value of ax is undefined.
3200
 
3193
 
3201
======================================================================
3194
======================================================================
3202
==== Function 62, subfunction 1 - get number of the last PCI-bus. ====
3195
==== Function 62, subfunction 1 - get number of the last PCI-bus. ====
3203
======================================================================
3196
======================================================================
3204
Parameters:
3197
Parameters:
3205
  * eax = 62 - function number
3198
  * eax = 62 - function number
3206
  * bl = 1 - subfunction number
3199
  * bl = 1 - subfunction number
3207
Returned value:
3200
Returned value:
3208
  * eax = -1 - access to PCI is disabled; otherwise
3201
  * eax = -1 - access to PCI is disabled; otherwise
3209
  * al = number of the last PCI-bus; other bytes of eax are destroyed
3202
  * al = number of the last PCI-bus; other bytes of eax are destroyed
3210
Remarks:
3203
Remarks:
3211
  * Previously low-level access to PCI for applications must be
3204
  * Previously low-level access to PCI for applications must be
3212
    enabled by subfunction 12 of function 21.
3205
    enabled by subfunction 12 of function 21.
3213
  * If PCI BIOS is not supported, the value of ax is undefined.
3206
  * If PCI BIOS is not supported, the value of ax is undefined.
3214
 
3207
 
3215
======================================================================
3208
======================================================================
3216
===================== Function 62, subfunction 2 =====================
3209
===================== Function 62, subfunction 2 =====================
3217
===== Get mechanism of addressing to the PCI configuration space. ====
3210
===== Get mechanism of addressing to the PCI configuration space. ====
3218
======================================================================
3211
======================================================================
3219
Parameters:
3212
Parameters:
3220
  * eax = 62 - function number
3213
  * eax = 62 - function number
3221
  * bl = 2 - subfunction number
3214
  * bl = 2 - subfunction number
3222
Returned value:
3215
Returned value:
3223
  * eax = -1 - access to PCI is disabled; otherwise
3216
  * eax = -1 - access to PCI is disabled; otherwise
3224
  * al = mechanism (1 or 2); other bytes of eax are destroyed
3217
  * al = mechanism (1 or 2); other bytes of eax are destroyed
3225
Remarks:
3218
Remarks:
3226
  * Previously low-level access to PCI for applications must be
3219
  * Previously low-level access to PCI for applications must be
3227
    enabled by subfunction 12 of function 21.
3220
    enabled by subfunction 12 of function 21.
3228
  * Addressing mechanism is selected depending on
3221
  * Addressing mechanism is selected depending on
3229
    equipment characteristics.
3222
    equipment characteristics.
3230
  * Subfunctions of read and write work automatically
3223
  * Subfunctions of read and write work automatically
3231
    with the selected mechanism.
3224
    with the selected mechanism.
3232
 
3225
 
3233
======================================================================
3226
======================================================================
3234
======== Function 62, subfunctions 4,5,6 - read PCI-register. ========
3227
======== Function 62, subfunctions 4,5,6 - read PCI-register. ========
3235
======================================================================
3228
======================================================================
3236
Parameters:
3229
Parameters:
3237
  * eax = 62 - function number
3230
  * eax = 62 - function number
3238
  * bl = 4 - read byte
3231
  * bl = 4 - read byte
3239
  * bl = 5 - read word
3232
  * bl = 5 - read word
3240
  * bl = 6 - read dword
3233
  * bl = 6 - read dword
3241
  * bh = number of PCI-bus
3234
  * bh = number of PCI-bus
3242
  * ch = dddddfff, where ddddd = number of the device on the bus,
3235
  * ch = dddddfff, where ddddd = number of the device on the bus,
3243
    fff = function number of device
3236
    fff = function number of device
3244
  * cl = number of register (must be even for bl=5,
3237
  * cl = number of register (must be even for bl=5,
3245
    divisible by 4 for bl=6)
3238
    divisible by 4 for bl=6)
3246
Returned value:
3239
Returned value:
3247
  * eax = -1 - error (access to PCI is disabled or parameters
3240
  * eax = -1 - error (access to PCI is disabled or parameters
3248
    are not supported); otherwise
3241
    are not supported); otherwise
3249
  * al/ax/eax (depending on requested size) contains the data;
3242
  * al/ax/eax (depending on requested size) contains the data;
3250
    the other part of register eax is destroyed
3243
    the other part of register eax is destroyed
3251
Remarks:
3244
Remarks:
3252
  * Previously low-level access to PCI for applications must be
3245
  * Previously low-level access to PCI for applications must be
3253
    enabled by subfunction 12 of function 21.
3246
    enabled by subfunction 12 of function 21.
3254
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3247
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3255
    function number. To get access mechanism use subfunction 2.
3248
    function number. To get access mechanism use subfunction 2.
3256
  * Some registers are standard and exist for all devices, some are
3249
  * Some registers are standard and exist for all devices, some are
3257
    defined by the concrete device. The list of registers of the
3250
    defined by the concrete device. The list of registers of the
3258
    first type can be found e.g. in famous
3251
    first type can be found e.g. in famous
3259
    Interrupt List by Ralf Brown
3252
    Interrupt List by Ralf Brown
3260
    (http://www.pobox.com/~ralf/files.html,
3253
    (http://www.pobox.com/~ralf/files.html,
3261
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/);
3254
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/);
3262
    registers of the second type must be listed
3255
    registers of the second type must be listed
3263
    in the device documentation.
3256
    in the device documentation.
3264
 
3257
 
3265
======================================================================
3258
======================================================================
3266
====== Function 62, subfunctions 8,9,10 - write to PCI-register. =====
3259
====== Function 62, subfunctions 8,9,10 - write to PCI-register. =====
3267
======================================================================
3260
======================================================================
3268
Parameters:
3261
Parameters:
3269
  * eax = 62 - function number
3262
  * eax = 62 - function number
3270
  * bl = 8 - write byte
3263
  * bl = 8 - write byte
3271
  * bl = 9 - write word
3264
  * bl = 9 - write word
3272
  * bl = 10 - write dword
3265
  * bl = 10 - write dword
3273
  * bh = number of PCI-bus
3266
  * bh = number of PCI-bus
3274
  * ch = dddddfff, where ddddd = number of the device on the bus,
3267
  * ch = dddddfff, where ddddd = number of the device on the bus,
3275
    fff = function number of device
3268
    fff = function number of device
3276
  * cl = number of register (must be even for bl=9,
3269
  * cl = number of register (must be even for bl=9,
3277
    divisible by 4 for bl=10)
3270
    divisible by 4 for bl=10)
3278
  * dl/dx/edx (depending on requested size) contatins
3271
  * dl/dx/edx (depending on requested size) contatins
3279
    the data to write
3272
    the data to write
3280
Returned value:
3273
Returned value:
3281
  * eax = -1 - error (access to PCI is disabled or parameters
3274
  * eax = -1 - error (access to PCI is disabled or parameters
3282
    are not supported)
3275
    are not supported)
3283
  * eax = 0 - success
3276
  * eax = 0 - success
3284
Remarks:
3277
Remarks:
3285
  * Previously low-level access to PCI for applications must be
3278
  * Previously low-level access to PCI for applications must be
3286
    enabled by subfunction 12 of function 21.
3279
    enabled by subfunction 12 of function 21.
3287
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3280
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3288
    function number. To get access mechanism use subfunction 2.
3281
    function number. To get access mechanism use subfunction 2.
3289
  * Some registers are standard and exist for all devices, some are
3282
  * Some registers are standard and exist for all devices, some are
3290
    defined by the concrete device. The list of registers of the
3283
    defined by the concrete device. The list of registers of the
3291
    first type can be found e.g. in famous Interrupt List by
3284
    first type can be found e.g. in famous Interrupt List by
3292
    Ralf Brown; registers of the second type must be listed
3285
    Ralf Brown; registers of the second type must be listed
3293
    in the device documentation.
3286
    in the device documentation.
3294
 
3287
 
3295
======================================================================
3288
======================================================================
3296
============== Function 63 - work with the debug board. ==============
3289
============== Function 63 - work with the debug board. ==============
3297
======================================================================
3290
======================================================================
3298
The debug board is the global system buffer (with the size
3291
The debug board is the global system buffer (with the size
3299
512 bytes), to which any program can write (generally speaking,
3292
512 bytes), to which any program can write (generally speaking,
3300
arbitrary) data and from which other program can read these data.
3293
arbitrary) data and from which other program can read these data.
3301
By the agreement written data are text strings interpreted as
3294
By the agreement written data are text strings interpreted as
3302
debug messages on a course of program execution. The kernel in
3295
debug messages on a course of program execution. The kernel in
3303
some situations also writes to the debug board information on
3296
some situations also writes to the debug board information on
3304
execution of some functions; by the agreement kernel messages
3297
execution of some functions; by the agreement kernel messages
3305
begins from the prefix "K : ".
3298
begins from the prefix "K : ".
3306
For view of the debug board the application 'board' was created,
3299
For view of the debug board the application 'board' was created,
3307
which reads data from the buffer and displays them in its window.
3300
which reads data from the buffer and displays them in its window.
3308
'board' interpretes the sequence of codes 13,10 as newline.
3301
'board' interpretes the sequence of codes 13,10 as newline.
3309
A character with null code in an end of line is not necessary,
3302
A character with null code in an end of line is not necessary,
3310
but also does not prevent.
3303
but also does not prevent.
3311
Because debugger has been written, the value of the debug board
3304
Because debugger has been written, the value of the debug board
3312
has decreased, as debugger allows to inspect completely a course of
3305
has decreased, as debugger allows to inspect completely a course of
3313
program execution without any efforts from the direction of program
3306
program execution without any efforts from the direction of program
3314
itself. Nevertheless in some cases the debug board is still useful.
3307
itself. Nevertheless in some cases the debug board is still useful.
3315
 
3308
 
3316
----------------------------- Write byte -----------------------------
3309
----------------------------- Write byte -----------------------------
3317
Parameters:
3310
Parameters:
3318
  * eax = 63 - function number
3311
  * eax = 63 - function number
3319
  * ebx = 1 - subfunction number
3312
  * ebx = 1 - subfunction number
3320
  * cl = data byte
3313
  * cl = data byte
3321
Returned value:
3314
Returned value:
3322
  * function does not return value
3315
  * function does not return value
3323
Remarks:
3316
Remarks:
3324
  * Byte is written to the buffer. Buffer size is 512 bytes.
3317
  * Byte is written to the buffer. Buffer size is 512 bytes.
3325
    At buffer overflow all obtained data are lost.
3318
    At buffer overflow all obtained data are lost.
3326
  * For output to the debug board of more complicated objects
3319
  * For output to the debug board of more complicated objects
3327
    (strings, numbers) it is enough to call this function in cycle.
3320
    (strings, numbers) it is enough to call this function in cycle.
3328
    It is possible not to write the appropriate code manually and use
3321
    It is possible not to write the appropriate code manually and use
3329
    file 'debug.inc', which is included into the distributive.
3322
    file 'debug.inc', which is included into the distributive.
3330
 
3323
 
3331
----------------------------- Read byte ------------------------------
3324
----------------------------- Read byte ------------------------------
3332
Takes away byte from the buffer.
3325
Takes away byte from the buffer.
3333
Parameters:
3326
Parameters:
3334
  * eax = 63 - function number
3327
  * eax = 63 - function number
3335
  * ebx = 2 - subfunction number
3328
  * ebx = 2 - subfunction number
3336
Returned value:
3329
Returned value:
3337
  * eax = ebx = 0 - the buffer is empty
3330
  * eax = ebx = 0 - the buffer is empty
3338
  * eax = byte, ebx = 1 - byte was successfully read
3331
  * eax = byte, ebx = 1 - byte was successfully read
3339
 
3332
 
3340
======================================================================
3333
======================================================================
3341
============== Function 64 - resize application memory. ==============
3334
============== Function 64 - resize application memory. ==============
3342
======================================================================
3335
======================================================================
3343
Parameters:
3336
Parameters:
3344
  * eax = 64 - function number
3337
  * eax = 64 - function number
3345
  * ebx = 1 - unique subfunction
3338
  * ebx = 1 - unique subfunction
3346
  * ecx = new memory size
3339
  * ecx = new memory size
3347
Returned value:
3340
Returned value:
3348
  * eax = 0 - success
3341
  * eax = 0 - success
3349
  * eax = 1 - not enough memory
3342
  * eax = 1 - not enough memory
3350
Remarks:
3343
Remarks:
3351
  * There is another way to dynamically allocate/free memory -
3344
  * There is another way to dynamically allocate/free memory -
3352
    subfunctions 11, 12, 13 of function 68.
3345
    subfunctions 11, 12, 13 of function 68.
3353
  * The function cannot be used together with 68.11, 68.12, 68.13.
3346
  * The function cannot be used together with 68.11, 68.12, 68.13.
3354
    The function call will be ignored after creation of process heap
3347
    The function call will be ignored after creation of process heap
3355
    with function 68.11.
3348
    with function 68.11.
3356
 
3349
 
3357
======================================================================
3350
======================================================================
3358
======== Function 65 - draw image with palette in the window. ========
3351
======== Function 65 - draw image with palette in the window. ========
3359
======================================================================
3352
======================================================================
3360
Parameters:
3353
Parameters:
3361
  * eax = 65 - function number
3354
  * eax = 65 - function number
3362
  * ebx = pointer to the image
3355
  * ebx = pointer to the image
3363
  * ecx = [size on axis x]*65536 + [size on axis y]
3356
  * ecx = [size on axis x]*65536 + [size on axis y]
3364
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
3357
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
3365
  * esi = number of bits per pixel, must be 8, 24 or 32
3358
  * esi = number of bits per pixel, must be 8, 24 or 32
3366
  * edi = pointer to palette (256 colors 0x00RRGGBB);
3359
  * edi = pointer to palette (256 colors 0x00RRGGBB);
3367
          ignored when esi = 24 and 32
3360
          ignored when esi = 24 and 32
3368
  * ebp = offset of next row data relative to previous row data
3361
  * ebp = offset of next row data relative to previous row data
3369
Returned value:
3362
Returned value:
3370
  * function does not return value
3363
  * function does not return value
3371
Remarks:
3364
Remarks:
3372
  * Coordinates of the image are coordinates of the upper left corner
3365
  * Coordinates of the image are coordinates of the upper left corner
3373
    of the image relative to the window.
3366
    of the image relative to the window.
3374
  * Size of the image in bytes is xsize*ysize.
3367
  * Size of the image in bytes is xsize*ysize.
3375
  * Each byte of image is index in the palette.
3368
  * Each byte of image is index in the palette.
3376
  * If the image uses less than 256 colors, palette size may be
3369
  * If the image uses less than 256 colors, palette size may be
3377
    less than 256 too.
3370
    less than 256 too.
3378
  * The call to function 7 is equivalent to call to this function
3371
  * The call to function 7 is equivalent to call to this function
3379
    with esi=24, ebp=0.
3372
    with esi=24, ebp=0.
3380
 
3373
 
3381
======================================================================
3374
======================================================================
3382
================== Function 66 - work with keyboard. =================
3375
================== Function 66 - work with keyboard. =================
3383
======================================================================
3376
======================================================================
3384
The input mode influences results of reading keys by function 2.
3377
The input mode influences results of reading keys by function 2.
3385
When a program loads, ASCII input mode is set for it.
3378
When a program loads, ASCII input mode is set for it.
3386
 
3379
 
3387
-------------- Subfunction 1 - set keyboard input mode. --------------
3380
-------------- Subfunction 1 - set keyboard input mode. --------------
3388
Parameters:
3381
Parameters:
3389
  * eax = 66 - function number
3382
  * eax = 66 - function number
3390
  * ebx = 1 - subfunction number
3383
  * ebx = 1 - subfunction number
3391
  * ecx = mode:
3384
  * ecx = mode:
3392
    * 0 = normal (ASCII-characters)
3385
    * 0 = normal (ASCII-characters)
3393
    * 1 = scancodes
3386
    * 1 = scancodes
3394
Returned value:
3387
Returned value:
3395
  * function does not return value
3388
  * function does not return value
3396
 
3389
 
3397
-------------- Subfunction 2 - get keyboard input mode. --------------
3390
-------------- Subfunction 2 - get keyboard input mode. --------------
3398
Parameters:
3391
Parameters:
3399
  * eax = 66 - function number
3392
  * eax = 66 - function number
3400
  * ebx = 2 - subfunction number
3393
  * ebx = 2 - subfunction number
3401
Returned value:
3394
Returned value:
3402
  * eax = current mode
3395
  * eax = current mode
3403
 
3396
 
3404
------------ Subfunction 3 - get status of control keys. -------------
3397
------------ Subfunction 3 - get status of control keys. -------------
3405
Parameters:
3398
Parameters:
3406
  * eax = 66 - function number
3399
  * eax = 66 - function number
3407
  * ebx = 3 - subfunction number
3400
  * ebx = 3 - subfunction number
3408
Returned value:
3401
Returned value:
3409
  * eax = bit mask:
3402
  * eax = bit mask:
3410
  * bit 0 (mask 1): left Shift is pressed
3403
  * bit 0 (mask 1): left Shift is pressed
3411
  * bit 1 (mask 2): right Shift is pressed
3404
  * bit 1 (mask 2): right Shift is pressed
3412
  * bit 2 (mask 4): left Ctrl is pressed
3405
  * bit 2 (mask 4): left Ctrl is pressed
3413
  * bit 3 (mask 8): right Ctrl is pressed
3406
  * bit 3 (mask 8): right Ctrl is pressed
3414
  * bit 4 (mask 0x10): left Alt is pressed
3407
  * bit 4 (mask 0x10): left Alt is pressed
3415
  * bit 5 (mask 0x20): right Alt is pressed
3408
  * bit 5 (mask 0x20): right Alt is pressed
3416
  * bit 6 (mask 0x40): CapsLock is on
3409
  * bit 6 (mask 0x40): CapsLock is on
3417
  * bit 7 (mask 0x80): NumLock is on
3410
  * bit 7 (mask 0x80): NumLock is on
3418
  * bit 8 (mask 0x100): ScrollLock is on
3411
  * bit 8 (mask 0x100): ScrollLock is on
3419
  * other bits are cleared
3412
  * other bits are cleared
3420
 
3413
 
3421
-------------- Subfunction 4 - set system-wide hotkey. ---------------
3414
-------------- Subfunction 4 - set system-wide hotkey. ---------------
3422
When hotkey is pressed, the system notifies only those applications,
3415
When hotkey is pressed, the system notifies only those applications,
3423
which have installed it; the active application (which receives
3416
which have installed it; the active application (which receives
3424
all normal input) does not receive such keys.
3417
all normal input) does not receive such keys.
3425
The notification consists in sending event with the code 2.
3418
The notification consists in sending event with the code 2.
3426
Reading hotkey is the same as reading normal key - by function 2.
3419
Reading hotkey is the same as reading normal key - by function 2.
3427
Parameters:
3420
Parameters:
3428
  * eax = 66 - function number
3421
  * eax = 66 - function number
3429
  * ebx = 4 - subfunction number
3422
  * ebx = 4 - subfunction number
3430
  * cl determines key scancode;
3423
  * cl determines key scancode;
3431
    use cl=0 to give combinations such as Ctrl+Shift
3424
    use cl=0 to give combinations such as Ctrl+Shift
3432
  * edx = 0xXYZ determines possible states of control keys:
3425
  * edx = 0xXYZ determines possible states of control keys:
3433
    * Z (low 4 bits) determines state of LShift and RShift:
3426
    * Z (low 4 bits) determines state of LShift and RShift:
3434
      * 0 = no key must be pressed;
3427
      * 0 = no key must be pressed;
3435
      * 1 = exactly one key must be pressed;
3428
      * 1 = exactly one key must be pressed;
3436
      * 2 = both keys must be pressed;
3429
      * 2 = both keys must be pressed;
3437
      * 3 = must be pressed LShift, but not RShift;
3430
      * 3 = must be pressed LShift, but not RShift;
3438
      * 4 = must be pressed RShift, but not LShift
3431
      * 4 = must be pressed RShift, but not LShift
3439
    * Y - similar for LCtrl and RCtrl;
3432
    * Y - similar for LCtrl and RCtrl;
3440
    * X - similar for LAlt and RAlt
3433
    * X - similar for LAlt and RAlt
3441
Returned value:
3434
Returned value:
3442
  * eax=0 - success
3435
  * eax=0 - success
3443
  * eax=1 - too mant hotkeys (maximum 256 are allowed)
3436
  * eax=1 - too mant hotkeys (maximum 256 are allowed)
3444
Remarks:
3437
Remarks:
3445
  * Hotkey can work either at pressing or at release. Release
3438
  * Hotkey can work either at pressing or at release. Release
3446
    scancode of a key is more on 128 than pressing scancode
3439
    scancode of a key is more on 128 than pressing scancode
3447
    (i.e. high bit is set).
3440
    (i.e. high bit is set).
3448
  * Several applications can set the same combination;
3441
  * Several applications can set the same combination;
3449
    all such applications will be informed on pressing
3442
    all such applications will be informed on pressing
3450
    such combination.
3443
    such combination.
3451
 
3444
 
3452
-------------- Subfunction 5 - delete installed hotkey. --------------
3445
-------------- Subfunction 5 - delete installed hotkey. --------------
3453
Parameters:
3446
Parameters:
3454
  * eax = 66 - function number
3447
  * eax = 66 - function number
3455
  * ebx = 5 - subfunction number
3448
  * ebx = 5 - subfunction number
3456
  * cl = scancode of key and edx = 0xXYZ the same as in subfunction 4
3449
  * cl = scancode of key and edx = 0xXYZ the same as in subfunction 4
3457
Returned value:
3450
Returned value:
3458
  * eax = 0 - success
3451
  * eax = 0 - success
3459
  * eax = 1 - there is no such hotkey
3452
  * eax = 1 - there is no such hotkey
3460
Remarks:
3453
Remarks:
3461
  * When a process/thread terminates, all hotkey installed by it are
3454
  * When a process/thread terminates, all hotkey installed by it are
3462
    deleted.
3455
    deleted.
3463
  * The call to this subfunction does not affect other applications.
3456
  * The call to this subfunction does not affect other applications.
3464
    If other application has defined the same combination, it will
3457
    If other application has defined the same combination, it will
3465
    still receive notices.
3458
    still receive notices.
3466
 
3459
 
3467
======================================================================
3460
======================================================================
3468
========= Function 67 - change position/sizes of the window. =========
3461
========= Function 67 - change position/sizes of the window. =========
3469
======================================================================
3462
======================================================================
3470
Parameters:
3463
Parameters:
3471
  * eax = 67 - function number
3464
  * eax = 67 - function number
3472
  * ebx = new x-coordinate of the window
3465
  * ebx = new x-coordinate of the window
3473
  * ecx = new y-coordinate of the window
3466
  * ecx = new y-coordinate of the window
3474
  * edx = new x-size of the window
3467
  * edx = new x-size of the window
3475
  * esi = new y-size of the window
3468
  * esi = new y-size of the window
3476
Returned value:
3469
Returned value:
3477
  * function does not return value
3470
  * function does not return value
3478
Remarks:
3471
Remarks:
3479
  * The value -1 for a parameter means "do not change"; e.g. to move
3472
  * The value -1 for a parameter means "do not change"; e.g. to move
3480
    the window without resizing it is possible to specify edx=esi=-1.
3473
    the window without resizing it is possible to specify edx=esi=-1.
3481
  * Previously the window must be defined by function 0.
3474
  * Previously the window must be defined by function 0.
3482
    It sets initial coordinates and sizes of the window.
3475
    It sets initial coordinates and sizes of the window.
3483
  * Sizes of the window are understood in sense of function 0,
3476
  * Sizes of the window are understood in sense of function 0,
3484
    that is one pixel less than real sizes.
3477
    that is one pixel less than real sizes.
3485
  * The function call for maximized windows is simply ignored.
3478
  * The function call for maximized windows is simply ignored.
3486
  * For windows of appropriate styles position and/or sizes can be
3479
  * For windows of appropriate styles position and/or sizes can be
3487
    changed by user; current position and sizes can be obtained by
3480
    changed by user; current position and sizes can be obtained by
3488
    call to function 9.
3481
    call to function 9.
3489
  * The function sends to the window redraw event (with the code 1).
3482
  * The function sends to the window redraw event (with the code 1).
3490
 
3483
 
3491
======================================================================
3484
======================================================================
3492
====== Function 68, subfunction 0 - get the task switch counter. =====
3485
====== Function 68, subfunction 0 - get the task switch counter. =====
3493
======================================================================
3486
======================================================================
3494
Parameters:
3487
Parameters:
3495
  * eax = 68 - function number
3488
  * eax = 68 - function number
3496
  * ebx = 0 - subfunction number
3489
  * ebx = 0 - subfunction number
3497
Returned value:
3490
Returned value:
3498
  * eax = number of task switches from the system booting
3491
  * eax = number of task switches from the system booting
3499
    (modulo 2^32)
3492
    (modulo 2^32)
3500
 
3493
 
3501
======================================================================
3494
======================================================================
3502
======= Function 68, subfunction 1 - switch to the next thread. ======
3495
======= Function 68, subfunction 1 - switch to the next thread. ======
3503
======================================================================
3496
======================================================================
3504
The function completes the current time slice allocated to the
3497
The function completes the current time slice allocated to the
3505
thread and switches to the next. (Which thread in which process
3498
thread and switches to the next. (Which thread in which process
3506
will be next, is unpredictable). Later, when execution queue
3499
will be next, is unpredictable). Later, when execution queue
3507
will reach the current thread, execution will be continued.
3500
will reach the current thread, execution will be continued.
3508
Parameters:
3501
Parameters:
3509
  * eax = 68 - function number
3502
  * eax = 68 - function number
3510
  * ebx = 1 - subfunction number
3503
  * ebx = 1 - subfunction number
3511
Returned value:
3504
Returned value:
3512
  * function does not return value
3505
  * function does not return value
3513
 
3506
 
3514
======================================================================
3507
======================================================================
3515
============= Function 68, subfunction 2 - cache + rdpmc. ============
3508
============= Function 68, subfunction 2 - cache + rdpmc. ============
3516
======================================================================
3509
======================================================================
3517
Parameters:
3510
Parameters:
3518
  * eax = 68 - function number
3511
  * eax = 68 - function number
3519
  * ebx = 2 - subfunction number
3512
  * ebx = 2 - subfunction number
3520
  * ecx = required action:
3513
  * ecx = required action:
3521
    * ecx = 0 - enable instruction 'rdpmc'
3514
    * ecx = 0 - enable instruction 'rdpmc'
3522
      (ReaD Performance-Monitoring Counters) for applications
3515
      (ReaD Performance-Monitoring Counters) for applications
3523
    * ecx = 1 - find out whether cache is disabled/enabled
3516
    * ecx = 1 - find out whether cache is disabled/enabled
3524
    * ecx = 2 - enable cache
3517
    * ecx = 2 - enable cache
3525
    * ecx = 3 - disable cache
3518
    * ecx = 3 - disable cache
3526
Returned value:
3519
Returned value:
3527
  * for ecx=0:
3520
  * for ecx=0:
3528
    * eax = the value of cr4
3521
    * eax = the value of cr4
3529
  * for ecx=1:
3522
  * for ecx=1:
3530
    * eax = (cr0 and 0x60000000):
3523
    * eax = (cr0 and 0x60000000):
3531
    * eax = 0 - cache is on
3524
    * eax = 0 - cache is on
3532
    * eax <> 0 - cache is off
3525
    * eax <> 0 - cache is off
3533
  * for ecx=2 and ecx=3:
3526
  * for ecx=2 and ecx=3:
3534
    * function does not return value
3527
    * function does not return value
3535
 
3528
 
3536
======================================================================
3529
======================================================================
3537
=========== Function 68, subfunction 3 - read MSR-register. ==========
3530
=========== Function 68, subfunction 3 - read MSR-register. ==========
3538
======================================================================
3531
======================================================================
3539
MSR = Model Specific Register; the complete list of MSR-registers
3532
MSR = Model Specific Register; the complete list of MSR-registers
3540
of a processor is included to the documentation on it (for example,
3533
of a processor is included to the documentation on it (for example,
3541
IA-32 Intel Architecture Software Developer's Manual,
3534
IA-32 Intel Architecture Software Developer's Manual,
3542
Volume 3, Appendix B); each processor family has its own subset
3535
Volume 3, Appendix B); each processor family has its own subset
3543
of the MSR-registers.
3536
of the MSR-registers.
3544
Parameters:
3537
Parameters:
3545
  * eax = 68 - function number
3538
  * eax = 68 - function number
3546
  * ebx = 3 - subfunction number
3539
  * ebx = 3 - subfunction number
3547
  * ecx is ignored
3540
  * ecx is ignored
3548
  * edx = MSR address
3541
  * edx = MSR address
3549
Returned value:
3542
Returned value:
3550
  * ebx:eax = high:low dword of the result
3543
  * ebx:eax = high:low dword of the result
3551
Remarks:
3544
Remarks:
3552
  * If ecx contains nonexistent or not implemented for this processor
3545
  * If ecx contains nonexistent or not implemented for this processor
3553
    MSR, processor will generate an exception in the kernel, which
3546
    MSR, processor will generate an exception in the kernel, which
3554
    will kill the thread.
3547
    will kill the thread.
3555
  * Previously it is necessary to check, whether MSRs are supported
3548
  * Previously it is necessary to check, whether MSRs are supported
3556
    as a whole, with the instruction 'cpuid'. Otherwise processor
3549
    as a whole, with the instruction 'cpuid'. Otherwise processor
3557
    will generate other exception in the kernel, which will anyway
3550
    will generate other exception in the kernel, which will anyway
3558
    kill the thread.
3551
    kill the thread.
3559
 
3552
 
3560
======================================================================
3553
======================================================================
3561
========= Function 68, subfunction 4 - write to MSR-register. ========
3554
========= Function 68, subfunction 4 - write to MSR-register. ========
3562
======================================================================
3555
======================================================================
3563
MSR = Model Specific Register; the complete list of MSR-registers
3556
MSR = Model Specific Register; the complete list of MSR-registers
3564
of a processor is included to the documentation on it (for example,
3557
of a processor is included to the documentation on it (for example,
3565
IA-32 Intel Architecture Software Developer's Manual,
3558
IA-32 Intel Architecture Software Developer's Manual,
3566
Volume 3, Appendix B); each processor family has its own subset
3559
Volume 3, Appendix B); each processor family has its own subset
3567
of the MSR-registers.
3560
of the MSR-registers.
3568
Parameters:
3561
Parameters:
3569
  * eax = 68 - function number
3562
  * eax = 68 - function number
3570
  * ebx = 4 - subfunction number
3563
  * ebx = 4 - subfunction number
3571
  * ecx is ignored
3564
  * ecx is ignored
3572
  * edx = MSR address
3565
  * edx = MSR address
3573
  * esi:edi = high:low dword
3566
  * esi:edi = high:low dword
3574
Returned value:
3567
Returned value:
3575
  * ebx:eax = copy of esi:edi
3568
  * ebx:eax = copy of esi:edi
3576
Çàìå÷àíèÿ:
3569
Çàìå÷àíèÿ:
3577
  * If ecx contains nonexistent or not implemented for this processor
3570
  * If ecx contains nonexistent or not implemented for this processor
3578
    MSR, processor will generate an exception in the kernel, which
3571
    MSR, processor will generate an exception in the kernel, which
3579
    will kill the thread.
3572
    will kill the thread.
3580
  * Previously it is necessary to check, whether MSRs are supported
3573
  * Previously it is necessary to check, whether MSRs are supported
3581
    as a whole, with the instruction 'cpuid'. Otherwise processor
3574
    as a whole, with the instruction 'cpuid'. Otherwise processor
3582
    will generate other exception in the kernel, which will anyway
3575
    will generate other exception in the kernel, which will anyway
3583
    kill the thread.
3576
    kill the thread.
3584
 
3577
 
3585
======================================================================
3578
======================================================================
3586
======= Function 68, subfunction 11 - initialize process heap. =======
3579
======= Function 68, subfunction 11 - initialize process heap. =======
3587
======================================================================
3580
======================================================================
3588
Parameters:
3581
Parameters:
3589
  * eax = 68 - function number
3582
  * eax = 68 - function number
3590
  * ebx = 11 - subfunction number
3583
  * ebx = 11 - subfunction number
3591
Returned value:
3584
Returned value:
3592
  * eax = 0 - failed
3585
  * eax = 0 - failed
3593
  * otherwise size of created heap
3586
  * otherwise size of created heap
3594
Remarks:
3587
Remarks:
3595
  * The function call initializes heap, from which one can in future
3588
  * The function call initializes heap, from which one can in future
3596
    allocate and free memory blocks with subfunctions 12 and 13.
3589
    allocate and free memory blocks with subfunctions 12 and 13.
3597
    Heap size is equal to total amount of free application memory.
3590
    Heap size is equal to total amount of free application memory.
3598
  * The second function call from the same process results in
3591
  * The second function call from the same process results in
3599
    returning the size of the existing heap.
3592
    returning the size of the existing heap.
3600
  * After creation of the heap calls to function 64 will be ignored.
3593
  * After creation of the heap calls to function 64 will be ignored.
3601
 
3594
 
3602
======================================================================
3595
======================================================================
3603
======== Function 68, subfunction 12 - allocate memory block. ========
3596
======== Function 68, subfunction 12 - allocate memory block. ========
3604
======================================================================
3597
======================================================================
3605
Parameters:
3598
Parameters:
3606
  * eax = 68 - function number
3599
  * eax = 68 - function number
3607
  * ebx = 12 - subfunction number
3600
  * ebx = 12 - subfunction number
3608
  * ecx = required size in bytes
3601
  * ecx = required size in bytes
3609
Returned value:
3602
Returned value:
3610
  * eax = pointer to the allocated block
3603
  * eax = pointer to the allocated block
3611
Remarks:
3604
Remarks:
3612
  * Before this call one must initialize process heap by call to
3605
  * Before this call one must initialize process heap by call to
3613
    subfunction 11.
3606
    subfunction 11.
3614
  * The function allocates an integer number of pages (4 Kb) in such
3607
  * The function allocates an integer number of pages (4 Kb) in such
3615
    way that the real size of allocated block is more than or equal to
3608
    way that the real size of allocated block is more than or equal to
3616
    requested size.
3609
    requested size.
3617
 
3610
 
3618
======================================================================
3611
======================================================================
3619
========== Function 68, subfunction 13 - free memory block. ==========
3612
========== Function 68, subfunction 13 - free memory block. ==========
3620
======================================================================
3613
======================================================================
3621
Parameters:
3614
Parameters:
3622
  * eax = 68 - function number
3615
  * eax = 68 - function number
3623
  * ebx = 13 - subfunction number
3616
  * ebx = 13 - subfunction number
3624
  * ecx = pointer to the memory block
3617
  * ecx = pointer to the memory block
3625
Returned value:
3618
Returned value:
3626
  * eax = 1 - success
3619
  * eax = 1 - success
3627
  * eax = 0 - failed
3620
  * eax = 0 - failed
3628
Remarks:
3621
Remarks:
3629
  * The memory block must have been allocated by subfunction 12.
3622
  * The memory block must have been allocated by subfunction 12.
3630
 
3623
 
3631
======================================================================
3624
======================================================================
3632
======== Function 68, subfunction 14 - wait for driver notify. =======
3625
======== Function 68, subfunction 14 - wait for driver notify. =======
3633
======================================================================
3626
======================================================================
3634
Parameters:
3627
Parameters:
3635
  * eax = 68 - function number
3628
  * eax = 68 - function number
3636
  * ebx = 14 - subfunction number
3629
  * ebx = 14 - subfunction number
3637
  * ecx = pointer to the buffer for information (8 bytes)
3630
  * ecx = pointer to the buffer for information (8 bytes)
3638
Returned value:
3631
Returned value:
3639
  * buffer pointed to by ecx contains the following information:
3632
  * buffer pointed to by ecx contains the following information:
3640
    * +0: dword: constant EV_INTR = 1
3633
    * +0: dword: constant EV_INTR = 1
3641
    * +4: dword: driver data
3634
    * +4: dword: driver data
3642
Remarks:
3635
Remarks:
3643
  * The current implementation at wait time uses "heavy" operations
3636
  * The current implementation at wait time uses "heavy" operations
3644
    of task switch.
3637
    of task switch.
3645
 
3638
 
3646
======================================================================
3639
======================================================================
3647
====== Function 68, subfunction 15 - set FPU exception handler. ======
3640
====== Function 68, subfunction 15 - set FPU exception handler. ======
3648
======================================================================
3641
======================================================================
3649
Parameters:
3642
Parameters:
3650
  * eax = 68 - function number
3643
  * eax = 68 - function number
3651
  * ebx = 15 - subfunction number
3644
  * ebx = 15 - subfunction number
3652
  * ecx = address of the new exception handler
3645
  * ecx = address of the new exception handler
3653
Returned value:
3646
Returned value:
3654
  * eax = address of the old exception handler (0, if it was not set)
3647
  * eax = address of the old exception handler (0, if it was not set)
3655
 
3648
 
3656
======================================================================
3649
======================================================================
3657
============= Function 68, subfunction 16 - load driver. =============
3650
============= Function 68, subfunction 16 - load driver. =============
3658
======================================================================
3651
======================================================================
3659
Parameters:
3652
Parameters:
3660
  * eax = 68 - function number
3653
  * eax = 68 - function number
3661
  * ebx = 16 - subfunction number
3654
  * ebx = 16 - subfunction number
3662
  * ecx = pointer to ASCIIZ-string with driver name
3655
  * ecx = pointer to ASCIIZ-string with driver name
3663
Returned value:
3656
Returned value:
3664
  * eax = 0 - failed
3657
  * eax = 0 - failed
3665
  * otherwise eax = driver handle
3658
  * otherwise eax = driver handle
3666
Remarks:
3659
Remarks:
3667
  * If the driver was not loaded yet, it is loaded;
3660
  * If the driver was not loaded yet, it is loaded;
3668
    if the driver was loaded yet, nothing happens.
3661
    if the driver was loaded yet, nothing happens.
3669
  * Driver name is case-sensitive.
3662
  * Driver name is case-sensitive.
3670
    Maximum length of the name is 16 characters, including
3663
    Maximum length of the name is 16 characters, including
3671
    terminating null character, the rest is ignored.
3664
    terminating null character, the rest is ignored.
3672
  * The function can load only drivers which are registered in the
3665
  * The function can load only drivers which are registered in the
3673
    system; the current implementation contains
3666
    system; the current implementation contains
3674
    exactly 2 such drivers:
3667
    exactly 2 such drivers:
3675
    * name SOUND, file /rd/1/drivers/unisound.obj
3668
    * name SOUND, file /rd/1/drivers/unisound.obj
3676
    * name INFINITY, file /rd/1/drivers/infinity.obj
3669
    * name INFINITY, file /rd/1/drivers/infinity.obj
3677
 
3670
 
3678
======================================================================
3671
======================================================================
3679
============ Function 68, subfunction 17 - driver control. ===========
3672
============ Function 68, subfunction 17 - driver control. ===========
3680
======================================================================
3673
======================================================================
3681
Parameters:
3674
Parameters:
3682
  * eax = 68 - function number
3675
  * eax = 68 - function number
3683
  * ebx = 17 - subfunction number
3676
  * ebx = 17 - subfunction number
3684
  * ecx = pointer to the control structure:
3677
  * ecx = pointer to the control structure:
3685
    * +0: dword: handle of driver
3678
    * +0: dword: handle of driver
3686
    * +4: dword: code of driver function
3679
    * +4: dword: code of driver function
3687
    * +8: dword: pointer to input data
3680
    * +8: dword: pointer to input data
3688
    * +12 = +0xC: dword: size of input data
3681
    * +12 = +0xC: dword: size of input data
3689
    * +16 = +0x10: dword: pointer to output data
3682
    * +16 = +0x10: dword: pointer to output data
3690
    * +20 = +0x14: dword: size of output data
3683
    * +20 = +0x14: dword: size of output data
3691
Returned value:
3684
Returned value:
3692
  * eax = determined by driver
3685
  * eax = determined by driver
3693
Remarks:
3686
Remarks:
3694
  * Function codes and the structure of input/output data
3687
  * Function codes and the structure of input/output data
3695
    are defined by driver.
3688
    are defined by driver.
3696
  * Previously one must obtain driver handle by subfunction 16.
3689
  * Previously one must obtain driver handle by subfunction 16.
3697
 
3690
 
3698
======================================================================
3691
======================================================================
3699
====== Function 68, subfunction 18 - set SSE exception handler. ======
3692
====== Function 68, subfunction 18 - set SSE exception handler. ======
3700
======================================================================
3693
======================================================================
3701
Parameters:
3694
Parameters:
3702
  * eax = 68 - function number
3695
  * eax = 68 - function number
3703
  * ebx = 15 - subfunction number
3696
  * ebx = 15 - subfunction number
3704
  * ecx = address of the new exception handler
3697
  * ecx = address of the new exception handler
3705
Returned value:
3698
Returned value:
3706
  * eax = address of the old exception handler (0, if it was not set)
3699
  * eax = address of the old exception handler (0, if it was not set)
3707
 
3700
 
3708
======================================================================
3701
======================================================================
3709
=============== Function 68, subfunction 19 - load DLL. ==============
3702
=============== Function 68, subfunction 19 - load DLL. ==============
3710
======================================================================
3703
======================================================================
3711
Parameters:
3704
Parameters:
3712
  * eax = 68 - function number
3705
  * eax = 68 - function number
3713
  * ebx = 19 - subfunction number
3706
  * ebx = 19 - subfunction number
3714
  * ecx = pointer to ASCIIZ-string with the full path to DLL
3707
  * ecx = pointer to ASCIIZ-string with the full path to DLL
3715
Returned value:
3708
Returned value:
3716
  * eax = 0 - failed
3709
  * eax = 0 - failed
3717
  * otherwise eax = pointer to DLL export table
3710
  * otherwise eax = pointer to DLL export table
3718
Remarks:
3711
Remarks:
3719
  * Export table is an array of structures of 2 dword's, terminated
3712
  * Export table is an array of structures of 2 dword's, terminated
3720
    by zero. The first dword in structure points to function name,
3713
    by zero. The first dword in structure points to function name,
3721
    the second dword contains address of function.
3714
    the second dword contains address of function.
3722
 
3715
 
3723
======================================================================
3716
======================================================================
3724
====================== Fucntion 69 - debugging. ======================
3717
====================== Fucntion 69 - debugging. ======================
3725
======================================================================
3718
======================================================================
3726
A process can load other process as debugged by set of corresponding
3719
A process can load other process as debugged by set of corresponding
3727
bit by call to subfunction 7 of function 70.
3720
bit by call to subfunction 7 of function 70.
3728
A process can have only one debugger; one process can debug some
3721
A process can have only one debugger; one process can debug some
3729
others. The system notifies debugger on events occuring with
3722
others. The system notifies debugger on events occuring with
3730
debugged process. Messages are written to the buffer defined by
3723
debugged process. Messages are written to the buffer defined by
3731
subfunction 0.
3724
subfunction 0.
3732
Format of a message:
3725
Format of a message:
3733
  * +0: dword: message code
3726
  * +0: dword: message code
3734
  * +4: dword: PID of debugged process
3727
  * +4: dword: PID of debugged process
3735
  * +8: there can be additional data depending on message code
3728
  * +8: there can be additional data depending on message code
3736
Message codes:
3729
Message codes:
3737
  * 1 = exception
3730
  * 1 = exception
3738
    * in addition dword-number of the exception is given
3731
    * in addition dword-number of the exception is given
3739
    * process is suspended
3732
    * process is suspended
3740
  * 2 = process has terminated
3733
  * 2 = process has terminated
3741
    * comes at any termination: both through the system function -1,
3734
    * comes at any termination: both through the system function -1,
3742
      and at "murder" by any other process (including debugger itself)
3735
      and at "murder" by any other process (including debugger itself)
3743
  * 3 = debug exception int 1 = #DB
3736
  * 3 = debug exception int 1 = #DB
3744
    * in addition dword-image of the register DR6 is given:
3737
    * in addition dword-image of the register DR6 is given:
3745
      * bits 0-3: condition of the corresponding breakpoint (set by
3738
      * bits 0-3: condition of the corresponding breakpoint (set by
3746
        subfunction 9) is satisfied
3739
        subfunction 9) is satisfied
3747
      * áèò 14: exception has occured because of the trace mode
3740
      * áèò 14: exception has occured because of the trace mode
3748
        (flag TF is set TF)
3741
        (flag TF is set TF)
3749
    * process is suspended
3742
    * process is suspended
3750
When debugger terminates, all debugged processes are killed.
3743
When debugger terminates, all debugged processes are killed.
3751
If debugger does not want this, it must previously detach by
3744
If debugger does not want this, it must previously detach by
3752
subfunction 3.
3745
subfunction 3.
3753
 
3746
 
3754
All subfunctions are applicable only to processes/threads started
3747
All subfunctions are applicable only to processes/threads started
3755
from the current by function 58 or 70 with set debugging flag.
3748
from the current by function 58 or 70 with set debugging flag.
3756
Debugging of multithreaded programs is not supported yet.
3749
Debugging of multithreaded programs is not supported yet.
3757
The full list of subfunctions:
3750
The full list of subfunctions:
3758
  * subfunction 0 - define data area for debug messages
3751
  * subfunction 0 - define data area for debug messages
3759
  * subfunction 1 - get contents of registers of debugged thread
3752
  * subfunction 1 - get contents of registers of debugged thread
3760
  * subfunction 2 - set contents of registers of debugged thread
3753
  * subfunction 2 - set contents of registers of debugged thread
3761
  * subfunction 3 - detach from debugged process
3754
  * subfunction 3 - detach from debugged process
3762
  * subfunction 4 - suspend debugged thread
3755
  * subfunction 4 - suspend debugged thread
3763
  * subfunction 5 - resume debugged thread
3756
  * subfunction 5 - resume debugged thread
3764
  * subfunction 6 - read from the memory of debugged process
3757
  * subfunction 6 - read from the memory of debugged process
3765
  * subfunction 7 - write to the memory of debugged process
3758
  * subfunction 7 - write to the memory of debugged process
3766
  * subfunction 8 - terminate debugged thread
3759
  * subfunction 8 - terminate debugged thread
3767
  * subfunction 9 - set/clear hardware breakpoint
3760
  * subfunction 9 - set/clear hardware breakpoint
3768
 
3761
 
3769
======================================================================
3762
======================================================================
3770
= Function 69, subfunction 0 - define data area fror debug messages. =
3763
= Function 69, subfunction 0 - define data area fror debug messages. =
3771
======================================================================
3764
======================================================================
3772
Parameters:
3765
Parameters:
3773
  * eax = 69 - function number
3766
  * eax = 69 - function number
3774
  * ebx = 0 - subfunction number
3767
  * ebx = 0 - subfunction number
3775
  * ecx = pointer
3768
  * ecx = pointer
3776
Format of data area:
3769
Format of data area:
3777
  * +0: dword: N = buffer size (not including this header)
3770
  * +0: dword: N = buffer size (not including this header)
3778
  * +4: dword: occupied place
3771
  * +4: dword: occupied place
3779
  * +8: N*byte: buffer
3772
  * +8: N*byte: buffer
3780
Returned value:
3773
Returned value:
3781
  * function does not return value
3774
  * function does not return value
3782
Remarks:
3775
Remarks:
3783
  * If the size field is negative, the buffer is considered locked
3776
  * If the size field is negative, the buffer is considered locked
3784
    and at arrival of new message the system will wait.
3777
    and at arrival of new message the system will wait.
3785
    For synchronization frame all work with the buffer by operations
3778
    For synchronization frame all work with the buffer by operations
3786
    lock/unlock
3779
    lock/unlock
3787
    	neg	[bufsize]
3780
    	neg	[bufsize]
3788
  * Data in the buffer are considered as array of items with variable
3781
  * Data in the buffer are considered as array of items with variable
3789
    length - messages. Format of a message is explained in
3782
    length - messages. Format of a message is explained in
3790
    general description.
3783
    general description.
3791
 
3784
 
3792
======================================================================
3785
======================================================================
3793
===================== Function 69, subfunction 1 =====================
3786
===================== Function 69, subfunction 1 =====================
3794
============ Get contents of registers of debugged thread. ===========
3787
============ Get contents of registers of debugged thread. ===========
3795
======================================================================
3788
======================================================================
3796
Parameters:
3789
Parameters:
3797
  * eax = 69 - function number
3790
  * eax = 69 - function number
3798
  * ebx = 1 - subfunction number
3791
  * ebx = 1 - subfunction number
3799
  * ecx = thread identifier
3792
  * ecx = thread identifier
3800
  * edx = size of context structure, must be 0x28=40 bytes
3793
  * edx = size of context structure, must be 0x28=40 bytes
3801
  * esi = pointer to context structure
3794
  * esi = pointer to context structure
3802
Returned value:
3795
Returned value:
3803
  * function does not return value
3796
  * function does not return value
3804
Format of context structure: (FPU is not supported yet)
3797
Format of context structure: (FPU is not supported yet)
3805
  * +0: dword: eip
3798
  * +0: dword: eip
3806
  * +4: dword: eflags
3799
  * +4: dword: eflags
3807
  * +8: dword: eax
3800
  * +8: dword: eax
3808
  * +12 = +0xC: dword: ecx
3801
  * +12 = +0xC: dword: ecx
3809
  * +16 = +0x10: dword: edx
3802
  * +16 = +0x10: dword: edx
3810
  * +20 = +0x14: dword: ebx
3803
  * +20 = +0x14: dword: ebx
3811
  * +24 = +0x18: dword: esp
3804
  * +24 = +0x18: dword: esp
3812
  * +28 = +0x1C: dword: ebp
3805
  * +28 = +0x1C: dword: ebp
3813
  * +32 = +0x20: dword: esi
3806
  * +32 = +0x20: dword: esi
3814
  * +36 = +0x24: dword: edi
3807
  * +36 = +0x24: dword: edi
3815
Remarks:
3808
Remarks:
3816
  * If the thread executes code of ring-0, the function returns
3809
  * If the thread executes code of ring-0, the function returns
3817
    contents of registers of ring-3.
3810
    contents of registers of ring-3.
3818
  * Process must be loaded for debugging (as is shown in
3811
  * Process must be loaded for debugging (as is shown in
3819
    general description).
3812
    general description).
3820
 
3813
 
3821
======================================================================
3814
======================================================================
3822
===================== Function 69, subfunction 2 =====================
3815
===================== Function 69, subfunction 2 =====================
3823
============ Set contents of registers of debugged thread. ===========
3816
============ Set contents of registers of debugged thread. ===========
3824
======================================================================
3817
======================================================================
3825
Parameters:
3818
Parameters:
3826
  * eax = 69 - function number
3819
  * eax = 69 - function number
3827
  * ebx = 2 - subfunction number
3820
  * ebx = 2 - subfunction number
3828
  * ecx = thread identifier
3821
  * ecx = thread identifier
3829
  * edx = size of context structure, must be 0x28=40 bytes
3822
  * edx = size of context structure, must be 0x28=40 bytes
3830
Returned value:
3823
Returned value:
3831
  * function does not return value
3824
  * function does not return value
3832
Format of context structure is shown in the description of
3825
Format of context structure is shown in the description of
3833
subfunction 1.
3826
subfunction 1.
3834
Remarks:
3827
Remarks:
3835
  * If the thread executes code of ring-0, the function returns
3828
  * If the thread executes code of ring-0, the function returns
3836
    contents of registers of ring-3.
3829
    contents of registers of ring-3.
3837
  * Process must be loaded for debugging (as is shown in
3830
  * Process must be loaded for debugging (as is shown in
3838
    general description).
3831
    general description).
3839
 
3832
 
3840
======================================================================
3833
======================================================================
3841
===== Function 69, subfunction 3 - detach from debugged process. =====
3834
===== Function 69, subfunction 3 - detach from debugged process. =====
3842
======================================================================
3835
======================================================================
3843
Parameters:
3836
Parameters:
3844
  * eax = 69 - function number
3837
  * eax = 69 - function number
3845
  * ebx = 3 - subfunction number
3838
  * ebx = 3 - subfunction number
3846
  * ecx = identifier
3839
  * ecx = identifier
3847
Returned value:
3840
Returned value:
3848
  * function does not return value
3841
  * function does not return value
3849
Remarks:
3842
Remarks:
3850
  * If the process was suspended, it resumes execution.
3843
  * If the process was suspended, it resumes execution.
3851
 
3844
 
3852
======================================================================
3845
======================================================================
3853
======== Function 69, subfunction 4 - suspend debugged thread. =======
3846
======== Function 69, subfunction 4 - suspend debugged thread. =======
3854
======================================================================
3847
======================================================================
3855
Parameters:
3848
Parameters:
3856
  * eax = 69 - function number
3849
  * eax = 69 - function number
3857
  * ebx = 4 - subfunction number
3850
  * ebx = 4 - subfunction number
3858
  * ecx = thread identifier
3851
  * ecx = thread identifier
3859
Returned value:
3852
Returned value:
3860
  * function does not return value
3853
  * function does not return value
3861
Remarks:
3854
Remarks:
3862
  * Process must be loaded for debugging (as is shown in
3855
  * Process must be loaded for debugging (as is shown in
3863
    general description).
3856
    general description).
3864
 
3857
 
3865
======================================================================
3858
======================================================================
3866
======== Function 69, subfunction 5 - resume debugged thread. ========
3859
======== Function 69, subfunction 5 - resume debugged thread. ========
3867
======================================================================
3860
======================================================================
3868
Parameters:
3861
Parameters:
3869
  * eax = 69 - function number
3862
  * eax = 69 - function number
3870
  * ebx = 5 - subfunction number
3863
  * ebx = 5 - subfunction number
3871
  * ecx = thread identifier
3864
  * ecx = thread identifier
3872
Returned value:
3865
Returned value:
3873
  * function does not return value
3866
  * function does not return value
3874
Remarks:
3867
Remarks:
3875
  * Process must be loaded for debugging (as is shown in
3868
  * Process must be loaded for debugging (as is shown in
3876
    general description).
3869
    general description).
3877
 
3870
 
3878
======================================================================
3871
======================================================================
3879
= Fucntion 69, subfunction 6 - read from memory of debugged process. =
3872
= Fucntion 69, subfunction 6 - read from memory of debugged process. =
3880
======================================================================
3873
======================================================================
3881
Parameters:
3874
Parameters:
3882
  * eax = 69 - function number
3875
  * eax = 69 - function number
3883
  * ebx = 6 - subfunction number
3876
  * ebx = 6 - subfunction number
3884
  * ecx = identifier
3877
  * ecx = identifier
3885
  * edx = number of bytes to read
3878
  * edx = number of bytes to read
3886
  * esi = address in the memory of debugged process
3879
  * esi = address in the memory of debugged process
3887
  * edi = pointer to buffer for data
3880
  * edi = pointer to buffer for data
3888
Returned value:
3881
Returned value:
3889
  * eax = -1 at an error (invalid PID or buffer)
3882
  * eax = -1 at an error (invalid PID or buffer)
3890
  * otherwise eax = number of read bytes (possibly, 0,
3883
  * otherwise eax = number of read bytes (possibly, 0,
3891
    if esi is too large)
3884
    if esi is too large)
3892
Remarks:
3885
Remarks:
3893
  * Process must be loaded for debugging (as is shown in
3886
  * Process must be loaded for debugging (as is shown in
3894
    general description).
3887
    general description).
3895
 
3888
 
3896
======================================================================
3889
======================================================================
3897
== Function 69, subfunction 7 - write to memory of debugged process. =
3890
== Function 69, subfunction 7 - write to memory of debugged process. =
3898
======================================================================
3891
======================================================================
3899
Parameters:
3892
Parameters:
3900
  * eax = 69 - function number
3893
  * eax = 69 - function number
3901
  * ebx = 7 - subfunction number
3894
  * ebx = 7 - subfunction number
3902
  * ecx = identifier
3895
  * ecx = identifier
3903
  * edx = number of bytes to write
3896
  * edx = number of bytes to write
3904
  * esi = address of memory in debugged process
3897
  * esi = address of memory in debugged process
3905
  * edi = pointer to data
3898
  * edi = pointer to data
3906
Returned value:
3899
Returned value:
3907
  * eax = -1 at an error (invalid PID or buffer)
3900
  * eax = -1 at an error (invalid PID or buffer)
3908
  * otherwise eax = number of written bytes (possibly, 0,
3901
  * otherwise eax = number of written bytes (possibly, 0,
3909
    if esi is too large)
3902
    if esi is too large)
3910
Remarks:
3903
Remarks:
3911
  * Process must be loaded for debugging (as is shown in
3904
  * Process must be loaded for debugging (as is shown in
3912
    general description).
3905
    general description).
3913
 
3906
 
3914
======================================================================
3907
======================================================================
3915
======= Function 69, subfunction 8 - terminate debugged thread. ======
3908
======= Function 69, subfunction 8 - terminate debugged thread. ======
3916
======================================================================
3909
======================================================================
3917
Parameters:
3910
Parameters:
3918
  * eax = 69 - function number
3911
  * eax = 69 - function number
3919
  * ebx = 8 - subfunction number
3912
  * ebx = 8 - subfunction number
3920
  * ecx = identifier
3913
  * ecx = identifier
3921
Returned value:
3914
Returned value:
3922
  * function does not return value
3915
  * function does not return value
3923
Remarks:
3916
Remarks:
3924
  * Process must be loaded for debugging (as is shown in
3917
  * Process must be loaded for debugging (as is shown in
3925
    general description).
3918
    general description).
3926
  * The function is similar to subfunction 2 of function 18
3919
  * The function is similar to subfunction 2 of function 18
3927
    with two differences: it requires first remark and
3920
    with two differences: it requires first remark and
3928
    accepts PID rather than slot number.
3921
    accepts PID rather than slot number.
3929
 
3922
 
3930
======================================================================
3923
======================================================================
3931
===== Function 69, subfunction 9 - set/clear hardware breakpoint. ====
3924
===== Function 69, subfunction 9 - set/clear hardware breakpoint. ====
3932
======================================================================
3925
======================================================================
3933
Parameters:
3926
Parameters:
3934
  * eax = 69 - function number
3927
  * eax = 69 - function number
3935
  * ebx = 9 - subfunction number
3928
  * ebx = 9 - subfunction number
3936
  * ecx = thread identifier
3929
  * ecx = thread identifier
3937
  * dl = index of breakpoint, from 0 to 3 inclusively
3930
  * dl = index of breakpoint, from 0 to 3 inclusively
3938
  * dh = flags:
3931
  * dh = flags:
3939
    * if high bit is cleared - set breakpoint:
3932
    * if high bit is cleared - set breakpoint:
3940
      * bits 0-1 - condition:
3933
      * bits 0-1 - condition:
3941
        * 00 = breakpoint on execution
3934
        * 00 = breakpoint on execution
3942
        * 01 = breakpoint on read
3935
        * 01 = breakpoint on read
3943
        * 11 = breakpoint on read/write
3936
        * 11 = breakpoint on read/write
3944
      * bits 2-3 - length; for breakpoints on exception it must be
3937
      * bits 2-3 - length; for breakpoints on exception it must be
3945
        00, otherwise one of
3938
        00, otherwise one of
3946
        * 00 = byte
3939
        * 00 = byte
3947
        * 01 = word
3940
        * 01 = word
3948
        * 11 = dword
3941
        * 11 = dword
3949
      * esi = breakpoint address; must be aligned according to
3942
      * esi = breakpoint address; must be aligned according to
3950
        the length (i.e. must be even for word breakpoints,
3943
        the length (i.e. must be even for word breakpoints,
3951
        divisible by 4 for dword)
3944
        divisible by 4 for dword)
3952
    * if high bit is set - clear breakpoint
3945
    * if high bit is set - clear breakpoint
3953
Returned value:
3946
Returned value:
3954
  * eax = 0 - success
3947
  * eax = 0 - success
3955
  * eax = 1 - error in the input data
3948
  * eax = 1 - error in the input data
3956
  * eax = 2 - (reserved, is never returned in the current
3949
  * eax = 2 - (reserved, is never returned in the current
3957
    implementation) a global breakpoint with that index is already set
3950
    implementation) a global breakpoint with that index is already set
3958
Remarks:
3951
Remarks:
3959
  * Process must be loaded for debugging (as is shown in
3952
  * Process must be loaded for debugging (as is shown in
3960
    general description).
3953
    general description).
3961
  * Hardware breakpoints are implemented through DRx-registers of
3954
  * Hardware breakpoints are implemented through DRx-registers of
3962
    the processor, all limitations results from this.
3955
    the processor, all limitations results from this.
3963
  * The function can reinstall the breakpoint, previously set
3956
  * The function can reinstall the breakpoint, previously set
3964
    by it (and it does not inform on this).
3957
    by it (and it does not inform on this).
3965
    Carry on the list of set breakpoints in the debugger.
3958
    Carry on the list of set breakpoints in the debugger.
3966
  * Breakpoints generate debug exception #DB, on which the system
3959
  * Breakpoints generate debug exception #DB, on which the system
3967
    notifies debugger.
3960
    notifies debugger.
3968
  * Breakpoints on write and read/write act after
3961
  * Breakpoints on write and read/write act after
3969
    execution of the caused it instruction.
3962
    execution of the caused it instruction.
3970
 
3963
 
3971
======================================================================
3964
======================================================================
3972
==== Function 70 - work with file system with long names support. ====
3965
==== Function 70 - work with file system with long names support. ====
3973
======================================================================
3966
======================================================================
3974
Parameters:
3967
Parameters:
3975
  * eax = 70
3968
  * eax = 70
3976
  * ebx = pointer to the information structure
3969
  * ebx = pointer to the information structure
3977
Returned value:
3970
Returned value:
3978
  * eax = 0 - success; otherwise file system error code
3971
  * eax = 0 - success; otherwise file system error code
3979
  * some subfunctions return value in other registers too
3972
  * some subfunctions return value in other registers too
3980
General format of the information structure:
3973
General format of the information structure:
3981
  * +0: dword: subfunction number
3974
  * +0: dword: subfunction number
3982
  * +4: dword: file offset
3975
  * +4: dword: file offset
3983
  * +8: dword: high dword of offset (must be 0) or flags field
3976
  * +8: dword: high dword of offset (must be 0) or flags field
3984
  * +12 = +0xC: dword: size
3977
  * +12 = +0xC: dword: size
3985
  * +16 = +0x10: dword: pointer to data
3978
  * +16 = +0x10: dword: pointer to data
3986
  * +20 = +0x14: n db: ASCIIZ-string with the filename
3979
  * +20 = +0x14: n db: ASCIIZ-string with the filename
3987
    or
3980
    or
3988
  * +20 = +0x14: db 0
3981
  * +20 = +0x14: db 0
3989
  * +21 = +0x15: dd pointer to ASCIIZ-string with the filename
3982
  * +21 = +0x15: dd pointer to ASCIIZ-string with the filename
3990
Specifications - in documentation on the appropriate subfunction.
3983
Specifications - in documentation on the appropriate subfunction.
3991
Filename is case-insensitive. Russian letters must be written in
3984
Filename is case-insensitive. Russian letters must be written in
3992
the encoding cp866 (DOS).
3985
the encoding cp866 (DOS).
3993
Format of filename:
3986
Format of filename:
3994
/base/number/dir1/dir2/.../dirn/file,
3987
/base/number/dir1/dir2/.../dirn/file,
3995
where /base/number identifies device, on which file is located:
3988
where /base/number identifies device, on which file is located:
3996
one of
3989
one of
3997
  * /RD/1 = /RAMDISK/1 to access ramdisk
3990
  * /RD/1 = /RAMDISK/1 to access ramdisk
3998
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
3991
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
3999
    /FD/2 = /FLOPPYDISK/2 to access second one
3992
    /FD/2 = /FLOPPYDISK/2 to access second one
4000
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
3993
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
4001
    IDE0 (Primary Master), IDE1 (Primary Slave),
3994
    IDE0 (Primary Master), IDE1 (Primary Slave),
4002
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
3995
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
4003
    x - partition number on the selected hard drive, varies from 1
3996
    x - partition number on the selected hard drive, varies from 1
4004
    to 255 (on each hard drive the indexing starts from 1)
3997
    to 255 (on each hard drive the indexing starts from 1)
4005
  * /CD0/1, /CD1/1, /CD2/1, /CD3/1 to access accordingly to
3998
  * /CD0/1, /CD1/1, /CD2/1, /CD3/1 to access accordingly to
4006
    CD on IDE0 (Primary Master), IDE1 (Primary Slave),
3999
    CD on IDE0 (Primary Master), IDE1 (Primary Slave),
4007
    IDE2 (Secondary Master), IDE3 (Secondary Slave)
4000
    IDE2 (Secondary Master), IDE3 (Secondary Slave)
4008
Examples:
4001
Examples:
4009
  * '/rd/1/kernel.asm',0
4002
  * '/rd/1/kernel.asm',0
4010
  * '/HD0/1/kernel.asm',0
4003
  * '/HD0/1/kernel.asm',0
4011
  * '/hd0/2/menuet/pics/tanzania.bmp',0
4004
  * '/hd0/2/menuet/pics/tanzania.bmp',0
4012
  * '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0
4005
  * '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0
4013
Available subfunctions:
4006
Available subfunctions:
4014
  * subfunction 0 - read file
4007
  * subfunction 0 - read file
4015
  * subfunction 1 - read folder
4008
  * subfunction 1 - read folder
4016
  * subfunction 2 - create/rewrite file
4009
  * subfunction 2 - create/rewrite file
4017
  * subfunction 3 - write to existing file
4010
  * subfunction 3 - write to existing file
4018
  * subfunction 4 - set file size
4011
  * subfunction 4 - set file size
4019
  * subfunction 5 - get attributes of file/folder
4012
  * subfunction 5 - get attributes of file/folder
4020
  * subfunction 6 - set attributes of file/folder
4013
  * subfunction 6 - set attributes of file/folder
4021
  * subfunction 7 - start application
4014
  * subfunction 7 - start application
4022
  * subfunction 8 - delete file/folder
4015
  * subfunction 8 - delete file/folder
4023
  * subfunction 9 - create folder
4016
  * subfunction 9 - create folder
4024
For CD-drives due to hardware limitations only subfunctions
4017
For CD-drives due to hardware limitations only subfunctions
4025
0,1,5 and 7 are available, other subfunctions return error
4018
0,1,5 and 7 are available, other subfunctions return error
4026
with code 2.
4019
with code 2.
4027
 
4020
 
4028
======================================================================
4021
======================================================================
4029
=== Function 70, subfunction 0 - read file with long names support. ==
4022
=== Function 70, subfunction 0 - read file with long names support. ==
4030
======================================================================
4023
======================================================================
4031
Parameters:
4024
Parameters:
4032
  * eax = 70 - function number
4025
  * eax = 70 - function number
4033
  * ebx = pointer to the information structure
4026
  * ebx = pointer to the information structure
4034
Format of the information structure:
4027
Format of the information structure:
4035
  * +0: dword: 0 = subfunction number
4028
  * +0: dword: 0 = subfunction number
4036
  * +4: dword: file offset (in bytes)
4029
  * +4: dword: file offset (in bytes)
4037
  * +8: dword: 0 (reserved for high dword of offset)
4030
  * +8: dword: 0 (reserved for high dword of offset)
4038
  * +12 = +0xC: dword: number of bytes to read
4031
  * +12 = +0xC: dword: number of bytes to read
4039
  * +16 = +0x10: dword: pointer to buffer for data
4032
  * +16 = +0x10: dword: pointer to buffer for data
4040
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4033
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4041
    given in the general description
4034
    given in the general description
4042
    or
4035
    or
4043
  * +20 = +0x14: db 0
4036
  * +20 = +0x14: db 0
4044
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4037
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4045
Returned value:
4038
Returned value:
4046
  * eax = 0 - success, otherwise file system error code
4039
  * eax = 0 - success, otherwise file system error code
4047
  * ebx = number of read bytes or -1=0xffffffff if file was not found
4040
  * ebx = number of read bytes or -1=0xffffffff if file was not found
4048
Remarks:
4041
Remarks:
4049
  * If file was ended before last requested block was read,
4042
  * If file was ended before last requested block was read,
4050
    the function will read as many as it can, and after that return
4043
    the function will read as many as it can, and after that return
4051
    eax=6 (EOF).
4044
    eax=6 (EOF).
4052
  * The function does not allow to read folder (returns eax=10,
4045
  * The function does not allow to read folder (returns eax=10,
4053
    access denied).
4046
    access denied).
4054
 
4047
 
4055
======================================================================
4048
======================================================================
4056
== Function 70, subfunction 1 - read folder with long names support. =
4049
== Function 70, subfunction 1 - read folder with long names support. =
4057
======================================================================
4050
======================================================================
4058
Parameters:
4051
Parameters:
4059
  * eax = 70 - function number
4052
  * eax = 70 - function number
4060
  * ebx = pointer to the information structure
4053
  * ebx = pointer to the information structure
4061
Format of the information structure:
4054
Format of the information structure:
4062
  * +0: dword: 1 = subfunction number
4055
  * +0: dword: 1 = subfunction number
4063
  * +4: dword: index of starting block (beginning from 0)
4056
  * +4: dword: index of starting block (beginning from 0)
4064
  * +8: dword: flags field:
4057
  * +8: dword: flags field:
4065
    * bit 0 (mask 1): in what format to return names,
4058
    * bit 0 (mask 1): in what format to return names,
4066
      0=ANSI, 1=UNICODE
4059
      0=ANSI, 1=UNICODE
4067
    * other bits are reserved and must be set to 0 for the future
4060
    * other bits are reserved and must be set to 0 for the future
4068
      compatibility
4061
      compatibility
4069
  * +12 = +0xC: dword: number of blocks to read
4062
  * +12 = +0xC: dword: number of blocks to read
4070
  * +16 = +0x10: dword: pointer to buffer for data, buffer size
4063
  * +16 = +0x10: dword: pointer to buffer for data, buffer size
4071
    must be not less than 32 + [+12]*560 bytes
4064
    must be not less than 32 + [+12]*560 bytes
4072
  * +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
4065
  * +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
4073
    given in the general description
4066
    given in the general description
4074
    or
4067
    or
4075
  * +20 = +0x14: db 0
4068
  * +20 = +0x14: db 0
4076
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4069
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4077
Returned value:
4070
Returned value:
4078
  * eax = 0 - success, otherwise file system error code
4071
  * eax = 0 - success, otherwise file system error code
4079
  * ebx = number of files, information on which was written to
4072
  * ebx = number of files, information on which was written to
4080
    the buffer, or -1=0xffffffff, if folder was not found
4073
    the buffer, or -1=0xffffffff, if folder was not found
4081
Structure of the buffer:
4074
Structure of the buffer:
4082
  * +0: 32*byte: header
4075
  * +0: 32*byte: header
4083
  * +32 = +0x20: n1*byte: block with information on file 1
4076
  * +32 = +0x20: n1*byte: block with information on file 1
4084
  * +32+n1: n2*byte: block with information on file 2
4077
  * +32+n1: n2*byte: block with information on file 2
4085
  * ...
4078
  * ...
4086
Structure of header:
4079
Structure of header:
4087
  * +0: dword: version of structure (current is 1)
4080
  * +0: dword: version of structure (current is 1)
4088
  * +4: dword: number of placed blocks; is not greater than requested
4081
  * +4: dword: number of placed blocks; is not greater than requested
4089
    in the field +12 of information structure; can be less, if
4082
    in the field +12 of information structure; can be less, if
4090
    there are no more files in folder (the same as in ebx)
4083
    there are no more files in folder (the same as in ebx)
4091
  * +8: dword: total number of files in folder
4084
  * +8: dword: total number of files in folder
4092
  * +12 = +0xC: 20*byte: reserved (zeroed)
4085
  * +12 = +0xC: 20*byte: reserved (zeroed)
4093
Structure of block of data for folder entry (BDFE):
4086
Structure of block of data for folder entry (BDFE):
4094
  * +0: dword: attributes of file:
4087
  * +0: dword: attributes of file:
4095
    * bit 0 (mask 1): file is read-only
4088
    * bit 0 (mask 1): file is read-only
4096
    * bit 1 (mask 2): file is hidden
4089
    * bit 1 (mask 2): file is hidden
4097
    * bit 2 (mask 4): file is system
4090
    * bit 2 (mask 4): file is system
4098
    * bit 3 (mask 8): this is not a file but volume label
4091
    * bit 3 (mask 8): this is not a file but volume label
4099
      (for one partition meets no more than once and
4092
      (for one partition meets no more than once and
4100
      only in root folder)
4093
      only in root folder)
4101
    * bit 4 (mask 0x10): this is a folder
4094
    * bit 4 (mask 0x10): this is a folder
4102
    * bit 5 (mask 0x20): file was not archived - many archivation
4095
    * bit 5 (mask 0x20): file was not archived - many archivation
4103
      programs have an option to archive only files with this bit set,
4096
      programs have an option to archive only files with this bit set,
4104
      and after archiving this bit is cleared - it can be useful
4097
      and after archiving this bit is cleared - it can be useful
4105
      for automatically creating of backup-archives as at writing
4098
      for automatically creating of backup-archives as at writing
4106
      this bit is usually set
4099
      this bit is usually set
4107
  * +4: byte: type of name data:
4100
  * +4: byte: type of name data:
4108
    (coincides with bit 0 of flags in the information structure)
4101
    (coincides with bit 0 of flags in the information structure)
4109
    * 0 = ASCII = 1-byte representation of each character
4102
    * 0 = ASCII = 1-byte representation of each character
4110
    * 1 = UNICODE = 2-byte representation of each character
4103
    * 1 = UNICODE = 2-byte representation of each character
4111
  * +5: 3*byte: reserved (zero)
4104
  * +5: 3*byte: reserved (zero)
4112
  * +8: 4*byte: time of file creation
4105
  * +8: 4*byte: time of file creation
4113
  * +12 = +0xC: 4*byte: date of file creation
4106
  * +12 = +0xC: 4*byte: date of file creation
4114
  * +16 = +0x10: 4*byte: time of last access (read or write)
4107
  * +16 = +0x10: 4*byte: time of last access (read or write)
4115
  * +20 = +0x14: 4*byte: date of last access
4108
  * +20 = +0x14: 4*byte: date of last access
4116
  * +24 = +0x18: 4*byte: time of last modification
4109
  * +24 = +0x18: 4*byte: time of last modification
4117
  * +28 = +0x1C: 4*byte: date of last modification
4110
  * +28 = +0x1C: 4*byte: date of last modification
4118
  * +32 = +0x20: qword: file size in bytes (up to 16777216 Tb)
4111
  * +32 = +0x20: qword: file size in bytes (up to 16777216 Tb)
4119
  * +40 = +0x28: name
4112
  * +40 = +0x28: name
4120
    * for ASCII format: maximum length is 263 characters
4113
    * for ASCII format: maximum length is 263 characters
4121
      (263 bytes), byte after the name has value 0
4114
      (263 bytes), byte after the name has value 0
4122
    * for UNICODE format: maximum length is 259 characters
4115
    * for UNICODE format: maximum length is 259 characters
4123
      (518 bytes), 2 bytes after the name have value 0
4116
      (518 bytes), 2 bytes after the name have value 0
4124
Time format:
4117
Time format:
4125
  * +0: byte: seconds
4118
  * +0: byte: seconds
4126
  * +1: byte: minutes
4119
  * +1: byte: minutes
4127
  * +2: byte: hours
4120
  * +2: byte: hours
4128
  * +3: byte: reserved (0)
4121
  * +3: byte: reserved (0)
4129
  * for example, 23.59.59 is written as (in hex) 3B 3B 17 00
4122
  * for example, 23.59.59 is written as (in hex) 3B 3B 17 00
4130
Date format:
4123
Date format:
4131
  * +0: byte: day
4124
  * +0: byte: day
4132
  * +1: byte: month
4125
  * +1: byte: month
4133
  * +2: word: year
4126
  * +2: word: year
4134
  * for example, 25.11.1979 is written as (in hex) 19 0B BB 07
4127
  * for example, 25.11.1979 is written as (in hex) 19 0B BB 07
4135
Remarks:
4128
Remarks:
4136
  * If BDFE contains ASCII name, the length of BDFE is 304 bytes,
4129
  * If BDFE contains ASCII name, the length of BDFE is 304 bytes,
4137
    if UNICODE name - 560 bytes. Value of length is aligned
4130
    if UNICODE name - 560 bytes. Value of length is aligned
4138
    on 16-byte bound (to accelerate processing in CPU cache).
4131
    on 16-byte bound (to accelerate processing in CPU cache).
4139
  * First character after a name is zero (ASCIIZ-string). The further
4132
  * First character after a name is zero (ASCIIZ-string). The further
4140
    data contain garbage.
4133
    data contain garbage.
4141
  * If files in folder were ended before requested number was read,
4134
  * If files in folder were ended before requested number was read,
4142
    the function will read as many as it can, and after that return
4135
    the function will read as many as it can, and after that return
4143
    eax=6 (EOF).
4136
    eax=6 (EOF).
4144
  * Any folder on the disk, except for root, contains two special
4137
  * Any folder on the disk, except for root, contains two special
4145
    entries "." and "..", identifying accordingly the folder itself
4138
    entries "." and "..", identifying accordingly the folder itself
4146
    and the parent folder.
4139
    and the parent folder.
4147
  * The function allows also to read virtual folders "/", "/rd",
4140
  * The function allows also to read virtual folders "/", "/rd",
4148
    "/fd", "/hd[n]", thus attributes of subfolders are set to 0x10,
4141
    "/fd", "/hd[n]", thus attributes of subfolders are set to 0x10,
4149
    and times and dates are zeroed. An alternative way to get the
4142
    and times and dates are zeroed. An alternative way to get the
4150
    equipment information - subfunction 11 of function 18.
4143
    equipment information - subfunction 11 of function 18.
4151
 
4144
 
4152
======================================================================
4145
======================================================================
4153
===================== Function 70, subfunction 2 =====================
4146
===================== Function 70, subfunction 2 =====================
4154
============ Create/rewrite file with long names support. ============
4147
============ Create/rewrite file with long names support. ============
4155
======================================================================
4148
======================================================================
4156
Parameters:
4149
Parameters:
4157
  * eax = 70 - function number
4150
  * eax = 70 - function number
4158
  * ebx = pointer to the information structure
4151
  * ebx = pointer to the information structure
4159
Format of the information structure:
4152
Format of the information structure:
4160
  * +0: dword: 2 = subfunction number
4153
  * +0: dword: 2 = subfunction number
4161
  * +4: dword: 0 (reserved)
4154
  * +4: dword: 0 (reserved)
4162
  * +8: dword: 0 (reserved)
4155
  * +8: dword: 0 (reserved)
4163
  * +12 = +0xC: dword: number of bytes to read
4156
  * +12 = +0xC: dword: number of bytes to read
4164
  * +16 = +0x10: dword: pointer to data
4157
  * +16 = +0x10: dword: pointer to data
4165
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4158
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4166
    given in the general description
4159
    given in the general description
4167
    or
4160
    or
4168
  * +20 = +0x14: db 0
4161
  * +20 = +0x14: db 0
4169
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4162
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4170
Returned value:
4163
Returned value:
4171
  * eax = 0 - success, otherwise file system error code
4164
  * eax = 0 - success, otherwise file system error code
4172
  * ebx = number of written bytes (possibly 0)
4165
  * ebx = number of written bytes (possibly 0)
4173
Remarks:
4166
Remarks:
4174
  * If a file with given name did not exist, it is created;
4167
  * If a file with given name did not exist, it is created;
4175
    if it existed, it is rewritten.
4168
    if it existed, it is rewritten.
4176
  * If there is not enough free space on disk, the function will
4169
  * If there is not enough free space on disk, the function will
4177
    write as many as can and then return error code 8.
4170
    write as many as can and then return error code 8.
4178
  * The function is not supported for CD (returns error code 2).
4171
  * The function is not supported for CD (returns error code 2).
4179
 
4172
 
4180
======================================================================
4173
======================================================================
4181
===================== Function 70, subfunction 3 =====================
4174
===================== Function 70, subfunction 3 =====================
4182
=========== Write to existing file with long names support. ==========
4175
=========== Write to existing file with long names support. ==========
4183
======================================================================
4176
======================================================================
4184
Parameters:
4177
Parameters:
4185
  * eax = 70 - function number
4178
  * eax = 70 - function number
4186
  * ebx = pointer to the information structure
4179
  * ebx = pointer to the information structure
4187
Format of the information structure:
4180
Format of the information structure:
4188
  * +0: dword: 3 = subfunction number
4181
  * +0: dword: 3 = subfunction number
4189
  * +4: dword: file offset (in bytes)
4182
  * +4: dword: file offset (in bytes)
4190
  * +8: dword: high dword of offset (must be 0 for FAT)
4183
  * +8: dword: high dword of offset (must be 0 for FAT)
4191
  * +12 = +0xC: dword: number of bytes to write
4184
  * +12 = +0xC: dword: number of bytes to write
4192
  * +16 = +0x10: dword: pointer to data
4185
  * +16 = +0x10: dword: pointer to data
4193
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4186
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4194
    given in the general description
4187
    given in the general description
4195
    or
4188
    or
4196
  * +20 = +0x14: db 0
4189
  * +20 = +0x14: db 0
4197
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4190
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4198
Returned value:
4191
Returned value:
4199
  * eax = 0 - success, otherwise file system error code
4192
  * eax = 0 - success, otherwise file system error code
4200
  * ebx = number of written bytes (possibly 0)
4193
  * ebx = number of written bytes (possibly 0)
4201
Remarks:
4194
Remarks:
4202
  * The file must already exist, otherwise function returns eax=5.
4195
  * The file must already exist, otherwise function returns eax=5.
4203
  * The only result of write 0 bytes is update in the file attributes
4196
  * The only result of write 0 bytes is update in the file attributes
4204
    date/time of modification and access to the current date/time.
4197
    date/time of modification and access to the current date/time.
4205
  * If beginning and/or ending position is greater than file size
4198
  * If beginning and/or ending position is greater than file size
4206
    (except for the previous case), the file is expanded to needed
4199
    (except for the previous case), the file is expanded to needed
4207
    size with zero characters.
4200
    size with zero characters.
4208
  * The function is not supported for CD (returns error code 2).
4201
  * The function is not supported for CD (returns error code 2).
4209
 
4202
 
4210
======================================================================
4203
======================================================================
4211
============ Function 70, subfunction 4 - set end of file. ===========
4204
============ Function 70, subfunction 4 - set end of file. ===========
4212
======================================================================
4205
======================================================================
4213
Parameters:
4206
Parameters:
4214
  * eax = 70 - function number
4207
  * eax = 70 - function number
4215
  * ebx = pointer to the information structure
4208
  * ebx = pointer to the information structure
4216
Format of the information structure:
4209
Format of the information structure:
4217
  * +0: dword: 4 = subfunction number
4210
  * +0: dword: 4 = subfunction number
4218
  * +4: dword: low dword of new file size
4211
  * +4: dword: low dword of new file size
4219
  * +8: dword: high dword of new file size (must be 0 for FAT)
4212
  * +8: dword: high dword of new file size (must be 0 for FAT)
4220
  * +12 = +0xC: dword: 0 (reserved)
4213
  * +12 = +0xC: dword: 0 (reserved)
4221
  * +16 = +0x10: dword: 0 (reserved)
4214
  * +16 = +0x10: dword: 0 (reserved)
4222
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4215
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4223
    given in the general description
4216
    given in the general description
4224
    or
4217
    or
4225
  * +20 = +0x14: db 0
4218
  * +20 = +0x14: db 0
4226
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4219
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4227
Returned value:
4220
Returned value:
4228
  * eax = 0 - success, otherwise file system error code
4221
  * eax = 0 - success, otherwise file system error code
4229
  * ebx destroyed
4222
  * ebx destroyed
4230
Remarks:
4223
Remarks:
4231
  * If the new file size is less than old one, file is truncated.
4224
  * If the new file size is less than old one, file is truncated.
4232
    If the new size is greater than old one, file is expanded with
4225
    If the new size is greater than old one, file is expanded with
4233
    characters with code 0. If the new size is equal to old one,
4226
    characters with code 0. If the new size is equal to old one,
4234
    the only result of call is set date/time of modification and
4227
    the only result of call is set date/time of modification and
4235
    access to the current date/time.
4228
    access to the current date/time.
4236
  * If there is not enough free space on disk for expansion, the
4229
  * If there is not enough free space on disk for expansion, the
4237
    function will expand to maximum possible size and then return
4230
    function will expand to maximum possible size and then return
4238
    error code 8.
4231
    error code 8.
4239
  * The function is not supported for CD (returns error code 2).
4232
  * The function is not supported for CD (returns error code 2).
4240
 
4233
 
4241
======================================================================
4234
======================================================================
4242
==== Function 70, subfunction 5 - get information on file/folder. ====
4235
==== Function 70, subfunction 5 - get information on file/folder. ====
4243
======================================================================
4236
======================================================================
4244
Parameters:
4237
Parameters:
4245
  * eax = 70 - function number
4238
  * eax = 70 - function number
4246
  * ebx = pointer to the information structure
4239
  * ebx = pointer to the information structure
4247
Format of the information structure:
4240
Format of the information structure:
4248
  * +0: dword: 5 = subfunction number
4241
  * +0: dword: 5 = subfunction number
4249
  * +4: dword: 0 (reserved)
4242
  * +4: dword: 0 (reserved)
4250
  * +8: dword: 0 (reserved)
4243
  * +8: dword: 0 (reserved)
4251
  * +12 = +0xC: dword: 0 (reserved)
4244
  * +12 = +0xC: dword: 0 (reserved)
4252
  * +16 = +0x10: dword: pointer to buffer for data (40 bytes)
4245
  * +16 = +0x10: dword: pointer to buffer for data (40 bytes)
4253
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4246
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4254
    given in the general description
4247
    given in the general description
4255
    or
4248
    or
4256
  * +20 = +0x14: db 0
4249
  * +20 = +0x14: db 0
4257
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4250
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4258
Returned value:
4251
Returned value:
4259
  * eax = 0 - success, otherwise file system error code
4252
  * eax = 0 - success, otherwise file system error code
4260
  * ebx destroyed
4253
  * ebx destroyed
4261
Information on file is returned in the BDFE format (block of data
4254
Information on file is returned in the BDFE format (block of data
4262
for folder entry), explained in the description of
4255
for folder entry), explained in the description of
4263
subfunction 1, but without filename
4256
subfunction 1, but without filename
4264
(i.e. only first 40 = 0x28 bytes).
4257
(i.e. only first 40 = 0x28 bytes).
4265
Remarks:
4258
Remarks:
4266
  * The function does not support virtual folders such as /, /rd and
4259
  * The function does not support virtual folders such as /, /rd and
4267
    root folders like /rd/1.
4260
    root folders like /rd/1.
4268
 
4261
 
4269
======================================================================
4262
======================================================================
4270
===== Function 70, subfunction 6 - set attributes of file/folder. ====
4263
===== Function 70, subfunction 6 - set attributes of file/folder. ====
4271
======================================================================
4264
======================================================================
4272
Parameters:
4265
Parameters:
4273
  * eax = 70 - function number
4266
  * eax = 70 - function number
4274
  * ebx = pointer to the information structure
4267
  * ebx = pointer to the information structure
4275
Format of the information structure:
4268
Format of the information structure:
4276
  * +0: dword: 6 = subfunction number
4269
  * +0: dword: 6 = subfunction number
4277
  * +4: dword: 0 (reserved)
4270
  * +4: dword: 0 (reserved)
4278
  * +8: dword: 0 (reserved)
4271
  * +8: dword: 0 (reserved)
4279
  * +12 = +0xC: dword: 0 (reserved)
4272
  * +12 = +0xC: dword: 0 (reserved)
4280
  * +16 = +0x10: dword: pointer to buffer with attributes (32 bytes)
4273
  * +16 = +0x10: dword: pointer to buffer with attributes (32 bytes)
4281
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4274
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4282
    given in the general description
4275
    given in the general description
4283
    or
4276
    or
4284
  * +20 = +0x14: db 0
4277
  * +20 = +0x14: db 0
4285
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4278
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4286
Returned value:
4279
Returned value:
4287
  * eax = 0 - success, otherwise file system error code
4280
  * eax = 0 - success, otherwise file system error code
4288
  * ebx destroyed
4281
  * ebx destroyed
4289
File attributes are first 32 bytes in BDFE (block of data
4282
File attributes are first 32 bytes in BDFE (block of data
4290
for folder entry), explained in the description of subfunction 1
4283
for folder entry), explained in the description of subfunction 1
4291
(that is, without name and size of file). Attribute
4284
(that is, without name and size of file). Attribute
4292
file/folder/volume label (bits 3,4 in dword +0) is not changed.
4285
file/folder/volume label (bits 3,4 in dword +0) is not changed.
4293
Byte +4 (name format) is ignored.
4286
Byte +4 (name format) is ignored.
4294
Remarks:
4287
Remarks:
4295
  * The function does not support virtual folders such as /, /rd and
4288
  * The function does not support virtual folders such as /, /rd and
4296
    root folders like /rd/1.
4289
    root folders like /rd/1.
4297
  * The function is not supported for CD (returns error code 2).
4290
  * The function is not supported for CD (returns error code 2).
4298
 
4291
 
4299
======================================================================
4292
======================================================================
4300
=========== Function 70, subfunction 7 - start application. ==========
4293
=========== Function 70, subfunction 7 - start application. ==========
4301
======================================================================
4294
======================================================================
4302
Parameters:
4295
Parameters:
4303
  * eax = 70 - function number
4296
  * eax = 70 - function number
4304
  * ebx = pointer to the information structure
4297
  * ebx = pointer to the information structure
4305
Format of the information structure:
4298
Format of the information structure:
4306
  * +0: dword: 7 = subfunction number
4299
  * +0: dword: 7 = subfunction number
4307
  * +4: dword: flags field:
4300
  * +4: dword: flags field:
4308
    * áèò 0: start process as debugged
4301
    * áèò 0: start process as debugged
4309
    * other bits are reserved and must be set to 0
4302
    * other bits are reserved and must be set to 0
4310
  * +8: dword: 0 or pointer to ASCIIZ-string with parameters
4303
  * +8: dword: 0 or pointer to ASCIIZ-string with parameters
4311
  * +12 = +0xC: dword: 0 (reserved)
4304
  * +12 = +0xC: dword: 0 (reserved)
4312
  * +16 = +0x10: dword: 0 (reserved)
4305
  * +16 = +0x10: dword: 0 (reserved)
4313
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4306
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4314
    given in the general description
4307
    given in the general description
4315
    or
4308
    or
4316
  * +20 = +0x14: db 0
4309
  * +20 = +0x14: db 0
4317
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4310
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4318
Returned value:
4311
Returned value:
4319
  * eax > 0 - program is loaded, eax contains PID
4312
  * eax > 0 - program is loaded, eax contains PID
4320
  * eax < 0 - an error has occured, -eax contains
4313
  * eax < 0 - an error has occured, -eax contains
4321
    file system error code
4314
    file system error code
4322
  * ebx destroyed
4315
  * ebx destroyed
4323
Remarks:
4316
Remarks:
4324
  * Command line must be terminated by the character with the code 0
4317
  * Command line must be terminated by the character with the code 0
4325
    (ASCIIZ-string); function takes into account either all characters
4318
    (ASCIIZ-string); function takes into account either all characters
4326
    up to terminating zero inclusively or first 256 character
4319
    up to terminating zero inclusively or first 256 character
4327
    regarding what is less.
4320
    regarding what is less.
4328
  * If the process is started as debugged, it is created in
4321
  * If the process is started as debugged, it is created in
4329
    the suspended state; to run use subfunction 5 of function 69.
4322
    the suspended state; to run use subfunction 5 of function 69.
4330
 
4323
 
4331
======================================================================
4324
======================================================================
4332
========== Function 70, subfunction 8 - delete file/folder. ==========
4325
========== Function 70, subfunction 8 - delete file/folder. ==========
4333
======================================================================
4326
======================================================================
4334
Parameters:
4327
Parameters:
4335
  * eax = 70 - function number
4328
  * eax = 70 - function number
4336
  * ebx = pointer to the information structure
4329
  * ebx = pointer to the information structure
4337
Format of the information structure:
4330
Format of the information structure:
4338
  * +0: dword: 8 = subfunction number
4331
  * +0: dword: 8 = subfunction number
4339
  * +4: dword: 0 (reserved)
4332
  * +4: dword: 0 (reserved)
4340
  * +8: dword: 0 (reserved)
4333
  * +8: dword: 0 (reserved)
4341
  * +12 = +0xC: dword: 0 (reserved)
4334
  * +12 = +0xC: dword: 0 (reserved)
4342
  * +16 = +0x10: dword: 0 (reserved)
4335
  * +16 = +0x10: dword: 0 (reserved)
4343
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4336
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4344
    given in the general description
4337
    given in the general description
4345
    or
4338
    or
4346
  * +20 = +0x14: db 0
4339
  * +20 = +0x14: db 0
4347
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4340
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4348
Returned value:
4341
Returned value:
4349
  * eax = 0 - success, otherwise file system error code
4342
  * eax = 0 - success, otherwise file system error code
4350
  * ebx destroyed
4343
  * ebx destroyed
4351
Remarks:
4344
Remarks:
4352
  * The function is not supported for CD (returns error code 2).
4345
  * The function is not supported for CD (returns error code 2).
4353
  * The function can delete only empty folders (attempt to delete
4346
  * The function can delete only empty folders (attempt to delete
4354
    nonempty folder results in error with code 10, "access denied").
4347
    nonempty folder results in error with code 10, "access denied").
4355
 
4348
 
4356
======================================================================
4349
======================================================================
4357
============= Function 70, subfunction 9 - create folder. ============
4350
============= Function 70, subfunction 9 - create folder. ============
4358
======================================================================
4351
======================================================================
4359
Parameters:
4352
Parameters:
4360
  * eax = 70 - function number
4353
  * eax = 70 - function number
4361
  * ebx = pointer to the information structure
4354
  * ebx = pointer to the information structure
4362
Format of the information structure:
4355
Format of the information structure:
4363
  * +0: dword: 9 = subfunction number
4356
  * +0: dword: 9 = subfunction number
4364
  * +4: dword: 0 (reserved)
4357
  * +4: dword: 0 (reserved)
4365
  * +8: dword: 0 (reserved)
4358
  * +8: dword: 0 (reserved)
4366
  * +12 = +0xC: dword: 0 (reserved)
4359
  * +12 = +0xC: dword: 0 (reserved)
4367
  * +16 = +0x10: dword: 0 (reserved)
4360
  * +16 = +0x10: dword: 0 (reserved)
4368
  * +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
4361
  * +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
4369
    given in the general description
4362
    given in the general description
4370
    or
4363
    or
4371
  * +20 = +0x14: db 0
4364
  * +20 = +0x14: db 0
4372
  * +21 = +0x15: dd pointer to ASCIIZ-string with folder name
4365
  * +21 = +0x15: dd pointer to ASCIIZ-string with folder name
4373
Returned value:
4366
Returned value:
4374
  * eax = 0 - success, otherwise file system error code
4367
  * eax = 0 - success, otherwise file system error code
4375
  * ebx destroyed
4368
  * ebx destroyed
4376
Remarks:
4369
Remarks:
4377
  * The function is not supported for CD (returns error code 2).
4370
  * The function is not supported for CD (returns error code 2).
4378
  * The parent folder must already exist.
4371
  * The parent folder must already exist.
4379
  * If target folder already exists, function returns success (eax=0).
4372
  * If target folder already exists, function returns success (eax=0).
4380
 
4373
 
4381
======================================================================
4374
======================================================================
4382
========== Function 71, subfunction 1 - set window caption. ==========
4375
========== Function 71, subfunction 1 - set window caption. ==========
4383
======================================================================
4376
======================================================================
4384
Parameters:
4377
Parameters:
4385
  * eax = 71 - function number
4378
  * eax = 71 - function number
4386
  * ebx = 1 - subfunction number
4379
  * ebx = 1 - subfunction number
4387
  * ecx = pointer to caption string
4380
  * ecx = pointer to caption string
4388
Returned value:
4381
Returned value:
4389
  * function does not return value
4382
  * function does not return value
4390
Remarks:
4383
Remarks:
4391
  * String must be in the ASCIIZ-format. Disregarding real string
4384
  * String must be in the ASCIIZ-format. Disregarding real string
4392
    length, no more than 255 characters are drawn.
4385
    length, no more than 255 characters are drawn.
4393
  * Pass NULL in ecx to remove caption.
4386
  * Pass NULL in ecx to remove caption.
4394
 
4387
 
4395
======================================================================
4388
======================================================================
4396
=============== Function -1 - terminate thread/process ===============
4389
=============== Function -1 - terminate thread/process ===============
4397
======================================================================
4390
======================================================================
4398
Parameters:
4391
Parameters:
4399
  * eax = -1 - function number
4392
  * eax = -1 - function number
4400
Returned value:
4393
Returned value:
4401
  * function does not return neither value nor control
4394
  * function does not return neither value nor control
4402
Remarks:
4395
Remarks:
4403
  * If the process did not create threads obviously, it has only
4396
  * If the process did not create threads obviously, it has only
4404
    one thread, which termination results in process termination.
4397
    one thread, which termination results in process termination.
4405
  * If the current thread is last in the process, its termination
4398
  * If the current thread is last in the process, its termination
4406
    also results in process terminates.
4399
    also results in process terminates.
4407
  * This function terminates the current thread. Other thread can be
4400
  * This function terminates the current thread. Other thread can be
4408
    killed by call to subfunction 2 of function 18.
4401
    killed by call to subfunction 2 of function 18.
4409
 
4402
 
4410
======================================================================
4403
======================================================================
4411
=========================== List of events ===========================
4404
=========================== List of events ===========================
4412
======================================================================
4405
======================================================================
4413
Next event can be retrieved by the call of one from functions 10
4406
Next event can be retrieved by the call of one from functions 10
4414
(to wait for event), 11 (to check without waiting), 23
4407
(to wait for event), 11 (to check without waiting), 23
4415
(to wait during the given time).
4408
(to wait during the given time).
4416
These functions return only those events, which enter into a mask set
4409
These functions return only those events, which enter into a mask set
4417
by function 40. By default it is first three,
4410
by function 40. By default it is first three,
4418
there is enough for most applications.
4411
there is enough for most applications.
4419
Codes of events:
4412
Codes of events:
4420
  * 1 = redraw event (is reset by call to function 0)
4413
  * 1 = redraw event (is reset by call to function 0)
4421
  * 2 = key on keyboard is pressed (acts, only when the window is
4414
  * 2 = key on keyboard is pressed (acts, only when the window is
4422
    active) or hotkey is pressed; is reset, when all keys from
4415
    active) or hotkey is pressed; is reset, when all keys from
4423
    the buffer are read out by function 2
4416
    the buffer are read out by function 2
4424
  * 3 = button is pressed, defined earlier by function 8
4417
  * 3 = button is pressed, defined earlier by function 8
4425
    (or close button, created implicitly by function 0;
4418
    (or close button, created implicitly by function 0;
4426
    minimize button is handled by the system and sends no message;
4419
    minimize button is handled by the system and sends no message;
4427
    acts, only when the window is active;
4420
    acts, only when the window is active;
4428
    is reset when all buttons from the buffer
4421
    is reset when all buttons from the buffer
4429
    are read out by function 17)
4422
    are read out by function 17)
4430
  * 4 = reserved (in current implementation never comes even after
4423
  * 4 = reserved (in current implementation never comes even after
4431
    unmasking by function 40)
4424
    unmasking by function 40)
4432
  * 5 = the desktop background is redrawed (is reset automatically
4425
  * 5 = the desktop background is redrawed (is reset automatically
4433
    after redraw, so if in redraw time program does not wait and
4426
    after redraw, so if in redraw time program does not wait and
4434
    does not check events, it will not remark this event)
4427
    does not check events, it will not remark this event)
4435
  * 6 = mouse event (something happened - button pressing or moving;
4428
  * 6 = mouse event (something happened - button pressing or moving;
4436
    is reset at reading)
4429
    is reset at reading)
4437
  * 7 = IPC event (see function 60 -
4430
  * 7 = IPC event (see function 60 -
4438
    Inter Process Communication; is reset at reading)
4431
    Inter Process Communication; is reset at reading)
4439
  * 8 = network event (is reset at reading)
4432
  * 8 = network event (is reset at reading)
4440
  * 9 = debug event (is reset at reading; see
4433
  * 9 = debug event (is reset at reading; see
4441
    debug subsystem)
4434
    debug subsystem)
4442
  * 16..31 = event with appropriate IRQ
4435
  * 16..31 = event with appropriate IRQ
4443
    (16=IRQ0, 31=IRQ15) (is reset after reading all IRQ data)
4436
    (16=IRQ0, 31=IRQ15) (is reset after reading all IRQ data)
4444
 
4437
 
4445
======================================================================
4438
======================================================================
4446
=================== Error codes of the file system ===================
4439
=================== Error codes of the file system ===================
4447
======================================================================
4440
======================================================================
4448
  * 0 = success
4441
  * 0 = success
4449
  * 1 = base and/or partition of a hard disk is not defined
4442
  * 1 = base and/or partition of a hard disk is not defined
4450
    (by subfunctions 7, 8 of function 21)
4443
    (by subfunctions 7, 8 of function 21)
4451
  * 2 = function is not supported for the given file system
4444
  * 2 = function is not supported for the given file system
4452
  * 3 = unknown file system
4445
  * 3 = unknown file system
4453
  * 4 = is returned only from function 'rename' by transmission of
4446
  * 4 = is returned only from function 'rename' by transmission of
4454
    the strongly incorrect parameter and in any way does not
4447
    the strongly incorrect parameter and in any way does not
4455
    correspond to the description in the kernel sources
4448
    correspond to the description in the kernel sources
4456
    "partition not defined at hd"
4449
    "partition not defined at hd"
4457
  * 5 = file not found
4450
  * 5 = file not found
4458
  * 6 = end of file, EOF
4451
  * 6 = end of file, EOF
4459
  * 7 = pointer lies outside of application memory
4452
  * 7 = pointer lies outside of application memory
4460
  * 8 = disk is full
4453
  * 8 = disk is full
4461
  * 9 = FAT table is destroyed
4454
  * 9 = FAT table is destroyed
4462
  * 10 = access denied
4455
  * 10 = access denied
4463
  * 11 = device error
4456
  * 11 = device error
4464
Application start functions can return also following errors:
4457
Application start functions can return also following errors:
4465
  * 30 = 0x1E = not enough memory
4458
  * 30 = 0x1E = not enough memory
4466
  * 31 = 0x1F = file is not executable
4459
  * 31 = 0x1F = file is not executable
4467
  * 32 = 0x20 = too many processes
4460
  * 32 = 0x20 = too many processes
4468
>
4461
>
4469
>
4462
>
4470
>
4463
>
4471
>
4464
>