Subversion Repositories Kolibri OS

Rev

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

Rev 540 Rev 546
1
SYSTEM FUNCTIONS of OS Kolibri 0.6.5.0
1
SYSTEM FUNCTIONS of OS Kolibri 0.7.0.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
  * Before calling subfunctions 2 and 5 you should call this function
496
  * Before calling subfunctions 2 and 5 you should call this function
497
    to set image size!
497
    to set image size!
498
  * For update of the screen (after completion of a series of commands
498
  * For update of the screen (after completion of a series of commands
499
    working with a background) call subfunction 3.
499
    working with a background) call subfunction 3.
500
  * There is a pair function for get size of the background image -
500
  * There is a pair function for get size of the background image -
501
    subfunction 1 of function 39.
501
    subfunction 1 of function 39.
502
 
502
 
503
======================================================================
503
======================================================================
504
=== Function 15, subfunction 2 - put pixel on the background image. ==
504
=== Function 15, subfunction 2 - put pixel on the background image. ==
505
======================================================================
505
======================================================================
506
Parameters:
506
Parameters:
507
  * eax = 15 - function number
507
  * eax = 15 - function number
508
  * ebx = 2 - subfunction number
508
  * ebx = 2 - subfunction number
509
  * ecx = offset
509
  * ecx = offset
510
  * edx = color of a pixel 0xRRGGBB
510
  * edx = color of a pixel 0xRRGGBB
511
Returned value:
511
Returned value:
512
  * function does not return value
512
  * function does not return value
513
Remarks:
513
Remarks:
514
  * Offset for a pixel with coordinates (x,y) is calculated as
514
  * Offset for a pixel with coordinates (x,y) is calculated as
515
    (x+y*xsize)*3.
515
    (x+y*xsize)*3.
516
  * If the given offset exceeds size set by subfunction 1,
516
  * If the given offset exceeds size set by subfunction 1,
517
    the call is ignored.
517
    the call is ignored.
518
  * For update of the screen (after completion of a series of commands
518
  * For update of the screen (after completion of a series of commands
519
    working with a background) call subfunction 3.
519
    working with a background) call subfunction 3.
520
  * There is a pair function for get pixel on the background image -
520
  * There is a pair function for get pixel on the background image -
521
    subfunction 2 of function 39.
521
    subfunction 2 of function 39.
522
 
522
 
523
======================================================================
523
======================================================================
524
=========== Function 15, subfunction 3 - redraw background. ==========
524
=========== Function 15, subfunction 3 - redraw background. ==========
525
======================================================================
525
======================================================================
526
Parameters:
526
Parameters:
527
  * eax = 15 - function number
527
  * eax = 15 - function number
528
  * ebx = 3 - subfunction number
528
  * ebx = 3 - subfunction number
529
Returned value:
529
Returned value:
530
  * function does not return value
530
  * function does not return value
531
 
531
 
532
======================================================================
532
======================================================================
533
== Function 15, subfunction 4 - set drawing mode for the background. =
533
== Function 15, subfunction 4 - set drawing mode for the background. =
534
======================================================================
534
======================================================================
535
Parameters:
535
Parameters:
536
  * eax = 15 - function number
536
  * eax = 15 - function number
537
  * ebx = 4 - subfunction number
537
  * ebx = 4 - subfunction number
538
  * ecx = drawing mode:
538
  * ecx = drawing mode:
539
    * 1 = tile
539
    * 1 = tile
540
    * 2 = stretch
540
    * 2 = stretch
541
Returned value:
541
Returned value:
542
  * function does not return value
542
  * function does not return value
543
Remarks:
543
Remarks:
544
  * For update of the screen (after completion of a series of commands
544
  * For update of the screen (after completion of a series of commands
545
    working with a background) call subfunction 3.
545
    working with a background) call subfunction 3.
546
  * There is a pair function for get drawing mode of the background -
546
  * There is a pair function for get drawing mode of the background -
547
    subfunction 4 of function 39.
547
    subfunction 4 of function 39.
548
 
548
 
549
======================================================================
549
======================================================================
550
===================== Function 15, subfunction 5 =====================
550
===================== Function 15, subfunction 5 =====================
551
============ Put block of pixels on the background image. ============
551
============ Put block of pixels on the background image. ============
552
======================================================================
552
======================================================================
553
Parameters:
553
Parameters:
554
  * eax = 15 - function number
554
  * eax = 15 - function number
555
  * ebx = 5 - subfunction number
555
  * ebx = 5 - subfunction number
556
  * ecx = pointer to the data in the format BBGGRRBBGGRR...
556
  * ecx = pointer to the data in the format BBGGRRBBGGRR...
557
  * edx = offset in data of the background image
557
  * edx = offset in data of the background image
558
  * esi = size of data in bytes = 3 * number of pixels
558
  * esi = size of data in bytes = 3 * number of pixels
559
Returned value:
559
Returned value:
560
  * function does not return value
560
  * function does not return value
561
Remarks:
561
Remarks:
562
  * Offset and size are not checked for correctness.
562
  * Offset and size are not checked for correctness.
563
  * Color of each pixel is stored as 3-bytes value BBGGRR.
563
  * Color of each pixel is stored as 3-bytes value BBGGRR.
564
  * Pixels of the background image are written sequentially
564
  * Pixels of the background image are written sequentially
565
    from left to right, from up to down.
565
    from left to right, from up to down.
566
  * Offset of pixel with coordinates (x,y) is (x+y*xsize)*3.
566
  * Offset of pixel with coordinates (x,y) is (x+y*xsize)*3.
567
  * For update of the screen (after completion of a series of commands
567
  * For update of the screen (after completion of a series of commands
568
    working with a background) call subfunction 3.
568
    working with a background) call subfunction 3.
569
 
569
 
570
======================================================================
570
======================================================================
-
 
571
===================== Function 15, subfunction 6 =====================
-
 
572
======== Map background data to the address space of process. ========
-
 
573
======================================================================
-
 
574
Parameters:
-
 
575
  * eax = 15 - function number
-
 
576
  * ebx = 6 - subfunction number
-
 
577
Returned value:
-
 
578
  * eax = pointer to background data, 0 if error
-
 
579
Remarks:
-
 
580
  * Mapped data are available for read and write.
-
 
581
  * Size of background data is 3*xsize*ysize. The system blocks
-
 
582
    changes of background sizes while process works with mapped data.
-
 
583
  * Color of each pixel is stored as 3-bytes value BBGGRR.
-
 
584
  * Pixels of the background image are written sequentially
-
 
585
    from left to right, from up to down.
-
 
586
 
-
 
587
======================================================================
-
 
588
===== Function 15, subfunction 7 - close mapped background data. =====
-
 
589
======================================================================
-
 
590
Parameters:
-
 
591
  * eax = 15 - function number
-
 
592
  * ebx = 7 - subfunction number
-
 
593
  * ecx = pointer to mapped data
-
 
594
Returned value:
-
 
595
  * eax = 1 - success, 0 - error
-
 
596
 
-
 
597
======================================================================
571
=============== Function 16 - save ramdisk on a floppy. ==============
598
=============== Function 16 - save ramdisk on a floppy. ==============
572
======================================================================
599
======================================================================
573
Parameters:
600
Parameters:
574
  * eax = 16 - function number
601
  * eax = 16 - function number
575
  * ebx = 1 or ebx = 2 - on which floppy save
602
  * ebx = 1 or ebx = 2 - on which floppy save
576
Returned value:
603
Returned value:
577
  * eax = 0 - success
604
  * eax = 0 - success
578
  * eax = 1 - error
605
  * eax = 1 - error
579
 
606
 
580
======================================================================
607
======================================================================
581
======= Function 17 - get the identifier of the pressed button. ======
608
======= Function 17 - get the identifier of the pressed button. ======
582
======================================================================
609
======================================================================
583
Takes away the code of the pressed button from the buffer.
610
Takes away the code of the pressed button from the buffer.
584
Parameters:
611
Parameters:
585
  * eax = 17 - function number
612
  * eax = 17 - function number
586
Returned value:
613
Returned value:
587
  * if the buffer is empty, function returns eax=1
614
  * if the buffer is empty, function returns eax=1
588
  * if the buffer is not empty, function returns al=0,
615
  * if the buffer is not empty, function returns al=0,
589
    high 24 bits of eax contain button identifier (in particular, ah
616
    high 24 bits of eax contain button identifier (in particular, ah
590
    contains low byte of the identifier; if all buttons have
617
    contains low byte of the identifier; if all buttons have
591
    the identifier less than 256, ah is enough to distinguish).
618
    the identifier less than 256, ah is enough to distinguish).
592
Remarks:
619
Remarks:
593
  * "Buffer" keeps only one button, at pressing the new button the
620
  * "Buffer" keeps only one button, at pressing the new button the
594
    information about old is lost.
621
    information about old is lost.
595
  * The call of this function by an application with inactive window
622
  * The call of this function by an application with inactive window
596
    will return answer "buffer is empty".
623
    will return answer "buffer is empty".
597
 
624
 
598
======================================================================
625
======================================================================
599
============ Function 18, subfunction 1 - system shutdown. ===========
626
============ Function 18, subfunction 1 - system shutdown. ===========
600
======================================================================
627
======================================================================
601
Parameters:
628
Parameters:
602
  * eax = 18 - function number
629
  * eax = 18 - function number
603
  * ebx = 1 - subfunction number
630
  * ebx = 1 - subfunction number
604
Returned value:
631
Returned value:
605
  * function always return eax = 0 as tag of success
632
  * function always return eax = 0 as tag of success
606
Remarks:
633
Remarks:
607
  * On the last step menu of exit from the system appears and waits
634
  * On the last step menu of exit from the system appears and waits
608
    response of the user.
635
    response of the user.
609
  * See also subfunction 9, system shutdown with
636
  * See also subfunction 9, system shutdown with
610
    the parameter to force the choice in the exit menu.
637
    the parameter to force the choice in the exit menu.
611
 
638
 
612
======================================================================
639
======================================================================
613
= Function 18, subfunction 2 - terminate process/thread by the slot. =
640
= Function 18, subfunction 2 - terminate process/thread by the slot. =
614
======================================================================
641
======================================================================
615
Parameters:
642
Parameters:
616
  * eax = 18 - function number
643
  * eax = 18 - function number
617
  * ebx = 2 - subfunction number
644
  * ebx = 2 - subfunction number
618
  * ecx = number of the slot of process/thread
645
  * ecx = number of the slot of process/thread
619
Returned value:
646
Returned value:
620
  * function does not return value
647
  * function does not return value
621
Remarks:
648
Remarks:
622
  * It is impossible to terminate system thread OS/IDLE (with
649
  * It is impossible to terminate system thread OS/IDLE (with
623
    number of the slot 1),
650
    number of the slot 1),
624
    it is possible to terminate any normal process/thread.
651
    it is possible to terminate any normal process/thread.
625
  * See also subfunction 18 - terminate
652
  * See also subfunction 18 - terminate
626
    process/thread by the identifier.
653
    process/thread by the identifier.
627
 
654
 
628
======================================================================
655
======================================================================
629
===================== Function 18, subfunction 3 =====================
656
===================== Function 18, subfunction 3 =====================
630
============= Make active the window of the given thread. ============
657
============= Make active the window of the given thread. ============
631
======================================================================
658
======================================================================
632
Parameters:
659
Parameters:
633
  * eax = 18 - function number
660
  * eax = 18 - function number
634
  * ebx = 3 - subfunction number
661
  * ebx = 3 - subfunction number
635
  * ecx = number of the thread slot
662
  * ecx = number of the thread slot
636
Returned value:
663
Returned value:
637
  * function does not return value
664
  * function does not return value
638
Remarks:
665
Remarks:
639
  * If correct, but nonexistent slot is given,
666
  * If correct, but nonexistent slot is given,
640
    some window is made active.
667
    some window is made active.
641
  * To find out, which window is active, use subfunction 7.
668
  * To find out, which window is active, use subfunction 7.
642
 
669
 
643
======================================================================
670
======================================================================
644
===================== Function 18, subfunction 4 =====================
671
===================== Function 18, subfunction 4 =====================
645
=========== Get counter of idle time units per one second. ===========
672
=========== Get counter of idle time units per one second. ===========
646
======================================================================
673
======================================================================
647
Idle time units are units, in which the processor stands idle
674
Idle time units are units, in which the processor stands idle
648
in waiting for interrupt (in the command 'hlt').
675
in waiting for interrupt (in the command 'hlt').
649
 
676
 
650
Parameters:
677
Parameters:
651
  * eax = 18 - function number
678
  * eax = 18 - function number
652
  * ebx = 4 - subfunction number
679
  * ebx = 4 - subfunction number
653
Returned value:
680
Returned value:
654
  * eax = value of the counter of idle time units per one second
681
  * eax = value of the counter of idle time units per one second
655
 
682
 
656
======================================================================
683
======================================================================
657
========== Function 18, subfunction 5 - get CPU clock rate. ==========
684
========== Function 18, subfunction 5 - get CPU clock rate. ==========
658
======================================================================
685
======================================================================
659
Parameters:
686
Parameters:
660
  * eax = 18 - function number
687
  * eax = 18 - function number
661
  * ebx = 5 - subfunction number
688
  * ebx = 5 - subfunction number
662
Returned value:
689
Returned value:
663
  * eax = clock rate (modulo 2^32 clock ticks = 4GHz)
690
  * eax = clock rate (modulo 2^32 clock ticks = 4GHz)
664
 
691
 
665
======================================================================
692
======================================================================
666
 Function 18, subfunction 6 - save ramdisk to the file on hard drive. 
693
 Function 18, subfunction 6 - save ramdisk to the file on hard drive. 
667
======================================================================
694
======================================================================
668
Parameters:
695
Parameters:
669
  * eax = 18 - function number
696
  * eax = 18 - function number
670
  * ebx = 6 - subfunction number
697
  * ebx = 6 - subfunction number
671
  * ecx = pointer to the full path to file
698
  * ecx = pointer to the full path to file
672
    (for example, "/hd0/1/kolibri/kolibri.img")
699
    (for example, "/hd0/1/kolibri/kolibri.img")
673
Returned value:
700
Returned value:
674
  * eax = 0 - success
701
  * eax = 0 - success
675
  * else eax = error code of the file system
702
  * else eax = error code of the file system
676
Remarks:
703
Remarks:
677
  * All folders in the given path must exist, otherwise function
704
  * All folders in the given path must exist, otherwise function
678
    returns value 5, "file not found".
705
    returns value 5, "file not found".
679
 
706
 
680
======================================================================
707
======================================================================
681
=========== Function 18, subfunction 7 - get active window. ==========
708
=========== Function 18, subfunction 7 - get active window. ==========
682
======================================================================
709
======================================================================
683
Parameters:
710
Parameters:
684
  * eax = 18 - function number
711
  * eax = 18 - function number
685
  * ebx = 7 - subfunction number
712
  * ebx = 7 - subfunction number
686
Returned value:
713
Returned value:
687
  * eax = number of the active window
714
  * eax = number of the active window
688
    (number of the slot of the thread with active window)
715
    (number of the slot of the thread with active window)
689
Remarks:
716
Remarks:
690
  * Active window is at the top of the window stack and receives
717
  * Active window is at the top of the window stack and receives
691
    messages on all keyboard input.
718
    messages on all keyboard input.
692
  * To make a window active, use subfunction 3.
719
  * To make a window active, use subfunction 3.
693
 
720
 
694
======================================================================
721
======================================================================
695
== Function 18, subfunction 8 - disable/enable the internal speaker. =
722
== Function 18, subfunction 8 - disable/enable the internal speaker. =
696
======================================================================
723
======================================================================
697
If speaker sound is disabled, all calls to subfunction 55 of
724
If speaker sound is disabled, all calls to subfunction 55 of
698
function 55 are ignored. If speaker sound is enabled,
725
function 55 are ignored. If speaker sound is enabled,
699
they are routed on builtin speaker.
726
they are routed on builtin speaker.
700
 
727
 
701
------------------- Subsubfunction 1 - get status. -------------------
728
------------------- Subsubfunction 1 - get status. -------------------
702
Parameters:
729
Parameters:
703
  * eax = 18 - function number
730
  * eax = 18 - function number
704
  * ebx = 8 - subfunction number
731
  * ebx = 8 - subfunction number
705
  * ecx = 1 - number of the subsubfunction
732
  * ecx = 1 - number of the subsubfunction
706
Returned value:
733
Returned value:
707
  * eax = 0 - speaker sound is enabled; 1 - disabled
734
  * eax = 0 - speaker sound is enabled; 1 - disabled
708
 
735
 
709
----------------- Subsubfunction 2 - toggle status. ------------------
736
----------------- Subsubfunction 2 - toggle status. ------------------
710
Toggles states of disable/enable.
737
Toggles states of disable/enable.
711
Parameters:
738
Parameters:
712
  * eax = 18 - function number
739
  * eax = 18 - function number
713
  * ebx = 8 - subfunction number
740
  * ebx = 8 - subfunction number
714
  * ecx = 2 - number of the subsubfunction
741
  * ecx = 2 - number of the subsubfunction
715
Returned value:
742
Returned value:
716
  * function does not return value
743
  * function does not return value
717
 
744
 
718
======================================================================
745
======================================================================
719
== Function 18, subfunction 9 - system shutdown with the parameter. ==
746
== Function 18, subfunction 9 - system shutdown with the parameter. ==
720
======================================================================
747
======================================================================
721
Parameters:
748
Parameters:
722
  * eax = 18 - function number
749
  * eax = 18 - function number
723
  * ebx = 9 - subfunction number
750
  * ebx = 9 - subfunction number
724
  * ecx = parameter:
751
  * ecx = parameter:
725
    * 1 = on the last step of shutdown save ramdisk on a floppy and
752
    * 1 = on the last step of shutdown save ramdisk on a floppy and
726
      then show the exit menu and request further operations
753
      then show the exit menu and request further operations
727
      from the user
754
      from the user
728
    * 2 = turn off computer
755
    * 2 = turn off computer
729
    * 3 = reboot computer
756
    * 3 = reboot computer
730
    * 4 = restart the kernel from the file 'kernel.mnt' on ramdisk
757
    * 4 = restart the kernel from the file 'kernel.mnt' on ramdisk
731
Returned value:
758
Returned value:
732
  * at incorrect ecx the registers do not change (i.e. eax=18)
759
  * at incorrect ecx the registers do not change (i.e. eax=18)
733
  * by correct call function always returns eax=0
760
  * by correct call function always returns eax=0
734
    as the tag of success
761
    as the tag of success
735
Remarks:
762
Remarks:
736
  * Do not rely on returned value by incorrect call, it can be
763
  * Do not rely on returned value by incorrect call, it can be
737
    changed in future versions of the kernel.
764
    changed in future versions of the kernel.
738
  * It is possible to use subfunction 1, that on the last step
765
  * It is possible to use subfunction 1, that on the last step
739
    the user makes choice himself.
766
    the user makes choice himself.
740
  * It is not recommended to use value ecx=1 (to not irritate the user
767
  * It is not recommended to use value ecx=1 (to not irritate the user
741
    with excessive questions); to save ramdisk on a floppy use
768
    with excessive questions); to save ramdisk on a floppy use
742
    function 16 (which admits specification, on which floppy to
769
    function 16 (which admits specification, on which floppy to
743
    write), and to shutdown with the exit menu use already mentioned
770
    write), and to shutdown with the exit menu use already mentioned
744
    subfunction 1.
771
    subfunction 1.
745
 
772
 
746
======================================================================
773
======================================================================
747
===== Function 18, subfunction 10 - minimize application window. =====
774
===== Function 18, subfunction 10 - minimize application window. =====
748
======================================================================
775
======================================================================
749
Minimizes the own window.
776
Minimizes the own window.
750
Parameters:
777
Parameters:
751
  * eax = 18 - function number
778
  * eax = 18 - function number
752
  * ebx = 10 - subfunction number
779
  * ebx = 10 - subfunction number
753
Returned value:
780
Returned value:
754
  * function does not return value
781
  * function does not return value
755
Remarks:
782
Remarks:
756
  * The minimized window from the point of view of function 9
783
  * The minimized window from the point of view of function 9
757
    keeps position and sizes.
784
    keeps position and sizes.
758
  * Restoring of an application window occurs at its activation by 
785
  * Restoring of an application window occurs at its activation by 
759
    subfunction 3.
786
    subfunction 3.
760
  * Usually there is no necessity to minimize/restire a window
787
  * Usually there is no necessity to minimize/restire a window
761
    obviously: minimization of a window is carried out by the system
788
    obviously: minimization of a window is carried out by the system
762
    at pressing the minimization button (for skinned windows
789
    at pressing the minimization button (for skinned windows
763
    it is defined automatically by function 0,
790
    it is defined automatically by function 0,
764
    for other windows it can be defined manually by function 8),
791
    for other windows it can be defined manually by function 8),
765
    restore of a window is done by the application '@panel'.
792
    restore of a window is done by the application '@panel'.
766
 
793
 
767
======================================================================
794
======================================================================
768
 Function 18, subfunction 11 - get information on the disk subsystem. 
795
 Function 18, subfunction 11 - get information on the disk subsystem. 
769
======================================================================
796
======================================================================
770
Parameters:
797
Parameters:
771
  * eax = 18 - function number
798
  * eax = 18 - function number
772
  * ebx = 11 - subfunction number
799
  * ebx = 11 - subfunction number
773
  * ecx = type of the table:
800
  * ecx = type of the table:
774
    * 1 = short version, 10 bytes
801
    * 1 = short version, 10 bytes
775
    * 2 = full version, 65536 bytes
802
    * 2 = full version, 65536 bytes
776
  * edx = pointer to the buffer (in the application) for the table
803
  * edx = pointer to the buffer (in the application) for the table
777
Returned value:
804
Returned value:
778
  * function does not return value
805
  * function does not return value
779
Format of the table: short version:
806
Format of the table: short version:
780
  * +0: byte: information about FDD's (drives for floppies),
807
  * +0: byte: information about FDD's (drives for floppies),
781
    AAAABBBB, where AAAA gives type of the first drive, BBBB -
808
    AAAABBBB, where AAAA gives type of the first drive, BBBB -
782
    of the second regarding to the following list:
809
    of the second regarding to the following list:
783
    * 0 = there is no drive
810
    * 0 = there is no drive
784
    * 1 = 360Kb, 5.25''
811
    * 1 = 360Kb, 5.25''
785
    * 2 = 1.2Mb, 5.25''
812
    * 2 = 1.2Mb, 5.25''
786
    * 3 = 720Kb, 3.5''
813
    * 3 = 720Kb, 3.5''
787
    * 4 = 1.44Mb, 3.5''
814
    * 4 = 1.44Mb, 3.5''
788
    * 5 = 2.88Mb, 3.5'' (such drives are not used anymore)
815
    * 5 = 2.88Mb, 3.5'' (such drives are not used anymore)
789
    For example, for the standard configuration from one 1.44-drive
816
    For example, for the standard configuration from one 1.44-drive
790
    here will be 40h, and for the case 1.2Mb on A: and 1.44Mb on B:
817
    here will be 40h, and for the case 1.2Mb on A: and 1.44Mb on B:
791
    the value is 24h.
818
    the value is 24h.
792
  * +1: byte: information about hard disks and CD-drives, AABBCCDD,
819
  * +1: byte: information about hard disks and CD-drives, AABBCCDD,
793
    where AA corresponds to the controller IDE0, ..., DD - IDE3:
820
    where AA corresponds to the controller IDE0, ..., DD - IDE3:
794
    * 0 = device is absent
821
    * 0 = device is absent
795
    * 1 = hard drive
822
    * 1 = hard drive
796
    * 2 = CD-drive
823
    * 2 = CD-drive
797
    For example, in the case HD on IDE0 and CD on IDE2
824
    For example, in the case HD on IDE0 and CD on IDE2
798
    this field contains 48h.
825
    this field contains 48h.
799
  * +2: 4 db: number of the retrieved partitions on hard disks
826
  * +2: 4 db: number of the retrieved partitions on hard disks
800
    at accordingly IDE0,...,IDE3.
827
    at accordingly IDE0,...,IDE3.
801
    If the hard disk on IDEx is absent, appropriate byte is zero,
828
    If the hard disk on IDEx is absent, appropriate byte is zero,
802
    otherwise it shows number of the recognized partitions, which
829
    otherwise it shows number of the recognized partitions, which
803
    can be not presented (if the drive is not formatted or if
830
    can be not presented (if the drive is not formatted or if
804
    the file system is not supported). Current version of the kernel
831
    the file system is not supported). Current version of the kernel
805
    supports only FAT16, FAT32 and NTFS for hard disks.
832
    supports only FAT16, FAT32 and NTFS for hard disks.
806
  * +6: 4 db: reserved
833
  * +6: 4 db: reserved
807
Format of the table: full version:
834
Format of the table: full version:
808
  * +0: 10 db: same as for the short version
835
  * +0: 10 db: same as for the short version
809
  * +10: 100 db: data for the first partition
836
  * +10: 100 db: data for the first partition
810
  * +110: 100 db: data for the second partition
837
  * +110: 100 db: data for the second partition
811
  * ...
838
  * ...
812
  * +10+100*(n-1): 100 db: data for the last partition
839
  * +10+100*(n-1): 100 db: data for the last partition
813
The partitions are located as follows: at first sequentially all
840
The partitions are located as follows: at first sequentially all
814
recoginzed partitions on HD on IDE0 (if present),
841
recoginzed partitions on HD on IDE0 (if present),
815
then on HD on IDE1 (if present) and so on up to IDE3.
842
then on HD on IDE1 (if present) and so on up to IDE3.
816
Format of the information about partition
843
Format of the information about partition
817
(at moment only FAT is supported):
844
(at moment only FAT is supported):
818
  * +0: dword: first physical sector of the partition
845
  * +0: dword: first physical sector of the partition
819
  * +4: dword: last physical sector of the partition
846
  * +4: dword: last physical sector of the partition
820
    (belongs to the partition)
847
    (belongs to the partition)
821
  * +8: byte: file system type:
848
  * +8: byte: file system type:
822
    16=FAT16, 32=FAT32, 1=NTFS
849
    16=FAT16, 32=FAT32, 1=NTFS
823
  * other data are dependent on file system, are modified with
850
  * other data are dependent on file system, are modified with
824
    kernel modifications and therefore are not described
851
    kernel modifications and therefore are not described
825
Remarks:
852
Remarks:
826
  * The short table can be used for obtaining the information about
853
  * The short table can be used for obtaining the information about
827
    available devices.
854
    available devices.
828
 
855
 
829
======================================================================
856
======================================================================
830
========== Function 18, subfunction 13 - get kernel version. =========
857
========== Function 18, subfunction 13 - get kernel version. =========
831
======================================================================
858
======================================================================
832
Parameters:
859
Parameters:
833
  * eax = 18 - function number
860
  * eax = 18 - function number
834
  * ebx = 13 - subfunction number
861
  * ebx = 13 - subfunction number
835
  * ecx = pointer to the buffer (not less than 16 bytes), where
862
  * ecx = pointer to the buffer (not less than 16 bytes), where
836
    the information will be placed
863
    the information will be placed
837
Returned value:
864
Returned value:
838
  * function does not return value
865
  * function does not return value
839
Structure of the buffer:
866
Structure of the buffer:
840
db a,b,c,d for version a.b.c.d
867
db a,b,c,d for version a.b.c.d
841
db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
868
db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
842
dd REV - kernel SVN revision number
869
dd REV - kernel SVN revision number
843
For Kolibri 0.7.0.0 kernel:
870
For Kolibri 0.7.0.0 kernel:
844
db 0,7,0,0
871
db 0,7,0,0
845
db 2
872
db 2
846
dd 533
873
dd 533
847
 
874
 
848
======================================================================
875
======================================================================
849
======= Function 18, subfunction 14 - wait for screen retrace. =======
876
======= Function 18, subfunction 14 - wait for screen retrace. =======
850
======================================================================
877
======================================================================
851
Waits for the beginning of retrace of the scanning ray of the screen
878
Waits for the beginning of retrace of the scanning ray of the screen
852
monitor.
879
monitor.
853
Parameters:
880
Parameters:
854
  * eax = 18 - function number
881
  * eax = 18 - function number
855
  * ebx = 14 - subfunction number
882
  * ebx = 14 - subfunction number
856
Returned value:
883
Returned value:
857
  * eax = 0 as the tag of success
884
  * eax = 0 as the tag of success
858
Remarks:
885
Remarks:
859
  * Function is intended only for active high-efficiency graphics
886
  * Function is intended only for active high-efficiency graphics
860
    applications; is used for smooth output of a graphics.
887
    applications; is used for smooth output of a graphics.
861
 
888
 
862
======================================================================
889
======================================================================
863
== Function 18, subfunction 15 - center mouse cursor on the screen. ==
890
== Function 18, subfunction 15 - center mouse cursor on the screen. ==
864
======================================================================
891
======================================================================
865
Parameters:
892
Parameters:
866
  * eax = 18 - function number
893
  * eax = 18 - function number
867
  * ebx = 15 - subfunction number
894
  * ebx = 15 - subfunction number
868
Returned value:
895
Returned value:
869
  * eax = 0 as the tag of success
896
  * eax = 0 as the tag of success
870
 
897
 
871
======================================================================
898
======================================================================
872
========= Function 18, subfunction 16 - get size of free RAM. ========
899
========= Function 18, subfunction 16 - get size of free RAM. ========
873
======================================================================
900
======================================================================
874
Parameters:
901
Parameters:
875
  * eax = 18 - function number
902
  * eax = 18 - function number
876
  * ebx = 16 - subfunction number
903
  * ebx = 16 - subfunction number
877
Returned value:
904
Returned value:
878
  * eax = size of free memory in kilobytes
905
  * eax = size of free memory in kilobytes
879
 
906
 
880
======================================================================
907
======================================================================
881
======== Function 18, subfunction 17 - get full amount of RAM. =======
908
======== Function 18, subfunction 17 - get full amount of RAM. =======
882
======================================================================
909
======================================================================
883
Parameters:
910
Parameters:
884
  * eax = 18 - function number
911
  * eax = 18 - function number
885
  * ebx = 17 - subfunction number
912
  * ebx = 17 - subfunction number
886
Returned value:
913
Returned value:
887
  * eax = total size of existing memory in kilobytes
914
  * eax = total size of existing memory in kilobytes
888
 
915
 
889
======================================================================
916
======================================================================
890
===================== Function 18, subfunction 18 ====================
917
===================== Function 18, subfunction 18 ====================
891
============= Terminate process/thread by the identifier. ============
918
============= Terminate process/thread by the identifier. ============
892
======================================================================
919
======================================================================
893
Parameters:
920
Parameters:
894
  * eax = 18 - function number
921
  * eax = 18 - function number
895
  * ebx = 18 - subfunction number
922
  * ebx = 18 - subfunction number
896
  * ecx = identifer of process/thread (PID/TID)
923
  * ecx = identifer of process/thread (PID/TID)
897
Returned value:
924
Returned value:
898
  * eax = 0 - success
925
  * eax = 0 - success
899
  * eax = -1 - error (process is not found or is system)
926
  * eax = -1 - error (process is not found or is system)
900
Remarks:
927
Remarks:
901
  * It is impossible to terminate system thread OS/IDLE (identifier
928
  * It is impossible to terminate system thread OS/IDLE (identifier
902
    1), it is possible to terminate any normal process/thread.
929
    1), it is possible to terminate any normal process/thread.
903
  * See also subfunction 2 - terminate
930
  * See also subfunction 2 - terminate
904
    process/thread by given slot.
931
    process/thread by given slot.
905
 
932
 
906
======================================================================
933
======================================================================
907
======== Function 18, subfunction 19 - get/set mouse features. =======
934
======== Function 18, subfunction 19 - get/set mouse features. =======
908
======================================================================
935
======================================================================
909
 
936
 
910
---------------- Subsubfunction 0 - get mouse speed. -----------------
937
---------------- Subsubfunction 0 - get mouse speed. -----------------
911
Parameters:
938
Parameters:
912
  * eax = 18 - function number
939
  * eax = 18 - function number
913
  * ebx = 19 - subfunction number
940
  * ebx = 19 - subfunction number
914
  * ecx = 0 - subsubfunction number
941
  * ecx = 0 - subsubfunction number
915
Returned value:
942
Returned value:
916
  * eax = current mouse speed
943
  * eax = current mouse speed
917
 
944
 
918
---------------- Subsubfunction 1 - set mouse speed. -----------------
945
---------------- Subsubfunction 1 - set mouse speed. -----------------
919
Parameters:
946
Parameters:
920
  * eax = 18 - function number
947
  * eax = 18 - function number
921
  * ebx = 19 - subfunction number
948
  * ebx = 19 - subfunction number
922
  * ecx = 1 - subsubfunction number
949
  * ecx = 1 - subsubfunction number
923
  * edx = new value for speed
950
  * edx = new value for speed
924
Returned value:
951
Returned value:
925
  * function does not return value
952
  * function does not return value
926
 
953
 
927
---------------- Subsubfunction 2 - get mouse delay. -----------------
954
---------------- Subsubfunction 2 - get mouse delay. -----------------
928
Parameters:
955
Parameters:
929
  * eax = 18 - function number
956
  * eax = 18 - function number
930
  * ebx = 19 - subfunction number
957
  * ebx = 19 - subfunction number
931
  * ecx = 2 - subsubfunction number
958
  * ecx = 2 - subsubfunction number
932
Returned value:
959
Returned value:
933
  * eax = current mouse delay
960
  * eax = current mouse delay
934
 
961
 
935
---------------- Subsubfunction 3 - set mouse delay. -----------------
962
---------------- Subsubfunction 3 - set mouse delay. -----------------
936
Parameters:
963
Parameters:
937
  * eax = 18 - function number
964
  * eax = 18 - function number
938
  * ebx = 19 - subfunction number
965
  * ebx = 19 - subfunction number
939
  * ecx = 3 - subsubfunction number
966
  * ecx = 3 - subsubfunction number
940
  * edx = new value for mouse delay
967
  * edx = new value for mouse delay
941
Returned value:
968
Returned value:
942
  * function does not return value
969
  * function does not return value
943
 
970
 
944
----------- Subsubfunction 4 - set mouse pointer position. -----------
971
----------- Subsubfunction 4 - set mouse pointer position. -----------
945
Parameters:
972
Parameters:
946
  * eax = 18 - function number
973
  * eax = 18 - function number
947
  * ebx = 19 - subfunction number
974
  * ebx = 19 - subfunction number
948
  * ecx = 4 - subsubfunction number
975
  * ecx = 4 - subsubfunction number
949
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
976
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
950
Returned value:
977
Returned value:
951
  * function does not return value
978
  * function does not return value
952
Remarks:
979
Remarks:
953
  * It is recommended to set speed of the mouse (in subsubfunction 1)
980
  * It is recommended to set speed of the mouse (in subsubfunction 1)
954
    from 1 up to 9. The installed value is not inspected by the kernel
981
    from 1 up to 9. The installed value is not inspected by the kernel
955
    code, so set it carefully, at incorrect value the cursor
982
    code, so set it carefully, at incorrect value the cursor
956
    can "freeze". Speed of the mouse can be regulated through the
983
    can "freeze". Speed of the mouse can be regulated through the
957
    application SETUP.
984
    application SETUP.
958
  * Recommended delay of the mouse (in subsubfunction 3) = 10. Lower
985
  * Recommended delay of the mouse (in subsubfunction 3) = 10. Lower
959
    value is not handled by COM mice. At the very large values the
986
    value is not handled by COM mice. At the very large values the
960
    movement of the mouse on 1 pixel is impossible and the cursor will
987
    movement of the mouse on 1 pixel is impossible and the cursor will
961
    jump on the value of installed speed (subsubfunction 1). The
988
    jump on the value of installed speed (subsubfunction 1). The
962
    installed value is not inspected by the kernel code.
989
    installed value is not inspected by the kernel code.
963
    Mouse delay can be regulated through the application SETUP.
990
    Mouse delay can be regulated through the application SETUP.
964
  * The subsubfunction 4 does not check the passed value. Before
991
  * The subsubfunction 4 does not check the passed value. Before
965
    its call find out current screen resolution (with function 14)
992
    its call find out current screen resolution (with function 14)
966
    and check that the value of position is inside the limits of the
993
    and check that the value of position is inside the limits of the
967
    screen.
994
    screen.
968
 
995
 
969
======================================================================
996
======================================================================
970
======== Function 18, subfunction 20 - get information on RAM. =======
997
======== Function 18, subfunction 20 - get information on RAM. =======
971
======================================================================
998
======================================================================
972
Parameters:
999
Parameters:
973
  * eax = 18 - function number
1000
  * eax = 18 - function number
974
  * ebx = 20 - subfunction number
1001
  * ebx = 20 - subfunction number
975
  * ecx = pointer to the buffer for information (36 bytes)
1002
  * ecx = pointer to the buffer for information (36 bytes)
976
Returned value:
1003
Returned value:
977
  * eax = total size of existing RAM in pages
1004
  * eax = total size of existing RAM in pages
978
    or -1 if error has occured
1005
    or -1 if error has occured
979
  * buffer pointed to by ecx contains the following information:
1006
  * buffer pointed to by ecx contains the following information:
980
    * +0:  dword: total size of existing RAM in pages
1007
    * +0:  dword: total size of existing RAM in pages
981
    * +4:  dword: size of free RAM in pages
1008
    * +4:  dword: size of free RAM in pages
982
    * +8:  dword: number of page faults (exceptions #PF)
1009
    * +8:  dword: number of page faults (exceptions #PF)
983
                 in applications
1010
                 in applications
984
    * +12: dword: size of kernel heap in bytes
1011
    * +12: dword: size of kernel heap in bytes
985
    * +16: dword: free in kernel heap in bytes
1012
    * +16: dword: free in kernel heap in bytes
986
    * +20: dword: total number of memory blocks in kernel heap
1013
    * +20: dword: total number of memory blocks in kernel heap
987
    * +24: dword: number of free memory blocks in kernel heap
1014
    * +24: dword: number of free memory blocks in kernel heap
988
    * +28: dword: size of maximum free block in kernel heap
1015
    * +28: dword: size of maximum free block in kernel heap
989
                 (reserved)
1016
                 (reserved)
990
    * +32: dword: size of maximum allocated block in kernel heap
1017
    * +32: dword: size of maximum allocated block in kernel heap
991
                 (reserved)
1018
                 (reserved)
992
 
1019
 
993
======================================================================
1020
======================================================================
994
==================== Function 20 - MIDI interface. ===================
1021
==================== Function 20 - MIDI interface. ===================
995
======================================================================
1022
======================================================================
996
 
1023
 
997
----------------------- Subfunction 1 - reset ------------------------
1024
----------------------- Subfunction 1 - reset ------------------------
998
Parameters:
1025
Parameters:
999
  * eax = 20 - function number
1026
  * eax = 20 - function number
1000
  * ebx = 1 - subfunction number
1027
  * ebx = 1 - subfunction number
1001
 
1028
 
1002
-------------------- Subfunction 2 - output byte ---------------------
1029
-------------------- Subfunction 2 - output byte ---------------------
1003
Parameters:
1030
Parameters:
1004
  * eax = 20 - function number
1031
  * eax = 20 - function number
1005
  * ebx = 2 - subfunction number
1032
  * ebx = 2 - subfunction number
1006
  * cl = byte for output
1033
  * cl = byte for output
1007
Returned value (is the same for both subfunctions):
1034
Returned value (is the same for both subfunctions):
1008
  * eax = 0 - success
1035
  * eax = 0 - success
1009
  * eax = 1 - base port is not defined
1036
  * eax = 1 - base port is not defined
1010
Remarks:
1037
Remarks:
1011
  * Previously the base port must be defined by 
1038
  * Previously the base port must be defined by 
1012
    subfunction 1 of function 21.
1039
    subfunction 1 of function 21.
1013
 
1040
 
1014
======================================================================
1041
======================================================================
1015
======== Function 21, subfunction 1 - set MPU MIDI base port. ========
1042
======== Function 21, subfunction 1 - set MPU MIDI base port. ========
1016
======================================================================
1043
======================================================================
1017
Parameters:
1044
Parameters:
1018
  * eax = 21 - function number
1045
  * eax = 21 - function number
1019
  * ebx = 1 - subfunction number
1046
  * ebx = 1 - subfunction number
1020
  * ecx = number of base port
1047
  * ecx = number of base port
1021
Returned value
1048
Returned value
1022
  * eax = 0 - success
1049
  * eax = 0 - success
1023
  * eax = -1 - erratic number of a port
1050
  * eax = -1 - erratic number of a port
1024
Remarks:
1051
Remarks:
1025
  * Number of a port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1052
  * Number of a port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1026
  * The installation of base is necessary for function 20.
1053
  * The installation of base is necessary for function 20.
1027
  * To get base port use subfunction 1 of function 26.
1054
  * To get base port use subfunction 1 of function 26.
1028
 
1055
 
1029
======================================================================
1056
======================================================================
1030
========== Function 21, subfunction 2 - set keyboard layout. =========
1057
========== Function 21, subfunction 2 - set keyboard layout. =========
1031
======================================================================
1058
======================================================================
1032
Keyboard layout is used to convert keyboard scancodes to ASCII-codes,
1059
Keyboard layout is used to convert keyboard scancodes to ASCII-codes,
1033
which will be read by function 2.
1060
which will be read by function 2.
1034
Parameters:
1061
Parameters:
1035
  * eax = 21 - function number
1062
  * eax = 21 - function number
1036
  * ebx = 2 - subfunction number
1063
  * ebx = 2 - subfunction number
1037
  * ecx = which layout to set:
1064
  * ecx = which layout to set:
1038
    * 1 = normal layout
1065
    * 1 = normal layout
1039
    * 2 = layout at pressed Shift
1066
    * 2 = layout at pressed Shift
1040
    * 3 = layout at pressed Alt
1067
    * 3 = layout at pressed Alt
1041
  * edx = pointer to layout - table of length 128 bytes
1068
  * edx = pointer to layout - table of length 128 bytes
1042
Or:
1069
Or:
1043
  * ecx = 9
1070
  * ecx = 9
1044
  * dx = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1071
  * dx = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1045
Returned value:
1072
Returned value:
1046
  * eax = 0 - success
1073
  * eax = 0 - success
1047
  * eax = 1 - incorrect parameter
1074
  * eax = 1 - incorrect parameter
1048
Remarks:
1075
Remarks:
1049
  * If Alt is pressed, the layout with Alt is used;
1076
  * If Alt is pressed, the layout with Alt is used;
1050
    if Alt is not pressed, but Shift is pressed,
1077
    if Alt is not pressed, but Shift is pressed,
1051
    the layout with Shift is used;
1078
    the layout with Shift is used;
1052
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1079
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1053
    layout is used and then from the code is subtracted 0x60;
1080
    layout is used and then from the code is subtracted 0x60;
1054
    if no control key is pressed, the normal layout is used.
1081
    if no control key is pressed, the normal layout is used.
1055
  * To get layout and country identifier use 
1082
  * To get layout and country identifier use 
1056
    subfunction 2 of function 26.
1083
    subfunction 2 of function 26.
1057
  * Country identifier is global system variable, which is not used
1084
  * Country identifier is global system variable, which is not used
1058
    by the kernel itself; however the application '@panel' displays
1085
    by the kernel itself; however the application '@panel' displays
1059
    the corresponding icon.
1086
    the corresponding icon.
1060
  * The application @panel switches layouts on user request.
1087
  * The application @panel switches layouts on user request.
1061
 
1088
 
1062
======================================================================
1089
======================================================================
1063
============== Function 21, subfunction 3 - set CD base. =============
1090
============== Function 21, subfunction 3 - set CD base. =============
1064
======================================================================
1091
======================================================================
1065
Parameters:
1092
Parameters:
1066
  * eax = 21 - function number
1093
  * eax = 21 - function number
1067
  * ebx = 3 - subfunction number
1094
  * ebx = 3 - subfunction number
1068
  * ecx = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1095
  * ecx = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1069
Returned value:
1096
Returned value:
1070
  * eax = 0
1097
  * eax = 0
1071
Remarks:
1098
Remarks:
1072
  * CD base is used by function 24.
1099
  * CD base is used by function 24.
1073
  * To get CD base use subfunction 3 of function 26.
1100
  * To get CD base use subfunction 3 of function 26.
1074
 
1101
 
1075
======================================================================
1102
======================================================================
1076
====== Function 21, subfunction 4 - set Sound Blaster base port. =====
1103
====== Function 21, subfunction 4 - set Sound Blaster base port. =====
1077
======================================================================
1104
======================================================================
1078
Parameters:
1105
Parameters:
1079
  * eax = 21 - function number
1106
  * eax = 21 - function number
1080
  * ebx = 4 - subfunction number
1107
  * ebx = 4 - subfunction number
1081
  * ecx = number of the base port
1108
  * ecx = number of the base port
1082
Returned value:
1109
Returned value:
1083
  * eax = 0 - success
1110
  * eax = 0 - success
1084
  * eax = -1 - erratic port number
1111
  * eax = -1 - erratic port number
1085
Remarks:
1112
Remarks:
1086
  * Number of the port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1113
  * Number of the port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1087
  * The installation of the base is necessary for
1114
  * The installation of the base is necessary for
1088
    functions 25, 28, 55.
1115
    functions 25, 28, 55.
1089
  * To get base port use subfunction 4 of function 26.
1116
  * To get base port use subfunction 4 of function 26.
1090
 
1117
 
1091
======================================================================
1118
======================================================================
1092
========== Function 21, subfunction 5 - set system language. =========
1119
========== Function 21, subfunction 5 - set system language. =========
1093
======================================================================
1120
======================================================================
1094
Parameters:
1121
Parameters:
1095
  * eax = 21 - function number
1122
  * eax = 21 - function number
1096
  * ebx = 5 - subfunction number
1123
  * ebx = 5 - subfunction number
1097
  * ecx = system language (1=eng, 2=fi, 3=ger, 4=rus)
1124
  * ecx = system language (1=eng, 2=fi, 3=ger, 4=rus)
1098
Returned value:
1125
Returned value:
1099
  * eax = 0
1126
  * eax = 0
1100
Remarks:
1127
Remarks:
1101
  * System language is global system variable and is not used
1128
  * System language is global system variable and is not used
1102
    by the kernel itself, however application @panel draws the
1129
    by the kernel itself, however application @panel draws the
1103
    appropriate icon.
1130
    appropriate icon.
1104
  * Function does not check for correctness, as the kernel does not
1131
  * Function does not check for correctness, as the kernel does not
1105
    use this variable.
1132
    use this variable.
1106
  * To get system language use subfunction 5 of function 26.
1133
  * To get system language use subfunction 5 of function 26.
1107
 
1134
 
1108
======================================================================
1135
======================================================================
1109
============== Function 21, subfunction 7 - set HD base. =============
1136
============== Function 21, subfunction 7 - set HD base. =============
1110
======================================================================
1137
======================================================================
1111
The HD base defines hard disk to write with usage of obsolete
1138
The HD base defines hard disk to write with usage of obsolete
1112
syntax /HD in obsolete function 58; at usage of modern syntax
1139
syntax /HD in obsolete function 58; at usage of modern syntax
1113
/HD0,/HD1,/HD2,/HD3 base is set automatically.
1140
/HD0,/HD1,/HD2,/HD3 base is set automatically.
1114
Parameters:
1141
Parameters:
1115
  * eax = 21 - function number
1142
  * eax = 21 - function number
1116
  * ebx = 7 - subfunction number
1143
  * ebx = 7 - subfunction number
1117
  * ecx = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1144
  * ecx = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1118
Returned value:
1145
Returned value:
1119
  * eax = 0
1146
  * eax = 0
1120
Remarks:
1147
Remarks:
1121
  * Any application at any time can change the base.
1148
  * Any application at any time can change the base.
1122
  * Do not change base, when any application works with hard disk.
1149
  * Do not change base, when any application works with hard disk.
1123
    If you do not want system bugs.
1150
    If you do not want system bugs.
1124
  * To get HD base use subfunction 7 of function 26.
1151
  * To get HD base use subfunction 7 of function 26.
1125
  * It is also necessary to define used partition of hard disk by 
1152
  * It is also necessary to define used partition of hard disk by 
1126
    subfunction 8.
1153
    subfunction 8.
1127
 
1154
 
1128
======================================================================
1155
======================================================================
1129
========= Function 21, subfunction 8 - set used HD partition. ========
1156
========= Function 21, subfunction 8 - set used HD partition. ========
1130
======================================================================
1157
======================================================================
1131
The HD partition defines partition of the hard disk to write with
1158
The HD partition defines partition of the hard disk to write with
1132
usage of obsolete syntax /HD and obsolete function 58;
1159
usage of obsolete syntax /HD and obsolete function 58;
1133
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1160
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1134
base and partition are set automatically.
1161
base and partition are set automatically.
1135
Parameters:
1162
Parameters:
1136
  * eax = 21 - function number
1163
  * eax = 21 - function number
1137
  * ebx = 8 - subfunction number
1164
  * ebx = 8 - subfunction number
1138
  * ecx = HD partition (beginning from 1)
1165
  * ecx = HD partition (beginning from 1)
1139
Return value:
1166
Return value:
1140
  * eax = 0
1167
  * eax = 0
1141
Remarks:
1168
Remarks:
1142
  * Any application at any time can change partition.
1169
  * Any application at any time can change partition.
1143
  * Do not change partition when any application works with hard disk.
1170
  * Do not change partition when any application works with hard disk.
1144
    If you do not want system bugs.
1171
    If you do not want system bugs.
1145
  * To get used partition use subfunction 8 of function 26.
1172
  * To get used partition use subfunction 8 of function 26.
1146
  * There is no correctness checks.
1173
  * There is no correctness checks.
1147
  * To get the number of partitions of a hard disk use 
1174
  * To get the number of partitions of a hard disk use 
1148
    subfunction 11 of function 18.
1175
    subfunction 11 of function 18.
1149
  * It is also necessary to define used HD base by subfunction 7.
1176
  * It is also necessary to define used HD base by subfunction 7.
1150
 
1177
 
1151
======================================================================
1178
======================================================================
1152
======== Function 21, subfunction 10 - set sound DMA channel. ========
1179
======== Function 21, subfunction 10 - set sound DMA channel. ========
1153
======================================================================
1180
======================================================================
1154
Parameters:
1181
Parameters:
1155
  * eax = 21 - function number
1182
  * eax = 21 - function number
1156
  * ebx = 10 - subfunction number
1183
  * ebx = 10 - subfunction number
1157
  * ecx = number of channel (from 0 up to 3 inclusively)
1184
  * ecx = number of channel (from 0 up to 3 inclusively)
1158
Returned value:
1185
Returned value:
1159
  * eax = 0 - success
1186
  * eax = 0 - success
1160
  * eax = -1 - incorrect channel number
1187
  * eax = -1 - incorrect channel number
1161
Remarks:
1188
Remarks:
1162
  * Number of DMA channel is used in subfunction 1 of function 55.
1189
  * Number of DMA channel is used in subfunction 1 of function 55.
1163
  * To get sound DMA channel use subfunction 10 of function 26.
1190
  * To get sound DMA channel use subfunction 10 of function 26.
1164
 
1191
 
1165
======================================================================
1192
======================================================================
1166
 Function 21, subfunction 11 - enable/disable low-level access to HD. 
1193
 Function 21, subfunction 11 - enable/disable low-level access to HD. 
1167
======================================================================
1194
======================================================================
1168
Parameters:
1195
Parameters:
1169
  * eax = 21 - function number
1196
  * eax = 21 - function number
1170
  * ebx = 11 - subfunction number
1197
  * ebx = 11 - subfunction number
1171
  * ecx = 0/1 - disable/enable
1198
  * ecx = 0/1 - disable/enable
1172
Returned value:
1199
Returned value:
1173
  * eax = 0
1200
  * eax = 0
1174
Remarks:
1201
Remarks:
1175
  * Is used in LBA-read (subfunction 8 of function 58).
1202
  * Is used in LBA-read (subfunction 8 of function 58).
1176
  * The current implementation uses only low bit of ecx.
1203
  * The current implementation uses only low bit of ecx.
1177
  * To get current status use subfunction 11 of function 26.
1204
  * To get current status use subfunction 11 of function 26.
1178
 
1205
 
1179
======================================================================
1206
======================================================================
1180
 Function 21, subfunction 12 - enable/disable low-level access to PCI. 
1207
 Function 21, subfunction 12 - enable/disable low-level access to PCI. 
1181
======================================================================
1208
======================================================================
1182
Parameters:
1209
Parameters:
1183
  * eax = 21 - function number
1210
  * eax = 21 - function number
1184
  * ebx = 12 - subfunction number
1211
  * ebx = 12 - subfunction number
1185
  * ecx = 0/1 - disable/enable
1212
  * ecx = 0/1 - disable/enable
1186
Returned value:
1213
Returned value:
1187
  * eax = 0
1214
  * eax = 0
1188
Remarks:
1215
Remarks:
1189
  * Is used in operations with PCI bus (function 62).
1216
  * Is used in operations with PCI bus (function 62).
1190
  * The current implementation uses only low bit of ecx.
1217
  * The current implementation uses only low bit of ecx.
1191
  * To get current status use subfunction 12 of function 26.
1218
  * To get current status use subfunction 12 of function 26.
1192
 
1219
 
1193
======================================================================
1220
======================================================================
1194
============ Function 21, subfunction 13, subsubfunction 1 ===========
1221
============ Function 21, subfunction 13, subsubfunction 1 ===========
1195
======== Initialize + get information on the driver vmode.mdr. =======
1222
======== Initialize + get information on the driver vmode.mdr. =======
1196
======================================================================
1223
======================================================================
1197
Parameters:
1224
Parameters:
1198
  * eax = 21 - function number
1225
  * eax = 21 - function number
1199
  * ebx = 13 - subfunction number
1226
  * ebx = 13 - subfunction number
1200
  * ecx = 1 - number of the driver function
1227
  * ecx = 1 - number of the driver function
1201
  * edx = pointer to 512-bytes buffer
1228
  * edx = pointer to 512-bytes buffer
1202
Returned value:
1229
Returned value:
1203
  * if driver is not loaded
1230
  * if driver is not loaded
1204
    (never happens in the current implementation):
1231
    (never happens in the current implementation):
1205
    * eax = -1
1232
    * eax = -1
1206
    * ebx, ecx destroyed
1233
    * ebx, ecx destroyed
1207
  * if driver is loaded:
1234
  * if driver is loaded:
1208
    * eax = 'MDAZ' (in fasm style, that is 'M' - low byte, 'Z' - high)
1235
    * eax = 'MDAZ' (in fasm style, that is 'M' - low byte, 'Z' - high)
1209
      - signature
1236
      - signature
1210
    * ebx = current frequency of the scanning (in Hz)
1237
    * ebx = current frequency of the scanning (in Hz)
1211
    * ecx destroyed
1238
    * ecx destroyed
1212
    * buffer pointed to by edx is filled
1239
    * buffer pointed to by edx is filled
1213
Format of the buffer:
1240
Format of the buffer:
1214
  * +0: 32*byte: driver name, "Trans VideoDriver"
1241
  * +0: 32*byte: driver name, "Trans VideoDriver"
1215
    (without quotes, supplemented by spaces)
1242
    (without quotes, supplemented by spaces)
1216
  * +32 = +0x20: dword: driver version (version x.y is encoded as
1243
  * +32 = +0x20: dword: driver version (version x.y is encoded as
1217
    y*65536+x), for the current implementation is 1 (1.0)
1244
    y*65536+x), for the current implementation is 1 (1.0)
1218
  * +36 = +0x24: 7*dword: reserved (0 in the current implementation)
1245
  * +36 = +0x24: 7*dword: reserved (0 in the current implementation)
1219
  * +64 = +0x40: 32*word: list of supported videomodes (each word
1246
  * +64 = +0x40: 32*word: list of supported videomodes (each word
1220
    is number of a videomode, after list itself there are zeroes)
1247
    is number of a videomode, after list itself there are zeroes)
1221
  * +128 = +0x80: 32*(5*word): list of supported frequences of the
1248
  * +128 = +0x80: 32*(5*word): list of supported frequences of the
1222
    scannings for videomodes: for each videomode listed in the
1249
    scannings for videomodes: for each videomode listed in the
1223
    previous field up to 5 supported frequences are given
1250
    previous field up to 5 supported frequences are given
1224
    (unused positions contain zeroes)
1251
    (unused positions contain zeroes)
1225
Remarks:
1252
Remarks:
1226
  * Function initializes the driver (if it is not initialized yet)
1253
  * Function initializes the driver (if it is not initialized yet)
1227
    and must be called first, before others (otherwise they will do
1254
    and must be called first, before others (otherwise they will do
1228
    nothing and return -1).
1255
    nothing and return -1).
1229
  * The current implementation supports only one frequency
1256
  * The current implementation supports only one frequency
1230
    of the scanning on videomode.
1257
    of the scanning on videomode.
1231
 
1258
 
1232
======================================================================
1259
======================================================================
1233
============ Function 21, subfunction 13, subsubfunction 2 ===========
1260
============ Function 21, subfunction 13, subsubfunction 2 ===========
1234
================ Get information on current videomode. ===============
1261
================ Get information on current videomode. ===============
1235
======================================================================
1262
======================================================================
1236
Parameters:
1263
Parameters:
1237
  * eax = 21 - function number
1264
  * eax = 21 - function number
1238
  * ebx = 13 - subfunction number
1265
  * ebx = 13 - subfunction number
1239
  * ecx = 2 - number of the driver function
1266
  * ecx = 2 - number of the driver function
1240
Returned value:
1267
Returned value:
1241
  * eax = -1 - driver is not loaded or not initialized;
1268
  * eax = -1 - driver is not loaded or not initialized;
1242
    ebx,ecx are destroyed
1269
    ebx,ecx are destroyed
1243
  * eax = [width]*65536 + [height]
1270
  * eax = [width]*65536 + [height]
1244
  * ebx = frequency of the vertical scanning (in Hz)
1271
  * ebx = frequency of the vertical scanning (in Hz)
1245
  * ecx = number of current videomode
1272
  * ecx = number of current videomode
1246
Remarks:
1273
Remarks:
1247
  * Driver must be initialized by call to 
1274
  * Driver must be initialized by call to 
1248
    driver function 1.
1275
    driver function 1.
1249
  * If only screen sizes are required, it is more expedient to use
1276
  * If only screen sizes are required, it is more expedient to use
1250
    function 14 taking into account that it
1277
    function 14 taking into account that it
1251
    returns sizes on 1 less.
1278
    returns sizes on 1 less.
1252
 
1279
 
1253
======================================================================
1280
======================================================================
1254
=== Function 21, subfunction 13, subsubfunction 3 - set videomode. ===
1281
=== Function 21, subfunction 13, subsubfunction 3 - set videomode. ===
1255
======================================================================
1282
======================================================================
1256
Parameters:
1283
Parameters:
1257
  * eax = 21 - function number
1284
  * eax = 21 - function number
1258
  * ebx = 13 - subfunction number
1285
  * ebx = 13 - subfunction number
1259
  * ecx = 3 - number of the driver function
1286
  * ecx = 3 - number of the driver function
1260
  * edx = [scanning frequency]*65536 + [videomode number]
1287
  * edx = [scanning frequency]*65536 + [videomode number]
1261
Returned value:
1288
Returned value:
1262
  * eax = -1 - driver is not loaded, not initialized or
1289
  * eax = -1 - driver is not loaded, not initialized or
1263
    an error has occured
1290
    an error has occured
1264
  * eax = 0 - success
1291
  * eax = 0 - success
1265
  * ebx, ecx destroyed
1292
  * ebx, ecx destroyed
1266
Remarks:
1293
Remarks:
1267
  * Driver must be initialized by driver function 1.
1294
  * Driver must be initialized by driver function 1.
1268
  * The videomode number and frequency must be in the table
1295
  * The videomode number and frequency must be in the table
1269
    returned by driver function 1.
1296
    returned by driver function 1.
1270
 
1297
 
1271
======================================================================
1298
======================================================================
1272
============ Function 21, subfunction 13, subsubfunction 4 ===========
1299
============ Function 21, subfunction 13, subsubfunction 4 ===========
1273
================== Return to the initial videomode. ==================
1300
================== Return to the initial videomode. ==================
1274
======================================================================
1301
======================================================================
1275
Returns the screen to the videomode set at system boot.
1302
Returns the screen to the videomode set at system boot.
1276
Parameters:
1303
Parameters:
1277
  * eax = 21 - function number
1304
  * eax = 21 - function number
1278
  * ebx = 13 - subfunction number
1305
  * ebx = 13 - subfunction number
1279
  * ecx = 4 - number of the driver function
1306
  * ecx = 4 - number of the driver function
1280
Returned value:
1307
Returned value:
1281
  * eax = -1 - driver is not loaded or not initialized
1308
  * eax = -1 - driver is not loaded or not initialized
1282
  * eax = 0 - success
1309
  * eax = 0 - success
1283
  * ebx, ecx destroyed
1310
  * ebx, ecx destroyed
1284
Remarks:
1311
Remarks:
1285
  * Driver must be initialized by call to driver function 1.
1312
  * Driver must be initialized by call to driver function 1.
1286
 
1313
 
1287
======================================================================
1314
======================================================================
1288
============ Function 21, subfunction 13, subsubfunction 5 ===========
1315
============ Function 21, subfunction 13, subsubfunction 5 ===========
1289
===== Increase/decrease the size of the visible area of monitor. =====
1316
===== Increase/decrease the size of the visible area of monitor. =====
1290
======================================================================
1317
======================================================================
1291
Parameters:
1318
Parameters:
1292
  * eax = 21 - function number
1319
  * eax = 21 - function number
1293
  * ebx = 13 - subfunction number
1320
  * ebx = 13 - subfunction number
1294
  * ecx = 5 - number of the driver function
1321
  * ecx = 5 - number of the driver function
1295
  * edx = 0/1 - decrease/increase horizontal size on 1 position
1322
  * edx = 0/1 - decrease/increase horizontal size on 1 position
1296
  * edx = 2/3 - is not supported in the current implementation;
1323
  * edx = 2/3 - is not supported in the current implementation;
1297
    is planned as decrease/increase vertical size on 1 position
1324
    is planned as decrease/increase vertical size on 1 position
1298
Returned value:
1325
Returned value:
1299
  * eax = -1 - driver is not loaded or not initialized
1326
  * eax = -1 - driver is not loaded or not initialized
1300
  * eax = 0 - success
1327
  * eax = 0 - success
1301
  * ebx, ecx destroyed
1328
  * ebx, ecx destroyed
1302
Remarks:
1329
Remarks:
1303
  * Driver must be initialized by call to driver function 1.
1330
  * Driver must be initialized by call to driver function 1.
1304
  * Function influences only the physical size of the screen image;
1331
  * Function influences only the physical size of the screen image;
1305
    the logical size (number of pixels) does not change.
1332
    the logical size (number of pixels) does not change.
1306
 
1333
 
1307
======================================================================
1334
======================================================================
1308
================= Function 22 - set system date/time. ================
1335
================= Function 22 - set system date/time. ================
1309
======================================================================
1336
======================================================================
1310
Parameters:
1337
Parameters:
1311
  * eax = 22 - function number
1338
  * eax = 22 - function number
1312
  * ebx = 0 - set time
1339
  * ebx = 0 - set time
1313
    * ecx = 0x00SSMMHH - time in the binary-decimal code (BCD):
1340
    * ecx = 0x00SSMMHH - time in the binary-decimal code (BCD):
1314
    * HH=hour 00..23
1341
    * HH=hour 00..23
1315
    * MM=minute 00..59
1342
    * MM=minute 00..59
1316
    * SS=second 00..59
1343
    * SS=second 00..59
1317
  * ebx = 1 - set date
1344
  * ebx = 1 - set date
1318
    * ecx = 0x00DDMMYY - date in the binary-decimal code (BCD):
1345
    * ecx = 0x00DDMMYY - date in the binary-decimal code (BCD):
1319
    * DD=day 01..31
1346
    * DD=day 01..31
1320
    * MM=month 01..12
1347
    * MM=month 01..12
1321
    * YY=year 00..99
1348
    * YY=year 00..99
1322
  * ebx = 2 - set day of week
1349
  * ebx = 2 - set day of week
1323
    * ecx = 1 for Sunday, ..., 7 for Saturday
1350
    * ecx = 1 for Sunday, ..., 7 for Saturday
1324
  * ebx = 3 - set alarm clock
1351
  * ebx = 3 - set alarm clock
1325
    * ecx = 0x00SSMMHH
1352
    * ecx = 0x00SSMMHH
1326
Returned value:
1353
Returned value:
1327
  * eax = 0 - success
1354
  * eax = 0 - success
1328
  * eax = 1 - incorrect parameter
1355
  * eax = 1 - incorrect parameter
1329
  * eax = 2 - CMOS-battery was unloaded
1356
  * eax = 2 - CMOS-battery was unloaded
1330
Remarks:
1357
Remarks:
1331
  * Value of installation of day of week seems to be doubtful,
1358
  * Value of installation of day of week seems to be doubtful,
1332
    as it a little where is used
1359
    as it a little where is used
1333
    (day of week can be calculated by date).
1360
    (day of week can be calculated by date).
1334
  * Alarm clock can be set on operation in the given time every day.
1361
  * Alarm clock can be set on operation in the given time every day.
1335
    But there is no existing system function to disable it.
1362
    But there is no existing system function to disable it.
1336
  * Operation of alarm clock consists in generation IRQ8.
1363
  * Operation of alarm clock consists in generation IRQ8.
1337
  * Generally CMOS supports for alarm clock set of value 0xFF
1364
  * Generally CMOS supports for alarm clock set of value 0xFF
1338
    as one of parameters and it means that the appropriate parameter
1365
    as one of parameters and it means that the appropriate parameter
1339
    is ignored. But current implementation does not allow this
1366
    is ignored. But current implementation does not allow this
1340
    (will return 1).
1367
    (will return 1).
1341
  * Alarm clock is a global system resource; the set of
1368
  * Alarm clock is a global system resource; the set of
1342
    an alarm clock cancels automatically the previous set.
1369
    an alarm clock cancels automatically the previous set.
1343
    However, at moment no program uses it.
1370
    However, at moment no program uses it.
1344
 
1371
 
1345
======================================================================
1372
======================================================================
1346
============= Function 23 - wait for event with timeout. =============
1373
============= Function 23 - wait for event with timeout. =============
1347
======================================================================
1374
======================================================================
1348
If the message queue is empty, waits for new message in the queue,
1375
If the message queue is empty, waits for new message in the queue,
1349
but no more than given time. Then reads out a message from the queue.
1376
but no more than given time. Then reads out a message from the queue.
1350
 
1377
 
1351
Parameters:
1378
Parameters:
1352
  * eax = 23 - function number
1379
  * eax = 23 - function number
1353
  * ebx = timeout (in 1/100 of second)
1380
  * ebx = timeout (in 1/100 of second)
1354
Returned value:
1381
Returned value:
1355
  * eax = 0 - the message queue is empty
1382
  * eax = 0 - the message queue is empty
1356
  * otherwise eax = event (see the list of events)
1383
  * otherwise eax = event (see the list of events)
1357
Remarks:
1384
Remarks:
1358
  * Only those events are taken into account, which enter into
1385
  * Only those events are taken into account, which enter into
1359
    the mask set by function 40. By default it is
1386
    the mask set by function 40. By default it is
1360
    redraw, key and button events.
1387
    redraw, key and button events.
1361
  * To check for presence of a message in the queue use function 11.
1388
  * To check for presence of a message in the queue use function 11.
1362
    To wait without timeout use function 10.
1389
    To wait without timeout use function 10.
1363
  * Transmission ebx=0 results in immediate returning eax=0.
1390
  * Transmission ebx=0 results in immediate returning eax=0.
1364
  * Current implementation returns immediately with eax=0,
1391
  * Current implementation returns immediately with eax=0,
1365
    if the addition of ebx with the current value of time counter
1392
    if the addition of ebx with the current value of time counter
1366
    makes 32-bit overflow.
1393
    makes 32-bit overflow.
1367
 
1394
 
1368
======================================================================
1395
======================================================================
1369
======== Function 24, subfunction 1 - begin to play CD-audio. ========
1396
======== Function 24, subfunction 1 - begin to play CD-audio. ========
1370
======================================================================
1397
======================================================================
1371
Parameters:
1398
Parameters:
1372
  * eax = 24 - function number
1399
  * eax = 24 - function number
1373
  * ebx = 1 - subfunction number
1400
  * ebx = 1 - subfunction number
1374
  * ecx = 0x00FRSSMM, where
1401
  * ecx = 0x00FRSSMM, where
1375
    * MM = starting minute
1402
    * MM = starting minute
1376
    * SS = starting second
1403
    * SS = starting second
1377
    * FR = starting frame
1404
    * FR = starting frame
1378
Returned value:
1405
Returned value:
1379
  * eax = 0 - success
1406
  * eax = 0 - success
1380
  * eax = 1 - CD base is not defined
1407
  * eax = 1 - CD base is not defined
1381
Remarks:
1408
Remarks:
1382
  * Previously CD base must be defined by the call to 
1409
  * Previously CD base must be defined by the call to 
1383
    subfunction 3 of function 21.
1410
    subfunction 3 of function 21.
1384
  * One second includes 75 frames, one minute includes 60 seconds.
1411
  * One second includes 75 frames, one minute includes 60 seconds.
1385
  * The function is asynchronous (returns control, when play begins).
1412
  * The function is asynchronous (returns control, when play begins).
1386
 
1413
 
1387
======================================================================
1414
======================================================================
1388
======= Function 24, subfunction 2 - get information on tracks. ======
1415
======= Function 24, subfunction 2 - get information on tracks. ======
1389
======================================================================
1416
======================================================================
1390
Parameters:
1417
Parameters:
1391
  * eax = 24 - function number
1418
  * eax = 24 - function number
1392
  * ebx = 2 - subfunction number
1419
  * ebx = 2 - subfunction number
1393
  * ecx = pointer to the buffer for the table
1420
  * ecx = pointer to the buffer for the table
1394
    (maximum 8*64h+4 bytes=100 tracks)
1421
    (maximum 8*64h+4 bytes=100 tracks)
1395
Returned value:
1422
Returned value:
1396
  * eax = 0 - success
1423
  * eax = 0 - success
1397
  * eax = 1 - CD base is not defined
1424
  * eax = 1 - CD base is not defined
1398
Remarks:
1425
Remarks:
1399
  * The format of the table with tracks information is the same as
1426
  * The format of the table with tracks information is the same as
1400
    for ATAPI-CD command 43h (READ TOC), usual table (subcommand 00h).
1427
    for ATAPI-CD command 43h (READ TOC), usual table (subcommand 00h).
1401
    Function returns addresses in MSF.
1428
    Function returns addresses in MSF.
1402
  * Previously CD base port must be set by call to 
1429
  * Previously CD base port must be set by call to 
1403
    subfunction 3 of function 21.
1430
    subfunction 3 of function 21.
1404
  * Function returns information only about no more than 100
1431
  * Function returns information only about no more than 100
1405
    first tracks. In most cases it is enough.
1432
    first tracks. In most cases it is enough.
1406
 
1433
 
1407
======================================================================
1434
======================================================================
1408
========== Function 24, subfunction 3 - stop play CD-audio. ==========
1435
========== Function 24, subfunction 3 - stop play CD-audio. ==========
1409
======================================================================
1436
======================================================================
1410
Parameters:
1437
Parameters:
1411
  * eax = 24 - function number
1438
  * eax = 24 - function number
1412
  * ebx = 1 - subfunction number
1439
  * ebx = 1 - subfunction number
1413
Returned value:
1440
Returned value:
1414
  * eax = 0 - success
1441
  * eax = 0 - success
1415
  * eax = 1 - CD base is not defined
1442
  * eax = 1 - CD base is not defined
1416
Remarks:
1443
Remarks:
1417
  * Previously CD base port must be defined by call to 
1444
  * Previously CD base port must be defined by call to 
1418
    subfunction 3 of function 21.
1445
    subfunction 3 of function 21.
1419
 
1446
 
1420
======================================================================
1447
======================================================================
1421
=================== Function 25 - set SBPro volume. ==================
1448
=================== Function 25 - set SBPro volume. ==================
1422
======================================================================
1449
======================================================================
1423
Parameters:
1450
Parameters:
1424
  * eax = 25 - function number
1451
  * eax = 25 - function number
1425
  * ebx = what to set:
1452
  * ebx = what to set:
1426
    * 1 - set common volume
1453
    * 1 - set common volume
1427
    * 2 - set CD-audio volume
1454
    * 2 - set CD-audio volume
1428
  * cl = volume level: high 4 bits for the left column,
1455
  * cl = volume level: high 4 bits for the left column,
1429
    low 4 bits for the right one
1456
    low 4 bits for the right one
1430
Returned value:
1457
Returned value:
1431
  * eax = 0 - success
1458
  * eax = 0 - success
1432
  * eax = 1 - SB base is not defined
1459
  * eax = 1 - SB base is not defined
1433
  * eax = 2 - incorrect subfunction
1460
  * eax = 2 - incorrect subfunction
1434
Remarks:
1461
Remarks:
1435
  * Previously SB base port must be defined by 
1462
  * Previously SB base port must be defined by 
1436
    subfunction 4 of function 21.
1463
    subfunction 4 of function 21.
1437
  * See also function 28 which sets
1464
  * See also function 28 which sets
1438
    volume for the later standard SB16.
1465
    volume for the later standard SB16.
1439
 
1466
 
1440
======================================================================
1467
======================================================================
1441
======== Function 26, subfunction 1 - get MPU MIDI base port. ========
1468
======== Function 26, subfunction 1 - get MPU MIDI base port. ========
1442
======================================================================
1469
======================================================================
1443
Parameters:
1470
Parameters:
1444
  * eax = 26 - function number
1471
  * eax = 26 - function number
1445
  * ebx = 1 - subfunction number
1472
  * ebx = 1 - subfunction number
1446
Returned value:
1473
Returned value:
1447
  * eax = port number
1474
  * eax = port number
1448
Parameters:
1475
Parameters:
1449
  * To set base port use subfunction 1 of function 21.
1476
  * To set base port use subfunction 1 of function 21.
1450
 
1477
 
1451
======================================================================
1478
======================================================================
1452
========== Function 26, subfunction 2 - get keyboard layout. =========
1479
========== Function 26, subfunction 2 - get keyboard layout. =========
1453
======================================================================
1480
======================================================================
1454
The keyboard layout is used to convert keyboard scancodes to
1481
The keyboard layout is used to convert keyboard scancodes to
1455
ASCII-codes for function 2.
1482
ASCII-codes for function 2.
1456
Parameters:
1483
Parameters:
1457
  * eax = 26 - function number
1484
  * eax = 26 - function number
1458
  * ebx = 2 - subfunction number
1485
  * ebx = 2 - subfunction number
1459
  * ecx = what layout to get:
1486
  * ecx = what layout to get:
1460
    * 1 = normal layout
1487
    * 1 = normal layout
1461
    * 2 = layout with pressed Shift
1488
    * 2 = layout with pressed Shift
1462
    * 3 = layout with pressed Alt
1489
    * 3 = layout with pressed Alt
1463
  * edx = pointer to the 128-bytes buffer, where the layout will be
1490
  * edx = pointer to the 128-bytes buffer, where the layout will be
1464
    copied
1491
    copied
1465
Returned value:
1492
Returned value:
1466
  * function does not return value
1493
  * function does not return value
1467
Or:
1494
Or:
1468
  * eax = 26 - function number
1495
  * eax = 26 - function number
1469
  * ebx = 2 - subfunction number
1496
  * ebx = 2 - subfunction number
1470
  * ecx = 9
1497
  * ecx = 9
1471
Returned value:
1498
Returned value:
1472
  * eax = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1499
  * eax = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1473
Remarks:
1500
Remarks:
1474
  * If Alt is pressed, the layout with Alt is used;
1501
  * If Alt is pressed, the layout with Alt is used;
1475
    if Alt is not pressed, but Shift is pressed,
1502
    if Alt is not pressed, but Shift is pressed,
1476
    the layout with Shift is used;
1503
    the layout with Shift is used;
1477
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1504
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1478
    layout is used and then from the code is subtracted 0x60;
1505
    layout is used and then from the code is subtracted 0x60;
1479
    if no control key is pressed, the normal layout is used.
1506
    if no control key is pressed, the normal layout is used.
1480
  * To set layout and country identifier use 
1507
  * To set layout and country identifier use 
1481
    subfunction 2 of function 21.
1508
    subfunction 2 of function 21.
1482
  * Country identifier is global system variable, which is not used
1509
  * Country identifier is global system variable, which is not used
1483
    by the kernel itself; however the application '@panel' displays
1510
    by the kernel itself; however the application '@panel' displays
1484
    the corresponding icon (using this function).
1511
    the corresponding icon (using this function).
1485
  * The application @panel switches layouts on user request.
1512
  * The application @panel switches layouts on user request.
1486
 
1513
 
1487
======================================================================
1514
======================================================================
1488
============== Function 26, subfunction 3 - get CD base. =============
1515
============== Function 26, subfunction 3 - get CD base. =============
1489
======================================================================
1516
======================================================================
1490
Parameters:
1517
Parameters:
1491
  * eax = 26 - function number
1518
  * eax = 26 - function number
1492
  * ebx = 3 - subfunction number
1519
  * ebx = 3 - subfunction number
1493
Returned value:
1520
Returned value:
1494
  * eax = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1521
  * eax = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1495
Remarks:
1522
Remarks:
1496
  * CD base is used by function 24.
1523
  * CD base is used by function 24.
1497
  * To set CD base use subfunction 3 of function 21.
1524
  * To set CD base use subfunction 3 of function 21.
1498
 
1525
 
1499
======================================================================
1526
======================================================================
1500
====== Function 26, subfunction 4 - get Sound Blaster base port. =====
1527
====== Function 26, subfunction 4 - get Sound Blaster base port. =====
1501
======================================================================
1528
======================================================================
1502
Parameters:
1529
Parameters:
1503
  * eax = 26 - function number
1530
  * eax = 26 - function number
1504
  * ebx = 4 - subfunction number
1531
  * ebx = 4 - subfunction number
1505
Returned value:
1532
Returned value:
1506
  * eax = base port number
1533
  * eax = base port number
1507
Remarks:
1534
Remarks:
1508
  * Bae port is used by functions 25, 55.
1535
  * Bae port is used by functions 25, 55.
1509
  * To set base port use subfunction 4 of function 21.
1536
  * To set base port use subfunction 4 of function 21.
1510
 
1537
 
1511
======================================================================
1538
======================================================================
1512
========== Function 26, subfunction 5 - get system language. =========
1539
========== Function 26, subfunction 5 - get system language. =========
1513
======================================================================
1540
======================================================================
1514
Parameters:
1541
Parameters:
1515
  * eax = 26 - function number
1542
  * eax = 26 - function number
1516
  * ebx = 5 - subfunction number
1543
  * ebx = 5 - subfunction number
1517
Returned value:
1544
Returned value:
1518
  * eax = system language (1=eng, 2=fi, 3=ger, 4=rus)
1545
  * eax = system language (1=eng, 2=fi, 3=ger, 4=rus)
1519
Remarks:
1546
Remarks:
1520
  * System language is global system variable and is not used
1547
  * System language is global system variable and is not used
1521
    by the kernel itself, however application @panel draws the
1548
    by the kernel itself, however application @panel draws the
1522
    appropriate icon (using this function).
1549
    appropriate icon (using this function).
1523
  * To set system language use subfunction 5 of function 21.
1550
  * To set system language use subfunction 5 of function 21.
1524
 
1551
 
1525
======================================================================
1552
======================================================================
1526
============== Function 26, subfunction 7 - get HD base. =============
1553
============== Function 26, subfunction 7 - get HD base. =============
1527
======================================================================
1554
======================================================================
1528
The HD base defines hard disk to write with usage of obsolete
1555
The HD base defines hard disk to write with usage of obsolete
1529
syntax /HD in obsolete function 58; at usage of modern syntax
1556
syntax /HD in obsolete function 58; at usage of modern syntax
1530
/HD0,/HD1,/HD2,/HD3 base is set automatically.
1557
/HD0,/HD1,/HD2,/HD3 base is set automatically.
1531
Parameters:
1558
Parameters:
1532
  * eax = 26 - function number
1559
  * eax = 26 - function number
1533
  * ebx = 7 - subfunction number
1560
  * ebx = 7 - subfunction number
1534
Returned value:
1561
Returned value:
1535
  * eax = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1562
  * eax = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1536
Remarks:
1563
Remarks:
1537
  * Any application in any time can change HD base.
1564
  * Any application in any time can change HD base.
1538
  * To set base use subfunction 7 of function 21.
1565
  * To set base use subfunction 7 of function 21.
1539
  * To get used partition of hard disk use subfunction 8.
1566
  * To get used partition of hard disk use subfunction 8.
1540
 
1567
 
1541
======================================================================
1568
======================================================================
1542
========= Function 26, subfunction 8 - get used HD partition. ========
1569
========= Function 26, subfunction 8 - get used HD partition. ========
1543
======================================================================
1570
======================================================================
1544
The HD partition defines partition of the hard disk to write with
1571
The HD partition defines partition of the hard disk to write with
1545
usage of obsolete syntax /HD in obsolete function 58;
1572
usage of obsolete syntax /HD in obsolete function 58;
1546
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1573
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1547
base and partition are set automatically.
1574
base and partition are set automatically.
1548
Parameters:
1575
Parameters:
1549
  * eax = 26 - function number
1576
  * eax = 26 - function number
1550
  * ebx = 8 - subfunction number
1577
  * ebx = 8 - subfunction number
1551
Returned value:
1578
Returned value:
1552
  * eax = HD partition (beginning from 1)
1579
  * eax = HD partition (beginning from 1)
1553
Remarks:
1580
Remarks:
1554
  * Any application in any time can change partition.
1581
  * Any application in any time can change partition.
1555
  * To set partition use subfunction 8 of function 21.
1582
  * To set partition use subfunction 8 of function 21.
1556
  * To get number of partitions on a hard disk use
1583
  * To get number of partitions on a hard disk use
1557
    subfunction 11 of function 18.
1584
    subfunction 11 of function 18.
1558
  * To get base of used hard disk, use subfunction 7.
1585
  * To get base of used hard disk, use subfunction 7.
1559
 
1586
 
1560
======================================================================
1587
======================================================================
1561
=== Function 26, subfunction 9 - get the value of the time counter. ==
1588
=== Function 26, subfunction 9 - get the value of the time counter. ==
1562
======================================================================
1589
======================================================================
1563
Parameters:
1590
Parameters:
1564
  * eax = 26 - function number
1591
  * eax = 26 - function number
1565
  * ebx = 9 - subfunction number
1592
  * ebx = 9 - subfunction number
1566
Returned value:
1593
Returned value:
1567
  * eax = number of 1/100s of second, past from the system boot time
1594
  * eax = number of 1/100s of second, past from the system boot time
1568
Remarks:
1595
Remarks:
1569
  * Counter takes modulo 2^32, that correspond to a little more
1596
  * Counter takes modulo 2^32, that correspond to a little more
1570
    than 497 days.
1597
    than 497 days.
1571
  * To get system time use function 3.
1598
  * To get system time use function 3.
1572
 
1599
 
1573
======================================================================
1600
======================================================================
1574
======== Function 26, subfunction 10 - get sound DMA channel. ========
1601
======== Function 26, subfunction 10 - get sound DMA channel. ========
1575
======================================================================
1602
======================================================================
1576
Parameters:
1603
Parameters:
1577
  * eax = 26 - function number
1604
  * eax = 26 - function number
1578
  * ebx = 10 - subfunction number
1605
  * ebx = 10 - subfunction number
1579
Returned value:
1606
Returned value:
1580
  * eax = number of the channel (from 0 to 3 inclusive)
1607
  * eax = number of the channel (from 0 to 3 inclusive)
1581
Remarks:
1608
Remarks:
1582
  * Number of the DMA channel is used by subfunction 1 of function 55.
1609
  * Number of the DMA channel is used by subfunction 1 of function 55.
1583
  * To set the sound DMA channel use subfunction 10 of function 21.
1610
  * To set the sound DMA channel use subfunction 10 of function 21.
1584
 
1611
 
1585
======================================================================
1612
======================================================================
1586
===================== Function 26, subfunction 11 ====================
1613
===================== Function 26, subfunction 11 ====================
1587
========== Find out whether low-level HD access is enabled. ==========
1614
========== Find out whether low-level HD access is enabled. ==========
1588
======================================================================
1615
======================================================================
1589
Parameters:
1616
Parameters:
1590
  * eax = 26 - function number
1617
  * eax = 26 - function number
1591
  * ebx = 11 - subfunction number
1618
  * ebx = 11 - subfunction number
1592
Returned value:
1619
Returned value:
1593
  * eax = 0/1 - disabled/enabled
1620
  * eax = 0/1 - disabled/enabled
1594
Remarks:
1621
Remarks:
1595
  * Is used in LBA read (subfunction 8 of function 58).
1622
  * Is used in LBA read (subfunction 8 of function 58).
1596
  * To set current state use subfunction 11 of function 21.
1623
  * To set current state use subfunction 11 of function 21.
1597
 
1624
 
1598
======================================================================
1625
======================================================================
1599
===================== Function 26, subfunction 12 ====================
1626
===================== Function 26, subfunction 12 ====================
1600
========== Find out whether low-level PCI access is enabled. =========
1627
========== Find out whether low-level PCI access is enabled. =========
1601
======================================================================
1628
======================================================================
1602
Parameters:
1629
Parameters:
1603
  * eax = 26 - function number
1630
  * eax = 26 - function number
1604
  * ebx = 12 - subfunction number
1631
  * ebx = 12 - subfunction number
1605
Returned value:
1632
Returned value:
1606
  * eax = 0/1 - disabled/enabled
1633
  * eax = 0/1 - disabled/enabled
1607
Remarks:
1634
Remarks:
1608
  * Is used by operations with PCI bus (function 62).
1635
  * Is used by operations with PCI bus (function 62).
1609
  * The current implementation uses only low bit of ecx.
1636
  * The current implementation uses only low bit of ecx.
1610
  * To set the current state use subfunction 12 of function 21.
1637
  * To set the current state use subfunction 12 of function 21.
1611
 
1638
 
1612
======================================================================
1639
======================================================================
1613
=================== Function 28 - set SB16 volume. ===================
1640
=================== Function 28 - set SB16 volume. ===================
1614
======================================================================
1641
======================================================================
1615
Parameters:
1642
Parameters:
1616
  * eax = 28 - function number
1643
  * eax = 28 - function number
1617
  * ebx = what to install:
1644
  * ebx = what to install:
1618
    * 1 - install common volume
1645
    * 1 - install common volume
1619
    * 2 - install CD-audio volume
1646
    * 2 - install CD-audio volume
1620
  * cl = volume level (0=off, 0xFF=max)
1647
  * cl = volume level (0=off, 0xFF=max)
1621
Returned value:
1648
Returned value:
1622
  * eax = 0 - success
1649
  * eax = 0 - success
1623
  * eax = 1 - SB base is not defined
1650
  * eax = 1 - SB base is not defined
1624
  * eax = 2 - incorrect subfunction
1651
  * eax = 2 - incorrect subfunction
1625
Remarks:
1652
Remarks:
1626
  * Previously SB base port must be defined by
1653
  * Previously SB base port must be defined by
1627
    subfunction 4 of function 21.
1654
    subfunction 4 of function 21.
1628
  * This function gives more variants for volume, that function 25.
1655
  * This function gives more variants for volume, that function 25.
1629
 
1656
 
1630
======================================================================
1657
======================================================================
1631
=================== Function 29 - get system date. ===================
1658
=================== Function 29 - get system date. ===================
1632
======================================================================
1659
======================================================================
1633
Parameters:
1660
Parameters:
1634
  * eax = 29 - function number
1661
  * eax = 29 - function number
1635
Returned value:
1662
Returned value:
1636
  * eax = 0x00DDMMYY, where
1663
  * eax = 0x00DDMMYY, where
1637
    (binary-decimal coding, BCD, is used)
1664
    (binary-decimal coding, BCD, is used)
1638
  * YY = two low digits of year (00..99)
1665
  * YY = two low digits of year (00..99)
1639
  * MM = month (01..12)
1666
  * MM = month (01..12)
1640
  * DD = day (01..31)
1667
  * DD = day (01..31)
1641
Remarks:
1668
Remarks:
1642
  * To set system date use function 22.
1669
  * To set system date use function 22.
1643
 
1670
 
1644
======================================================================
1671
======================================================================
1645
============= Function 30 - work with the current folder. ============
1672
============= Function 30 - work with the current folder. ============
1646
======================================================================
1673
======================================================================
1647
 
1674
 
1648
--------- Subfunction 1 - set current folder for the thread. ---------
1675
--------- Subfunction 1 - set current folder for the thread. ---------
1649
Parameters:
1676
Parameters:
1650
  * eax = 30 - function number
1677
  * eax = 30 - function number
1651
  * ebx = 1 - subfunction number
1678
  * ebx = 1 - subfunction number
1652
  * ecx = pointer to ASCIIZ-string with the path to new current folder
1679
  * ecx = pointer to ASCIIZ-string with the path to new current folder
1653
Returned value:
1680
Returned value:
1654
  * function does not return value
1681
  * function does not return value
1655
 
1682
 
1656
--------- Subfunction 2 - get current folder for the thread. ---------
1683
--------- Subfunction 2 - get current folder for the thread. ---------
1657
Parameters:
1684
Parameters:
1658
  * eax = 30 - function number
1685
  * eax = 30 - function number
1659
  * ebx = 2 - subfunction number
1686
  * ebx = 2 - subfunction number
1660
  * ecx = pointer to buffer
1687
  * ecx = pointer to buffer
1661
  * edx = size of buffer
1688
  * edx = size of buffer
1662
Returned value:
1689
Returned value:
1663
  * eax = size of the current folder's name (including terminating 0)
1690
  * eax = size of the current folder's name (including terminating 0)
1664
Remarks:
1691
Remarks:
1665
  * If the buffer is too small to hold all data, only first (edx-1)
1692
  * If the buffer is too small to hold all data, only first (edx-1)
1666
    bytes are copied and than terminating 0 is inserted.
1693
    bytes are copied and than terminating 0 is inserted.
1667
 
1694
 
1668
======================================================================
1695
======================================================================
1669
=============== Function 32 - delete file from ramdisk. ==============
1696
=============== Function 32 - delete file from ramdisk. ==============
1670
======================================================================
1697
======================================================================
1671
Parameters:
1698
Parameters:
1672
  * eax = 32 - function number
1699
  * eax = 32 - function number
1673
  * ebx = pointer to the filename
1700
  * ebx = pointer to the filename
1674
Returned value:
1701
Returned value:
1675
  * eax = 0 - success; otherwise file system error code
1702
  * eax = 0 - success; otherwise file system error code
1676
Remarks:
1703
Remarks:
1677
  * This function is obsolete; function 58 allows to fulfill
1704
  * This function is obsolete; function 58 allows to fulfill
1678
    the same operations with the extended possibilities.
1705
    the same operations with the extended possibilities.
1679
  * The current implementation returns only values 0(success) and
1706
  * The current implementation returns only values 0(success) and
1680
    5(file not found).
1707
    5(file not found).
1681
  * The filename must be either in the format 8+3 characters
1708
  * The filename must be either in the format 8+3 characters
1682
    (first 8 characters - name itself, last 3 - extension,
1709
    (first 8 characters - name itself, last 3 - extension,
1683
    the short names and extensions are supplemented with spaces),
1710
    the short names and extensions are supplemented with spaces),
1684
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1711
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1685
    (name no more than 8 characters, dot, extension 3 characters
1712
    (name no more than 8 characters, dot, extension 3 characters
1686
    supplemented if necessary by spaces).
1713
    supplemented if necessary by spaces).
1687
    The filename must be written with capital letters. The terminating
1714
    The filename must be written with capital letters. The terminating
1688
    character with code 0 is not necessary (not ASCIIZ-string).
1715
    character with code 0 is not necessary (not ASCIIZ-string).
1689
  * This function does not support folders on the ramdisk.
1716
  * This function does not support folders on the ramdisk.
1690
 
1717
 
1691
======================================================================
1718
======================================================================
1692
================ Function 33 - write file to ramdisk. ================
1719
================ Function 33 - write file to ramdisk. ================
1693
======================================================================
1720
======================================================================
1694
Parameters:
1721
Parameters:
1695
  * eax = 33 - function number
1722
  * eax = 33 - function number
1696
  * ebx = pointer to the filename
1723
  * ebx = pointer to the filename
1697
  * ecx = pointer to data for writing
1724
  * ecx = pointer to data for writing
1698
  * edx = number of bytes for writing
1725
  * edx = number of bytes for writing
1699
  * should be set esi=0
1726
  * should be set esi=0
1700
Returned value:
1727
Returned value:
1701
  * eax = 0 - success, otherwise file system error code
1728
  * eax = 0 - success, otherwise file system error code
1702
Remarks:
1729
Remarks:
1703
  * This function is obsolete; function 70 allows to fulfil
1730
  * This function is obsolete; function 70 allows to fulfil
1704
    the same operations with extended possibilities.
1731
    the same operations with extended possibilities.
1705
  * If esi contains non-zero value and selected file already exists,
1732
  * If esi contains non-zero value and selected file already exists,
1706
    one more file with the same name will be created.
1733
    one more file with the same name will be created.
1707
  * Otherwise file will be overwritten.
1734
  * Otherwise file will be overwritten.
1708
  * The filename must be either in the format 8+3 characters
1735
  * The filename must be either in the format 8+3 characters
1709
    (first 8 characters - name itself, last 3 - extension,
1736
    (first 8 characters - name itself, last 3 - extension,
1710
    the short names and extensions are supplemented with spaces),
1737
    the short names and extensions are supplemented with spaces),
1711
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1738
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1712
    (name no more than 8 characters, dot, extension 3 characters
1739
    (name no more than 8 characters, dot, extension 3 characters
1713
    supplemented if necessary by spaces).
1740
    supplemented if necessary by spaces).
1714
    The filename must be written with capital letters. The terminating
1741
    The filename must be written with capital letters. The terminating
1715
    character with code 0 is not necessary (not ASCIIZ-string).
1742
    character with code 0 is not necessary (not ASCIIZ-string).
1716
  * This function does not support folders on the ramdisk.
1743
  * This function does not support folders on the ramdisk.
1717
 
1744
 
1718
======================================================================
1745
======================================================================
1719
======= Function 35 - read the color of a pixel on the screen. =======
1746
======= Function 35 - read the color of a pixel on the screen. =======
1720
======================================================================
1747
======================================================================
1721
Parameters:
1748
Parameters:
1722
  * eax = 35
1749
  * eax = 35
1723
  * ebx = y*xsize+x, where
1750
  * ebx = y*xsize+x, where
1724
  * (x,y) = coordinates of a pixel (beginning from 0)
1751
  * (x,y) = coordinates of a pixel (beginning from 0)
1725
  * xsize = horizontal screen size
1752
  * xsize = horizontal screen size
1726
Returned value:
1753
Returned value:
1727
  * eax = color 0x00RRGGBB
1754
  * eax = color 0x00RRGGBB
1728
Remarks:
1755
Remarks:
1729
  * To get screen sizes use function 14. Pay attention,
1756
  * To get screen sizes use function 14. Pay attention,
1730
    that it subtracts 1 from both sizes.
1757
    that it subtracts 1 from both sizes.
1731
  * There is also direct access (without any system calls)
1758
  * There is also direct access (without any system calls)
1732
    to videomemory through the selector gs. To get parameters of
1759
    to videomemory through the selector gs. To get parameters of
1733
    the current videomode, use function 61.
1760
    the current videomode, use function 61.
1734
 
1761
 
1735
======================================================================
1762
======================================================================
1736
=================== Function 37 - work with mouse. ===================
1763
=================== Function 37 - work with mouse. ===================
1737
======================================================================
1764
======================================================================
1738
 
1765
 
1739
---------- Subfunction 0 - screen coordinates of the mouse -----------
1766
---------- Subfunction 0 - screen coordinates of the mouse -----------
1740
Parameters:
1767
Parameters:
1741
  * eax = 37 - function number
1768
  * eax = 37 - function number
1742
  * ebx = 0 - subfunction number
1769
  * ebx = 0 - subfunction number
1743
Returned value:
1770
Returned value:
1744
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1771
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1745
    (beginning from 0)
1772
    (beginning from 0)
1746
 
1773
 
1747
-- Subfunction 1 - coordinates of the mouse relative to the window ---
1774
-- Subfunction 1 - coordinates of the mouse relative to the window ---
1748
Parameters:
1775
Parameters:
1749
  * eax = 37 - function number
1776
  * eax = 37 - function number
1750
  * ebx = 1 - subfunction number
1777
  * ebx = 1 - subfunction number
1751
Returned value:
1778
Returned value:
1752
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1779
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1753
    relative to the application window (beginning from 0)
1780
    relative to the application window (beginning from 0)
1754
Remarks:
1781
Remarks:
1755
  * The value is calculated by formula (x-xwnd)*65536 + (y-ywnd).
1782
  * The value is calculated by formula (x-xwnd)*65536 + (y-ywnd).
1756
    If y>=ywnd, the low word is non-negative and contains
1783
    If y>=ywnd, the low word is non-negative and contains
1757
    relative y-coordinate, and the high word - relative x-coordinate
1784
    relative y-coordinate, and the high word - relative x-coordinate
1758
    (with correct sign). Otherwise the low word is negative and still
1785
    (with correct sign). Otherwise the low word is negative and still
1759
    contains relative y-coordinate, and to the high word
1786
    contains relative y-coordinate, and to the high word
1760
    1 should be added.
1787
    1 should be added.
1761
 
1788
 
1762
------------ Subfunction 2 - pressed buttons of the mouse ------------
1789
------------ Subfunction 2 - pressed buttons of the mouse ------------
1763
Parameters:
1790
Parameters:
1764
  * eax = 37 - function number
1791
  * eax = 37 - function number
1765
  * ebx = 2 - subfunction number
1792
  * ebx = 2 - subfunction number
1766
Returned value:
1793
Returned value:
1767
  * eax contains information on the pressed mouse buttons:
1794
  * eax contains information on the pressed mouse buttons:
1768
  * bit 0 is set = left button is pressed
1795
  * bit 0 is set = left button is pressed
1769
  * bit 1 is set = right button is pressed
1796
  * bit 1 is set = right button is pressed
1770
  * bit 2 is set = middle button is pressed
1797
  * bit 2 is set = middle button is pressed
1771
  * bit 3 is set = 4th button is pressed
1798
  * bit 3 is set = 4th button is pressed
1772
  * bit 4 is set = 5th button is pressed
1799
  * bit 4 is set = 5th button is pressed
1773
  * other bits are cleared
1800
  * other bits are cleared
1774
 
1801
 
1775
-------------------- Subfunction 4 - load cursor ---------------------
1802
-------------------- Subfunction 4 - load cursor ---------------------
1776
Parameters:
1803
Parameters:
1777
  * eax = 37 - function number
1804
  * eax = 37 - function number
1778
  * ebx = 4 - subfunction number
1805
  * ebx = 4 - subfunction number
1779
  * dx = data source:
1806
  * dx = data source:
1780
  * dx = LOAD_FROM_FILE = 0 - data in a file
1807
  * dx = LOAD_FROM_FILE = 0 - data in a file
1781
    * ecx = pointer to full path to the cursor file
1808
    * ecx = pointer to full path to the cursor file
1782
    * the file must be in the format .cur, which is standard for
1809
    * the file must be in the format .cur, which is standard for
1783
      MS Windows, at that of the size 32*32 pixels
1810
      MS Windows, at that of the size 32*32 pixels
1784
  * dx = LOAD_FROM_MEM = 1 - data of file are already loaded in memory
1811
  * dx = LOAD_FROM_MEM = 1 - data of file are already loaded in memory
1785
    * ecx = pointer to data of the cursor file
1812
    * ecx = pointer to data of the cursor file
1786
    * the data format is the same as in the previous case
1813
    * the data format is the same as in the previous case
1787
  * dx = LOAD_INDIRECT = 2 - data in memory
1814
  * dx = LOAD_INDIRECT = 2 - data in memory
1788
    * ecx = pointer to cursor image in the format ARGB 32*32 pixels
1815
    * ecx = pointer to cursor image in the format ARGB 32*32 pixels
1789
    * edx = 0xXXYY0002, where
1816
    * edx = 0xXXYY0002, where
1790
      * XX = x-coordinate of cursor hotspot
1817
      * XX = x-coordinate of cursor hotspot
1791
      * YY = y-coordinate
1818
      * YY = y-coordinate
1792
      * 0 <= XX, YY <= 31
1819
      * 0 <= XX, YY <= 31
1793
Returned value:
1820
Returned value:
1794
  * eax = 0 - failed
1821
  * eax = 0 - failed
1795
  * otherwise eax = cursor handle
1822
  * otherwise eax = cursor handle
1796
 
1823
 
1797
--------------------- Subfunction 5 - set cursor ---------------------
1824
--------------------- Subfunction 5 - set cursor ---------------------
1798
Sets new cursor for the window of the current thread.
1825
Sets new cursor for the window of the current thread.
1799
Parameters:
1826
Parameters:
1800
  * eax = 37 - function number
1827
  * eax = 37 - function number
1801
  * ebx = 5 - subfunction number
1828
  * ebx = 5 - subfunction number
1802
  * ecx = cursor handle
1829
  * ecx = cursor handle
1803
Returned value:
1830
Returned value:
1804
  * eax = handle of previous cursor
1831
  * eax = handle of previous cursor
1805
Remarks:
1832
Remarks:
1806
  * If the handle is incorrect, the function restores the default
1833
  * If the handle is incorrect, the function restores the default
1807
    cursor (standard arrow). In particular, ecx=0 restores it.
1834
    cursor (standard arrow). In particular, ecx=0 restores it.
1808
 
1835
 
1809
------------------- Subfunction 6 - delete cursor --------------------
1836
------------------- Subfunction 6 - delete cursor --------------------
1810
Parameters:
1837
Parameters:
1811
  * eax = 37 - function number
1838
  * eax = 37 - function number
1812
  * ebx = 6 - subfunction number
1839
  * ebx = 6 - subfunction number
1813
  * ecx = cursor handle
1840
  * ecx = cursor handle
1814
Returned value:
1841
Returned value:
1815
  * eax destroyed
1842
  * eax destroyed
1816
Remarks:
1843
Remarks:
1817
  * The cursor must be loaded previously by the current thread
1844
  * The cursor must be loaded previously by the current thread
1818
    (with the call to subfunction 4). The function does not delete
1845
    (with the call to subfunction 4). The function does not delete
1819
    system cursors and cursors, loaded by another applications.
1846
    system cursors and cursors, loaded by another applications.
1820
  * If the active cursor (set by subfunction 5) is deleted,
1847
  * If the active cursor (set by subfunction 5) is deleted,
1821
    the system restores the default cursor (standard arrow).
1848
    the system restores the default cursor (standard arrow).
1822
 
1849
 
1823
------------------ Subfunction 7 - get scroll data -------------------
1850
------------------ Subfunction 7 - get scroll data -------------------
1824
Parameters:
1851
Parameters:
1825
  * eax = 37 - function number
1852
  * eax = 37 - function number
1826
  * ebx = 7 - subfunction number
1853
  * ebx = 7 - subfunction number
1827
Returned value:
1854
Returned value:
1828
  * eax = [horizontal offset]*65536 + [vertical offset]
1855
  * eax = [horizontal offset]*65536 + [vertical offset]
1829
Remarks:
1856
Remarks:
1830
  * Scroll data is available for active window only.
1857
  * Scroll data is available for active window only.
1831
  * Values are zeroed after reading.
1858
  * Values are zeroed after reading.
1832
  * Values are signed.
1859
  * Values are signed.
1833
 
1860
 
1834
======================================================================
1861
======================================================================
1835
====================== Function 38 - draw line. ======================
1862
====================== Function 38 - draw line. ======================
1836
======================================================================
1863
======================================================================
1837
Parameters:
1864
Parameters:
1838
  * eax = 38 - function number
1865
  * eax = 38 - function number
1839
  * ebx = [start coordinate on axis x]*65536 +
1866
  * ebx = [start coordinate on axis x]*65536 +
1840
              [end coordinate on axis x]
1867
              [end coordinate on axis x]
1841
  * ecx = [start coordinate on axis y]*65536 +
1868
  * ecx = [start coordinate on axis y]*65536 +
1842
              [end coordinate on axis y]
1869
              [end coordinate on axis y]
1843
  * edx = 0x00RRGGBB - color
1870
  * edx = 0x00RRGGBB - color
1844
    edx = 0x01xxxxxx - draw inversed line
1871
    edx = 0x01xxxxxx - draw inversed line
1845
          (low 24 bits are ignored)
1872
          (low 24 bits are ignored)
1846
Returned value:
1873
Returned value:
1847
  * function does not return value
1874
  * function does not return value
1848
Remarks:
1875
Remarks:
1849
  * Coordinates are relative to the window.
1876
  * Coordinates are relative to the window.
1850
  * End point is also drawn.
1877
  * End point is also drawn.
1851
 
1878
 
1852
======================================================================
1879
======================================================================
1853
== Function 39, subfunction 1 - get a size of the background image. ==
1880
== Function 39, subfunction 1 - get a size of the background image. ==
1854
======================================================================
1881
======================================================================
1855
Parameters:
1882
Parameters:
1856
  * eax = 39 - function number
1883
  * eax = 39 - function number
1857
  * ebx = 1 - subfunction number
1884
  * ebx = 1 - subfunction number
1858
Returned value:
1885
Returned value:
1859
  * eax = [width]*65536 + [height]
1886
  * eax = [width]*65536 + [height]
1860
Remarks:
1887
Remarks:
1861
  * There is a pair function to set sizes of background image -
1888
  * There is a pair function to set sizes of background image -
1862
    subfunction 1 of function 15. After which it is necessary,
1889
    subfunction 1 of function 15. After which it is necessary,
1863
    of course, anew to define image.
1890
    of course, anew to define image.
1864
 
1891
 
1865
======================================================================
1892
======================================================================
1866
== Function 39, subfunction 2 - get pixel from the background image. =
1893
== Function 39, subfunction 2 - get pixel from the background image. =
1867
======================================================================
1894
======================================================================
1868
Parameters:
1895
Parameters:
1869
  * eax = 39 - function number
1896
  * eax = 39 - function number
1870
  * ebx = 2 - subfunction number
1897
  * ebx = 2 - subfunction number
1871
  * ecx = offset
1898
  * ecx = offset
1872
Returned value:
1899
Returned value:
1873
  * eax = 0x00RRGGBB - pixel color, if offset is valid
1900
  * eax = 0x00RRGGBB - pixel color, if offset is valid
1874
    (less than 0x160000-16)
1901
    (less than 0x160000-16)
1875
  * eax = 2 otherwise
1902
  * eax = 2 otherwise
1876
Remarks:
1903
Remarks:
1877
  * Do not rely on returned value for invalid offsets, it may be
1904
  * Do not rely on returned value for invalid offsets, it may be
1878
    changed in future kernel versions.
1905
    changed in future kernel versions.
1879
  * Offset for pixel with coordinates (x,y)
1906
  * Offset for pixel with coordinates (x,y)
1880
    is calculated as (x+y*xsize)*3.
1907
    is calculated as (x+y*xsize)*3.
1881
  * There is a pair function to set pixel on the background image - 
1908
  * There is a pair function to set pixel on the background image - 
1882
    subfunction 2 of function 15.
1909
    subfunction 2 of function 15.
1883
 
1910
 
1884
======================================================================
1911
======================================================================
1885
== Function 39, subfunction 4 - get drawing mode for the background. =
1912
== Function 39, subfunction 4 - get drawing mode for the background. =
1886
======================================================================
1913
======================================================================
1887
Parameters:
1914
Parameters:
1888
  * eax = 39 - function number
1915
  * eax = 39 - function number
1889
  * ebx = 4 - subfunction number
1916
  * ebx = 4 - subfunction number
1890
Returned value:
1917
Returned value:
1891
  * eax = 1 - tile
1918
  * eax = 1 - tile
1892
  * eax = 2 - stretch
1919
  * eax = 2 - stretch
1893
Remarks:
1920
Remarks:
1894
  * There is a pair function to set drawing mode - 
1921
  * There is a pair function to set drawing mode - 
1895
    subfunction 4 of function 15.
1922
    subfunction 4 of function 15.
1896
 
1923
 
1897
======================================================================
1924
======================================================================
1898
=========== Function 40 - set the mask for expected events. ==========
1925
=========== Function 40 - set the mask for expected events. ==========
1899
======================================================================
1926
======================================================================
1900
The mask for expected events affects function working with events
1927
The mask for expected events affects function working with events
1901
10, 11, 23 - they notify only about events allowed by this mask.
1928
10, 11, 23 - they notify only about events allowed by this mask.
1902
Parameters:
1929
Parameters:
1903
  * eax = 40 - function number
1930
  * eax = 40 - function number
1904
  * ebx = mask: bit i corresponds to event i+1 (see list of events)
1931
  * ebx = mask: bit i corresponds to event i+1 (see list of events)
1905
    (set bit permits notice on event)
1932
    (set bit permits notice on event)
1906
Returned value:
1933
Returned value:
1907
  * function does not return value
1934
  * function does not return value
1908
Remarks:
1935
Remarks:
1909
  * Default mask (7=111b) enables nofices about redraw,
1936
  * Default mask (7=111b) enables nofices about redraw,
1910
    keys and buttons. This is enough for many applications.
1937
    keys and buttons. This is enough for many applications.
1911
  * Events prohibited in the mask are saved anyway, when come;
1938
  * Events prohibited in the mask are saved anyway, when come;
1912
    they are simply not informed with event functions.
1939
    they are simply not informed with event functions.
1913
  * Event functions take into account the mask on moment of
1940
  * Event functions take into account the mask on moment of
1914
    function call, not on moment of event arrival.
1941
    function call, not on moment of event arrival.
1915
 
1942
 
1916
======================================================================
1943
======================================================================
1917
==================== Function 41 - get IRQ owner. ====================
1944
==================== Function 41 - get IRQ owner. ====================
1918
======================================================================
1945
======================================================================
1919
Parameters:
1946
Parameters:
1920
  * eax = 41 - function number
1947
  * eax = 41 - function number
1921
  * ebx = IRQ number, 0..15
1948
  * ebx = IRQ number, 0..15
1922
Returned value:
1949
Returned value:
1923
  * eax = owner PID
1950
  * eax = owner PID
1924
  * eax = 0, if there is no owner
1951
  * eax = 0, if there is no owner
1925
  * eax = -1 for incorrect ebx
1952
  * eax = -1 for incorrect ebx
1926
 
1953
 
1927
======================================================================
1954
======================================================================
1928
==================== Function 42 - read IRQ data. ====================
1955
==================== Function 42 - read IRQ data. ====================
1929
======================================================================
1956
======================================================================
1930
When an IRQ occurs, the system reads data from ports indicated
1957
When an IRQ occurs, the system reads data from ports indicated
1931
earlier by function 44 and writes this data to
1958
earlier by function 44 and writes this data to
1932
internal buffer. This function reads out data from that buffer
1959
internal buffer. This function reads out data from that buffer
1933
bytewise.
1960
bytewise.
1934
Parameters:
1961
Parameters:
1935
  * eax = 42 - function number
1962
  * eax = 42 - function number
1936
  * ebx = IRQ number, 0..15
1963
  * ebx = IRQ number, 0..15
1937
Returned value: (use value of ecx to distinguish)
1964
Returned value: (use value of ecx to distinguish)
1938
  * if the thread is not IRQ owner (or IRQ number is incorrect):
1965
  * if the thread is not IRQ owner (or IRQ number is incorrect):
1939
    * ecx = 2
1966
    * ecx = 2
1940
  * if there is no data:
1967
  * if there is no data:
1941
    * eax = 0
1968
    * eax = 0
1942
    * ecx = 1
1969
    * ecx = 1
1943
    * ebx destroyed
1970
    * ebx destroyed
1944
  * if all is ok:
1971
  * if all is ok:
1945
    * eax = byte size of data, not yet read from buffer
1972
    * eax = byte size of data, not yet read from buffer
1946
    * ecx = 0
1973
    * ecx = 0
1947
    * ebx = current byte
1974
    * ebx = current byte
1948
Remarks:
1975
Remarks:
1949
  * Previously the thread must reserve indicated IRQ for itself
1976
  * Previously the thread must reserve indicated IRQ for itself
1950
    by function 45.
1977
    by function 45.
1951
  * The size of data buffer is 4000 bytes, on overflow
1978
  * The size of data buffer is 4000 bytes, on overflow
1952
    "fresh" data cease to be written in the buffer.
1979
    "fresh" data cease to be written in the buffer.
1953
 
1980
 
1954
======================================================================
1981
======================================================================
1955
================ Function 43 - input/output to a port. ===============
1982
================ Function 43 - input/output to a port. ===============
1956
======================================================================
1983
======================================================================
1957
 
1984
 
1958
------------------------ Output data to port -------------------------
1985
------------------------ Output data to port -------------------------
1959
Parameters:
1986
Parameters:
1960
  * eax = 43 - function number
1987
  * eax = 43 - function number
1961
  * bl = byte for output
1988
  * bl = byte for output
1962
  * ecx = port number 0xnnnn (from 0 to 0xFFFF)
1989
  * ecx = port number 0xnnnn (from 0 to 0xFFFF)
1963
Returned value:
1990
Returned value:
1964
  * eax = 0 - success
1991
  * eax = 0 - success
1965
  * eax = 1 - the thread has not reserved the selected port
1992
  * eax = 1 - the thread has not reserved the selected port
1966
 
1993
 
1967
------------------------ Input data from port ------------------------
1994
------------------------ Input data from port ------------------------
1968
Parameters:
1995
Parameters:
1969
  * eax = 43 - function number
1996
  * eax = 43 - function number
1970
  * ebx is ignored
1997
  * ebx is ignored
1971
  * ecx = 0x8000nnnn, where nnnn = port number (from 0 to 0xFFFF)
1998
  * ecx = 0x8000nnnn, where nnnn = port number (from 0 to 0xFFFF)
1972
Returned value:
1999
Returned value:
1973
  * eax = 0 - success, thus ebx = entered byte
2000
  * eax = 0 - success, thus ebx = entered byte
1974
  * eax = 1 - the thread has not reserved the selected port
2001
  * eax = 1 - the thread has not reserved the selected port
1975
Remarks:
2002
Remarks:
1976
  * Previously the thread must reserve the selected port
2003
  * Previously the thread must reserve the selected port
1977
    for itself by function 46.
2004
    for itself by function 46.
1978
  * Instead of call to this function it is better to use
2005
  * Instead of call to this function it is better to use
1979
    processor instructions in/out - this is much
2006
    processor instructions in/out - this is much
1980
    faster and a bit shorter and easier.
2007
    faster and a bit shorter and easier.
1981
 
2008
 
1982
======================================================================
2009
======================================================================
1983
=========== Function 44 - define operations at IRQ arrival. ==========
2010
=========== Function 44 - define operations at IRQ arrival. ==========
1984
======================================================================
2011
======================================================================
1985
At IRQ arrival the system can read the data from ports defined
2012
At IRQ arrival the system can read the data from ports defined
1986
by this function and write these data to internal buffer, whence
2013
by this function and write these data to internal buffer, whence
1987
they can be read by ôóíêöèåé 42.
2014
they can be read by ôóíêöèåé 42.
1988
Parameters:
2015
Parameters:
1989
  * eax = 44 - function number
2016
  * eax = 44 - function number
1990
  * ebx = pointer to the array of structures each describing one port:
2017
  * ebx = pointer to the array of structures each describing one port:
1991
    * +0: word: 0 means end of array, otherwise port number
2018
    * +0: word: 0 means end of array, otherwise port number
1992
    * +2: byte: reserved (ignored)
2019
    * +2: byte: reserved (ignored)
1993
    * +3: byte: 1=read byte from this port, 2=read word
2020
    * +3: byte: 1=read byte from this port, 2=read word
1994
  * ecx = IRQ number, 0..15
2021
  * ecx = IRQ number, 0..15
1995
Returned value:
2022
Returned value:
1996
  * eax = 0 - success
2023
  * eax = 0 - success
1997
  * eax = 1 - the thread is not owner of selected IRQ
2024
  * eax = 1 - the thread is not owner of selected IRQ
1998
Remarks:
2025
Remarks:
1999
  * Previously the thread must reserve for itself selected IRQ
2026
  * Previously the thread must reserve for itself selected IRQ
2000
    by function 45.
2027
    by function 45.
2001
  * First 16 ports are considered only.
2028
  * First 16 ports are considered only.
2002
  * The current implementation considers incorrect value of field +3
2029
  * The current implementation considers incorrect value of field +3
2003
    as a signal to terminate IRQ processing.
2030
    as a signal to terminate IRQ processing.
2004
 
2031
 
2005
======================================================================
2032
======================================================================
2006
=================== Function 45 - reserve/free IRQ. ==================
2033
=================== Function 45 - reserve/free IRQ. ==================
2007
======================================================================
2034
======================================================================
2008
Parameters:
2035
Parameters:
2009
  * eax = 45 - function number
2036
  * eax = 45 - function number
2010
  * ebx = 0 - reserve, 1 = free
2037
  * ebx = 0 - reserve, 1 = free
2011
  * ecx = IRQ number, 0..15
2038
  * ecx = IRQ number, 0..15
2012
Returned value:
2039
Returned value:
2013
  * eax = 0 - success
2040
  * eax = 0 - success
2014
  * eax = 1 - error (invalid IRQ number
2041
  * eax = 1 - error (invalid IRQ number
2015
    or attempt to reserve not free IRQ
2042
    or attempt to reserve not free IRQ
2016
    or to free IRQ, not reserved by this thread)
2043
    or to free IRQ, not reserved by this thread)
2017
Remarks:
2044
Remarks:
2018
  * IRQ reservation is required for functions 42 and 44.
2045
  * IRQ reservation is required for functions 42 and 44.
2019
  * Only one thread can reserve the specific IRQ.
2046
  * Only one thread can reserve the specific IRQ.
2020
  * IRQs, handled by the system itself, are reserved by the system
2047
  * IRQs, handled by the system itself, are reserved by the system
2021
    (thread 1) at booting.
2048
    (thread 1) at booting.
2022
  * When a thread terminates, all reserved by it IRQs
2049
  * When a thread terminates, all reserved by it IRQs
2023
    are freed automatically.
2050
    are freed automatically.
2024
 
2051
 
2025
======================================================================
2052
======================================================================
2026
====== Function 46 - reserve/free a group of input/output ports. =====
2053
====== Function 46 - reserve/free a group of input/output ports. =====
2027
======================================================================
2054
======================================================================
2028
To work with reserved ports an application can access directly by
2055
To work with reserved ports an application can access directly by
2029
commands in/out (recommended way) and can use function 43
2056
commands in/out (recommended way) and can use function 43
2030
(not recommended way).
2057
(not recommended way).
2031
Parameters:
2058
Parameters:
2032
  * eax = 46 - function number
2059
  * eax = 46 - function number
2033
  * ebx = 0 - reserve, 1 - free
2060
  * ebx = 0 - reserve, 1 - free
2034
  * ecx = start port number
2061
  * ecx = start port number
2035
  * edx = end port number (inclusive)
2062
  * edx = end port number (inclusive)
2036
Returned value:
2063
Returned value:
2037
  * eax = 0 - success
2064
  * eax = 0 - success
2038
  * eax = 1 - error
2065
  * eax = 1 - error
2039
Remarks:
2066
Remarks:
2040
  * For ports reservation: an error occurs if and only if
2067
  * For ports reservation: an error occurs if and only if
2041
    one from the following condition satisfies:
2068
    one from the following condition satisfies:
2042
    * start port is more than end port;
2069
    * start port is more than end port;
2043
    * the selected range contains incorrect port number
2070
    * the selected range contains incorrect port number
2044
      (correct are from 0 to 0xFFFF);
2071
      (correct are from 0 to 0xFFFF);
2045
    * limit for the total number of reserved areas is exceeded
2072
    * limit for the total number of reserved areas is exceeded
2046
      (maximum 255 are allowed);
2073
      (maximum 255 are allowed);
2047
    * the selected range intersects with any of earlier reserved
2074
    * the selected range intersects with any of earlier reserved
2048
  * For ports free: an error is an attempt to free range,
2075
  * For ports free: an error is an attempt to free range,
2049
    that was not earlier reserved by this function
2076
    that was not earlier reserved by this function
2050
    (with same ecx,edx).
2077
    (with same ecx,edx).
2051
  * If an error occurs (for both cases) function performs no action.
2078
  * If an error occurs (for both cases) function performs no action.
2052
  * At booting the system reserves for itself ports
2079
  * At booting the system reserves for itself ports
2053
    0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (inclusively).
2080
    0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (inclusively).
2054
  * When a thread terminates, all reserved by it ports
2081
  * When a thread terminates, all reserved by it ports
2055
    are freed automatically.
2082
    are freed automatically.
2056
 
2083
 
2057
======================================================================
2084
======================================================================
2058
============= Function 47 - draw a number in the window. =============
2085
============= Function 47 - draw a number in the window. =============
2059
======================================================================
2086
======================================================================
2060
Parameters:
2087
Parameters:
2061
  * eax = 47 - function number
2088
  * eax = 47 - function number
2062
  * ebx = parameters of conversion number to text:
2089
  * ebx = parameters of conversion number to text:
2063
    * bl = 0 - ecx contains number
2090
    * bl = 0 - ecx contains number
2064
    * bl = 1 - ecx contains pointer to dword-number
2091
    * bl = 1 - ecx contains pointer to dword-number
2065
    * bh = 0 - display in decimal number system
2092
    * bh = 0 - display in decimal number system
2066
    * bh = 1 - display in hexadecimal system
2093
    * bh = 1 - display in hexadecimal system
2067
    * bh = 2 - display in binary system
2094
    * bh = 2 - display in binary system
2068
    * bits 16-21 = how many digits to display
2095
    * bits 16-21 = how many digits to display
2069
    * bits 22-31 reserved and must be set to 0
2096
    * bits 22-31 reserved and must be set to 0
2070
  * ecx = number (if bl=0) or pointer (if bl=1)
2097
  * ecx = number (if bl=0) or pointer (if bl=1)
2071
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
2098
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
2072
  * esi = 0xX0RRGGBB:
2099
  * esi = 0xX0RRGGBB:
2073
    * RR, GG, BB specify the color
2100
    * RR, GG, BB specify the color
2074
    * X = ABnn (bits)
2101
    * X = ABnn (bits)
2075
    * nn = font (0/1)
2102
    * nn = font (0/1)
2076
    * A is ignored
2103
    * A is ignored
2077
    * B=1 - fill background with the color edi
2104
    * B=1 - fill background with the color edi
2078
Returned value:
2105
Returned value:
2079
  * function does not return value
2106
  * function does not return value
2080
Remarks:
2107
Remarks:
2081
  * The given length must not exceed 60.
2108
  * The given length must not exceed 60.
2082
  * The exactly given amount of digits is output. If number is small
2109
  * The exactly given amount of digits is output. If number is small
2083
    and can be written by smaller amount of digits, it is supplemented
2110
    and can be written by smaller amount of digits, it is supplemented
2084
    by leading zeroes; if the number is big and can not be written by
2111
    by leading zeroes; if the number is big and can not be written by
2085
    given amount of digits, extra digits are not drawn.
2112
    given amount of digits, extra digits are not drawn.
2086
  * Parameters of fonts are shown in the description of function 4
2113
  * Parameters of fonts are shown in the description of function 4
2087
    (text output).
2114
    (text output).
2088
 
2115
 
2089
======================================================================
2116
======================================================================
2090
========= Function 48, subfunction 0 - apply screen settings. ========
2117
========= Function 48, subfunction 0 - apply screen settings. ========
2091
======================================================================
2118
======================================================================
2092
Parameters:
2119
Parameters:
2093
  * eax = 48 - function number
2120
  * eax = 48 - function number
2094
  * ebx = 0 - subfunction number
2121
  * ebx = 0 - subfunction number
2095
  * ecx = 0 - reserved
2122
  * ecx = 0 - reserved
2096
Returned value:
2123
Returned value:
2097
  * function does not return value
2124
  * function does not return value
2098
Remarks:
2125
Remarks:
2099
  * Function redraws the screen after parameters change by
2126
  * Function redraws the screen after parameters change by
2100
    subfunctions 1 and 2.
2127
    subfunctions 1 and 2.
2101
  * Function call without prior call to one of indicated subfunctions
2128
  * Function call without prior call to one of indicated subfunctions
2102
    is ignored.
2129
    is ignored.
2103
  * Function call with nonzero ecx is ignored.
2130
  * Function call with nonzero ecx is ignored.
2104
 
2131
 
2105
======================================================================
2132
======================================================================
2106
=========== Function 48, subfunction 1 - set button style. ===========
2133
=========== Function 48, subfunction 1 - set button style. ===========
2107
======================================================================
2134
======================================================================
2108
Parameters:
2135
Parameters:
2109
  * eax = 48 - function number
2136
  * eax = 48 - function number
2110
  * ebx = 1 - subfunction number
2137
  * ebx = 1 - subfunction number
2111
  * ecx = button style:
2138
  * ecx = button style:
2112
    * 0 = flat
2139
    * 0 = flat
2113
    * 1 = 3d
2140
    * 1 = 3d
2114
Returned value:
2141
Returned value:
2115
  * function does not return value
2142
  * function does not return value
2116
Remarks:
2143
Remarks:
2117
  * After call to this function one should redraw the screen by
2144
  * After call to this function one should redraw the screen by
2118
    subfunction 0.
2145
    subfunction 0.
2119
  * Button style influences only to their draw of function 8.
2146
  * Button style influences only to their draw of function 8.
2120
 
2147
 
2121
======================================================================
2148
======================================================================
2122
====== Function 48, subfunction 2 - set standard window colors. ======
2149
====== Function 48, subfunction 2 - set standard window colors. ======
2123
======================================================================
2150
======================================================================
2124
Parameters:
2151
Parameters:
2125
  * eax = 48 - function number
2152
  * eax = 48 - function number
2126
  * ebx = 2 - subfunction number
2153
  * ebx = 2 - subfunction number
2127
  * ecx = pointer to the color table
2154
  * ecx = pointer to the color table
2128
  * edx = size of the color table
2155
  * edx = size of the color table
2129
    (must be 40 bytes for future compatibility)
2156
    (must be 40 bytes for future compatibility)
2130
Format of the color table is shown in description of subfunction 3.
2157
Format of the color table is shown in description of subfunction 3.
2131
Returned value:
2158
Returned value:
2132
  * function does not return value
2159
  * function does not return value
2133
Remarks:
2160
Remarks:
2134
  * After call to this function one should redraw the screen by
2161
  * After call to this function one should redraw the screen by
2135
    subfunction 0.
2162
    subfunction 0.
2136
  * Table of standard colors influences only to applications,
2163
  * Table of standard colors influences only to applications,
2137
    which receive this table obviously (by subfunction 3)
2164
    which receive this table obviously (by subfunction 3)
2138
    and use it (specifying colors from it to drawing functions).
2165
    and use it (specifying colors from it to drawing functions).
2139
  * Table of standard colors is included in skin and is installed
2166
  * Table of standard colors is included in skin and is installed
2140
    anew with skin installation (by subfunction 8).
2167
    anew with skin installation (by subfunction 8).
2141
  * Color table can be viewed/changed interactively with
2168
  * Color table can be viewed/changed interactively with
2142
    the application 'desktop'.
2169
    the application 'desktop'.
2143
 
2170
 
2144
======================================================================
2171
======================================================================
2145
====== Function 48, subfunction 3 - get standard window colors. ======
2172
====== Function 48, subfunction 3 - get standard window colors. ======
2146
======================================================================
2173
======================================================================
2147
Parameters:
2174
Parameters:
2148
  * eax = 48 - function number
2175
  * eax = 48 - function number
2149
  * ebx = 3 - subfunction number
2176
  * ebx = 3 - subfunction number
2150
  * ecx = pointer to the buffer with size edx bytes,
2177
  * ecx = pointer to the buffer with size edx bytes,
2151
    where table will be written
2178
    where table will be written
2152
  * edx = size of color table
2179
  * edx = size of color table
2153
    (must be 40 bytes for future compatibility)
2180
    (must be 40 bytes for future compatibility)
2154
Returned value:
2181
Returned value:
2155
  * function does not return value
2182
  * function does not return value
2156
Format of the color table:
2183
Format of the color table:
2157
each item is dword-value for color 0x00RRGGBB
2184
each item is dword-value for color 0x00RRGGBB
2158
  * +0: dword: frames - color of frame
2185
  * +0: dword: frames - color of frame
2159
  * +4: dword: grab - color of header
2186
  * +4: dword: grab - color of header
2160
  * +8: dword: grab_button - color of button on header bar
2187
  * +8: dword: grab_button - color of button on header bar
2161
  * +12 = +0xC: dword: grab_button_text - color of text on button
2188
  * +12 = +0xC: dword: grab_button_text - color of text on button
2162
    on header bar
2189
    on header bar
2163
  * +16 = +0x10: dword: grab_text - color of text on header
2190
  * +16 = +0x10: dword: grab_text - color of text on header
2164
  * +20 = +0x14: dword: work - color of working area
2191
  * +20 = +0x14: dword: work - color of working area
2165
  * +24 = +0x18: dword: work_button - color of button in working area
2192
  * +24 = +0x18: dword: work_button - color of button in working area
2166
  * +28 = +0x1C: dword: work_button_text - color of text on button
2193
  * +28 = +0x1C: dword: work_button_text - color of text on button
2167
    in working area
2194
    in working area
2168
  * +32 = +0x20: dword: work_text - color of text in working area
2195
  * +32 = +0x20: dword: work_text - color of text in working area
2169
  * +36 = +0x24: dword: work_graph - color of graphics in working area
2196
  * +36 = +0x24: dword: work_graph - color of graphics in working area
2170
Remarks:
2197
Remarks:
2171
  * Structure of the color table is described in the standard
2198
  * Structure of the color table is described in the standard
2172
    include file 'macros.inc' as 'system_colors'; for example,
2199
    include file 'macros.inc' as 'system_colors'; for example,
2173
    it is possible to write:
2200
    it is possible to write:
2174
    	sc	system_colors		; variable declaration
2201
    	sc	system_colors		; variable declaration
2175
    	...				; somewhere one must call
2202
    	...				; somewhere one must call
2176
    					; this function with ecx=sc
2203
    					; this function with ecx=sc
2177
    	mov	ecx, [sc.work_button_text]	; read text color on
2204
    	mov	ecx, [sc.work_button_text]	; read text color on
2178
    					; buttin in working area
2205
    					; buttin in working area
2179
  * A program itself desides to use or not to use color table.
2206
  * A program itself desides to use or not to use color table.
2180
    For usage program must simply at calls to drawing functions select
2207
    For usage program must simply at calls to drawing functions select
2181
    color taken from the table.
2208
    color taken from the table.
2182
  * At change of the table of standard colors (by subfunction 2 with
2209
  * At change of the table of standard colors (by subfunction 2 with
2183
    the subsequent application of changes by subfunction 0 or
2210
    the subsequent application of changes by subfunction 0 or
2184
    at skin set by subfunction 8) the system sends to all windows
2211
    at skin set by subfunction 8) the system sends to all windows
2185
    redraw message (the event with code 1).
2212
    redraw message (the event with code 1).
2186
  * Color table can be viewed/changed interactively with
2213
  * Color table can be viewed/changed interactively with
2187
    the application 'desktop'.
2214
    the application 'desktop'.
2188
 
2215
 
2189
======================================================================
2216
======================================================================
2190
============ Function 48, subfunction 4 - get skin height. ===========
2217
============ Function 48, subfunction 4 - get skin height. ===========
2191
======================================================================
2218
======================================================================
2192
Parameters:
2219
Parameters:
2193
  * eax = 48 - function number
2220
  * eax = 48 - function number
2194
  * ebx = 4 - subfunction number
2221
  * ebx = 4 - subfunction number
2195
Returned value:
2222
Returned value:
2196
  * eax = skin height
2223
  * eax = skin height
2197
Remarks:
2224
Remarks:
2198
  * Skin height is defined as the height of a header
2225
  * Skin height is defined as the height of a header
2199
    of skinned windows.
2226
    of skinned windows.
2200
  * See also general structure of window in the description
2227
  * See also general structure of window in the description
2201
    of function 0.
2228
    of function 0.
2202
 
2229
 
2203
======================================================================
2230
======================================================================
2204
======== Function 48, subfunction 5 - get screen working area. =======
2231
======== Function 48, subfunction 5 - get screen working area. =======
2205
======================================================================
2232
======================================================================
2206
Parameters:
2233
Parameters:
2207
  * eax = 48 - function number
2234
  * eax = 48 - function number
2208
  * ebx = 5 - subfunction number
2235
  * ebx = 5 - subfunction number
2209
Returned value:
2236
Returned value:
2210
  * eax = [left]*65536 + [right]
2237
  * eax = [left]*65536 + [right]
2211
  * ebx = [top]*65536 + [bottom]
2238
  * ebx = [top]*65536 + [bottom]
2212
Remarks:
2239
Remarks:
2213
  * The screen working area defines position and coordinates of
2240
  * The screen working area defines position and coordinates of
2214
    a maximized window.
2241
    a maximized window.
2215
  * The screen working area in view of normal work is all screen
2242
  * The screen working area in view of normal work is all screen
2216
    without system panel (the application '@panel').
2243
    without system panel (the application '@panel').
2217
  * (left,top) are coordinates of the left upper corner,
2244
  * (left,top) are coordinates of the left upper corner,
2218
    (right,bottom) are coordinates of the right lower one.
2245
    (right,bottom) are coordinates of the right lower one.
2219
    Thus the size of working area on x axis can be calculated by
2246
    Thus the size of working area on x axis can be calculated by
2220
    formula right-left+1, on y axis - by formula bottom-right+1.
2247
    formula right-left+1, on y axis - by formula bottom-right+1.
2221
  * See also function 14,
2248
  * See also function 14,
2222
    to get sizes of all screen.
2249
    to get sizes of all screen.
2223
  * There is a pair function to set working area - subfunction 6.
2250
  * There is a pair function to set working area - subfunction 6.
2224
 
2251
 
2225
======================================================================
2252
======================================================================
2226
======== Function 48, subfunction 6 - set screen working area. =======
2253
======== Function 48, subfunction 6 - set screen working area. =======
2227
======================================================================
2254
======================================================================
2228
Parameters:
2255
Parameters:
2229
  * eax = 48 - function number
2256
  * eax = 48 - function number
2230
  * ebx = 6 - subfunction number
2257
  * ebx = 6 - subfunction number
2231
  * ecx = [left]*65536 + [right]
2258
  * ecx = [left]*65536 + [right]
2232
  * edx = [top]*65536 + [bottom]
2259
  * edx = [top]*65536 + [bottom]
2233
Returned value:
2260
Returned value:
2234
  * function does not return value
2261
  * function does not return value
2235
Remarks:
2262
Remarks:
2236
  * The screen working area defines position and coordinates of
2263
  * The screen working area defines position and coordinates of
2237
    a maximized window.
2264
    a maximized window.
2238
  * This function is used only by the application '@panel',
2265
  * This function is used only by the application '@panel',
2239
    which set working area to all screen without system panel.
2266
    which set working area to all screen without system panel.
2240
  * (left,top) are coordinates of the left upper corner,
2267
  * (left,top) are coordinates of the left upper corner,
2241
    (right,bottom) are coordinates of the right lower one.
2268
    (right,bottom) are coordinates of the right lower one.
2242
    Thus the size of working area on x axis can be calculated by
2269
    Thus the size of working area on x axis can be calculated by
2243
    formula right-left+1, on y axis - by formula bottom-right+1.
2270
    formula right-left+1, on y axis - by formula bottom-right+1.
2244
  * If 'left'>='right', x-coordinate of working area is not changed.
2271
  * If 'left'>='right', x-coordinate of working area is not changed.
2245
    If 'left'<0, 'left' will not be set. If 'right' is greater than or
2272
    If 'left'<0, 'left' will not be set. If 'right' is greater than or
2246
    equal to screen width, 'right' will not be set.
2273
    equal to screen width, 'right' will not be set.
2247
    Similarly on y axis.
2274
    Similarly on y axis.
2248
  * See also function 14,
2275
  * See also function 14,
2249
    to get sizes of all screen.
2276
    to get sizes of all screen.
2250
  * There is a pair function to get working area - subfunction 5.
2277
  * There is a pair function to get working area - subfunction 5.
2251
  * This function redraws the screen automatically,
2278
  * This function redraws the screen automatically,
2252
    updating coordinates and sizes of maximized windows.
2279
    updating coordinates and sizes of maximized windows.
2253
    The system sends to all windows redraw message (the event 1).
2280
    The system sends to all windows redraw message (the event 1).
2254
 
2281
 
2255
======================================================================
2282
======================================================================
2256
=========== Function 48, subfunction 7 - get skin margins. ===========
2283
=========== Function 48, subfunction 7 - get skin margins. ===========
2257
======================================================================
2284
======================================================================
2258
Returns the area of a header of a skinned window, intended for
2285
Returns the area of a header of a skinned window, intended for
2259
a text of a header.
2286
a text of a header.
2260
Parameters:
2287
Parameters:
2261
  * eax = 48 - function number
2288
  * eax = 48 - function number
2262
  * ebx = 7 - subfunction number
2289
  * ebx = 7 - subfunction number
2263
Returned value:
2290
Returned value:
2264
  * eax = [left]*65536 + [right]
2291
  * eax = [left]*65536 + [right]
2265
  * ebx = [top]*65536 + [bottom]
2292
  * ebx = [top]*65536 + [bottom]
2266
Remarks:
2293
Remarks:
2267
  * An application decides itself to use or not to use this function.
2294
  * An application decides itself to use or not to use this function.
2268
  * It is recommended to take into account returned value
2295
  * It is recommended to take into account returned value
2269
    of this function for choice of a place for drawing header text
2296
    of this function for choice of a place for drawing header text
2270
    (by function 4) or a substitute of header text
2297
    (by function 4) or a substitute of header text
2271
    (at the discretion of an application).
2298
    (at the discretion of an application).
2272
 
2299
 
2273
======================================================================
2300
======================================================================
2274
============= Function 48, subfunction 8 - set used skin. ============
2301
============= Function 48, subfunction 8 - set used skin. ============
2275
======================================================================
2302
======================================================================
2276
Parameters:
2303
Parameters:
2277
  * eax = 48 - function number
2304
  * eax = 48 - function number
2278
  * ebx = 8 - subfunction number
2305
  * ebx = 8 - subfunction number
2279
  * ecx = pointer to a block for function 58, in
2306
  * ecx = pointer to a block for function 58, in
2280
    which the fields of intermediate buffer and file name are filled
2307
    which the fields of intermediate buffer and file name are filled
2281
Returned value:
2308
Returned value:
2282
  * eax = 0 - success
2309
  * eax = 0 - success
2283
  * otherwise eax = file system error code; if file does not
2310
  * otherwise eax = file system error code; if file does not
2284
    contain valid skin, function returns error 3
2311
    contain valid skin, function returns error 3
2285
    (unknown file system).
2312
    (unknown file system).
2286
Remarks:
2313
Remarks:
2287
  * After successful skin loading the system sends to all windows
2314
  * After successful skin loading the system sends to all windows
2288
    redraw message (the event 1).
2315
    redraw message (the event 1).
2289
  * At booting the system reads skin from file 'default.skn'
2316
  * At booting the system reads skin from file 'default.skn'
2290
    on ramdisk.
2317
    on ramdisk.
2291
  * User can change the skin statically by creating hisself
2318
  * User can change the skin statically by creating hisself
2292
    'default.skn' or dynamically with the application 'desktop'.
2319
    'default.skn' or dynamically with the application 'desktop'.
2293
 
2320
 
2294
======================================================================
2321
======================================================================
2295
=========== Function 49 - Advanced Power Management (APM). ===========
2322
=========== Function 49 - Advanced Power Management (APM). ===========
2296
======================================================================
2323
======================================================================
2297
Parameters:
2324
Parameters:
2298
  * eax = 49 - function number
2325
  * eax = 49 - function number
2299
  * dx = number of the APM function
2326
  * dx = number of the APM function
2300
    (analogue of ax in APM specification)
2327
    (analogue of ax in APM specification)
2301
  * bx, cx = parameters of the APM function
2328
  * bx, cx = parameters of the APM function
2302
Returned value:
2329
Returned value:
2303
  * 16-bit registers ax, bx, cx, dx, si, di and carry flag CF
2330
  * 16-bit registers ax, bx, cx, dx, si, di and carry flag CF
2304
    are set according to the APM specification
2331
    are set according to the APM specification
2305
  * high halves of 32-bit registers eax, ebx, ecx,
2332
  * high halves of 32-bit registers eax, ebx, ecx,
2306
    edx, esi, edi are destroyed
2333
    edx, esi, edi are destroyed
2307
Remarks:
2334
Remarks:
2308
  * APM 1.2 specification is described in the document
2335
  * APM 1.2 specification is described in the document
2309
    "Advanced Power Management (APM) BIOS Specification"
2336
    "Advanced Power Management (APM) BIOS Specification"
2310
    (Revision 1.2), available at
2337
    (Revision 1.2), available at
2311
    http://www.microsoft.com/whdc/archive/amp_12.mspx;
2338
    http://www.microsoft.com/whdc/archive/amp_12.mspx;
2312
    besides it is included in famous Interrupt List by Ralf Brown
2339
    besides it is included in famous Interrupt List by Ralf Brown
2313
    (http://www.pobox.com/~ralf/files.html,
2340
    (http://www.pobox.com/~ralf/files.html,
2314
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/).
2341
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/).
2315
 
2342
 
2316
======================================================================
2343
======================================================================
2317
=================== Function 50 - set window shape. ==================
2344
=================== Function 50 - set window shape. ==================
2318
======================================================================
2345
======================================================================
2319
Normal windows have rectangular shape. This function can give to
2346
Normal windows have rectangular shape. This function can give to
2320
a window any shape. The shape is given by a set of points inside
2347
a window any shape. The shape is given by a set of points inside
2321
the base rectangle belonging to a window. Position and coordinates
2348
the base rectangle belonging to a window. Position and coordinates
2322
of the base rectangle are set by function 0
2349
of the base rectangle are set by function 0
2323
and changed by function 67.
2350
and changed by function 67.
2324
 
2351
 
2325
--------------------------- Set shape data ---------------------------
2352
--------------------------- Set shape data ---------------------------
2326
Parameters:
2353
Parameters:
2327
  * eax = 50 - function number
2354
  * eax = 50 - function number
2328
  * ebx = 0 - subfunction number
2355
  * ebx = 0 - subfunction number
2329
  * ecx = pointer to shape data (array of bytes 0/1)
2356
  * ecx = pointer to shape data (array of bytes 0/1)
2330
Returned value:
2357
Returned value:
2331
  * function does not return value
2358
  * function does not return value
2332
 
2359
 
2333
-------------------------- Set shape scale ---------------------------
2360
-------------------------- Set shape scale ---------------------------
2334
Parameters:
2361
Parameters:
2335
  * eax = 50 - function number
2362
  * eax = 50 - function number
2336
  * ebx = 1 - subfunction number
2363
  * ebx = 1 - subfunction number
2337
  * ecx sets a scale: each byte of data defines
2364
  * ecx sets a scale: each byte of data defines
2338
    (2^scale)*(2^scale) pixels
2365
    (2^scale)*(2^scale) pixels
2339
Returned value:
2366
Returned value:
2340
  * function does not return value
2367
  * function does not return value
2341
Remarks:
2368
Remarks:
2342
  * Default scale is 0 (scale factor is 1). If in the shape data
2369
  * Default scale is 0 (scale factor is 1). If in the shape data
2343
    one byte corresponds to one pixel, there is no necessity
2370
    one byte corresponds to one pixel, there is no necessity
2344
    to set scale.
2371
    to set scale.
2345
  * Let's designate xsize = window width (in pixels), ysize = height;
2372
  * Let's designate xsize = window width (in pixels), ysize = height;
2346
    pay attention, that they are one pixel more than defined by
2373
    pay attention, that they are one pixel more than defined by
2347
    functions 0, 67.
2374
    functions 0, 67.
2348
  * On definition of scale xsize and ysize must be divisible
2375
  * On definition of scale xsize and ysize must be divisible
2349
    on 2^scale.
2376
    on 2^scale.
2350
  * Byte of data on offset 'a' must be 0/1 and defines belonging
2377
  * Byte of data on offset 'a' must be 0/1 and defines belonging
2351
    to a window of square with the side 2^scale (if scale=0,
2378
    to a window of square with the side 2^scale (if scale=0,
2352
    this is one pixel) and coordinates of the left upper corner
2379
    this is one pixel) and coordinates of the left upper corner
2353
    (a mod (xsize shr scale), a div (xsize shr scale))
2380
    (a mod (xsize shr scale), a div (xsize shr scale))
2354
  * Data size: (xsize shr scale)*(ysize shr scale).
2381
  * Data size: (xsize shr scale)*(ysize shr scale).
2355
  * Data must be presented in the memory and not change
2382
  * Data must be presented in the memory and not change
2356
    after set of shape.
2383
    after set of shape.
2357
  * The system views the shape data at every window redraw by
2384
  * The system views the shape data at every window redraw by
2358
    function 0.
2385
    function 0.
2359
  * The call of subfunction 0 with NULL pointer results in return
2386
  * The call of subfunction 0 with NULL pointer results in return
2360
    to the rectangular shape.
2387
    to the rectangular shape.
2361
 
2388
 
2362
======================================================================
2389
======================================================================
2363
==================== Function 51 - create thread. ====================
2390
==================== Function 51 - create thread. ====================
2364
======================================================================
2391
======================================================================
2365
Parameters:
2392
Parameters:
2366
  * eax = 51 - function number
2393
  * eax = 51 - function number
2367
  * ebx = 1 - unique subfunction
2394
  * ebx = 1 - unique subfunction
2368
  * ecx = address of thread entry point (starting eip)
2395
  * ecx = address of thread entry point (starting eip)
2369
  * edx = pointer to thread stack (starting esp)
2396
  * edx = pointer to thread stack (starting esp)
2370
Returned value:
2397
Returned value:
2371
  * eax = -1 - error (there is too many threads)
2398
  * eax = -1 - error (there is too many threads)
2372
  * otherwise eax = TID - thread identifier
2399
  * otherwise eax = TID - thread identifier
2373
         
2400
         
2374
 
2401
 
2375
======================================================================
2402
======================================================================
2376
=== Function 52, subfunction 0 - get network driver configuration. ===
2403
=== Function 52, subfunction 0 - get network driver configuration. ===
2377
======================================================================
2404
======================================================================
2378
Parameters:
2405
Parameters:
2379
  * eax = 52 - function number
2406
  * eax = 52 - function number
2380
  * ebx = 0 - subfunction number
2407
  * ebx = 0 - subfunction number
2381
Returned value:
2408
Returned value:
2382
  * eax = configuration dword
2409
  * eax = configuration dword
2383
Remarks:
2410
Remarks:
2384
  * Configuration dword can be set by subfunction 2.
2411
  * Configuration dword can be set by subfunction 2.
2385
  * The kernel does not use this variable. The value of this
2412
  * The kernel does not use this variable. The value of this
2386
    variable and working with it subfunctions 0 and 2 is represented
2413
    variable and working with it subfunctions 0 and 2 is represented
2387
    doubtful.
2414
    doubtful.
2388
 
2415
 
2389
======================================================================
2416
======================================================================
2390
========= Function 52, subfunction 1 - get local IP-address. =========
2417
========= Function 52, subfunction 1 - get local IP-address. =========
2391
======================================================================
2418
======================================================================
2392
Parameters:
2419
Parameters:
2393
  * eax = 52 - function number
2420
  * eax = 52 - function number
2394
  * ebx = 1 - subfunction number
2421
  * ebx = 1 - subfunction number
2395
Returned value:
2422
Returned value:
2396
  * eax = IP-address (4 bytes)
2423
  * eax = IP-address (4 bytes)
2397
Remarks:
2424
Remarks:
2398
  * Local IP-address is set by subfunction 3.
2425
  * Local IP-address is set by subfunction 3.
2399
 
2426
 
2400
======================================================================
2427
======================================================================
2401
=== Function 52, subfunction 2 - set network driver configuration. ===
2428
=== Function 52, subfunction 2 - set network driver configuration. ===
2402
======================================================================
2429
======================================================================
2403
Parameters:
2430
Parameters:
2404
  * eax = 52 - function number
2431
  * eax = 52 - function number
2405
  * ebx = 2 - subfunction number
2432
  * ebx = 2 - subfunction number
2406
  * ecx = configuration dword; if low 7 bits derivate the number 3,
2433
  * ecx = configuration dword; if low 7 bits derivate the number 3,
2407
    function [re-]initializes Ethernet-card, otherwise
2434
    function [re-]initializes Ethernet-card, otherwise
2408
    Ethernet turns off
2435
    Ethernet turns off
2409
Returned value:
2436
Returned value:
2410
  * if Ethernet-interface is not requested, function returns eax=2,
2437
  * if Ethernet-interface is not requested, function returns eax=2,
2411
    but this can be changed in future kernel versions
2438
    but this can be changed in future kernel versions
2412
  * if Ethernet-interface is requested, eax=0 means error
2439
  * if Ethernet-interface is requested, eax=0 means error
2413
    (absence of Ethernet-card), and nonzero value - success
2440
    (absence of Ethernet-card), and nonzero value - success
2414
Remarks:
2441
Remarks:
2415
  * Configuration dword can be read by subfunction 0.
2442
  * Configuration dword can be read by subfunction 0.
2416
  * The kernel does not use this variable. The value of this
2443
  * The kernel does not use this variable. The value of this
2417
    variable, subfunction 0 and part of subfunction 2, which set it,
2444
    variable, subfunction 0 and part of subfunction 2, which set it,
2418
    is represented doubtful.
2445
    is represented doubtful.
2419
 
2446
 
2420
======================================================================
2447
======================================================================
2421
========= Function 52, subfunction 3 - set local IP-address. =========
2448
========= Function 52, subfunction 3 - set local IP-address. =========
2422
======================================================================
2449
======================================================================
2423
Parameters:
2450
Parameters:
2424
  * eax = 52 - function number
2451
  * eax = 52 - function number
2425
  * ebx = 3 - subfunction number
2452
  * ebx = 3 - subfunction number
2426
  * ecx = IP-address (4 bytes)
2453
  * ecx = IP-address (4 bytes)
2427
Returned value:
2454
Returned value:
2428
  * the current implementation returns eax=3, but this can be changed
2455
  * the current implementation returns eax=3, but this can be changed
2429
    in future versions
2456
    in future versions
2430
Remarks:
2457
Remarks:
2431
  * Local IP-address can be get by subfunction 1.
2458
  * Local IP-address can be get by subfunction 1.
2432
 
2459
 
2433
======================================================================
2460
======================================================================
2434
= Function 52, subfunction 6 - add data to the stack of input queue. =
2461
= Function 52, subfunction 6 - add data to the stack of input queue. =
2435
======================================================================
2462
======================================================================
2436
Parameters:
2463
Parameters:
2437
  * eax = 52 - function number
2464
  * eax = 52 - function number
2438
  * ebx = 6 - subfunction number
2465
  * ebx = 6 - subfunction number
2439
  * edx = data size
2466
  * edx = data size
2440
  * esi = data pointer
2467
  * esi = data pointer
2441
Returned value:
2468
Returned value:
2442
  * eax = -1 - error
2469
  * eax = -1 - error
2443
  * eax = 0 - success
2470
  * eax = 0 - success
2444
Remarks:
2471
Remarks:
2445
  * This function is intended only for slow network drivers
2472
  * This function is intended only for slow network drivers
2446
    (PPP, SLIP).
2473
    (PPP, SLIP).
2447
  * Data size must not exceed 1500 bytes, though function
2474
  * Data size must not exceed 1500 bytes, though function
2448
    performs no checks on correctness.
2475
    performs no checks on correctness.
2449
 
2476
 
2450
======================================================================
2477
======================================================================
2451
 Function 52, subfunction 8 - read data from the network output queue. 
2478
 Function 52, subfunction 8 - read data from the network output queue. 
2452
======================================================================
2479
======================================================================
2453
Parameters:
2480
Parameters:
2454
  * eax = 52 - function number
2481
  * eax = 52 - function number
2455
  * ebx = 8 - subfunction number
2482
  * ebx = 8 - subfunction number
2456
  * esi = pointer to 1500-byte buffer
2483
  * esi = pointer to 1500-byte buffer
2457
Returned value:
2484
Returned value:
2458
  * eax = number of read bytes (in the current implementation
2485
  * eax = number of read bytes (in the current implementation
2459
    either 0 = no data or 1500)
2486
    either 0 = no data or 1500)
2460
  * data was copied in buffer
2487
  * data was copied in buffer
2461
Remarks:
2488
Remarks:
2462
  * This function is intended only for slow network drivers
2489
  * This function is intended only for slow network drivers
2463
    (PPP, SLIP).
2490
    (PPP, SLIP).
2464
 
2491
 
2465
======================================================================
2492
======================================================================
2466
============ Function 52, subfunction 9 - get gateway IP. ============
2493
============ Function 52, subfunction 9 - get gateway IP. ============
2467
======================================================================
2494
======================================================================
2468
Parameters:
2495
Parameters:
2469
  * eax = 52 - function number
2496
  * eax = 52 - function number
2470
  * ebx = 9 - subfunction number
2497
  * ebx = 9 - subfunction number
2471
Returned value:
2498
Returned value:
2472
  * eax = gateway IP (4 bytes)
2499
  * eax = gateway IP (4 bytes)
2473
 
2500
 
2474
======================================================================
2501
======================================================================
2475
=========== Function 52, subfunction 10 - get subnet mask. ===========
2502
=========== Function 52, subfunction 10 - get subnet mask. ===========
2476
======================================================================
2503
======================================================================
2477
Parameters:
2504
Parameters:
2478
  * eax = 52 - function number
2505
  * eax = 52 - function number
2479
  * ebx = 10 - subfunction number
2506
  * ebx = 10 - subfunction number
2480
Returned value:
2507
Returned value:
2481
  * eax = subnet mask
2508
  * eax = subnet mask
2482
 
2509
 
2483
======================================================================
2510
======================================================================
2484
============ Function 52, subfunction 11 - set gateway IP. ===========
2511
============ Function 52, subfunction 11 - set gateway IP. ===========
2485
======================================================================
2512
======================================================================
2486
Parameters:
2513
Parameters:
2487
  * eax = 52 - function number
2514
  * eax = 52 - function number
2488
  * ebx = 11 - subfunction number
2515
  * ebx = 11 - subfunction number
2489
  * ecx = gateway IP (4 bytes)
2516
  * ecx = gateway IP (4 bytes)
2490
Returned value:
2517
Returned value:
2491
  * the current implementation returns eax=11, but this can be changed
2518
  * the current implementation returns eax=11, but this can be changed
2492
    in future versions
2519
    in future versions
2493
 
2520
 
2494
======================================================================
2521
======================================================================
2495
=========== Function 52, subfunction 12 - set subnet mask. ===========
2522
=========== Function 52, subfunction 12 - set subnet mask. ===========
2496
======================================================================
2523
======================================================================
2497
Parameters:
2524
Parameters:
2498
  * eax = 52 - function number
2525
  * eax = 52 - function number
2499
  * ebx = 12 - subfunction number
2526
  * ebx = 12 - subfunction number
2500
  * ecx = subnet mask
2527
  * ecx = subnet mask
2501
Returned value:
2528
Returned value:
2502
  * the current implementation returns eax=12, but this can be changed
2529
  * the current implementation returns eax=12, but this can be changed
2503
    in future versions
2530
    in future versions
2504
 
2531
 
2505
======================================================================
2532
======================================================================
2506
============== Function 52, subfunction 13 - get DNS IP. =============
2533
============== Function 52, subfunction 13 - get DNS IP. =============
2507
======================================================================
2534
======================================================================
2508
Parameters:
2535
Parameters:
2509
  * eax = 52 - function number
2536
  * eax = 52 - function number
2510
  * ebx = 13 - subfunction number
2537
  * ebx = 13 - subfunction number
2511
Returned value:
2538
Returned value:
2512
  * eax = DNS IP (4 bytes)
2539
  * eax = DNS IP (4 bytes)
2513
 
2540
 
2514
======================================================================
2541
======================================================================
2515
============== Function 52, subfunction 14 - set DNS IP. =============
2542
============== Function 52, subfunction 14 - set DNS IP. =============
2516
======================================================================
2543
======================================================================
2517
Parameters:
2544
Parameters:
2518
  * eax = 52 - function number
2545
  * eax = 52 - function number
2519
  * ebx = 14 - subfunction number
2546
  * ebx = 14 - subfunction number
2520
  * ecx = DNS IP (4 bytes)
2547
  * ecx = DNS IP (4 bytes)
2521
Returned value:
2548
Returned value:
2522
  * the current implementation returns eax=14, but this can be changed
2549
  * the current implementation returns eax=14, but this can be changed
2523
    in future versions
2550
    in future versions
2524
 
2551
 
2525
======================================================================
2552
======================================================================
2526
======== Function 52, subfunction 15 - get local MAC address. ========
2553
======== Function 52, subfunction 15 - get local MAC address. ========
2527
======================================================================
2554
======================================================================
2528
Parameters:
2555
Parameters:
2529
  * eax = 52 - function number
2556
  * eax = 52 - function number
2530
  * ebx = 15 - subfunction number
2557
  * ebx = 15 - subfunction number
2531
  * ecx = 0 - read first 4 bytes,
2558
  * ecx = 0 - read first 4 bytes,
2532
    ecx = 4 - read last 2 bytes
2559
    ecx = 4 - read last 2 bytes
2533
Returned value:
2560
Returned value:
2534
  * for ecx=0: eax = first 4 bytes of MAC address
2561
  * for ecx=0: eax = first 4 bytes of MAC address
2535
  * for ecx=4: ax = last 2 bytes of MAC address,
2562
  * for ecx=4: ax = last 2 bytes of MAC address,
2536
               high half of eax is destroyed
2563
               high half of eax is destroyed
2537
  * for other ecx: eax = -1 indicates an error
2564
  * for other ecx: eax = -1 indicates an error
2538
 
2565
 
2539
======================================================================
2566
======================================================================
2540
============ Function 53, subfunction 0 - open UDP-socket. ===========
2567
============ Function 53, subfunction 0 - open UDP-socket. ===========
2541
======================================================================
2568
======================================================================
2542
Parameters:
2569
Parameters:
2543
  * eax = 53 - function number
2570
  * eax = 53 - function number
2544
  * ebx = 0 - subfunction number
2571
  * ebx = 0 - subfunction number
2545
  * ecx = local port (only low word is taken into account)
2572
  * ecx = local port (only low word is taken into account)
2546
  * edx = remote port (only low word is taken into account)
2573
  * edx = remote port (only low word is taken into account)
2547
  * esi = remote IP
2574
  * esi = remote IP
2548
Returned value:
2575
Returned value:
2549
  * eax = -1 = 0xFFFFFFFF - error; ebx destroyed
2576
  * eax = -1 = 0xFFFFFFFF - error; ebx destroyed
2550
  * eax = socket handle (some number which unambiguously identifies
2577
  * eax = socket handle (some number which unambiguously identifies
2551
    socket and have sense only for the system) - success;
2578
    socket and have sense only for the system) - success;
2552
    ebx destroyed
2579
    ebx destroyed
2553
 
2580
 
2554
======================================================================
2581
======================================================================
2555
=========== Function 53, subfunction 1 - close UDP-socket. ===========
2582
=========== Function 53, subfunction 1 - close UDP-socket. ===========
2556
======================================================================
2583
======================================================================
2557
Parameters:
2584
Parameters:
2558
  * eax = 53 - function number
2585
  * eax = 53 - function number
2559
  * ebx = 1 - subfunction number
2586
  * ebx = 1 - subfunction number
2560
  * ecx = socket handle
2587
  * ecx = socket handle
2561
Returned value:
2588
Returned value:
2562
  * eax = -1 - incorrect handle
2589
  * eax = -1 - incorrect handle
2563
  * eax = 0 - success
2590
  * eax = 0 - success
2564
  * ebx destroyed
2591
  * ebx destroyed
2565
Remarks:
2592
Remarks:
2566
  * The current implementation does not close automatically all
2593
  * The current implementation does not close automatically all
2567
    sockets of a thread at termination. In particular, one should not
2594
    sockets of a thread at termination. In particular, one should not
2568
    kill a thread with many opened sockets - there will be an outflow
2595
    kill a thread with many opened sockets - there will be an outflow
2569
    of resources.
2596
    of resources.
2570
  * The current implementation does no checks on correctness
2597
  * The current implementation does no checks on correctness
2571
    (function returns error only if thread tries to close not opened
2598
    (function returns error only if thread tries to close not opened
2572
    socket with correct handle).
2599
    socket with correct handle).
2573
 
2600
 
2574
======================================================================
2601
======================================================================
2575
============== Function 53, subfunction 2 - poll socket. =============
2602
============== Function 53, subfunction 2 - poll socket. =============
2576
======================================================================
2603
======================================================================
2577
Parameters:
2604
Parameters:
2578
  * eax = 53 - function number
2605
  * eax = 53 - function number
2579
  * ebx = 2 - subfunction number
2606
  * ebx = 2 - subfunction number
2580
  * ecx = socket handle
2607
  * ecx = socket handle
2581
Returned value:
2608
Returned value:
2582
  * eax = number of read bytes
2609
  * eax = number of read bytes
2583
  * ebx destroyed
2610
  * ebx destroyed
2584
Remarks:
2611
Remarks:
2585
  * There is no checks for correctness.
2612
  * There is no checks for correctness.
2586
 
2613
 
2587
======================================================================
2614
======================================================================
2588
========= Function 53, subfunction 3 - read byte from socket. ========
2615
========= Function 53, subfunction 3 - read byte from socket. ========
2589
======================================================================
2616
======================================================================
2590
Parameters:
2617
Parameters:
2591
  * eax = 53 - function number
2618
  * eax = 53 - function number
2592
  * ebx = 3 - subfunction number
2619
  * ebx = 3 - subfunction number
2593
  * ecx = socket handle
2620
  * ecx = socket handle
2594
Returned value:
2621
Returned value:
2595
  * if there is no read data: eax=0, bl=0,
2622
  * if there is no read data: eax=0, bl=0,
2596
    other bytes of ebx are destroyed
2623
    other bytes of ebx are destroyed
2597
  * if there are read data: eax=number of rest bytes
2624
  * if there are read data: eax=number of rest bytes
2598
    (possibly 0), bl=read byte, other bytes of ebx are destroyed
2625
    (possibly 0), bl=read byte, other bytes of ebx are destroyed
2599
Remarks:
2626
Remarks:
2600
  * There is no checks for correctness.
2627
  * There is no checks for correctness.
2601
 
2628
 
2602
======================================================================
2629
======================================================================
2603
========== Function 53, subfunction 4 - write to UDP-socket. =========
2630
========== Function 53, subfunction 4 - write to UDP-socket. =========
2604
======================================================================
2631
======================================================================
2605
Parameters:
2632
Parameters:
2606
  * eax = 53 - function number
2633
  * eax = 53 - function number
2607
  * ebx = 4 - subfunction number
2634
  * ebx = 4 - subfunction number
2608
  * ecx = socket handle
2635
  * ecx = socket handle
2609
  * edx = number of bytes to write
2636
  * edx = number of bytes to write
2610
  * esi = pointer to data to write
2637
  * esi = pointer to data to write
2611
Returned value:
2638
Returned value:
2612
  * eax = 0xffffffff - invalid handle
2639
  * eax = 0xffffffff - invalid handle
2613
  * eax = 0xffff - not enough memory
2640
  * eax = 0xffff - not enough memory
2614
  * eax = 0 - success
2641
  * eax = 0 - success
2615
  * ebx destroyed
2642
  * ebx destroyed
2616
Remarks:
2643
Remarks:
2617
  * Check on validity of handle is minimal - only not very incorrect
2644
  * Check on validity of handle is minimal - only not very incorrect
2618
    not opened handles are eliminated.
2645
    not opened handles are eliminated.
2619
  * Number of bytes to write must not exceed 1500-28, though
2646
  * Number of bytes to write must not exceed 1500-28, though
2620
    the appropriate check is not made.
2647
    the appropriate check is not made.
2621
 
2648
 
2622
======================================================================
2649
======================================================================
2623
============ Function 53, subfunction 5 - open TCP-socket. ===========
2650
============ Function 53, subfunction 5 - open TCP-socket. ===========
2624
======================================================================
2651
======================================================================
2625
Parameters:
2652
Parameters:
2626
  * eax = 53 - function number
2653
  * eax = 53 - function number
2627
  * ebx = 5 - subfunction number
2654
  * ebx = 5 - subfunction number
2628
  * ecx = local port (only low word is taken into account)
2655
  * ecx = local port (only low word is taken into account)
2629
  * edx = remote port (only low word is taken into account)
2656
  * edx = remote port (only low word is taken into account)
2630
  * esi = remote IP
2657
  * esi = remote IP
2631
  * edi = open mode: SOCKET_PASSIVE=0 or SOCKET_ACTIVE=1
2658
  * edi = open mode: SOCKET_PASSIVE=0 or SOCKET_ACTIVE=1
2632
Returned value:
2659
Returned value:
2633
  * eax = -1 = 0xFFFFFFFF - error; ebx destroys
2660
  * eax = -1 = 0xFFFFFFFF - error; ebx destroys
2634
  * eax = socket handle (some number which unambiguously identifies
2661
  * eax = socket handle (some number which unambiguously identifies
2635
    socket and have sense only for the system) - success;
2662
    socket and have sense only for the system) - success;
2636
    ebx destroyed
2663
    ebx destroyed
2637
 
2664
 
2638
======================================================================
2665
======================================================================
2639
========= Function 53, subfunction 6 - get TCP-socket status. ========
2666
========= Function 53, subfunction 6 - get TCP-socket status. ========
2640
======================================================================
2667
======================================================================
2641
Parameters:
2668
Parameters:
2642
  * eax = 53 - function number
2669
  * eax = 53 - function number
2643
  * ebx = 6 - subfunction number
2670
  * ebx = 6 - subfunction number
2644
  * ecx = socket handle
2671
  * ecx = socket handle
2645
Returned value:
2672
Returned value:
2646
  * eax = socket status: one of
2673
  * eax = socket status: one of
2647
  * TCB_LISTEN = 1
2674
  * TCB_LISTEN = 1
2648
  * TCB_SYN_SENT = 2
2675
  * TCB_SYN_SENT = 2
2649
  * TCB_SYN_RECEIVED = 3
2676
  * TCB_SYN_RECEIVED = 3
2650
  * TCB_ESTABLISHED = 4
2677
  * TCB_ESTABLISHED = 4
2651
  * TCB_FIN_WAIT_1 = 5
2678
  * TCB_FIN_WAIT_1 = 5
2652
  * TCB_FIN_WAIT_2 = 6
2679
  * TCB_FIN_WAIT_2 = 6
2653
  * TCB_CLOSE_WAIT = 7
2680
  * TCB_CLOSE_WAIT = 7
2654
  * TCB_CLOSING = 8
2681
  * TCB_CLOSING = 8
2655
  * TCB_LAST_ASK = 9
2682
  * TCB_LAST_ASK = 9
2656
  * TCB_TIME_WAIT = 10
2683
  * TCB_TIME_WAIT = 10
2657
  * TCB_CLOSED = 11
2684
  * TCB_CLOSED = 11
2658
  * ebx destroys
2685
  * ebx destroys
2659
Remarks:
2686
Remarks:
2660
  * There is no checks for correctness.
2687
  * There is no checks for correctness.
2661
 
2688
 
2662
======================================================================
2689
======================================================================
2663
========== Function 53, subfunction 7 - write to TCP-socket. =========
2690
========== Function 53, subfunction 7 - write to TCP-socket. =========
2664
======================================================================
2691
======================================================================
2665
Parameters:
2692
Parameters:
2666
  * eax = 53 - function number
2693
  * eax = 53 - function number
2667
  * ebx = 7 - subfunction number
2694
  * ebx = 7 - subfunction number
2668
  * ecx = socket handle
2695
  * ecx = socket handle
2669
  * edx = number of bytes to write
2696
  * edx = number of bytes to write
2670
  * esi = pointer to data to write
2697
  * esi = pointer to data to write
2671
Returned value:
2698
Returned value:
2672
  * eax = 0xffffffff - error
2699
  * eax = 0xffffffff - error
2673
  * eax = 0xffff - not enough memory
2700
  * eax = 0xffff - not enough memory
2674
  * eax = 0 - success
2701
  * eax = 0 - success
2675
  * ebx destroyed
2702
  * ebx destroyed
2676
Remarks:
2703
Remarks:
2677
  * Check on validity of handle is minimal - only not very incorrect
2704
  * Check on validity of handle is minimal - only not very incorrect
2678
    not opened handles are eliminated.
2705
    not opened handles are eliminated.
2679
  * Number of bytes to write must not exceed 1500-40, though
2706
  * Number of bytes to write must not exceed 1500-40, though
2680
    the appropriate check is not made.
2707
    the appropriate check is not made.
2681
 
2708
 
2682
======================================================================
2709
======================================================================
2683
=========== Function 53, subfunction 8 - close TCP-socket. ===========
2710
=========== Function 53, subfunction 8 - close TCP-socket. ===========
2684
======================================================================
2711
======================================================================
2685
Parameters:
2712
Parameters:
2686
  * eax = 53 - function number
2713
  * eax = 53 - function number
2687
  * ebx = 8 - subfunction number
2714
  * ebx = 8 - subfunction number
2688
  * ecx = socket handle
2715
  * ecx = socket handle
2689
Returned value:
2716
Returned value:
2690
  * eax = -1 - invalid handle
2717
  * eax = -1 - invalid handle
2691
  * eax = 0xffff - not enough memory for socket close packet
2718
  * eax = 0xffff - not enough memory for socket close packet
2692
  * eax = 0 - success
2719
  * eax = 0 - success
2693
  * in many cases eax is destroyed (the result of function 'queue'
2720
  * in many cases eax is destroyed (the result of function 'queue'
2694
    is returned) - probably this is bug, which will be corrected
2721
    is returned) - probably this is bug, which will be corrected
2695
  * ebx destroyed
2722
  * ebx destroyed
2696
Remarks:
2723
Remarks:
2697
  * The current implementation does not close automatically all
2724
  * The current implementation does not close automatically all
2698
    sockets of a thread at termination. In particular, one should not
2725
    sockets of a thread at termination. In particular, one should not
2699
    kill a thread with many opened sockets - there will be an outflow
2726
    kill a thread with many opened sockets - there will be an outflow
2700
    of resources.
2727
    of resources.
2701
  * The current implementation does no checks on correctness
2728
  * The current implementation does no checks on correctness
2702
    (function returns error only if thread tries to close not opened
2729
    (function returns error only if thread tries to close not opened
2703
    socket with correct handle).
2730
    socket with correct handle).
2704
 
2731
 
2705
======================================================================
2732
======================================================================
2706
=== Function 53, subfunction 9 - check whether local port is free. ===
2733
=== Function 53, subfunction 9 - check whether local port is free. ===
2707
======================================================================
2734
======================================================================
2708
Parameters:
2735
Parameters:
2709
  * eax = 53 - function number
2736
  * eax = 53 - function number
2710
  * ebx = 9 - subfunction number
2737
  * ebx = 9 - subfunction number
2711
  * ecx = local port number (low 16 bits are used only)
2738
  * ecx = local port number (low 16 bits are used only)
2712
Returned value:
2739
Returned value:
2713
  * eax = 0 - port is used
2740
  * eax = 0 - port is used
2714
  * eax = 1 - port is free
2741
  * eax = 1 - port is free
2715
  * ebx destroyed
2742
  * ebx destroyed
2716
 
2743
 
2717
======================================================================
2744
======================================================================
2718
===== Function 53, subfunction 10 - query Ethernet cable status. =====
2745
===== Function 53, subfunction 10 - query Ethernet cable status. =====
2719
======================================================================
2746
======================================================================
2720
Parameters:
2747
Parameters:
2721
  * eax = 53 - function number
2748
  * eax = 53 - function number
2722
  * ebx = 10 - subfunction number
2749
  * ebx = 10 - subfunction number
2723
Returned value:
2750
Returned value:
2724
  * al = -1 - a network driver is not loaded or
2751
  * al = -1 - a network driver is not loaded or
2725
              does not support this function
2752
              does not support this function
2726
  * al = 0 - Ethernet cable is unplugged
2753
  * al = 0 - Ethernet cable is unplugged
2727
  * al = 1 - Ethernet cable is plugged
2754
  * al = 1 - Ethernet cable is plugged
2728
  * ebx destroyed
2755
  * ebx destroyed
2729
Remarks:
2756
Remarks:
2730
  * The current kernel implementation supports this function
2757
  * The current kernel implementation supports this function
2731
    only for RTL8139 network cards.
2758
    only for RTL8139 network cards.
2732
 
2759
 
2733
======================================================================
2760
======================================================================
2734
======= Function 53, subfunction 11 - read network stack data. =======
2761
======= Function 53, subfunction 11 - read network stack data. =======
2735
======================================================================
2762
======================================================================
2736
Paramters:
2763
Paramters:
2737
  * eax = 53 - function number
2764
  * eax = 53 - function number
2738
  * ebx = 11 - subfunction number
2765
  * ebx = 11 - subfunction number
2739
  * ecx = socket handle
2766
  * ecx = socket handle
2740
  * edx = pointer to buffer
2767
  * edx = pointer to buffer
2741
  * esi = number of bytes to read;
2768
  * esi = number of bytes to read;
2742
  * esi = 0 - read all data (maximum 4096 bytes)
2769
  * esi = 0 - read all data (maximum 4096 bytes)
2743
Returned value:
2770
Returned value:
2744
  * eax = number of bytes read
2771
  * eax = number of bytes read
2745
  * ebx destroyed
2772
  * ebx destroyed
2746
Remakrs:
2773
Remakrs:
2747
  * There is no check on handle correctness.
2774
  * There is no check on handle correctness.
2748
 
2775
 
2749
======================================================================
2776
======================================================================
2750
= Function 53, subfunction 255 - debug information of network driver. 
2777
= Function 53, subfunction 255 - debug information of network driver. 
2751
======================================================================
2778
======================================================================
2752
Parameters:
2779
Parameters:
2753
  * eax = 53 - function number
2780
  * eax = 53 - function number
2754
  * ebx = 255 - subfunction number
2781
  * ebx = 255 - subfunction number
2755
  * ecx = type of requested information (see below)
2782
  * ecx = type of requested information (see below)
2756
Returned value:
2783
Returned value:
2757
  * eax = requested information
2784
  * eax = requested information
2758
  * ebx destroyed
2785
  * ebx destroyed
2759
Possible values for ecx:
2786
Possible values for ecx:
2760
  * 100: length of queue 0 (empty queue)
2787
  * 100: length of queue 0 (empty queue)
2761
  * 101: length of queue 1 (ip-out queue)
2788
  * 101: length of queue 1 (ip-out queue)
2762
  * 102: length of queue 2 (ip-in queue)
2789
  * 102: length of queue 2 (ip-in queue)
2763
  * 103: length of queue 3 (net1out queue)
2790
  * 103: length of queue 3 (net1out queue)
2764
  * 200: number of items in the ARP table
2791
  * 200: number of items in the ARP table
2765
  * 201: size of the ARP table (in items) (20 for current version)
2792
  * 201: size of the ARP table (in items) (20 for current version)
2766
  * 202: read item at edx of the ARP table to the temporary buffer,
2793
  * 202: read item at edx of the ARP table to the temporary buffer,
2767
    whence 5 following types take information;
2794
    whence 5 following types take information;
2768
    in this case eax is not defined
2795
    in this case eax is not defined
2769
  * 203: IP-address saved by type 202
2796
  * 203: IP-address saved by type 202
2770
  * 204: high dword of MAC-address saved by type 202
2797
  * 204: high dword of MAC-address saved by type 202
2771
  * 205: low word of MAC-address saved by type 202
2798
  * 205: low word of MAC-address saved by type 202
2772
  * 206: status word saved by type 202
2799
  * 206: status word saved by type 202
2773
  * 207: ttl word saved by type 202
2800
  * 207: ttl word saved by type 202
2774
  * 2: total number of received IP-packets
2801
  * 2: total number of received IP-packets
2775
  * 3: total number of transferred IP-packets
2802
  * 3: total number of transferred IP-packets
2776
  * 4: total number of dumped received packets
2803
  * 4: total number of dumped received packets
2777
  * 5: total number of received ARP-packets
2804
  * 5: total number of received ARP-packets
2778
  * 6: status of packet driver, 0=inactive, nonzero=active
2805
  * 6: status of packet driver, 0=inactive, nonzero=active
2779
 
2806
 
2780
======================================================================
2807
======================================================================
2781
========== Function 55, subfunction 0 - load data for SB16. ==========
2808
========== Function 55, subfunction 0 - load data for SB16. ==========
2782
======================================================================
2809
======================================================================
2783
Parameters:
2810
Parameters:
2784
  * eax = 55 - function number
2811
  * eax = 55 - function number
2785
  * ebx = 0 - subfunction number
2812
  * ebx = 0 - subfunction number
2786
  * ecx = pointer to data (is copied 64 kilobytes, is used as much as
2813
  * ecx = pointer to data (is copied 64 kilobytes, is used as much as
2787
    set by subfunction 2)
2814
    set by subfunction 2)
2788
Returned value:
2815
Returned value:
2789
  * function does not return value
2816
  * function does not return value
2790
Remarks:
2817
Remarks:
2791
  * Format and size of data are set by subfunction 2.
2818
  * Format and size of data are set by subfunction 2.
2792
 
2819
 
2793
======================================================================
2820
======================================================================
2794
======== Function 55, subfunction 1 - begin play data on SB16. =======
2821
======== Function 55, subfunction 1 - begin play data on SB16. =======
2795
======================================================================
2822
======================================================================
2796
Parameters:
2823
Parameters:
2797
  * eax = 55 - function number
2824
  * eax = 55 - function number
2798
  * ebx = 1 - subfunction number
2825
  * ebx = 1 - subfunction number
2799
Returned value:
2826
Returned value:
2800
  * function does not return value
2827
  * function does not return value
2801
Remarks:
2828
Remarks:
2802
  * Previously data must be loaded by subfunction 0 and
2829
  * Previously data must be loaded by subfunction 0 and
2803
    their format must be defined by subfunction 2.
2830
    their format must be defined by subfunction 2.
2804
  * Function returns control, when playing of data began; after that
2831
  * Function returns control, when playing of data began; after that
2805
    play goes independently from application (and does not use
2832
    play goes independently from application (and does not use
2806
    processor time at all).
2833
    processor time at all).
2807
  * Previously must be defined SB16 base port
2834
  * Previously must be defined SB16 base port
2808
    (by subfunction 4 of function 21) and DMA channel
2835
    (by subfunction 4 of function 21) and DMA channel
2809
    (by subfunction 10 of function 21).
2836
    (by subfunction 10 of function 21).
2810
 
2837
 
2811
======================================================================
2838
======================================================================
2812
======== Function 55, subfunction 2 - set format of SB16 data. =======
2839
======== Function 55, subfunction 2 - set format of SB16 data. =======
2813
======================================================================
2840
======================================================================
2814
Parameters:
2841
Parameters:
2815
  * eax = 55 - function number
2842
  * eax = 55 - function number
2816
  * ebx = 2 - subfunction number
2843
  * ebx = 2 - subfunction number
2817
  * ecx = 0 - set digit capacity
2844
  * ecx = 0 - set digit capacity
2818
    * edx = 1 - 8bit mono
2845
    * edx = 1 - 8bit mono
2819
    * edx = 2 - 8bit stereo
2846
    * edx = 2 - 8bit stereo
2820
  * ecx = 1 - set data size
2847
  * ecx = 1 - set data size
2821
    * edx = size in bytes
2848
    * edx = size in bytes
2822
  * ecx = 2 - set play frequency
2849
  * ecx = 2 - set play frequency
2823
    * edx = frequency
2850
    * edx = frequency
2824
Returned value:
2851
Returned value:
2825
  * function does not return value
2852
  * function does not return value
2826
Remarks:
2853
Remarks:
2827
  * When the system boots, it sets following default parameters:
2854
  * When the system boots, it sets following default parameters:
2828
    digit capacity - 8bit mono, size - 64 Kb, frequency - 44100 Hz.
2855
    digit capacity - 8bit mono, size - 64 Kb, frequency - 44100 Hz.
2829
    Nevertheless it is recommended to set necessary values obviously
2856
    Nevertheless it is recommended to set necessary values obviously
2830
    as they could be reset by some application.
2857
    as they could be reset by some application.
2831
 
2858
 
2832
======================================================================
2859
======================================================================
2833
 Function 55, subfunction 55 - begin to play data on built-in speaker. 
2860
 Function 55, subfunction 55 - begin to play data on built-in speaker. 
2834
======================================================================
2861
======================================================================
2835
Parameters:
2862
Parameters:
2836
  * eax = 55 - function number
2863
  * eax = 55 - function number
2837
  * ebx = 55 - subfunction number
2864
  * ebx = 55 - subfunction number
2838
  * esi = pointer to data
2865
  * esi = pointer to data
2839
Returned value:
2866
Returned value:
2840
  * eax = 0 - success
2867
  * eax = 0 - success
2841
  * eax = 55 - error (speaker is off or busy)
2868
  * eax = 55 - error (speaker is off or busy)
2842
Data is an array of items with variable length.
2869
Data is an array of items with variable length.
2843
Format of each item is defined by first byte:
2870
Format of each item is defined by first byte:
2844
  * 0 = end of data
2871
  * 0 = end of data
2845
  * 1..0x80 = sets sound duration on 1/100 of second; sound note
2872
  * 1..0x80 = sets sound duration on 1/100 of second; sound note
2846
    is defined by immediate value of frequency
2873
    is defined by immediate value of frequency
2847
    * following word (2 bytes) contains frequency divider;
2874
    * following word (2 bytes) contains frequency divider;
2848
      frequency is defined as 1193180/divider
2875
      frequency is defined as 1193180/divider
2849
  * 0x81 = invalid
2876
  * 0x81 = invalid
2850
  * 0x82..0xFF = note is defined by octave and number:
2877
  * 0x82..0xFF = note is defined by octave and number:
2851
    * duration in 1/100 of second = (first byte)-0x81
2878
    * duration in 1/100 of second = (first byte)-0x81
2852
    * there is one more byte;
2879
    * there is one more byte;
2853
    * (second byte)=0xFF - delay
2880
    * (second byte)=0xFF - delay
2854
    * otherwise it looks like a*0x10+b, where b=number of the note in
2881
    * otherwise it looks like a*0x10+b, where b=number of the note in
2855
      an octave from 1 to 12, a=number of octave (beginning from 0)
2882
      an octave from 1 to 12, a=number of octave (beginning from 0)
2856
Remarks:
2883
Remarks:
2857
  * Speaker play can be disabled/enabled by
2884
  * Speaker play can be disabled/enabled by
2858
    subfunction 8 of function 18.
2885
    subfunction 8 of function 18.
2859
  * Function returns control, having informed the system
2886
  * Function returns control, having informed the system
2860
    an information on request. Play itself goes independently from
2887
    an information on request. Play itself goes independently from
2861
    the program.
2888
    the program.
2862
  * The data must be kept in the memory at least up to the end
2889
  * The data must be kept in the memory at least up to the end
2863
    of play.
2890
    of play.
2864
 
2891
 
2865
======================================================================
2892
======================================================================
2866
================ Function 58 - work with file system. ================
2893
================ Function 58 - work with file system. ================
2867
======================================================================
2894
======================================================================
2868
Parameters:
2895
Parameters:
2869
  * eax = 58
2896
  * eax = 58
2870
  * ebx = pointer to the information structure
2897
  * ebx = pointer to the information structure
2871
Returned value:
2898
Returned value:
2872
  * eax = 0 - success; otherwise file system error code
2899
  * eax = 0 - success; otherwise file system error code
2873
  * some subfunctions return value in other registers too
2900
  * some subfunctions return value in other registers too
2874
General format of the information structure:
2901
General format of the information structure:
2875
  * +0: dword: subfunction number
2902
  * +0: dword: subfunction number
2876
  * +4: dword: number of block
2903
  * +4: dword: number of block
2877
  * +8: dword: size
2904
  * +8: dword: size
2878
  * +12 = +0xC: dword: pointer to data
2905
  * +12 = +0xC: dword: pointer to data
2879
  * +16 = +0x10: dword: pointer to a memory for system operations
2906
  * +16 = +0x10: dword: pointer to a memory for system operations
2880
    (4096 bytes)
2907
    (4096 bytes)
2881
  * +20 = +0x14: n db: ASCIIZ-string with the file name
2908
  * +20 = +0x14: n db: ASCIIZ-string with the file name
2882
Specifications - in documentation on the appropriate subfunction.
2909
Specifications - in documentation on the appropriate subfunction.
2883
Filename is case-insensitive for latin letters, russian letters
2910
Filename is case-insensitive for latin letters, russian letters
2884
must be capital.
2911
must be capital.
2885
Format of filename:
2912
Format of filename:
2886
/base/number/dir1/dir2/.../dirn/file,
2913
/base/number/dir1/dir2/.../dirn/file,
2887
where /base/number identifies device, on which file is located:
2914
where /base/number identifies device, on which file is located:
2888
one of
2915
one of
2889
  * /RD/1 = /RAMDISK/1 to access ramdisk
2916
  * /RD/1 = /RAMDISK/1 to access ramdisk
2890
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
2917
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
2891
    /FD/2 = /FLOPPYDISK/2 to access second one
2918
    /FD/2 = /FLOPPYDISK/2 to access second one
2892
  * /HD/x = /HARDDISK/x - obsolete variant of access to hard disk
2919
  * /HD/x = /HARDDISK/x - obsolete variant of access to hard disk
2893
    (in this case base is defined by subfunction 7 of function 21),
2920
    (in this case base is defined by subfunction 7 of function 21),
2894
    x - partition number (beginning from 1)
2921
    x - partition number (beginning from 1)
2895
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
2922
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
2896
    IDE0 (Primary Master), IDE1 (Primary Slave),
2923
    IDE0 (Primary Master), IDE1 (Primary Slave),
2897
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
2924
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
2898
    x - partition number on the selected hard drive, varies from 1
2925
    x - partition number on the selected hard drive, varies from 1
2899
    to 255 (on each hard drive the indexing starts from 1)
2926
    to 255 (on each hard drive the indexing starts from 1)
2900
Remarks:
2927
Remarks:
2901
  * In the first two cases it is also possible to use FIRST
2928
  * In the first two cases it is also possible to use FIRST
2902
    instead of 1, SECOND instead of 2, but it is not recommended
2929
    instead of 1, SECOND instead of 2, but it is not recommended
2903
    for convenience of transition to the future extensions.
2930
    for convenience of transition to the future extensions.
2904
  * Limitation n<=39 is imposed.
2931
  * Limitation n<=39 is imposed.
2905
  * Names of folders and file dir1,...,dirn,file must have the
2932
  * Names of folders and file dir1,...,dirn,file must have the
2906
    format 8.3: name no more than 8 characters, dot, extension no
2933
    format 8.3: name no more than 8 characters, dot, extension no
2907
    more than 3 characters. Trailing spaces are ignored, no other
2934
    more than 3 characters. Trailing spaces are ignored, no other
2908
    spaces is allowed. If name occupies equally 8 characters,
2935
    spaces is allowed. If name occupies equally 8 characters,
2909
    dot may be omitted (though it is not recommended to use this
2936
    dot may be omitted (though it is not recommended to use this
2910
    feature for convenience of transition to the future extensions).
2937
    feature for convenience of transition to the future extensions).
2911
  * This function does not support folders on ramdisk.
2938
  * This function does not support folders on ramdisk.
2912
Examples:
2939
Examples:
2913
  * '/RAMDISK/FIRST/KERNEL.ASM',0
2940
  * '/RAMDISK/FIRST/KERNEL.ASM',0
2914
    '/rd/1/kernel.asm',0
2941
    '/rd/1/kernel.asm',0
2915
  * '/HD0/1/kernel.asm',0
2942
  * '/HD0/1/kernel.asm',0
2916
  * '/hd0/1/menuet/pics/tanzania.bmp',0
2943
  * '/hd0/1/menuet/pics/tanzania.bmp',0
2917
Existing subfunctions:
2944
Existing subfunctions:
2918
  * subfunction 0 - read file/folder
2945
  * subfunction 0 - read file/folder
2919
  * subfunction 8 - LBA-read from device
2946
  * subfunction 8 - LBA-read from device
2920
  * subfunction 15 - get file system information
2947
  * subfunction 15 - get file system information
2921
 
2948
 
2922
======================================================================
2949
======================================================================
2923
=========== Function 58, subfunction 0 - read file/folder. ===========
2950
=========== Function 58, subfunction 0 - read file/folder. ===========
2924
======================================================================
2951
======================================================================
2925
Parameters:
2952
Parameters:
2926
  * eax = 58
2953
  * eax = 58
2927
  * ebx = pointer to the information structure
2954
  * ebx = pointer to the information structure
2928
Format of the information structure:
2955
Format of the information structure:
2929
  * +0: dword: 0 = subfunction number
2956
  * +0: dword: 0 = subfunction number
2930
  * +4: dword: first block to read (beginning from 0)
2957
  * +4: dword: first block to read (beginning from 0)
2931
  * +8: dword: amount of blocks to read
2958
  * +8: dword: amount of blocks to read
2932
  * +12 = +0xC: dword: pointer to buffer for data
2959
  * +12 = +0xC: dword: pointer to buffer for data
2933
  * +16 = +0x10: dword: pointer to buffer for system operations
2960
  * +16 = +0x10: dword: pointer to buffer for system operations
2934
    (4096 bytes)
2961
    (4096 bytes)
2935
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2962
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2936
    given in the general description
2963
    given in the general description
2937
Returned value:
2964
Returned value:
2938
  * eax = 0 - success, otherwise file system error code
2965
  * eax = 0 - success, otherwise file system error code
2939
  * ebx = file size (in bytes) or -1=0xffffffff, if file was not found
2966
  * ebx = file size (in bytes) or -1=0xffffffff, if file was not found
2940
Remarks:
2967
Remarks:
2941
  * Block size is 512 bytes.
2968
  * Block size is 512 bytes.
2942
  * This function is obsolete, for reading files use subfunction 0
2969
  * This function is obsolete, for reading files use subfunction 0
2943
    of function 70, for reading folders - subfunction 1 of
2970
    of function 70, for reading folders - subfunction 1 of
2944
    function 70.
2971
    function 70.
2945
  * Function can read contents of a folder. Only FAT file system is
2972
  * Function can read contents of a folder. Only FAT file system is
2946
    supported. The format of FAT-folder is described
2973
    supported. The format of FAT-folder is described
2947
    in any FAT documentation.
2974
    in any FAT documentation.
2948
  * Size of a folder is determined by size of FAT clusters chain.
2975
  * Size of a folder is determined by size of FAT clusters chain.
2949
  * If file was ended before last requested block was read,
2976
  * If file was ended before last requested block was read,
2950
    the function will read as many as it can, and after that return
2977
    the function will read as many as it can, and after that return
2951
    eax=6 (EOF).
2978
    eax=6 (EOF).
2952
  * Function can read root folders /rd/1,/fd/x,/hd[n]/x, but
2979
  * Function can read root folders /rd/1,/fd/x,/hd[n]/x, but
2953
    in the first two cases the current implementation does not follow
2980
    in the first two cases the current implementation does not follow
2954
    to the declared rules:
2981
    to the declared rules:
2955
    for /rd/1:
2982
    for /rd/1:
2956
    * if one want to read 0 blocks, function considers,
2983
    * if one want to read 0 blocks, function considers,
2957
      that he requested 1;
2984
      that he requested 1;
2958
    * if one requests more than 14 blocks or starting block is
2985
    * if one requests more than 14 blocks or starting block is
2959
      not less than 14, function returns eax=5 (not found) è ebx=-1;
2986
      not less than 14, function returns eax=5 (not found) è ebx=-1;
2960
    * size of ramdisk root folder is 14 blocks, 
2987
    * size of ramdisk root folder is 14 blocks, 
2961
      0x1C00=7168 áàéò; but function returns ebx=0
2988
      0x1C00=7168 áàéò; but function returns ebx=0
2962
      (except of the case of previous item);
2989
      (except of the case of previous item);
2963
    * strangely enough, it is possible to read 14th block (which
2990
    * strangely enough, it is possible to read 14th block (which
2964
      generally contains a garbage - I remind, the indexing begins
2991
      generally contains a garbage - I remind, the indexing begins
2965
      from 0);
2992
      from 0);
2966
    * if some block with the number not less than 14 was requested,
2993
    * if some block with the number not less than 14 was requested,
2967
      function returns eax=6(EOF); otherwise eax=0.
2994
      function returns eax=6(EOF); otherwise eax=0.
2968
    For /fd/x:
2995
    For /fd/x:
2969
    * if the start block is not less than 14, function returns
2996
    * if the start block is not less than 14, function returns
2970
      eax=5 (not found) and ebx=0;
2997
      eax=5 (not found) and ebx=0;
2971
    * note that format of FAT12 allows floppies with the root size
2998
    * note that format of FAT12 allows floppies with the root size
2972
      more or less than 14 blocks;
2999
      more or less than 14 blocks;
2973
    * check for length is not performed;
3000
    * check for length is not performed;
2974
    * if data was successful read, function returns
3001
    * if data was successful read, function returns
2975
      eax=0,ebx=0; otherwise eax=10 (access denied), ebx=-1.
3002
      eax=0,ebx=0; otherwise eax=10 (access denied), ebx=-1.
2976
  * The function handles reading of special folders /,/rd,/fd,/hd[n];
3003
  * The function handles reading of special folders /,/rd,/fd,/hd[n];
2977
    but the result does not correspond to expected (on operations with
3004
    but the result does not correspond to expected (on operations with
2978
    normal files/folders), does not follow the declared rules,
3005
    normal files/folders), does not follow the declared rules,
2979
    may be changed in future versions of the kernel and consequently
3006
    may be changed in future versions of the kernel and consequently
2980
    is not described. To obtain the information about the equipment
3007
    is not described. To obtain the information about the equipment
2981
    use subfunction 11 of function 18 or
3008
    use subfunction 11 of function 18 or
2982
    read corresponding folder with subfunction 1 of function 70.
3009
    read corresponding folder with subfunction 1 of function 70.
2983
 
3010
 
2984
======================================================================
3011
======================================================================
2985
========= Function 58, subfunction 8 - LBA-read from device. =========
3012
========= Function 58, subfunction 8 - LBA-read from device. =========
2986
======================================================================
3013
======================================================================
2987
Parameters:
3014
Parameters:
2988
  * eax = 58 - function number
3015
  * eax = 58 - function number
2989
  * ebx = pointer to the information structure
3016
  * ebx = pointer to the information structure
2990
Format of the information structure:
3017
Format of the information structure:
2991
  * +0: dword: 8 = subfunction number
3018
  * +0: dword: 8 = subfunction number
2992
  * +4: dword: number of block to read (beginning from 0)
3019
  * +4: dword: number of block to read (beginning from 0)
2993
  * +8: dword: ignored (set to 1)
3020
  * +8: dword: ignored (set to 1)
2994
  * +12 = +0xC: dword: pointer to buffer for data (512 bytes)
3021
  * +12 = +0xC: dword: pointer to buffer for data (512 bytes)
2995
  * +16 = +0x10: dword: pointer to buffer for system operations
3022
  * +16 = +0x10: dword: pointer to buffer for system operations
2996
    (4096 bytes)
3023
    (4096 bytes)
2997
  * +20 = +0x14: ASCIIZ-name of device: case-insensitive, one of
3024
  * +20 = +0x14: ASCIIZ-name of device: case-insensitive, one of
2998
    /rd/1 = /RamDisk/1, /hd/n = /HardDisk/n,
3025
    /rd/1 = /RamDisk/1, /hd/n = /HardDisk/n,
2999
    1<=n<=4 - number of device: 1=IDE0, ..., 4=IDE3.
3026
    1<=n<=4 - number of device: 1=IDE0, ..., 4=IDE3.
3000
    Instead of digits it is allowed, though not recommended for
3027
    Instead of digits it is allowed, though not recommended for
3001
    convenience of transition to future extensions, to use
3028
    convenience of transition to future extensions, to use
3002
    'first','second','third','fourth'.
3029
    'first','second','third','fourth'.
3003
Returned value:
3030
Returned value:
3004
  * for device name /hd/xxx, where xxx is not in the list above:
3031
  * for device name /hd/xxx, where xxx is not in the list above:
3005
    * eax = ebx = 1
3032
    * eax = ebx = 1
3006
  * for invalid device name (except for the previous case):
3033
  * for invalid device name (except for the previous case):
3007
    * eax = 5
3034
    * eax = 5
3008
    * ebx does not change
3035
    * ebx does not change
3009
  * if LBA-access is disabled by subfunction 11 of function 21:
3036
  * if LBA-access is disabled by subfunction 11 of function 21:
3010
    * eax = 2
3037
    * eax = 2
3011
    * ebx destroyed
3038
    * ebx destroyed
3012
  * for ramdisk: attempt to read block outside ramdisk
3039
  * for ramdisk: attempt to read block outside ramdisk
3013
    (18*2*80 blocks) results in
3040
    (18*2*80 blocks) results in
3014
    * eax = 3
3041
    * eax = 3
3015
    * ebx = 0
3042
    * ebx = 0
3016
  * for successful read:
3043
  * for successful read:
3017
    * eax = ebx = 0
3044
    * eax = ebx = 0
3018
Remarks:
3045
Remarks:
3019
  * Block size is 512 bytes; function reads one block.
3046
  * Block size is 512 bytes; function reads one block.
3020
  * Do not depend on returned value, it can be changed
3047
  * Do not depend on returned value, it can be changed
3021
    in future versions.
3048
    in future versions.
3022
  * Function requires that LBA-access to devices is enabled by 
3049
  * Function requires that LBA-access to devices is enabled by 
3023
    subfunction 11 of function 21. To check this one can use 
3050
    subfunction 11 of function 21. To check this one can use 
3024
    subfunction 11 of function 26.
3051
    subfunction 11 of function 26.
3025
  * LBA-read of floppy is not supported.
3052
  * LBA-read of floppy is not supported.
3026
  * Function reads data on physical hard drive; if for any reason
3053
  * Function reads data on physical hard drive; if for any reason
3027
    data of the concrete partition are required, application must
3054
    data of the concrete partition are required, application must
3028
    define starting sector of this partition (either directly
3055
    define starting sector of this partition (either directly
3029
    through MBR, or from the full structure returned by
3056
    through MBR, or from the full structure returned by
3030
    ïîäôóíêöèåé 11 ôóíêöèè 18).
3057
    ïîäôóíêöèåé 11 ôóíêöèè 18).
3031
  * Function does not check error code of hard disk, so request of
3058
  * Function does not check error code of hard disk, so request of
3032
    nonexisting sector reads something (most probably it will be
3059
    nonexisting sector reads something (most probably it will be
3033
    zeroes, but this is defined by device) and this is considered
3060
    zeroes, but this is defined by device) and this is considered
3034
    as success (eax=0).
3061
    as success (eax=0).
3035
 
3062
 
3036
======================================================================
3063
======================================================================
3037
==== Function 58, subfunction 15 - get information on file system. ===
3064
==== Function 58, subfunction 15 - get information on file system. ===
3038
======================================================================
3065
======================================================================
3039
Parameters:
3066
Parameters:
3040
  * eax = 58 - function number
3067
  * eax = 58 - function number
3041
  * ebx = pointer to the information structure
3068
  * ebx = pointer to the information structure
3042
Format of the information structure:
3069
Format of the information structure:
3043
  * +0: dword: 15 = subfunction number
3070
  * +0: dword: 15 = subfunction number
3044
  * +4: dword: ignored
3071
  * +4: dword: ignored
3045
  * +8: dword: ignored
3072
  * +8: dword: ignored
3046
  * +12 = +0xC: dword: ignored
3073
  * +12 = +0xC: dword: ignored
3047
  * +16 = +0x10: dword: ignored
3074
  * +16 = +0x10: dword: ignored
3048
  * +20 = +0x14: (only second character is checked)
3075
  * +20 = +0x14: (only second character is checked)
3049
    /rd=/RAMDISK or /hd=/HARDDISK
3076
    /rd=/RAMDISK or /hd=/HARDDISK
3050
Returned value:
3077
Returned value:
3051
  * if the second character does not belong to set {'r','R','h','H'}:
3078
  * if the second character does not belong to set {'r','R','h','H'}:
3052
    * eax = 3
3079
    * eax = 3
3053
    * ebx = ecx = dword [fileinfo] = 0
3080
    * ebx = ecx = dword [fileinfo] = 0
3054
  * for ramdisk:
3081
  * for ramdisk:
3055
    * eax = 0 (success)
3082
    * eax = 0 (success)
3056
    * ebx = total number of clusters = 2847
3083
    * ebx = total number of clusters = 2847
3057
    * ecx = number of free clusters
3084
    * ecx = number of free clusters
3058
    * dword [fileinfo] = cluster size = 512
3085
    * dword [fileinfo] = cluster size = 512
3059
  * for hard disk: base and partition are defined by subfunctions
3086
  * for hard disk: base and partition are defined by subfunctions
3060
    7 and 8 of function 21:
3087
    7 and 8 of function 21:
3061
    * eax = 0 (success)
3088
    * eax = 0 (success)
3062
    * ebx = total number of clusters
3089
    * ebx = total number of clusters
3063
    * ecx = number of free clusters
3090
    * ecx = number of free clusters
3064
    * dword [fileinfo] = cluster size (in bytes)
3091
    * dword [fileinfo] = cluster size (in bytes)
3065
Remarks:
3092
Remarks:
3066
  * Be not surprised to strange layout of 4th returned parameter
3093
  * Be not surprised to strange layout of 4th returned parameter
3067
    - when this code was writing, at system calls application got
3094
    - when this code was writing, at system calls application got
3068
    only registers eax,ebx,ecx (from pushad-structure transmitted
3095
    only registers eax,ebx,ecx (from pushad-structure transmitted
3069
    as argument to the system function). Now it is corrected, so,
3096
    as argument to the system function). Now it is corrected, so,
3070
    probably, it is meaningful to return cluster size in edx, while
3097
    probably, it is meaningful to return cluster size in edx, while
3071
    this function is not used yet.
3098
    this function is not used yet.
3072
  * There exists also subfunction 11 of function 18,
3099
  * There exists also subfunction 11 of function 18,
3073
    which returns information on file system. From the full table
3100
    which returns information on file system. From the full table
3074
    of disk subsystem it is possible to deduce cluster size (there
3101
    of disk subsystem it is possible to deduce cluster size (there
3075
    it is stored in sectors) and total number of clusters
3102
    it is stored in sectors) and total number of clusters
3076
    for hard disks.
3103
    for hard disks.
3077
 
3104
 
3078
======================================================================
3105
======================================================================
3079
========== Function 60 - Inter Process Communication (IPC). ==========
3106
========== Function 60 - Inter Process Communication (IPC). ==========
3080
======================================================================
3107
======================================================================
3081
IPC is used for message dispatching from one process/thread to
3108
IPC is used for message dispatching from one process/thread to
3082
another. Previously it is necessary to agree how to interpret
3109
another. Previously it is necessary to agree how to interpret
3083
the concrete message.
3110
the concrete message.
3084
 
3111
 
3085
----------- Subfunction 1 - set the area for IPC receiving -----------
3112
----------- Subfunction 1 - set the area for IPC receiving -----------
3086
Is called by process-receiver.
3113
Is called by process-receiver.
3087
Parameters:
3114
Parameters:
3088
  * eax = 60 - function number
3115
  * eax = 60 - function number
3089
  * ebx = 1 - subfunction number
3116
  * ebx = 1 - subfunction number
3090
  * ecx = pointer to the buffer
3117
  * ecx = pointer to the buffer
3091
  * edx = size of the buffer
3118
  * edx = size of the buffer
3092
Returned value:
3119
Returned value:
3093
  * eax = 0 - always success
3120
  * eax = 0 - always success
3094
Format of IPC-buffer:
3121
Format of IPC-buffer:
3095
  * +0: dword: if nonzero, buffer is considered locked;
3122
  * +0: dword: if nonzero, buffer is considered locked;
3096
    lock/unlock the buffer, when you work with it and need that
3123
    lock/unlock the buffer, when you work with it and need that
3097
    buffer data are not changed from outside (no new messages)
3124
    buffer data are not changed from outside (no new messages)
3098
  * +4: dword: occupied place in the buffer (in bytes)
3125
  * +4: dword: occupied place in the buffer (in bytes)
3099
  * +8: first message
3126
  * +8: first message
3100
  * +8+n: second message
3127
  * +8+n: second message
3101
  * ...
3128
  * ...
3102
Format of a message:
3129
Format of a message:
3103
  * +0: dword: PID of sender
3130
  * +0: dword: PID of sender
3104
  * +4: dword: message length (not including this header)
3131
  * +4: dword: message length (not including this header)
3105
  * +8: n*byte: message data
3132
  * +8: n*byte: message data
3106
 
3133
 
3107
------------------ Subfunction 2 - send IPC message ------------------
3134
------------------ Subfunction 2 - send IPC message ------------------
3108
Is called by process-sender.
3135
Is called by process-sender.
3109
Parameters:
3136
Parameters:
3110
  * eax = 60 - function number
3137
  * eax = 60 - function number
3111
  * ebx = 2 - subfunction number
3138
  * ebx = 2 - subfunction number
3112
  * ecx = PID of receiver
3139
  * ecx = PID of receiver
3113
  * edx = pointer to the message data
3140
  * edx = pointer to the message data
3114
  * esi = message length (in bytes)
3141
  * esi = message length (in bytes)
3115
Returned value:
3142
Returned value:
3116
  * eax = 0 - success
3143
  * eax = 0 - success
3117
  * eax = 1 - the receiver has not defined buffer for IPC messages
3144
  * eax = 1 - the receiver has not defined buffer for IPC messages
3118
    (can be, still have no time,
3145
    (can be, still have no time,
3119
    and can be, this is not right process)
3146
    and can be, this is not right process)
3120
  * eax = 2 - the receiver has blocked IPC-buffer; try to wait a bit
3147
  * eax = 2 - the receiver has blocked IPC-buffer; try to wait a bit
3121
  * eax = 3 - overflow of IPC-buffer of the receiver
3148
  * eax = 3 - overflow of IPC-buffer of the receiver
3122
  * eax = 4 - process/thread with such PID does not exist
3149
  * eax = 4 - process/thread with such PID does not exist
3123
Remarks:
3150
Remarks:
3124
  * Immediately after writing of IPC-message to the buffer the system
3151
  * Immediately after writing of IPC-message to the buffer the system
3125
    sends to the receiver the event with code 7 (see event codes).
3152
    sends to the receiver the event with code 7 (see event codes).
3126
 
3153
 
3127
======================================================================
3154
======================================================================
3128
==== Function 61 - get parameters for the direct graphics access. ====
3155
==== Function 61 - get parameters for the direct graphics access. ====
3129
======================================================================
3156
======================================================================
3130
The data of the graphics screen (the memory area which displays
3157
The data of the graphics screen (the memory area which displays
3131
screen contents) are accessible to a program directly, without
3158
screen contents) are accessible to a program directly, without
3132
any system calls, through the selector gs:
3159
any system calls, through the selector gs:
3133
	mov	eax, [gs:0]
3160
	mov	eax, [gs:0]
3134
places in eax the first dword of the buffer, which contains
3161
places in eax the first dword of the buffer, which contains
3135
information on color of the left upper point (and, possibly, colors
3162
information on color of the left upper point (and, possibly, colors
3136
of several following).
3163
of several following).
3137
	mov	[gs:0], eax
3164
	mov	[gs:0], eax
3138
by work in VESA modes with LFB sets color of the left upper point
3165
by work in VESA modes with LFB sets color of the left upper point
3139
(and, possibly, colors of several following).
3166
(and, possibly, colors of several following).
3140
To interpret the data of graphics screen program needs to know
3167
To interpret the data of graphics screen program needs to know
3141
some parameters, returning by this function.
3168
some parameters, returning by this function.
3142
Remarks:
3169
Remarks:
3143
  * Graphics parameters changes very seldom at work,
3170
  * Graphics parameters changes very seldom at work,
3144
    namely, only in cases, when user works with the application VRR.
3171
    namely, only in cases, when user works with the application VRR.
3145
  * At videomode change the system redraws all windows (event
3172
  * At videomode change the system redraws all windows (event
3146
    with code 1) and redraws the background (event 5).
3173
    with code 1) and redraws the background (event 5).
3147
    Same events occur in other cases too, which meet much more often,
3174
    Same events occur in other cases too, which meet much more often,
3148
    than videomode change.
3175
    than videomode change.
3149
  * By operation in videomodes with LFB the selector gs points to
3176
  * By operation in videomodes with LFB the selector gs points to
3150
    LFB itself, so reading/writing on gs result directly in
3177
    LFB itself, so reading/writing on gs result directly in
3151
    change of screen contents. By operation in videomodes without
3178
    change of screen contents. By operation in videomodes without
3152
    LFB gs points to some data area in the kernel, and all functions
3179
    LFB gs points to some data area in the kernel, and all functions
3153
    of screen output fulfil honesty double operation on writing
3180
    of screen output fulfil honesty double operation on writing
3154
    directly to the screen and writing to this buffer. In result
3181
    directly to the screen and writing to this buffer. In result
3155
    at reading contents of this buffer the results correspond to
3182
    at reading contents of this buffer the results correspond to
3156
    screen contents (with, generally speaking, large color
3183
    screen contents (with, generally speaking, large color
3157
    resolution), and writing is ignored.
3184
    resolution), and writing is ignored.
3158
    One exception is the mode 320*200, for which main loop of the
3185
    One exception is the mode 320*200, for which main loop of the
3159
    system thread updates the screen according to mouse movements.
3186
    system thread updates the screen according to mouse movements.
3160
 
3187
 
3161
------------------------- Screen resolution --------------------------
3188
------------------------- Screen resolution --------------------------
3162
Parameters:
3189
Parameters:
3163
  * eax = 61 - function number
3190
  * eax = 61 - function number
3164
  * ebx = 1 - subfunction number
3191
  * ebx = 1 - subfunction number
3165
Returned value:
3192
Returned value:
3166
  * eax = [resolution on x axis]*65536 + [resolution on y axis]
3193
  * eax = [resolution on x axis]*65536 + [resolution on y axis]
3167
Remarks:
3194
Remarks:
3168
  * One can use function 14 paying attention that
3195
  * One can use function 14 paying attention that
3169
    it returns sizes on 1 pixel less. It is fully equivalent way.
3196
    it returns sizes on 1 pixel less. It is fully equivalent way.
3170
 
3197
 
3171
---------------------- Number of bits per pixel ----------------------
3198
---------------------- Number of bits per pixel ----------------------
3172
Parameters:
3199
Parameters:
3173
  * eax = 61 - function number
3200
  * eax = 61 - function number
3174
  * ebx = 2 - subfunction number
3201
  * ebx = 2 - subfunction number
3175
Returned value:
3202
Returned value:
3176
  * eax = number of bits per pixel (24 or 32)
3203
  * eax = number of bits per pixel (24 or 32)
3177
 
3204
 
3178
-------------------- Number of bytes per scanline --------------------
3205
-------------------- Number of bytes per scanline --------------------
3179
Parameters:
3206
Parameters:
3180
  * eax = 61 - function number
3207
  * eax = 61 - function number
3181
  * ebx = 3 - subfunction number
3208
  * ebx = 3 - subfunction number
3182
Returned value:
3209
Returned value:
3183
  * eax = number of bytes occupied by one scanline
3210
  * eax = number of bytes occupied by one scanline
3184
    (horizontal line on the screen)
3211
    (horizontal line on the screen)
3185
 
3212
 
3186
======================================================================
3213
======================================================================
3187
===== Function 62, subfunction 0 - get version of PCI-interface. =====
3214
===== Function 62, subfunction 0 - get version of PCI-interface. =====
3188
======================================================================
3215
======================================================================
3189
Parameters:
3216
Parameters:
3190
  * eax = 62 - function number
3217
  * eax = 62 - function number
3191
  * bl = 0 - subfunction number
3218
  * bl = 0 - subfunction number
3192
Returned value:
3219
Returned value:
3193
  * eax = -1 - PCI access is disabled; otherwise
3220
  * eax = -1 - PCI access is disabled; otherwise
3194
  * ah.al = version of PCI-interface (ah=version, al=subversion)
3221
  * ah.al = version of PCI-interface (ah=version, al=subversion)
3195
  * high word of eax is zeroed
3222
  * high word of eax is zeroed
3196
Remarks:
3223
Remarks:
3197
  * Previously low-level access to PCI for applications must be
3224
  * Previously low-level access to PCI for applications must be
3198
    enabled by subfunction 12 of function 21.
3225
    enabled by subfunction 12 of function 21.
3199
  * If PCI BIOS is not supported, the value of ax is undefined.
3226
  * If PCI BIOS is not supported, the value of ax is undefined.
3200
 
3227
 
3201
======================================================================
3228
======================================================================
3202
==== Function 62, subfunction 1 - get number of the last PCI-bus. ====
3229
==== Function 62, subfunction 1 - get number of the last PCI-bus. ====
3203
======================================================================
3230
======================================================================
3204
Parameters:
3231
Parameters:
3205
  * eax = 62 - function number
3232
  * eax = 62 - function number
3206
  * bl = 1 - subfunction number
3233
  * bl = 1 - subfunction number
3207
Returned value:
3234
Returned value:
3208
  * eax = -1 - access to PCI is disabled; otherwise
3235
  * eax = -1 - access to PCI is disabled; otherwise
3209
  * al = number of the last PCI-bus; other bytes of eax are destroyed
3236
  * al = number of the last PCI-bus; other bytes of eax are destroyed
3210
Remarks:
3237
Remarks:
3211
  * Previously low-level access to PCI for applications must be
3238
  * Previously low-level access to PCI for applications must be
3212
    enabled by subfunction 12 of function 21.
3239
    enabled by subfunction 12 of function 21.
3213
  * If PCI BIOS is not supported, the value of ax is undefined.
3240
  * If PCI BIOS is not supported, the value of ax is undefined.
3214
 
3241
 
3215
======================================================================
3242
======================================================================
3216
===================== Function 62, subfunction 2 =====================
3243
===================== Function 62, subfunction 2 =====================
3217
===== Get mechanism of addressing to the PCI configuration space. ====
3244
===== Get mechanism of addressing to the PCI configuration space. ====
3218
======================================================================
3245
======================================================================
3219
Parameters:
3246
Parameters:
3220
  * eax = 62 - function number
3247
  * eax = 62 - function number
3221
  * bl = 2 - subfunction number
3248
  * bl = 2 - subfunction number
3222
Returned value:
3249
Returned value:
3223
  * eax = -1 - access to PCI is disabled; otherwise
3250
  * eax = -1 - access to PCI is disabled; otherwise
3224
  * al = mechanism (1 or 2); other bytes of eax are destroyed
3251
  * al = mechanism (1 or 2); other bytes of eax are destroyed
3225
Remarks:
3252
Remarks:
3226
  * Previously low-level access to PCI for applications must be
3253
  * Previously low-level access to PCI for applications must be
3227
    enabled by subfunction 12 of function 21.
3254
    enabled by subfunction 12 of function 21.
3228
  * Addressing mechanism is selected depending on
3255
  * Addressing mechanism is selected depending on
3229
    equipment characteristics.
3256
    equipment characteristics.
3230
  * Subfunctions of read and write work automatically
3257
  * Subfunctions of read and write work automatically
3231
    with the selected mechanism.
3258
    with the selected mechanism.
3232
 
3259
 
3233
======================================================================
3260
======================================================================
3234
======== Function 62, subfunctions 4,5,6 - read PCI-register. ========
3261
======== Function 62, subfunctions 4,5,6 - read PCI-register. ========
3235
======================================================================
3262
======================================================================
3236
Parameters:
3263
Parameters:
3237
  * eax = 62 - function number
3264
  * eax = 62 - function number
3238
  * bl = 4 - read byte
3265
  * bl = 4 - read byte
3239
  * bl = 5 - read word
3266
  * bl = 5 - read word
3240
  * bl = 6 - read dword
3267
  * bl = 6 - read dword
3241
  * bh = number of PCI-bus
3268
  * bh = number of PCI-bus
3242
  * ch = dddddfff, where ddddd = number of the device on the bus,
3269
  * ch = dddddfff, where ddddd = number of the device on the bus,
3243
    fff = function number of device
3270
    fff = function number of device
3244
  * cl = number of register (must be even for bl=5,
3271
  * cl = number of register (must be even for bl=5,
3245
    divisible by 4 for bl=6)
3272
    divisible by 4 for bl=6)
3246
Returned value:
3273
Returned value:
3247
  * eax = -1 - error (access to PCI is disabled or parameters
3274
  * eax = -1 - error (access to PCI is disabled or parameters
3248
    are not supported); otherwise
3275
    are not supported); otherwise
3249
  * al/ax/eax (depending on requested size) contains the data;
3276
  * al/ax/eax (depending on requested size) contains the data;
3250
    the other part of register eax is destroyed
3277
    the other part of register eax is destroyed
3251
Remarks:
3278
Remarks:
3252
  * Previously low-level access to PCI for applications must be
3279
  * Previously low-level access to PCI for applications must be
3253
    enabled by subfunction 12 of function 21.
3280
    enabled by subfunction 12 of function 21.
3254
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3281
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3255
    function number. To get access mechanism use subfunction 2.
3282
    function number. To get access mechanism use subfunction 2.
3256
  * Some registers are standard and exist for all devices, some are
3283
  * Some registers are standard and exist for all devices, some are
3257
    defined by the concrete device. The list of registers of the
3284
    defined by the concrete device. The list of registers of the
3258
    first type can be found e.g. in famous
3285
    first type can be found e.g. in famous
3259
    Interrupt List by Ralf Brown
3286
    Interrupt List by Ralf Brown
3260
    (http://www.pobox.com/~ralf/files.html,
3287
    (http://www.pobox.com/~ralf/files.html,
3261
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/);
3288
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/);
3262
    registers of the second type must be listed
3289
    registers of the second type must be listed
3263
    in the device documentation.
3290
    in the device documentation.
3264
 
3291
 
3265
======================================================================
3292
======================================================================
3266
====== Function 62, subfunctions 8,9,10 - write to PCI-register. =====
3293
====== Function 62, subfunctions 8,9,10 - write to PCI-register. =====
3267
======================================================================
3294
======================================================================
3268
Parameters:
3295
Parameters:
3269
  * eax = 62 - function number
3296
  * eax = 62 - function number
3270
  * bl = 8 - write byte
3297
  * bl = 8 - write byte
3271
  * bl = 9 - write word
3298
  * bl = 9 - write word
3272
  * bl = 10 - write dword
3299
  * bl = 10 - write dword
3273
  * bh = number of PCI-bus
3300
  * bh = number of PCI-bus
3274
  * ch = dddddfff, where ddddd = number of the device on the bus,
3301
  * ch = dddddfff, where ddddd = number of the device on the bus,
3275
    fff = function number of device
3302
    fff = function number of device
3276
  * cl = number of register (must be even for bl=9,
3303
  * cl = number of register (must be even for bl=9,
3277
    divisible by 4 for bl=10)
3304
    divisible by 4 for bl=10)
3278
  * dl/dx/edx (depending on requested size) contatins
3305
  * dl/dx/edx (depending on requested size) contatins
3279
    the data to write
3306
    the data to write
3280
Returned value:
3307
Returned value:
3281
  * eax = -1 - error (access to PCI is disabled or parameters
3308
  * eax = -1 - error (access to PCI is disabled or parameters
3282
    are not supported)
3309
    are not supported)
3283
  * eax = 0 - success
3310
  * eax = 0 - success
3284
Remarks:
3311
Remarks:
3285
  * Previously low-level access to PCI for applications must be
3312
  * Previously low-level access to PCI for applications must be
3286
    enabled by subfunction 12 of function 21.
3313
    enabled by subfunction 12 of function 21.
3287
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3314
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3288
    function number. To get access mechanism use subfunction 2.
3315
    function number. To get access mechanism use subfunction 2.
3289
  * Some registers are standard and exist for all devices, some are
3316
  * Some registers are standard and exist for all devices, some are
3290
    defined by the concrete device. The list of registers of the
3317
    defined by the concrete device. The list of registers of the
3291
    first type can be found e.g. in famous Interrupt List by
3318
    first type can be found e.g. in famous Interrupt List by
3292
    Ralf Brown; registers of the second type must be listed
3319
    Ralf Brown; registers of the second type must be listed
3293
    in the device documentation.
3320
    in the device documentation.
3294
 
3321
 
3295
======================================================================
3322
======================================================================
3296
============== Function 63 - work with the debug board. ==============
3323
============== Function 63 - work with the debug board. ==============
3297
======================================================================
3324
======================================================================
3298
The debug board is the global system buffer (with the size
3325
The debug board is the global system buffer (with the size
3299
1024 bytes), to which any program can write (generally speaking,
3326
1024 bytes), to which any program can write (generally speaking,
3300
arbitrary) data and from which other program can read these data.
3327
arbitrary) data and from which other program can read these data.
3301
By the agreement written data are text strings interpreted as
3328
By the agreement written data are text strings interpreted as
3302
debug messages on a course of program execution. The kernel in
3329
debug messages on a course of program execution. The kernel in
3303
some situations also writes to the debug board information on
3330
some situations also writes to the debug board information on
3304
execution of some functions; by the agreement kernel messages
3331
execution of some functions; by the agreement kernel messages
3305
begins from the prefix "K : ".
3332
begins from the prefix "K : ".
3306
For view of the debug board the application 'board' was created,
3333
For view of the debug board the application 'board' was created,
3307
which reads data from the buffer and displays them in its window.
3334
which reads data from the buffer and displays them in its window.
3308
'board' interpretes the sequence of codes 13,10 as newline.
3335
'board' interpretes the sequence of codes 13,10 as newline.
3309
A character with null code in an end of line is not necessary,
3336
A character with null code in an end of line is not necessary,
3310
but also does not prevent.
3337
but also does not prevent.
3311
Because debugger has been written, the value of the debug board
3338
Because debugger has been written, the value of the debug board
3312
has decreased, as debugger allows to inspect completely a course of
3339
has decreased, as debugger allows to inspect completely a course of
3313
program execution without any efforts from the direction of program
3340
program execution without any efforts from the direction of program
3314
itself. Nevertheless in some cases the debug board is still useful.
3341
itself. Nevertheless in some cases the debug board is still useful.
3315
 
3342
 
3316
----------------------------- Write byte -----------------------------
3343
----------------------------- Write byte -----------------------------
3317
Parameters:
3344
Parameters:
3318
  * eax = 63 - function number
3345
  * eax = 63 - function number
3319
  * ebx = 1 - subfunction number
3346
  * ebx = 1 - subfunction number
3320
  * cl = data byte
3347
  * cl = data byte
3321
Returned value:
3348
Returned value:
3322
  * function does not return value
3349
  * function does not return value
3323
Remarks:
3350
Remarks:
3324
  * Byte is written to the buffer. Buffer size is 512 bytes.
3351
  * Byte is written to the buffer. Buffer size is 512 bytes.
3325
    At buffer overflow all obtained data are lost.
3352
    At buffer overflow all obtained data are lost.
3326
  * For output to the debug board of more complicated objects
3353
  * For output to the debug board of more complicated objects
3327
    (strings, numbers) it is enough to call this function in cycle.
3354
    (strings, numbers) it is enough to call this function in cycle.
3328
    It is possible not to write the appropriate code manually and use
3355
    It is possible not to write the appropriate code manually and use
3329
    file 'debug.inc', which is included into the distributive.
3356
    file 'debug.inc', which is included into the distributive.
3330
 
3357
 
3331
----------------------------- Read byte ------------------------------
3358
----------------------------- Read byte ------------------------------
3332
Takes away byte from the buffer.
3359
Takes away byte from the buffer.
3333
Parameters:
3360
Parameters:
3334
  * eax = 63 - function number
3361
  * eax = 63 - function number
3335
  * ebx = 2 - subfunction number
3362
  * ebx = 2 - subfunction number
3336
Returned value:
3363
Returned value:
3337
  * eax = ebx = 0 - the buffer is empty
3364
  * eax = ebx = 0 - the buffer is empty
3338
  * eax = byte, ebx = 1 - byte was successfully read
3365
  * eax = byte, ebx = 1 - byte was successfully read
3339
 
3366
 
3340
======================================================================
3367
======================================================================
3341
============== Function 64 - resize application memory. ==============
3368
============== Function 64 - resize application memory. ==============
3342
======================================================================
3369
======================================================================
3343
Parameters:
3370
Parameters:
3344
  * eax = 64 - function number
3371
  * eax = 64 - function number
3345
  * ebx = 1 - unique subfunction
3372
  * ebx = 1 - unique subfunction
3346
  * ecx = new memory size
3373
  * ecx = new memory size
3347
Returned value:
3374
Returned value:
3348
  * eax = 0 - success
3375
  * eax = 0 - success
3349
  * eax = 1 - not enough memory
3376
  * eax = 1 - not enough memory
3350
Remarks:
3377
Remarks:
3351
  * There is another way to dynamically allocate/free memory -
3378
  * There is another way to dynamically allocate/free memory -
3352
    subfunctions 11, 12, 13 of function 68.
3379
    subfunctions 11, 12, 13 of function 68.
3353
  * The function cannot be used together with 68.11, 68.12, 68.13.
3380
  * 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
3381
    The function call will be ignored after creation of process heap
3355
    with function 68.11.
3382
    with function 68.11.
3356
 
3383
 
3357
======================================================================
3384
======================================================================
3358
======== Function 65 - draw image with palette in the window. ========
3385
======== Function 65 - draw image with palette in the window. ========
3359
======================================================================
3386
======================================================================
3360
Parameters:
3387
Parameters:
3361
  * eax = 65 - function number
3388
  * eax = 65 - function number
3362
  * ebx = pointer to the image
3389
  * ebx = pointer to the image
3363
  * ecx = [size on axis x]*65536 + [size on axis y]
3390
  * ecx = [size on axis x]*65536 + [size on axis y]
3364
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
3391
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
3365
  * esi = number of bits per pixel, must be 8, 24 or 32
3392
  * esi = number of bits per pixel, must be 8, 24 or 32
3366
  * edi = pointer to palette (256 colors 0x00RRGGBB);
3393
  * edi = pointer to palette (256 colors 0x00RRGGBB);
3367
          ignored when esi = 24 and 32
3394
          ignored when esi = 24 and 32
3368
  * ebp = offset of next row data relative to previous row data
3395
  * ebp = offset of next row data relative to previous row data
3369
Returned value:
3396
Returned value:
3370
  * function does not return value
3397
  * function does not return value
3371
Remarks:
3398
Remarks:
3372
  * Coordinates of the image are coordinates of the upper left corner
3399
  * Coordinates of the image are coordinates of the upper left corner
3373
    of the image relative to the window.
3400
    of the image relative to the window.
3374
  * Size of the image in bytes is xsize*ysize.
3401
  * Size of the image in bytes is xsize*ysize.
3375
  * Each byte of image is index in the palette.
3402
  * Each byte of image is index in the palette.
3376
  * If the image uses less than 256 colors, palette size may be
3403
  * If the image uses less than 256 colors, palette size may be
3377
    less than 256 too.
3404
    less than 256 too.
3378
  * The call to function 7 is equivalent to call to this function
3405
  * The call to function 7 is equivalent to call to this function
3379
    with esi=24, ebp=0.
3406
    with esi=24, ebp=0.
3380
 
3407
 
3381
======================================================================
3408
======================================================================
3382
================== Function 66 - work with keyboard. =================
3409
================== Function 66 - work with keyboard. =================
3383
======================================================================
3410
======================================================================
3384
The input mode influences results of reading keys by function 2.
3411
The input mode influences results of reading keys by function 2.
3385
When a program loads, ASCII input mode is set for it.
3412
When a program loads, ASCII input mode is set for it.
3386
 
3413
 
3387
-------------- Subfunction 1 - set keyboard input mode. --------------
3414
-------------- Subfunction 1 - set keyboard input mode. --------------
3388
Parameters:
3415
Parameters:
3389
  * eax = 66 - function number
3416
  * eax = 66 - function number
3390
  * ebx = 1 - subfunction number
3417
  * ebx = 1 - subfunction number
3391
  * ecx = mode:
3418
  * ecx = mode:
3392
    * 0 = normal (ASCII-characters)
3419
    * 0 = normal (ASCII-characters)
3393
    * 1 = scancodes
3420
    * 1 = scancodes
3394
Returned value:
3421
Returned value:
3395
  * function does not return value
3422
  * function does not return value
3396
 
3423
 
3397
-------------- Subfunction 2 - get keyboard input mode. --------------
3424
-------------- Subfunction 2 - get keyboard input mode. --------------
3398
Parameters:
3425
Parameters:
3399
  * eax = 66 - function number
3426
  * eax = 66 - function number
3400
  * ebx = 2 - subfunction number
3427
  * ebx = 2 - subfunction number
3401
Returned value:
3428
Returned value:
3402
  * eax = current mode
3429
  * eax = current mode
3403
 
3430
 
3404
------------ Subfunction 3 - get status of control keys. -------------
3431
------------ Subfunction 3 - get status of control keys. -------------
3405
Parameters:
3432
Parameters:
3406
  * eax = 66 - function number
3433
  * eax = 66 - function number
3407
  * ebx = 3 - subfunction number
3434
  * ebx = 3 - subfunction number
3408
Returned value:
3435
Returned value:
3409
  * eax = bit mask:
3436
  * eax = bit mask:
3410
  * bit 0 (mask 1): left Shift is pressed
3437
  * bit 0 (mask 1): left Shift is pressed
3411
  * bit 1 (mask 2): right Shift is pressed
3438
  * bit 1 (mask 2): right Shift is pressed
3412
  * bit 2 (mask 4): left Ctrl is pressed
3439
  * bit 2 (mask 4): left Ctrl is pressed
3413
  * bit 3 (mask 8): right Ctrl is pressed
3440
  * bit 3 (mask 8): right Ctrl is pressed
3414
  * bit 4 (mask 0x10): left Alt is pressed
3441
  * bit 4 (mask 0x10): left Alt is pressed
3415
  * bit 5 (mask 0x20): right Alt is pressed
3442
  * bit 5 (mask 0x20): right Alt is pressed
3416
  * bit 6 (mask 0x40): CapsLock is on
3443
  * bit 6 (mask 0x40): CapsLock is on
3417
  * bit 7 (mask 0x80): NumLock is on
3444
  * bit 7 (mask 0x80): NumLock is on
3418
  * bit 8 (mask 0x100): ScrollLock is on
3445
  * bit 8 (mask 0x100): ScrollLock is on
3419
  * other bits are cleared
3446
  * other bits are cleared
3420
 
3447
 
3421
-------------- Subfunction 4 - set system-wide hotkey. ---------------
3448
-------------- Subfunction 4 - set system-wide hotkey. ---------------
3422
When hotkey is pressed, the system notifies only those applications,
3449
When hotkey is pressed, the system notifies only those applications,
3423
which have installed it; the active application (which receives
3450
which have installed it; the active application (which receives
3424
all normal input) does not receive such keys.
3451
all normal input) does not receive such keys.
3425
The notification consists in sending event with the code 2.
3452
The notification consists in sending event with the code 2.
3426
Reading hotkey is the same as reading normal key - by function 2.
3453
Reading hotkey is the same as reading normal key - by function 2.
3427
Parameters:
3454
Parameters:
3428
  * eax = 66 - function number
3455
  * eax = 66 - function number
3429
  * ebx = 4 - subfunction number
3456
  * ebx = 4 - subfunction number
3430
  * cl determines key scancode;
3457
  * cl determines key scancode;
3431
    use cl=0 to give combinations such as Ctrl+Shift
3458
    use cl=0 to give combinations such as Ctrl+Shift
3432
  * edx = 0xXYZ determines possible states of control keys:
3459
  * edx = 0xXYZ determines possible states of control keys:
3433
    * Z (low 4 bits) determines state of LShift and RShift:
3460
    * Z (low 4 bits) determines state of LShift and RShift:
3434
      * 0 = no key must be pressed;
3461
      * 0 = no key must be pressed;
3435
      * 1 = exactly one key must be pressed;
3462
      * 1 = exactly one key must be pressed;
3436
      * 2 = both keys must be pressed;
3463
      * 2 = both keys must be pressed;
3437
      * 3 = must be pressed LShift, but not RShift;
3464
      * 3 = must be pressed LShift, but not RShift;
3438
      * 4 = must be pressed RShift, but not LShift
3465
      * 4 = must be pressed RShift, but not LShift
3439
    * Y - similar for LCtrl and RCtrl;
3466
    * Y - similar for LCtrl and RCtrl;
3440
    * X - similar for LAlt and RAlt
3467
    * X - similar for LAlt and RAlt
3441
Returned value:
3468
Returned value:
3442
  * eax=0 - success
3469
  * eax=0 - success
3443
  * eax=1 - too mant hotkeys (maximum 256 are allowed)
3470
  * eax=1 - too mant hotkeys (maximum 256 are allowed)
3444
Remarks:
3471
Remarks:
3445
  * Hotkey can work either at pressing or at release. Release
3472
  * Hotkey can work either at pressing or at release. Release
3446
    scancode of a key is more on 128 than pressing scancode
3473
    scancode of a key is more on 128 than pressing scancode
3447
    (i.e. high bit is set).
3474
    (i.e. high bit is set).
3448
  * Several applications can set the same combination;
3475
  * Several applications can set the same combination;
3449
    all such applications will be informed on pressing
3476
    all such applications will be informed on pressing
3450
    such combination.
3477
    such combination.
3451
 
3478
 
3452
-------------- Subfunction 5 - delete installed hotkey. --------------
3479
-------------- Subfunction 5 - delete installed hotkey. --------------
3453
Parameters:
3480
Parameters:
3454
  * eax = 66 - function number
3481
  * eax = 66 - function number
3455
  * ebx = 5 - subfunction number
3482
  * ebx = 5 - subfunction number
3456
  * cl = scancode of key and edx = 0xXYZ the same as in subfunction 4
3483
  * cl = scancode of key and edx = 0xXYZ the same as in subfunction 4
3457
Returned value:
3484
Returned value:
3458
  * eax = 0 - success
3485
  * eax = 0 - success
3459
  * eax = 1 - there is no such hotkey
3486
  * eax = 1 - there is no such hotkey
3460
Remarks:
3487
Remarks:
3461
  * When a process/thread terminates, all hotkey installed by it are
3488
  * When a process/thread terminates, all hotkey installed by it are
3462
    deleted.
3489
    deleted.
3463
  * The call to this subfunction does not affect other applications.
3490
  * The call to this subfunction does not affect other applications.
3464
    If other application has defined the same combination, it will
3491
    If other application has defined the same combination, it will
3465
    still receive notices.
3492
    still receive notices.
3466
 
3493
 
3467
======================================================================
3494
======================================================================
3468
========= Function 67 - change position/sizes of the window. =========
3495
========= Function 67 - change position/sizes of the window. =========
3469
======================================================================
3496
======================================================================
3470
Parameters:
3497
Parameters:
3471
  * eax = 67 - function number
3498
  * eax = 67 - function number
3472
  * ebx = new x-coordinate of the window
3499
  * ebx = new x-coordinate of the window
3473
  * ecx = new y-coordinate of the window
3500
  * ecx = new y-coordinate of the window
3474
  * edx = new x-size of the window
3501
  * edx = new x-size of the window
3475
  * esi = new y-size of the window
3502
  * esi = new y-size of the window
3476
Returned value:
3503
Returned value:
3477
  * function does not return value
3504
  * function does not return value
3478
Remarks:
3505
Remarks:
3479
  * The value -1 for a parameter means "do not change"; e.g. to move
3506
  * 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.
3507
    the window without resizing it is possible to specify edx=esi=-1.
3481
  * Previously the window must be defined by function 0.
3508
  * Previously the window must be defined by function 0.
3482
    It sets initial coordinates and sizes of the window.
3509
    It sets initial coordinates and sizes of the window.
3483
  * Sizes of the window are understood in sense of function 0,
3510
  * Sizes of the window are understood in sense of function 0,
3484
    that is one pixel less than real sizes.
3511
    that is one pixel less than real sizes.
3485
  * The function call for maximized windows is simply ignored.
3512
  * The function call for maximized windows is simply ignored.
3486
  * For windows of appropriate styles position and/or sizes can be
3513
  * For windows of appropriate styles position and/or sizes can be
3487
    changed by user; current position and sizes can be obtained by
3514
    changed by user; current position and sizes can be obtained by
3488
    call to function 9.
3515
    call to function 9.
3489
  * The function sends to the window redraw event (with the code 1).
3516
  * The function sends to the window redraw event (with the code 1).
3490
 
3517
 
3491
======================================================================
3518
======================================================================
3492
====== Function 68, subfunction 0 - get the task switch counter. =====
3519
====== Function 68, subfunction 0 - get the task switch counter. =====
3493
======================================================================
3520
======================================================================
3494
Parameters:
3521
Parameters:
3495
  * eax = 68 - function number
3522
  * eax = 68 - function number
3496
  * ebx = 0 - subfunction number
3523
  * ebx = 0 - subfunction number
3497
Returned value:
3524
Returned value:
3498
  * eax = number of task switches from the system booting
3525
  * eax = number of task switches from the system booting
3499
    (modulo 2^32)
3526
    (modulo 2^32)
3500
 
3527
 
3501
======================================================================
3528
======================================================================
3502
======= Function 68, subfunction 1 - switch to the next thread. ======
3529
======= Function 68, subfunction 1 - switch to the next thread. ======
3503
======================================================================
3530
======================================================================
3504
The function completes the current time slice allocated to the
3531
The function completes the current time slice allocated to the
3505
thread and switches to the next. (Which thread in which process
3532
thread and switches to the next. (Which thread in which process
3506
will be next, is unpredictable). Later, when execution queue
3533
will be next, is unpredictable). Later, when execution queue
3507
will reach the current thread, execution will be continued.
3534
will reach the current thread, execution will be continued.
3508
Parameters:
3535
Parameters:
3509
  * eax = 68 - function number
3536
  * eax = 68 - function number
3510
  * ebx = 1 - subfunction number
3537
  * ebx = 1 - subfunction number
3511
Returned value:
3538
Returned value:
3512
  * function does not return value
3539
  * function does not return value
3513
 
3540
 
3514
======================================================================
3541
======================================================================
3515
============= Function 68, subfunction 2 - cache + rdpmc. ============
3542
============= Function 68, subfunction 2 - cache + rdpmc. ============
3516
======================================================================
3543
======================================================================
3517
Parameters:
3544
Parameters:
3518
  * eax = 68 - function number
3545
  * eax = 68 - function number
3519
  * ebx = 2 - subfunction number
3546
  * ebx = 2 - subfunction number
3520
  * ecx = required action:
3547
  * ecx = required action:
3521
    * ecx = 0 - enable instruction 'rdpmc'
3548
    * ecx = 0 - enable instruction 'rdpmc'
3522
      (ReaD Performance-Monitoring Counters) for applications
3549
      (ReaD Performance-Monitoring Counters) for applications
3523
    * ecx = 1 - find out whether cache is disabled/enabled
3550
    * ecx = 1 - find out whether cache is disabled/enabled
3524
    * ecx = 2 - enable cache
3551
    * ecx = 2 - enable cache
3525
    * ecx = 3 - disable cache
3552
    * ecx = 3 - disable cache
3526
Returned value:
3553
Returned value:
3527
  * for ecx=0:
3554
  * for ecx=0:
3528
    * eax = the value of cr4
3555
    * eax = the value of cr4
3529
  * for ecx=1:
3556
  * for ecx=1:
3530
    * eax = (cr0 and 0x60000000):
3557
    * eax = (cr0 and 0x60000000):
3531
    * eax = 0 - cache is on
3558
    * eax = 0 - cache is on
3532
    * eax <> 0 - cache is off
3559
    * eax <> 0 - cache is off
3533
  * for ecx=2 and ecx=3:
3560
  * for ecx=2 and ecx=3:
3534
    * function does not return value
3561
    * function does not return value
3535
 
3562
 
3536
======================================================================
3563
======================================================================
3537
=========== Function 68, subfunction 3 - read MSR-register. ==========
3564
=========== Function 68, subfunction 3 - read MSR-register. ==========
3538
======================================================================
3565
======================================================================
3539
MSR = Model Specific Register; the complete list of MSR-registers
3566
MSR = Model Specific Register; the complete list of MSR-registers
3540
of a processor is included to the documentation on it (for example,
3567
of a processor is included to the documentation on it (for example,
3541
IA-32 Intel Architecture Software Developer's Manual,
3568
IA-32 Intel Architecture Software Developer's Manual,
3542
Volume 3, Appendix B); each processor family has its own subset
3569
Volume 3, Appendix B); each processor family has its own subset
3543
of the MSR-registers.
3570
of the MSR-registers.
3544
Parameters:
3571
Parameters:
3545
  * eax = 68 - function number
3572
  * eax = 68 - function number
3546
  * ebx = 3 - subfunction number
3573
  * ebx = 3 - subfunction number
3547
  * ecx is ignored
3574
  * ecx is ignored
3548
  * edx = MSR address
3575
  * edx = MSR address
3549
Returned value:
3576
Returned value:
3550
  * ebx:eax = high:low dword of the result
3577
  * ebx:eax = high:low dword of the result
3551
Remarks:
3578
Remarks:
3552
  * If ecx contains nonexistent or not implemented for this processor
3579
  * If ecx contains nonexistent or not implemented for this processor
3553
    MSR, processor will generate an exception in the kernel, which
3580
    MSR, processor will generate an exception in the kernel, which
3554
    will kill the thread.
3581
    will kill the thread.
3555
  * Previously it is necessary to check, whether MSRs are supported
3582
  * Previously it is necessary to check, whether MSRs are supported
3556
    as a whole, with the instruction 'cpuid'. Otherwise processor
3583
    as a whole, with the instruction 'cpuid'. Otherwise processor
3557
    will generate other exception in the kernel, which will anyway
3584
    will generate other exception in the kernel, which will anyway
3558
    kill the thread.
3585
    kill the thread.
3559
 
3586
 
3560
======================================================================
3587
======================================================================
3561
========= Function 68, subfunction 4 - write to MSR-register. ========
3588
========= Function 68, subfunction 4 - write to MSR-register. ========
3562
======================================================================
3589
======================================================================
3563
MSR = Model Specific Register; the complete list of MSR-registers
3590
MSR = Model Specific Register; the complete list of MSR-registers
3564
of a processor is included to the documentation on it (for example,
3591
of a processor is included to the documentation on it (for example,
3565
IA-32 Intel Architecture Software Developer's Manual,
3592
IA-32 Intel Architecture Software Developer's Manual,
3566
Volume 3, Appendix B); each processor family has its own subset
3593
Volume 3, Appendix B); each processor family has its own subset
3567
of the MSR-registers.
3594
of the MSR-registers.
3568
Parameters:
3595
Parameters:
3569
  * eax = 68 - function number
3596
  * eax = 68 - function number
3570
  * ebx = 4 - subfunction number
3597
  * ebx = 4 - subfunction number
3571
  * ecx is ignored
3598
  * ecx is ignored
3572
  * edx = MSR address
3599
  * edx = MSR address
3573
  * esi:edi = high:low dword
3600
  * esi:edi = high:low dword
3574
Returned value:
3601
Returned value:
3575
  * function does not return value
3602
  * function does not return value
3576
Remarks:
3603
Remarks:
3577
  * If ecx contains nonexistent or not implemented for this processor
3604
  * If ecx contains nonexistent or not implemented for this processor
3578
    MSR, processor will generate an exception in the kernel, which
3605
    MSR, processor will generate an exception in the kernel, which
3579
    will kill the thread.
3606
    will kill the thread.
3580
  * Previously it is necessary to check, whether MSRs are supported
3607
  * Previously it is necessary to check, whether MSRs are supported
3581
    as a whole, with the instruction 'cpuid'. Otherwise processor
3608
    as a whole, with the instruction 'cpuid'. Otherwise processor
3582
    will generate other exception in the kernel, which will anyway
3609
    will generate other exception in the kernel, which will anyway
3583
    kill the thread.
3610
    kill the thread.
3584
 
3611
 
3585
======================================================================
3612
======================================================================
3586
======= Function 68, subfunction 11 - initialize process heap. =======
3613
======= Function 68, subfunction 11 - initialize process heap. =======
3587
======================================================================
3614
======================================================================
3588
Parameters:
3615
Parameters:
3589
  * eax = 68 - function number
3616
  * eax = 68 - function number
3590
  * ebx = 11 - subfunction number
3617
  * ebx = 11 - subfunction number
3591
Returned value:
3618
Returned value:
3592
  * eax = 0 - failed
3619
  * eax = 0 - failed
3593
  * otherwise size of created heap
3620
  * otherwise size of created heap
3594
Remarks:
3621
Remarks:
3595
  * The function call initializes heap, from which one can in future
3622
  * The function call initializes heap, from which one can in future
3596
    allocate and free memory blocks with subfunctions 12 and 13.
3623
    allocate and free memory blocks with subfunctions 12 and 13.
3597
    Heap size is equal to total amount of free application memory.
3624
    Heap size is equal to total amount of free application memory.
3598
  * The second function call from the same process results in
3625
  * The second function call from the same process results in
3599
    returning the size of the existing heap.
3626
    returning the size of the existing heap.
3600
  * After creation of the heap calls to function 64 will be ignored.
3627
  * After creation of the heap calls to function 64 will be ignored.
3601
 
3628
 
3602
======================================================================
3629
======================================================================
3603
======== Function 68, subfunction 12 - allocate memory block. ========
3630
======== Function 68, subfunction 12 - allocate memory block. ========
3604
======================================================================
3631
======================================================================
3605
Parameters:
3632
Parameters:
3606
  * eax = 68 - function number
3633
  * eax = 68 - function number
3607
  * ebx = 12 - subfunction number
3634
  * ebx = 12 - subfunction number
3608
  * ecx = required size in bytes
3635
  * ecx = required size in bytes
3609
Returned value:
3636
Returned value:
3610
  * eax = pointer to the allocated block
3637
  * eax = pointer to the allocated block
3611
Remarks:
3638
Remarks:
3612
  * Before this call one must initialize process heap by call to
3639
  * Before this call one must initialize process heap by call to
3613
    subfunction 11.
3640
    subfunction 11.
3614
  * The function allocates an integer number of pages (4 Kb) in such
3641
  * 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
3642
    way that the real size of allocated block is more than or equal to
3616
    requested size.
3643
    requested size.
3617
 
3644
 
3618
======================================================================
3645
======================================================================
3619
========== Function 68, subfunction 13 - free memory block. ==========
3646
========== Function 68, subfunction 13 - free memory block. ==========
3620
======================================================================
3647
======================================================================
3621
Parameters:
3648
Parameters:
3622
  * eax = 68 - function number
3649
  * eax = 68 - function number
3623
  * ebx = 13 - subfunction number
3650
  * ebx = 13 - subfunction number
3624
  * ecx = pointer to the memory block
3651
  * ecx = pointer to the memory block
3625
Returned value:
3652
Returned value:
3626
  * eax = 1 - success
3653
  * eax = 1 - success
3627
  * eax = 0 - failed
3654
  * eax = 0 - failed
3628
Remarks:
3655
Remarks:
3629
  * The memory block must have been allocated by subfunction 12
3656
  * The memory block must have been allocated by subfunction 12
3630
    or subfunction 20.
3657
    or subfunction 20.
3631
 
3658
 
3632
======================================================================
3659
======================================================================
3633
======== Function 68, subfunction 14 - wait for driver notify. =======
3660
======== Function 68, subfunction 14 - wait for driver notify. =======
3634
======================================================================
3661
======================================================================
3635
Parameters:
3662
Parameters:
3636
  * eax = 68 - function number
3663
  * eax = 68 - function number
3637
  * ebx = 14 - subfunction number
3664
  * ebx = 14 - subfunction number
3638
  * ecx = pointer to the buffer for information (8 bytes)
3665
  * ecx = pointer to the buffer for information (8 bytes)
3639
Returned value:
3666
Returned value:
3640
  * buffer pointed to by ecx contains the following information:
3667
  * buffer pointed to by ecx contains the following information:
3641
    * +0: dword: constant EV_INTR = 1
3668
    * +0: dword: constant EV_INTR = 1
3642
    * +4: dword: driver data
3669
    * +4: dword: driver data
3643
Remarks:
3670
Remarks:
3644
  * The current implementation at wait time uses "heavy" operations
3671
  * The current implementation at wait time uses "heavy" operations
3645
    of task switch.
3672
    of task switch.
3646
 
3673
 
3647
======================================================================
3674
======================================================================
3648
====== Function 68, subfunction 15 - set FPU exception handler. ======
3675
====== Function 68, subfunction 15 - set FPU exception handler. ======
3649
======================================================================
3676
======================================================================
3650
Parameters:
3677
Parameters:
3651
  * eax = 68 - function number
3678
  * eax = 68 - function number
3652
  * ebx = 15 - subfunction number
3679
  * ebx = 15 - subfunction number
3653
  * ecx = address of the new exception handler
3680
  * ecx = address of the new exception handler
3654
Returned value:
3681
Returned value:
3655
  * eax = address of the old exception handler (0, if it was not set)
3682
  * eax = address of the old exception handler (0, if it was not set)
3656
 
3683
 
3657
======================================================================
3684
======================================================================
3658
============= Function 68, subfunction 16 - load driver. =============
3685
============= Function 68, subfunction 16 - load driver. =============
3659
======================================================================
3686
======================================================================
3660
Parameters:
3687
Parameters:
3661
  * eax = 68 - function number
3688
  * eax = 68 - function number
3662
  * ebx = 16 - subfunction number
3689
  * ebx = 16 - subfunction number
3663
  * ecx = pointer to ASCIIZ-string with driver name
3690
  * ecx = pointer to ASCIIZ-string with driver name
3664
Returned value:
3691
Returned value:
3665
  * eax = 0 - failed
3692
  * eax = 0 - failed
3666
  * otherwise eax = driver handle
3693
  * otherwise eax = driver handle
3667
Remarks:
3694
Remarks:
3668
  * If the driver was not loaded yet, it is loaded;
3695
  * If the driver was not loaded yet, it is loaded;
3669
    if the driver was loaded yet, nothing happens.
3696
    if the driver was loaded yet, nothing happens.
3670
  * Driver name is case-sensitive.
3697
  * Driver name is case-sensitive.
3671
    Maximum length of the name is 16 characters, including
3698
    Maximum length of the name is 16 characters, including
3672
    terminating null character, the rest is ignored.
3699
    terminating null character, the rest is ignored.
3673
  * Driver ABC is loaded from file /rd/1/drivers/ABC.obj.
3700
  * Driver ABC is loaded from file /rd/1/drivers/ABC.obj.
3674
 
3701
 
3675
======================================================================
3702
======================================================================
3676
============ Function 68, subfunction 17 - driver control. ===========
3703
============ Function 68, subfunction 17 - driver control. ===========
3677
======================================================================
3704
======================================================================
3678
Parameters:
3705
Parameters:
3679
  * eax = 68 - function number
3706
  * eax = 68 - function number
3680
  * ebx = 17 - subfunction number
3707
  * ebx = 17 - subfunction number
3681
  * ecx = pointer to the control structure:
3708
  * ecx = pointer to the control structure:
3682
    * +0: dword: handle of driver
3709
    * +0: dword: handle of driver
3683
    * +4: dword: code of driver function
3710
    * +4: dword: code of driver function
3684
    * +8: dword: pointer to input data
3711
    * +8: dword: pointer to input data
3685
    * +12 = +0xC: dword: size of input data
3712
    * +12 = +0xC: dword: size of input data
3686
    * +16 = +0x10: dword: pointer to output data
3713
    * +16 = +0x10: dword: pointer to output data
3687
    * +20 = +0x14: dword: size of output data
3714
    * +20 = +0x14: dword: size of output data
3688
Returned value:
3715
Returned value:
3689
  * eax = determined by driver
3716
  * eax = determined by driver
3690
Remarks:
3717
Remarks:
3691
  * Function codes and the structure of input/output data
3718
  * Function codes and the structure of input/output data
3692
    are defined by driver.
3719
    are defined by driver.
3693
  * Previously one must obtain driver handle by subfunction 16.
3720
  * Previously one must obtain driver handle by subfunction 16.
3694
 
3721
 
3695
======================================================================
3722
======================================================================
3696
====== Function 68, subfunction 18 - set SSE exception handler. ======
3723
====== Function 68, subfunction 18 - set SSE exception handler. ======
3697
======================================================================
3724
======================================================================
3698
Parameters:
3725
Parameters:
3699
  * eax = 68 - function number
3726
  * eax = 68 - function number
3700
  * ebx = 15 - subfunction number
3727
  * ebx = 15 - subfunction number
3701
  * ecx = address of the new exception handler
3728
  * ecx = address of the new exception handler
3702
Returned value:
3729
Returned value:
3703
  * eax = address of the old exception handler (0, if it was not set)
3730
  * eax = address of the old exception handler (0, if it was not set)
3704
 
3731
 
3705
======================================================================
3732
======================================================================
3706
=============== Function 68, subfunction 19 - load DLL. ==============
3733
=============== Function 68, subfunction 19 - load DLL. ==============
3707
======================================================================
3734
======================================================================
3708
Parameters:
3735
Parameters:
3709
  * eax = 68 - function number
3736
  * eax = 68 - function number
3710
  * ebx = 19 - subfunction number
3737
  * ebx = 19 - subfunction number
3711
  * ecx = pointer to ASCIIZ-string with the full path to DLL
3738
  * ecx = pointer to ASCIIZ-string with the full path to DLL
3712
Returned value:
3739
Returned value:
3713
  * eax = 0 - failed
3740
  * eax = 0 - failed
3714
  * otherwise eax = pointer to DLL export table
3741
  * otherwise eax = pointer to DLL export table
3715
Remarks:
3742
Remarks:
3716
  * Export table is an array of structures of 2 dword's, terminated
3743
  * Export table is an array of structures of 2 dword's, terminated
3717
    by zero. The first dword in structure points to function name,
3744
    by zero. The first dword in structure points to function name,
3718
    the second dword contains address of function.
3745
    the second dword contains address of function.
3719
 
3746
 
3720
======================================================================
3747
======================================================================
3721
======= Function 68, subfunction 20 - reallocate memory block. =======
3748
======= Function 68, subfunction 20 - reallocate memory block. =======
3722
======================================================================
3749
======================================================================
3723
Parameters:
3750
Parameters:
3724
  * eax = 68 - function number
3751
  * eax = 68 - function number
3725
  * ebx = 20 - subfunction number
3752
  * ebx = 20 - subfunction number
3726
  * ecx = new size in bytes
3753
  * ecx = new size in bytes
3727
  * edx = pointer to already allocated block
3754
  * edx = pointer to already allocated block
3728
Returned value:
3755
Returned value:
3729
  * eax = pointer to the reallocated block, 0 = error
3756
  * eax = pointer to the reallocated block, 0 = error
3730
Remarks:
3757
Remarks:
3731
  * Before this call one must initialize process heap by call to
3758
  * Before this call one must initialize process heap by call to
3732
    subfunction 11.
3759
    subfunction 11.
3733
  * The function allocates an integer number of pages (4 Kb) in such
3760
  * The function allocates an integer number of pages (4 Kb) in such
3734
    way that the real size of allocated block is more than or equal to
3761
    way that the real size of allocated block is more than or equal to
3735
    requested size.
3762
    requested size.
3736
  * If edx=0, the function call is equivalent to memory allocation
3763
  * If edx=0, the function call is equivalent to memory allocation
3737
    with subfunction 12. Otherwise the block at edx
3764
    with subfunction 12. Otherwise the block at edx
3738
    must be allocated earlier with subfunction 12 or this subfunction.
3765
    must be allocated earlier with subfunction 12 or this subfunction.
3739
  * If ecx=0, the function frees memory block at edx and returns 0.
3766
  * If ecx=0, the function frees memory block at edx and returns 0.
3740
  * The contents of the block are unchanged up to the shorter of
3767
  * The contents of the block are unchanged up to the shorter of
3741
    the new and old sizes.
3768
    the new and old sizes.
3742
 
3769
 
3743
======================================================================
3770
======================================================================
3744
====================== Fucntion 69 - debugging. ======================
3771
====================== Fucntion 69 - debugging. ======================
3745
======================================================================
3772
======================================================================
3746
A process can load other process as debugged by set of corresponding
3773
A process can load other process as debugged by set of corresponding
3747
bit by call to subfunction 7 of function 70.
3774
bit by call to subfunction 7 of function 70.
3748
A process can have only one debugger; one process can debug some
3775
A process can have only one debugger; one process can debug some
3749
others. The system notifies debugger on events occuring with
3776
others. The system notifies debugger on events occuring with
3750
debugged process. Messages are written to the buffer defined by
3777
debugged process. Messages are written to the buffer defined by
3751
subfunction 0.
3778
subfunction 0.
3752
Format of a message:
3779
Format of a message:
3753
  * +0: dword: message code
3780
  * +0: dword: message code
3754
  * +4: dword: PID of debugged process
3781
  * +4: dword: PID of debugged process
3755
  * +8: there can be additional data depending on message code
3782
  * +8: there can be additional data depending on message code
3756
Message codes:
3783
Message codes:
3757
  * 1 = exception
3784
  * 1 = exception
3758
    * in addition dword-number of the exception is given
3785
    * in addition dword-number of the exception is given
3759
    * process is suspended
3786
    * process is suspended
3760
  * 2 = process has terminated
3787
  * 2 = process has terminated
3761
    * comes at any termination: both through the system function -1,
3788
    * comes at any termination: both through the system function -1,
3762
      and at "murder" by any other process (including debugger itself)
3789
      and at "murder" by any other process (including debugger itself)
3763
  * 3 = debug exception int 1 = #DB
3790
  * 3 = debug exception int 1 = #DB
3764
    * in addition dword-image of the register DR6 is given:
3791
    * in addition dword-image of the register DR6 is given:
3765
      * bits 0-3: condition of the corresponding breakpoint (set by
3792
      * bits 0-3: condition of the corresponding breakpoint (set by
3766
        subfunction 9) is satisfied
3793
        subfunction 9) is satisfied
3767
      * áèò 14: exception has occured because of the trace mode
3794
      * áèò 14: exception has occured because of the trace mode
3768
        (flag TF is set TF)
3795
        (flag TF is set TF)
3769
    * process is suspended
3796
    * process is suspended
3770
When debugger terminates, all debugged processes are killed.
3797
When debugger terminates, all debugged processes are killed.
3771
If debugger does not want this, it must previously detach by
3798
If debugger does not want this, it must previously detach by
3772
subfunction 3.
3799
subfunction 3.
3773
 
3800
 
3774
All subfunctions are applicable only to processes/threads started
3801
All subfunctions are applicable only to processes/threads started
3775
from the current by function 70 with set debugging flag.
3802
from the current by function 70 with set debugging flag.
3776
Debugging of multithreaded programs is not supported yet.
3803
Debugging of multithreaded programs is not supported yet.
3777
The full list of subfunctions:
3804
The full list of subfunctions:
3778
  * subfunction 0 - define data area for debug messages
3805
  * subfunction 0 - define data area for debug messages
3779
  * subfunction 1 - get contents of registers of debugged thread
3806
  * subfunction 1 - get contents of registers of debugged thread
3780
  * subfunction 2 - set contents of registers of debugged thread
3807
  * subfunction 2 - set contents of registers of debugged thread
3781
  * subfunction 3 - detach from debugged process
3808
  * subfunction 3 - detach from debugged process
3782
  * subfunction 4 - suspend debugged thread
3809
  * subfunction 4 - suspend debugged thread
3783
  * subfunction 5 - resume debugged thread
3810
  * subfunction 5 - resume debugged thread
3784
  * subfunction 6 - read from the memory of debugged process
3811
  * subfunction 6 - read from the memory of debugged process
3785
  * subfunction 7 - write to the memory of debugged process
3812
  * subfunction 7 - write to the memory of debugged process
3786
  * subfunction 8 - terminate debugged thread
3813
  * subfunction 8 - terminate debugged thread
3787
  * subfunction 9 - set/clear hardware breakpoint
3814
  * subfunction 9 - set/clear hardware breakpoint
3788
 
3815
 
3789
======================================================================
3816
======================================================================
3790
= Function 69, subfunction 0 - define data area fror debug messages. =
3817
= Function 69, subfunction 0 - define data area fror debug messages. =
3791
======================================================================
3818
======================================================================
3792
Parameters:
3819
Parameters:
3793
  * eax = 69 - function number
3820
  * eax = 69 - function number
3794
  * ebx = 0 - subfunction number
3821
  * ebx = 0 - subfunction number
3795
  * ecx = pointer
3822
  * ecx = pointer
3796
Format of data area:
3823
Format of data area:
3797
  * +0: dword: N = buffer size (not including this header)
3824
  * +0: dword: N = buffer size (not including this header)
3798
  * +4: dword: occupied place
3825
  * +4: dword: occupied place
3799
  * +8: N*byte: buffer
3826
  * +8: N*byte: buffer
3800
Returned value:
3827
Returned value:
3801
  * function does not return value
3828
  * function does not return value
3802
Remarks:
3829
Remarks:
3803
  * If the size field is negative, the buffer is considered locked
3830
  * If the size field is negative, the buffer is considered locked
3804
    and at arrival of new message the system will wait.
3831
    and at arrival of new message the system will wait.
3805
    For synchronization frame all work with the buffer by operations
3832
    For synchronization frame all work with the buffer by operations
3806
    lock/unlock
3833
    lock/unlock
3807
    	neg	[bufsize]
3834
    	neg	[bufsize]
3808
  * Data in the buffer are considered as array of items with variable
3835
  * Data in the buffer are considered as array of items with variable
3809
    length - messages. Format of a message is explained in
3836
    length - messages. Format of a message is explained in
3810
    general description.
3837
    general description.
3811
 
3838
 
3812
======================================================================
3839
======================================================================
3813
===================== Function 69, subfunction 1 =====================
3840
===================== Function 69, subfunction 1 =====================
3814
============ Get contents of registers of debugged thread. ===========
3841
============ Get contents of registers of debugged thread. ===========
3815
======================================================================
3842
======================================================================
3816
Parameters:
3843
Parameters:
3817
  * eax = 69 - function number
3844
  * eax = 69 - function number
3818
  * ebx = 1 - subfunction number
3845
  * ebx = 1 - subfunction number
3819
  * ecx = thread identifier
3846
  * ecx = thread identifier
3820
  * edx = size of context structure, must be 0x28=40 bytes
3847
  * edx = size of context structure, must be 0x28=40 bytes
3821
  * esi = pointer to context structure
3848
  * esi = pointer to context structure
3822
Returned value:
3849
Returned value:
3823
  * function does not return value
3850
  * function does not return value
3824
Format of context structure: (FPU is not supported yet)
3851
Format of context structure: (FPU is not supported yet)
3825
  * +0: dword: eip
3852
  * +0: dword: eip
3826
  * +4: dword: eflags
3853
  * +4: dword: eflags
3827
  * +8: dword: eax
3854
  * +8: dword: eax
3828
  * +12 = +0xC: dword: ecx
3855
  * +12 = +0xC: dword: ecx
3829
  * +16 = +0x10: dword: edx
3856
  * +16 = +0x10: dword: edx
3830
  * +20 = +0x14: dword: ebx
3857
  * +20 = +0x14: dword: ebx
3831
  * +24 = +0x18: dword: esp
3858
  * +24 = +0x18: dword: esp
3832
  * +28 = +0x1C: dword: ebp
3859
  * +28 = +0x1C: dword: ebp
3833
  * +32 = +0x20: dword: esi
3860
  * +32 = +0x20: dword: esi
3834
  * +36 = +0x24: dword: edi
3861
  * +36 = +0x24: dword: edi
3835
Remarks:
3862
Remarks:
3836
  * If the thread executes code of ring-0, the function returns
3863
  * If the thread executes code of ring-0, the function returns
3837
    contents of registers of ring-3.
3864
    contents of registers of ring-3.
3838
  * Process must be loaded for debugging (as is shown in
3865
  * Process must be loaded for debugging (as is shown in
3839
    general description).
3866
    general description).
3840
 
3867
 
3841
======================================================================
3868
======================================================================
3842
===================== Function 69, subfunction 2 =====================
3869
===================== Function 69, subfunction 2 =====================
3843
============ Set contents of registers of debugged thread. ===========
3870
============ Set contents of registers of debugged thread. ===========
3844
======================================================================
3871
======================================================================
3845
Parameters:
3872
Parameters:
3846
  * eax = 69 - function number
3873
  * eax = 69 - function number
3847
  * ebx = 2 - subfunction number
3874
  * ebx = 2 - subfunction number
3848
  * ecx = thread identifier
3875
  * ecx = thread identifier
3849
  * edx = size of context structure, must be 0x28=40 bytes
3876
  * edx = size of context structure, must be 0x28=40 bytes
3850
Returned value:
3877
Returned value:
3851
  * function does not return value
3878
  * function does not return value
3852
Format of context structure is shown in the description of
3879
Format of context structure is shown in the description of
3853
subfunction 1.
3880
subfunction 1.
3854
Remarks:
3881
Remarks:
3855
  * If the thread executes code of ring-0, the function returns
3882
  * If the thread executes code of ring-0, the function returns
3856
    contents of registers of ring-3.
3883
    contents of registers of ring-3.
3857
  * Process must be loaded for debugging (as is shown in
3884
  * Process must be loaded for debugging (as is shown in
3858
    general description).
3885
    general description).
3859
 
3886
 
3860
======================================================================
3887
======================================================================
3861
===== Function 69, subfunction 3 - detach from debugged process. =====
3888
===== Function 69, subfunction 3 - detach from debugged process. =====
3862
======================================================================
3889
======================================================================
3863
Parameters:
3890
Parameters:
3864
  * eax = 69 - function number
3891
  * eax = 69 - function number
3865
  * ebx = 3 - subfunction number
3892
  * ebx = 3 - subfunction number
3866
  * ecx = identifier
3893
  * ecx = identifier
3867
Returned value:
3894
Returned value:
3868
  * function does not return value
3895
  * function does not return value
3869
Remarks:
3896
Remarks:
3870
  * If the process was suspended, it resumes execution.
3897
  * If the process was suspended, it resumes execution.
3871
 
3898
 
3872
======================================================================
3899
======================================================================
3873
======== Function 69, subfunction 4 - suspend debugged thread. =======
3900
======== Function 69, subfunction 4 - suspend debugged thread. =======
3874
======================================================================
3901
======================================================================
3875
Parameters:
3902
Parameters:
3876
  * eax = 69 - function number
3903
  * eax = 69 - function number
3877
  * ebx = 4 - subfunction number
3904
  * ebx = 4 - subfunction number
3878
  * ecx = thread identifier
3905
  * ecx = thread identifier
3879
Returned value:
3906
Returned value:
3880
  * function does not return value
3907
  * function does not return value
3881
Remarks:
3908
Remarks:
3882
  * Process must be loaded for debugging (as is shown in
3909
  * Process must be loaded for debugging (as is shown in
3883
    general description).
3910
    general description).
3884
 
3911
 
3885
======================================================================
3912
======================================================================
3886
======== Function 69, subfunction 5 - resume debugged thread. ========
3913
======== Function 69, subfunction 5 - resume debugged thread. ========
3887
======================================================================
3914
======================================================================
3888
Parameters:
3915
Parameters:
3889
  * eax = 69 - function number
3916
  * eax = 69 - function number
3890
  * ebx = 5 - subfunction number
3917
  * ebx = 5 - subfunction number
3891
  * ecx = thread identifier
3918
  * ecx = thread identifier
3892
Returned value:
3919
Returned value:
3893
  * function does not return value
3920
  * function does not return value
3894
Remarks:
3921
Remarks:
3895
  * Process must be loaded for debugging (as is shown in
3922
  * Process must be loaded for debugging (as is shown in
3896
    general description).
3923
    general description).
3897
 
3924
 
3898
======================================================================
3925
======================================================================
3899
= Fucntion 69, subfunction 6 - read from memory of debugged process. =
3926
= Fucntion 69, subfunction 6 - read from memory of debugged process. =
3900
======================================================================
3927
======================================================================
3901
Parameters:
3928
Parameters:
3902
  * eax = 69 - function number
3929
  * eax = 69 - function number
3903
  * ebx = 6 - subfunction number
3930
  * ebx = 6 - subfunction number
3904
  * ecx = identifier
3931
  * ecx = identifier
3905
  * edx = number of bytes to read
3932
  * edx = number of bytes to read
3906
  * esi = address in the memory of debugged process
3933
  * esi = address in the memory of debugged process
3907
  * edi = pointer to buffer for data
3934
  * edi = pointer to buffer for data
3908
Returned value:
3935
Returned value:
3909
  * eax = -1 at an error (invalid PID or buffer)
3936
  * eax = -1 at an error (invalid PID or buffer)
3910
  * otherwise eax = number of read bytes (possibly, 0,
3937
  * otherwise eax = number of read bytes (possibly, 0,
3911
    if esi is too large)
3938
    if esi is too large)
3912
Remarks:
3939
Remarks:
3913
  * Process must be loaded for debugging (as is shown in
3940
  * Process must be loaded for debugging (as is shown in
3914
    general description).
3941
    general description).
3915
 
3942
 
3916
======================================================================
3943
======================================================================
3917
== Function 69, subfunction 7 - write to memory of debugged process. =
3944
== Function 69, subfunction 7 - write to memory of debugged process. =
3918
======================================================================
3945
======================================================================
3919
Parameters:
3946
Parameters:
3920
  * eax = 69 - function number
3947
  * eax = 69 - function number
3921
  * ebx = 7 - subfunction number
3948
  * ebx = 7 - subfunction number
3922
  * ecx = identifier
3949
  * ecx = identifier
3923
  * edx = number of bytes to write
3950
  * edx = number of bytes to write
3924
  * esi = address of memory in debugged process
3951
  * esi = address of memory in debugged process
3925
  * edi = pointer to data
3952
  * edi = pointer to data
3926
Returned value:
3953
Returned value:
3927
  * eax = -1 at an error (invalid PID or buffer)
3954
  * eax = -1 at an error (invalid PID or buffer)
3928
  * otherwise eax = number of written bytes (possibly, 0,
3955
  * otherwise eax = number of written bytes (possibly, 0,
3929
    if esi is too large)
3956
    if esi is too large)
3930
Remarks:
3957
Remarks:
3931
  * Process must be loaded for debugging (as is shown in
3958
  * Process must be loaded for debugging (as is shown in
3932
    general description).
3959
    general description).
3933
 
3960
 
3934
======================================================================
3961
======================================================================
3935
======= Function 69, subfunction 8 - terminate debugged thread. ======
3962
======= Function 69, subfunction 8 - terminate debugged thread. ======
3936
======================================================================
3963
======================================================================
3937
Parameters:
3964
Parameters:
3938
  * eax = 69 - function number
3965
  * eax = 69 - function number
3939
  * ebx = 8 - subfunction number
3966
  * ebx = 8 - subfunction number
3940
  * ecx = identifier
3967
  * ecx = identifier
3941
Returned value:
3968
Returned value:
3942
  * function does not return value
3969
  * function does not return value
3943
Remarks:
3970
Remarks:
3944
  * Process must be loaded for debugging (as is shown in
3971
  * Process must be loaded for debugging (as is shown in
3945
    general description).
3972
    general description).
3946
  * The function is similar to subfunction 2 of function 18
3973
  * The function is similar to subfunction 2 of function 18
3947
    with two differences: it requires first remark and
3974
    with two differences: it requires first remark and
3948
    accepts PID rather than slot number.
3975
    accepts PID rather than slot number.
3949
 
3976
 
3950
======================================================================
3977
======================================================================
3951
===== Function 69, subfunction 9 - set/clear hardware breakpoint. ====
3978
===== Function 69, subfunction 9 - set/clear hardware breakpoint. ====
3952
======================================================================
3979
======================================================================
3953
Parameters:
3980
Parameters:
3954
  * eax = 69 - function number
3981
  * eax = 69 - function number
3955
  * ebx = 9 - subfunction number
3982
  * ebx = 9 - subfunction number
3956
  * ecx = thread identifier
3983
  * ecx = thread identifier
3957
  * dl = index of breakpoint, from 0 to 3 inclusively
3984
  * dl = index of breakpoint, from 0 to 3 inclusively
3958
  * dh = flags:
3985
  * dh = flags:
3959
    * if high bit is cleared - set breakpoint:
3986
    * if high bit is cleared - set breakpoint:
3960
      * bits 0-1 - condition:
3987
      * bits 0-1 - condition:
3961
        * 00 = breakpoint on execution
3988
        * 00 = breakpoint on execution
3962
        * 01 = breakpoint on read
3989
        * 01 = breakpoint on read
3963
        * 11 = breakpoint on read/write
3990
        * 11 = breakpoint on read/write
3964
      * bits 2-3 - length; for breakpoints on exception it must be
3991
      * bits 2-3 - length; for breakpoints on exception it must be
3965
        00, otherwise one of
3992
        00, otherwise one of
3966
        * 00 = byte
3993
        * 00 = byte
3967
        * 01 = word
3994
        * 01 = word
3968
        * 11 = dword
3995
        * 11 = dword
3969
      * esi = breakpoint address; must be aligned according to
3996
      * esi = breakpoint address; must be aligned according to
3970
        the length (i.e. must be even for word breakpoints,
3997
        the length (i.e. must be even for word breakpoints,
3971
        divisible by 4 for dword)
3998
        divisible by 4 for dword)
3972
    * if high bit is set - clear breakpoint
3999
    * if high bit is set - clear breakpoint
3973
Returned value:
4000
Returned value:
3974
  * eax = 0 - success
4001
  * eax = 0 - success
3975
  * eax = 1 - error in the input data
4002
  * eax = 1 - error in the input data
3976
  * eax = 2 - (reserved, is never returned in the current
4003
  * eax = 2 - (reserved, is never returned in the current
3977
    implementation) a global breakpoint with that index is already set
4004
    implementation) a global breakpoint with that index is already set
3978
Remarks:
4005
Remarks:
3979
  * Process must be loaded for debugging (as is shown in
4006
  * Process must be loaded for debugging (as is shown in
3980
    general description).
4007
    general description).
3981
  * Hardware breakpoints are implemented through DRx-registers of
4008
  * Hardware breakpoints are implemented through DRx-registers of
3982
    the processor, all limitations results from this.
4009
    the processor, all limitations results from this.
3983
  * The function can reinstall the breakpoint, previously set
4010
  * The function can reinstall the breakpoint, previously set
3984
    by it (and it does not inform on this).
4011
    by it (and it does not inform on this).
3985
    Carry on the list of set breakpoints in the debugger.
4012
    Carry on the list of set breakpoints in the debugger.
3986
  * Breakpoints generate debug exception #DB, on which the system
4013
  * Breakpoints generate debug exception #DB, on which the system
3987
    notifies debugger.
4014
    notifies debugger.
3988
  * Breakpoints on write and read/write act after
4015
  * Breakpoints on write and read/write act after
3989
    execution of the caused it instruction.
4016
    execution of the caused it instruction.
3990
 
4017
 
3991
======================================================================
4018
======================================================================
3992
==== Function 70 - work with file system with long names support. ====
4019
==== Function 70 - work with file system with long names support. ====
3993
======================================================================
4020
======================================================================
3994
Parameters:
4021
Parameters:
3995
  * eax = 70
4022
  * eax = 70
3996
  * ebx = pointer to the information structure
4023
  * ebx = pointer to the information structure
3997
Returned value:
4024
Returned value:
3998
  * eax = 0 - success; otherwise file system error code
4025
  * eax = 0 - success; otherwise file system error code
3999
  * some subfunctions return value in other registers too
4026
  * some subfunctions return value in other registers too
4000
General format of the information structure:
4027
General format of the information structure:
4001
  * +0: dword: subfunction number
4028
  * +0: dword: subfunction number
4002
  * +4: dword: file offset
4029
  * +4: dword: file offset
4003
  * +8: dword: high dword of offset (must be 0) or flags field
4030
  * +8: dword: high dword of offset (must be 0) or flags field
4004
  * +12 = +0xC: dword: size
4031
  * +12 = +0xC: dword: size
4005
  * +16 = +0x10: dword: pointer to data
4032
  * +16 = +0x10: dword: pointer to data
4006
  * +20 = +0x14: n db: ASCIIZ-string with the filename
4033
  * +20 = +0x14: n db: ASCIIZ-string with the filename
4007
    or
4034
    or
4008
  * +20 = +0x14: db 0
4035
  * +20 = +0x14: db 0
4009
  * +21 = +0x15: dd pointer to ASCIIZ-string with the filename
4036
  * +21 = +0x15: dd pointer to ASCIIZ-string with the filename
4010
Specifications - in documentation on the appropriate subfunction.
4037
Specifications - in documentation on the appropriate subfunction.
4011
Filename is case-insensitive. Russian letters must be written in
4038
Filename is case-insensitive. Russian letters must be written in
4012
the encoding cp866 (DOS).
4039
the encoding cp866 (DOS).
4013
Format of filename:
4040
Format of filename:
4014
/base/number/dir1/dir2/.../dirn/file,
4041
/base/number/dir1/dir2/.../dirn/file,
4015
where /base/number identifies device, on which file is located:
4042
where /base/number identifies device, on which file is located:
4016
one of
4043
one of
4017
  * /RD/1 = /RAMDISK/1 to access ramdisk
4044
  * /RD/1 = /RAMDISK/1 to access ramdisk
4018
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
4045
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
4019
    /FD/2 = /FLOPPYDISK/2 to access second one
4046
    /FD/2 = /FLOPPYDISK/2 to access second one
4020
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
4047
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
4021
    IDE0 (Primary Master), IDE1 (Primary Slave),
4048
    IDE0 (Primary Master), IDE1 (Primary Slave),
4022
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
4049
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
4023
    x - partition number on the selected hard drive, varies from 1
4050
    x - partition number on the selected hard drive, varies from 1
4024
    to 255 (on each hard drive the indexing starts from 1)
4051
    to 255 (on each hard drive the indexing starts from 1)
4025
  * /CD0/1, /CD1/1, /CD2/1, /CD3/1 to access accordingly to
4052
  * /CD0/1, /CD1/1, /CD2/1, /CD3/1 to access accordingly to
4026
    CD on IDE0 (Primary Master), IDE1 (Primary Slave),
4053
    CD on IDE0 (Primary Master), IDE1 (Primary Slave),
4027
    IDE2 (Secondary Master), IDE3 (Secondary Slave)
4054
    IDE2 (Secondary Master), IDE3 (Secondary Slave)
-
 
4055
  * /SYS means system folder; with the usual boot (from floppy)
-
 
4056
    is equivalent to /RD/1
4028
Examples:
4057
Examples:
4029
  * '/rd/1/kernel.asm',0
4058
  * '/rd/1/kernel.asm',0
4030
  * '/HD0/1/kernel.asm',0
4059
  * '/HD0/1/kernel.asm',0
4031
  * '/hd0/2/menuet/pics/tanzania.bmp',0
4060
  * '/hd0/2/menuet/pics/tanzania.bmp',0
4032
  * '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0
4061
  * '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0
-
 
4062
  * '/sys/MySuperApp.ini',0
4033
Available subfunctions:
4063
Available subfunctions:
4034
  * subfunction 0 - read file
4064
  * subfunction 0 - read file
4035
  * subfunction 1 - read folder
4065
  * subfunction 1 - read folder
4036
  * subfunction 2 - create/rewrite file
4066
  * subfunction 2 - create/rewrite file
4037
  * subfunction 3 - write to existing file
4067
  * subfunction 3 - write to existing file
4038
  * subfunction 4 - set file size
4068
  * subfunction 4 - set file size
4039
  * subfunction 5 - get attributes of file/folder
4069
  * subfunction 5 - get attributes of file/folder
4040
  * subfunction 6 - set attributes of file/folder
4070
  * subfunction 6 - set attributes of file/folder
4041
  * subfunction 7 - start application
4071
  * subfunction 7 - start application
4042
  * subfunction 8 - delete file/folder
4072
  * subfunction 8 - delete file/folder
4043
  * subfunction 9 - create folder
4073
  * subfunction 9 - create folder
4044
For CD-drives due to hardware limitations only subfunctions
4074
For CD-drives due to hardware limitations only subfunctions
4045
0,1,5 and 7 are available, other subfunctions return error
4075
0,1,5 and 7 are available, other subfunctions return error
4046
with code 2.
4076
with code 2.
4047
 
4077
 
4048
======================================================================
4078
======================================================================
4049
=== Function 70, subfunction 0 - read file with long names support. ==
4079
=== Function 70, subfunction 0 - read file with long names support. ==
4050
======================================================================
4080
======================================================================
4051
Parameters:
4081
Parameters:
4052
  * eax = 70 - function number
4082
  * eax = 70 - function number
4053
  * ebx = pointer to the information structure
4083
  * ebx = pointer to the information structure
4054
Format of the information structure:
4084
Format of the information structure:
4055
  * +0: dword: 0 = subfunction number
4085
  * +0: dword: 0 = subfunction number
4056
  * +4: dword: file offset (in bytes)
4086
  * +4: dword: file offset (in bytes)
4057
  * +8: dword: 0 (reserved for high dword of offset)
4087
  * +8: dword: 0 (reserved for high dword of offset)
4058
  * +12 = +0xC: dword: number of bytes to read
4088
  * +12 = +0xC: dword: number of bytes to read
4059
  * +16 = +0x10: dword: pointer to buffer for data
4089
  * +16 = +0x10: dword: pointer to buffer for data
4060
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4090
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4061
    given in the general description
4091
    given in the general description
4062
    or
4092
    or
4063
  * +20 = +0x14: db 0
4093
  * +20 = +0x14: db 0
4064
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4094
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4065
Returned value:
4095
Returned value:
4066
  * eax = 0 - success, otherwise file system error code
4096
  * eax = 0 - success, otherwise file system error code
4067
  * ebx = number of read bytes or -1=0xffffffff if file was not found
4097
  * ebx = number of read bytes or -1=0xffffffff if file was not found
4068
Remarks:
4098
Remarks:
4069
  * If file was ended before last requested block was read,
4099
  * If file was ended before last requested block was read,
4070
    the function will read as many as it can, and after that return
4100
    the function will read as many as it can, and after that return
4071
    eax=6 (EOF).
4101
    eax=6 (EOF).
4072
  * The function does not allow to read folder (returns eax=10,
4102
  * The function does not allow to read folder (returns eax=10,
4073
    access denied).
4103
    access denied).
4074
 
4104
 
4075
======================================================================
4105
======================================================================
4076
== Function 70, subfunction 1 - read folder with long names support. =
4106
== Function 70, subfunction 1 - read folder with long names support. =
4077
======================================================================
4107
======================================================================
4078
Parameters:
4108
Parameters:
4079
  * eax = 70 - function number
4109
  * eax = 70 - function number
4080
  * ebx = pointer to the information structure
4110
  * ebx = pointer to the information structure
4081
Format of the information structure:
4111
Format of the information structure:
4082
  * +0: dword: 1 = subfunction number
4112
  * +0: dword: 1 = subfunction number
4083
  * +4: dword: index of starting block (beginning from 0)
4113
  * +4: dword: index of starting block (beginning from 0)
4084
  * +8: dword: flags field:
4114
  * +8: dword: flags field:
4085
    * bit 0 (mask 1): in what format to return names,
4115
    * bit 0 (mask 1): in what format to return names,
4086
      0=ANSI, 1=UNICODE
4116
      0=ANSI, 1=UNICODE
4087
    * other bits are reserved and must be set to 0 for the future
4117
    * other bits are reserved and must be set to 0 for the future
4088
      compatibility
4118
      compatibility
4089
  * +12 = +0xC: dword: number of blocks to read
4119
  * +12 = +0xC: dword: number of blocks to read
4090
  * +16 = +0x10: dword: pointer to buffer for data, buffer size
4120
  * +16 = +0x10: dword: pointer to buffer for data, buffer size
4091
    must be not less than 32 + [+12]*560 bytes
4121
    must be not less than 32 + [+12]*560 bytes
4092
  * +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
4122
  * +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
4093
    given in the general description
4123
    given in the general description
4094
    or
4124
    or
4095
  * +20 = +0x14: db 0
4125
  * +20 = +0x14: db 0
4096
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4126
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4097
Returned value:
4127
Returned value:
4098
  * eax = 0 - success, otherwise file system error code
4128
  * eax = 0 - success, otherwise file system error code
4099
  * ebx = number of files, information on which was written to
4129
  * ebx = number of files, information on which was written to
4100
    the buffer, or -1=0xffffffff, if folder was not found
4130
    the buffer, or -1=0xffffffff, if folder was not found
4101
Structure of the buffer:
4131
Structure of the buffer:
4102
  * +0: 32*byte: header
4132
  * +0: 32*byte: header
4103
  * +32 = +0x20: n1*byte: block with information on file 1
4133
  * +32 = +0x20: n1*byte: block with information on file 1
4104
  * +32+n1: n2*byte: block with information on file 2
4134
  * +32+n1: n2*byte: block with information on file 2
4105
  * ...
4135
  * ...
4106
Structure of header:
4136
Structure of header:
4107
  * +0: dword: version of structure (current is 1)
4137
  * +0: dword: version of structure (current is 1)
4108
  * +4: dword: number of placed blocks; is not greater than requested
4138
  * +4: dword: number of placed blocks; is not greater than requested
4109
    in the field +12 of information structure; can be less, if
4139
    in the field +12 of information structure; can be less, if
4110
    there are no more files in folder (the same as in ebx)
4140
    there are no more files in folder (the same as in ebx)
4111
  * +8: dword: total number of files in folder
4141
  * +8: dword: total number of files in folder
4112
  * +12 = +0xC: 20*byte: reserved (zeroed)
4142
  * +12 = +0xC: 20*byte: reserved (zeroed)
4113
Structure of block of data for folder entry (BDFE):
4143
Structure of block of data for folder entry (BDFE):
4114
  * +0: dword: attributes of file:
4144
  * +0: dword: attributes of file:
4115
    * bit 0 (mask 1): file is read-only
4145
    * bit 0 (mask 1): file is read-only
4116
    * bit 1 (mask 2): file is hidden
4146
    * bit 1 (mask 2): file is hidden
4117
    * bit 2 (mask 4): file is system
4147
    * bit 2 (mask 4): file is system
4118
    * bit 3 (mask 8): this is not a file but volume label
4148
    * bit 3 (mask 8): this is not a file but volume label
4119
      (for one partition meets no more than once and
4149
      (for one partition meets no more than once and
4120
      only in root folder)
4150
      only in root folder)
4121
    * bit 4 (mask 0x10): this is a folder
4151
    * bit 4 (mask 0x10): this is a folder
4122
    * bit 5 (mask 0x20): file was not archived - many archivation
4152
    * bit 5 (mask 0x20): file was not archived - many archivation
4123
      programs have an option to archive only files with this bit set,
4153
      programs have an option to archive only files with this bit set,
4124
      and after archiving this bit is cleared - it can be useful
4154
      and after archiving this bit is cleared - it can be useful
4125
      for automatically creating of backup-archives as at writing
4155
      for automatically creating of backup-archives as at writing
4126
      this bit is usually set
4156
      this bit is usually set
4127
  * +4: byte: type of name data:
4157
  * +4: byte: type of name data:
4128
    (coincides with bit 0 of flags in the information structure)
4158
    (coincides with bit 0 of flags in the information structure)
4129
    * 0 = ASCII = 1-byte representation of each character
4159
    * 0 = ASCII = 1-byte representation of each character
4130
    * 1 = UNICODE = 2-byte representation of each character
4160
    * 1 = UNICODE = 2-byte representation of each character
4131
  * +5: 3*byte: reserved (zero)
4161
  * +5: 3*byte: reserved (zero)
4132
  * +8: 4*byte: time of file creation
4162
  * +8: 4*byte: time of file creation
4133
  * +12 = +0xC: 4*byte: date of file creation
4163
  * +12 = +0xC: 4*byte: date of file creation
4134
  * +16 = +0x10: 4*byte: time of last access (read or write)
4164
  * +16 = +0x10: 4*byte: time of last access (read or write)
4135
  * +20 = +0x14: 4*byte: date of last access
4165
  * +20 = +0x14: 4*byte: date of last access
4136
  * +24 = +0x18: 4*byte: time of last modification
4166
  * +24 = +0x18: 4*byte: time of last modification
4137
  * +28 = +0x1C: 4*byte: date of last modification
4167
  * +28 = +0x1C: 4*byte: date of last modification
4138
  * +32 = +0x20: qword: file size in bytes (up to 16777216 Tb)
4168
  * +32 = +0x20: qword: file size in bytes (up to 16777216 Tb)
4139
  * +40 = +0x28: name
4169
  * +40 = +0x28: name
4140
    * for ASCII format: maximum length is 263 characters
4170
    * for ASCII format: maximum length is 263 characters
4141
      (263 bytes), byte after the name has value 0
4171
      (263 bytes), byte after the name has value 0
4142
    * for UNICODE format: maximum length is 259 characters
4172
    * for UNICODE format: maximum length is 259 characters
4143
      (518 bytes), 2 bytes after the name have value 0
4173
      (518 bytes), 2 bytes after the name have value 0
4144
Time format:
4174
Time format:
4145
  * +0: byte: seconds
4175
  * +0: byte: seconds
4146
  * +1: byte: minutes
4176
  * +1: byte: minutes
4147
  * +2: byte: hours
4177
  * +2: byte: hours
4148
  * +3: byte: reserved (0)
4178
  * +3: byte: reserved (0)
4149
  * for example, 23.59.59 is written as (in hex) 3B 3B 17 00
4179
  * for example, 23.59.59 is written as (in hex) 3B 3B 17 00
4150
Date format:
4180
Date format:
4151
  * +0: byte: day
4181
  * +0: byte: day
4152
  * +1: byte: month
4182
  * +1: byte: month
4153
  * +2: word: year
4183
  * +2: word: year
4154
  * for example, 25.11.1979 is written as (in hex) 19 0B BB 07
4184
  * for example, 25.11.1979 is written as (in hex) 19 0B BB 07
4155
Remarks:
4185
Remarks:
4156
  * If BDFE contains ASCII name, the length of BDFE is 304 bytes,
4186
  * If BDFE contains ASCII name, the length of BDFE is 304 bytes,
4157
    if UNICODE name - 560 bytes. Value of length is aligned
4187
    if UNICODE name - 560 bytes. Value of length is aligned
4158
    on 16-byte bound (to accelerate processing in CPU cache).
4188
    on 16-byte bound (to accelerate processing in CPU cache).
4159
  * First character after a name is zero (ASCIIZ-string). The further
4189
  * First character after a name is zero (ASCIIZ-string). The further
4160
    data contain garbage.
4190
    data contain garbage.
4161
  * If files in folder were ended before requested number was read,
4191
  * If files in folder were ended before requested number was read,
4162
    the function will read as many as it can, and after that return
4192
    the function will read as many as it can, and after that return
4163
    eax=6 (EOF).
4193
    eax=6 (EOF).
4164
  * Any folder on the disk, except for root, contains two special
4194
  * Any folder on the disk, except for root, contains two special
4165
    entries "." and "..", identifying accordingly the folder itself
4195
    entries "." and "..", identifying accordingly the folder itself
4166
    and the parent folder.
4196
    and the parent folder.
4167
  * The function allows also to read virtual folders "/", "/rd",
4197
  * The function allows also to read virtual folders "/", "/rd",
4168
    "/fd", "/hd[n]", thus attributes of subfolders are set to 0x10,
4198
    "/fd", "/hd[n]", thus attributes of subfolders are set to 0x10,
4169
    and times and dates are zeroed. An alternative way to get the
4199
    and times and dates are zeroed. An alternative way to get the
4170
    equipment information - subfunction 11 of function 18.
4200
    equipment information - subfunction 11 of function 18.
4171
 
4201
 
4172
======================================================================
4202
======================================================================
4173
===================== Function 70, subfunction 2 =====================
4203
===================== Function 70, subfunction 2 =====================
4174
============ Create/rewrite file with long names support. ============
4204
============ Create/rewrite file with long names support. ============
4175
======================================================================
4205
======================================================================
4176
Parameters:
4206
Parameters:
4177
  * eax = 70 - function number
4207
  * eax = 70 - function number
4178
  * ebx = pointer to the information structure
4208
  * ebx = pointer to the information structure
4179
Format of the information structure:
4209
Format of the information structure:
4180
  * +0: dword: 2 = subfunction number
4210
  * +0: dword: 2 = subfunction number
4181
  * +4: dword: 0 (reserved)
4211
  * +4: dword: 0 (reserved)
4182
  * +8: dword: 0 (reserved)
4212
  * +8: dword: 0 (reserved)
4183
  * +12 = +0xC: dword: number of bytes to read
4213
  * +12 = +0xC: dword: number of bytes to read
4184
  * +16 = +0x10: dword: pointer to data
4214
  * +16 = +0x10: dword: pointer to data
4185
  * +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
4186
    given in the general description
4216
    given in the general description
4187
    or
4217
    or
4188
  * +20 = +0x14: db 0
4218
  * +20 = +0x14: db 0
4189
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4219
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4190
Returned value:
4220
Returned value:
4191
  * eax = 0 - success, otherwise file system error code
4221
  * eax = 0 - success, otherwise file system error code
4192
  * ebx = number of written bytes (possibly 0)
4222
  * ebx = number of written bytes (possibly 0)
4193
Remarks:
4223
Remarks:
4194
  * If a file with given name did not exist, it is created;
4224
  * If a file with given name did not exist, it is created;
4195
    if it existed, it is rewritten.
4225
    if it existed, it is rewritten.
4196
  * If there is not enough free space on disk, the function will
4226
  * If there is not enough free space on disk, the function will
4197
    write as many as can and then return error code 8.
4227
    write as many as can and then return error code 8.
4198
  * The function is not supported for CD (returns error code 2).
4228
  * The function is not supported for CD (returns error code 2).
4199
 
4229
 
4200
======================================================================
4230
======================================================================
4201
===================== Function 70, subfunction 3 =====================
4231
===================== Function 70, subfunction 3 =====================
4202
=========== Write to existing file with long names support. ==========
4232
=========== Write to existing file with long names support. ==========
4203
======================================================================
4233
======================================================================
4204
Parameters:
4234
Parameters:
4205
  * eax = 70 - function number
4235
  * eax = 70 - function number
4206
  * ebx = pointer to the information structure
4236
  * ebx = pointer to the information structure
4207
Format of the information structure:
4237
Format of the information structure:
4208
  * +0: dword: 3 = subfunction number
4238
  * +0: dword: 3 = subfunction number
4209
  * +4: dword: file offset (in bytes)
4239
  * +4: dword: file offset (in bytes)
4210
  * +8: dword: high dword of offset (must be 0 for FAT)
4240
  * +8: dword: high dword of offset (must be 0 for FAT)
4211
  * +12 = +0xC: dword: number of bytes to write
4241
  * +12 = +0xC: dword: number of bytes to write
4212
  * +16 = +0x10: dword: pointer to data
4242
  * +16 = +0x10: dword: pointer to data
4213
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4243
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4214
    given in the general description
4244
    given in the general description
4215
    or
4245
    or
4216
  * +20 = +0x14: db 0
4246
  * +20 = +0x14: db 0
4217
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4247
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4218
Returned value:
4248
Returned value:
4219
  * eax = 0 - success, otherwise file system error code
4249
  * eax = 0 - success, otherwise file system error code
4220
  * ebx = number of written bytes (possibly 0)
4250
  * ebx = number of written bytes (possibly 0)
4221
Remarks:
4251
Remarks:
4222
  * The file must already exist, otherwise function returns eax=5.
4252
  * The file must already exist, otherwise function returns eax=5.
4223
  * The only result of write 0 bytes is update in the file attributes
4253
  * The only result of write 0 bytes is update in the file attributes
4224
    date/time of modification and access to the current date/time.
4254
    date/time of modification and access to the current date/time.
4225
  * If beginning and/or ending position is greater than file size
4255
  * If beginning and/or ending position is greater than file size
4226
    (except for the previous case), the file is expanded to needed
4256
    (except for the previous case), the file is expanded to needed
4227
    size with zero characters.
4257
    size with zero characters.
4228
  * The function is not supported for CD (returns error code 2).
4258
  * The function is not supported for CD (returns error code 2).
4229
 
4259
 
4230
======================================================================
4260
======================================================================
4231
============ Function 70, subfunction 4 - set end of file. ===========
4261
============ Function 70, subfunction 4 - set end of file. ===========
4232
======================================================================
4262
======================================================================
4233
Parameters:
4263
Parameters:
4234
  * eax = 70 - function number
4264
  * eax = 70 - function number
4235
  * ebx = pointer to the information structure
4265
  * ebx = pointer to the information structure
4236
Format of the information structure:
4266
Format of the information structure:
4237
  * +0: dword: 4 = subfunction number
4267
  * +0: dword: 4 = subfunction number
4238
  * +4: dword: low dword of new file size
4268
  * +4: dword: low dword of new file size
4239
  * +8: dword: high dword of new file size (must be 0 for FAT)
4269
  * +8: dword: high dword of new file size (must be 0 for FAT)
4240
  * +12 = +0xC: dword: 0 (reserved)
4270
  * +12 = +0xC: dword: 0 (reserved)
4241
  * +16 = +0x10: dword: 0 (reserved)
4271
  * +16 = +0x10: dword: 0 (reserved)
4242
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4272
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4243
    given in the general description
4273
    given in the general description
4244
    or
4274
    or
4245
  * +20 = +0x14: db 0
4275
  * +20 = +0x14: db 0
4246
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4276
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4247
Returned value:
4277
Returned value:
4248
  * eax = 0 - success, otherwise file system error code
4278
  * eax = 0 - success, otherwise file system error code
4249
  * ebx destroyed
4279
  * ebx destroyed
4250
Remarks:
4280
Remarks:
4251
  * If the new file size is less than old one, file is truncated.
4281
  * If the new file size is less than old one, file is truncated.
4252
    If the new size is greater than old one, file is expanded with
4282
    If the new size is greater than old one, file is expanded with
4253
    characters with code 0. If the new size is equal to old one,
4283
    characters with code 0. If the new size is equal to old one,
4254
    the only result of call is set date/time of modification and
4284
    the only result of call is set date/time of modification and
4255
    access to the current date/time.
4285
    access to the current date/time.
4256
  * If there is not enough free space on disk for expansion, the
4286
  * If there is not enough free space on disk for expansion, the
4257
    function will expand to maximum possible size and then return
4287
    function will expand to maximum possible size and then return
4258
    error code 8.
4288
    error code 8.
4259
  * The function is not supported for CD (returns error code 2).
4289
  * The function is not supported for CD (returns error code 2).
4260
 
4290
 
4261
======================================================================
4291
======================================================================
4262
==== Function 70, subfunction 5 - get information on file/folder. ====
4292
==== Function 70, subfunction 5 - get information on file/folder. ====
4263
======================================================================
4293
======================================================================
4264
Parameters:
4294
Parameters:
4265
  * eax = 70 - function number
4295
  * eax = 70 - function number
4266
  * ebx = pointer to the information structure
4296
  * ebx = pointer to the information structure
4267
Format of the information structure:
4297
Format of the information structure:
4268
  * +0: dword: 5 = subfunction number
4298
  * +0: dword: 5 = subfunction number
4269
  * +4: dword: 0 (reserved)
4299
  * +4: dword: 0 (reserved)
4270
  * +8: dword: 0 (reserved)
4300
  * +8: dword: 0 (reserved)
4271
  * +12 = +0xC: dword: 0 (reserved)
4301
  * +12 = +0xC: dword: 0 (reserved)
4272
  * +16 = +0x10: dword: pointer to buffer for data (40 bytes)
4302
  * +16 = +0x10: dword: pointer to buffer for data (40 bytes)
4273
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4303
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4274
    given in the general description
4304
    given in the general description
4275
    or
4305
    or
4276
  * +20 = +0x14: db 0
4306
  * +20 = +0x14: db 0
4277
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4307
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4278
Returned value:
4308
Returned value:
4279
  * eax = 0 - success, otherwise file system error code
4309
  * eax = 0 - success, otherwise file system error code
4280
  * ebx destroyed
4310
  * ebx destroyed
4281
Information on file is returned in the BDFE format (block of data
4311
Information on file is returned in the BDFE format (block of data
4282
for folder entry), explained in the description of
4312
for folder entry), explained in the description of
4283
subfunction 1, but without filename
4313
subfunction 1, but without filename
4284
(i.e. only first 40 = 0x28 bytes).
4314
(i.e. only first 40 = 0x28 bytes).
4285
Remarks:
4315
Remarks:
4286
  * The function does not support virtual folders such as /, /rd and
4316
  * The function does not support virtual folders such as /, /rd and
4287
    root folders like /rd/1.
4317
    root folders like /rd/1.
4288
 
4318
 
4289
======================================================================
4319
======================================================================
4290
===== Function 70, subfunction 6 - set attributes of file/folder. ====
4320
===== Function 70, subfunction 6 - set attributes of file/folder. ====
4291
======================================================================
4321
======================================================================
4292
Parameters:
4322
Parameters:
4293
  * eax = 70 - function number
4323
  * eax = 70 - function number
4294
  * ebx = pointer to the information structure
4324
  * ebx = pointer to the information structure
4295
Format of the information structure:
4325
Format of the information structure:
4296
  * +0: dword: 6 = subfunction number
4326
  * +0: dword: 6 = subfunction number
4297
  * +4: dword: 0 (reserved)
4327
  * +4: dword: 0 (reserved)
4298
  * +8: dword: 0 (reserved)
4328
  * +8: dword: 0 (reserved)
4299
  * +12 = +0xC: dword: 0 (reserved)
4329
  * +12 = +0xC: dword: 0 (reserved)
4300
  * +16 = +0x10: dword: pointer to buffer with attributes (32 bytes)
4330
  * +16 = +0x10: dword: pointer to buffer with attributes (32 bytes)
4301
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4331
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4302
    given in the general description
4332
    given in the general description
4303
    or
4333
    or
4304
  * +20 = +0x14: db 0
4334
  * +20 = +0x14: db 0
4305
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4335
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4306
Returned value:
4336
Returned value:
4307
  * eax = 0 - success, otherwise file system error code
4337
  * eax = 0 - success, otherwise file system error code
4308
  * ebx destroyed
4338
  * ebx destroyed
4309
File attributes are first 32 bytes in BDFE (block of data
4339
File attributes are first 32 bytes in BDFE (block of data
4310
for folder entry), explained in the description of subfunction 1
4340
for folder entry), explained in the description of subfunction 1
4311
(that is, without name and size of file). Attribute
4341
(that is, without name and size of file). Attribute
4312
file/folder/volume label (bits 3,4 in dword +0) is not changed.
4342
file/folder/volume label (bits 3,4 in dword +0) is not changed.
4313
Byte +4 (name format) is ignored.
4343
Byte +4 (name format) is ignored.
4314
Remarks:
4344
Remarks:
4315
  * The function does not support virtual folders such as /, /rd and
4345
  * The function does not support virtual folders such as /, /rd and
4316
    root folders like /rd/1.
4346
    root folders like /rd/1.
4317
  * The function is not supported for CD (returns error code 2).
4347
  * The function is not supported for CD (returns error code 2).
4318
 
4348
 
4319
======================================================================
4349
======================================================================
4320
=========== Function 70, subfunction 7 - start application. ==========
4350
=========== Function 70, subfunction 7 - start application. ==========
4321
======================================================================
4351
======================================================================
4322
Parameters:
4352
Parameters:
4323
  * eax = 70 - function number
4353
  * eax = 70 - function number
4324
  * ebx = pointer to the information structure
4354
  * ebx = pointer to the information structure
4325
Format of the information structure:
4355
Format of the information structure:
4326
  * +0: dword: 7 = subfunction number
4356
  * +0: dword: 7 = subfunction number
4327
  * +4: dword: flags field:
4357
  * +4: dword: flags field:
4328
    * áèò 0: start process as debugged
4358
    * áèò 0: start process as debugged
4329
    * other bits are reserved and must be set to 0
4359
    * other bits are reserved and must be set to 0
4330
  * +8: dword: 0 or pointer to ASCIIZ-string with parameters
4360
  * +8: dword: 0 or pointer to ASCIIZ-string with parameters
4331
  * +12 = +0xC: dword: 0 (reserved)
4361
  * +12 = +0xC: dword: 0 (reserved)
4332
  * +16 = +0x10: dword: 0 (reserved)
4362
  * +16 = +0x10: dword: 0 (reserved)
4333
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4363
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4334
    given in the general description
4364
    given in the general description
4335
    or
4365
    or
4336
  * +20 = +0x14: db 0
4366
  * +20 = +0x14: db 0
4337
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4367
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4338
Returned value:
4368
Returned value:
4339
  * eax > 0 - program is loaded, eax contains PID
4369
  * eax > 0 - program is loaded, eax contains PID
4340
  * eax < 0 - an error has occured, -eax contains
4370
  * eax < 0 - an error has occured, -eax contains
4341
    file system error code
4371
    file system error code
4342
  * ebx destroyed
4372
  * ebx destroyed
4343
Remarks:
4373
Remarks:
4344
  * Command line must be terminated by the character with the code 0
4374
  * Command line must be terminated by the character with the code 0
4345
    (ASCIIZ-string); function takes into account either all characters
4375
    (ASCIIZ-string); function takes into account either all characters
4346
    up to terminating zero inclusively or first 256 character
4376
    up to terminating zero inclusively or first 256 character
4347
    regarding what is less.
4377
    regarding what is less.
4348
  * If the process is started as debugged, it is created in
4378
  * If the process is started as debugged, it is created in
4349
    the suspended state; to run use subfunction 5 of function 69.
4379
    the suspended state; to run use subfunction 5 of function 69.
4350
 
4380
 
4351
======================================================================
4381
======================================================================
4352
========== Function 70, subfunction 8 - delete file/folder. ==========
4382
========== Function 70, subfunction 8 - delete file/folder. ==========
4353
======================================================================
4383
======================================================================
4354
Parameters:
4384
Parameters:
4355
  * eax = 70 - function number
4385
  * eax = 70 - function number
4356
  * ebx = pointer to the information structure
4386
  * ebx = pointer to the information structure
4357
Format of the information structure:
4387
Format of the information structure:
4358
  * +0: dword: 8 = subfunction number
4388
  * +0: dword: 8 = subfunction number
4359
  * +4: dword: 0 (reserved)
4389
  * +4: dword: 0 (reserved)
4360
  * +8: dword: 0 (reserved)
4390
  * +8: dword: 0 (reserved)
4361
  * +12 = +0xC: dword: 0 (reserved)
4391
  * +12 = +0xC: dword: 0 (reserved)
4362
  * +16 = +0x10: dword: 0 (reserved)
4392
  * +16 = +0x10: dword: 0 (reserved)
4363
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4393
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4364
    given in the general description
4394
    given in the general description
4365
    or
4395
    or
4366
  * +20 = +0x14: db 0
4396
  * +20 = +0x14: db 0
4367
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4397
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4368
Returned value:
4398
Returned value:
4369
  * eax = 0 - success, otherwise file system error code
4399
  * eax = 0 - success, otherwise file system error code
4370
  * ebx destroyed
4400
  * ebx destroyed
4371
Remarks:
4401
Remarks:
4372
  * The function is not supported for CD (returns error code 2).
4402
  * The function is not supported for CD (returns error code 2).
4373
  * The function can delete only empty folders (attempt to delete
4403
  * The function can delete only empty folders (attempt to delete
4374
    nonempty folder results in error with code 10, "access denied").
4404
    nonempty folder results in error with code 10, "access denied").
4375
 
4405
 
4376
======================================================================
4406
======================================================================
4377
============= Function 70, subfunction 9 - create folder. ============
4407
============= Function 70, subfunction 9 - create folder. ============
4378
======================================================================
4408
======================================================================
4379
Parameters:
4409
Parameters:
4380
  * eax = 70 - function number
4410
  * eax = 70 - function number
4381
  * ebx = pointer to the information structure
4411
  * ebx = pointer to the information structure
4382
Format of the information structure:
4412
Format of the information structure:
4383
  * +0: dword: 9 = subfunction number
4413
  * +0: dword: 9 = subfunction number
4384
  * +4: dword: 0 (reserved)
4414
  * +4: dword: 0 (reserved)
4385
  * +8: dword: 0 (reserved)
4415
  * +8: dword: 0 (reserved)
4386
  * +12 = +0xC: dword: 0 (reserved)
4416
  * +12 = +0xC: dword: 0 (reserved)
4387
  * +16 = +0x10: dword: 0 (reserved)
4417
  * +16 = +0x10: dword: 0 (reserved)
4388
  * +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
4418
  * +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
4389
    given in the general description
4419
    given in the general description
4390
    or
4420
    or
4391
  * +20 = +0x14: db 0
4421
  * +20 = +0x14: db 0
4392
  * +21 = +0x15: dd pointer to ASCIIZ-string with folder name
4422
  * +21 = +0x15: dd pointer to ASCIIZ-string with folder name
4393
Returned value:
4423
Returned value:
4394
  * eax = 0 - success, otherwise file system error code
4424
  * eax = 0 - success, otherwise file system error code
4395
  * ebx destroyed
4425
  * ebx destroyed
4396
Remarks:
4426
Remarks:
4397
  * The function is not supported for CD (returns error code 2).
4427
  * The function is not supported for CD (returns error code 2).
4398
  * The parent folder must already exist.
4428
  * The parent folder must already exist.
4399
  * If target folder already exists, function returns success (eax=0).
4429
  * If target folder already exists, function returns success (eax=0).
4400
 
4430
 
4401
======================================================================
4431
======================================================================
4402
========== Function 71, subfunction 1 - set window caption. ==========
4432
========== Function 71, subfunction 1 - set window caption. ==========
4403
======================================================================
4433
======================================================================
4404
Parameters:
4434
Parameters:
4405
  * eax = 71 - function number
4435
  * eax = 71 - function number
4406
  * ebx = 1 - subfunction number
4436
  * ebx = 1 - subfunction number
4407
  * ecx = pointer to caption string
4437
  * ecx = pointer to caption string
4408
Returned value:
4438
Returned value:
4409
  * function does not return value
4439
  * function does not return value
4410
Remarks:
4440
Remarks:
4411
  * String must be in the ASCIIZ-format. Disregarding real string
4441
  * String must be in the ASCIIZ-format. Disregarding real string
4412
    length, no more than 255 characters are drawn.
4442
    length, no more than 255 characters are drawn.
4413
  * Pass NULL in ecx to remove caption.
4443
  * Pass NULL in ecx to remove caption.
4414
 
4444
 
4415
======================================================================
4445
======================================================================
4416
=============== Function -1 - terminate thread/process ===============
4446
=============== Function -1 - terminate thread/process ===============
4417
======================================================================
4447
======================================================================
4418
Parameters:
4448
Parameters:
4419
  * eax = -1 - function number
4449
  * eax = -1 - function number
4420
Returned value:
4450
Returned value:
4421
  * function does not return neither value nor control
4451
  * function does not return neither value nor control
4422
Remarks:
4452
Remarks:
4423
  * If the process did not create threads obviously, it has only
4453
  * If the process did not create threads obviously, it has only
4424
    one thread, which termination results in process termination.
4454
    one thread, which termination results in process termination.
4425
  * If the current thread is last in the process, its termination
4455
  * If the current thread is last in the process, its termination
4426
    also results in process terminates.
4456
    also results in process terminates.
4427
  * This function terminates the current thread. Other thread can be
4457
  * This function terminates the current thread. Other thread can be
4428
    killed by call to subfunction 2 of function 18.
4458
    killed by call to subfunction 2 of function 18.
4429
 
4459
 
4430
======================================================================
4460
======================================================================
4431
=========================== List of events ===========================
4461
=========================== List of events ===========================
4432
======================================================================
4462
======================================================================
4433
Next event can be retrieved by the call of one from functions 10
4463
Next event can be retrieved by the call of one from functions 10
4434
(to wait for event), 11 (to check without waiting), 23
4464
(to wait for event), 11 (to check without waiting), 23
4435
(to wait during the given time).
4465
(to wait during the given time).
4436
These functions return only those events, which enter into a mask set
4466
These functions return only those events, which enter into a mask set
4437
by function 40. By default it is first three,
4467
by function 40. By default it is first three,
4438
there is enough for most applications.
4468
there is enough for most applications.
4439
Codes of events:
4469
Codes of events:
4440
  * 1 = redraw event (is reset by call to function 0)
4470
  * 1 = redraw event (is reset by call to function 0)
4441
  * 2 = key on keyboard is pressed (acts, only when the window is
4471
  * 2 = key on keyboard is pressed (acts, only when the window is
4442
    active) or hotkey is pressed; is reset, when all keys from
4472
    active) or hotkey is pressed; is reset, when all keys from
4443
    the buffer are read out by function 2
4473
    the buffer are read out by function 2
4444
  * 3 = button is pressed, defined earlier by function 8
4474
  * 3 = button is pressed, defined earlier by function 8
4445
    (or close button, created implicitly by function 0;
4475
    (or close button, created implicitly by function 0;
4446
    minimize button is handled by the system and sends no message;
4476
    minimize button is handled by the system and sends no message;
4447
    acts, only when the window is active;
4477
    acts, only when the window is active;
4448
    is reset when all buttons from the buffer
4478
    is reset when all buttons from the buffer
4449
    are read out by function 17)
4479
    are read out by function 17)
4450
  * 4 = reserved (in current implementation never comes even after
4480
  * 4 = reserved (in current implementation never comes even after
4451
    unmasking by function 40)
4481
    unmasking by function 40)
4452
  * 5 = the desktop background is redrawed (is reset automatically
4482
  * 5 = the desktop background is redrawed (is reset automatically
4453
    after redraw, so if in redraw time program does not wait and
4483
    after redraw, so if in redraw time program does not wait and
4454
    does not check events, it will not remark this event)
4484
    does not check events, it will not remark this event)
4455
  * 6 = mouse event (something happened - button pressing or moving;
4485
  * 6 = mouse event (something happened - button pressing or moving;
4456
    is reset at reading)
4486
    is reset at reading)
4457
  * 7 = IPC event (see function 60 -
4487
  * 7 = IPC event (see function 60 -
4458
    Inter Process Communication; is reset at reading)
4488
    Inter Process Communication; is reset at reading)
4459
  * 8 = network event (is reset at reading)
4489
  * 8 = network event (is reset at reading)
4460
  * 9 = debug event (is reset at reading; see
4490
  * 9 = debug event (is reset at reading; see
4461
    debug subsystem)
4491
    debug subsystem)
4462
  * 16..31 = event with appropriate IRQ
4492
  * 16..31 = event with appropriate IRQ
4463
    (16=IRQ0, 31=IRQ15) (is reset after reading all IRQ data)
4493
    (16=IRQ0, 31=IRQ15) (is reset after reading all IRQ data)
4464
 
4494
 
4465
======================================================================
4495
======================================================================
4466
=================== Error codes of the file system ===================
4496
=================== Error codes of the file system ===================
4467
======================================================================
4497
======================================================================
4468
  * 0 = success
4498
  * 0 = success
4469
  * 1 = base and/or partition of a hard disk is not defined
4499
  * 1 = base and/or partition of a hard disk is not defined
4470
    (by subfunctions 7, 8 of function 21)
4500
    (by subfunctions 7, 8 of function 21)
4471
  * 2 = function is not supported for the given file system
4501
  * 2 = function is not supported for the given file system
4472
  * 3 = unknown file system
4502
  * 3 = unknown file system
4473
  * 4 = reserved, is never returned in the current implementation
4503
  * 4 = reserved, is never returned in the current implementation
4474
  * 5 = file not found
4504
  * 5 = file not found
4475
  * 6 = end of file, EOF
4505
  * 6 = end of file, EOF
4476
  * 7 = pointer lies outside of application memory
4506
  * 7 = pointer lies outside of application memory
4477
  * 8 = disk is full
4507
  * 8 = disk is full
4478
  * 9 = FAT table is destroyed
4508
  * 9 = FAT table is destroyed
4479
  * 10 = access denied
4509
  * 10 = access denied
4480
  * 11 = device error
4510
  * 11 = device error
4481
Application start functions can return also following errors:
4511
Application start functions can return also following errors:
4482
  * 30 = 0x1E = not enough memory
4512
  * 30 = 0x1E = not enough memory
4483
  * 31 = 0x1F = file is not executable
4513
  * 31 = 0x1F = file is not executable
4484
  * 32 = 0x20 = too many processes
4514
  * 32 = 0x20 = too many processes
4485
>
4515
>
4486
>
4516
>
4487
>
4517
>
4488
>
4518
>