Subversion Repositories Kolibri OS

Rev

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

Rev 314 Rev 321
1
SYSTEM FUNCTIONS of OS Kolibri 0.6.4.0
1
SYSTEM FUNCTIONS of OS Kolibri 0.6.4.0
2
 
2
 
3
Number of the function is located in the register eax.
3
Number of the function is located in the register eax.
4
The call of the system function is executed by "int 0x40" command.
4
The call of the system function is executed by "int 0x40" command.
5
All registers except explicitly declared in the returned value,
5
All registers except explicitly declared in the returned value,
6
    including eflags, are preserved.
6
    including eflags, are preserved.
7
 
7
 
8
 
8
 
9
======================================================================
9
======================================================================
10
============== Function 0 - define and draw the window. ==============
10
============== Function 0 - define and draw the window. ==============
11
======================================================================
11
======================================================================
12
Defines an application window. Draws a frame of the window, header and
12
Defines an application window. Draws a frame of the window, header and
13
working area. For skinned windows defines standard close and minimize
13
working area. For skinned windows defines standard close and minimize
14
buttons.
14
buttons.
15
Parameters:
15
Parameters:
16
  * eax = 0 - function number
16
  * eax = 0 - function number
17
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
17
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
18
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
18
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
19
  * edx = 0xXYRRGGBB, where:
19
  * edx = 0xXYRRGGBB, where:
20
    * Y = style of the window:
20
    * Y = style of the window:
21
      * Y=0 - type I - fixed-size window
21
      * Y=0 - type I - fixed-size window
22
      * Y=1 - only define window area, draw nothing
22
      * Y=1 - only define window area, draw nothing
23
      * Y=2 - type II - variable-size window
23
      * Y=2 - type II - variable-size window
24
      * Y=3 - skinned window
24
      * Y=3 - skinned window
25
      * other possible values (from 4 up to 15) are reserved,
25
      * other possible values (from 4 up to 15) are reserved,
26
        function call with such Y is ignored
26
        function call with such Y is ignored
27
    * RR, GG, BB = accordingly red, green, blue components of a color
27
    * RR, GG, BB = accordingly red, green, blue components of a color
28
      of the working area of the window (are ignored for style Y=2)
28
      of the working area of the window (are ignored for style Y=2)
29
    * X = DCBA (bits)
29
    * X = DCBA (bits)
30
      * A = 1 - window has caption; for style Y=3 caption string
30
      * A = 1 - window has caption; for style Y=3 caption string
31
                  must be passed in edi, for other styles use
31
                  must be passed in edi, for other styles use
32
                  subfunction 1 of function 71
32
                  subfunction 1 of function 71
33
      * B = 1 - coordinates of all graphics primitives are relative to
33
      * B = 1 - coordinates of all graphics primitives are relative to
34
                  window client area
34
                  window client area
35
      * C = 1 - don't fill working area on window draw
35
      * C = 1 - don't fill working area on window draw
36
      * D = 0 - normal filling of the working area, 1 - gradient
36
      * D = 0 - normal filling of the working area, 1 - gradient
37
    The following parameters are intended for windows
37
    The following parameters are intended for windows
38
    of a type I and II, and ignored for styles Y=1,3:
38
    of a type I and II, and ignored for styles Y=1,3:
39
  * esi = 0xXYRRGGBB - color of the header
39
  * esi = 0xXYRRGGBB - color of the header
40
    * RR, GG, BB define color
40
    * RR, GG, BB define color
41
    * Y=0 - usual window, Y=1 - unmovable window
41
    * Y=0 - usual window, Y=1 - unmovable window
42
    * X defines a gradient of header: X=0 - no gradient,
42
    * X defines a gradient of header: X=0 - no gradient,
43
      X=8 - usual gradient,
43
      X=8 - usual gradient,
44
      for windows of a type II X=4 - negative gradient
44
      for windows of a type II X=4 - negative gradient
45
    * other values of X and Y are reserved
45
    * other values of X and Y are reserved
46
  * edi = 0x00RRGGBB - color of the frame
46
  * edi = 0x00RRGGBB - color of the frame
47
Returned value:
47
Returned value:
48
  * function does not return value
48
  * function does not return value
49
Remarks:
49
Remarks:
50
  * Position and sizes of the window are installed by the first
50
  * Position and sizes of the window are installed by the first
51
    call of this function and are ignored at subsequent; to change
51
    call of this function and are ignored at subsequent; to change
52
    position and/or sizes of already created window use function 67.
52
    position and/or sizes of already created window use function 67.
53
  * For windows with style Y=3 and caption (A=1) caption string is set
53
  * For windows with style Y=3 and caption (A=1) caption string is set
54
    by the first call of this function and is ignored at subsequent
54
    by the first call of this function and is ignored at subsequent
55
    (strictly speaking, is ignored after a call to subfunction 2
55
    (strictly speaking, is ignored after a call to subfunction 2
56
    of function 12 - end redraw); to change caption of already created
56
    of function 12 - end redraw); to change caption of already created
57
    window use subfunction 1 of function 71.
57
    window use subfunction 1 of function 71.
58
  * If the window has appropriate styles, position and/or sizes can be
58
  * If the window has appropriate styles, position and/or sizes can be
59
    changed by user. Current position and sizes can be obtained
59
    changed by user. Current position and sizes can be obtained
60
    by function 9.
60
    by function 9.
61
  * The window must fit on the screen. If the transferred
61
  * The window must fit on the screen. If the transferred
62
    coordinates and sizes do not satisfy to this condition,
62
    coordinates and sizes do not satisfy to this condition,
63
    appropriate coordinate (or, probably, both) is considered as zero,
63
    appropriate coordinate (or, probably, both) is considered as zero,
64
    and if it does not help too, the appropriate size
64
    and if it does not help too, the appropriate size
65
    (or, probably, both) is installed in a size of the screen.
65
    (or, probably, both) is installed in a size of the screen.
66
    
66
    
67
    Further let us designate xpos,ypos,xsize,ysize - values passed
67
    Further let us designate xpos,ypos,xsize,ysize - values passed
68
    in ebx,ecx. The coordinates are resulted concerning
68
    in ebx,ecx. The coordinates are resulted concerning
69
    the left upper corner of the window, which, thus, is set as (0,0),
69
    the left upper corner of the window, which, thus, is set as (0,0),
70
    coordinates of the right lower corner essence (xsize,ysize).
70
    coordinates of the right lower corner essence (xsize,ysize).
71
  * The sizes of the window are understood in sence of coordinates
71
  * The sizes of the window are understood in sence of coordinates
72
    of the right lower corner. This concerns all other functions too.
72
    of the right lower corner. This concerns all other functions too.
73
    It means, that the real sizes are on 1 pixel more.
73
    It means, that the real sizes are on 1 pixel more.
74
  * The window of type I looks as follows:
74
  * The window of type I looks as follows:
75
    * draw external frame of color indicated in edi, 1 pixel in width
75
    * draw external frame of color indicated in edi, 1 pixel in width
76
    * draw header - rectangle with the left upper corner (1,1) and
76
    * draw header - rectangle with the left upper corner (1,1) and
77
      right lower (xsize-1,min(25,ysize)) color indicated in esi
77
      right lower (xsize-1,min(25,ysize)) color indicated in esi
78
      (taking a gradient into account)
78
      (taking a gradient into account)
79
    * if ysize>=26, fill the working area of the window -
79
    * if ysize>=26, fill the working area of the window -
80
      rectangle with the left upper corner (1,21) and right lower
80
      rectangle with the left upper corner (1,21) and right lower
81
      (xsize-1,ysize-1) (sizes (xsize-1)*(ysize-21)) with color
81
      (xsize-1,ysize-1) (sizes (xsize-1)*(ysize-21)) with color
82
      indicated in edx (taking a gradient into account)
82
      indicated in edx (taking a gradient into account)
83
    * if A=1 and caption has been already set by subfunction 1
83
    * if A=1 and caption has been already set by subfunction 1
84
      of function 71, it is drawn in the corresponding place of header
84
      of function 71, it is drawn in the corresponding place of header
85
  * The window of style Y=1 looks as follows:
85
  * The window of style Y=1 looks as follows:
86
    * completely defined by the application
86
    * completely defined by the application
87
  * The window of type II looks as follows:
87
  * The window of type II looks as follows:
88
    * draw external frame of width 1 pixel with the "shaded" color
88
    * draw external frame of width 1 pixel with the "shaded" color
89
      edi (all components of the color decrease twice)
89
      edi (all components of the color decrease twice)
90
    * draw intermediate frame of width 3 pixels with color edi
90
    * draw intermediate frame of width 3 pixels with color edi
91
    * draw internal frame of width 1 pixel with the "shaded" color edi
91
    * draw internal frame of width 1 pixel with the "shaded" color edi
92
    * draw header - rectangle with the left upper corner (4,4)
92
    * draw header - rectangle with the left upper corner (4,4)
93
      and right lower (xsize-4,min(20,ysize)) color, indicated in esi
93
      and right lower (xsize-4,min(20,ysize)) color, indicated in esi
94
      (taking a gradient into account)
94
      (taking a gradient into account)
95
    * if ysize>=26, fill the working area of the window -
95
    * if ysize>=26, fill the working area of the window -
96
      rectangle with the left upper corner (5,20) and right lower
96
      rectangle with the left upper corner (5,20) and right lower
97
      (xsize-5,ysize-5) with color indicated in edx
97
      (xsize-5,ysize-5) with color indicated in edx
98
      (taking a gradient into account)
98
      (taking a gradient into account)
99
    * if A=1 and caption has been already set by subfunction 1
99
    * if A=1 and caption has been already set by subfunction 1
100
      of function 71, it is drawn in the corresponding place of header
100
      of function 71, it is drawn in the corresponding place of header
101
  * The skinned window looks as follows:
101
  * The skinned window looks as follows:
102
    * draw external frame of width 1 pixel
102
    * draw external frame of width 1 pixel
103
      with color 'outer' from the skin
103
      with color 'outer' from the skin
104
    * draw intermediate frame of width 3 pixel
104
    * draw intermediate frame of width 3 pixel
105
      with color 'frame' from the skin
105
      with color 'frame' from the skin
106
    * draw internal frame of width 1 pixel
106
    * draw internal frame of width 1 pixel
107
      with color 'inner' from the skin
107
      with color 'inner' from the skin
108
    * draw header (on bitmaps from the skin) in a rectangle
108
    * draw header (on bitmaps from the skin) in a rectangle
109
      (0,0) - (xsize,_skinh-1)
109
      (0,0) - (xsize,_skinh-1)
110
    * if ysize>=26, fill the working area of the window -
110
    * if ysize>=26, fill the working area of the window -
111
      rectangle with the left upper corner (5,_skinh) and right lower
111
      rectangle with the left upper corner (5,_skinh) and right lower
112
      (xsize-5,ysize-5) with color indicated in edx
112
      (xsize-5,ysize-5) with color indicated in edx
113
      (taking a gradient into account)
113
      (taking a gradient into account)
114
    * define two standard buttons: close and minimize
114
    * define two standard buttons: close and minimize
115
      (see function 8)
115
      (see function 8)
116
    * if A=1 and edi contains (nonzero) pointer to caption string,
116
    * if A=1 and edi contains (nonzero) pointer to caption string,
117
      it is drawn in place in header defined in the skin
117
      it is drawn in place in header defined in the skin
118
    * value _skinh is accessible as the result of call
118
    * value _skinh is accessible as the result of call
119
      subfunction 4 of function 48
119
      subfunction 4 of function 48
120
 
120
 
121
======================================================================
121
======================================================================
122
================ Function 1 - put pixel in the window. ===============
122
================ Function 1 - put pixel in the window. ===============
123
======================================================================
123
======================================================================
124
Parameters:
124
Parameters:
125
  * eax = 1 - function number
125
  * eax = 1 - function number
126
  * ebx = x-coordinate (relative to the window)
126
  * ebx = x-coordinate (relative to the window)
127
  * ecx = y-coordinate (relative to the window)
127
  * ecx = y-coordinate (relative to the window)
128
  * edx = 0x00RRGGBB - color of a pixel
128
  * edx = 0x00RRGGBB - color of a pixel
129
    edx = 0x01xxxxxx - invert color of a pixel
129
    edx = 0x01xxxxxx - invert color of a pixel
130
          (low 24 bits are ignored)
130
          (low 24 bits are ignored)
131
Returned value:
131
Returned value:
132
  * function does not return value
132
  * function does not return value
133
 
133
 
134
======================================================================
134
======================================================================
135
============ Function 2 - get the code of the pressed key. ===========
135
============ Function 2 - get the code of the pressed key. ===========
136
======================================================================
136
======================================================================
137
Takes away the code of the pressed key from the buffer.
137
Takes away the code of the pressed key from the buffer.
138
Parameters:
138
Parameters:
139
  * eax = 2 - function number
139
  * eax = 2 - function number
140
Returned value:
140
Returned value:
141
  * if the buffer is empty, function returns eax=1
141
  * if the buffer is empty, function returns eax=1
142
  * if the buffer is not empty, function returns al=0,
142
  * if the buffer is not empty, function returns al=0,
143
    ah=code of the pressed key, high word of eax is zero
143
    ah=code of the pressed key, high word of eax is zero
144
  * if there is "hotkey", function returns al=2,
144
  * if there is "hotkey", function returns al=2,
145
    ah=scancode of the pressed key (0 for control keys),
145
    ah=scancode of the pressed key (0 for control keys),
146
    high word of eax contains a status of control keys at the moment
146
    high word of eax contains a status of control keys at the moment
147
    of pressing a hotkey
147
    of pressing a hotkey
148
Remarks:
148
Remarks:
149
  * There is a common system buffer of the pressed keys
149
  * There is a common system buffer of the pressed keys
150
    by a size of 120 bytes, organized as queue.
150
    by a size of 120 bytes, organized as queue.
151
  * There is one more common system buffer on 120 "hotkeys".
151
  * There is one more common system buffer on 120 "hotkeys".
152
  * If the application with the inactive window calls this function,
152
  * If the application with the inactive window calls this function,
153
    the buffer of the pressed keys is considered to be empty.
153
    the buffer of the pressed keys is considered to be empty.
154
  * By default this function returns ASCII-codes; to switch
154
  * By default this function returns ASCII-codes; to switch
155
    to the scancodes mode (and back) use function 66.
155
    to the scancodes mode (and back) use function 66.
156
    However, hotkeys are always notificated as scancodes.
156
    However, hotkeys are always notificated as scancodes.
157
  * To find out, what keys correspond to what codes, start
157
  * To find out, what keys correspond to what codes, start
158
    the application keyascii and scancode.
158
    the application keyascii and scancode.
159
  * Scancodes come directly from keyboard and are fixed;
159
  * Scancodes come directly from keyboard and are fixed;
160
    ASCII-codes turn out with usage of the conversion tables,
160
    ASCII-codes turn out with usage of the conversion tables,
161
    which can be set by subfunction 2 of function 21
161
    which can be set by subfunction 2 of function 21
162
    and get by subfunction 2 of function 26.
162
    and get by subfunction 2 of function 26.
163
  * As a consequence, ASCII-codes take into account current
163
  * As a consequence, ASCII-codes take into account current
164
    keyboard layout (rus/en) as opposed to scancodes.
164
    keyboard layout (rus/en) as opposed to scancodes.
165
  * This function notifies only about those hotkeys, which were
165
  * This function notifies only about those hotkeys, which were
166
    defined by this thread by subfunction 4 of function 66.
166
    defined by this thread by subfunction 4 of function 66.
167
 
167
 
168
======================================================================
168
======================================================================
169
==================== Function 3 - get system time. ===================
169
==================== Function 3 - get system time. ===================
170
======================================================================
170
======================================================================
171
Parameters:
171
Parameters:
172
  * eax = 3 - function number
172
  * eax = 3 - function number
173
Returned value:
173
Returned value:
174
  * eax = 0x00SSMMHH, where HH:MM:SS = Hours:Minutes:Seconds
174
  * eax = 0x00SSMMHH, where HH:MM:SS = Hours:Minutes:Seconds
175
  * each item is BCD-number, for example,
175
  * each item is BCD-number, for example,
176
    for time 23:59:59 function returns 0x00595923
176
    for time 23:59:59 function returns 0x00595923
177
Remarks:
177
Remarks:
178
  * See also subfunction 9 of function 26 - get time from
178
  * See also subfunction 9 of function 26 - get time from
179
    the moment of start of the system; it is more convenient, because
179
    the moment of start of the system; it is more convenient, because
180
    returns simply DWORD-value of the time counter.
180
    returns simply DWORD-value of the time counter.
181
  * System time can be set by function 22.
181
  * System time can be set by function 22.
182
 
182
 
183
======================================================================
183
======================================================================
184
============ Function 4 - draw text string in the window. ============
184
============ Function 4 - draw text string in the window. ============
185
======================================================================
185
======================================================================
186
Parameters:
186
Parameters:
187
  * eax = 4 - function number
187
  * eax = 4 - function number
188
  * ebx = [coordinate on axis x]*65536 + [coordinate on axis y]
188
  * ebx = [coordinate on axis x]*65536 + [coordinate on axis y]
189
  * ecx = 0xX0RRGGBB, where
189
  * ecx = 0xX0RRGGBB, where
190
    * RR, GG, BB specify text color
190
    * RR, GG, BB specify text color
191
    * X=ABnn (bits):
191
    * X=ABnn (bits):
192
    * nn specifies the used font: 0=system monospaced,
192
    * nn specifies the used font: 0=system monospaced,
193
      1=system font of variable width
193
      1=system font of variable width
194
    * A=0 - output esi characters, A=1 - output ASCIIZ-string
194
    * A=0 - output esi characters, A=1 - output ASCIIZ-string
195
    * B=1 - fill background with the color edi
195
    * B=1 - fill background with the color edi
196
  * edx = pointer to the beginning of the string
196
  * edx = pointer to the beginning of the string
197
  * esi = for A=0 length of the string, must not exceed 255;
197
  * esi = for A=0 length of the string, must not exceed 255;
198
          for A=1 is ignored
198
          for A=1 is ignored
199
Returned value:
199
Returned value:
200
  * function does not return value
200
  * function does not return value
201
Remarks:
201
Remarks:
202
  * First system font is read out at loading from the file char.mt,
202
  * First system font is read out at loading from the file char.mt,
203
    second - from char2.mt.
203
    second - from char2.mt.
204
  * Both fonts have height 9 pixels, width of the monospaced font
204
  * Both fonts have height 9 pixels, width of the monospaced font
205
    is equal to 6 pixels.
205
    is equal to 6 pixels.
206
 
206
 
207
======================================================================
207
======================================================================
208
========================= Function 5 - delay. ========================
208
========================= Function 5 - delay. ========================
209
======================================================================
209
======================================================================
210
Delays execution of the program on the given time.
210
Delays execution of the program on the given time.
211
Parameters:
211
Parameters:
212
  * eax = 5 - function number
212
  * eax = 5 - function number
213
  * ebx = time in the 1/100 of second
213
  * ebx = time in the 1/100 of second
214
Returned value:
214
Returned value:
215
  * function does not return value
215
  * function does not return value
216
Remarks:
216
Remarks:
217
  * Passing ebx=0 does not transfer control to the next process
217
  * Passing ebx=0 does not transfer control to the next process
218
    and does not make any operations at all. If it is really required
218
    and does not make any operations at all. If it is really required
219
    to transfer control to the next process (to complete a current
219
    to transfer control to the next process (to complete a current
220
    time slice), use subfunction 1 of function 68.
220
    time slice), use subfunction 1 of function 68.
221
  * At current implementation there will be an immediate return from
221
  * At current implementation there will be an immediate return from
222
    the function, if the addition of ebx with current value of
222
    the function, if the addition of ebx with current value of
223
    time counter will call 32-bit overflow.
223
    time counter will call 32-bit overflow.
224
 
224
 
225
======================================================================
225
======================================================================
226
============== Function 6 - read the file from ramdisk. ==============
226
============== Function 6 - read the file from ramdisk. ==============
227
======================================================================
227
======================================================================
228
Parameters:
228
Parameters:
229
  * eax = 6 - function number
229
  * eax = 6 - function number
230
  * ebx = pointer to the filename
230
  * ebx = pointer to the filename
231
  * ecx = number of start block, beginning from 1;
231
  * ecx = number of start block, beginning from 1;
232
    ecx=0 - read from the beginning of the file (same as ecx=1)
232
    ecx=0 - read from the beginning of the file (same as ecx=1)
233
  * edx = number of blocks to read;
233
  * edx = number of blocks to read;
234
    edx=0 - read one block (same as edx=1)
234
    edx=0 - read one block (same as edx=1)
235
  * esi = pointer to memory area for the data
235
  * esi = pointer to memory area for the data
236
Returned value:
236
Returned value:
237
  * eax = file size in bytes, if the file was successfully read
237
  * eax = file size in bytes, if the file was successfully read
238
  * eax = -1, if the file was not found
238
  * eax = -1, if the file was not found
239
Remarks:
239
Remarks:
240
  * This function is out-of-date; function 70 allows
240
  * This function is out-of-date; function 70 allows
241
    to fulfil the same operations with the extended possibilities.
241
    to fulfil the same operations with the extended possibilities.
242
  * Block = 512 bytes.
242
  * Block = 512 bytes.
243
  * For reading all file you can specify the certainly large value
243
  * For reading all file you can specify the certainly large value
244
    in edx, for example, edx = -1; but in this case be ready that
244
    in edx, for example, edx = -1; but in this case be ready that
245
    the program will "fall", if the file will appear too large and can
245
    the program will "fall", if the file will appear too large and can
246
    not be placed in the program memory.
246
    not be placed in the program memory.
247
  * The filename must be either in the format 8+3 characters
247
  * The filename must be either in the format 8+3 characters
248
    (first 8 characters - name itself, last 3 - extension,
248
    (first 8 characters - name itself, last 3 - extension,
249
    the short names and extensions are supplemented with spaces),
249
    the short names and extensions are supplemented with spaces),
250
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
250
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
251
    (name no more than 8 characters, dot, extension 3 characters
251
    (name no more than 8 characters, dot, extension 3 characters
252
    supplemented if necessary by spaces).
252
    supplemented if necessary by spaces).
253
    The filename must be written with capital letters. The terminating
253
    The filename must be written with capital letters. The terminating
254
    character with code 0 is not necessary (not ASCIIZ-string).
254
    character with code 0 is not necessary (not ASCIIZ-string).
255
  * This function does not support folders on the ramdisk.
255
  * This function does not support folders on the ramdisk.
256
 
256
 
257
======================================================================
257
======================================================================
258
=============== Function 7 - draw image in the window. ===============
258
=============== Function 7 - draw image in the window. ===============
259
======================================================================
259
======================================================================
260
Paramters:
260
Paramters:
261
  * eax = 7 - function number
261
  * eax = 7 - function number
262
  * ebx = pointer to the image in the format BBGGRRBBGGRR...
262
  * ebx = pointer to the image in the format BBGGRRBBGGRR...
263
  * ecx = [size on axis x]*65536 + [size on axis y]
263
  * ecx = [size on axis x]*65536 + [size on axis y]
264
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
264
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
265
Returned value:
265
Returned value:
266
  * function does not return value
266
  * function does not return value
267
Remarks:
267
Remarks:
268
  * Coordinates of the image are coordinates of the upper left corner
268
  * Coordinates of the image are coordinates of the upper left corner
269
    of the image relative to the window.
269
    of the image relative to the window.
270
  * Size of the image in bytes is 3*xsize*ysize.
270
  * Size of the image in bytes is 3*xsize*ysize.
271
 
271
 
272
======================================================================
272
======================================================================
273
=============== Function 8 - define/delete the button. ===============
273
=============== Function 8 - define/delete the button. ===============
274
======================================================================
274
======================================================================
275
Parameters for button definition:
275
Parameters for button definition:
276
  * eax = 8 - function number
276
  * eax = 8 - function number
277
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
277
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
278
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
278
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
279
  * edx = 0xXYnnnnnn, where:
279
  * edx = 0xXYnnnnnn, where:
280
    * nnnnnn = identifier of the button
280
    * nnnnnn = identifier of the button
281
    * high (31st) bit of edx is cleared
281
    * high (31st) bit of edx is cleared
282
    * if 30th bit of edx is set - do not draw the button
282
    * if 30th bit of edx is set - do not draw the button
283
    * if 29th bit of edx is set - do not draw a frame
283
    * if 29th bit of edx is set - do not draw a frame
284
      at pressing the button
284
      at pressing the button
285
  * esi = 0x00RRGGBB - color of the button
285
  * esi = 0x00RRGGBB - color of the button
286
Parameters for button deleting:
286
Parameters for button deleting:
287
  * eax = 8 - function number
287
  * eax = 8 - function number
288
  * edx = 0x80nnnnnn, where nnnnnn - identifier of the button
288
  * edx = 0x80nnnnnn, where nnnnnn - identifier of the button
289
Returned value:
289
Returned value:
290
  * function does not return value
290
  * function does not return value
291
Remarks:
291
Remarks:
292
  * Sizes of the button must be more than 0 and less than 0x8000.
292
  * Sizes of the button must be more than 0 and less than 0x8000.
293
  * For skinned windows definition of the window
293
  * For skinned windows definition of the window
294
    (call of 0th function) creates two standard buttons -
294
    (call of 0th function) creates two standard buttons -
295
    for close of the window with identifier 1 and
295
    for close of the window with identifier 1 and
296
    for minimize of the window with identifier 0xffff.
296
    for minimize of the window with identifier 0xffff.
297
  * The creation of two buttons with same identifiers is admitted.
297
  * The creation of two buttons with same identifiers is admitted.
298
  * The button with the identifier 0xffff at pressing is interpreted
298
  * The button with the identifier 0xffff at pressing is interpreted
299
    by the system as the button of minimization, the system handles
299
    by the system as the button of minimization, the system handles
300
    such pressing independently, not accessing to the application.
300
    such pressing independently, not accessing to the application.
301
    In rest it is usual button.
301
    In rest it is usual button.
302
  * Total number of buttons for all applications is limited to 4095.
302
  * Total number of buttons for all applications is limited to 4095.
303
 
303
 
304
======================================================================
304
======================================================================
305
============ Function 9 - information on execution thread. ===========
305
============ Function 9 - information on execution thread. ===========
306
======================================================================
306
======================================================================
307
Parameters:
307
Parameters:
308
  * eax = 9 - function number
308
  * eax = 9 - function number
309
  * ebx = pointer to 1-Kb buffer
309
  * ebx = pointer to 1-Kb buffer
310
  * ecx = number of the slot of the thread
310
  * ecx = number of the slot of the thread
311
    ecx = -1 - get information on the current thread
311
    ecx = -1 - get information on the current thread
312
Returned value:
312
Returned value:
313
  * eax = maximum number of the slot of a thread
313
  * eax = maximum number of the slot of a thread
314
  * buffer pointed to by ebx contains the following information:
314
  * buffer pointed to by ebx contains the following information:
315
    * +0: dword: usage of the processor (how many time units
315
    * +0: dword: usage of the processor (how many time units
316
      per second leaves on execution of this thread)
316
      per second leaves on execution of this thread)
317
    * +4: word: position of the window of thread in the window stack
317
    * +4: word: position of the window of thread in the window stack
318
    * +6: word: (has no relation to the specified thread)
318
    * +6: word: (has no relation to the specified thread)
319
      number of the thread slot, which window has in the window stack
319
      number of the thread slot, which window has in the window stack
320
      position ecx
320
      position ecx
321
    * +8: word: reserved
321
    * +8: word: reserved
322
    * +10 = +0xA: 11 bytes: name of the process
322
    * +10 = +0xA: 11 bytes: name of the process
323
      (name of corresponding executable file in the format 8+3)
323
      (name of corresponding executable file in the format 8+3)
324
    * +21 = +0x15: byte: reserved, this byte is not changed
324
    * +21 = +0x15: byte: reserved, this byte is not changed
325
    * +22 = +0x16: dword: address of the process in memory
325
    * +22 = +0x16: dword: address of the process in memory
326
    * +26 = +0x1A: dword: size of used memory - 1
326
    * +26 = +0x1A: dword: size of used memory - 1
327
    * +30 = +0x1E: dword: identifier (PID/TID)
327
    * +30 = +0x1E: dword: identifier (PID/TID)
328
    * +34 = +0x22: dword: coordinate of the thread window on axis x
328
    * +34 = +0x22: dword: coordinate of the thread window on axis x
329
    * +38 = +0x26: dword: coordinate of the thread window on axis y
329
    * +38 = +0x26: dword: coordinate of the thread window on axis y
330
    * +42 = +0x2A: dword: size of the thread window on axis x
330
    * +42 = +0x2A: dword: size of the thread window on axis x
331
    * +46 = +0x2E: dword: size of the thread window on axis y
331
    * +46 = +0x2E: dword: size of the thread window on axis y
332
    * +50 = +0x32: word: status of the thread slot:
332
    * +50 = +0x32: word: status of the thread slot:
333
      * 0 = thread is running
333
      * 0 = thread is running
334
      * 1 = thread is suspended
334
      * 1 = thread is suspended
335
      * 2 = thread is suspended while waiting for event
335
      * 2 = thread is suspended while waiting for event
336
      * 3 = thread is terminating as a result of call to function -1
336
      * 3 = thread is terminating as a result of call to function -1
337
        or under duress as a result of call to subfunction 2
337
        or under duress as a result of call to subfunction 2
338
        of function 18 or termination of the system
338
        of function 18 or termination of the system
339
      * 4 = thread is terminating as a result of exception
339
      * 4 = thread is terminating as a result of exception
340
      * 5 = thread waits for event
340
      * 5 = thread waits for event
341
      * 9 = requested slot is free, all other information on the slot
341
      * 9 = requested slot is free, all other information on the slot
342
        is not meaningful
342
        is not meaningful
343
    * +52 = +0x34: word: reserved, this word is not changed
343
    * +52 = +0x34: word: reserved, this word is not changed
344
    * +54 = +0x36: dword: coordinate of the client area on axis x
344
    * +54 = +0x36: dword: coordinate of the client area on axis x
345
    * +58 = +0x3A: dword: coordinate of the client area on axis y
345
    * +58 = +0x3A: dword: coordinate of the client area on axis y
346
    * +62 = +0x3E: dword: width of the client area
346
    * +62 = +0x3E: dword: width of the client area
347
    * +66 = +0x42: dword: height of the client area
347
    * +66 = +0x42: dword: height of the client area
348
    * +70 = +0x46: byte: state of the window - bitfield
348
    * +70 = +0x46: byte: state of the window - bitfield
349
      * bit 0 (mask 1): window is maximized
349
      * bit 0 (mask 1): window is maximized
350
      * bit 1 (mask 2): window is minimized to panel
350
      * bit 1 (mask 2): window is minimized to panel
351
      * bit 2 (mask 4): window is rolled up
351
      * bit 2 (mask 4): window is rolled up
352
Remarks:
352
Remarks:
353
  * Slots are numbered starting from 1.
353
  * Slots are numbered starting from 1.
354
  * Returned value is not a total number of threads, because there
354
  * Returned value is not a total number of threads, because there
355
    can be free slots.
355
    can be free slots.
356
  * When process is starting, system automatically creates
356
  * When process is starting, system automatically creates
357
    execution thread.
357
    execution thread.
358
  * Function gives information on the thread. Each process has
358
  * Function gives information on the thread. Each process has
359
    at least one thread. One process can create many threads,
359
    at least one thread. One process can create many threads,
360
    in this case each thread has its own slot and the fields
360
    in this case each thread has its own slot and the fields
361
    +10, +22, +26 in these slots coincide.
361
    +10, +22, +26 in these slots coincide.
362
    Applications have no common way to define whether two threads
362
    Applications have no common way to define whether two threads
363
    belong to one process.
363
    belong to one process.
364
  * The active window - window on top of the window stack -
364
  * The active window - window on top of the window stack -
365
    receives the messages on a keyboard input. For such window
365
    receives the messages on a keyboard input. For such window
366
    the position in the window stack coincides with returned value.
366
    the position in the window stack coincides with returned value.
367
  * Slot 1 corresponds to special system thread, for which:
367
  * Slot 1 corresponds to special system thread, for which:
368
    * the window is in the bottom of the window stack, the fields
368
    * the window is in the bottom of the window stack, the fields
369
      +4 and +6 contain value 1
369
      +4 and +6 contain value 1
370
    * name of the process - "OS/IDLE" (supplemented by spaces)
370
    * name of the process - "OS/IDLE" (supplemented by spaces)
371
    * address of the process in memory is 0, size of used memory is
371
    * address of the process in memory is 0, size of used memory is
372
      16 Mb (0x1000000)
372
      16 Mb (0x1000000)
373
    * PID=1
373
    * PID=1
374
    * coordinates and sizes of the window and the client area are by
374
    * coordinates and sizes of the window and the client area are by
375
      convention set to 0
375
      convention set to 0
376
    * status of the slot is always 0 (running)
376
    * status of the slot is always 0 (running)
377
    * the execution time adds of time leaving on operations itself
377
    * the execution time adds of time leaving on operations itself
378
      and idle time in waiting for interrupt (which can be got by call
378
      and idle time in waiting for interrupt (which can be got by call
379
      to subfunction 4 of function 18).
379
      to subfunction 4 of function 18).
380
  * Beginning from slot 2, the normal applications are placed.
380
  * Beginning from slot 2, the normal applications are placed.
381
  * The normal applications are placed in memory at the address
381
  * The normal applications are placed in memory at the address
382
    0x60400000 (kernel constant 'std_application_base_address').
382
    0x60400000 (kernel constant 'std_application_base_address').
383
    There is no intersection, as each process has its own page table.
383
    There is no intersection, as each process has its own page table.
384
  * At creation of the thread it is assigned the slot
384
  * At creation of the thread it is assigned the slot
385
    in the system table and identifier (Process/Thread IDentifier =
385
    in the system table and identifier (Process/Thread IDentifier =
386
    PID/TID), which do not vary with time for given thread.
386
    PID/TID), which do not vary with time for given thread.
387
    After completion of the thread its slot can be anew used
387
    After completion of the thread its slot can be anew used
388
    for another thread. The thread identifier can not be assigned
388
    for another thread. The thread identifier can not be assigned
389
    to other thread even after completion of this thread.
389
    to other thread even after completion of this thread.
390
    Identifiers, assigned to new threads, grow monotonously.
390
    Identifiers, assigned to new threads, grow monotonously.
391
  * If the thread has not yet defined the window by call to
391
  * If the thread has not yet defined the window by call to
392
    function 0, the position and the sizes
392
    function 0, the position and the sizes
393
    of its window are considered to be zero.
393
    of its window are considered to be zero.
394
  * Coordinates of the client area are relative to the window.
394
  * Coordinates of the client area are relative to the window.
395
  * At the moment only the part of the buffer by a size
395
  * At the moment only the part of the buffer by a size
396
    71 = 0x37 bytes is used. Nevertheless it is recommended to use
396
    71 = 0x37 bytes is used. Nevertheless it is recommended to use
397
    1-Kb buffer for the future compatibility, in the future
397
    1-Kb buffer for the future compatibility, in the future
398
    some fields can be added.
398
    some fields can be added.
399
 
399
 
400
======================================================================
400
======================================================================
401
==================== Function 10 - wait for event. ===================
401
==================== Function 10 - wait for event. ===================
402
======================================================================
402
======================================================================
403
If the message queue is empty, waits for appearance of the message
403
If the message queue is empty, waits for appearance of the message
404
in queue. In this state thread does not consume CPU time.
404
in queue. In this state thread does not consume CPU time.
405
Then reads out the message from queue.
405
Then reads out the message from queue.
406
 
406
 
407
Parameters:
407
Parameters:
408
  * eax = 10 - function number
408
  * eax = 10 - function number
409
Returned value:
409
Returned value:
410
  * eax = event (see the list of events)
410
  * eax = event (see the list of events)
411
Remarks:
411
Remarks:
412
  * Those events are taken into account only which enter into
412
  * Those events are taken into account only which enter into
413
    a mask set by function 40. By default it is
413
    a mask set by function 40. By default it is
414
    redraw, key and button events.
414
    redraw, key and button events.
415
  * To check, whether there is a message in queue, use function 11.
415
  * To check, whether there is a message in queue, use function 11.
416
    To wait for no more than given time, use function 23.
416
    To wait for no more than given time, use function 23.
417
 
417
 
418
======================================================================
418
======================================================================
419
=============== Function 11 - check for event, no wait. ==============
419
=============== Function 11 - check for event, no wait. ==============
420
======================================================================
420
======================================================================
421
If the message queue contains event, function reads out
421
If the message queue contains event, function reads out
422
and return it. If the queue is empty, function returns 0.
422
and return it. If the queue is empty, function returns 0.
423
Parameters:
423
Parameters:
424
  * eax = 11 - function number
424
  * eax = 11 - function number
425
Returned value:
425
Returned value:
426
  * eax = 0 - message queue is empty
426
  * eax = 0 - message queue is empty
427
  * else eax = event (see the list of events)
427
  * else eax = event (see the list of events)
428
Remarks:
428
Remarks:
429
  * Those events are taken into account only, which enter into
429
  * Those events are taken into account only, which enter into
430
    a mask set by function 40. By default it is
430
    a mask set by function 40. By default it is
431
    redraw, key and button events.
431
    redraw, key and button events.
432
  * To wait for event, use function 10.
432
  * To wait for event, use function 10.
433
    To wait for no more than given time, use function 23.
433
    To wait for no more than given time, use function 23.
434
 
434
 
435
======================================================================
435
======================================================================
436
=============== Function 12 - begin/end window redraw. ===============
436
=============== Function 12 - begin/end window redraw. ===============
437
======================================================================
437
======================================================================
438
 
438
 
439
---------------- Subfunction 1 - begin window redraw. ----------------
439
---------------- Subfunction 1 - begin window redraw. ----------------
440
Parameters:
440
Parameters:
441
  * eax = 12 - function number
441
  * eax = 12 - function number
442
  * ebx = 1 - subfunction number
442
  * ebx = 1 - subfunction number
443
Returned value:
443
Returned value:
444
  * function does not return value
444
  * function does not return value
445
 
445
 
446
----------------- Subfunction 2 - end window redraw. -----------------
446
----------------- Subfunction 2 - end window redraw. -----------------
447
Parameters:
447
Parameters:
448
  * eax = 12 - function number
448
  * eax = 12 - function number
449
  * ebx = 2 - subfunction number
449
  * ebx = 2 - subfunction number
450
Returned value:
450
Returned value:
451
  * function does not return value
451
  * function does not return value
452
Remarks:
452
Remarks:
453
  * Subfunction 1 deletes all buttons defined with
453
  * Subfunction 1 deletes all buttons defined with
454
    function 8, they must be defined again.
454
    function 8, they must be defined again.
455
 
455
 
456
======================================================================
456
======================================================================
457
============ Function 13 - draw a rectangle in the window. ===========
457
============ Function 13 - draw a rectangle in the window. ===========
458
======================================================================
458
======================================================================
459
Parameters:
459
Parameters:
460
  * eax = 13 - function number
460
  * eax = 13 - function number
461
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
461
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
462
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
462
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
463
  * edx = color 0xRRGGBB or 0x80RRGGBB for gradient fill
463
  * edx = color 0xRRGGBB or 0x80RRGGBB for gradient fill
464
Returned value:
464
Returned value:
465
  * function does not return value
465
  * function does not return value
466
Remarks:
466
Remarks:
467
  * Coordinates are understood as coordinates of the left upper corner
467
  * Coordinates are understood as coordinates of the left upper corner
468
    of a rectangle relative to the window.
468
    of a rectangle relative to the window.
469
 
469
 
470
======================================================================
470
======================================================================
471
=================== Function 14 - get screen size. ===================
471
=================== Function 14 - get screen size. ===================
472
======================================================================
472
======================================================================
473
Parameters:
473
Parameters:
474
  * eax = 14 - function number
474
  * eax = 14 - function number
475
Returned value:
475
Returned value:
476
  * eax = [xsize]*65536 + [ysize], where
476
  * eax = [xsize]*65536 + [ysize], where
477
  * xsize = x-coordinate of the right lower corner of the screen =
477
  * xsize = x-coordinate of the right lower corner of the screen =
478
            horizontal size - 1
478
            horizontal size - 1
479
  * ysize = y-coordinate of the right lower corner of the screen =
479
  * ysize = y-coordinate of the right lower corner of the screen =
480
            vertical size - 1
480
            vertical size - 1
481
Remarks:
481
Remarks:
482
  * See also subfunction 5 of function 48 - get sizes of
482
  * See also subfunction 5 of function 48 - get sizes of
483
    working area of the screen.
483
    working area of the screen.
484
 
484
 
485
======================================================================
485
======================================================================
486
== Function 15, subfunction 1 - set a size of the background image. ==
486
== Function 15, subfunction 1 - set a size of the background image. ==
487
======================================================================
487
======================================================================
488
Parameters:
488
Parameters:
489
  * eax = 15 - function number
489
  * eax = 15 - function number
490
  * ebx = 1 - subfunction number
490
  * ebx = 1 - subfunction number
491
  * ecx = width of the image
491
  * ecx = width of the image
492
  * edx = height of the image
492
  * edx = height of the image
493
Returned value:
493
Returned value:
494
  * function does not return value
494
  * function does not return value
495
Remarks:
495
Remarks:
496
  * There is no checks for correctness. The setting of too large
496
  * There is no checks for correctness. The setting of too large
497
    values will result that the background will contain data abroad
497
    values will result that the background will contain data abroad
498
    of buffer for the background image. Buffer size = 0x160000-0x10,
498
    of buffer for the background image. Buffer size = 0x160000-0x10,
499
    that corresponds to maximum size 800*600. (800*600*3=0x15F900)
499
    that corresponds to maximum size 800*600. (800*600*3=0x15F900)
500
  * For update of the screen (after completion of a series of commands
500
  * For update of the screen (after completion of a series of commands
501
    working with a background) call subfunction 3.
501
    working with a background) call subfunction 3.
502
  * There is a pair function for get size of the background image -
502
  * There is a pair function for get size of the background image -
503
    subfunction 1 of function 39.
503
    subfunction 1 of function 39.
504
 
504
 
505
======================================================================
505
======================================================================
506
=== Function 15, subfunction 2 - put pixel on the background image. ==
506
=== Function 15, subfunction 2 - put pixel on the background image. ==
507
======================================================================
507
======================================================================
508
Parameters:
508
Parameters:
509
  * eax = 15 - function number
509
  * eax = 15 - function number
510
  * ebx = 2 - subfunction number
510
  * ebx = 2 - subfunction number
511
  * ecx = offset
511
  * ecx = offset
512
  * edx = color of a pixel 0xRRGGBB
512
  * edx = color of a pixel 0xRRGGBB
513
Returned value:
513
Returned value:
514
  * function does not return value
514
  * function does not return value
515
Remarks:
515
Remarks:
516
  * Offset for a pixel with coordinates (x,y) is calculated as
516
  * Offset for a pixel with coordinates (x,y) is calculated as
517
    (x+y*xsize)*3.
517
    (x+y*xsize)*3.
518
  * If the given offset exceeds 0x160000-16 = 1.375 Mb - 16 bytes,
518
  * If the given offset exceeds 0x160000-16 = 1.375 Mb - 16 bytes,
519
    the call is ignored.
519
    the call is ignored.
520
  * For update of the screen (after completion of a series of commands
520
  * For update of the screen (after completion of a series of commands
521
    working with a background) call subfunction 3.
521
    working with a background) call subfunction 3.
522
  * There is a pair function for get pixel on the background image -
522
  * There is a pair function for get pixel on the background image -
523
    subfunction 2 of function 39.
523
    subfunction 2 of function 39.
524
 
524
 
525
======================================================================
525
======================================================================
526
=========== Function 15, subfunction 3 - redraw background. ==========
526
=========== Function 15, subfunction 3 - redraw background. ==========
527
======================================================================
527
======================================================================
528
Parameters:
528
Parameters:
529
  * eax = 15 - function number
529
  * eax = 15 - function number
530
  * ebx = 3 - subfunction number
530
  * ebx = 3 - subfunction number
531
Returned value:
531
Returned value:
532
  * function does not return value
532
  * function does not return value
533
 
533
 
534
======================================================================
534
======================================================================
535
== Function 15, subfunction 4 - set drawing mode for the background. =
535
== Function 15, subfunction 4 - set drawing mode for the background. =
536
======================================================================
536
======================================================================
537
Parameters:
537
Parameters:
538
  * eax = 15 - function number
538
  * eax = 15 - function number
539
  * ebx = 4 - subfunction number
539
  * ebx = 4 - subfunction number
540
  * ecx = drawing mode:
540
  * ecx = drawing mode:
541
    * 1 = tile
541
    * 1 = tile
542
    * 2 = stretch
542
    * 2 = stretch
543
Returned value:
543
Returned value:
544
  * function does not return value
544
  * function does not return value
545
Remarks:
545
Remarks:
546
  * For update of the screen (after completion of a series of commands
546
  * For update of the screen (after completion of a series of commands
547
    working with a background) call subfunction 3.
547
    working with a background) call subfunction 3.
548
  * There is a pair function for get drawing mode of the background -
548
  * There is a pair function for get drawing mode of the background -
549
    subfunction 4 of function 39.
549
    subfunction 4 of function 39.
550
 
550
 
551
======================================================================
551
======================================================================
552
===================== Function 15, subfunction 5 =====================
552
===================== Function 15, subfunction 5 =====================
553
============ Put block of pixels on the background image. ============
553
============ Put block of pixels on the background image. ============
554
======================================================================
554
======================================================================
555
Parameters:
555
Parameters:
556
  * eax = 15 - function number
556
  * eax = 15 - function number
557
  * ebx = 5 - subfunction number
557
  * ebx = 5 - subfunction number
558
  * ecx = pointer to the data in the format BBGGRRBBGGRR...
558
  * ecx = pointer to the data in the format BBGGRRBBGGRR...
559
  * edx = offset in data of the background image
559
  * edx = offset in data of the background image
560
  * esi = size of data in bytes = 3 * number of pixels
560
  * esi = size of data in bytes = 3 * number of pixels
561
Returned value:
561
Returned value:
562
  * function does not return value
562
  * function does not return value
563
Remarks:
563
Remarks:
564
  * If the block gets out abroad 0x160000-16 = 1.375 Mb - 16 bytes,
564
  * If the block gets out abroad 0x160000-16 = 1.375 Mb - 16 bytes,
565
    the call is ignored.
565
    the call is ignored.
566
  * Color of each pixel is stored as 3-bytes value BBGGRR.
566
  * Color of each pixel is stored as 3-bytes value BBGGRR.
567
  * Pixels of the background image are written sequentially
567
  * Pixels of the background image are written sequentially
568
    from left to right, from up to down.
568
    from left to right, from up to down.
569
  * Offset of pixel with coordinates (x,y) is (x+y*xsize)*3.
569
  * Offset of pixel with coordinates (x,y) is (x+y*xsize)*3.
570
  * For update of the screen (after completion of a series of commands
570
  * For update of the screen (after completion of a series of commands
571
    working with a background) call subfunction 3.
571
    working with a background) call subfunction 3.
572
 
572
 
573
======================================================================
573
======================================================================
574
=============== Function 16 - save ramdisk on a floppy. ==============
574
=============== Function 16 - save ramdisk on a floppy. ==============
575
======================================================================
575
======================================================================
576
Parameters:
576
Parameters:
577
  * eax = 16 - function number
577
  * eax = 16 - function number
578
  * ebx = 1 or ebx = 2 - on which floppy save
578
  * ebx = 1 or ebx = 2 - on which floppy save
579
Returned value:
579
Returned value:
580
  * eax = 0 - success
580
  * eax = 0 - success
581
  * eax = 1 - error
581
  * eax = 1 - error
582
 
582
 
583
======================================================================
583
======================================================================
584
======= Function 17 - get the identifier of the pressed button. ======
584
======= Function 17 - get the identifier of the pressed button. ======
585
======================================================================
585
======================================================================
586
Takes away the code of the pressed button from the buffer.
586
Takes away the code of the pressed button from the buffer.
587
Parameters:
587
Parameters:
588
  * eax = 17 - function number
588
  * eax = 17 - function number
589
Returned value:
589
Returned value:
590
  * if the buffer is empty, function returns eax=1
590
  * if the buffer is empty, function returns eax=1
591
  * if the buffer is not empty, function returns al=0,
591
  * if the buffer is not empty, function returns al=0,
592
    high 24 bits of eax contain button identifier (in particular, ah
592
    high 24 bits of eax contain button identifier (in particular, ah
593
    contains low byte of the identifier; if all buttons have
593
    contains low byte of the identifier; if all buttons have
594
    the identifier less than 256, ah is enough to distinguish).
594
    the identifier less than 256, ah is enough to distinguish).
595
Remarks:
595
Remarks:
596
  * "Buffer" keeps only one button, at pressing the new button the
596
  * "Buffer" keeps only one button, at pressing the new button the
597
    information about old is lost.
597
    information about old is lost.
598
  * The call of this function by an application with inactive window
598
  * The call of this function by an application with inactive window
599
    will return answer "buffer is empty".
599
    will return answer "buffer is empty".
600
 
600
 
601
======================================================================
601
======================================================================
602
============ Function 18, subfunction 1 - system shutdown. ===========
602
============ Function 18, subfunction 1 - system shutdown. ===========
603
======================================================================
603
======================================================================
604
Parameters:
604
Parameters:
605
  * eax = 18 - function number
605
  * eax = 18 - function number
606
  * ebx = 1 - subfunction number
606
  * ebx = 1 - subfunction number
607
Returned value:
607
Returned value:
608
  * function always return eax = 0 as tag of success
608
  * function always return eax = 0 as tag of success
609
Remarks:
609
Remarks:
610
  * On the last step menu of exit from the system appears and waits
610
  * On the last step menu of exit from the system appears and waits
611
    response of the user.
611
    response of the user.
612
  * See also subfunction 9, system shutdown with
612
  * See also subfunction 9, system shutdown with
613
    the parameter to force the choice in the exit menu.
613
    the parameter to force the choice in the exit menu.
614
 
614
 
615
======================================================================
615
======================================================================
616
= Function 18, subfunction 2 - terminate process/thread by the slot. =
616
= Function 18, subfunction 2 - terminate process/thread by the slot. =
617
======================================================================
617
======================================================================
618
Parameters:
618
Parameters:
619
  * eax = 18 - function number
619
  * eax = 18 - function number
620
  * ebx = 2 - subfunction number
620
  * ebx = 2 - subfunction number
621
  * ecx = number of the slot of process/thread
621
  * ecx = number of the slot of process/thread
622
Returned value:
622
Returned value:
623
  * function does not return value
623
  * function does not return value
624
Remarks:
624
Remarks:
625
  * It is impossible to terminate system thread OS/IDLE (with
625
  * It is impossible to terminate system thread OS/IDLE (with
626
    number of the slot 1),
626
    number of the slot 1),
627
    it is possible to terminate any normal process/thread.
627
    it is possible to terminate any normal process/thread.
628
  * See also subfunction 18 - terminate
628
  * See also subfunction 18 - terminate
629
    process/thread by the identifier.
629
    process/thread by the identifier.
630
 
630
 
631
======================================================================
631
======================================================================
632
===================== Function 18, subfunction 3 =====================
632
===================== Function 18, subfunction 3 =====================
633
============= Make active the window of the given thread. ============
633
============= Make active the window of the given thread. ============
634
======================================================================
634
======================================================================
635
Parameters:
635
Parameters:
636
  * eax = 18 - function number
636
  * eax = 18 - function number
637
  * ebx = 3 - subfunction number
637
  * ebx = 3 - subfunction number
638
  * ecx = number of the thread slot
638
  * ecx = number of the thread slot
639
Returned value:
639
Returned value:
640
  * function does not return value
640
  * function does not return value
641
Remarks:
641
Remarks:
642
  * If correct, but nonexistent slot is given,
642
  * If correct, but nonexistent slot is given,
643
    some window is made active.
643
    some window is made active.
644
  * To find out, which window is active, use subfunction 7.
644
  * To find out, which window is active, use subfunction 7.
645
 
645
 
646
======================================================================
646
======================================================================
647
===================== Function 18, subfunction 4 =====================
647
===================== Function 18, subfunction 4 =====================
648
=========== Get counter of idle time units per one second. ===========
648
=========== Get counter of idle time units per one second. ===========
649
======================================================================
649
======================================================================
650
Idle time units are units, in which the processor stands idle
650
Idle time units are units, in which the processor stands idle
651
in waiting for interrupt (in the command 'hlt').
651
in waiting for interrupt (in the command 'hlt').
652
 
652
 
653
Parameters:
653
Parameters:
654
  * eax = 18 - function number
654
  * eax = 18 - function number
655
  * ebx = 4 - subfunction number
655
  * ebx = 4 - subfunction number
656
Returned value:
656
Returned value:
657
  * eax = value of the counter of idle time units per one second
657
  * eax = value of the counter of idle time units per one second
658
 
658
 
659
======================================================================
659
======================================================================
660
========== Function 18, subfunction 5 - get CPU clock rate. ==========
660
========== Function 18, subfunction 5 - get CPU clock rate. ==========
661
======================================================================
661
======================================================================
662
Parameters:
662
Parameters:
663
  * eax = 18 - function number
663
  * eax = 18 - function number
664
  * ebx = 5 - subfunction number
664
  * ebx = 5 - subfunction number
665
Returned value:
665
Returned value:
666
  * eax = clock rate (modulo 2^32 clock ticks = 4GHz)
666
  * eax = clock rate (modulo 2^32 clock ticks = 4GHz)
667
 
667
 
668
======================================================================
668
======================================================================
669
 Function 18, subfunction 6 - save ramdisk to the file on hard drive. 
669
 Function 18, subfunction 6 - save ramdisk to the file on hard drive. 
670
======================================================================
670
======================================================================
671
Parameters:
671
Parameters:
672
  * eax = 18 - function number
672
  * eax = 18 - function number
673
  * ebx = 6 - subfunction number
673
  * ebx = 6 - subfunction number
674
  * ecx defines path to the file:
674
  * ecx defines path to the file:
675
    * 1 = in the folder "/KOLIBRI"
675
    * 1 = in the folder "/KOLIBRI"
676
    * 2 = in the root folder
676
    * 2 = in the root folder
677
    * 3 = edx points to the path (names of folders in the format 8+3,
677
    * 3 = edx points to the path (names of folders in the format 8+3,
678
      divided by '/')
678
      divided by '/')
679
Returned value:
679
Returned value:
680
  * eax = 0 - success
680
  * eax = 0 - success
681
  * else eax = error code of the file system
681
  * else eax = error code of the file system
682
Çàìå÷àíèÿ:
682
Çàìå÷àíèÿ:
683
  * Filename is fixed, "kolibri.img" (global kernel variable
683
  * Filename is fixed, "kolibri.img" (global kernel variable
684
    'image_save' from 'preboot.inc')
684
    'image_save' from 'preboot.inc')
685
  * Drive and partition are defined by subfunction 7
685
  * Drive and partition are defined by subfunction 7
686
    and subfunction 8 of function 21.
686
    and subfunction 8 of function 21.
687
  * All folders in the given path must exist, otherwise function
687
  * All folders in the given path must exist, otherwise function
688
    returns value 5, "file not found".
688
    returns value 5, "file not found".
689
 
689
 
690
======================================================================
690
======================================================================
691
=========== Function 18, subfunction 7 - get active window. ==========
691
=========== Function 18, subfunction 7 - get active window. ==========
692
======================================================================
692
======================================================================
693
Parameters:
693
Parameters:
694
  * eax = 18 - function number
694
  * eax = 18 - function number
695
  * ebx = 7 - subfunction number
695
  * ebx = 7 - subfunction number
696
Returned value:
696
Returned value:
697
  * eax = number of the active window
697
  * eax = number of the active window
698
    (number of the slot of the thread with active window)
698
    (number of the slot of the thread with active window)
699
Remarks:
699
Remarks:
700
  * Active window is at the top of the window stack and receives
700
  * Active window is at the top of the window stack and receives
701
    messages on all keyboard input.
701
    messages on all keyboard input.
702
  * To make a window active, use subfunction 3.
702
  * To make a window active, use subfunction 3.
703
 
703
 
704
======================================================================
704
======================================================================
705
== Function 18, subfunction 8 - disable/enable the internal speaker. =
705
== Function 18, subfunction 8 - disable/enable the internal speaker. =
706
======================================================================
706
======================================================================
707
If speaker sound is disabled, all calls to subfunction 55 of
707
If speaker sound is disabled, all calls to subfunction 55 of
708
function 55 are ignored. If speaker sound is enabled,
708
function 55 are ignored. If speaker sound is enabled,
709
they are routed on builtin speaker.
709
they are routed on builtin speaker.
710
 
710
 
711
------------------- Subsubfunction 1 - get status. -------------------
711
------------------- Subsubfunction 1 - get status. -------------------
712
Parameters:
712
Parameters:
713
  * eax = 18 - function number
713
  * eax = 18 - function number
714
  * ebx = 8 - subfunction number
714
  * ebx = 8 - subfunction number
715
  * ecx = 1 - number of the subsubfunction
715
  * ecx = 1 - number of the subsubfunction
716
Returned value:
716
Returned value:
717
  * eax = 0 - speaker sound is enabled; 1 - disabled
717
  * eax = 0 - speaker sound is enabled; 1 - disabled
718
 
718
 
719
----------------- Subsubfunction 2 - toggle status. ------------------
719
----------------- Subsubfunction 2 - toggle status. ------------------
720
Toggles states of disable/enable.
720
Toggles states of disable/enable.
721
Parameters:
721
Parameters:
722
  * eax = 18 - function number
722
  * eax = 18 - function number
723
  * ebx = 8 - subfunction number
723
  * ebx = 8 - subfunction number
724
  * ecx = 2 - number of the subsubfunction
724
  * ecx = 2 - number of the subsubfunction
725
Returned value:
725
Returned value:
726
  * function does not return value
726
  * function does not return value
727
 
727
 
728
======================================================================
728
======================================================================
729
== Function 18, subfunction 9 - system shutdown with the parameter. ==
729
== Function 18, subfunction 9 - system shutdown with the parameter. ==
730
======================================================================
730
======================================================================
731
Parameters:
731
Parameters:
732
  * eax = 18 - function number
732
  * eax = 18 - function number
733
  * ebx = 9 - subfunction number
733
  * ebx = 9 - subfunction number
734
  * ecx = parameter:
734
  * ecx = parameter:
735
    * 1 = on the last step of shutdown save ramdisk on a floppy and
735
    * 1 = on the last step of shutdown save ramdisk on a floppy and
736
      then show the exit menu and request further operations
736
      then show the exit menu and request further operations
737
      from the user
737
      from the user
738
    * 2 = turn off computer
738
    * 2 = turn off computer
739
    * 3 = reboot computer
739
    * 3 = reboot computer
740
    * 4 = restart the kernel from the file 'kernel.mnt' on ramdisk
740
    * 4 = restart the kernel from the file 'kernel.mnt' on ramdisk
741
Returned value:
741
Returned value:
742
  * at incorrect ecx the registers do not change (i.e. eax=18)
742
  * at incorrect ecx the registers do not change (i.e. eax=18)
743
  * by correct call function always returns eax=0
743
  * by correct call function always returns eax=0
744
    as the tag of success
744
    as the tag of success
745
Remarks:
745
Remarks:
746
  * Do not rely on returned value by incorrect call, it can be
746
  * Do not rely on returned value by incorrect call, it can be
747
    changed in future versions of the kernel.
747
    changed in future versions of the kernel.
748
  * It is possible to use subfunction 1, that on the last step
748
  * It is possible to use subfunction 1, that on the last step
749
    the user makes choice himself.
749
    the user makes choice himself.
750
  * It is not recommended to use value ecx=1 (to not irritate the user
750
  * It is not recommended to use value ecx=1 (to not irritate the user
751
    with excessive questions); to save ramdisk on a floppy use
751
    with excessive questions); to save ramdisk on a floppy use
752
    function 16 (which admits specification, on which floppy to
752
    function 16 (which admits specification, on which floppy to
753
    write), and to shutdown with the exit menu use already mentioned
753
    write), and to shutdown with the exit menu use already mentioned
754
    subfunction 1.
754
    subfunction 1.
755
 
755
 
756
======================================================================
756
======================================================================
757
===== Function 18, subfunction 10 - minimize application window. =====
757
===== Function 18, subfunction 10 - minimize application window. =====
758
======================================================================
758
======================================================================
759
Minimizes the own window.
759
Minimizes the own window.
760
Parameters:
760
Parameters:
761
  * eax = 18 - function number
761
  * eax = 18 - function number
762
  * ebx = 10 - subfunction number
762
  * ebx = 10 - subfunction number
763
Returned value:
763
Returned value:
764
  * function does not return value
764
  * function does not return value
765
Remarks:
765
Remarks:
766
  * The minimized window from the point of view of function 9
766
  * The minimized window from the point of view of function 9
767
    keeps position and sizes.
767
    keeps position and sizes.
768
  * Restoring of an application window occurs at its activation by 
768
  * Restoring of an application window occurs at its activation by 
769
    subfunction 3.
769
    subfunction 3.
770
  * Usually there is no necessity to minimize/restire a window
770
  * Usually there is no necessity to minimize/restire a window
771
    obviously: minimization of a window is carried out by the system
771
    obviously: minimization of a window is carried out by the system
772
    at pressing the minimization button (for skinned windows
772
    at pressing the minimization button (for skinned windows
773
    it is defined automatically by function 0,
773
    it is defined automatically by function 0,
774
    for other windows it can be defined manually by function 8),
774
    for other windows it can be defined manually by function 8),
775
    restore of a window is done by the application '@panel'.
775
    restore of a window is done by the application '@panel'.
776
 
776
 
777
======================================================================
777
======================================================================
778
 Function 18, subfunction 11 - get information on the disk subsystem. 
778
 Function 18, subfunction 11 - get information on the disk subsystem. 
779
======================================================================
779
======================================================================
780
Parameters:
780
Parameters:
781
  * eax = 18 - function number
781
  * eax = 18 - function number
782
  * ebx = 11 - subfunction number
782
  * ebx = 11 - subfunction number
783
  * ecx = type of the table:
783
  * ecx = type of the table:
784
    * 1 = short version, 10 bytes
784
    * 1 = short version, 10 bytes
785
    * 2 = full version, 65536 bytes
785
    * 2 = full version, 65536 bytes
786
  * edx = pointer to the buffer (in the application) for the table
786
  * edx = pointer to the buffer (in the application) for the table
787
Returned value:
787
Returned value:
788
  * function does not return value
788
  * function does not return value
789
Format of the table: short version:
789
Format of the table: short version:
790
  * +0: byte: information about FDD's (drives for floppies),
790
  * +0: byte: information about FDD's (drives for floppies),
791
    AAAABBBB, where AAAA gives type of the first drive, BBBB -
791
    AAAABBBB, where AAAA gives type of the first drive, BBBB -
792
    of the second regarding to the following list:
792
    of the second regarding to the following list:
793
    * 0 = there is no drive
793
    * 0 = there is no drive
794
    * 1 = 360Kb, 5.25''
794
    * 1 = 360Kb, 5.25''
795
    * 2 = 1.2Mb, 5.25''
795
    * 2 = 1.2Mb, 5.25''
796
    * 3 = 720Kb, 3.5''
796
    * 3 = 720Kb, 3.5''
797
    * 4 = 1.44Mb, 3.5''
797
    * 4 = 1.44Mb, 3.5''
798
    * 5 = 2.88Mb, 3.5'' (such drives are not used anymore)
798
    * 5 = 2.88Mb, 3.5'' (such drives are not used anymore)
799
    For example, for the standard configuration from one 1.44-drive
799
    For example, for the standard configuration from one 1.44-drive
800
    here will be 40h, and for the case 1.2Mb on A: and 1.44Mb on B:
800
    here will be 40h, and for the case 1.2Mb on A: and 1.44Mb on B:
801
    the value is 24h.
801
    the value is 24h.
802
  * +1: byte: information about hard disks and CD-drives, AABBCCDD,
802
  * +1: byte: information about hard disks and CD-drives, AABBCCDD,
803
    where AA corresponds to the controller IDE0, ..., DD - IDE3:
803
    where AA corresponds to the controller IDE0, ..., DD - IDE3:
804
    * 0 = device is absent
804
    * 0 = device is absent
805
    * 1 = hard drive
805
    * 1 = hard drive
806
    * 2 = CD-drive
806
    * 2 = CD-drive
807
    For example, in the case HD on IDE0 and CD on IDE2
807
    For example, in the case HD on IDE0 and CD on IDE2
808
    this field contains 48h.
808
    this field contains 48h.
809
  * +2: 4 db: number of the retrieved partitions on hard disks
809
  * +2: 4 db: number of the retrieved partitions on hard disks
810
    at accordingly IDE0,...,IDE3.
810
    at accordingly IDE0,...,IDE3.
811
    If the hard disk on IDEx is absent, appropriate byte is zero,
811
    If the hard disk on IDEx is absent, appropriate byte is zero,
812
    otherwise it shows number of the recognized partitions, which
812
    otherwise it shows number of the recognized partitions, which
813
    can be not presented (if the drive is not formatted or if
813
    can be not presented (if the drive is not formatted or if
814
    the file system is not supported). Current version of the kernel
814
    the file system is not supported). Current version of the kernel
815
    supports only FAT16, FAT32 and NTFS for hard disks.
815
    supports only FAT16, FAT32 and NTFS for hard disks.
816
  * +6: 4 db: reserved
816
  * +6: 4 db: reserved
817
Format of the table: full version:
817
Format of the table: full version:
818
  * +0: 10 db: same as for the short version
818
  * +0: 10 db: same as for the short version
819
  * +10: 100 db: data for the first partition
819
  * +10: 100 db: data for the first partition
820
  * +110: 100 db: data for the second partition
820
  * +110: 100 db: data for the second partition
821
  * ...
821
  * ...
822
  * +10+100*(n-1): 100 db: data for the last partition
822
  * +10+100*(n-1): 100 db: data for the last partition
823
The partitions are located as follows: at first sequentially all
823
The partitions are located as follows: at first sequentially all
824
recoginzed partitions on HD on IDE0 (if present),
824
recoginzed partitions on HD on IDE0 (if present),
825
then on HD on IDE1 (if present) and so on up to IDE3.
825
then on HD on IDE1 (if present) and so on up to IDE3.
826
Format of the information about partition
826
Format of the information about partition
827
(at moment only FAT is supported):
827
(at moment only FAT is supported):
828
  * +0: dword: first physical sector of the partition
828
  * +0: dword: first physical sector of the partition
829
  * +4: dword: last physical sector of the partition
829
  * +4: dword: last physical sector of the partition
830
    (belongs to the partition)
830
    (belongs to the partition)
831
  * +8: byte: file system type:
831
  * +8: byte: file system type:
832
    16=FAT16, 32=FAT32, 1=NTFS
832
    16=FAT16, 32=FAT32, 1=NTFS
833
  * other data are dependent on file system, are modified with
833
  * other data are dependent on file system, are modified with
834
    kernel modifications and therefore are not described
834
    kernel modifications and therefore are not described
835
Remarks:
835
Remarks:
836
  * The short table can be used for obtaining the information about
836
  * The short table can be used for obtaining the information about
837
    available devices.
837
    available devices.
838
 
838
 
839
======================================================================
839
======================================================================
840
========== Function 18, subfunction 13 - get kernel version. =========
840
========== Function 18, subfunction 13 - get kernel version. =========
841
======================================================================
841
======================================================================
842
Parameters:
842
Parameters:
843
  * eax = 18 - function number
843
  * eax = 18 - function number
844
  * ebx = 13 - subfunction number
844
  * ebx = 13 - subfunction number
845
  * ecx = pointer to the buffer (not less than 16 bytes), where
845
  * ecx = pointer to the buffer (not less than 16 bytes), where
846
    the information will be placed
846
    the information will be placed
847
Returned value:
847
Returned value:
848
  * function does not return value
848
  * function does not return value
849
Structure of the buffer:
849
Structure of the buffer:
850
db a,b,c,d for version a.b.c.d
850
db a,b,c,d for version a.b.c.d
851
db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
851
db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
852
db 'name',0 - ASCIIZ-string with the name
852
db 'name',0 - ASCIIZ-string with the name
853
For Kolibri 0.6.4.0 kernel:
853
For Kolibri 0.6.4.0 kernel:
854
db 0,6,4,0
854
db 0,6,4,0
855
db 2
855
db 2
856
db 'Kolibri',0
856
db 'Kolibri',0
857
 
857
 
858
======================================================================
858
======================================================================
859
======= Function 18, subfunction 14 - wait for screen retrace. =======
859
======= Function 18, subfunction 14 - wait for screen retrace. =======
860
======================================================================
860
======================================================================
861
Waits for the beginning of retrace of the scanning ray of the screen
861
Waits for the beginning of retrace of the scanning ray of the screen
862
monitor.
862
monitor.
863
Parameters:
863
Parameters:
864
  * eax = 18 - function number
864
  * eax = 18 - function number
865
  * ebx = 14 - subfunction number
865
  * ebx = 14 - subfunction number
866
Returned value:
866
Returned value:
867
  * eax = 0 as the tag of success
867
  * eax = 0 as the tag of success
868
Remarks:
868
Remarks:
869
  * Function is intended only for active high-efficiency graphics
869
  * Function is intended only for active high-efficiency graphics
870
    applications; is used for smooth output of a graphics.
870
    applications; is used for smooth output of a graphics.
871
 
871
 
872
======================================================================
872
======================================================================
873
== Function 18, subfunction 15 - center mouse cursor on the screen. ==
873
== Function 18, subfunction 15 - center mouse cursor on the screen. ==
874
======================================================================
874
======================================================================
875
Parameters:
875
Parameters:
876
  * eax = 18 - function number
876
  * eax = 18 - function number
877
  * ebx = 15 - subfunction number
877
  * ebx = 15 - subfunction number
878
Returned value:
878
Returned value:
879
  * eax = 0 as the tag of success
879
  * eax = 0 as the tag of success
880
 
880
 
881
======================================================================
881
======================================================================
882
========= Function 18, subfunction 16 - get size of free RAM. ========
882
========= Function 18, subfunction 16 - get size of free RAM. ========
883
======================================================================
883
======================================================================
884
Parameters:
884
Parameters:
885
  * eax = 18 - function number
885
  * eax = 18 - function number
886
  * ebx = 16 - subfunction number
886
  * ebx = 16 - subfunction number
887
Returned value:
887
Returned value:
888
  * eax = size of free memory in kilobytes
888
  * eax = size of free memory in kilobytes
889
 
889
 
890
======================================================================
890
======================================================================
891
======== Function 18, subfunction 17 - get full amount of RAM. =======
891
======== Function 18, subfunction 17 - get full amount of RAM. =======
892
======================================================================
892
======================================================================
893
Parameters:
893
Parameters:
894
  * eax = 18 - function number
894
  * eax = 18 - function number
895
  * ebx = 17 - subfunction number
895
  * ebx = 17 - subfunction number
896
Returned value:
896
Returned value:
897
  * eax = total size of existing memory in kilobytes
897
  * eax = total size of existing memory in kilobytes
898
 
898
 
899
======================================================================
899
======================================================================
900
===================== Function 18, subfunction 18 ====================
900
===================== Function 18, subfunction 18 ====================
901
============= Terminate process/thread by the identifier. ============
901
============= Terminate process/thread by the identifier. ============
902
======================================================================
902
======================================================================
903
Parameters:
903
Parameters:
904
  * eax = 18 - function number
904
  * eax = 18 - function number
905
  * ebx = 18 - subfunction number
905
  * ebx = 18 - subfunction number
906
  * ecx = identifer of process/thread (PID/TID)
906
  * ecx = identifer of process/thread (PID/TID)
907
Returned value:
907
Returned value:
908
  * eax = 0 - success
908
  * eax = 0 - success
909
  * eax = -1 - error (process is not found or is system)
909
  * eax = -1 - error (process is not found or is system)
910
Remarks:
910
Remarks:
911
  * It is impossible to terminate system thread OS/IDLE (identifier
911
  * It is impossible to terminate system thread OS/IDLE (identifier
912
    1), it is possible to terminate any normal process/thread.
912
    1), it is possible to terminate any normal process/thread.
913
  * See also subfunction 2 - terminate
913
  * See also subfunction 2 - terminate
914
    process/thread by given slot.
914
    process/thread by given slot.
915
 
915
 
916
======================================================================
916
======================================================================
917
======== Function 18, subfunction 19 - get/set mouse features. =======
917
======== Function 18, subfunction 19 - get/set mouse features. =======
918
======================================================================
918
======================================================================
919
 
919
 
920
---------------- Subsubfunction 0 - get mouse speed. -----------------
920
---------------- Subsubfunction 0 - get mouse speed. -----------------
921
Parameters:
921
Parameters:
922
  * eax = 18 - function number
922
  * eax = 18 - function number
923
  * ebx = 19 - subfunction number
923
  * ebx = 19 - subfunction number
924
  * ecx = 0 - subsubfunction number
924
  * ecx = 0 - subsubfunction number
925
Returned value:
925
Returned value:
926
  * eax = current mouse speed
926
  * eax = current mouse speed
927
 
927
 
928
---------------- Subsubfunction 1 - set mouse speed. -----------------
928
---------------- Subsubfunction 1 - set mouse speed. -----------------
929
Parameters:
929
Parameters:
930
  * eax = 18 - function number
930
  * eax = 18 - function number
931
  * ebx = 19 - subfunction number
931
  * ebx = 19 - subfunction number
932
  * ecx = 1 - subsubfunction number
932
  * ecx = 1 - subsubfunction number
933
  * edx = new value for speed
933
  * edx = new value for speed
934
Returned value:
934
Returned value:
935
  * function does not return value
935
  * function does not return value
936
 
936
 
937
---------------- Subsubfunction 2 - get mouse delay. -----------------
937
---------------- Subsubfunction 2 - get mouse delay. -----------------
938
Parameters:
938
Parameters:
939
  * eax = 18 - function number
939
  * eax = 18 - function number
940
  * ebx = 19 - subfunction number
940
  * ebx = 19 - subfunction number
941
  * ecx = 2 - subsubfunction number
941
  * ecx = 2 - subsubfunction number
942
Returned value:
942
Returned value:
943
  * eax = current mouse delay
943
  * eax = current mouse delay
944
 
944
 
945
---------------- Subsubfunction 3 - set mouse delay. -----------------
945
---------------- Subsubfunction 3 - set mouse delay. -----------------
946
Parameters:
946
Parameters:
947
  * eax = 18 - function number
947
  * eax = 18 - function number
948
  * ebx = 19 - subfunction number
948
  * ebx = 19 - subfunction number
949
  * ecx = 3 - subsubfunction number
949
  * ecx = 3 - subsubfunction number
950
  * edx = new value for mouse delay
950
  * edx = new value for mouse delay
951
Returned value:
951
Returned value:
952
  * function does not return value
952
  * function does not return value
953
 
953
 
954
----------- Subsubfunction 4 - set mouse pointer position. -----------
954
----------- Subsubfunction 4 - set mouse pointer position. -----------
955
Parameters:
955
Parameters:
956
  * eax = 18 - function number
956
  * eax = 18 - function number
957
  * ebx = 19 - subfunction number
957
  * ebx = 19 - subfunction number
958
  * ecx = 4 - subsubfunction number
958
  * ecx = 4 - subsubfunction number
959
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
959
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
960
Returned value:
960
Returned value:
961
  * function does not return value
961
  * function does not return value
962
Remarks:
962
Remarks:
963
  * It is recommended to set speed of the mouse (in subsubfunction 1)
963
  * It is recommended to set speed of the mouse (in subsubfunction 1)
964
    from 1 up to 9. The installed value is not inspected by the kernel
964
    from 1 up to 9. The installed value is not inspected by the kernel
965
    code, so set it carefully, at incorrect value the cursor
965
    code, so set it carefully, at incorrect value the cursor
966
    can "freeze". Speed of the mouse can be regulated through the
966
    can "freeze". Speed of the mouse can be regulated through the
967
    application SETUP.
967
    application SETUP.
968
  * Recommended delay of the mouse (in subsubfunction 3) = 10. Lower
968
  * Recommended delay of the mouse (in subsubfunction 3) = 10. Lower
969
    value is not handled by COM mice. At the very large values the
969
    value is not handled by COM mice. At the very large values the
970
    movement of the mouse on 1 pixel is impossible and the cursor will
970
    movement of the mouse on 1 pixel is impossible and the cursor will
971
    jump on the value of installed speed (subsubfunction 1). The
971
    jump on the value of installed speed (subsubfunction 1). The
972
    installed value is not inspected by the kernel code.
972
    installed value is not inspected by the kernel code.
973
    Mouse delay can be regulated through the application SETUP.
973
    Mouse delay can be regulated through the application SETUP.
974
  * The subsubfunction 4 does not check the passed value. Before
974
  * The subsubfunction 4 does not check the passed value. Before
975
    its call find out current screen resolution (with function 14)
975
    its call find out current screen resolution (with function 14)
976
    and check that the value of position is inside the limits of the
976
    and check that the value of position is inside the limits of the
977
    screen.
977
    screen.
978
 
978
 
979
======================================================================
979
======================================================================
980
======== Function 18, subfunction 20 - get information on RAM. =======
980
======== Function 18, subfunction 20 - get information on RAM. =======
981
======================================================================
981
======================================================================
982
Parameters:
982
Parameters:
983
  * eax = 18 - function number
983
  * eax = 18 - function number
984
  * ebx = 20 - subfunction number
984
  * ebx = 20 - subfunction number
985
  * ecx = pointer to the buffer for information (36 bytes)
985
  * ecx = pointer to the buffer for information (36 bytes)
986
Returned value:
986
Returned value:
987
  * eax = total size of existing RAM in pages
987
  * eax = total size of existing RAM in pages
988
    or -1 if error has occured
988
    or -1 if error has occured
989
  * buffer pointed to by ecx contains the following information:
989
  * buffer pointed to by ecx contains the following information:
990
    * +0:  dword: total size of existing RAM in pages
990
    * +0:  dword: total size of existing RAM in pages
991
    * +4:  dword: size of free RAM in pages
991
    * +4:  dword: size of free RAM in pages
992
    * +8:  dword: number of page faults (exceptions #PF)
992
    * +8:  dword: number of page faults (exceptions #PF)
993
                 in applications
993
                 in applications
994
    * +12: dword: size of kernel heap in bytes
994
    * +12: dword: size of kernel heap in bytes
995
    * +16: dword: free in kernel heap in bytes
995
    * +16: dword: free in kernel heap in bytes
996
    * +20: dword: total number of memory blocks in kernel heap
996
    * +20: dword: total number of memory blocks in kernel heap
997
    * +24: dword: number of free memory blocks in kernel heap
997
    * +24: dword: number of free memory blocks in kernel heap
998
    * +28: dword: size of maximum free block in kernel heap
998
    * +28: dword: size of maximum free block in kernel heap
999
                 (reserved)
999
                 (reserved)
1000
    * +32: dword: size of maximum allocated block in kernel heap
1000
    * +32: dword: size of maximum allocated block in kernel heap
1001
                 (reserved)
1001
                 (reserved)
1002
 
1002
 
1003
======================================================================
1003
======================================================================
1004
==================== Function 20 - MIDI interface. ===================
1004
==================== Function 20 - MIDI interface. ===================
1005
======================================================================
1005
======================================================================
1006
 
1006
 
1007
----------------------- Subfunction 1 - reset ------------------------
1007
----------------------- Subfunction 1 - reset ------------------------
1008
Parameters:
1008
Parameters:
1009
  * eax = 20 - function number
1009
  * eax = 20 - function number
1010
  * ebx = 1 - subfunction number
1010
  * ebx = 1 - subfunction number
1011
 
1011
 
1012
-------------------- Subfunction 2 - output byte ---------------------
1012
-------------------- Subfunction 2 - output byte ---------------------
1013
Parameters:
1013
Parameters:
1014
  * eax = 20 - function number
1014
  * eax = 20 - function number
1015
  * ebx = 2 - subfunction number
1015
  * ebx = 2 - subfunction number
1016
  * cl = byte for output
1016
  * cl = byte for output
1017
Returned value (is the same for both subfunctions):
1017
Returned value (is the same for both subfunctions):
1018
  * eax = 0 - success
1018
  * eax = 0 - success
1019
  * eax = 1 - base port is not defined
1019
  * eax = 1 - base port is not defined
1020
Remarks:
1020
Remarks:
1021
  * Previously the base port must be defined by 
1021
  * Previously the base port must be defined by 
1022
    subfunction 1 of function 21.
1022
    subfunction 1 of function 21.
1023
 
1023
 
1024
======================================================================
1024
======================================================================
1025
======== Function 21, subfunction 1 - set MPU MIDI base port. ========
1025
======== Function 21, subfunction 1 - set MPU MIDI base port. ========
1026
======================================================================
1026
======================================================================
1027
Parameters:
1027
Parameters:
1028
  * eax = 21 - function number
1028
  * eax = 21 - function number
1029
  * ebx = 1 - subfunction number
1029
  * ebx = 1 - subfunction number
1030
  * ecx = number of base port
1030
  * ecx = number of base port
1031
Returned value
1031
Returned value
1032
  * eax = 0 - success
1032
  * eax = 0 - success
1033
  * eax = -1 - erratic number of a port
1033
  * eax = -1 - erratic number of a port
1034
Remarks:
1034
Remarks:
1035
  * Number of a port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1035
  * Number of a port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1036
  * The installation of base is necessary for function 20.
1036
  * The installation of base is necessary for function 20.
1037
  * To get base port use subfunction 1 of function 26.
1037
  * To get base port use subfunction 1 of function 26.
1038
 
1038
 
1039
======================================================================
1039
======================================================================
1040
========== Function 21, subfunction 2 - set keyboard layout. =========
1040
========== Function 21, subfunction 2 - set keyboard layout. =========
1041
======================================================================
1041
======================================================================
1042
Keyboard layout is used to convert keyboard scancodes to ASCII-codes,
1042
Keyboard layout is used to convert keyboard scancodes to ASCII-codes,
1043
which will be read by function 2.
1043
which will be read by function 2.
1044
Parameters:
1044
Parameters:
1045
  * eax = 21 - function number
1045
  * eax = 21 - function number
1046
  * ebx = 2 - subfunction number
1046
  * ebx = 2 - subfunction number
1047
  * ecx = which layout to set:
1047
  * ecx = which layout to set:
1048
    * 1 = normal layout
1048
    * 1 = normal layout
1049
    * 2 = layout at pressed Shift
1049
    * 2 = layout at pressed Shift
1050
    * 3 = layout at pressed Alt
1050
    * 3 = layout at pressed Alt
1051
  * edx = pointer to layout - table of length 128 bytes
1051
  * edx = pointer to layout - table of length 128 bytes
1052
Or:
1052
Or:
1053
  * ecx = 9
1053
  * ecx = 9
1054
  * dx = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1054
  * dx = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1055
Returned value:
1055
Returned value:
1056
  * eax = 0 - success
1056
  * eax = 0 - success
1057
  * eax = 1 - incorrect parameter
1057
  * eax = 1 - incorrect parameter
1058
Remarks:
1058
Remarks:
1059
  * If Alt is pressed, the layout with Alt is used;
1059
  * If Alt is pressed, the layout with Alt is used;
1060
    if Alt is not pressed, but Shift is pressed,
1060
    if Alt is not pressed, but Shift is pressed,
1061
    the layout with Shift is used;
1061
    the layout with Shift is used;
1062
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1062
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1063
    layout is used and then from the code is subtracted 0x60;
1063
    layout is used and then from the code is subtracted 0x60;
1064
    if no control key is pressed, the normal layout is used.
1064
    if no control key is pressed, the normal layout is used.
1065
  * To get layout and country identifier use 
1065
  * To get layout and country identifier use 
1066
    subfunction 2 of function 26.
1066
    subfunction 2 of function 26.
1067
  * Country identifier is global system variable, which is not used
1067
  * Country identifier is global system variable, which is not used
1068
    by the kernel itself; however the application '@panel' displays
1068
    by the kernel itself; however the application '@panel' displays
1069
    the corresponding icon.
1069
    the corresponding icon.
1070
  * The application @panel switches layouts on user request.
1070
  * The application @panel switches layouts on user request.
1071
 
1071
 
1072
======================================================================
1072
======================================================================
1073
============== Function 21, subfunction 3 - set CD base. =============
1073
============== Function 21, subfunction 3 - set CD base. =============
1074
======================================================================
1074
======================================================================
1075
Parameters:
1075
Parameters:
1076
  * eax = 21 - function number
1076
  * eax = 21 - function number
1077
  * ebx = 3 - subfunction number
1077
  * ebx = 3 - subfunction number
1078
  * ecx = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1078
  * ecx = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1079
Returned value:
1079
Returned value:
1080
  * eax = 0
1080
  * eax = 0
1081
Remarks:
1081
Remarks:
1082
  * CD base is used by function 24.
1082
  * CD base is used by function 24.
1083
  * To get CD base use subfunction 3 of function 26.
1083
  * To get CD base use subfunction 3 of function 26.
1084
 
1084
 
1085
======================================================================
1085
======================================================================
1086
====== Function 21, subfunction 4 - set Sound Blaster base port. =====
1086
====== Function 21, subfunction 4 - set Sound Blaster base port. =====
1087
======================================================================
1087
======================================================================
1088
Parameters:
1088
Parameters:
1089
  * eax = 21 - function number
1089
  * eax = 21 - function number
1090
  * ebx = 4 - subfunction number
1090
  * ebx = 4 - subfunction number
1091
  * ecx = number of the base port
1091
  * ecx = number of the base port
1092
Returned value:
1092
Returned value:
1093
  * eax = 0 - success
1093
  * eax = 0 - success
1094
  * eax = -1 - erratic port number
1094
  * eax = -1 - erratic port number
1095
Remarks:
1095
Remarks:
1096
  * Number of the port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1096
  * Number of the port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1097
  * The installation of the base is necessary for
1097
  * The installation of the base is necessary for
1098
    functions 25, 28, 55.
1098
    functions 25, 28, 55.
1099
  * To get base port use subfunction 4 of function 26.
1099
  * To get base port use subfunction 4 of function 26.
1100
 
1100
 
1101
======================================================================
1101
======================================================================
1102
========== Function 21, subfunction 5 - set system language. =========
1102
========== Function 21, subfunction 5 - set system language. =========
1103
======================================================================
1103
======================================================================
1104
Parameters:
1104
Parameters:
1105
  * eax = 21 - function number
1105
  * eax = 21 - function number
1106
  * ebx = 5 - subfunction number
1106
  * ebx = 5 - subfunction number
1107
  * ecx = system language (1=eng, 2=fi, 3=ger, 4=rus)
1107
  * ecx = system language (1=eng, 2=fi, 3=ger, 4=rus)
1108
Returned value:
1108
Returned value:
1109
  * eax = 0
1109
  * eax = 0
1110
Remarks:
1110
Remarks:
1111
  * System language is global system variable and is not used
1111
  * System language is global system variable and is not used
1112
    by the kernel itself, however application @panel draws the
1112
    by the kernel itself, however application @panel draws the
1113
    appropriate icon.
1113
    appropriate icon.
1114
  * Function does not check for correctness, as the kernel does not
1114
  * Function does not check for correctness, as the kernel does not
1115
    use this variable.
1115
    use this variable.
1116
  * To get system language use subfunction 5 of function 26.
1116
  * To get system language use subfunction 5 of function 26.
1117
 
1117
 
1118
======================================================================
1118
======================================================================
1119
============== Function 21, subfunction 7 - set HD base. =============
1119
============== Function 21, subfunction 7 - set HD base. =============
1120
======================================================================
1120
======================================================================
1121
The HD base defines hard disk to write with usage of obsolete
1121
The HD base defines hard disk to write with usage of obsolete
1122
file system functions and functions implicitly using the hard disk
1122
file system functions and functions implicitly using the hard disk
1123
(such as subfunction 6 of function 18);
1123
(such as subfunction 6 of function 18);
1124
at usage of function 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1124
at usage of function 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1125
these function set base themselves.
1125
these function set base themselves.
1126
Parameters:
1126
Parameters:
1127
  * eax = 21 - function number
1127
  * eax = 21 - function number
1128
  * ebx = 7 - subfunction number
1128
  * ebx = 7 - subfunction number
1129
  * ecx = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1129
  * ecx = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1130
Returned value:
1130
Returned value:
1131
  * eax = 0
1131
  * eax = 0
1132
Remarks:
1132
Remarks:
1133
  * Any application at any time can change the base.
1133
  * Any application at any time can change the base.
1134
  * Do not change base, when any application works with hard disk.
1134
  * Do not change base, when any application works with hard disk.
1135
    If you do not want system bugs.
1135
    If you do not want system bugs.
1136
  * To get HD base use subfunction 7 of function 26.
1136
  * To get HD base use subfunction 7 of function 26.
1137
  * It is also necessary to define used partition of hard disk by 
1137
  * It is also necessary to define used partition of hard disk by 
1138
    subfunction 8.
1138
    subfunction 8.
1139
 
1139
 
1140
======================================================================
1140
======================================================================
1141
========= Function 21, subfunction 8 - set used HD partition. ========
1141
========= Function 21, subfunction 8 - set used HD partition. ========
1142
======================================================================
1142
======================================================================
1143
The HD partition defines partition of the hard disk to write with
1143
The HD partition defines partition of the hard disk to write with
1144
usage of obsolete file system functions and functions implicitly
1144
usage of obsolete file system functions and functions implicitly
1145
using the hard disk (such as subfunction 6 of function 18);
1145
using the hard disk (such as subfunction 6 of function 18);
1146
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1146
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1147
these functions set base and partition themselves.
1147
these functions set base and partition themselves.
1148
Parameters:
1148
Parameters:
1149
  * eax = 21 - function number
1149
  * eax = 21 - function number
1150
  * ebx = 8 - subfunction number
1150
  * ebx = 8 - subfunction number
1151
  * ecx = HD partition (beginning from 1)
1151
  * ecx = HD partition (beginning from 1)
1152
Return value:
1152
Return value:
1153
  * eax = 0
1153
  * eax = 0
1154
Remarks:
1154
Remarks:
1155
  * Any application at any time can change partition.
1155
  * Any application at any time can change partition.
1156
  * Do not change partition when any application works with hard disk.
1156
  * Do not change partition when any application works with hard disk.
1157
    If you do not want system bugs.
1157
    If you do not want system bugs.
1158
  * To get used partition use subfunction 8 of function 26.
1158
  * To get used partition use subfunction 8 of function 26.
1159
  * There is no correctness checks.
1159
  * There is no correctness checks.
1160
  * To get the number of partitions of a hard disk use 
1160
  * To get the number of partitions of a hard disk use 
1161
    subfunction 11 of function 18.
1161
    subfunction 11 of function 18.
1162
  * It is also necessary to define used HD base by subfunction 7.
1162
  * It is also necessary to define used HD base by subfunction 7.
1163
 
1163
 
1164
======================================================================
1164
======================================================================
1165
======== Function 21, subfunction 10 - set sound DMA channel. ========
1165
======== Function 21, subfunction 10 - set sound DMA channel. ========
1166
======================================================================
1166
======================================================================
1167
Parameters:
1167
Parameters:
1168
  * eax = 21 - function number
1168
  * eax = 21 - function number
1169
  * ebx = 10 - subfunction number
1169
  * ebx = 10 - subfunction number
1170
  * ecx = number of channel (from 0 up to 3 inclusively)
1170
  * ecx = number of channel (from 0 up to 3 inclusively)
1171
Returned value:
1171
Returned value:
1172
  * eax = 0 - success
1172
  * eax = 0 - success
1173
  * eax = -1 - incorrect channel number
1173
  * eax = -1 - incorrect channel number
1174
Remarks:
1174
Remarks:
1175
  * Number of DMA channel is used in subfunction 1 of function 55.
1175
  * Number of DMA channel is used in subfunction 1 of function 55.
1176
  * To get sound DMA channel use subfunction 10 of function 26.
1176
  * To get sound DMA channel use subfunction 10 of function 26.
1177
 
1177
 
1178
======================================================================
1178
======================================================================
1179
 Function 21, subfunction 11 - enable/disable low-level access to HD. 
1179
 Function 21, subfunction 11 - enable/disable low-level access to HD. 
1180
======================================================================
1180
======================================================================
1181
Parameters:
1181
Parameters:
1182
  * eax = 21 - function number
1182
  * eax = 21 - function number
1183
  * ebx = 11 - subfunction number
1183
  * ebx = 11 - subfunction number
1184
  * ecx = 0/1 - disable/enable
1184
  * ecx = 0/1 - disable/enable
1185
Returned value:
1185
Returned value:
1186
  * eax = 0
1186
  * eax = 0
1187
Remarks:
1187
Remarks:
1188
  * Is used in LBA-read (subfunction 8 of function 58).
1188
  * Is used in LBA-read (subfunction 8 of function 58).
1189
  * The current implementation uses only low bit of ecx.
1189
  * The current implementation uses only low bit of ecx.
1190
  * To get current status use subfunction 11 of function 26.
1190
  * To get current status use subfunction 11 of function 26.
1191
 
1191
 
1192
======================================================================
1192
======================================================================
1193
 Function 21, subfunction 12 - enable/disable low-level access to PCI. 
1193
 Function 21, subfunction 12 - enable/disable low-level access to PCI. 
1194
======================================================================
1194
======================================================================
1195
Parameters:
1195
Parameters:
1196
  * eax = 21 - function number
1196
  * eax = 21 - function number
1197
  * ebx = 12 - subfunction number
1197
  * ebx = 12 - subfunction number
1198
  * ecx = 0/1 - disable/enable
1198
  * ecx = 0/1 - disable/enable
1199
Returned value:
1199
Returned value:
1200
  * eax = 0
1200
  * eax = 0
1201
Remarks:
1201
Remarks:
1202
  * Is used in operations with PCI bus (function 62).
1202
  * Is used in operations with PCI bus (function 62).
1203
  * The current implementation uses only low bit of ecx.
1203
  * The current implementation uses only low bit of ecx.
1204
  * To get current status use subfunction 12 of function 26.
1204
  * To get current status use subfunction 12 of function 26.
1205
 
1205
 
1206
======================================================================
1206
======================================================================
1207
============ Function 21, subfunction 13, subsubfunction 1 ===========
1207
============ Function 21, subfunction 13, subsubfunction 1 ===========
1208
======== Initialize + get information on the driver vmode.mdr. =======
1208
======== Initialize + get information on the driver vmode.mdr. =======
1209
======================================================================
1209
======================================================================
1210
Parameters:
1210
Parameters:
1211
  * eax = 21 - function number
1211
  * eax = 21 - function number
1212
  * ebx = 13 - subfunction number
1212
  * ebx = 13 - subfunction number
1213
  * ecx = 1 - number of the driver function
1213
  * ecx = 1 - number of the driver function
1214
  * edx = pointer to 512-bytes buffer
1214
  * edx = pointer to 512-bytes buffer
1215
Returned value:
1215
Returned value:
1216
  * if driver is not loaded
1216
  * if driver is not loaded
1217
    (never happens in the current implementation):
1217
    (never happens in the current implementation):
1218
    * eax = -1
1218
    * eax = -1
1219
    * ebx, ecx destroyed
1219
    * ebx, ecx destroyed
1220
  * if driver is loaded:
1220
  * if driver is loaded:
1221
    * eax = 'MDAZ' (in fasm style, that is 'M' - low byte, 'Z' - high)
1221
    * eax = 'MDAZ' (in fasm style, that is 'M' - low byte, 'Z' - high)
1222
      - signature
1222
      - signature
1223
    * ebx = current frequency of the scanning (in Hz)
1223
    * ebx = current frequency of the scanning (in Hz)
1224
    * ecx destroyed
1224
    * ecx destroyed
1225
    * buffer pointed to by edx is filled
1225
    * buffer pointed to by edx is filled
1226
Format of the buffer:
1226
Format of the buffer:
1227
  * +0: 32*byte: driver name, "Trans VideoDriver"
1227
  * +0: 32*byte: driver name, "Trans VideoDriver"
1228
    (without quotes, supplemented by spaces)
1228
    (without quotes, supplemented by spaces)
1229
  * +32 = +0x20: dword: driver version (version x.y is encoded as
1229
  * +32 = +0x20: dword: driver version (version x.y is encoded as
1230
    y*65536+x), for the current implementation is 1 (1.0)
1230
    y*65536+x), for the current implementation is 1 (1.0)
1231
  * +36 = +0x24: 7*dword: reserved (0 in the current implementation)
1231
  * +36 = +0x24: 7*dword: reserved (0 in the current implementation)
1232
  * +64 = +0x40: 32*word: list of supported videomodes (each word
1232
  * +64 = +0x40: 32*word: list of supported videomodes (each word
1233
    is number of a videomode, after list itself there are zeroes)
1233
    is number of a videomode, after list itself there are zeroes)
1234
  * +128 = +0x80: 32*(5*word): list of supported frequences of the
1234
  * +128 = +0x80: 32*(5*word): list of supported frequences of the
1235
    scannings for videomodes: for each videomode listed in the
1235
    scannings for videomodes: for each videomode listed in the
1236
    previous field up to 5 supported frequences are given
1236
    previous field up to 5 supported frequences are given
1237
    (unused positions contain zeroes)
1237
    (unused positions contain zeroes)
1238
Remarks:
1238
Remarks:
1239
  * Function initializes the driver (if it is not initialized yet)
1239
  * Function initializes the driver (if it is not initialized yet)
1240
    and must be called first, before others (otherwise they will do
1240
    and must be called first, before others (otherwise they will do
1241
    nothing and return -1).
1241
    nothing and return -1).
1242
  * The current implementation supports only one frequency
1242
  * The current implementation supports only one frequency
1243
    of the scanning on videomode.
1243
    of the scanning on videomode.
1244
 
1244
 
1245
======================================================================
1245
======================================================================
1246
============ Function 21, subfunction 13, subsubfunction 2 ===========
1246
============ Function 21, subfunction 13, subsubfunction 2 ===========
1247
================ Get information on current videomode. ===============
1247
================ Get information on current videomode. ===============
1248
======================================================================
1248
======================================================================
1249
Parameters:
1249
Parameters:
1250
  * eax = 21 - function number
1250
  * eax = 21 - function number
1251
  * ebx = 13 - subfunction number
1251
  * ebx = 13 - subfunction number
1252
  * ecx = 2 - number of the driver function
1252
  * ecx = 2 - number of the driver function
1253
Returned value:
1253
Returned value:
1254
  * eax = -1 - driver is not loaded or not initialized;
1254
  * eax = -1 - driver is not loaded or not initialized;
1255
    ebx,ecx are destroyed
1255
    ebx,ecx are destroyed
1256
  * eax = [width]*65536 + [height]
1256
  * eax = [width]*65536 + [height]
1257
  * ebx = frequency of the vertical scanning (in Hz)
1257
  * ebx = frequency of the vertical scanning (in Hz)
1258
  * ecx = number of current videomode
1258
  * ecx = number of current videomode
1259
Remarks:
1259
Remarks:
1260
  * Driver must be initialized by call to 
1260
  * Driver must be initialized by call to 
1261
    driver function 1.
1261
    driver function 1.
1262
  * If only screen sizes are required, it is more expedient to use
1262
  * If only screen sizes are required, it is more expedient to use
1263
    function 14 taking into account that it
1263
    function 14 taking into account that it
1264
    returns sizes on 1 less.
1264
    returns sizes on 1 less.
1265
 
1265
 
1266
======================================================================
1266
======================================================================
1267
=== Function 21, subfunction 13, subsubfunction 3 - set videomode. ===
1267
=== Function 21, subfunction 13, subsubfunction 3 - set videomode. ===
1268
======================================================================
1268
======================================================================
1269
Parameters:
1269
Parameters:
1270
  * eax = 21 - function number
1270
  * eax = 21 - function number
1271
  * ebx = 13 - subfunction number
1271
  * ebx = 13 - subfunction number
1272
  * ecx = 3 - number of the driver function
1272
  * ecx = 3 - number of the driver function
1273
  * edx = [scanning frequency]*65536 + [videomode number]
1273
  * edx = [scanning frequency]*65536 + [videomode number]
1274
Returned value:
1274
Returned value:
1275
  * eax = -1 - driver is not loaded, not initialized or
1275
  * eax = -1 - driver is not loaded, not initialized or
1276
    an error has occured
1276
    an error has occured
1277
  * eax = 0 - success
1277
  * eax = 0 - success
1278
  * ebx, ecx destroyed
1278
  * ebx, ecx destroyed
1279
Remarks:
1279
Remarks:
1280
  * Driver must be initialized by driver function 1.
1280
  * Driver must be initialized by driver function 1.
1281
  * The videomode number and frequency must be in the table
1281
  * The videomode number and frequency must be in the table
1282
    returned by driver function 1.
1282
    returned by driver function 1.
1283
 
1283
 
1284
======================================================================
1284
======================================================================
1285
============ Function 21, subfunction 13, subsubfunction 4 ===========
1285
============ Function 21, subfunction 13, subsubfunction 4 ===========
1286
================== Return to the initial videomode. ==================
1286
================== Return to the initial videomode. ==================
1287
======================================================================
1287
======================================================================
1288
Returns the screen to the videomode set at system boot.
1288
Returns the screen to the videomode set at system boot.
1289
Parameters:
1289
Parameters:
1290
  * eax = 21 - function number
1290
  * eax = 21 - function number
1291
  * ebx = 13 - subfunction number
1291
  * ebx = 13 - subfunction number
1292
  * ecx = 4 - number of the driver function
1292
  * ecx = 4 - number of the driver function
1293
Returned value:
1293
Returned value:
1294
  * eax = -1 - driver is not loaded or not initialized
1294
  * eax = -1 - driver is not loaded or not initialized
1295
  * eax = 0 - success
1295
  * eax = 0 - success
1296
  * ebx, ecx destroyed
1296
  * ebx, ecx destroyed
1297
Remarks:
1297
Remarks:
1298
  * Driver must be initialized by call to driver function 1.
1298
  * Driver must be initialized by call to driver function 1.
1299
 
1299
 
1300
======================================================================
1300
======================================================================
1301
============ Function 21, subfunction 13, subsubfunction 5 ===========
1301
============ Function 21, subfunction 13, subsubfunction 5 ===========
1302
===== Increase/decrease the size of the visible area of monitor. =====
1302
===== Increase/decrease the size of the visible area of monitor. =====
1303
======================================================================
1303
======================================================================
1304
Parameters:
1304
Parameters:
1305
  * eax = 21 - function number
1305
  * eax = 21 - function number
1306
  * ebx = 13 - subfunction number
1306
  * ebx = 13 - subfunction number
1307
  * ecx = 5 - number of the driver function
1307
  * ecx = 5 - number of the driver function
1308
  * edx = 0/1 - decrease/increase horizontal size on 1 position
1308
  * edx = 0/1 - decrease/increase horizontal size on 1 position
1309
  * edx = 2/3 - is not supported in the current implementation;
1309
  * edx = 2/3 - is not supported in the current implementation;
1310
    is planned as decrease/increase vertical size on 1 position
1310
    is planned as decrease/increase vertical size on 1 position
1311
Returned value:
1311
Returned value:
1312
  * eax = -1 - driver is not loaded or not initialized
1312
  * eax = -1 - driver is not loaded or not initialized
1313
  * eax = 0 - success
1313
  * eax = 0 - success
1314
  * ebx, ecx destroyed
1314
  * ebx, ecx destroyed
1315
Remarks:
1315
Remarks:
1316
  * Driver must be initialized by call to driver function 1.
1316
  * Driver must be initialized by call to driver function 1.
1317
  * Function influences only the physical size of the screen image;
1317
  * Function influences only the physical size of the screen image;
1318
    the logical size (number of pixels) does not change.
1318
    the logical size (number of pixels) does not change.
1319
 
1319
 
1320
======================================================================
1320
======================================================================
1321
================= Function 22 - set system date/time. ================
1321
================= Function 22 - set system date/time. ================
1322
======================================================================
1322
======================================================================
1323
Parameters:
1323
Parameters:
1324
  * eax = 22 - function number
1324
  * eax = 22 - function number
1325
  * ebx = 0 - set time
1325
  * ebx = 0 - set time
1326
    * ecx = 0x00SSMMHH - time in the binary-decimal code (BCD):
1326
    * ecx = 0x00SSMMHH - time in the binary-decimal code (BCD):
1327
    * HH=hour 00..23
1327
    * HH=hour 00..23
1328
    * MM=minute 00..59
1328
    * MM=minute 00..59
1329
    * SS=second 00..59
1329
    * SS=second 00..59
1330
  * ebx = 1 - set date
1330
  * ebx = 1 - set date
1331
    * ecx = 0x00DDMMYY - date in the binary-decimal code (BCD):
1331
    * ecx = 0x00DDMMYY - date in the binary-decimal code (BCD):
1332
    * DD=day 01..31
1332
    * DD=day 01..31
1333
    * MM=month 01..12
1333
    * MM=month 01..12
1334
    * YY=year 00..99
1334
    * YY=year 00..99
1335
  * ebx = 2 - set day of week
1335
  * ebx = 2 - set day of week
1336
    * ecx = 1 for Sunday, ..., 7 for Saturday
1336
    * ecx = 1 for Sunday, ..., 7 for Saturday
1337
  * ebx = 3 - set alarm clock
1337
  * ebx = 3 - set alarm clock
1338
    * ecx = 0x00SSMMHH
1338
    * ecx = 0x00SSMMHH
1339
Returned value:
1339
Returned value:
1340
  * eax = 0 - success
1340
  * eax = 0 - success
1341
  * eax = 1 - incorrect parameter
1341
  * eax = 1 - incorrect parameter
1342
  * eax = 2 - CMOS-battery was unloaded
1342
  * eax = 2 - CMOS-battery was unloaded
1343
Remarks:
1343
Remarks:
1344
  * Value of installation of day of week seems to be doubtful,
1344
  * Value of installation of day of week seems to be doubtful,
1345
    as it a little where is used
1345
    as it a little where is used
1346
    (day of week can be calculated by date).
1346
    (day of week can be calculated by date).
1347
  * Alarm clock can be set on operation in the given time every day.
1347
  * Alarm clock can be set on operation in the given time every day.
1348
    But there is no existing system function to disable it.
1348
    But there is no existing system function to disable it.
1349
  * Operation of alarm clock consists in generation IRQ8.
1349
  * Operation of alarm clock consists in generation IRQ8.
1350
  * Generally CMOS supports for alarm clock set of value 0xFF
1350
  * Generally CMOS supports for alarm clock set of value 0xFF
1351
    as one of parameters and it means that the appropriate parameter
1351
    as one of parameters and it means that the appropriate parameter
1352
    is ignored. But current implementation does not allow this
1352
    is ignored. But current implementation does not allow this
1353
    (will return 1).
1353
    (will return 1).
1354
  * Alarm clock is a global system resource; the set of
1354
  * Alarm clock is a global system resource; the set of
1355
    an alarm clock cancels automatically the previous set.
1355
    an alarm clock cancels automatically the previous set.
1356
    However, at moment no program uses it.
1356
    However, at moment no program uses it.
1357
 
1357
 
1358
======================================================================
1358
======================================================================
1359
============= Function 23 - wait for event with timeout. =============
1359
============= Function 23 - wait for event with timeout. =============
1360
======================================================================
1360
======================================================================
1361
If the message queue is empty, waits for new message in the queue,
1361
If the message queue is empty, waits for new message in the queue,
1362
but no more than given time. Then reads out a message from the queue.
1362
but no more than given time. Then reads out a message from the queue.
1363
 
1363
 
1364
Parameters:
1364
Parameters:
1365
  * eax = 23 - function number
1365
  * eax = 23 - function number
1366
  * ebx = timeout (in 1/100 of second)
1366
  * ebx = timeout (in 1/100 of second)
1367
Returned value:
1367
Returned value:
1368
  * eax = 0 - the message queue is empty
1368
  * eax = 0 - the message queue is empty
1369
  * otherwise eax = event (see the list of events)
1369
  * otherwise eax = event (see the list of events)
1370
Remarks:
1370
Remarks:
1371
  * Only those events are taken into account, which enter into
1371
  * Only those events are taken into account, which enter into
1372
    the mask set by function 40. By default it is
1372
    the mask set by function 40. By default it is
1373
    redraw, key and button events.
1373
    redraw, key and button events.
1374
  * To check for presence of a message in the queue use function 11.
1374
  * To check for presence of a message in the queue use function 11.
1375
    To wait without timeout use function 10.
1375
    To wait without timeout use function 10.
1376
  * Transmission ebx=0 results in immediate returning eax=0.
1376
  * Transmission ebx=0 results in immediate returning eax=0.
1377
  * Current implementation returns immediately with eax=0,
1377
  * Current implementation returns immediately with eax=0,
1378
    if the addition of ebx with the current value of time counter
1378
    if the addition of ebx with the current value of time counter
1379
    makes 32-bit overflow.
1379
    makes 32-bit overflow.
1380
 
1380
 
1381
======================================================================
1381
======================================================================
1382
======== Function 24, subfunction 1 - begin to play CD-audio. ========
1382
======== Function 24, subfunction 1 - begin to play CD-audio. ========
1383
======================================================================
1383
======================================================================
1384
Parameters:
1384
Parameters:
1385
  * eax = 24 - function number
1385
  * eax = 24 - function number
1386
  * ebx = 1 - subfunction number
1386
  * ebx = 1 - subfunction number
1387
  * ecx = 0x00FRSSMM, where
1387
  * ecx = 0x00FRSSMM, where
1388
    * MM = starting minute
1388
    * MM = starting minute
1389
    * SS = starting second
1389
    * SS = starting second
1390
    * FR = starting frame
1390
    * FR = starting frame
1391
Returned value:
1391
Returned value:
1392
  * eax = 0 - success
1392
  * eax = 0 - success
1393
  * eax = 1 - CD base is not defined
1393
  * eax = 1 - CD base is not defined
1394
Remarks:
1394
Remarks:
1395
  * Previously CD base must be defined by the call to 
1395
  * Previously CD base must be defined by the call to 
1396
    subfunction 3 of function 21.
1396
    subfunction 3 of function 21.
1397
  * One second includes 75 frames, one minute includes 60 seconds.
1397
  * One second includes 75 frames, one minute includes 60 seconds.
1398
  * The function is asynchronous (returns control, when play begins).
1398
  * The function is asynchronous (returns control, when play begins).
1399
 
1399
 
1400
======================================================================
1400
======================================================================
1401
======= Function 24, subfunction 2 - get information on tracks. ======
1401
======= Function 24, subfunction 2 - get information on tracks. ======
1402
======================================================================
1402
======================================================================
1403
Parameters:
1403
Parameters:
1404
  * eax = 24 - function number
1404
  * eax = 24 - function number
1405
  * ebx = 2 - subfunction number
1405
  * ebx = 2 - subfunction number
1406
  * ecx = pointer to the buffer for the table
1406
  * ecx = pointer to the buffer for the table
1407
    (maximum 8*64h+4 bytes=100 tracks)
1407
    (maximum 8*64h+4 bytes=100 tracks)
1408
Returned value:
1408
Returned value:
1409
  * eax = 0 - success
1409
  * eax = 0 - success
1410
  * eax = 1 - CD base is not defined
1410
  * eax = 1 - CD base is not defined
1411
Remarks:
1411
Remarks:
1412
  * The format of the table with tracks information is the same as
1412
  * The format of the table with tracks information is the same as
1413
    for ATAPI-CD command 43h (READ TOC), usual table (subcommand 00h).
1413
    for ATAPI-CD command 43h (READ TOC), usual table (subcommand 00h).
1414
    Function returns addresses in MSF.
1414
    Function returns addresses in MSF.
1415
  * Previously CD base port must be set by call to 
1415
  * Previously CD base port must be set by call to 
1416
    subfunction 3 of function 21.
1416
    subfunction 3 of function 21.
1417
  * Function returns information only about no more than 100
1417
  * Function returns information only about no more than 100
1418
    first tracks. In most cases it is enough.
1418
    first tracks. In most cases it is enough.
1419
 
1419
 
1420
======================================================================
1420
======================================================================
1421
========== Function 24, subfunction 3 - stop play CD-audio. ==========
1421
========== Function 24, subfunction 3 - stop play CD-audio. ==========
1422
======================================================================
1422
======================================================================
1423
Parameters:
1423
Parameters:
1424
  * eax = 24 - function number
1424
  * eax = 24 - function number
1425
  * ebx = 1 - subfunction number
1425
  * ebx = 1 - subfunction number
1426
Returned value:
1426
Returned value:
1427
  * eax = 0 - success
1427
  * eax = 0 - success
1428
  * eax = 1 - CD base is not defined
1428
  * eax = 1 - CD base is not defined
1429
Çàìå÷àíèÿ:
1429
Çàìå÷àíèÿ:
1430
  * Previously CD base port must be defined by call to 
1430
  * Previously CD base port must be defined by call to 
1431
    subfunction 3 of function 21.
1431
    subfunction 3 of function 21.
1432
 
1432
 
1433
======================================================================
1433
======================================================================
1434
=================== Function 25 - set SBPro volume. ==================
1434
=================== Function 25 - set SBPro volume. ==================
1435
======================================================================
1435
======================================================================
1436
Parameters:
1436
Parameters:
1437
  * eax = 25 - function number
1437
  * eax = 25 - function number
1438
  * ebx = what to set:
1438
  * ebx = what to set:
1439
    * 1 - set common volume
1439
    * 1 - set common volume
1440
    * 2 - set CD-audio volume
1440
    * 2 - set CD-audio volume
1441
  * cl = volume level: high 4 bits for the left column,
1441
  * cl = volume level: high 4 bits for the left column,
1442
    low 4 bits for the right one
1442
    low 4 bits for the right one
1443
Returned value:
1443
Returned value:
1444
  * eax = 0 - success
1444
  * eax = 0 - success
1445
  * eax = 1 - SB base is not defined
1445
  * eax = 1 - SB base is not defined
1446
  * eax = 2 - incorrect subfunction
1446
  * eax = 2 - incorrect subfunction
1447
Remarks:
1447
Remarks:
1448
  * Previously SB base port must be defined by 
1448
  * Previously SB base port must be defined by 
1449
    subfunction 4 of function 21.
1449
    subfunction 4 of function 21.
1450
  * See also function 28 which sets
1450
  * See also function 28 which sets
1451
    volume for the later standard SB16.
1451
    volume for the later standard SB16.
1452
 
1452
 
1453
======================================================================
1453
======================================================================
1454
======== Function 26, subfunction 1 - get MPU MIDI base port. ========
1454
======== Function 26, subfunction 1 - get MPU MIDI base port. ========
1455
======================================================================
1455
======================================================================
1456
Parameters:
1456
Parameters:
1457
  * eax = 26 - function number
1457
  * eax = 26 - function number
1458
  * ebx = 1 - subfunction number
1458
  * ebx = 1 - subfunction number
1459
Returned value:
1459
Returned value:
1460
  * eax = port number
1460
  * eax = port number
1461
Parameters:
1461
Parameters:
1462
  * To set base port use subfunction 1 of function 21.
1462
  * To set base port use subfunction 1 of function 21.
1463
 
1463
 
1464
======================================================================
1464
======================================================================
1465
========== Function 26, subfunction 2 - get keyboard layout. =========
1465
========== Function 26, subfunction 2 - get keyboard layout. =========
1466
======================================================================
1466
======================================================================
1467
The keyboard layout is used to convert keyboard scancodes to
1467
The keyboard layout is used to convert keyboard scancodes to
1468
ASCII-codes for function 2.
1468
ASCII-codes for function 2.
1469
Parameters:
1469
Parameters:
1470
  * eax = 26 - function number
1470
  * eax = 26 - function number
1471
  * ebx = 2 - subfunction number
1471
  * ebx = 2 - subfunction number
1472
  * ecx = what layout to get:
1472
  * ecx = what layout to get:
1473
    * 1 = normal layout
1473
    * 1 = normal layout
1474
    * 2 = layout with pressed Shift
1474
    * 2 = layout with pressed Shift
1475
    * 3 = layout with pressed Alt
1475
    * 3 = layout with pressed Alt
1476
  * edx = pointer to the 128-bytes buffer, where the layout will be
1476
  * edx = pointer to the 128-bytes buffer, where the layout will be
1477
    copied
1477
    copied
1478
Returned value:
1478
Returned value:
1479
  * function does not return value
1479
  * function does not return value
1480
Or:
1480
Or:
1481
  * eax = 26 - function number
1481
  * eax = 26 - function number
1482
  * ebx = 2 - subfunction number
1482
  * ebx = 2 - subfunction number
1483
  * ecx = 9
1483
  * ecx = 9
1484
Returned value:
1484
Returned value:
1485
  * eax = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1485
  * eax = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1486
Remarks:
1486
Remarks:
1487
  * If Alt is pressed, the layout with Alt is used;
1487
  * If Alt is pressed, the layout with Alt is used;
1488
    if Alt is not pressed, but Shift is pressed,
1488
    if Alt is not pressed, but Shift is pressed,
1489
    the layout with Shift is used;
1489
    the layout with Shift is used;
1490
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1490
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1491
    layout is used and then from the code is subtracted 0x60;
1491
    layout is used and then from the code is subtracted 0x60;
1492
    if no control key is pressed, the normal layout is used.
1492
    if no control key is pressed, the normal layout is used.
1493
  * To set layout and country identifier use 
1493
  * To set layout and country identifier use 
1494
    subfunction 2 of function 21.
1494
    subfunction 2 of function 21.
1495
  * Country identifier is global system variable, which is not used
1495
  * Country identifier is global system variable, which is not used
1496
    by the kernel itself; however the application '@panel' displays
1496
    by the kernel itself; however the application '@panel' displays
1497
    the corresponding icon (using this function).
1497
    the corresponding icon (using this function).
1498
  * The application @panel switches layouts on user request.
1498
  * The application @panel switches layouts on user request.
1499
 
1499
 
1500
======================================================================
1500
======================================================================
1501
============== Function 26, subfunction 3 - get CD base. =============
1501
============== Function 26, subfunction 3 - get CD base. =============
1502
======================================================================
1502
======================================================================
1503
Parameters:
1503
Parameters:
1504
  * eax = 26 - function number
1504
  * eax = 26 - function number
1505
  * ebx = 3 - subfunction number
1505
  * ebx = 3 - subfunction number
1506
Returned value:
1506
Returned value:
1507
  * eax = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1507
  * eax = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1508
Remarks:
1508
Remarks:
1509
  * CD base is used by function 24.
1509
  * CD base is used by function 24.
1510
  * To set CD base use subfunction 3 of function 21.
1510
  * To set CD base use subfunction 3 of function 21.
1511
 
1511
 
1512
======================================================================
1512
======================================================================
1513
====== Function 26, subfunction 4 - get Sound Blaster base port. =====
1513
====== Function 26, subfunction 4 - get Sound Blaster base port. =====
1514
======================================================================
1514
======================================================================
1515
Parameters:
1515
Parameters:
1516
  * eax = 26 - function number
1516
  * eax = 26 - function number
1517
  * ebx = 4 - subfunction number
1517
  * ebx = 4 - subfunction number
1518
Returned value:
1518
Returned value:
1519
  * eax = base port number
1519
  * eax = base port number
1520
Remarks:
1520
Remarks:
1521
  * Bae port is used by functions 25, 55.
1521
  * Bae port is used by functions 25, 55.
1522
  * To set base port use subfunction 4 of function 21.
1522
  * To set base port use subfunction 4 of function 21.
1523
 
1523
 
1524
======================================================================
1524
======================================================================
1525
========== Function 26, subfunction 5 - get system language. =========
1525
========== Function 26, subfunction 5 - get system language. =========
1526
======================================================================
1526
======================================================================
1527
Parameters:
1527
Parameters:
1528
  * eax = 26 - function number
1528
  * eax = 26 - function number
1529
  * ebx = 5 - subfunction number
1529
  * ebx = 5 - subfunction number
1530
Returned value:
1530
Returned value:
1531
  * eax = system language (1=eng, 2=fi, 3=ger, 4=rus)
1531
  * eax = system language (1=eng, 2=fi, 3=ger, 4=rus)
1532
Remarks:
1532
Remarks:
1533
  * System language is global system variable and is not used
1533
  * System language is global system variable and is not used
1534
    by the kernel itself, however application @panel draws the
1534
    by the kernel itself, however application @panel draws the
1535
    appropriate icon (using this function).
1535
    appropriate icon (using this function).
1536
  * To set system language use subfunction 5 of function 21.
1536
  * To set system language use subfunction 5 of function 21.
1537
 
1537
 
1538
======================================================================
1538
======================================================================
1539
============== Function 26, subfunction 7 - get HD base. =============
1539
============== Function 26, subfunction 7 - get HD base. =============
1540
======================================================================
1540
======================================================================
1541
The HD base defines hard disk to write with usage of obsolete
1541
The HD base defines hard disk to write with usage of obsolete
1542
file system functions and functions implicitly using the hard disk
1542
file system functions and functions implicitly using the hard disk
1543
(such as subfunction 6 of function 18);
1543
(such as subfunction 6 of function 18);
1544
at usage of function 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1544
at usage of function 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1545
these function set base themselves.
1545
these function set base themselves.
1546
Parameters:
1546
Parameters:
1547
  * eax = 26 - function number
1547
  * eax = 26 - function number
1548
  * ebx = 7 - subfunction number
1548
  * ebx = 7 - subfunction number
1549
Returned value:
1549
Returned value:
1550
  * eax = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1550
  * eax = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1551
Remarks:
1551
Remarks:
1552
  * Any application in any time can change HD base.
1552
  * Any application in any time can change HD base.
1553
  * To set base use subfunction 7 of function 21.
1553
  * To set base use subfunction 7 of function 21.
1554
  * To get used partition of hard disk use subfunction 8.
1554
  * To get used partition of hard disk use subfunction 8.
1555
 
1555
 
1556
======================================================================
1556
======================================================================
1557
========= Function 26, subfunction 8 - get used HD partition. ========
1557
========= Function 26, subfunction 8 - get used HD partition. ========
1558
======================================================================
1558
======================================================================
1559
The HD partition defines partition of the hard disk to write with
1559
The HD partition defines partition of the hard disk to write with
1560
usage of obsolete file system functions and functions implicitly
1560
usage of obsolete file system functions and functions implicitly
1561
using the hard disk (such as subfunction 6 of function 18);
1561
using the hard disk (such as subfunction 6 of function 18);
1562
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1562
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1563
these functions set base and partition themselves.
1563
these functions set base and partition themselves.
1564
Parameters:
1564
Parameters:
1565
  * eax = 26 - function number
1565
  * eax = 26 - function number
1566
  * ebx = 8 - subfunction number
1566
  * ebx = 8 - subfunction number
1567
Returned value:
1567
Returned value:
1568
  * eax = HD partition (beginning from 1)
1568
  * eax = HD partition (beginning from 1)
1569
Remarks:
1569
Remarks:
1570
  * Any application in any time can change partition.
1570
  * Any application in any time can change partition.
1571
  * To set partition use subfunction 8 of function 21.
1571
  * To set partition use subfunction 8 of function 21.
1572
  * To get number of partitions on a hard disk use
1572
  * To get number of partitions on a hard disk use
1573
    subfunction 11 of function 18.
1573
    subfunction 11 of function 18.
1574
  * To get base of used hard disk, use subfunction 7.
1574
  * To get base of used hard disk, use subfunction 7.
1575
 
1575
 
1576
======================================================================
1576
======================================================================
1577
=== Function 26, subfunction 9 - get the value of the time counter. ==
1577
=== Function 26, subfunction 9 - get the value of the time counter. ==
1578
======================================================================
1578
======================================================================
1579
Parameters:
1579
Parameters:
1580
  * eax = 26 - function number
1580
  * eax = 26 - function number
1581
  * ebx = 9 - subfunction number
1581
  * ebx = 9 - subfunction number
1582
Returned value:
1582
Returned value:
1583
  * eax = number of 1/100s of second, past from the system boot time
1583
  * eax = number of 1/100s of second, past from the system boot time
1584
Remarks:
1584
Remarks:
1585
  * Counter takes modulo 2^32, that correspond to a little more
1585
  * Counter takes modulo 2^32, that correspond to a little more
1586
    than 497 days.
1586
    than 497 days.
1587
  * To get system time use function 3.
1587
  * To get system time use function 3.
1588
 
1588
 
1589
======================================================================
1589
======================================================================
1590
======== Function 26, subfunction 10 - get sound DMA channel. ========
1590
======== Function 26, subfunction 10 - get sound DMA channel. ========
1591
======================================================================
1591
======================================================================
1592
Parameters:
1592
Parameters:
1593
  * eax = 26 - function number
1593
  * eax = 26 - function number
1594
  * ebx = 10 - subfunction number
1594
  * ebx = 10 - subfunction number
1595
Returned value:
1595
Returned value:
1596
  * eax = number of the channel (from 0 to 3 inclusive)
1596
  * eax = number of the channel (from 0 to 3 inclusive)
1597
Remarks:
1597
Remarks:
1598
  * Number of the DMA channel is used by subfunction 1 of function 55.
1598
  * Number of the DMA channel is used by subfunction 1 of function 55.
1599
  * To set the sound DMA channel use subfunction 10 of function 21.
1599
  * To set the sound DMA channel use subfunction 10 of function 21.
1600
 
1600
 
1601
======================================================================
1601
======================================================================
1602
===================== Function 26, subfunction 11 ====================
1602
===================== Function 26, subfunction 11 ====================
1603
========== Find out whether low-level HD access is enabled. ==========
1603
========== Find out whether low-level HD access is enabled. ==========
1604
======================================================================
1604
======================================================================
1605
Parameters:
1605
Parameters:
1606
  * eax = 26 - function number
1606
  * eax = 26 - function number
1607
  * ebx = 11 - subfunction number
1607
  * ebx = 11 - subfunction number
1608
Returned value:
1608
Returned value:
1609
  * eax = 0/1 - disabled/enabled
1609
  * eax = 0/1 - disabled/enabled
1610
Remarks:
1610
Remarks:
1611
  * Is used in LBA read (subfunction 8 of function 58).
1611
  * Is used in LBA read (subfunction 8 of function 58).
1612
  * To set current state use subfunction 11 of function 21.
1612
  * To set current state use subfunction 11 of function 21.
1613
 
1613
 
1614
======================================================================
1614
======================================================================
1615
===================== Function 26, subfunction 12 ====================
1615
===================== Function 26, subfunction 12 ====================
1616
========== Find out whether low-level PCI access is enabled. =========
1616
========== Find out whether low-level PCI access is enabled. =========
1617
======================================================================
1617
======================================================================
1618
Parameters:
1618
Parameters:
1619
  * eax = 26 - function number
1619
  * eax = 26 - function number
1620
  * ebx = 12 - subfunction number
1620
  * ebx = 12 - subfunction number
1621
Returned value:
1621
Returned value:
1622
  * eax = 0/1 - disabled/enabled
1622
  * eax = 0/1 - disabled/enabled
1623
Remarks:
1623
Remarks:
1624
  * Is used by operations with PCI bus (function 62).
1624
  * Is used by operations with PCI bus (function 62).
1625
  * The current implementation uses only low bit of ecx.
1625
  * The current implementation uses only low bit of ecx.
1626
  * To set the current state use subfunction 12 of function 21.
1626
  * To set the current state use subfunction 12 of function 21.
1627
 
1627
 
1628
======================================================================
1628
======================================================================
1629
=================== Function 28 - set SB16 volume. ===================
1629
=================== Function 28 - set SB16 volume. ===================
1630
======================================================================
1630
======================================================================
1631
Parameters:
1631
Parameters:
1632
  * eax = 28 - function number
1632
  * eax = 28 - function number
1633
  * ebx = what to install:
1633
  * ebx = what to install:
1634
    * 1 - install common volume
1634
    * 1 - install common volume
1635
    * 2 - install CD-audio volume
1635
    * 2 - install CD-audio volume
1636
  * cl = volume level (0=off, 0xFF=max)
1636
  * cl = volume level (0=off, 0xFF=max)
1637
Returned value:
1637
Returned value:
1638
  * eax = 0 - success
1638
  * eax = 0 - success
1639
  * eax = 1 - SB base is not defined
1639
  * eax = 1 - SB base is not defined
1640
  * eax = 2 - incorrect subfunction
1640
  * eax = 2 - incorrect subfunction
1641
Remarks:
1641
Remarks:
1642
  * Previously SB base port must be defined by
1642
  * Previously SB base port must be defined by
1643
    subfunction 4 of function 21.
1643
    subfunction 4 of function 21.
1644
  * This function gives more variants for volume, that function 25.
1644
  * This function gives more variants for volume, that function 25.
1645
 
1645
 
1646
======================================================================
1646
======================================================================
1647
=================== Function 29 - get system date. ===================
1647
=================== Function 29 - get system date. ===================
1648
======================================================================
1648
======================================================================
1649
Parameters:
1649
Parameters:
1650
  * eax = 29 - function number
1650
  * eax = 29 - function number
1651
Returned value:
1651
Returned value:
1652
  * eax = 0x00DDMMYY, where
1652
  * eax = 0x00DDMMYY, where
1653
    (binary-decimal coding, BCD, is used)
1653
    (binary-decimal coding, BCD, is used)
1654
  * YY = two low digits of year (00..99)
1654
  * YY = two low digits of year (00..99)
1655
  * MM = month (01..12)
1655
  * MM = month (01..12)
1656
  * DD = day (01..31)
1656
  * DD = day (01..31)
1657
Remarks:
1657
Remarks:
1658
  * To set system date use function 22.
1658
  * To set system date use function 22.
1659
 
1659
 
1660
======================================================================
1660
======================================================================
1661
=============== Function 32 - delete file from ramdisk. ==============
1661
=============== Function 32 - delete file from ramdisk. ==============
1662
======================================================================
1662
======================================================================
1663
Parameters:
1663
Parameters:
1664
  * eax = 32 - function number
1664
  * eax = 32 - function number
1665
  * ebx = pointer to the filename
1665
  * ebx = pointer to the filename
1666
Returned value:
1666
Returned value:
1667
  * eax = 0 - success; otherwise file system error code
1667
  * eax = 0 - success; otherwise file system error code
1668
Remarks:
1668
Remarks:
1669
  * This function is obsolete; function 58 allows to fulfill
1669
  * This function is obsolete; function 58 allows to fulfill
1670
    the same operations with the extended possibilities.
1670
    the same operations with the extended possibilities.
1671
  * The current implementation returns only values 0(success) and
1671
  * The current implementation returns only values 0(success) and
1672
    5(file not found).
1672
    5(file not found).
1673
  * The filename must be either in the format 8+3 characters
1673
  * The filename must be either in the format 8+3 characters
1674
    (first 8 characters - name itself, last 3 - extension,
1674
    (first 8 characters - name itself, last 3 - extension,
1675
    the short names and extensions are supplemented with spaces),
1675
    the short names and extensions are supplemented with spaces),
1676
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1676
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1677
    (name no more than 8 characters, dot, extension 3 characters
1677
    (name no more than 8 characters, dot, extension 3 characters
1678
    supplemented if necessary by spaces).
1678
    supplemented if necessary by spaces).
1679
    The filename must be written with capital letters. The terminating
1679
    The filename must be written with capital letters. The terminating
1680
    character with code 0 is not necessary (not ASCIIZ-string).
1680
    character with code 0 is not necessary (not ASCIIZ-string).
1681
  * This function does not support folders on the ramdisk.
1681
  * This function does not support folders on the ramdisk.
1682
 
1682
 
1683
======================================================================
1683
======================================================================
1684
================ Function 33 - write file to ramdisk. ================
1684
================ Function 33 - write file to ramdisk. ================
1685
======================================================================
1685
======================================================================
1686
Parameters:
1686
Parameters:
1687
  * eax = 33 - function number
1687
  * eax = 33 - function number
1688
  * ebx = pointer to the filename
1688
  * ebx = pointer to the filename
1689
  * ecx = pointer to data for writing
1689
  * ecx = pointer to data for writing
1690
  * edx = number of bytes for writing
1690
  * edx = number of bytes for writing
1691
  * should be set esi=0
1691
  * should be set esi=0
1692
Returned value:
1692
Returned value:
1693
  * eax = 0 - success, otherwise file system error code
1693
  * eax = 0 - success, otherwise file system error code
1694
Remarks:
1694
Remarks:
1695
  * This function is obsolete; function 70 allows to fulfil
1695
  * This function is obsolete; function 70 allows to fulfil
1696
    the same operations with extended possibilities.
1696
    the same operations with extended possibilities.
1697
  * If esi contains non-zero value and selected file already exists,
1697
  * If esi contains non-zero value and selected file already exists,
1698
    one more file with the same name will be created.
1698
    one more file with the same name will be created.
1699
  * Otherwise file will be overwritten.
1699
  * Otherwise file will be overwritten.
1700
  * The filename must be either in the format 8+3 characters
1700
  * The filename must be either in the format 8+3 characters
1701
    (first 8 characters - name itself, last 3 - extension,
1701
    (first 8 characters - name itself, last 3 - extension,
1702
    the short names and extensions are supplemented with spaces),
1702
    the short names and extensions are supplemented with spaces),
1703
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1703
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1704
    (name no more than 8 characters, dot, extension 3 characters
1704
    (name no more than 8 characters, dot, extension 3 characters
1705
    supplemented if necessary by spaces).
1705
    supplemented if necessary by spaces).
1706
    The filename must be written with capital letters. The terminating
1706
    The filename must be written with capital letters. The terminating
1707
    character with code 0 is not necessary (not ASCIIZ-string).
1707
    character with code 0 is not necessary (not ASCIIZ-string).
1708
  * This function does not support folders on the ramdisk.
1708
  * This function does not support folders on the ramdisk.
1709
 
1709
 
1710
======================================================================
1710
======================================================================
1711
======= Function 35 - read the color of a pixel on the screen. =======
1711
======= Function 35 - read the color of a pixel on the screen. =======
1712
======================================================================
1712
======================================================================
1713
Parameters:
1713
Parameters:
1714
  * eax = 35
1714
  * eax = 35
1715
  * ebx = y*xsize+x, where
1715
  * ebx = y*xsize+x, where
1716
  * (x,y) = coordinates of a pixel (beginning from 0)
1716
  * (x,y) = coordinates of a pixel (beginning from 0)
1717
  * xsize = horizontal screen size
1717
  * xsize = horizontal screen size
1718
Returned value:
1718
Returned value:
1719
  * eax = color 0x00RRGGBB
1719
  * eax = color 0x00RRGGBB
1720
Remarks:
1720
Remarks:
1721
  * To get screen sizes use function 14. Pay attention,
1721
  * To get screen sizes use function 14. Pay attention,
1722
    that it subtracts 1 from both sizes.
1722
    that it subtracts 1 from both sizes.
1723
  * There is also direct access (without any system calls)
1723
  * There is also direct access (without any system calls)
1724
    to videomemory through the selector gs. To get parameters of
1724
    to videomemory through the selector gs. To get parameters of
1725
    the current videomode, use function 61.
1725
    the current videomode, use function 61.
1726
 
1726
 
1727
======================================================================
1727
======================================================================
1728
=================== Function 37 - work with mouse. ===================
1728
=================== Function 37 - work with mouse. ===================
1729
======================================================================
1729
======================================================================
1730
 
1730
 
1731
---------- Subfunction 0 - screen coordinates of the mouse -----------
1731
---------- Subfunction 0 - screen coordinates of the mouse -----------
1732
Parameters:
1732
Parameters:
1733
  * eax = 37 - function number
1733
  * eax = 37 - function number
1734
  * ebx = 0 - subfunction number
1734
  * ebx = 0 - subfunction number
1735
Returned value:
1735
Returned value:
1736
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1736
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1737
    (beginning from 0)
1737
    (beginning from 0)
1738
 
1738
 
1739
-- Subfunction 1 - coordinates of the mouse relative to the window ---
1739
-- Subfunction 1 - coordinates of the mouse relative to the window ---
1740
Parameters:
1740
Parameters:
1741
  * eax = 37 - function number
1741
  * eax = 37 - function number
1742
  * ebx = 1 - subfunction number
1742
  * ebx = 1 - subfunction number
1743
Returned value:
1743
Returned value:
1744
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1744
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1745
    relative to the application window (beginning from 0)
1745
    relative to the application window (beginning from 0)
1746
Remarks:
1746
Remarks:
1747
  * The value is calculated by formula (x-xwnd)*65536 + (y-ywnd).
1747
  * The value is calculated by formula (x-xwnd)*65536 + (y-ywnd).
1748
    If y>=ywnd, the low word is non-negative and contains
1748
    If y>=ywnd, the low word is non-negative and contains
1749
    relative y-coordinate, and the high word - relative x-coordinate
1749
    relative y-coordinate, and the high word - relative x-coordinate
1750
    (with correct sign). Otherwise the low word is negative and still
1750
    (with correct sign). Otherwise the low word is negative and still
1751
    contains relative y-coordinate, and to the high word
1751
    contains relative y-coordinate, and to the high word
1752
    1 should be added.
1752
    1 should be added.
1753
 
1753
 
1754
------------ Subfunction 2 - pressed buttons of the mouse ------------
1754
------------ Subfunction 2 - pressed buttons of the mouse ------------
1755
Parameters:
1755
Parameters:
1756
  * eax = 37 - function number
1756
  * eax = 37 - function number
1757
  * ebx = 2 - subfunction number
1757
  * ebx = 2 - subfunction number
1758
Returned value:
1758
Returned value:
1759
  * eax contains information on the pressed mouse buttons:
1759
  * eax contains information on the pressed mouse buttons:
1760
  * bit 0 is set = left button is pressed
1760
  * bit 0 is set = left button is pressed
1761
  * bit 1 is set = right button is pressed
1761
  * bit 1 is set = right button is pressed
1762
  * other bits are cleared
1762
  * other bits are cleared
1763
 
1763
 
1764
-------------------- Subfunction 4 - load cursor ---------------------
1764
-------------------- Subfunction 4 - load cursor ---------------------
1765
Parameters:
1765
Parameters:
1766
  * eax = 37 - function number
1766
  * eax = 37 - function number
1767
  * ebx = 4 - subfunction number
1767
  * ebx = 4 - subfunction number
1768
  * dx = data source:
1768
  * dx = data source:
1769
  * dx = LOAD_FROM_FILE = 0 - data in a file
1769
  * dx = LOAD_FROM_FILE = 0 - data in a file
1770
    * ecx = pointer to full path to the cursor file
1770
    * ecx = pointer to full path to the cursor file
1771
    * the file must be in the format .cur, which is standard for
1771
    * the file must be in the format .cur, which is standard for
1772
      MS Windows, at that of the size 32*32 pixels
1772
      MS Windows, at that of the size 32*32 pixels
1773
  * dx = LOAD_FROM_MEM = 1 - data of file are already loaded in memory
1773
  * dx = LOAD_FROM_MEM = 1 - data of file are already loaded in memory
1774
    * ecx = pointer to data of the cursor file
1774
    * ecx = pointer to data of the cursor file
1775
    * the data format is the same as in the previous case
1775
    * the data format is the same as in the previous case
1776
  * dx = LOAD_INDIRECT = 2 - data in memory
1776
  * dx = LOAD_INDIRECT = 2 - data in memory
1777
    * ecx = pointer to cursor image in the format ARGB 32*32 pixels
1777
    * ecx = pointer to cursor image in the format ARGB 32*32 pixels
1778
    * edx = 0xXXYY0002, where
1778
    * edx = 0xXXYY0002, where
1779
      * XX = x-coordinate of cursor hotspot
1779
      * XX = x-coordinate of cursor hotspot
1780
      * YY = y-coordinate
1780
      * YY = y-coordinate
1781
      * 0 <= XX, YY <= 31
1781
      * 0 <= XX, YY <= 31
1782
Returned value:
1782
Returned value:
1783
  * eax = 0 - failed
1783
  * eax = 0 - failed
1784
  * otherwise eax = cursor handle
1784
  * otherwise eax = cursor handle
1785
 
1785
 
1786
--------------------- Subfunction 5 - set cursor ---------------------
1786
--------------------- Subfunction 5 - set cursor ---------------------
1787
Sets new cursor for the window of the current thread.
1787
Sets new cursor for the window of the current thread.
1788
Parameters:
1788
Parameters:
1789
  * eax = 37 - function number
1789
  * eax = 37 - function number
1790
  * ebx = 5 - subfunction number
1790
  * ebx = 5 - subfunction number
1791
  * ecx = cursor handle
1791
  * ecx = cursor handle
1792
Returned value:
1792
Returned value:
1793
  * eax = handle of previous cursor
1793
  * eax = handle of previous cursor
1794
Remarks:
1794
Remarks:
1795
  * If the handle is incorrect, the function restores the default
1795
  * If the handle is incorrect, the function restores the default
1796
    cursor (standard arrow). In particular, ecx=0 restores it.
1796
    cursor (standard arrow). In particular, ecx=0 restores it.
1797
 
1797
 
1798
------------------- Subfunction 6 - delete cursor --------------------
1798
------------------- Subfunction 6 - delete cursor --------------------
1799
Parameters:
1799
Parameters:
1800
  * eax = 37 - function number
1800
  * eax = 37 - function number
1801
  * ebx = 6 - subfunction number
1801
  * ebx = 6 - subfunction number
1802
  * ecx = cursor handle
1802
  * ecx = cursor handle
1803
Returned value:
1803
Returned value:
1804
  * eax destroyed
1804
  * eax destroyed
1805
Remarks:
1805
Remarks:
1806
  * The cursor must be loaded previously by the current thread
1806
  * The cursor must be loaded previously by the current thread
1807
    (with the call to subfunction 4). The function does not delete
1807
    (with the call to subfunction 4). The function does not delete
1808
    system cursors and cursors, loaded by another applications.
1808
    system cursors and cursors, loaded by another applications.
1809
  * If the active cursor (set by subfunction 5) is deleted,
1809
  * If the active cursor (set by subfunction 5) is deleted,
1810
    the system restores the default cursor (standard arrow).
1810
    the system restores the default cursor (standard arrow).
1811
 
1811
 
1812
======================================================================
1812
======================================================================
1813
====================== Function 38 - draw line. ======================
1813
====================== Function 38 - draw line. ======================
1814
======================================================================
1814
======================================================================
1815
Parameters:
1815
Parameters:
1816
  * eax = 38 - function number
1816
  * eax = 38 - function number
1817
  * ebx = [start coordinate on axis x]*65536 +
1817
  * ebx = [start coordinate on axis x]*65536 +
1818
              [end coordinate on axis x]
1818
              [end coordinate on axis x]
1819
  * ecx = [start coordinate on axis y]*65536 +
1819
  * ecx = [start coordinate on axis y]*65536 +
1820
              [end coordinate on axis y]
1820
              [end coordinate on axis y]
1821
  * edx = 0x00RRGGBB - color
1821
  * edx = 0x00RRGGBB - color
1822
    edx = 0x01xxxxxx - draw inversed line
1822
    edx = 0x01xxxxxx - draw inversed line
1823
          (low 24 bits are ignored)
1823
          (low 24 bits are ignored)
1824
Returned value:
1824
Returned value:
1825
  * function does not return value
1825
  * function does not return value
1826
Remarks:
1826
Remarks:
1827
  * Coordinates are relative to the window.
1827
  * Coordinates are relative to the window.
1828
  * End point is also drawn.
1828
  * End point is also drawn.
1829
 
1829
 
1830
======================================================================
1830
======================================================================
1831
== Function 39, subfunction 1 - get a size of the background image. ==
1831
== Function 39, subfunction 1 - get a size of the background image. ==
1832
======================================================================
1832
======================================================================
1833
Parameters:
1833
Parameters:
1834
  * eax = 39 - function number
1834
  * eax = 39 - function number
1835
  * ebx = 1 - subfunction number
1835
  * ebx = 1 - subfunction number
1836
Returned value:
1836
Returned value:
1837
  * eax = [width]*65536 + [height]
1837
  * eax = [width]*65536 + [height]
1838
Remarks:
1838
Remarks:
1839
  * There is a pair function to set sizes of background image -
1839
  * There is a pair function to set sizes of background image -
1840
    subfunction 1 of function 15. After which it is necessary,
1840
    subfunction 1 of function 15. After which it is necessary,
1841
    of course, anew to define image.
1841
    of course, anew to define image.
1842
 
1842
 
1843
======================================================================
1843
======================================================================
1844
== Function 39, subfunction 2 - get pixel from the background image. =
1844
== Function 39, subfunction 2 - get pixel from the background image. =
1845
======================================================================
1845
======================================================================
1846
Parameters:
1846
Parameters:
1847
  * eax = 39 - function number
1847
  * eax = 39 - function number
1848
  * ebx = 2 - subfunction number
1848
  * ebx = 2 - subfunction number
1849
  * ecx = offset
1849
  * ecx = offset
1850
Returned value:
1850
Returned value:
1851
  * eax = 0x00RRGGBB - pixel color, if offset is valid
1851
  * eax = 0x00RRGGBB - pixel color, if offset is valid
1852
    (less than 0x160000-16)
1852
    (less than 0x160000-16)
1853
  * eax = 2 otherwise
1853
  * eax = 2 otherwise
1854
Remarks:
1854
Remarks:
1855
  * Do not rely on returned value for invalid offsets, it may be
1855
  * Do not rely on returned value for invalid offsets, it may be
1856
    changed in future kernel versions.
1856
    changed in future kernel versions.
1857
  * Offset for pixel with coordinates (x,y)
1857
  * Offset for pixel with coordinates (x,y)
1858
    is calculated as (x+y*xsize)*3.
1858
    is calculated as (x+y*xsize)*3.
1859
  * There is a pair function to set pixel on the background image - 
1859
  * There is a pair function to set pixel on the background image - 
1860
    subfunction 2 of function 15.
1860
    subfunction 2 of function 15.
1861
 
1861
 
1862
======================================================================
1862
======================================================================
1863
== Function 39, subfunction 4 - get drawing mode for the background. =
1863
== Function 39, subfunction 4 - get drawing mode for the background. =
1864
======================================================================
1864
======================================================================
1865
Parameters:
1865
Parameters:
1866
  * eax = 39 - function number
1866
  * eax = 39 - function number
1867
  * ebx = 4 - subfunction number
1867
  * ebx = 4 - subfunction number
1868
Returned value:
1868
Returned value:
1869
  * eax = 1 - tile
1869
  * eax = 1 - tile
1870
  * eax = 2 - stretch
1870
  * eax = 2 - stretch
1871
Remarks:
1871
Remarks:
1872
  * There is a pair function to set drawing mode - 
1872
  * There is a pair function to set drawing mode - 
1873
    subfunction 4 of function 15.
1873
    subfunction 4 of function 15.
1874
 
1874
 
1875
======================================================================
1875
======================================================================
1876
=========== Function 40 - set the mask for expected events. ==========
1876
=========== Function 40 - set the mask for expected events. ==========
1877
======================================================================
1877
======================================================================
1878
The mask for expected events affects function working with events
1878
The mask for expected events affects function working with events
1879
10, 11, 23 - they notify only about events allowed by this mask.
1879
10, 11, 23 - they notify only about events allowed by this mask.
1880
Parameters:
1880
Parameters:
1881
  * eax = 40 - function number
1881
  * eax = 40 - function number
1882
  * ebx = mask: bit i corresponds to event i+1 (see list of events)
1882
  * ebx = mask: bit i corresponds to event i+1 (see list of events)
1883
    (set bit permits notice on event)
1883
    (set bit permits notice on event)
1884
Returned value:
1884
Returned value:
1885
  * function does not return value
1885
  * function does not return value
1886
Remarks:
1886
Remarks:
1887
  * Default mask (7=111b) enables nofices about redraw,
1887
  * Default mask (7=111b) enables nofices about redraw,
1888
    keys and buttons. This is enough for many applications.
1888
    keys and buttons. This is enough for many applications.
1889
  * Events prohibited in the mask are saved anyway, when come;
1889
  * Events prohibited in the mask are saved anyway, when come;
1890
    they are simply not informed with event functions.
1890
    they are simply not informed with event functions.
1891
  * Event functions take into account the mask on moment of
1891
  * Event functions take into account the mask on moment of
1892
    function call, not on moment of event arrival.
1892
    function call, not on moment of event arrival.
1893
 
1893
 
1894
======================================================================
1894
======================================================================
1895
==================== Function 41 - get IRQ owner. ====================
1895
==================== Function 41 - get IRQ owner. ====================
1896
======================================================================
1896
======================================================================
1897
Parameters:
1897
Parameters:
1898
  * eax = 41 - function number
1898
  * eax = 41 - function number
1899
  * ebx = IRQ number, 0..15
1899
  * ebx = IRQ number, 0..15
1900
Returned value:
1900
Returned value:
1901
  * eax = owner PID
1901
  * eax = owner PID
1902
  * eax = 0, if there is no owner
1902
  * eax = 0, if there is no owner
1903
  * eax = -1 for incorrect ebx
1903
  * eax = -1 for incorrect ebx
1904
 
1904
 
1905
======================================================================
1905
======================================================================
1906
==================== Function 42 - read IRQ data. ====================
1906
==================== Function 42 - read IRQ data. ====================
1907
======================================================================
1907
======================================================================
1908
When an IRQ occurs, the system reads data from ports indicated
1908
When an IRQ occurs, the system reads data from ports indicated
1909
earlier by function 44 and writes this data to
1909
earlier by function 44 and writes this data to
1910
internal buffer. This function reads out data from that buffer
1910
internal buffer. This function reads out data from that buffer
1911
bytewise.
1911
bytewise.
1912
Parameters:
1912
Parameters:
1913
  * eax = 42 - function number
1913
  * eax = 42 - function number
1914
  * ebx = IRQ number, 0..15
1914
  * ebx = IRQ number, 0..15
1915
Returned value: (use value of ecx to distinguish)
1915
Returned value: (use value of ecx to distinguish)
1916
  * if the thread is not IRQ owner (or IRQ number is incorrect):
1916
  * if the thread is not IRQ owner (or IRQ number is incorrect):
1917
    * ecx = 2
1917
    * ecx = 2
1918
  * if there is no data:
1918
  * if there is no data:
1919
    * eax = 0
1919
    * eax = 0
1920
    * ecx = 1
1920
    * ecx = 1
1921
    * ebx destroyed
1921
    * ebx destroyed
1922
  * if all is ok:
1922
  * if all is ok:
1923
    * eax = byte size of data, not yet read from buffer
1923
    * eax = byte size of data, not yet read from buffer
1924
    * ecx = 0
1924
    * ecx = 0
1925
    * ebx = current byte
1925
    * ebx = current byte
1926
Remarks:
1926
Remarks:
1927
  * Previously the thread must reserve indicated IRQ for itself
1927
  * Previously the thread must reserve indicated IRQ for itself
1928
    by function 45.
1928
    by function 45.
1929
  * The size of data buffer is 4000 bytes, on overflow
1929
  * The size of data buffer is 4000 bytes, on overflow
1930
    "fresh" data cease to be written in the buffer.
1930
    "fresh" data cease to be written in the buffer.
1931
 
1931
 
1932
======================================================================
1932
======================================================================
1933
================ Function 43 - input/output to a port. ===============
1933
================ Function 43 - input/output to a port. ===============
1934
======================================================================
1934
======================================================================
1935
 
1935
 
1936
------------------------ Output data to port -------------------------
1936
------------------------ Output data to port -------------------------
1937
Parameters:
1937
Parameters:
1938
  * eax = 43 - function number
1938
  * eax = 43 - function number
1939
  * bl = byte for output
1939
  * bl = byte for output
1940
  * ecx = port number 0xnnnn (from 0 to 0xFFFF)
1940
  * ecx = port number 0xnnnn (from 0 to 0xFFFF)
1941
Returned value:
1941
Returned value:
1942
  * eax = 0 - success
1942
  * eax = 0 - success
1943
  * eax = 1 - the thread has not reserved the selected port
1943
  * eax = 1 - the thread has not reserved the selected port
1944
 
1944
 
1945
------------------------ Input data from port ------------------------
1945
------------------------ Input data from port ------------------------
1946
Parameters:
1946
Parameters:
1947
  * eax = 43 - function number
1947
  * eax = 43 - function number
1948
  * ebx is ignored
1948
  * ebx is ignored
1949
  * ecx = 0x8000nnnn, where nnnn = port number (from 0 to 0xFFFF)
1949
  * ecx = 0x8000nnnn, where nnnn = port number (from 0 to 0xFFFF)
1950
Returned value:
1950
Returned value:
1951
  * eax = 0 - success, thus ebx = entered byte
1951
  * eax = 0 - success, thus ebx = entered byte
1952
  * eax = 1 - the thread has not reserved the selected port
1952
  * eax = 1 - the thread has not reserved the selected port
1953
Remarks:
1953
Remarks:
1954
  * Previously the thread must reserve the selected port
1954
  * Previously the thread must reserve the selected port
1955
    for itself by function 46.
1955
    for itself by function 46.
1956
  * Instead of call to this function it is better to use
1956
  * Instead of call to this function it is better to use
1957
    processor instructions in/out - this is much
1957
    processor instructions in/out - this is much
1958
    faster and a bit shorter and easier.
1958
    faster and a bit shorter and easier.
1959
 
1959
 
1960
======================================================================
1960
======================================================================
1961
=========== Function 44 - define operations at IRQ arrival. ==========
1961
=========== Function 44 - define operations at IRQ arrival. ==========
1962
======================================================================
1962
======================================================================
1963
At IRQ arrival the system can read the data from ports defined
1963
At IRQ arrival the system can read the data from ports defined
1964
by this function and write these data to internal buffer, whence
1964
by this function and write these data to internal buffer, whence
1965
they can be read by ôóíêöèåé 42.
1965
they can be read by ôóíêöèåé 42.
1966
Parameters:
1966
Parameters:
1967
  * eax = 44 - function number
1967
  * eax = 44 - function number
1968
  * ebx = pointer to the array of structures each describing one port:
1968
  * ebx = pointer to the array of structures each describing one port:
1969
    * +0: word: 0 means end of array, otherwise port number
1969
    * +0: word: 0 means end of array, otherwise port number
1970
    * +2: byte: reserved (ignored)
1970
    * +2: byte: reserved (ignored)
1971
    * +3: byte: 1=read byte from this port, 2=read word
1971
    * +3: byte: 1=read byte from this port, 2=read word
1972
  * ecx = IRQ number, 0..15
1972
  * ecx = IRQ number, 0..15
1973
Returned value:
1973
Returned value:
1974
  * eax = 0 - success
1974
  * eax = 0 - success
1975
  * eax = 1 - the thread is not owner of selected IRQ
1975
  * eax = 1 - the thread is not owner of selected IRQ
1976
Remarks:
1976
Remarks:
1977
  * Previously the thread must reserve for itself selected IRQ
1977
  * Previously the thread must reserve for itself selected IRQ
1978
    by function 45.
1978
    by function 45.
1979
  * First 16 ports are considered only.
1979
  * First 16 ports are considered only.
1980
  * The current implementation considers incorrect value of field +3
1980
  * The current implementation considers incorrect value of field +3
1981
    as a signal to terminate IRQ processing.
1981
    as a signal to terminate IRQ processing.
1982
 
1982
 
1983
======================================================================
1983
======================================================================
1984
=================== Function 45 - reserve/free IRQ. ==================
1984
=================== Function 45 - reserve/free IRQ. ==================
1985
======================================================================
1985
======================================================================
1986
Parameters:
1986
Parameters:
1987
  * eax = 45 - function number
1987
  * eax = 45 - function number
1988
  * ebx = 0 - reserve, 1 = free
1988
  * ebx = 0 - reserve, 1 = free
1989
  * ecx = IRQ number, 0..15
1989
  * ecx = IRQ number, 0..15
1990
Returned value:
1990
Returned value:
1991
  * eax = 0 - success
1991
  * eax = 0 - success
1992
  * eax = 1 - error (invalid IRQ number
1992
  * eax = 1 - error (invalid IRQ number
1993
    or attempt to reserve not free IRQ
1993
    or attempt to reserve not free IRQ
1994
    or to free IRQ, not reserved by this thread)
1994
    or to free IRQ, not reserved by this thread)
1995
Remarks:
1995
Remarks:
1996
  * IRQ reservation is required for functions 42 and 44.
1996
  * IRQ reservation is required for functions 42 and 44.
1997
  * Only one thread can reserve the specific IRQ.
1997
  * Only one thread can reserve the specific IRQ.
1998
  * IRQs, handled by the system itself, are reserved by the system
1998
  * IRQs, handled by the system itself, are reserved by the system
1999
    (thread 1) at booting.
1999
    (thread 1) at booting.
2000
  * When a thread terminates, all reserved by it IRQs
2000
  * When a thread terminates, all reserved by it IRQs
2001
    are freed automatically.
2001
    are freed automatically.
2002
 
2002
 
2003
======================================================================
2003
======================================================================
2004
====== Function 46 - reserve/free a group of input/output ports. =====
2004
====== Function 46 - reserve/free a group of input/output ports. =====
2005
======================================================================
2005
======================================================================
2006
To work with reserved ports an application can access directly by
2006
To work with reserved ports an application can access directly by
2007
commands in/out (recommended way) and can use function 43
2007
commands in/out (recommended way) and can use function 43
2008
(not recommended way).
2008
(not recommended way).
2009
Parameters:
2009
Parameters:
2010
  * eax = 46 - function number
2010
  * eax = 46 - function number
2011
  * ebx = 0 - reserve, 1 - free
2011
  * ebx = 0 - reserve, 1 - free
2012
  * ecx = start port number
2012
  * ecx = start port number
2013
  * edx = end port number (inclusive)
2013
  * edx = end port number (inclusive)
2014
Returned value:
2014
Returned value:
2015
  * eax = 0 - success
2015
  * eax = 0 - success
2016
  * eax = 1 - error
2016
  * eax = 1 - error
2017
Remarks:
2017
Remarks:
2018
  * For ports reservation: an error occurs if and only if
2018
  * For ports reservation: an error occurs if and only if
2019
    one from the following condition satisfies:
2019
    one from the following condition satisfies:
2020
    * start port is more than end port;
2020
    * start port is more than end port;
2021
    * the selected range contains incorrect port number
2021
    * the selected range contains incorrect port number
2022
      (correct are from 0 to 0xFFFF);
2022
      (correct are from 0 to 0xFFFF);
2023
    * limit for the total number of reserved areas is exceeded
2023
    * limit for the total number of reserved areas is exceeded
2024
      (maximum 255 are allowed);
2024
      (maximum 255 are allowed);
2025
    * the selected range intersects with any of earlier reserved
2025
    * the selected range intersects with any of earlier reserved
2026
  * For ports free: an error is an attempt to free range,
2026
  * For ports free: an error is an attempt to free range,
2027
    that was not earlier reserved by this function
2027
    that was not earlier reserved by this function
2028
    (with same ecx,edx).
2028
    (with same ecx,edx).
2029
  * If an error occurs (for both cases) function performs no action.
2029
  * If an error occurs (for both cases) function performs no action.
2030
  * At booting the system reserves for itself ports
2030
  * At booting the system reserves for itself ports
2031
    0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (inclusively).
2031
    0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (inclusively).
2032
  * When a thread terminates, all reserved by it ports
2032
  * When a thread terminates, all reserved by it ports
2033
    are freed automatically.
2033
    are freed automatically.
2034
 
2034
 
2035
======================================================================
2035
======================================================================
2036
============= Function 47 - draw a number in the window. =============
2036
============= Function 47 - draw a number in the window. =============
2037
======================================================================
2037
======================================================================
2038
Parameters:
2038
Parameters:
2039
  * eax = 47 - function number
2039
  * eax = 47 - function number
2040
  * ebx = parameters of conversion number to text:
2040
  * ebx = parameters of conversion number to text:
2041
    * bl = 0 - ecx contains number
2041
    * bl = 0 - ecx contains number
2042
    * bl = 1 - ecx contains pointer to dword-number
2042
    * bl = 1 - ecx contains pointer to dword-number
2043
    * bh = 0 - display in decimal number system
2043
    * bh = 0 - display in decimal number system
2044
    * bh = 1 - display in hexadecimal system
2044
    * bh = 1 - display in hexadecimal system
2045
    * bh = 2 - display in binary system
2045
    * bh = 2 - display in binary system
2046
    * áèòû 16-21 = how many digits to display
2046
    * áèòû 16-21 = how many digits to display
2047
    * áèòû 22-31 reserved and must be set to 0
2047
    * áèòû 22-31 reserved and must be set to 0
2048
  * ecx = number (if bl=0) or pointer (if bl=1)
2048
  * ecx = number (if bl=0) or pointer (if bl=1)
2049
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
2049
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
2050
  * esi = 0xX0RRGGBB:
2050
  * esi = 0xX0RRGGBB:
2051
    * RR, GG, BB specify the color
2051
    * RR, GG, BB specify the color
2052
    * X = ABnn (bits)
2052
    * X = ABnn (bits)
2053
    * nn = font (0/1)
2053
    * nn = font (0/1)
2054
    * A is ignored
2054
    * A is ignored
2055
    * B=1 - fill background with the color edi
2055
    * B=1 - fill background with the color edi
2056
Returned value:
2056
Returned value:
2057
  * function does not return value
2057
  * function does not return value
2058
Remarks:
2058
Remarks:
2059
  * The given length must not exceed 60.
2059
  * The given length must not exceed 60.
2060
  * The exactly given amount of digits is output. If number is small
2060
  * The exactly given amount of digits is output. If number is small
2061
    and can be written by smaller amount of digits, it is supplemented
2061
    and can be written by smaller amount of digits, it is supplemented
2062
    by leading zeroes; if the number is big and can not be written by
2062
    by leading zeroes; if the number is big and can not be written by
2063
    given amount of digits, extra digits are not drawn.
2063
    given amount of digits, extra digits are not drawn.
2064
  * Parameters of fonts are shown in the description of function 4
2064
  * Parameters of fonts are shown in the description of function 4
2065
    (text output).
2065
    (text output).
2066
 
2066
 
2067
======================================================================
2067
======================================================================
2068
========= Function 48, subfunction 0 - apply screen settings. ========
2068
========= Function 48, subfunction 0 - apply screen settings. ========
2069
======================================================================
2069
======================================================================
2070
Parameters:
2070
Parameters:
2071
  * eax = 48 - function number
2071
  * eax = 48 - function number
2072
  * ebx = 0 - subfunction number
2072
  * ebx = 0 - subfunction number
2073
  * ecx = 0 - reserved
2073
  * ecx = 0 - reserved
2074
Returned value:
2074
Returned value:
2075
  * function does not return value
2075
  * function does not return value
2076
Remarks:
2076
Remarks:
2077
  * Function redraws the screen after parameters change by
2077
  * Function redraws the screen after parameters change by
2078
    subfunctions 1 and 2.
2078
    subfunctions 1 and 2.
2079
  * Function call without prior call to one of indicated subfunctions
2079
  * Function call without prior call to one of indicated subfunctions
2080
    is ignored.
2080
    is ignored.
2081
  * Function call with nonzero ecx is ignored.
2081
  * Function call with nonzero ecx is ignored.
2082
 
2082
 
2083
======================================================================
2083
======================================================================
2084
=========== Function 48, subfunction 1 - set button style. ===========
2084
=========== Function 48, subfunction 1 - set button style. ===========
2085
======================================================================
2085
======================================================================
2086
Parameters:
2086
Parameters:
2087
  * eax = 48 - function number
2087
  * eax = 48 - function number
2088
  * ebx = 1 - subfunction number
2088
  * ebx = 1 - subfunction number
2089
  * ecx = button style:
2089
  * ecx = button style:
2090
    * 0 = flat
2090
    * 0 = flat
2091
    * 1 = 3d
2091
    * 1 = 3d
2092
Returned value:
2092
Returned value:
2093
  * function does not return value
2093
  * function does not return value
2094
Remarks:
2094
Remarks:
2095
  * After call to this function one should redraw the screen by
2095
  * After call to this function one should redraw the screen by
2096
    subfunction 0.
2096
    subfunction 0.
2097
  * Button style influences only to their draw of function 8.
2097
  * Button style influences only to their draw of function 8.
2098
 
2098
 
2099
======================================================================
2099
======================================================================
2100
====== Function 48, subfunction 2 - set standard window colors. ======
2100
====== Function 48, subfunction 2 - set standard window colors. ======
2101
======================================================================
2101
======================================================================
2102
Parameters:
2102
Parameters:
2103
  * eax = 48 - function number
2103
  * eax = 48 - function number
2104
  * ebx = 2 - subfunction number
2104
  * ebx = 2 - subfunction number
2105
  * ecx = pointer to the color table
2105
  * ecx = pointer to the color table
2106
  * edx = size of the color table
2106
  * edx = size of the color table
2107
    (must be 40 bytes for future compatibility)
2107
    (must be 40 bytes for future compatibility)
2108
Format of the color table is shown in description of subfunction 3.
2108
Format of the color table is shown in description of subfunction 3.
2109
Returned value:
2109
Returned value:
2110
  * function does not return value
2110
  * function does not return value
2111
Remarks:
2111
Remarks:
2112
  * After call to this function one should redraw the screen by
2112
  * After call to this function one should redraw the screen by
2113
    subfunction 0.
2113
    subfunction 0.
2114
  * Table of standard colors influences only to applications,
2114
  * Table of standard colors influences only to applications,
2115
    which receive this table obviously (by subfunction 3)
2115
    which receive this table obviously (by subfunction 3)
2116
    and use it (specifying colors from it to drawing functions).
2116
    and use it (specifying colors from it to drawing functions).
2117
  * Table of standard colors is included in skin and is installed
2117
  * Table of standard colors is included in skin and is installed
2118
    anew with skin installation (by subfunction 8).
2118
    anew with skin installation (by subfunction 8).
2119
  * Color table can be viewed/changed interactively with
2119
  * Color table can be viewed/changed interactively with
2120
    the application 'desktop'.
2120
    the application 'desktop'.
2121
 
2121
 
2122
======================================================================
2122
======================================================================
2123
====== Function 48, subfunction 3 - get standard window colors. ======
2123
====== Function 48, subfunction 3 - get standard window colors. ======
2124
======================================================================
2124
======================================================================
2125
Parameters:
2125
Parameters:
2126
  * eax = 48 - function number
2126
  * eax = 48 - function number
2127
  * ebx = 3 - subfunction number
2127
  * ebx = 3 - subfunction number
2128
  * ecx = pointer to the buffer with size edx bytes,
2128
  * ecx = pointer to the buffer with size edx bytes,
2129
    where table will be written
2129
    where table will be written
2130
  * edx = size of color table
2130
  * edx = size of color table
2131
    (must be 40 bytes for future compatibility)
2131
    (must be 40 bytes for future compatibility)
2132
Returned value:
2132
Returned value:
2133
  * function does not return value
2133
  * function does not return value
2134
Format of the color table:
2134
Format of the color table:
2135
each item is dword-value for color 0x00RRGGBB
2135
each item is dword-value for color 0x00RRGGBB
2136
  * +0: dword: frames - color of frame
2136
  * +0: dword: frames - color of frame
2137
  * +4: dword: grab - color of header
2137
  * +4: dword: grab - color of header
2138
  * +8: dword: grab_button - color of button on header bar
2138
  * +8: dword: grab_button - color of button on header bar
2139
  * +12 = +0xC: dword: grab_button_text - color of text on button
2139
  * +12 = +0xC: dword: grab_button_text - color of text on button
2140
    on header bar
2140
    on header bar
2141
  * +16 = +0x10: dword: grab_text - color of text on header
2141
  * +16 = +0x10: dword: grab_text - color of text on header
2142
  * +20 = +0x14: dword: work - color of working area
2142
  * +20 = +0x14: dword: work - color of working area
2143
  * +24 = +0x18: dword: work_button - color of button in working area
2143
  * +24 = +0x18: dword: work_button - color of button in working area
2144
  * +28 = +0x1C: dword: work_button_text - color of text on button
2144
  * +28 = +0x1C: dword: work_button_text - color of text on button
2145
    in working area
2145
    in working area
2146
  * +32 = +0x20: dword: work_text - color of text in working area
2146
  * +32 = +0x20: dword: work_text - color of text in working area
2147
  * +36 = +0x24: dword: work_graph - color of graphics in working area
2147
  * +36 = +0x24: dword: work_graph - color of graphics in working area
2148
Remarks:
2148
Remarks:
2149
  * Structure of the color table is described in the standard
2149
  * Structure of the color table is described in the standard
2150
    include file 'macros.inc' as 'system_colors'; for example,
2150
    include file 'macros.inc' as 'system_colors'; for example,
2151
    it is possible to write:
2151
    it is possible to write:
2152
    	sc	system_colors		; variable declaration
2152
    	sc	system_colors		; variable declaration
2153
    	...				; somewhere one must call
2153
    	...				; somewhere one must call
2154
    					; this function with ecx=sc
2154
    					; this function with ecx=sc
2155
    	mov	ecx, [sc.work_button_text]	; read text color on
2155
    	mov	ecx, [sc.work_button_text]	; read text color on
2156
    					; buttin in working area
2156
    					; buttin in working area
2157
  * A program itself desides to use or not to use color table.
2157
  * A program itself desides to use or not to use color table.
2158
    For usage program must simply at calls to drawing functions select
2158
    For usage program must simply at calls to drawing functions select
2159
    color taken from the table.
2159
    color taken from the table.
2160
  * At change of the table of standard colors (by subfunction 2 with
2160
  * At change of the table of standard colors (by subfunction 2 with
2161
    the subsequent application of changes by subfunction 0 or
2161
    the subsequent application of changes by subfunction 0 or
2162
    at skin set by subfunction 8) the system sends to all windows
2162
    at skin set by subfunction 8) the system sends to all windows
2163
    redraw message (the event with code 1).
2163
    redraw message (the event with code 1).
2164
  * Color table can be viewed/changed interactively with
2164
  * Color table can be viewed/changed interactively with
2165
    the application 'desktop'.
2165
    the application 'desktop'.
2166
 
2166
 
2167
======================================================================
2167
======================================================================
2168
============ Function 48, subfunction 4 - get skin height. ===========
2168
============ Function 48, subfunction 4 - get skin height. ===========
2169
======================================================================
2169
======================================================================
2170
Parameters:
2170
Parameters:
2171
  * eax = 48 - function number
2171
  * eax = 48 - function number
2172
  * ebx = 4 - subfunction number
2172
  * ebx = 4 - subfunction number
2173
Returned value:
2173
Returned value:
2174
  * eax = skin height
2174
  * eax = skin height
2175
Remarks:
2175
Remarks:
2176
  * Skin height is defined as the height of a header
2176
  * Skin height is defined as the height of a header
2177
    of skinned windows.
2177
    of skinned windows.
2178
  * See also general structure of window in the description
2178
  * See also general structure of window in the description
2179
    of function 0.
2179
    of function 0.
2180
 
2180
 
2181
======================================================================
2181
======================================================================
2182
======== Function 48, subfunction 5 - get screen working area. =======
2182
======== Function 48, subfunction 5 - get screen working area. =======
2183
======================================================================
2183
======================================================================
2184
Parameters:
2184
Parameters:
2185
  * eax = 48 - function number
2185
  * eax = 48 - function number
2186
  * ebx = 5 - subfunction number
2186
  * ebx = 5 - subfunction number
2187
Returned value:
2187
Returned value:
2188
  * eax = [left]*65536 + [right]
2188
  * eax = [left]*65536 + [right]
2189
  * ebx = [top]*65536 + [bottom]
2189
  * ebx = [top]*65536 + [bottom]
2190
Remarks:
2190
Remarks:
2191
  * The screen working area defines position and coordinates of
2191
  * The screen working area defines position and coordinates of
2192
    a maximized window.
2192
    a maximized window.
2193
  * The screen working area in view of normal work is all screen
2193
  * The screen working area in view of normal work is all screen
2194
    without system panel (the application '@panel').
2194
    without system panel (the application '@panel').
2195
  * (left,top) are coordinates of the left upper corner,
2195
  * (left,top) are coordinates of the left upper corner,
2196
    (right,bottom) are coordinates of the right lower one.
2196
    (right,bottom) are coordinates of the right lower one.
2197
    Thus the size of working area on x axis can be calculated by
2197
    Thus the size of working area on x axis can be calculated by
2198
    formula right-left+1, on y axis - by formula bottom-right+1.
2198
    formula right-left+1, on y axis - by formula bottom-right+1.
2199
  * See also function 14,
2199
  * See also function 14,
2200
    to get sizes of all screen.
2200
    to get sizes of all screen.
2201
  * There is a pair function to set working area - subfunction 6.
2201
  * There is a pair function to set working area - subfunction 6.
2202
 
2202
 
2203
======================================================================
2203
======================================================================
2204
======== Function 48, subfunction 6 - set screen working area. =======
2204
======== Function 48, subfunction 6 - set screen working area. =======
2205
======================================================================
2205
======================================================================
2206
Parameters:
2206
Parameters:
2207
  * eax = 48 - function number
2207
  * eax = 48 - function number
2208
  * ebx = 6 - subfunction number
2208
  * ebx = 6 - subfunction number
2209
  * ecx = [left]*65536 + [right]
2209
  * ecx = [left]*65536 + [right]
2210
  * edx = [top]*65536 + [bottom]
2210
  * edx = [top]*65536 + [bottom]
2211
Returned value:
2211
Returned value:
2212
  * function does not return value
2212
  * function does not return value
2213
Remarks:
2213
Remarks:
2214
  * The screen working area defines position and coordinates of
2214
  * The screen working area defines position and coordinates of
2215
    a maximized window.
2215
    a maximized window.
2216
  * This function is used only by the application '@panel',
2216
  * This function is used only by the application '@panel',
2217
    which set working area to all screen without system panel.
2217
    which set working area to all screen without system panel.
2218
  * (left,top) are coordinates of the left upper corner,
2218
  * (left,top) are coordinates of the left upper corner,
2219
    (right,bottom) are coordinates of the right lower one.
2219
    (right,bottom) are coordinates of the right lower one.
2220
    Thus the size of working area on x axis can be calculated by
2220
    Thus the size of working area on x axis can be calculated by
2221
    formula right-left+1, on y axis - by formula bottom-right+1.
2221
    formula right-left+1, on y axis - by formula bottom-right+1.
2222
  * If 'left'>='right', x-coordinate of working area is not changed.
2222
  * If 'left'>='right', x-coordinate of working area is not changed.
2223
    If 'left'<0, 'left' will not be set. If 'right' is greater than or
2223
    If 'left'<0, 'left' will not be set. If 'right' is greater than or
2224
    equal to screen width, 'right' will not be set.
2224
    equal to screen width, 'right' will not be set.
2225
    Similarly on y axis.
2225
    Similarly on y axis.
2226
  * See also function 14,
2226
  * See also function 14,
2227
    to get sizes of all screen.
2227
    to get sizes of all screen.
2228
  * There is a pair function to get working area - subfunction 5.
2228
  * There is a pair function to get working area - subfunction 5.
2229
  * This function redraws the screen automatically,
2229
  * This function redraws the screen automatically,
2230
    updating coordinates and sizes of maximized windows.
2230
    updating coordinates and sizes of maximized windows.
2231
    The system sends to all windows redraw message (the event 1).
2231
    The system sends to all windows redraw message (the event 1).
2232
 
2232
 
2233
======================================================================
2233
======================================================================
2234
=========== Function 48, subfunction 7 - get skin margins. ===========
2234
=========== Function 48, subfunction 7 - get skin margins. ===========
2235
======================================================================
2235
======================================================================
2236
Returns the area of a header of a skinned window, intended for
2236
Returns the area of a header of a skinned window, intended for
2237
a text of a header.
2237
a text of a header.
2238
Parameters:
2238
Parameters:
2239
  * eax = 48 - function number
2239
  * eax = 48 - function number
2240
  * ebx = 7 - subfunction number
2240
  * ebx = 7 - subfunction number
2241
Returned value:
2241
Returned value:
2242
  * eax = [left]*65536 + [right]
2242
  * eax = [left]*65536 + [right]
2243
  * ebx = [top]*65536 + [bottom]
2243
  * ebx = [top]*65536 + [bottom]
2244
Remarks:
2244
Remarks:
2245
  * An application decides itself to use or not to use this function.
2245
  * An application decides itself to use or not to use this function.
2246
  * It is recommended to take into account returned value
2246
  * It is recommended to take into account returned value
2247
    of this function for choice of a place for drawing header text
2247
    of this function for choice of a place for drawing header text
2248
    (by function 4) or a substitute of header text
2248
    (by function 4) or a substitute of header text
2249
    (at the discretion of an application).
2249
    (at the discretion of an application).
2250
 
2250
 
2251
======================================================================
2251
======================================================================
2252
============= Function 48, subfunction 8 - set used skin. ============
2252
============= Function 48, subfunction 8 - set used skin. ============
2253
======================================================================
2253
======================================================================
2254
Parameters:
2254
Parameters:
2255
  * eax = 48 - function number
2255
  * eax = 48 - function number
2256
  * ebx = 8 - subfunction number
2256
  * ebx = 8 - subfunction number
2257
  * ecx = pointer to a block for function 58, in
2257
  * ecx = pointer to a block for function 58, in
2258
    which the fields of intermediate buffer and file name are filled
2258
    which the fields of intermediate buffer and file name are filled
2259
Returned value:
2259
Returned value:
2260
  * eax = 0 - success
2260
  * eax = 0 - success
2261
  * otherwise eax = file system error code; if file does not
2261
  * otherwise eax = file system error code; if file does not
2262
    contain valid skin, function returns error 3
2262
    contain valid skin, function returns error 3
2263
    (unknown file system).
2263
    (unknown file system).
2264
Remarks:
2264
Remarks:
2265
  * After successful skin loading the system sends to all windows
2265
  * After successful skin loading the system sends to all windows
2266
    redraw message (the event 1).
2266
    redraw message (the event 1).
2267
  * At booting the system reads skin from file 'default.skn'
2267
  * At booting the system reads skin from file 'default.skn'
2268
    on ramdisk.
2268
    on ramdisk.
2269
  * User can change the skin statically by creating hisself
2269
  * User can change the skin statically by creating hisself
2270
    'default.skn' or dynamically with the application 'desktop'.
2270
    'default.skn' or dynamically with the application 'desktop'.
2271
 
2271
 
2272
======================================================================
2272
======================================================================
2273
=========== Function 49 - Advanced Power Management (APM). ===========
2273
=========== Function 49 - Advanced Power Management (APM). ===========
2274
======================================================================
2274
======================================================================
2275
Parameters:
2275
Parameters:
2276
  * eax = 49 - function number
2276
  * eax = 49 - function number
2277
  * dx = number of the APM function
2277
  * dx = number of the APM function
2278
    (analogue of ax in APM specification)
2278
    (analogue of ax in APM specification)
2279
  * bx, cx = parameters of the APM function
2279
  * bx, cx = parameters of the APM function
2280
Returned value:
2280
Returned value:
2281
  * 16-bit registers ax, bx, cx, dx, si, di and carry flag CF
2281
  * 16-bit registers ax, bx, cx, dx, si, di and carry flag CF
2282
    are set according to the APM specification
2282
    are set according to the APM specification
2283
  * high halves of 32-bit registers eax, ebx, ecx,
2283
  * high halves of 32-bit registers eax, ebx, ecx,
2284
    edx, esi, edi are destroyed
2284
    edx, esi, edi are destroyed
2285
Remarks:
2285
Remarks:
2286
  * APM 1.2 specification is described in the document
2286
  * APM 1.2 specification is described in the document
2287
    "Advanced Power Management (APM) BIOS Specification"
2287
    "Advanced Power Management (APM) BIOS Specification"
2288
    (Revision 1.2), available at
2288
    (Revision 1.2), available at
2289
    http://www.microsoft.com/whdc/archive/amp_12.mspx;
2289
    http://www.microsoft.com/whdc/archive/amp_12.mspx;
2290
    besides it is included in famous Interrupt List by Ralf Brown
2290
    besides it is included in famous Interrupt List by Ralf Brown
2291
    (http://www.pobox.com/~ralf/files.html,
2291
    (http://www.pobox.com/~ralf/files.html,
2292
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/).
2292
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/).
2293
 
2293
 
2294
======================================================================
2294
======================================================================
2295
=================== Function 50 - set window shape. ==================
2295
=================== Function 50 - set window shape. ==================
2296
======================================================================
2296
======================================================================
2297
Normal windows have rectangular shape. This function can give to
2297
Normal windows have rectangular shape. This function can give to
2298
a window any shape. The shape is given by a set of points inside
2298
a window any shape. The shape is given by a set of points inside
2299
the base rectangle belonging to a window. Position and coordinates
2299
the base rectangle belonging to a window. Position and coordinates
2300
of the base rectangle are set by function 0
2300
of the base rectangle are set by function 0
2301
and changed by function 67.
2301
and changed by function 67.
2302
 
2302
 
2303
--------------------------- Set shape data ---------------------------
2303
--------------------------- Set shape data ---------------------------
2304
Parameters:
2304
Parameters:
2305
  * eax = 50 - function number
2305
  * eax = 50 - function number
2306
  * ebx = 0 - subfunction number
2306
  * ebx = 0 - subfunction number
2307
  * ecx = pointer to shape data (array of bytes 0/1)
2307
  * ecx = pointer to shape data (array of bytes 0/1)
2308
Returned value:
2308
Returned value:
2309
  * function does not return value
2309
  * function does not return value
2310
 
2310
 
2311
-------------------------- Set shape scale ---------------------------
2311
-------------------------- Set shape scale ---------------------------
2312
Parameters:
2312
Parameters:
2313
  * eax = 50 - function number
2313
  * eax = 50 - function number
2314
  * ebx = 1 - subfunction number
2314
  * ebx = 1 - subfunction number
2315
  * ecx sets a scale: each byte of data defines
2315
  * ecx sets a scale: each byte of data defines
2316
    (2^scale)*(2^scale) pixels
2316
    (2^scale)*(2^scale) pixels
2317
Returned value:
2317
Returned value:
2318
  * function does not return value
2318
  * function does not return value
2319
Remarks:
2319
Remarks:
2320
  * Default scale is 0 (scale factor is 1). If in the shape data
2320
  * Default scale is 0 (scale factor is 1). If in the shape data
2321
    one byte corresponds to one pixel, there is no necessity
2321
    one byte corresponds to one pixel, there is no necessity
2322
    to set scale.
2322
    to set scale.
2323
  * Let's designate xsize = window width (in pixels), ysize = height;
2323
  * Let's designate xsize = window width (in pixels), ysize = height;
2324
    pay attention, that they are one pixel more than defined by
2324
    pay attention, that they are one pixel more than defined by
2325
    functions 0, 67.
2325
    functions 0, 67.
2326
  * On definition of scale xsize and ysize must be divisible
2326
  * On definition of scale xsize and ysize must be divisible
2327
    on 2^scale.
2327
    on 2^scale.
2328
  * Byte of data on offset 'a' must be 0/1 and defines belonging
2328
  * Byte of data on offset 'a' must be 0/1 and defines belonging
2329
    to a window of square with the side 2^scale (if scale=0,
2329
    to a window of square with the side 2^scale (if scale=0,
2330
    this is one pixel) and coordinates of the left upper corner
2330
    this is one pixel) and coordinates of the left upper corner
2331
    (a mod (xsize shr scale), a div (xsize shr scale))
2331
    (a mod (xsize shr scale), a div (xsize shr scale))
2332
  * Data size: (xsize shr scale)*(ysize shr scale).
2332
  * Data size: (xsize shr scale)*(ysize shr scale).
2333
  * Data must be presented in the memory and not change
2333
  * Data must be presented in the memory and not change
2334
    after set of shape.
2334
    after set of shape.
2335
  * The system views the shape data at every window redraw by
2335
  * The system views the shape data at every window redraw by
2336
    function 0.
2336
    function 0.
2337
  * The call of subfunction 0 with NULL pointer results in return
2337
  * The call of subfunction 0 with NULL pointer results in return
2338
    to the rectangular shape.
2338
    to the rectangular shape.
2339
 
2339
 
2340
======================================================================
2340
======================================================================
2341
==================== Function 51 - create thread. ====================
2341
==================== Function 51 - create thread. ====================
2342
======================================================================
2342
======================================================================
2343
Parameters:
2343
Parameters:
2344
  * eax = 51 - function number
2344
  * eax = 51 - function number
2345
  * ebx = 1 - unique subfunction
2345
  * ebx = 1 - unique subfunction
2346
  * ecx = address of thread entry point (starting eip)
2346
  * ecx = address of thread entry point (starting eip)
2347
  * edx = pointer to thread stack (starting esp)
2347
  * edx = pointer to thread stack (starting esp)
2348
Returned value:
2348
Returned value:
2349
  * eax = -1 - error (there is too many threads)
2349
  * eax = -1 - error (there is too many threads)
2350
  * otherwise eax = TID - thread identifier
2350
  * otherwise eax = TID - thread identifier
2351
         
2351
         
2352
 
2352
 
2353
======================================================================
2353
======================================================================
2354
=== Function 52, subfunction 0 - get network driver configuration. ===
2354
=== Function 52, subfunction 0 - get network driver configuration. ===
2355
======================================================================
2355
======================================================================
2356
Parameters:
2356
Parameters:
2357
  * eax = 52 - function number
2357
  * eax = 52 - function number
2358
  * ebx = 0 - subfunction number
2358
  * ebx = 0 - subfunction number
2359
Returned value:
2359
Returned value:
2360
  * eax = configuration dword
2360
  * eax = configuration dword
2361
Remarks:
2361
Remarks:
2362
  * Configuration dword can be set by subfunction 2.
2362
  * Configuration dword can be set by subfunction 2.
2363
  * The kernel does not use this variable. The value of this
2363
  * The kernel does not use this variable. The value of this
2364
    variable and working with it subfunctions 0 and 2 is represented
2364
    variable and working with it subfunctions 0 and 2 is represented
2365
    doubtful.
2365
    doubtful.
2366
 
2366
 
2367
======================================================================
2367
======================================================================
2368
========= Function 52, subfunction 1 - get local IP-address. =========
2368
========= Function 52, subfunction 1 - get local IP-address. =========
2369
======================================================================
2369
======================================================================
2370
Parameters:
2370
Parameters:
2371
  * eax = 52 - function number
2371
  * eax = 52 - function number
2372
  * ebx = 1 - subfunction number
2372
  * ebx = 1 - subfunction number
2373
Returned value:
2373
Returned value:
2374
  * eax = IP-address (4 bytes)
2374
  * eax = IP-address (4 bytes)
2375
Remarks:
2375
Remarks:
2376
  * Local IP-address is set by subfunction 3.
2376
  * Local IP-address is set by subfunction 3.
2377
 
2377
 
2378
======================================================================
2378
======================================================================
2379
=== Function 52, subfunction 2 - set network driver configuration. ===
2379
=== Function 52, subfunction 2 - set network driver configuration. ===
2380
======================================================================
2380
======================================================================
2381
Parameters:
2381
Parameters:
2382
  * eax = 52 - function number
2382
  * eax = 52 - function number
2383
  * ebx = 2 - subfunction number
2383
  * ebx = 2 - subfunction number
2384
  * ecx = configuration dword; if low 7 bits derivate the number 3,
2384
  * ecx = configuration dword; if low 7 bits derivate the number 3,
2385
    function [re-]initializes Ethernet-card, otherwise
2385
    function [re-]initializes Ethernet-card, otherwise
2386
    Ethernet turns off
2386
    Ethernet turns off
2387
Returned value:
2387
Returned value:
2388
  * if Ethernet-interface is not requested, function returns eax=2,
2388
  * if Ethernet-interface is not requested, function returns eax=2,
2389
    but this can be changed in future kernel versions
2389
    but this can be changed in future kernel versions
2390
  * if Ethernet-interface is requested, eax=0 means error
2390
  * if Ethernet-interface is requested, eax=0 means error
2391
    (absence of Ethernet-card), and nonzero value - success
2391
    (absence of Ethernet-card), and nonzero value - success
2392
Remarks:
2392
Remarks:
2393
  * Configuration dword can be read by subfunction 0.
2393
  * Configuration dword can be read by subfunction 0.
2394
  * The kernel does not use this variable. The value of this
2394
  * The kernel does not use this variable. The value of this
2395
    variable, subfunction 0 and part of subfunction 2, which set it,
2395
    variable, subfunction 0 and part of subfunction 2, which set it,
2396
    is represented doubtful.
2396
    is represented doubtful.
2397
 
2397
 
2398
======================================================================
2398
======================================================================
2399
========= Function 52, subfunction 3 - set local IP-address. =========
2399
========= Function 52, subfunction 3 - set local IP-address. =========
2400
======================================================================
2400
======================================================================
2401
Parameters:
2401
Parameters:
2402
  * eax = 52 - function number
2402
  * eax = 52 - function number
2403
  * ebx = 3 - subfunction number
2403
  * ebx = 3 - subfunction number
2404
  * ecx = IP-address (4 bytes)
2404
  * ecx = IP-address (4 bytes)
2405
Returned value:
2405
Returned value:
2406
  * the current implementation returns eax=3, but this can be changed
2406
  * the current implementation returns eax=3, but this can be changed
2407
    in future versions
2407
    in future versions
2408
Remarks:
2408
Remarks:
2409
  * Local IP-address can be get by subfunction 1.
2409
  * Local IP-address can be get by subfunction 1.
2410
 
2410
 
2411
======================================================================
2411
======================================================================
2412
= Function 52, subfunction 6 - add data to the stack of input queue. =
2412
= Function 52, subfunction 6 - add data to the stack of input queue. =
2413
======================================================================
2413
======================================================================
2414
Parameters:
2414
Parameters:
2415
  * eax = 52 - function number
2415
  * eax = 52 - function number
2416
  * ebx = 6 - subfunction number
2416
  * ebx = 6 - subfunction number
2417
  * edx = data size
2417
  * edx = data size
2418
  * esi = data pointer
2418
  * esi = data pointer
2419
Returned value:
2419
Returned value:
2420
  * eax = -1 - error
2420
  * eax = -1 - error
2421
  * eax = 0 - success
2421
  * eax = 0 - success
2422
Remarks:
2422
Remarks:
2423
  * This function is intended only for slow network drivers
2423
  * This function is intended only for slow network drivers
2424
    (PPP, SLIP).
2424
    (PPP, SLIP).
2425
  * Data size must not exceed 1500 bytes, though function
2425
  * Data size must not exceed 1500 bytes, though function
2426
    performs no checks on correctness.
2426
    performs no checks on correctness.
2427
 
2427
 
2428
======================================================================
2428
======================================================================
2429
 Function 52, subfunction 8 - read data from the network output queue. 
2429
 Function 52, subfunction 8 - read data from the network output queue. 
2430
======================================================================
2430
======================================================================
2431
Parameters:
2431
Parameters:
2432
  * eax = 52 - function number
2432
  * eax = 52 - function number
2433
  * ebx = 8 - subfunction number
2433
  * ebx = 8 - subfunction number
2434
  * esi = pointer to 1500-byte buffer
2434
  * esi = pointer to 1500-byte buffer
2435
Returned value:
2435
Returned value:
2436
  * eax = number of read bytes (in the current implementation
2436
  * eax = number of read bytes (in the current implementation
2437
    either 0 = no data or 1500)
2437
    either 0 = no data or 1500)
2438
  * data was copied in buffer
2438
  * data was copied in buffer
2439
Remarks:
2439
Remarks:
2440
  * This function is intended only for slow network drivers
2440
  * This function is intended only for slow network drivers
2441
    (PPP, SLIP).
2441
    (PPP, SLIP).
2442
 
2442
 
2443
======================================================================
2443
======================================================================
2444
============ Function 52, subfunction 9 - get gateway IP. ============
2444
============ Function 52, subfunction 9 - get gateway IP. ============
2445
======================================================================
2445
======================================================================
2446
Parameters:
2446
Parameters:
2447
  * eax = 52 - function number
2447
  * eax = 52 - function number
2448
  * ebx = 9 - subfunction number
2448
  * ebx = 9 - subfunction number
2449
Returned value:
2449
Returned value:
2450
  * eax = gateway IP (4 bytes)
2450
  * eax = gateway IP (4 bytes)
2451
 
2451
 
2452
======================================================================
2452
======================================================================
2453
=========== Function 52, subfunction 10 - get subnet mask. ===========
2453
=========== Function 52, subfunction 10 - get subnet mask. ===========
2454
======================================================================
2454
======================================================================
2455
Parameters:
2455
Parameters:
2456
  * eax = 52 - function number
2456
  * eax = 52 - function number
2457
  * ebx = 10 - subfunction number
2457
  * ebx = 10 - subfunction number
2458
Returned value:
2458
Returned value:
2459
  * eax = subnet mask
2459
  * eax = subnet mask
2460
 
2460
 
2461
======================================================================
2461
======================================================================
2462
============ Function 52, subfunction 11 - set gateway IP. ===========
2462
============ Function 52, subfunction 11 - set gateway IP. ===========
2463
======================================================================
2463
======================================================================
2464
Parameters:
2464
Parameters:
2465
  * eax = 52 - function number
2465
  * eax = 52 - function number
2466
  * ebx = 11 - subfunction number
2466
  * ebx = 11 - subfunction number
2467
  * ecx = gateway IP (4 bytes)
2467
  * ecx = gateway IP (4 bytes)
2468
Returned value:
2468
Returned value:
2469
  * the current implementation returns eax=11, but this can be changed
2469
  * the current implementation returns eax=11, but this can be changed
2470
    in future versions
2470
    in future versions
2471
 
2471
 
2472
======================================================================
2472
======================================================================
2473
=========== Function 52, subfunction 12 - set subnet mask. ===========
2473
=========== Function 52, subfunction 12 - set subnet mask. ===========
2474
======================================================================
2474
======================================================================
2475
Parameters:
2475
Parameters:
2476
  * eax = 52 - function number
2476
  * eax = 52 - function number
2477
  * ebx = 12 - subfunction number
2477
  * ebx = 12 - subfunction number
2478
  * ecx = subnet mask
2478
  * ecx = subnet mask
2479
Returned value:
2479
Returned value:
2480
  * the current implementation returns eax=12, but this can be changed
2480
  * the current implementation returns eax=12, but this can be changed
2481
    in future versions
2481
    in future versions
2482
 
2482
 
2483
======================================================================
2483
======================================================================
2484
============== Function 52, subfunction 13 - get DNS IP. =============
2484
============== Function 52, subfunction 13 - get DNS IP. =============
2485
======================================================================
2485
======================================================================
2486
Parameters:
2486
Parameters:
2487
  * eax = 52 - function number
2487
  * eax = 52 - function number
2488
  * ebx = 13 - subfunction number
2488
  * ebx = 13 - subfunction number
2489
Returned value:
2489
Returned value:
2490
  * eax = DNS IP (4 bytes)
2490
  * eax = DNS IP (4 bytes)
2491
 
2491
 
2492
======================================================================
2492
======================================================================
2493
============== Function 52, subfunction 14 - set DNS IP. =============
2493
============== Function 52, subfunction 14 - set DNS IP. =============
2494
======================================================================
2494
======================================================================
2495
Parameters:
2495
Parameters:
2496
  * eax = 52 - function number
2496
  * eax = 52 - function number
2497
  * ebx = 14 - subfunction number
2497
  * ebx = 14 - subfunction number
2498
  * ecx = DNS IP (4 bytes)
2498
  * ecx = DNS IP (4 bytes)
2499
Returned value:
2499
Returned value:
2500
  * the current implementation returns eax=14, but this can be changed
2500
  * the current implementation returns eax=14, but this can be changed
2501
    in future versions
2501
    in future versions
2502
 
2502
 
2503
======================================================================
2503
======================================================================
2504
======== Function 52, subfunction 15 - get local MAC address. ========
2504
======== Function 52, subfunction 15 - get local MAC address. ========
2505
======================================================================
2505
======================================================================
2506
Parameters:
2506
Parameters:
2507
  * eax = 52 - function number
2507
  * eax = 52 - function number
2508
  * ebx = 15 - subfunction number
2508
  * ebx = 15 - subfunction number
2509
  * ecx = 0 - read first 4 bytes,
2509
  * ecx = 0 - read first 4 bytes,
2510
    ecx = 4 - read last 2 bytes
2510
    ecx = 4 - read last 2 bytes
2511
Returned value:
2511
Returned value:
2512
  * for ecx=0: eax = first 4 bytes of MAC address
2512
  * for ecx=0: eax = first 4 bytes of MAC address
2513
  * for ecx=4: ax = last 2 bytes of MAC address,
2513
  * for ecx=4: ax = last 2 bytes of MAC address,
2514
               high half of eax is destroyed
2514
               high half of eax is destroyed
2515
  * for other ecx: eax = -1 indicates an error
2515
  * for other ecx: eax = -1 indicates an error
2516
 
2516
 
2517
======================================================================
2517
======================================================================
2518
============ Function 53, subfunction 0 - open UDP-socket. ===========
2518
============ Function 53, subfunction 0 - open UDP-socket. ===========
2519
======================================================================
2519
======================================================================
2520
Parameters:
2520
Parameters:
2521
  * eax = 53 - function number
2521
  * eax = 53 - function number
2522
  * ebx = 0 - subfunction number
2522
  * ebx = 0 - subfunction number
2523
  * ecx = local port (only low word is taken into account)
2523
  * ecx = local port (only low word is taken into account)
2524
  * edx = remote port (only low word is taken into account)
2524
  * edx = remote port (only low word is taken into account)
2525
  * esi = remote IP
2525
  * esi = remote IP
2526
Returned value:
2526
Returned value:
2527
  * eax = -1 = 0xFFFFFFFF - error; ebx destroyed
2527
  * eax = -1 = 0xFFFFFFFF - error; ebx destroyed
2528
  * eax = socket handle (some number which unambiguously identifies
2528
  * eax = socket handle (some number which unambiguously identifies
2529
    socket and have sense only for the system) - success;
2529
    socket and have sense only for the system) - success;
2530
    ebx destroyed
2530
    ebx destroyed
2531
 
2531
 
2532
======================================================================
2532
======================================================================
2533
=========== Function 53, subfunction 1 - close UDP-socket. ===========
2533
=========== Function 53, subfunction 1 - close UDP-socket. ===========
2534
======================================================================
2534
======================================================================
2535
Parameters:
2535
Parameters:
2536
  * eax = 53 - function number
2536
  * eax = 53 - function number
2537
  * ebx = 1 - subfunction number
2537
  * ebx = 1 - subfunction number
2538
  * ecx = socket handle
2538
  * ecx = socket handle
2539
Returned value:
2539
Returned value:
2540
  * eax = -1 - incorrect handle
2540
  * eax = -1 - incorrect handle
2541
  * eax = 0 - success
2541
  * eax = 0 - success
2542
  * ebx destroyed
2542
  * ebx destroyed
2543
Remarks:
2543
Remarks:
2544
  * The current implementation does not close automatically all
2544
  * The current implementation does not close automatically all
2545
    sockets of a thread at termination. In particular, one should not
2545
    sockets of a thread at termination. In particular, one should not
2546
    kill a thread with many opened sockets - there will be an outflow
2546
    kill a thread with many opened sockets - there will be an outflow
2547
    of resources.
2547
    of resources.
2548
  * The current implementation does no checks on correctness
2548
  * The current implementation does no checks on correctness
2549
    (function returns error only if thread tries to close not opened
2549
    (function returns error only if thread tries to close not opened
2550
    socket with correct handle).
2550
    socket with correct handle).
2551
 
2551
 
2552
======================================================================
2552
======================================================================
2553
============== Function 53, subfunction 2 - poll socket. =============
2553
============== Function 53, subfunction 2 - poll socket. =============
2554
======================================================================
2554
======================================================================
2555
Parameters:
2555
Parameters:
2556
  * eax = 53 - function number
2556
  * eax = 53 - function number
2557
  * ebx = 2 - subfunction number
2557
  * ebx = 2 - subfunction number
2558
  * ecx = socket handle
2558
  * ecx = socket handle
2559
Returned value:
2559
Returned value:
2560
  * eax = number of read bytes
2560
  * eax = number of read bytes
2561
  * ebx destroyed
2561
  * ebx destroyed
2562
Remarks:
2562
Remarks:
2563
  * There is no checks for correctness.
2563
  * There is no checks for correctness.
2564
 
2564
 
2565
======================================================================
2565
======================================================================
2566
========= Function 53, subfunction 3 - read byte from socket. ========
2566
========= Function 53, subfunction 3 - read byte from socket. ========
2567
======================================================================
2567
======================================================================
2568
Parameters:
2568
Parameters:
2569
  * eax = 53 - function number
2569
  * eax = 53 - function number
2570
  * ebx = 3 - subfunction number
2570
  * ebx = 3 - subfunction number
2571
  * ecx = socket handle
2571
  * ecx = socket handle
2572
Returned value:
2572
Returned value:
2573
  * if there is no read data: eax=0, bl=0,
2573
  * if there is no read data: eax=0, bl=0,
2574
    other bytes of ebx are destroyed
2574
    other bytes of ebx are destroyed
2575
  * if there are read data: eax=number of rest bytes
2575
  * if there are read data: eax=number of rest bytes
2576
    (possibly 0), bl=read byte, other bytes of ebx are destroyed
2576
    (possibly 0), bl=read byte, other bytes of ebx are destroyed
2577
Remarks:
2577
Remarks:
2578
  * There is no checks for correctness.
2578
  * There is no checks for correctness.
2579
 
2579
 
2580
======================================================================
2580
======================================================================
2581
========== Function 53, subfunction 4 - write to UDP-socket. =========
2581
========== Function 53, subfunction 4 - write to UDP-socket. =========
2582
======================================================================
2582
======================================================================
2583
Parameters:
2583
Parameters:
2584
  * eax = 53 - function number
2584
  * eax = 53 - function number
2585
  * ebx = 4 - subfunction number
2585
  * ebx = 4 - subfunction number
2586
  * ecx = socket handle
2586
  * ecx = socket handle
2587
  * edx = number of bytes to write
2587
  * edx = number of bytes to write
2588
  * esi = pointer to data to write
2588
  * esi = pointer to data to write
2589
Returned value:
2589
Returned value:
2590
  * eax = 0xffffffff - invalid handle
2590
  * eax = 0xffffffff - invalid handle
2591
  * eax = 0xffff - not enough memory
2591
  * eax = 0xffff - not enough memory
2592
  * eax = 0 - success
2592
  * eax = 0 - success
2593
  * ebx destroyed
2593
  * ebx destroyed
2594
Remarks:
2594
Remarks:
2595
  * Check on validity of handle is minimal - only not very incorrect
2595
  * Check on validity of handle is minimal - only not very incorrect
2596
    not opened handles are eliminated.
2596
    not opened handles are eliminated.
2597
  * Number of bytes to write must not exceed 1500-28, though
2597
  * Number of bytes to write must not exceed 1500-28, though
2598
    the appropriate check is not made.
2598
    the appropriate check is not made.
2599
 
2599
 
2600
======================================================================
2600
======================================================================
2601
============ Function 53, subfunction 5 - open TCP-socket. ===========
2601
============ Function 53, subfunction 5 - open TCP-socket. ===========
2602
======================================================================
2602
======================================================================
2603
Parameters:
2603
Parameters:
2604
  * eax = 53 - function number
2604
  * eax = 53 - function number
2605
  * ebx = 5 - subfunction number
2605
  * ebx = 5 - subfunction number
2606
  * ecx = local port (only low word is taken into account)
2606
  * ecx = local port (only low word is taken into account)
2607
  * edx = remote port (only low word is taken into account)
2607
  * edx = remote port (only low word is taken into account)
2608
  * esi = remote IP
2608
  * esi = remote IP
2609
  * edi = open mode: SOCKET_PASSIVE=0 or SOCKET_ACTIVE=1
2609
  * edi = open mode: SOCKET_PASSIVE=0 or SOCKET_ACTIVE=1
2610
Returned value:
2610
Returned value:
2611
  * eax = -1 = 0xFFFFFFFF - error; ebx destroys
2611
  * eax = -1 = 0xFFFFFFFF - error; ebx destroys
2612
  * eax = socket handle (some number which unambiguously identifies
2612
  * eax = socket handle (some number which unambiguously identifies
2613
    socket and have sense only for the system) - success;
2613
    socket and have sense only for the system) - success;
2614
    ebx destroyed
2614
    ebx destroyed
2615
 
2615
 
2616
======================================================================
2616
======================================================================
2617
========= Function 53, subfunction 6 - get TCP-socket status. ========
2617
========= Function 53, subfunction 6 - get TCP-socket status. ========
2618
======================================================================
2618
======================================================================
2619
Parameters:
2619
Parameters:
2620
  * eax = 53 - function number
2620
  * eax = 53 - function number
2621
  * ebx = 6 - subfunction number
2621
  * ebx = 6 - subfunction number
2622
  * ecx = socket handle
2622
  * ecx = socket handle
2623
Returned value:
2623
Returned value:
2624
  * eax = socket status: one of
2624
  * eax = socket status: one of
2625
  * TCB_LISTEN = 1
2625
  * TCB_LISTEN = 1
2626
  * TCB_SYN_SENT = 2
2626
  * TCB_SYN_SENT = 2
2627
  * TCB_SYN_RECEIVED = 3
2627
  * TCB_SYN_RECEIVED = 3
2628
  * TCB_ESTABLISHED = 4
2628
  * TCB_ESTABLISHED = 4
2629
  * TCB_FIN_WAIT_1 = 5
2629
  * TCB_FIN_WAIT_1 = 5
2630
  * TCB_FIN_WAIT_2 = 6
2630
  * TCB_FIN_WAIT_2 = 6
2631
  * TCB_CLOSE_WAIT = 7
2631
  * TCB_CLOSE_WAIT = 7
2632
  * TCB_CLOSING = 8
2632
  * TCB_CLOSING = 8
2633
  * TCB_LAST_ASK = 9
2633
  * TCB_LAST_ASK = 9
2634
  * TCB_TIME_WAIT = 10
2634
  * TCB_TIME_WAIT = 10
2635
  * TCB_CLOSED = 11
2635
  * TCB_CLOSED = 11
2636
  * ebx destroys
2636
  * ebx destroys
2637
Remarks:
2637
Remarks:
2638
  * There is no checks for correctness.
2638
  * There is no checks for correctness.
2639
 
2639
 
2640
======================================================================
2640
======================================================================
2641
========== Function 53, subfunction 7 - write to TCP-socket. =========
2641
========== Function 53, subfunction 7 - write to TCP-socket. =========
2642
======================================================================
2642
======================================================================
2643
Parameters:
2643
Parameters:
2644
  * eax = 53 - function number
2644
  * eax = 53 - function number
2645
  * ebx = 7 - subfunction number
2645
  * ebx = 7 - subfunction number
2646
  * ecx = socket handle
2646
  * ecx = socket handle
2647
  * edx = number of bytes to write
2647
  * edx = number of bytes to write
2648
  * esi = pointer to data to write
2648
  * esi = pointer to data to write
2649
Returned value:
2649
Returned value:
2650
  * eax = 0xffffffff - error
2650
  * eax = 0xffffffff - error
2651
  * eax = 0xffff - not enough memory
2651
  * eax = 0xffff - not enough memory
2652
  * eax = 0 - success
2652
  * eax = 0 - success
2653
  * ebx destroyed
2653
  * ebx destroyed
2654
Remarks:
2654
Remarks:
2655
  * Check on validity of handle is minimal - only not very incorrect
2655
  * Check on validity of handle is minimal - only not very incorrect
2656
    not opened handles are eliminated.
2656
    not opened handles are eliminated.
2657
  * Number of bytes to write must not exceed 1500-40, though
2657
  * Number of bytes to write must not exceed 1500-40, though
2658
    the appropriate check is not made.
2658
    the appropriate check is not made.
2659
 
2659
 
2660
======================================================================
2660
======================================================================
2661
=========== Function 53, subfunction 8 - close TCP-socket. ===========
2661
=========== Function 53, subfunction 8 - close TCP-socket. ===========
2662
======================================================================
2662
======================================================================
2663
Parameters:
2663
Parameters:
2664
  * eax = 53 - function number
2664
  * eax = 53 - function number
2665
  * ebx = 8 - subfunction number
2665
  * ebx = 8 - subfunction number
2666
  * ecx = socket handle
2666
  * ecx = socket handle
2667
Returned value:
2667
Returned value:
2668
  * eax = -1 - invalid handle
2668
  * eax = -1 - invalid handle
2669
  * eax = 0xffff - not enough memory for socket close packet
2669
  * eax = 0xffff - not enough memory for socket close packet
2670
  * eax = 0 - success
2670
  * eax = 0 - success
2671
  * in many cases eax is destroyed (the result of function 'queue'
2671
  * in many cases eax is destroyed (the result of function 'queue'
2672
    is returned) - probably this is bug, which will be corrected
2672
    is returned) - probably this is bug, which will be corrected
2673
  * ebx destroyed
2673
  * ebx destroyed
2674
Remarks:
2674
Remarks:
2675
  * The current implementation does not close automatically all
2675
  * The current implementation does not close automatically all
2676
    sockets of a thread at termination. In particular, one should not
2676
    sockets of a thread at termination. In particular, one should not
2677
    kill a thread with many opened sockets - there will be an outflow
2677
    kill a thread with many opened sockets - there will be an outflow
2678
    of resources.
2678
    of resources.
2679
  * The current implementation does no checks on correctness
2679
  * The current implementation does no checks on correctness
2680
    (function returns error only if thread tries to close not opened
2680
    (function returns error only if thread tries to close not opened
2681
    socket with correct handle).
2681
    socket with correct handle).
2682
 
2682
 
2683
======================================================================
2683
======================================================================
2684
=== Function 53, subfunction 9 - check whether local port is free. ===
2684
=== Function 53, subfunction 9 - check whether local port is free. ===
2685
======================================================================
2685
======================================================================
2686
Parameters:
2686
Parameters:
2687
  * eax = 53 - function number
2687
  * eax = 53 - function number
2688
  * ebx = 9 - subfunction number
2688
  * ebx = 9 - subfunction number
2689
  * ecx = local port number (low 16 bits are used only)
2689
  * ecx = local port number (low 16 bits are used only)
2690
Returned value:
2690
Returned value:
2691
  * eax = 0 - port is used
2691
  * eax = 0 - port is used
2692
  * eax = 1 - port is free
2692
  * eax = 1 - port is free
2693
  * ebx destroyed
2693
  * ebx destroyed
2694
 
2694
 
2695
======================================================================
2695
======================================================================
2696
===== Function 53, subfunction 10 - query Ethernet cable status. =====
2696
===== Function 53, subfunction 10 - query Ethernet cable status. =====
2697
======================================================================
2697
======================================================================
2698
Parameters:
2698
Parameters:
2699
  * eax = 53 - function number
2699
  * eax = 53 - function number
2700
  * ebx = 10 - subfunction number
2700
  * ebx = 10 - subfunction number
2701
Returned value:
2701
Returned value:
2702
  * al = -1 - a network driver is not loaded or
2702
  * al = -1 - a network driver is not loaded or
2703
              does not support this function
2703
              does not support this function
2704
  * al = 0 - Ethernet cable is unplugged
2704
  * al = 0 - Ethernet cable is unplugged
2705
  * al = 1 - Ethernet cable is plugged
2705
  * al = 1 - Ethernet cable is plugged
2706
Remarks:
2706
Remarks:
2707
  * The current kernel implementation supports this function
2707
  * The current kernel implementation supports this function
2708
    only for RTL8139 network cards.
2708
    only for RTL8139 network cards.
2709
 
2709
 
2710
======================================================================
2710
======================================================================
2711
= Function 53, subfunction 255 - debug information of network driver. 
2711
= Function 53, subfunction 255 - debug information of network driver. 
2712
======================================================================
2712
======================================================================
2713
Parameters:
2713
Parameters:
2714
  * eax = 53 - function number
2714
  * eax = 53 - function number
2715
  * ebx = 255 - subfunction number
2715
  * ebx = 255 - subfunction number
2716
  * ecx = type of requested information (see below)
2716
  * ecx = type of requested information (see below)
2717
Returned value:
2717
Returned value:
2718
  * eax = requested information
2718
  * eax = requested information
2719
  * ebx destroyed
2719
  * ebx destroyed
2720
Possible values for ecx:
2720
Possible values for ecx:
2721
  * 100: length of queue 0 (empty queue)
2721
  * 100: length of queue 0 (empty queue)
2722
  * 101: length of queue 1 (ip-out queue)
2722
  * 101: length of queue 1 (ip-out queue)
2723
  * 102: length of queue 2 (ip-in queue)
2723
  * 102: length of queue 2 (ip-in queue)
2724
  * 103: length of queue 3 (net1out queue)
2724
  * 103: length of queue 3 (net1out queue)
2725
  * 200: number of items in the ARP table
2725
  * 200: number of items in the ARP table
2726
  * 201: size of the ARP table (in items) (20 for current version)
2726
  * 201: size of the ARP table (in items) (20 for current version)
2727
  * 202: read item at edx of the ARP table to the temporary buffer,
2727
  * 202: read item at edx of the ARP table to the temporary buffer,
2728
    whence 5 following types take information;
2728
    whence 5 following types take information;
2729
    in this case eax is not defined
2729
    in this case eax is not defined
2730
  * 203: IP-address saved by type 202
2730
  * 203: IP-address saved by type 202
2731
  * 204: high dword of MAC-address saved by type 202
2731
  * 204: high dword of MAC-address saved by type 202
2732
  * 205: low word of MAC-address saved by type 202
2732
  * 205: low word of MAC-address saved by type 202
2733
  * 206: status word saved by type 202
2733
  * 206: status word saved by type 202
2734
  * 207: ttl word saved by type 202
2734
  * 207: ttl word saved by type 202
2735
  * 2: total number of received IP-packets
2735
  * 2: total number of received IP-packets
2736
  * 3: total number of transferred IP-packets
2736
  * 3: total number of transferred IP-packets
2737
  * 4: total number of dumped received packets
2737
  * 4: total number of dumped received packets
2738
  * 5: total number of received ARP-packets
2738
  * 5: total number of received ARP-packets
2739
  * 6: status of packet driver, 0=inactive, nonzero=active
2739
  * 6: status of packet driver, 0=inactive, nonzero=active
2740
 
2740
 
2741
======================================================================
2741
======================================================================
2742
========== Function 55, subfunction 0 - load data for SB16. ==========
2742
========== Function 55, subfunction 0 - load data for SB16. ==========
2743
======================================================================
2743
======================================================================
2744
Parameters:
2744
Parameters:
2745
  * eax = 55 - function number
2745
  * eax = 55 - function number
2746
  * ebx = 0 - subfunction number
2746
  * ebx = 0 - subfunction number
2747
  * ecx = pointer to data (is copied 64 kilobytes, is used as much as
2747
  * ecx = pointer to data (is copied 64 kilobytes, is used as much as
2748
    set by subfunction 2)
2748
    set by subfunction 2)
2749
Returned value:
2749
Returned value:
2750
  * function does not return value
2750
  * function does not return value
2751
Remarks:
2751
Remarks:
2752
  * Format and size of data are set by subfunction 2.
2752
  * Format and size of data are set by subfunction 2.
2753
 
2753
 
2754
======================================================================
2754
======================================================================
2755
======== Function 55, subfunction 1 - begin play data on SB16. =======
2755
======== Function 55, subfunction 1 - begin play data on SB16. =======
2756
======================================================================
2756
======================================================================
2757
Parameters:
2757
Parameters:
2758
  * eax = 55 - function number
2758
  * eax = 55 - function number
2759
  * ebx = 1 - subfunction number
2759
  * ebx = 1 - subfunction number
2760
Returned value:
2760
Returned value:
2761
  * function does not return value
2761
  * function does not return value
2762
Remarks:
2762
Remarks:
2763
  * Previously data must be loaded by subfunction 0 and
2763
  * Previously data must be loaded by subfunction 0 and
2764
    their format must be defined by subfunction 2.
2764
    their format must be defined by subfunction 2.
2765
  * Function returns control, when playing of data began; after that
2765
  * Function returns control, when playing of data began; after that
2766
    play goes independently from application (and does not use
2766
    play goes independently from application (and does not use
2767
    processor time at all).
2767
    processor time at all).
2768
  * Previously must be defined SB16 base port
2768
  * Previously must be defined SB16 base port
2769
    (by subfunction 4 of function 21) and DMA channel
2769
    (by subfunction 4 of function 21) and DMA channel
2770
    (by subfunction 10 of function 21).
2770
    (by subfunction 10 of function 21).
2771
 
2771
 
2772
======================================================================
2772
======================================================================
2773
======== Function 55, subfunction 2 - set format of SB16 data. =======
2773
======== Function 55, subfunction 2 - set format of SB16 data. =======
2774
======================================================================
2774
======================================================================
2775
Parameters:
2775
Parameters:
2776
  * eax = 55 - function number
2776
  * eax = 55 - function number
2777
  * ebx = 2 - subfunction number
2777
  * ebx = 2 - subfunction number
2778
  * ecx = 0 - set digit capacity
2778
  * ecx = 0 - set digit capacity
2779
    * edx = 1 - 8bit mono
2779
    * edx = 1 - 8bit mono
2780
    * edx = 2 - 8bit stereo
2780
    * edx = 2 - 8bit stereo
2781
  * ecx = 1 - set data size
2781
  * ecx = 1 - set data size
2782
    * edx = size in bytes
2782
    * edx = size in bytes
2783
  * ecx = 2 - set play frequency
2783
  * ecx = 2 - set play frequency
2784
    * edx = frequency
2784
    * edx = frequency
2785
Returned value:
2785
Returned value:
2786
  * function does not return value
2786
  * function does not return value
2787
Remarks:
2787
Remarks:
2788
  * When the system boots, it sets following default parameters:
2788
  * When the system boots, it sets following default parameters:
2789
    digit capacity - 8bit mono, size - 64 Kb, frequency - 44100 Hz.
2789
    digit capacity - 8bit mono, size - 64 Kb, frequency - 44100 Hz.
2790
    Nevertheless it is recommended to set necessary values obviously
2790
    Nevertheless it is recommended to set necessary values obviously
2791
    as they could be reset by some application.
2791
    as they could be reset by some application.
2792
 
2792
 
2793
======================================================================
2793
======================================================================
2794
 Function 55, subfunction 55 - begin to play data on built-in speaker. 
2794
 Function 55, subfunction 55 - begin to play data on built-in speaker. 
2795
======================================================================
2795
======================================================================
2796
Parameters:
2796
Parameters:
2797
  * eax = 55 - function number
2797
  * eax = 55 - function number
2798
  * ebx = 55 - subfunction number
2798
  * ebx = 55 - subfunction number
2799
  * esi = pointer to data
2799
  * esi = pointer to data
2800
Returned value:
2800
Returned value:
2801
  * eax = 0 - success
2801
  * eax = 0 - success
2802
  * eax = 55 - error (speaker is off or busy)
2802
  * eax = 55 - error (speaker is off or busy)
2803
Data is an array of items with variable length.
2803
Data is an array of items with variable length.
2804
Format of each item is defined by first byte:
2804
Format of each item is defined by first byte:
2805
  * 0 = end of data
2805
  * 0 = end of data
2806
  * 1..0x80 = sets sound duration on 1/100 of second; sound note
2806
  * 1..0x80 = sets sound duration on 1/100 of second; sound note
2807
    is defined by immediate value of frequency
2807
    is defined by immediate value of frequency
2808
    * following word (2 bytes) contains frequency divider;
2808
    * following word (2 bytes) contains frequency divider;
2809
      frequency is defined as 1193180/divider
2809
      frequency is defined as 1193180/divider
2810
  * 0x81 = invalid
2810
  * 0x81 = invalid
2811
  * 0x82..0xFF = note is defined by octave and number:
2811
  * 0x82..0xFF = note is defined by octave and number:
2812
    * duration in 1/100 of second = (first byte)-0x81
2812
    * duration in 1/100 of second = (first byte)-0x81
2813
    * there is one more byte;
2813
    * there is one more byte;
2814
    * (second byte)=0xFF - delay
2814
    * (second byte)=0xFF - delay
2815
    * otherwise it looks like a*0x10+b, where b=number of the note in
2815
    * otherwise it looks like a*0x10+b, where b=number of the note in
2816
      an octave from 1 to 12, a=number of octave (beginning from 0)
2816
      an octave from 1 to 12, a=number of octave (beginning from 0)
2817
Remarks:
2817
Remarks:
2818
  * Speaker play can be disabled/enabled by
2818
  * Speaker play can be disabled/enabled by
2819
    subfunction 8 of function 18.
2819
    subfunction 8 of function 18.
2820
  * Function returns control, having informed the system
2820
  * Function returns control, having informed the system
2821
    an information on request. Play itself goes independently from
2821
    an information on request. Play itself goes independently from
2822
    the program.
2822
    the program.
2823
  * The data must be kept in the memory at least up to the end
2823
  * The data must be kept in the memory at least up to the end
2824
    of play.
2824
    of play.
2825
 
2825
 
2826
======================================================================
2826
======================================================================
2827
================ Function 58 - work with file system. ================
2827
================ Function 58 - work with file system. ================
2828
======================================================================
2828
======================================================================
2829
Parameters:
2829
Parameters:
2830
  * eax = 58
2830
  * eax = 58
2831
  * ebx = pointer to the information structure
2831
  * ebx = pointer to the information structure
2832
Returned value:
2832
Returned value:
2833
  * eax = 0 - success; otherwise file system error code
2833
  * eax = 0 - success; otherwise file system error code
2834
  * some subfunctions return value in other registers too
2834
  * some subfunctions return value in other registers too
2835
General format of the information structure:
2835
General format of the information structure:
2836
  * +0: dword: subfunction number
2836
  * +0: dword: subfunction number
2837
  * +4: dword: number of block
2837
  * +4: dword: number of block
2838
  * +8: dword: size
2838
  * +8: dword: size
2839
  * +12 = +0xC: dword: pointer to data
2839
  * +12 = +0xC: dword: pointer to data
2840
  * +16 = +0x10: dword: pointer to a memory for system operations
2840
  * +16 = +0x10: dword: pointer to a memory for system operations
2841
    (4096 bytes)
2841
    (4096 bytes)
2842
  * +20 = +0x14: n db: ASCIIZ-string with the file name
2842
  * +20 = +0x14: n db: ASCIIZ-string with the file name
2843
Specifications - in documentation on the appropriate subfunction.
2843
Specifications - in documentation on the appropriate subfunction.
2844
Filename is case-insensitive for latin letters, russian letters
2844
Filename is case-insensitive for latin letters, russian letters
2845
must be capital.
2845
must be capital.
2846
Format of filename:
2846
Format of filename:
2847
/base/number/dir1/dir2/.../dirn/file,
2847
/base/number/dir1/dir2/.../dirn/file,
2848
where /base/number identifies device, on which file is located:
2848
where /base/number identifies device, on which file is located:
2849
one of
2849
one of
2850
  * /RD/1 = /RAMDISK/1 to access ramdisk
2850
  * /RD/1 = /RAMDISK/1 to access ramdisk
2851
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
2851
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
2852
    /FD/2 = /FLOPPYDISK/2 to access second one
2852
    /FD/2 = /FLOPPYDISK/2 to access second one
2853
  * /HD/x = /HARDDISK/x - obsolete variant of access to hard disk
2853
  * /HD/x = /HARDDISK/x - obsolete variant of access to hard disk
2854
    (in this case base is defined by subfunction 7 of function 21),
2854
    (in this case base is defined by subfunction 7 of function 21),
2855
    x - partition number (beginning from 1)
2855
    x - partition number (beginning from 1)
2856
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
2856
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
2857
    IDE0 (Primary Master), IDE1 (Primary Slave),
2857
    IDE0 (Primary Master), IDE1 (Primary Slave),
2858
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
2858
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
2859
    x - partition number on the selected hard drive, varies from 1
2859
    x - partition number on the selected hard drive, varies from 1
2860
    to 255 (on each hard drive the indexing starts from 1)
2860
    to 255 (on each hard drive the indexing starts from 1)
2861
Remarks:
2861
Remarks:
2862
  * In the first two cases it is also possible to use FIRST
2862
  * In the first two cases it is also possible to use FIRST
2863
    instead of 1, SECOND instead of 2, but it is not recommended
2863
    instead of 1, SECOND instead of 2, but it is not recommended
2864
    for convenience of transition to the future extensions.
2864
    for convenience of transition to the future extensions.
2865
  * Limitation n<=39 is imposed.
2865
  * Limitation n<=39 is imposed.
2866
  * Names of folders and file dir1,...,dirn,file must have the
2866
  * Names of folders and file dir1,...,dirn,file must have the
2867
    format 8.3: name no more than 8 characters, dot, extension no
2867
    format 8.3: name no more than 8 characters, dot, extension no
2868
    more than 3 characters. Trailing spaces are ignored, no other
2868
    more than 3 characters. Trailing spaces are ignored, no other
2869
    spaces is allowed. If name occupies equally 8 characters,
2869
    spaces is allowed. If name occupies equally 8 characters,
2870
    dot may be omitted (though it is not recommended to use this
2870
    dot may be omitted (though it is not recommended to use this
2871
    feature for convenience of transition to the future extensions).
2871
    feature for convenience of transition to the future extensions).
2872
  * This function does not support folders on ramdisk.
2872
  * This function does not support folders on ramdisk.
2873
Examples:
2873
Examples:
2874
  * '/RAMDISK/FIRST/KERNEL.ASM',0
2874
  * '/RAMDISK/FIRST/KERNEL.ASM',0
2875
    '/rd/1/kernel.asm',0
2875
    '/rd/1/kernel.asm',0
2876
  * '/HD0/1/kernel.asm',0
2876
  * '/HD0/1/kernel.asm',0
2877
  * '/hd0/1/menuet/pics/tanzania.bmp',0
2877
  * '/hd0/1/menuet/pics/tanzania.bmp',0
2878
Existing subfunctions:
2878
Existing subfunctions:
2879
  * subfunction 0 - read file/folder
2879
  * subfunction 0 - read file/folder
2880
  * subfunction 1 - rewrite file
2880
  * subfunction 1 - rewrite file
2881
  * subfunction 4 - make folder
-
 
2882
  * subfunction 5 - rename/move file/folder
-
 
2883
  * subfunction 8 - LBA-read from device
2881
  * subfunction 8 - LBA-read from device
2884
  * subfunction 15 - get file system information
2882
  * subfunction 15 - get file system information
2885
 
2883
 
2886
======================================================================
2884
======================================================================
2887
=========== Function 58, subfunction 0 - read file/folder. ===========
2885
=========== Function 58, subfunction 0 - read file/folder. ===========
2888
======================================================================
2886
======================================================================
2889
Parameters:
2887
Parameters:
2890
  * eax = 58
2888
  * eax = 58
2891
  * ebx = pointer to the information structure
2889
  * ebx = pointer to the information structure
2892
Format of the information structure:
2890
Format of the information structure:
2893
  * +0: dword: 0 = subfunction number
2891
  * +0: dword: 0 = subfunction number
2894
  * +4: dword: first block to read (beginning from 0)
2892
  * +4: dword: first block to read (beginning from 0)
2895
  * +8: dword: amount of blocks to read
2893
  * +8: dword: amount of blocks to read
2896
  * +12 = +0xC: dword: pointer to buffer for data
2894
  * +12 = +0xC: dword: pointer to buffer for data
2897
  * +16 = +0x10: dword: pointer to buffer for system operations
2895
  * +16 = +0x10: dword: pointer to buffer for system operations
2898
    (4096 bytes)
2896
    (4096 bytes)
2899
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2897
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2900
    given in the general description
2898
    given in the general description
2901
Returned value:
2899
Returned value:
2902
  * eax = 0 - success, otherwise file system error code
2900
  * eax = 0 - success, otherwise file system error code
2903
  * ebx = file size (in bytes) or -1=0xffffffff, if file was not found
2901
  * ebx = file size (in bytes) or -1=0xffffffff, if file was not found
2904
Remarks:
2902
Remarks:
2905
  * Block size is 512 bytes.
2903
  * Block size is 512 bytes.
2906
  * This function is obsolete, for reading files use subfunction 0
2904
  * This function is obsolete, for reading files use subfunction 0
2907
    of function 70, for reading folders - subfunction 1 of
2905
    of function 70, for reading folders - subfunction 1 of
2908
    function 70.
2906
    function 70.
2909
  * Function can read contents of a folder. Only FAT file system is
2907
  * Function can read contents of a folder. Only FAT file system is
2910
    supported. The format of FAT-folder is described
2908
    supported. The format of FAT-folder is described
2911
    in any FAT documentation.
2909
    in any FAT documentation.
2912
  * Size of a folder is determined by size of FAT clusters chain.
2910
  * Size of a folder is determined by size of FAT clusters chain.
2913
  * If file was ended before last requested block was read,
2911
  * If file was ended before last requested block was read,
2914
    the function will read as many as it can, and after that return
2912
    the function will read as many as it can, and after that return
2915
    eax=6 (EOF).
2913
    eax=6 (EOF).
2916
  * Function can read root folders /rd/1,/fd/x,/hd[n]/x, but
2914
  * Function can read root folders /rd/1,/fd/x,/hd[n]/x, but
2917
    in the first two cases the current implementation does not follow
2915
    in the first two cases the current implementation does not follow
2918
    to the declared rules:
2916
    to the declared rules:
2919
    for /rd/1:
2917
    for /rd/1:
2920
    * if one want to read 0 blocks, function considers,
2918
    * if one want to read 0 blocks, function considers,
2921
      that he requested 1;
2919
      that he requested 1;
2922
    * if one requests more than 14 blocks or starting block is
2920
    * if one requests more than 14 blocks or starting block is
2923
      not less than 14, function returns eax=5 (not found) è ebx=-1;
2921
      not less than 14, function returns eax=5 (not found) è ebx=-1;
2924
    * size of ramdisk root folder is 14 blocks, 
2922
    * size of ramdisk root folder is 14 blocks, 
2925
      0x1C00=7168 áàéò; but function returns ebx=0
2923
      0x1C00=7168 áàéò; but function returns ebx=0
2926
      (except of the case of previous item);
2924
      (except of the case of previous item);
2927
    * strangely enough, it is possible to read 14th block (which
2925
    * strangely enough, it is possible to read 14th block (which
2928
      generally contains a garbage - I remind, the indexing begins
2926
      generally contains a garbage - I remind, the indexing begins
2929
      from 0);
2927
      from 0);
2930
    * if some block with the number not less than 14 was requested,
2928
    * if some block with the number not less than 14 was requested,
2931
      function returns eax=6(EOF); otherwise eax=0.
2929
      function returns eax=6(EOF); otherwise eax=0.
2932
    For /fd/x:
2930
    For /fd/x:
2933
    * if the start block is not less than 14, function returns
2931
    * if the start block is not less than 14, function returns
2934
      eax=5 (not found) and ebx=0;
2932
      eax=5 (not found) and ebx=0;
2935
    * note that format of FAT12 allows floppies with the root size
2933
    * note that format of FAT12 allows floppies with the root size
2936
      more or less than 14 blocks;
2934
      more or less than 14 blocks;
2937
    * check for length is not performed;
2935
    * check for length is not performed;
2938
    * if data was successful read, function returns
2936
    * if data was successful read, function returns
2939
      eax=0,ebx=0; otherwise eax=10 (access denied), ebx=-1.
2937
      eax=0,ebx=0; otherwise eax=10 (access denied), ebx=-1.
2940
  * The function handles reading of special folders /,/rd,/fd,/hd[n];
2938
  * The function handles reading of special folders /,/rd,/fd,/hd[n];
2941
    but the result does not correspond to expected (on operations with
2939
    but the result does not correspond to expected (on operations with
2942
    normal files/folders), does not follow the declared rules,
2940
    normal files/folders), does not follow the declared rules,
2943
    may be changed in future versions of the kernel and consequently
2941
    may be changed in future versions of the kernel and consequently
2944
    is not described. To obtain the information about the equipment
2942
    is not described. To obtain the information about the equipment
2945
    use subfunction 11 of function 18 or
2943
    use subfunction 11 of function 18 or
2946
    read corresponding folder with subfunction 1 of function 70.
2944
    read corresponding folder with subfunction 1 of function 70.
2947
 
2945
 
2948
======================================================================
2946
======================================================================
2949
============= Function 58, subfunction 1 - rewrite file. =============
2947
============= Function 58, subfunction 1 - rewrite file. =============
2950
======================================================================
2948
======================================================================
2951
If the file does not exist, it is created.
2949
If the file does not exist, it is created.
2952
If the file exists, it is rewritten.
2950
If the file exists, it is rewritten.
2953
Parameters:
2951
Parameters:
2954
  * eax = 58 - function number
2952
  * eax = 58 - function number
2955
  * ebx = pointer to the information structure
2953
  * ebx = pointer to the information structure
2956
Format of the information structure:
2954
Format of the information structure:
2957
  * +0: dword: 1 = subfunction number
2955
  * +0: dword: 1 = subfunction number
2958
  * +4: dword: ignored (set to 0)
2956
  * +4: dword: ignored (set to 0)
2959
  * +8: dword: number of bytes to write
2957
  * +8: dword: number of bytes to write
2960
  * +12 = +0xC: dword: pointer to data to write
2958
  * +12 = +0xC: dword: pointer to data to write
2961
  * +16 = +0x10: dword: pointer to buffer for system operations
2959
  * +16 = +0x10: dword: pointer to buffer for system operations
2962
    (4096 bytes)
2960
    (4096 bytes)
2963
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2961
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2964
    given in the general description
2962
    given in the general description
2965
Returned value:
2963
Returned value:
2966
  * eax = 0 - success, otherwise file system error code
2964
  * eax = 0 - success, otherwise file system error code
2967
  * ebx destroyed
2965
  * ebx destroyed
2968
Remarks:
2966
Remarks:
2969
  * This function is obsolete, use subfunction 2 of function 70.
2967
  * This function is obsolete, use subfunction 2 of function 70.
2970
 
2968
 
2971
======================================================================
2969
======================================================================
2972
============== Function 58, subfunction 4 - make folder. =============
-
 
2973
======================================================================
-
 
2974
Parameters:
-
 
2975
  * eax = 58 - function number
-
 
2976
  * ebx = pointer to the information structure
-
 
2977
Format of the information structure:
-
 
2978
  * +0: dword: 4 = subfunction number
-
 
2979
  * +4: dword: ignored
-
 
2980
  * +8: dword: ignored
-
 
2981
  * +12 = +0xC: dword: ignored
-
 
2982
  * +16 = +0x10: dword: pointer to buffer for system operations
-
 
2983
    (4096 bytes)
-
 
2984
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
-
 
2985
    given in the general description
-
 
2986
Returned value:
-
 
2987
  * eax = 0 - success, otherwise file system error code
-
 
2988
  * ebx destroyed
-
 
2989
Remarks:
-
 
2990
  * Ramdisk and floppies do not support this function, it is only
-
 
2991
    for hard disks.
-
 
2992
 
-
 
2993
======================================================================
-
 
2994
======== Function 58, subfunction 5 - rename/move file/folder. =======
-
 
2995
======================================================================
-
 
2996
Parameters:
-
 
2997
  * eax = 58 - function number
-
 
2998
  * ebx = pointer to the information structure
-
 
2999
Format of the information structure:
-
 
3000
  * +0: dword: 5 = subfunction number
-
 
3001
  * +4: dword: ignored
-
 
3002
  * +8: dword: ignored
-
 
3003
  * +12 = +0xC: dword: ignored
-
 
3004
  * +16 = +0x10: dword: pointer to buffer for system operations
-
 
3005
    (4096 bytes)
-
 
3006
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
-
 
3007
    given in the general description
-
 
3008
  * +20+n: (at once after terminating null character) new
-
 
3009
    ASCIIZ-name, must start from /hd/1, that is interpreted as
-
 
3010
    the hard disk, indicated in the first name
-
 
3011
    (moving from one disk to another is not supported)
-
 
3012
Returned value:
-
 
3013
  * eax = 0 - success, otherwise file system error code
-
 
3014
  * ebx destroyed
-
 
3015
Remarks:
-
 
3016
  * Ramdisk and floppies do not support this function, it is only
-
 
3017
    for hard disks.
-
 
3018
  * If the new ASCIIZ-name is strongly incorrect, i.e. does not start
-
 
3019
    from /hd/1, /hd/first, /harddisk/1, /harddisk/first or after this
-
 
3020
    space or null character follows, function returns, strangely
-
 
3021
    enough, error code 4. It is the only function which returns
-
 
3022
    this code.
-
 
3023
 
-
 
3024
======================================================================
-
 
3025
========= Function 58, subfunction 8 - LBA-read from device. =========
2970
========= Function 58, subfunction 8 - LBA-read from device. =========
3026
======================================================================
2971
======================================================================
3027
Parameters:
2972
Parameters:
3028
  * eax = 58 - function number
2973
  * eax = 58 - function number
3029
  * ebx = pointer to the information structure
2974
  * ebx = pointer to the information structure
3030
Format of the information structure:
2975
Format of the information structure:
3031
  * +0: dword: 8 = subfunction number
2976
  * +0: dword: 8 = subfunction number
3032
  * +4: dword: number of block to read (beginning from 0)
2977
  * +4: dword: number of block to read (beginning from 0)
3033
  * +8: dword: ignored (set to 1)
2978
  * +8: dword: ignored (set to 1)
3034
  * +12 = +0xC: dword: pointer to buffer for data (512 bytes)
2979
  * +12 = +0xC: dword: pointer to buffer for data (512 bytes)
3035
  * +16 = +0x10: dword: pointer to buffer for system operations
2980
  * +16 = +0x10: dword: pointer to buffer for system operations
3036
    (4096 bytes)
2981
    (4096 bytes)
3037
  * +20 = +0x14: ASCIIZ-name of device: case-insensitive, one of
2982
  * +20 = +0x14: ASCIIZ-name of device: case-insensitive, one of
3038
    /rd/1 = /RamDisk/1, /hd/n = /HardDisk/n,
2983
    /rd/1 = /RamDisk/1, /hd/n = /HardDisk/n,
3039
    1<=n<=4 - number of device: 1=IDE0, ..., 4=IDE3.
2984
    1<=n<=4 - number of device: 1=IDE0, ..., 4=IDE3.
3040
    Instead of digits it is allowed, though not recommended for
2985
    Instead of digits it is allowed, though not recommended for
3041
    convenience of transition to future extensions, to use
2986
    convenience of transition to future extensions, to use
3042
    'first','second','third','fourth'.
2987
    'first','second','third','fourth'.
3043
Returned value:
2988
Returned value:
3044
  * for device name /hd/xxx, where xxx is not in the list above:
2989
  * for device name /hd/xxx, where xxx is not in the list above:
3045
    * eax = ebx = 1
2990
    * eax = ebx = 1
3046
  * for invalid device name (except for the previous case):
2991
  * for invalid device name (except for the previous case):
3047
    * eax = 5
2992
    * eax = 5
3048
    * ebx does not change
2993
    * ebx does not change
3049
  * if LBA-access is disabled by subfunction 11 of function 21:
2994
  * if LBA-access is disabled by subfunction 11 of function 21:
3050
    * eax = 2
2995
    * eax = 2
3051
    * ebx destroyed
2996
    * ebx destroyed
3052
  * for ramdisk: attempt to read block outside ramdisk
2997
  * for ramdisk: attempt to read block outside ramdisk
3053
    (18*2*80 blocks) results in
2998
    (18*2*80 blocks) results in
3054
    * eax = 3
2999
    * eax = 3
3055
    * ebx = 0
3000
    * ebx = 0
3056
  * for successful read:
3001
  * for successful read:
3057
    * eax = ebx = 0
3002
    * eax = ebx = 0
3058
Remarks:
3003
Remarks:
3059
  * Block size is 512 bytes; function reads one block.
3004
  * Block size is 512 bytes; function reads one block.
3060
  * Do not depend on returned value, it can be changed
3005
  * Do not depend on returned value, it can be changed
3061
    in future versions.
3006
    in future versions.
3062
  * Function requires that LBA-access to devices is enabled by 
3007
  * Function requires that LBA-access to devices is enabled by 
3063
    subfunction 11 of function 21. To check this one can use 
3008
    subfunction 11 of function 21. To check this one can use 
3064
    subfunction 11 of function 26.
3009
    subfunction 11 of function 26.
3065
  * LBA-read of floppy is not supported.
3010
  * LBA-read of floppy is not supported.
3066
  * Function reads data on physical hard drive; if for any reason
3011
  * Function reads data on physical hard drive; if for any reason
3067
    data of the concrete partition are required, application must
3012
    data of the concrete partition are required, application must
3068
    define starting sector of this partition (either directly
3013
    define starting sector of this partition (either directly
3069
    through MBR, or from the full structure returned by
3014
    through MBR, or from the full structure returned by
3070
    ïîäôóíêöèåé 11 ôóíêöèè 18).
3015
    ïîäôóíêöèåé 11 ôóíêöèè 18).
3071
  * Function does not check error code of hard disk, so request of
3016
  * Function does not check error code of hard disk, so request of
3072
    nonexisting sector reads something (most probably it will be
3017
    nonexisting sector reads something (most probably it will be
3073
    zeroes, but this is defined by device) and this is considered
3018
    zeroes, but this is defined by device) and this is considered
3074
    as success (eax=0).
3019
    as success (eax=0).
3075
 
3020
 
3076
======================================================================
3021
======================================================================
3077
==== Function 58, subfunction 15 - get information on file system. ===
3022
==== Function 58, subfunction 15 - get information on file system. ===
3078
======================================================================
3023
======================================================================
3079
Parameters:
3024
Parameters:
3080
  * eax = 58 - function number
3025
  * eax = 58 - function number
3081
  * ebx = pointer to the information structure
3026
  * ebx = pointer to the information structure
3082
Format of the information structure:
3027
Format of the information structure:
3083
  * +0: dword: 15 = subfunction number
3028
  * +0: dword: 15 = subfunction number
3084
  * +4: dword: ignored
3029
  * +4: dword: ignored
3085
  * +8: dword: ignored
3030
  * +8: dword: ignored
3086
  * +12 = +0xC: dword: ignored
3031
  * +12 = +0xC: dword: ignored
3087
  * +16 = +0x10: dword: ignored
3032
  * +16 = +0x10: dword: ignored
3088
  * +20 = +0x14: (only second character is checked)
3033
  * +20 = +0x14: (only second character is checked)
3089
    /rd=/RAMDISK or /hd=/HARDDISK
3034
    /rd=/RAMDISK or /hd=/HARDDISK
3090
Returned value:
3035
Returned value:
3091
  * if the second character does not belong to set {'r','R','h','H'}:
3036
  * if the second character does not belong to set {'r','R','h','H'}:
3092
    * eax = 3
3037
    * eax = 3
3093
    * ebx = ecx = dword [fileinfo] = 0
3038
    * ebx = ecx = dword [fileinfo] = 0
3094
  * for ramdisk:
3039
  * for ramdisk:
3095
    * eax = 0 (success)
3040
    * eax = 0 (success)
3096
    * ebx = total number of clusters = 2847
3041
    * ebx = total number of clusters = 2847
3097
    * ecx = number of free clusters
3042
    * ecx = number of free clusters
3098
    * dword [fileinfo] = cluster size = 512
3043
    * dword [fileinfo] = cluster size = 512
3099
  * for hard disk: base and partition are defined by subfunctions
3044
  * for hard disk: base and partition are defined by subfunctions
3100
    7 and 8 of function 21:
3045
    7 and 8 of function 21:
3101
    * eax = 0 (success)
3046
    * eax = 0 (success)
3102
    * ebx = total number of clusters
3047
    * ebx = total number of clusters
3103
    * ecx = number of free clusters
3048
    * ecx = number of free clusters
3104
    * dword [fileinfo] = cluster size (in bytes)
3049
    * dword [fileinfo] = cluster size (in bytes)
3105
Remarks:
3050
Remarks:
3106
  * Be not surprised to strange layout of 4th returned parameter
3051
  * Be not surprised to strange layout of 4th returned parameter
3107
    - when this code was writing, at system calls application got
3052
    - when this code was writing, at system calls application got
3108
    only registers eax,ebx,ecx (from pushad-structure transmitted
3053
    only registers eax,ebx,ecx (from pushad-structure transmitted
3109
    as argument to the system function). Now it is corrected, so,
3054
    as argument to the system function). Now it is corrected, so,
3110
    probably, it is meaningful to return cluster size in edx, while
3055
    probably, it is meaningful to return cluster size in edx, while
3111
    this function is not used yet.
3056
    this function is not used yet.
3112
  * There exists also subfunction 11 of function 18,
3057
  * There exists also subfunction 11 of function 18,
3113
    which returns information on file system. From the full table
3058
    which returns information on file system. From the full table
3114
    of disk subsystem it is possible to deduce cluster size (there
3059
    of disk subsystem it is possible to deduce cluster size (there
3115
    it is stored in sectors) and total number of clusters
3060
    it is stored in sectors) and total number of clusters
3116
    for hard disks.
3061
    for hard disks.
3117
 
3062
 
3118
======================================================================
3063
======================================================================
3119
========== Function 60 - Inter Process Communication (IPC). ==========
3064
========== Function 60 - Inter Process Communication (IPC). ==========
3120
======================================================================
3065
======================================================================
3121
IPC is used for message dispatching from one process/thread to
3066
IPC is used for message dispatching from one process/thread to
3122
another. Previously it is necessary to agree how to interpret
3067
another. Previously it is necessary to agree how to interpret
3123
the concrete message.
3068
the concrete message.
3124
 
3069
 
3125
----------- Subfunction 1 - set the area for IPC receiving -----------
3070
----------- Subfunction 1 - set the area for IPC receiving -----------
3126
Is called by process-receiver.
3071
Is called by process-receiver.
3127
Parameters:
3072
Parameters:
3128
  * eax = 60 - function number
3073
  * eax = 60 - function number
3129
  * ebx = 1 - subfunction number
3074
  * ebx = 1 - subfunction number
3130
  * ecx = pointer to the buffer
3075
  * ecx = pointer to the buffer
3131
  * edx = size of the buffer
3076
  * edx = size of the buffer
3132
Returned value:
3077
Returned value:
3133
  * eax = 0 - always success
3078
  * eax = 0 - always success
3134
Format of IPC-buffer:
3079
Format of IPC-buffer:
3135
  * +0: dword: if nonzero, buffer is considered locked;
3080
  * +0: dword: if nonzero, buffer is considered locked;
3136
    lock/unlock the buffer, when you work with it and need that
3081
    lock/unlock the buffer, when you work with it and need that
3137
    buffer data are not changed from outside (no new messages)
3082
    buffer data are not changed from outside (no new messages)
3138
  * +4: dword: occupied place in the buffer (in bytes)
3083
  * +4: dword: occupied place in the buffer (in bytes)
3139
  * +8: first message
3084
  * +8: first message
3140
  * +8+n: second message
3085
  * +8+n: second message
3141
  * ...
3086
  * ...
3142
Format of a message:
3087
Format of a message:
3143
  * +0: dword: PID of sender
3088
  * +0: dword: PID of sender
3144
  * +4: dword: message length (not including this header)
3089
  * +4: dword: message length (not including this header)
3145
  * +8: n*byte: message data
3090
  * +8: n*byte: message data
3146
 
3091
 
3147
------------------ Subfunction 2 - send IPC message ------------------
3092
------------------ Subfunction 2 - send IPC message ------------------
3148
Is called by process-sender.
3093
Is called by process-sender.
3149
Parameters:
3094
Parameters:
3150
  * eax = 60 - function number
3095
  * eax = 60 - function number
3151
  * ebx = 2 - subfunction number
3096
  * ebx = 2 - subfunction number
3152
  * ecx = PID of receiver
3097
  * ecx = PID of receiver
3153
  * edx = pointer to the message data
3098
  * edx = pointer to the message data
3154
  * esi = message length (in bytes)
3099
  * esi = message length (in bytes)
3155
Returned value:
3100
Returned value:
3156
  * eax = 0 - success
3101
  * eax = 0 - success
3157
  * eax = 1 - the receiver has not defined buffer for IPC messages
3102
  * eax = 1 - the receiver has not defined buffer for IPC messages
3158
    (can be, still have no time,
3103
    (can be, still have no time,
3159
    and can be, this is not right process)
3104
    and can be, this is not right process)
3160
  * eax = 2 - the receiver has blocked IPC-buffer; try to wait a bit
3105
  * eax = 2 - the receiver has blocked IPC-buffer; try to wait a bit
3161
  * eax = 3 - overflow of IPC-buffer of the receiver
3106
  * eax = 3 - overflow of IPC-buffer of the receiver
3162
  * eax = 4 - process/thread with such PID does not exist
3107
  * eax = 4 - process/thread with such PID does not exist
3163
Remarks:
3108
Remarks:
3164
  * Immediately after writing of IPC-message to the buffer the system
3109
  * Immediately after writing of IPC-message to the buffer the system
3165
    sends to the receiver the event with code 7 (see event codes).
3110
    sends to the receiver the event with code 7 (see event codes).
3166
 
3111
 
3167
======================================================================
3112
======================================================================
3168
==== Function 61 - get parameters for the direct graphics access. ====
3113
==== Function 61 - get parameters for the direct graphics access. ====
3169
======================================================================
3114
======================================================================
3170
The data of the graphics screen (the memory area which displays
3115
The data of the graphics screen (the memory area which displays
3171
screen contents) are accessible to a program directly, without
3116
screen contents) are accessible to a program directly, without
3172
any system calls, through the selector gs:
3117
any system calls, through the selector gs:
3173
	mov	eax, [gs:0]
3118
	mov	eax, [gs:0]
3174
places in eax the first dword of the buffer, which contains
3119
places in eax the first dword of the buffer, which contains
3175
information on color of the left upper point (and, possibly, colors
3120
information on color of the left upper point (and, possibly, colors
3176
of several following).
3121
of several following).
3177
	mov	[gs:0], eax
3122
	mov	[gs:0], eax
3178
by work in VESA modes with LFB sets color of the left upper point
3123
by work in VESA modes with LFB sets color of the left upper point
3179
(and, possibly, colors of several following).
3124
(and, possibly, colors of several following).
3180
To interpret the data of graphics screen program needs to know
3125
To interpret the data of graphics screen program needs to know
3181
some parameters, returning by this function.
3126
some parameters, returning by this function.
3182
Remarks:
3127
Remarks:
3183
  * Graphics parameters changes very seldom at work,
3128
  * Graphics parameters changes very seldom at work,
3184
    namely, only in cases, when user works with the application VRR.
3129
    namely, only in cases, when user works with the application VRR.
3185
  * At videomode change the system redraws all windows (event
3130
  * At videomode change the system redraws all windows (event
3186
    with code 1) and redraws the background (event 5).
3131
    with code 1) and redraws the background (event 5).
3187
    Same events occur in other cases too, which meet much more often,
3132
    Same events occur in other cases too, which meet much more often,
3188
    than videomode change.
3133
    than videomode change.
3189
  * By operation in videomodes with LFB the selector gs points to
3134
  * By operation in videomodes with LFB the selector gs points to
3190
    LFB itself, so reading/writing on gs result directly in
3135
    LFB itself, so reading/writing on gs result directly in
3191
    change of screen contents. By operation in videomodes without
3136
    change of screen contents. By operation in videomodes without
3192
    LFB gs points to some data area in the kernel, and all functions
3137
    LFB gs points to some data area in the kernel, and all functions
3193
    of screen output fulfil honesty double operation on writing
3138
    of screen output fulfil honesty double operation on writing
3194
    directly to the screen and writing to this buffer. In result
3139
    directly to the screen and writing to this buffer. In result
3195
    at reading contents of this buffer the results correspond to
3140
    at reading contents of this buffer the results correspond to
3196
    screen contents (with, generally speaking, large color
3141
    screen contents (with, generally speaking, large color
3197
    resolution), and writing is ignored.
3142
    resolution), and writing is ignored.
3198
    One exception is the mode 320*200, for which main loop of the
3143
    One exception is the mode 320*200, for which main loop of the
3199
    system thread updates the screen according to mouse movements.
3144
    system thread updates the screen according to mouse movements.
3200
 
3145
 
3201
------------------------- Screen resolution --------------------------
3146
------------------------- Screen resolution --------------------------
3202
Parameters:
3147
Parameters:
3203
  * eax = 61 - function number
3148
  * eax = 61 - function number
3204
  * ebx = 1 - subfunction number
3149
  * ebx = 1 - subfunction number
3205
Returned value:
3150
Returned value:
3206
  * eax = [resolution on x axis]*65536 + [resolution on y axis]
3151
  * eax = [resolution on x axis]*65536 + [resolution on y axis]
3207
Remarks:
3152
Remarks:
3208
  * One can use function 14 paying attention that
3153
  * One can use function 14 paying attention that
3209
    it returns sizes on 1 pixel less. It is fully equivalent way.
3154
    it returns sizes on 1 pixel less. It is fully equivalent way.
3210
 
3155
 
3211
---------------------- Number of bits per pixel ----------------------
3156
---------------------- Number of bits per pixel ----------------------
3212
Parameters:
3157
Parameters:
3213
  * eax = 61 - function number
3158
  * eax = 61 - function number
3214
  * ebx = 2 - subfunction number
3159
  * ebx = 2 - subfunction number
3215
Returned value:
3160
Returned value:
3216
  * eax = number of bits per pixel (24 or 32)
3161
  * eax = number of bits per pixel (24 or 32)
3217
 
3162
 
3218
-------------------- Number of bytes per scanline --------------------
3163
-------------------- Number of bytes per scanline --------------------
3219
Parameters:
3164
Parameters:
3220
  * eax = 61 - function number
3165
  * eax = 61 - function number
3221
  * ebx = 3 - subfunction number
3166
  * ebx = 3 - subfunction number
3222
Returned value:
3167
Returned value:
3223
  * eax = number of bytes occupied by one scanline
3168
  * eax = number of bytes occupied by one scanline
3224
    (horizontal line on the screen)
3169
    (horizontal line on the screen)
3225
 
3170
 
3226
======================================================================
3171
======================================================================
3227
===== Function 62, subfunction 0 - get version of PCI-interface. =====
3172
===== Function 62, subfunction 0 - get version of PCI-interface. =====
3228
======================================================================
3173
======================================================================
3229
Parameters:
3174
Parameters:
3230
  * eax = 62 - function number
3175
  * eax = 62 - function number
3231
  * bl = 0 - subfunction number
3176
  * bl = 0 - subfunction number
3232
Returned value:
3177
Returned value:
3233
  * eax = -1 - PCI access is disabled; otherwise
3178
  * eax = -1 - PCI access is disabled; otherwise
3234
  * ah.al = version of PCI-interface (ah=version, al=subversion)
3179
  * ah.al = version of PCI-interface (ah=version, al=subversion)
3235
  * high word of eax is zeroed
3180
  * high word of eax is zeroed
3236
Remarks:
3181
Remarks:
3237
  * Previously low-level access to PCI for applications must be
3182
  * Previously low-level access to PCI for applications must be
3238
    enabled by subfunction 12 of function 21.
3183
    enabled by subfunction 12 of function 21.
3239
  * If PCI BIOS is not supported, the value of ax is undefined.
3184
  * If PCI BIOS is not supported, the value of ax is undefined.
3240
 
3185
 
3241
======================================================================
3186
======================================================================
3242
==== Function 62, subfunction 1 - get number of the last PCI-bus. ====
3187
==== Function 62, subfunction 1 - get number of the last PCI-bus. ====
3243
======================================================================
3188
======================================================================
3244
Parameters:
3189
Parameters:
3245
  * eax = 62 - function number
3190
  * eax = 62 - function number
3246
  * bl = 1 - subfunction number
3191
  * bl = 1 - subfunction number
3247
Returned value:
3192
Returned value:
3248
  * eax = -1 - access to PCI is disabled; otherwise
3193
  * eax = -1 - access to PCI is disabled; otherwise
3249
  * al = number of the last PCI-bus; other bytes of eax are destroyed
3194
  * al = number of the last PCI-bus; other bytes of eax are destroyed
3250
Remarks:
3195
Remarks:
3251
  * Previously low-level access to PCI for applications must be
3196
  * Previously low-level access to PCI for applications must be
3252
    enabled by subfunction 12 of function 21.
3197
    enabled by subfunction 12 of function 21.
3253
  * If PCI BIOS is not supported, the value of ax is undefined.
3198
  * If PCI BIOS is not supported, the value of ax is undefined.
3254
 
3199
 
3255
======================================================================
3200
======================================================================
3256
===================== Function 62, subfunction 2 =====================
3201
===================== Function 62, subfunction 2 =====================
3257
===== Get mechanism of addressing to the PCI configuration space. ====
3202
===== Get mechanism of addressing to the PCI configuration space. ====
3258
======================================================================
3203
======================================================================
3259
Parameters:
3204
Parameters:
3260
  * eax = 62 - function number
3205
  * eax = 62 - function number
3261
  * bl = 2 - subfunction number
3206
  * bl = 2 - subfunction number
3262
Returned value:
3207
Returned value:
3263
  * eax = -1 - access to PCI is disabled; otherwise
3208
  * eax = -1 - access to PCI is disabled; otherwise
3264
  * al = mechanism (1 or 2); other bytes of eax are destroyed
3209
  * al = mechanism (1 or 2); other bytes of eax are destroyed
3265
Remarks:
3210
Remarks:
3266
  * Previously low-level access to PCI for applications must be
3211
  * Previously low-level access to PCI for applications must be
3267
    enabled by subfunction 12 of function 21.
3212
    enabled by subfunction 12 of function 21.
3268
  * Addressing mechanism is selected depending on
3213
  * Addressing mechanism is selected depending on
3269
    equipment characteristics.
3214
    equipment characteristics.
3270
  * Subfunctions of read and write work automatically
3215
  * Subfunctions of read and write work automatically
3271
    with the selected mechanism.
3216
    with the selected mechanism.
3272
 
3217
 
3273
======================================================================
3218
======================================================================
3274
======== Function 62, subfunctions 4,5,6 - read PCI-register. ========
3219
======== Function 62, subfunctions 4,5,6 - read PCI-register. ========
3275
======================================================================
3220
======================================================================
3276
Parameters:
3221
Parameters:
3277
  * eax = 62 - function number
3222
  * eax = 62 - function number
3278
  * bl = 4 - read byte
3223
  * bl = 4 - read byte
3279
  * bl = 5 - read word
3224
  * bl = 5 - read word
3280
  * bl = 6 - read dword
3225
  * bl = 6 - read dword
3281
  * bh = number of PCI-bus
3226
  * bh = number of PCI-bus
3282
  * ch = dddddfff, where ddddd = number of the device on the bus,
3227
  * ch = dddddfff, where ddddd = number of the device on the bus,
3283
    fff = function number of device
3228
    fff = function number of device
3284
  * cl = number of register (must be even for bl=5,
3229
  * cl = number of register (must be even for bl=5,
3285
    divisible by 4 for bl=6)
3230
    divisible by 4 for bl=6)
3286
Returned value:
3231
Returned value:
3287
  * eax = -1 - error (access to PCI is disabled or parameters
3232
  * eax = -1 - error (access to PCI is disabled or parameters
3288
    are not supported); otherwise
3233
    are not supported); otherwise
3289
  * al/ax/eax (depending on requested size) contains the data;
3234
  * al/ax/eax (depending on requested size) contains the data;
3290
    the other part of register eax is destroyed
3235
    the other part of register eax is destroyed
3291
Remarks:
3236
Remarks:
3292
  * Previously low-level access to PCI for applications must be
3237
  * Previously low-level access to PCI for applications must be
3293
    enabled by subfunction 12 of function 21.
3238
    enabled by subfunction 12 of function 21.
3294
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3239
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3295
    function number. To get access mechanism use subfunction 2.
3240
    function number. To get access mechanism use subfunction 2.
3296
  * Some registers are standard and exist for all devices, some are
3241
  * Some registers are standard and exist for all devices, some are
3297
    defined by the concrete device. The list of registers of the
3242
    defined by the concrete device. The list of registers of the
3298
    first type can be found e.g. in famous
3243
    first type can be found e.g. in famous
3299
    Interrupt List by Ralf Brown
3244
    Interrupt List by Ralf Brown
3300
    (http://www.pobox.com/~ralf/files.html,
3245
    (http://www.pobox.com/~ralf/files.html,
3301
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/);
3246
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/);
3302
    registers of the second type must be listed
3247
    registers of the second type must be listed
3303
    in the device documentation.
3248
    in the device documentation.
3304
 
3249
 
3305
======================================================================
3250
======================================================================
3306
====== Function 62, subfunctions 8,9,10 - write to PCI-register. =====
3251
====== Function 62, subfunctions 8,9,10 - write to PCI-register. =====
3307
======================================================================
3252
======================================================================
3308
Parameters:
3253
Parameters:
3309
  * eax = 62 - function number
3254
  * eax = 62 - function number
3310
  * bl = 8 - write byte
3255
  * bl = 8 - write byte
3311
  * bl = 9 - write word
3256
  * bl = 9 - write word
3312
  * bl = 10 - write dword
3257
  * bl = 10 - write dword
3313
  * bh = number of PCI-bus
3258
  * bh = number of PCI-bus
3314
  * ch = dddddfff, where ddddd = number of the device on the bus,
3259
  * ch = dddddfff, where ddddd = number of the device on the bus,
3315
    fff = function number of device
3260
    fff = function number of device
3316
  * cl = number of register (must be even for bl=9,
3261
  * cl = number of register (must be even for bl=9,
3317
    divisible by 4 for bl=10)
3262
    divisible by 4 for bl=10)
3318
  * dl/dx/edx (depending on requested size) contatins
3263
  * dl/dx/edx (depending on requested size) contatins
3319
    the data to write
3264
    the data to write
3320
Returned value:
3265
Returned value:
3321
  * eax = -1 - error (access to PCI is disabled or parameters
3266
  * eax = -1 - error (access to PCI is disabled or parameters
3322
    are not supported)
3267
    are not supported)
3323
  * eax = 0 - success
3268
  * eax = 0 - success
3324
Remarks:
3269
Remarks:
3325
  * Previously low-level access to PCI for applications must be
3270
  * Previously low-level access to PCI for applications must be
3326
    enabled by subfunction 12 of function 21.
3271
    enabled by subfunction 12 of function 21.
3327
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3272
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3328
    function number. To get access mechanism use subfunction 2.
3273
    function number. To get access mechanism use subfunction 2.
3329
  * Some registers are standard and exist for all devices, some are
3274
  * Some registers are standard and exist for all devices, some are
3330
    defined by the concrete device. The list of registers of the
3275
    defined by the concrete device. The list of registers of the
3331
    first type can be found e.g. in famous Interrupt List by
3276
    first type can be found e.g. in famous Interrupt List by
3332
    Ralf Brown; registers of the second type must be listed
3277
    Ralf Brown; registers of the second type must be listed
3333
    in the device documentation.
3278
    in the device documentation.
3334
 
3279
 
3335
======================================================================
3280
======================================================================
3336
============== Function 63 - work with the debug board. ==============
3281
============== Function 63 - work with the debug board. ==============
3337
======================================================================
3282
======================================================================
3338
The debug board is the global system buffer (with the size
3283
The debug board is the global system buffer (with the size
3339
512 bytes), to which any program can write (generally speaking,
3284
512 bytes), to which any program can write (generally speaking,
3340
arbitrary) data and from which other program can read these data.
3285
arbitrary) data and from which other program can read these data.
3341
By the agreement written data are text strings interpreted as
3286
By the agreement written data are text strings interpreted as
3342
debug messages on a course of program execution. The kernel in
3287
debug messages on a course of program execution. The kernel in
3343
some situations also writes to the debug board information on
3288
some situations also writes to the debug board information on
3344
execution of some functions; by the agreement kernel messages
3289
execution of some functions; by the agreement kernel messages
3345
begins from the prefix "K : ".
3290
begins from the prefix "K : ".
3346
For view of the debug board the application 'board' was created,
3291
For view of the debug board the application 'board' was created,
3347
which reads data from the buffer and displays them in its window.
3292
which reads data from the buffer and displays them in its window.
3348
'board' interpretes the sequence of codes 13,10 as newline.
3293
'board' interpretes the sequence of codes 13,10 as newline.
3349
A character with null code in an end of line is not necessary,
3294
A character with null code in an end of line is not necessary,
3350
but also does not prevent.
3295
but also does not prevent.
3351
Because debugger has been written, the value of the debug board
3296
Because debugger has been written, the value of the debug board
3352
has decreased, as debugger allows to inspect completely a course of
3297
has decreased, as debugger allows to inspect completely a course of
3353
program execution without any efforts from the direction of program
3298
program execution without any efforts from the direction of program
3354
itself. Nevertheless in some cases the debug board is still useful.
3299
itself. Nevertheless in some cases the debug board is still useful.
3355
 
3300
 
3356
----------------------------- Write byte -----------------------------
3301
----------------------------- Write byte -----------------------------
3357
Parameters:
3302
Parameters:
3358
  * eax = 63 - function number
3303
  * eax = 63 - function number
3359
  * ebx = 1 - subfunction number
3304
  * ebx = 1 - subfunction number
3360
  * cl = data byte
3305
  * cl = data byte
3361
Returned value:
3306
Returned value:
3362
  * function does not return value
3307
  * function does not return value
3363
Remarks:
3308
Remarks:
3364
  * Byte is written to the buffer. Buffer size is 512 bytes.
3309
  * Byte is written to the buffer. Buffer size is 512 bytes.
3365
    At buffer overflow all obtained data are lost.
3310
    At buffer overflow all obtained data are lost.
3366
  * For output to the debug board of more complicated objects
3311
  * For output to the debug board of more complicated objects
3367
    (strings, numbers) it is enough to call this function in cycle.
3312
    (strings, numbers) it is enough to call this function in cycle.
3368
    It is possible not to write the appropriate code manually and use
3313
    It is possible not to write the appropriate code manually and use
3369
    file 'debug.inc', which is included into the distributive.
3314
    file 'debug.inc', which is included into the distributive.
3370
 
3315
 
3371
----------------------------- Read byte ------------------------------
3316
----------------------------- Read byte ------------------------------
3372
Takes away byte from the buffer.
3317
Takes away byte from the buffer.
3373
Parameters:
3318
Parameters:
3374
  * eax = 63 - function number
3319
  * eax = 63 - function number
3375
  * ebx = 2 - subfunction number
3320
  * ebx = 2 - subfunction number
3376
Returned value:
3321
Returned value:
3377
  * eax = ebx = 0 - the buffer is empty
3322
  * eax = ebx = 0 - the buffer is empty
3378
  * eax = byte, ebx = 1 - byte was successfully read
3323
  * eax = byte, ebx = 1 - byte was successfully read
3379
 
3324
 
3380
======================================================================
3325
======================================================================
3381
============== Function 64 - resize application memory. ==============
3326
============== Function 64 - resize application memory. ==============
3382
======================================================================
3327
======================================================================
3383
Parameters:
3328
Parameters:
3384
  * eax = 64 - function number
3329
  * eax = 64 - function number
3385
  * ebx = 1 - unique subfunction
3330
  * ebx = 1 - unique subfunction
3386
  * ecx = new memory size
3331
  * ecx = new memory size
3387
Returned value:
3332
Returned value:
3388
  * eax = 0 - success
3333
  * eax = 0 - success
3389
  * eax = 1 - not enough memory
3334
  * eax = 1 - not enough memory
3390
Remarks:
3335
Remarks:
3391
  * There is another way to dynamically allocate/free memory -
3336
  * There is another way to dynamically allocate/free memory -
3392
    subfunctions 11, 12, 13 of function 68.
3337
    subfunctions 11, 12, 13 of function 68.
3393
  * The function cannot be used together with 68.11, 68.12, 68.13.
3338
  * The function cannot be used together with 68.11, 68.12, 68.13.
3394
    The function call will be ignored after creation of process heap
3339
    The function call will be ignored after creation of process heap
3395
    with function 68.11.
3340
    with function 68.11.
3396
 
3341
 
3397
======================================================================
3342
======================================================================
3398
======== Function 65 - draw image with palette in the window. ========
3343
======== Function 65 - draw image with palette in the window. ========
3399
======================================================================
3344
======================================================================
3400
Parameters:
3345
Parameters:
3401
  * eax = 65 - function number
3346
  * eax = 65 - function number
3402
  * ebx = pointer to the image
3347
  * ebx = pointer to the image
3403
  * ecx = [size on axis x]*65536 + [size on axis y]
3348
  * ecx = [size on axis x]*65536 + [size on axis y]
3404
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
3349
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
3405
  * esi = number of bits per pixel, must be 8, 24 or 32
3350
  * esi = number of bits per pixel, must be 8, 24 or 32
3406
  * edi = pointer to palette (256 colors 0x00RRGGBB);
3351
  * edi = pointer to palette (256 colors 0x00RRGGBB);
3407
          ignored when esi = 24 and 32
3352
          ignored when esi = 24 and 32
3408
  * ebp = offset of next row data relative to previous row data
3353
  * ebp = offset of next row data relative to previous row data
3409
Returned value:
3354
Returned value:
3410
  * function does not return value
3355
  * function does not return value
3411
Remarks:
3356
Remarks:
3412
  * Coordinates of the image are coordinates of the upper left corner
3357
  * Coordinates of the image are coordinates of the upper left corner
3413
    of the image relative to the window.
3358
    of the image relative to the window.
3414
  * Size of the image in bytes is xsize*ysize.
3359
  * Size of the image in bytes is xsize*ysize.
3415
  * Each byte of image is index in the palette.
3360
  * Each byte of image is index in the palette.
3416
  * If the image uses less than 256 colors, palette size may be
3361
  * If the image uses less than 256 colors, palette size may be
3417
    less than 256 too.
3362
    less than 256 too.
3418
  * The call to function 7 is equivalent to call to this function
3363
  * The call to function 7 is equivalent to call to this function
3419
    with esi=24, ebp=0.
3364
    with esi=24, ebp=0.
3420
 
3365
 
3421
======================================================================
3366
======================================================================
3422
================== Function 66 - work with keyboard. =================
3367
================== Function 66 - work with keyboard. =================
3423
======================================================================
3368
======================================================================
3424
The input mode influences results of reading keys by function 2.
3369
The input mode influences results of reading keys by function 2.
3425
When a program loads, ASCII input mode is set for it.
3370
When a program loads, ASCII input mode is set for it.
3426
 
3371
 
3427
-------------- Subfunction 1 - set keyboard input mode. --------------
3372
-------------- Subfunction 1 - set keyboard input mode. --------------
3428
Parameters:
3373
Parameters:
3429
  * eax = 66 - function number
3374
  * eax = 66 - function number
3430
  * ebx = 1 - subfunction number
3375
  * ebx = 1 - subfunction number
3431
  * ecx = mode:
3376
  * ecx = mode:
3432
    * 0 = normal (ASCII-characters)
3377
    * 0 = normal (ASCII-characters)
3433
    * 1 = scancodes
3378
    * 1 = scancodes
3434
Returned value:
3379
Returned value:
3435
  * function does not return value
3380
  * function does not return value
3436
 
3381
 
3437
-------------- Subfunction 2 - get keyboard input mode. --------------
3382
-------------- Subfunction 2 - get keyboard input mode. --------------
3438
Parameters:
3383
Parameters:
3439
  * eax = 66 - function number
3384
  * eax = 66 - function number
3440
  * ebx = 2 - subfunction number
3385
  * ebx = 2 - subfunction number
3441
Returned value:
3386
Returned value:
3442
  * eax = current mode
3387
  * eax = current mode
3443
 
3388
 
3444
------------ Subfunction 3 - get status of control keys. -------------
3389
------------ Subfunction 3 - get status of control keys. -------------
3445
Parameters:
3390
Parameters:
3446
  * eax = 66 - function number
3391
  * eax = 66 - function number
3447
  * ebx = 3 - subfunction number
3392
  * ebx = 3 - subfunction number
3448
Returned value:
3393
Returned value:
3449
  * eax = bit mask:
3394
  * eax = bit mask:
3450
  * bit 0 (mask 1): left Shift is pressed
3395
  * bit 0 (mask 1): left Shift is pressed
3451
  * bit 1 (mask 2): right Shift is pressed
3396
  * bit 1 (mask 2): right Shift is pressed
3452
  * bit 2 (mask 4): left Ctrl is pressed
3397
  * bit 2 (mask 4): left Ctrl is pressed
3453
  * bit 3 (mask 8): right Ctrl is pressed
3398
  * bit 3 (mask 8): right Ctrl is pressed
3454
  * bit 4 (mask 0x10): left Alt is pressed
3399
  * bit 4 (mask 0x10): left Alt is pressed
3455
  * bit 5 (mask 0x20): right Alt is pressed
3400
  * bit 5 (mask 0x20): right Alt is pressed
3456
  * bit 6 (mask 0x40): CapsLock is on
3401
  * bit 6 (mask 0x40): CapsLock is on
3457
  * bit 7 (mask 0x80): NumLock is on
3402
  * bit 7 (mask 0x80): NumLock is on
3458
  * bit 8 (mask 0x100): ScrollLock is on
3403
  * bit 8 (mask 0x100): ScrollLock is on
3459
  * other bits are cleared
3404
  * other bits are cleared
3460
 
3405
 
3461
-------------- Subfunction 4 - set system-wide hotkey. ---------------
3406
-------------- Subfunction 4 - set system-wide hotkey. ---------------
3462
When hotkey is pressed, the system notifies only those applications,
3407
When hotkey is pressed, the system notifies only those applications,
3463
which have installed it; the active application (which receives
3408
which have installed it; the active application (which receives
3464
all normal input) does not receive such keys.
3409
all normal input) does not receive such keys.
3465
The notification consists in sending event with the code 2.
3410
The notification consists in sending event with the code 2.
3466
Reading hotkey is the same as reading normal key - by function 2.
3411
Reading hotkey is the same as reading normal key - by function 2.
3467
Parameters:
3412
Parameters:
3468
  * eax = 66 - function number
3413
  * eax = 66 - function number
3469
  * ebx = 4 - subfunction number
3414
  * ebx = 4 - subfunction number
3470
  * cl determines key scancode;
3415
  * cl determines key scancode;
3471
    use cl=0 to give combinations such as Ctrl+Shift
3416
    use cl=0 to give combinations such as Ctrl+Shift
3472
  * edx = 0xXYZ determines possible states of control keys:
3417
  * edx = 0xXYZ determines possible states of control keys:
3473
    * Z (low 4 bits) determines state of LShift and RShift:
3418
    * Z (low 4 bits) determines state of LShift and RShift:
3474
      * 0 = no key must be pressed;
3419
      * 0 = no key must be pressed;
3475
      * 1 = exactly one key must be pressed;
3420
      * 1 = exactly one key must be pressed;
3476
      * 2 = both keys must be pressed;
3421
      * 2 = both keys must be pressed;
3477
      * 3 = must be pressed LShift, but not RShift;
3422
      * 3 = must be pressed LShift, but not RShift;
3478
      * 4 = must be pressed RShift, but not LShift
3423
      * 4 = must be pressed RShift, but not LShift
3479
    * Y - similar for LCtrl and RCtrl;
3424
    * Y - similar for LCtrl and RCtrl;
3480
    * X - similar for LAlt and RAlt
3425
    * X - similar for LAlt and RAlt
3481
Returned value:
3426
Returned value:
3482
  * eax=0 - success
3427
  * eax=0 - success
3483
  * eax=1 - too mant hotkeys (maximum 256 are allowed)
3428
  * eax=1 - too mant hotkeys (maximum 256 are allowed)
3484
Remarks:
3429
Remarks:
3485
  * Hotkey can work either at pressing or at release. Release
3430
  * Hotkey can work either at pressing or at release. Release
3486
    scancode of a key is more on 128 than pressing scancode
3431
    scancode of a key is more on 128 than pressing scancode
3487
    (i.e. high bit is set).
3432
    (i.e. high bit is set).
3488
  * Several applications can set the same combination;
3433
  * Several applications can set the same combination;
3489
    all such applications will be informed on pressing
3434
    all such applications will be informed on pressing
3490
    such combination.
3435
    such combination.
3491
 
3436
 
3492
-------------- Subfunction 5 - delete installed hotkey. --------------
3437
-------------- Subfunction 5 - delete installed hotkey. --------------
3493
Parameters:
3438
Parameters:
3494
  * eax = 66 - function number
3439
  * eax = 66 - function number
3495
  * ebx = 5 - subfunction number
3440
  * ebx = 5 - subfunction number
3496
  * cl = scancode of key and edx = 0xXYZ the same as in subfunction 4
3441
  * cl = scancode of key and edx = 0xXYZ the same as in subfunction 4
3497
Returned value:
3442
Returned value:
3498
  * eax = 0 - success
3443
  * eax = 0 - success
3499
  * eax = 1 - there is no such hotkey
3444
  * eax = 1 - there is no such hotkey
3500
Remarks:
3445
Remarks:
3501
  * When a process/thread terminates, all hotkey installed by it are
3446
  * When a process/thread terminates, all hotkey installed by it are
3502
    deleted.
3447
    deleted.
3503
  * The call to this subfunction does not affect other applications.
3448
  * The call to this subfunction does not affect other applications.
3504
    If other application has defined the same combination, it will
3449
    If other application has defined the same combination, it will
3505
    still receive notices.
3450
    still receive notices.
3506
 
3451
 
3507
======================================================================
3452
======================================================================
3508
========= Function 67 - change position/sizes of the window. =========
3453
========= Function 67 - change position/sizes of the window. =========
3509
======================================================================
3454
======================================================================
3510
Parameters:
3455
Parameters:
3511
  * eax = 67 - function number
3456
  * eax = 67 - function number
3512
  * ebx = new x-coordinate of the window
3457
  * ebx = new x-coordinate of the window
3513
  * ecx = new y-coordinate of the window
3458
  * ecx = new y-coordinate of the window
3514
  * edx = new x-size of the window
3459
  * edx = new x-size of the window
3515
  * esi = new y-size of the window
3460
  * esi = new y-size of the window
3516
Returned value:
3461
Returned value:
3517
  * function does not return value
3462
  * function does not return value
3518
Remarks:
3463
Remarks:
3519
  * The value -1 for a parameter means "do not change"; e.g. to move
3464
  * The value -1 for a parameter means "do not change"; e.g. to move
3520
    the window without resizing it is possible to specify edx=esi=-1.
3465
    the window without resizing it is possible to specify edx=esi=-1.
3521
  * Previously the window must be defined by function 0.
3466
  * Previously the window must be defined by function 0.
3522
    It sets initial coordinates and sizes of the window.
3467
    It sets initial coordinates and sizes of the window.
3523
  * Sizes of the window are understood in sense of function 0,
3468
  * Sizes of the window are understood in sense of function 0,
3524
    that is one pixel less than real sizes.
3469
    that is one pixel less than real sizes.
3525
  * The function call for maximized windows is simply ignored.
3470
  * The function call for maximized windows is simply ignored.
3526
  * For windows of appropriate styles position and/or sizes can be
3471
  * For windows of appropriate styles position and/or sizes can be
3527
    changed by user; current position and sizes can be obtained by
3472
    changed by user; current position and sizes can be obtained by
3528
    call to function 9.
3473
    call to function 9.
3529
  * The function sends to the window redraw event (with the code 1).
3474
  * The function sends to the window redraw event (with the code 1).
3530
 
3475
 
3531
======================================================================
3476
======================================================================
3532
====== Function 68, subfunction 0 - get the task switch counter. =====
3477
====== Function 68, subfunction 0 - get the task switch counter. =====
3533
======================================================================
3478
======================================================================
3534
Parameters:
3479
Parameters:
3535
  * eax = 68 - function number
3480
  * eax = 68 - function number
3536
  * ebx = 0 - subfunction number
3481
  * ebx = 0 - subfunction number
3537
Returned value:
3482
Returned value:
3538
  * eax = number of task switches from the system booting
3483
  * eax = number of task switches from the system booting
3539
    (modulo 2^32)
3484
    (modulo 2^32)
3540
 
3485
 
3541
======================================================================
3486
======================================================================
3542
======= Function 68, subfunction 1 - switch to the next thread. ======
3487
======= Function 68, subfunction 1 - switch to the next thread. ======
3543
======================================================================
3488
======================================================================
3544
The function completes the current time slice allocated to the
3489
The function completes the current time slice allocated to the
3545
thread and switches to the next. (Which thread in which process
3490
thread and switches to the next. (Which thread in which process
3546
will be next, is unpredictable). Later, when execution queue
3491
will be next, is unpredictable). Later, when execution queue
3547
will reach the current thread, execution will be continued.
3492
will reach the current thread, execution will be continued.
3548
Parameters:
3493
Parameters:
3549
  * eax = 68 - function number
3494
  * eax = 68 - function number
3550
  * ebx = 1 - subfunction number
3495
  * ebx = 1 - subfunction number
3551
Returned value:
3496
Returned value:
3552
  * function does not return value
3497
  * function does not return value
3553
 
3498
 
3554
======================================================================
3499
======================================================================
3555
============= Function 68, subfunction 2 - cache + rdpmc. ============
3500
============= Function 68, subfunction 2 - cache + rdpmc. ============
3556
======================================================================
3501
======================================================================
3557
Parameters:
3502
Parameters:
3558
  * eax = 68 - function number
3503
  * eax = 68 - function number
3559
  * ebx = 2 - subfunction number
3504
  * ebx = 2 - subfunction number
3560
  * ecx = required action:
3505
  * ecx = required action:
3561
    * ecx = 0 - enable instruction 'rdpmc'
3506
    * ecx = 0 - enable instruction 'rdpmc'
3562
      (ReaD Performance-Monitoring Counters) for applications
3507
      (ReaD Performance-Monitoring Counters) for applications
3563
    * ecx = 1 - find out whether cache is disabled/enabled
3508
    * ecx = 1 - find out whether cache is disabled/enabled
3564
    * ecx = 2 - enable cache
3509
    * ecx = 2 - enable cache
3565
    * ecx = 3 - disable cache
3510
    * ecx = 3 - disable cache
3566
Returned value:
3511
Returned value:
3567
  * for ecx=0:
3512
  * for ecx=0:
3568
    * eax = the value of cr4
3513
    * eax = the value of cr4
3569
  * for ecx=1:
3514
  * for ecx=1:
3570
    * eax = (cr0 and 0x60000000):
3515
    * eax = (cr0 and 0x60000000):
3571
    * eax = 0 - cache is on
3516
    * eax = 0 - cache is on
3572
    * eax <> 0 - cache is off
3517
    * eax <> 0 - cache is off
3573
  * for ecx=2 and ecx=3:
3518
  * for ecx=2 and ecx=3:
3574
    * function does not return value
3519
    * function does not return value
3575
 
3520
 
3576
======================================================================
3521
======================================================================
3577
=========== Function 68, subfunction 3 - read MSR-register. ==========
3522
=========== Function 68, subfunction 3 - read MSR-register. ==========
3578
======================================================================
3523
======================================================================
3579
MSR = Model Specific Register; the complete list of MSR-registers
3524
MSR = Model Specific Register; the complete list of MSR-registers
3580
of a processor is included to the documentation on it (for example,
3525
of a processor is included to the documentation on it (for example,
3581
IA-32 Intel Architecture Software Developer's Manual,
3526
IA-32 Intel Architecture Software Developer's Manual,
3582
Volume 3, Appendix B); each processor family has its own subset
3527
Volume 3, Appendix B); each processor family has its own subset
3583
of the MSR-registers.
3528
of the MSR-registers.
3584
Parameters:
3529
Parameters:
3585
  * eax = 68 - function number
3530
  * eax = 68 - function number
3586
  * ebx = 3 - subfunction number
3531
  * ebx = 3 - subfunction number
3587
  * ecx is ignored
3532
  * ecx is ignored
3588
  * edx = MSR address
3533
  * edx = MSR address
3589
Returned value:
3534
Returned value:
3590
  * ebx:eax = high:low dword of the result
3535
  * ebx:eax = high:low dword of the result
3591
Remarks:
3536
Remarks:
3592
  * If ecx contains nonexistent or not implemented for this processor
3537
  * If ecx contains nonexistent or not implemented for this processor
3593
    MSR, processor will generate an exception in the kernel, which
3538
    MSR, processor will generate an exception in the kernel, which
3594
    will kill the thread.
3539
    will kill the thread.
3595
  * Previously it is necessary to check, whether MSRs are supported
3540
  * Previously it is necessary to check, whether MSRs are supported
3596
    as a whole, with the instruction 'cpuid'. Otherwise processor
3541
    as a whole, with the instruction 'cpuid'. Otherwise processor
3597
    will generate other exception in the kernel, which will anyway
3542
    will generate other exception in the kernel, which will anyway
3598
    kill the thread.
3543
    kill the thread.
3599
 
3544
 
3600
======================================================================
3545
======================================================================
3601
========= Function 68, subfunction 4 - write to MSR-register. ========
3546
========= Function 68, subfunction 4 - write to MSR-register. ========
3602
======================================================================
3547
======================================================================
3603
MSR = Model Specific Register; the complete list of MSR-registers
3548
MSR = Model Specific Register; the complete list of MSR-registers
3604
of a processor is included to the documentation on it (for example,
3549
of a processor is included to the documentation on it (for example,
3605
IA-32 Intel Architecture Software Developer's Manual,
3550
IA-32 Intel Architecture Software Developer's Manual,
3606
Volume 3, Appendix B); each processor family has its own subset
3551
Volume 3, Appendix B); each processor family has its own subset
3607
of the MSR-registers.
3552
of the MSR-registers.
3608
Parameters:
3553
Parameters:
3609
  * eax = 68 - function number
3554
  * eax = 68 - function number
3610
  * ebx = 4 - subfunction number
3555
  * ebx = 4 - subfunction number
3611
  * ecx is ignored
3556
  * ecx is ignored
3612
  * edx = MSR address
3557
  * edx = MSR address
3613
  * esi:edi = high:low dword
3558
  * esi:edi = high:low dword
3614
Returned value:
3559
Returned value:
3615
  * ebx:eax = copy of esi:edi
3560
  * ebx:eax = copy of esi:edi
3616
Çàìå÷àíèÿ:
3561
Çàìå÷àíèÿ:
3617
  * If ecx contains nonexistent or not implemented for this processor
3562
  * If ecx contains nonexistent or not implemented for this processor
3618
    MSR, processor will generate an exception in the kernel, which
3563
    MSR, processor will generate an exception in the kernel, which
3619
    will kill the thread.
3564
    will kill the thread.
3620
  * Previously it is necessary to check, whether MSRs are supported
3565
  * Previously it is necessary to check, whether MSRs are supported
3621
    as a whole, with the instruction 'cpuid'. Otherwise processor
3566
    as a whole, with the instruction 'cpuid'. Otherwise processor
3622
    will generate other exception in the kernel, which will anyway
3567
    will generate other exception in the kernel, which will anyway
3623
    kill the thread.
3568
    kill the thread.
3624
 
3569
 
3625
======================================================================
3570
======================================================================
3626
======= Function 68, subfunction 11 - initialize process heap. =======
3571
======= Function 68, subfunction 11 - initialize process heap. =======
3627
======================================================================
3572
======================================================================
3628
Parameters:
3573
Parameters:
3629
  * eax = 68 - function number
3574
  * eax = 68 - function number
3630
  * ebx = 11 - subfunction number
3575
  * ebx = 11 - subfunction number
3631
Returned value:
3576
Returned value:
3632
  * eax = 0 - failed
3577
  * eax = 0 - failed
3633
  * otherwise size of created heap
3578
  * otherwise size of created heap
3634
Remarks:
3579
Remarks:
3635
  * The function call initializes heap, from which one can in future
3580
  * The function call initializes heap, from which one can in future
3636
    allocate and free memory blocks with subfunctions 12 and 13.
3581
    allocate and free memory blocks with subfunctions 12 and 13.
3637
    Heap size is equal to total amount of free application memory.
3582
    Heap size is equal to total amount of free application memory.
3638
  * The second function call from the same process results in
3583
  * The second function call from the same process results in
3639
    returning the size of the existing heap.
3584
    returning the size of the existing heap.
3640
  * After creation of the heap calls to function 64 will be ignored.
3585
  * After creation of the heap calls to function 64 will be ignored.
3641
 
3586
 
3642
======================================================================
3587
======================================================================
3643
======== Function 68, subfunction 12 - allocate memory block. ========
3588
======== Function 68, subfunction 12 - allocate memory block. ========
3644
======================================================================
3589
======================================================================
3645
Parameters:
3590
Parameters:
3646
  * eax = 68 - function number
3591
  * eax = 68 - function number
3647
  * ebx = 12 - subfunction number
3592
  * ebx = 12 - subfunction number
3648
  * ecx = required size in bytes
3593
  * ecx = required size in bytes
3649
Returned value:
3594
Returned value:
3650
  * eax = pointer to the allocated block
3595
  * eax = pointer to the allocated block
3651
Remarks:
3596
Remarks:
3652
  * Before this call one must initialize process heap by call to
3597
  * Before this call one must initialize process heap by call to
3653
    subfunction 11.
3598
    subfunction 11.
3654
  * The function allocates an integer number of pages (4 Kb) in such
3599
  * The function allocates an integer number of pages (4 Kb) in such
3655
    way that the real size of allocated block is more than or equal to
3600
    way that the real size of allocated block is more than or equal to
3656
    requested size.
3601
    requested size.
3657
 
3602
 
3658
======================================================================
3603
======================================================================
3659
========== Function 68, subfunction 13 - free memory block. ==========
3604
========== Function 68, subfunction 13 - free memory block. ==========
3660
======================================================================
3605
======================================================================
3661
Parameters:
3606
Parameters:
3662
  * eax = 68 - function number
3607
  * eax = 68 - function number
3663
  * ebx = 13 - subfunction number
3608
  * ebx = 13 - subfunction number
3664
  * ecx = pointer to the memory block
3609
  * ecx = pointer to the memory block
3665
Returned value:
3610
Returned value:
3666
  * eax = 1 - success
3611
  * eax = 1 - success
3667
  * eax = 0 - failed
3612
  * eax = 0 - failed
3668
Remarks:
3613
Remarks:
3669
  * The memory block must have been allocated by subfunction 12.
3614
  * The memory block must have been allocated by subfunction 12.
3670
 
3615
 
3671
======================================================================
3616
======================================================================
3672
======== Function 68, subfunction 14 - wait for driver notify. =======
3617
======== Function 68, subfunction 14 - wait for driver notify. =======
3673
======================================================================
3618
======================================================================
3674
Parameters:
3619
Parameters:
3675
  * eax = 68 - function number
3620
  * eax = 68 - function number
3676
  * ebx = 14 - subfunction number
3621
  * ebx = 14 - subfunction number
3677
  * ecx = pointer to the buffer for information (8 bytes)
3622
  * ecx = pointer to the buffer for information (8 bytes)
3678
Returned value:
3623
Returned value:
3679
  * buffer pointed to by ecx contains the following information:
3624
  * buffer pointed to by ecx contains the following information:
3680
    * +0: dword: constant EV_INTR = 1
3625
    * +0: dword: constant EV_INTR = 1
3681
    * +4: dword: driver data
3626
    * +4: dword: driver data
3682
Remarks:
3627
Remarks:
3683
  * The current implementation at wait time uses "heavy" operations
3628
  * The current implementation at wait time uses "heavy" operations
3684
    of task switch.
3629
    of task switch.
3685
 
3630
 
3686
======================================================================
3631
======================================================================
3687
====== Function 68, subfunction 15 - set FPU exception handler. ======
3632
====== Function 68, subfunction 15 - set FPU exception handler. ======
3688
======================================================================
3633
======================================================================
3689
Parameters:
3634
Parameters:
3690
  * eax = 68 - function number
3635
  * eax = 68 - function number
3691
  * ebx = 15 - subfunction number
3636
  * ebx = 15 - subfunction number
3692
  * ecx = address of the new exception handler
3637
  * ecx = address of the new exception handler
3693
Returned value:
3638
Returned value:
3694
  * eax = address of the old exception handler (0, if it was not set)
3639
  * eax = address of the old exception handler (0, if it was not set)
3695
 
3640
 
3696
======================================================================
3641
======================================================================
3697
============= Function 68, subfunction 16 - load driver. =============
3642
============= Function 68, subfunction 16 - load driver. =============
3698
======================================================================
3643
======================================================================
3699
Parameters:
3644
Parameters:
3700
  * eax = 68 - function number
3645
  * eax = 68 - function number
3701
  * ebx = 16 - subfunction number
3646
  * ebx = 16 - subfunction number
3702
  * ecx = pointer to ASCIIZ-string with driver name
3647
  * ecx = pointer to ASCIIZ-string with driver name
3703
Returned value:
3648
Returned value:
3704
  * eax = 0 - failed
3649
  * eax = 0 - failed
3705
  * otherwise eax = driver handle
3650
  * otherwise eax = driver handle
3706
Remarks:
3651
Remarks:
3707
  * If the driver was not loaded yet, it is loaded;
3652
  * If the driver was not loaded yet, it is loaded;
3708
    if the driver was loaded yet, nothing happens.
3653
    if the driver was loaded yet, nothing happens.
3709
  * Driver name is case-sensitive.
3654
  * Driver name is case-sensitive.
3710
    Maximum length of the name is 16 characters, including
3655
    Maximum length of the name is 16 characters, including
3711
    terminating null character, the rest is ignored.
3656
    terminating null character, the rest is ignored.
3712
  * The function can load only drivers which are registered in the
3657
  * The function can load only drivers which are registered in the
3713
    system; the current implementation contains
3658
    system; the current implementation contains
3714
    exactly 2 such drivers:
3659
    exactly 2 such drivers:
3715
    * name SOUND, file /rd/1/drivers/unisound.obj
3660
    * name SOUND, file /rd/1/drivers/unisound.obj
3716
    * name INFINITY, file /rd/1/drivers/infinity.obj
3661
    * name INFINITY, file /rd/1/drivers/infinity.obj
3717
 
3662
 
3718
======================================================================
3663
======================================================================
3719
============ Function 68, subfunction 17 - driver control. ===========
3664
============ Function 68, subfunction 17 - driver control. ===========
3720
======================================================================
3665
======================================================================
3721
Parameters:
3666
Parameters:
3722
  * eax = 68 - function number
3667
  * eax = 68 - function number
3723
  * ebx = 17 - subfunction number
3668
  * ebx = 17 - subfunction number
3724
  * ecx = pointer to the control structure:
3669
  * ecx = pointer to the control structure:
3725
    * +0: dword: handle of driver
3670
    * +0: dword: handle of driver
3726
    * +4: dword: code of driver function
3671
    * +4: dword: code of driver function
3727
    * +8: dword: pointer to input data
3672
    * +8: dword: pointer to input data
3728
    * +12 = +0xC: dword: size of input data
3673
    * +12 = +0xC: dword: size of input data
3729
    * +16 = +0x10: dword: pointer to output data
3674
    * +16 = +0x10: dword: pointer to output data
3730
    * +20 = +0x14: dword: size of output data
3675
    * +20 = +0x14: dword: size of output data
3731
Returned value:
3676
Returned value:
3732
  * eax = determined by driver
3677
  * eax = determined by driver
3733
Remarks:
3678
Remarks:
3734
  * Function codes and the structure of input/output data
3679
  * Function codes and the structure of input/output data
3735
    are defined by driver.
3680
    are defined by driver.
3736
  * Previously one must obtain driver handle by subfunction 16.
3681
  * Previously one must obtain driver handle by subfunction 16.
3737
 
3682
 
3738
======================================================================
3683
======================================================================
3739
====== Function 68, subfunction 18 - set SSE exception handler. ======
3684
====== Function 68, subfunction 18 - set SSE exception handler. ======
3740
======================================================================
3685
======================================================================
3741
Parameters:
3686
Parameters:
3742
  * eax = 68 - function number
3687
  * eax = 68 - function number
3743
  * ebx = 15 - subfunction number
3688
  * ebx = 15 - subfunction number
3744
  * ecx = address of the new exception handler
3689
  * ecx = address of the new exception handler
3745
Returned value:
3690
Returned value:
3746
  * eax = address of the old exception handler (0, if it was not set)
3691
  * eax = address of the old exception handler (0, if it was not set)
3747
 
3692
 
3748
======================================================================
3693
======================================================================
3749
=============== Function 68, subfunction 19 - load DLL. ==============
3694
=============== Function 68, subfunction 19 - load DLL. ==============
3750
======================================================================
3695
======================================================================
3751
Parameters:
3696
Parameters:
3752
  * eax = 68 - function number
3697
  * eax = 68 - function number
3753
  * ebx = 19 - subfunction number
3698
  * ebx = 19 - subfunction number
3754
  * ecx = pointer to ASCIIZ-string with the full path to DLL
3699
  * ecx = pointer to ASCIIZ-string with the full path to DLL
3755
Returned value:
3700
Returned value:
3756
  * eax = 0 - failed
3701
  * eax = 0 - failed
3757
  * otherwise eax = pointer to DLL export table
3702
  * otherwise eax = pointer to DLL export table
3758
Remarks:
3703
Remarks:
3759
  * Export table is an array of structures of 2 dword's, terminated
3704
  * Export table is an array of structures of 2 dword's, terminated
3760
    by zero. The first dword in structure points to function name,
3705
    by zero. The first dword in structure points to function name,
3761
    the second dword contains address of function.
3706
    the second dword contains address of function.
3762
 
3707
 
3763
======================================================================
3708
======================================================================
3764
====================== Fucntion 69 - debugging. ======================
3709
====================== Fucntion 69 - debugging. ======================
3765
======================================================================
3710
======================================================================
3766
A process can load other process as debugged by set of corresponding
3711
A process can load other process as debugged by set of corresponding
3767
bit by call to subfunction 7 of function 70.
3712
bit by call to subfunction 7 of function 70.
3768
A process can have only one debugger; one process can debug some
3713
A process can have only one debugger; one process can debug some
3769
others. The system notifies debugger on events occuring with
3714
others. The system notifies debugger on events occuring with
3770
debugged process. Messages are written to the buffer defined by
3715
debugged process. Messages are written to the buffer defined by
3771
subfunction 0.
3716
subfunction 0.
3772
Format of a message:
3717
Format of a message:
3773
  * +0: dword: message code
3718
  * +0: dword: message code
3774
  * +4: dword: PID of debugged process
3719
  * +4: dword: PID of debugged process
3775
  * +8: there can be additional data depending on message code
3720
  * +8: there can be additional data depending on message code
3776
Message codes:
3721
Message codes:
3777
  * 1 = exception
3722
  * 1 = exception
3778
    * in addition dword-number of the exception is given
3723
    * in addition dword-number of the exception is given
3779
    * process is suspended
3724
    * process is suspended
3780
  * 2 = process has terminated
3725
  * 2 = process has terminated
3781
    * comes at any termination: both through the system function -1,
3726
    * comes at any termination: both through the system function -1,
3782
      and at "murder" by any other process (including debugger itself)
3727
      and at "murder" by any other process (including debugger itself)
3783
  * 3 = debug exception int 1 = #DB
3728
  * 3 = debug exception int 1 = #DB
3784
    * in addition dword-image of the register DR6 is given:
3729
    * in addition dword-image of the register DR6 is given:
3785
      * bits 0-3: condition of the corresponding breakpoint (set by
3730
      * bits 0-3: condition of the corresponding breakpoint (set by
3786
        subfunction 9) is satisfied
3731
        subfunction 9) is satisfied
3787
      * áèò 14: exception has occured because of the trace mode
3732
      * áèò 14: exception has occured because of the trace mode
3788
        (flag TF is set TF)
3733
        (flag TF is set TF)
3789
    * process is suspended
3734
    * process is suspended
3790
When debugger terminates, all debugged processes are killed.
3735
When debugger terminates, all debugged processes are killed.
3791
If debugger does not want this, it must previously detach by
3736
If debugger does not want this, it must previously detach by
3792
subfunction 3.
3737
subfunction 3.
3793
 
3738
 
3794
All subfunctions are applicable only to processes/threads started
3739
All subfunctions are applicable only to processes/threads started
3795
from the current by function 58 or 70 with set debugging flag.
3740
from the current by function 58 or 70 with set debugging flag.
3796
Debugging of multithreaded programs is not supported yet.
3741
Debugging of multithreaded programs is not supported yet.
3797
The full list of subfunctions:
3742
The full list of subfunctions:
3798
  * subfunction 0 - define data area for debug messages
3743
  * subfunction 0 - define data area for debug messages
3799
  * subfunction 1 - get contents of registers of debugged thread
3744
  * subfunction 1 - get contents of registers of debugged thread
3800
  * subfunction 2 - set contents of registers of debugged thread
3745
  * subfunction 2 - set contents of registers of debugged thread
3801
  * subfunction 3 - detach from debugged process
3746
  * subfunction 3 - detach from debugged process
3802
  * subfunction 4 - suspend debugged thread
3747
  * subfunction 4 - suspend debugged thread
3803
  * subfunction 5 - resume debugged thread
3748
  * subfunction 5 - resume debugged thread
3804
  * subfunction 6 - read from the memory of debugged process
3749
  * subfunction 6 - read from the memory of debugged process
3805
  * subfunction 7 - write to the memory of debugged process
3750
  * subfunction 7 - write to the memory of debugged process
3806
  * subfunction 8 - terminate debugged thread
3751
  * subfunction 8 - terminate debugged thread
3807
  * subfunction 9 - set/clear hardware breakpoint
3752
  * subfunction 9 - set/clear hardware breakpoint
3808
 
3753
 
3809
======================================================================
3754
======================================================================
3810
= Function 69, subfunction 0 - define data area fror debug messages. =
3755
= Function 69, subfunction 0 - define data area fror debug messages. =
3811
======================================================================
3756
======================================================================
3812
Parameters:
3757
Parameters:
3813
  * eax = 69 - function number
3758
  * eax = 69 - function number
3814
  * ebx = 0 - subfunction number
3759
  * ebx = 0 - subfunction number
3815
  * ecx = pointer
3760
  * ecx = pointer
3816
Format of data area:
3761
Format of data area:
3817
  * +0: dword: N = buffer size (not including this header)
3762
  * +0: dword: N = buffer size (not including this header)
3818
  * +4: dword: occupied place
3763
  * +4: dword: occupied place
3819
  * +8: N*byte: buffer
3764
  * +8: N*byte: buffer
3820
Returned value:
3765
Returned value:
3821
  * function does not return value
3766
  * function does not return value
3822
Remarks:
3767
Remarks:
3823
  * If the size field is negative, the buffer is considered locked
3768
  * If the size field is negative, the buffer is considered locked
3824
    and at arrival of new message the system will wait.
3769
    and at arrival of new message the system will wait.
3825
    For synchronization frame all work with the buffer by operations
3770
    For synchronization frame all work with the buffer by operations
3826
    lock/unlock
3771
    lock/unlock
3827
    	neg	[bufsize]
3772
    	neg	[bufsize]
3828
  * Data in the buffer are considered as array of items with variable
3773
  * Data in the buffer are considered as array of items with variable
3829
    length - messages. Format of a message is explained in
3774
    length - messages. Format of a message is explained in
3830
    general description.
3775
    general description.
3831
 
3776
 
3832
======================================================================
3777
======================================================================
3833
===================== Function 69, subfunction 1 =====================
3778
===================== Function 69, subfunction 1 =====================
3834
============ Get contents of registers of debugged thread. ===========
3779
============ Get contents of registers of debugged thread. ===========
3835
======================================================================
3780
======================================================================
3836
Parameters:
3781
Parameters:
3837
  * eax = 69 - function number
3782
  * eax = 69 - function number
3838
  * ebx = 1 - subfunction number
3783
  * ebx = 1 - subfunction number
3839
  * ecx = thread identifier
3784
  * ecx = thread identifier
3840
  * edx = size of context structure, must be 0x28=40 bytes
3785
  * edx = size of context structure, must be 0x28=40 bytes
3841
  * esi = pointer to context structure
3786
  * esi = pointer to context structure
3842
Returned value:
3787
Returned value:
3843
  * function does not return value
3788
  * function does not return value
3844
Format of context structure: (FPU is not supported yet)
3789
Format of context structure: (FPU is not supported yet)
3845
  * +0: dword: eip
3790
  * +0: dword: eip
3846
  * +4: dword: eflags
3791
  * +4: dword: eflags
3847
  * +8: dword: eax
3792
  * +8: dword: eax
3848
  * +12 = +0xC: dword: ecx
3793
  * +12 = +0xC: dword: ecx
3849
  * +16 = +0x10: dword: edx
3794
  * +16 = +0x10: dword: edx
3850
  * +20 = +0x14: dword: ebx
3795
  * +20 = +0x14: dword: ebx
3851
  * +24 = +0x18: dword: esp
3796
  * +24 = +0x18: dword: esp
3852
  * +28 = +0x1C: dword: ebp
3797
  * +28 = +0x1C: dword: ebp
3853
  * +32 = +0x20: dword: esi
3798
  * +32 = +0x20: dword: esi
3854
  * +36 = +0x24: dword: edi
3799
  * +36 = +0x24: dword: edi
3855
Remarks:
3800
Remarks:
3856
  * If the thread executes code of ring-0, the function returns
3801
  * If the thread executes code of ring-0, the function returns
3857
    contents of registers of ring-3.
3802
    contents of registers of ring-3.
3858
  * Process must be loaded for debugging (as is shown in
3803
  * Process must be loaded for debugging (as is shown in
3859
    general description).
3804
    general description).
3860
 
3805
 
3861
======================================================================
3806
======================================================================
3862
===================== Function 69, subfunction 2 =====================
3807
===================== Function 69, subfunction 2 =====================
3863
============ Set contents of registers of debugged thread. ===========
3808
============ Set contents of registers of debugged thread. ===========
3864
======================================================================
3809
======================================================================
3865
Parameters:
3810
Parameters:
3866
  * eax = 69 - function number
3811
  * eax = 69 - function number
3867
  * ebx = 2 - subfunction number
3812
  * ebx = 2 - subfunction number
3868
  * ecx = thread identifier
3813
  * ecx = thread identifier
3869
  * edx = size of context structure, must be 0x28=40 bytes
3814
  * edx = size of context structure, must be 0x28=40 bytes
3870
Returned value:
3815
Returned value:
3871
  * function does not return value
3816
  * function does not return value
3872
Format of context structure is shown in the description of
3817
Format of context structure is shown in the description of
3873
subfunction 1.
3818
subfunction 1.
3874
Remarks:
3819
Remarks:
3875
  * If the thread executes code of ring-0, the function returns
3820
  * If the thread executes code of ring-0, the function returns
3876
    contents of registers of ring-3.
3821
    contents of registers of ring-3.
3877
  * Process must be loaded for debugging (as is shown in
3822
  * Process must be loaded for debugging (as is shown in
3878
    general description).
3823
    general description).
3879
 
3824
 
3880
======================================================================
3825
======================================================================
3881
===== Function 69, subfunction 3 - detach from debugged process. =====
3826
===== Function 69, subfunction 3 - detach from debugged process. =====
3882
======================================================================
3827
======================================================================
3883
Parameters:
3828
Parameters:
3884
  * eax = 69 - function number
3829
  * eax = 69 - function number
3885
  * ebx = 3 - subfunction number
3830
  * ebx = 3 - subfunction number
3886
  * ecx = identifier
3831
  * ecx = identifier
3887
Returned value:
3832
Returned value:
3888
  * function does not return value
3833
  * function does not return value
3889
Remarks:
3834
Remarks:
3890
  * If the process was suspended, it resumes execution.
3835
  * If the process was suspended, it resumes execution.
3891
 
3836
 
3892
======================================================================
3837
======================================================================
3893
======== Function 69, subfunction 4 - suspend debugged thread. =======
3838
======== Function 69, subfunction 4 - suspend debugged thread. =======
3894
======================================================================
3839
======================================================================
3895
Parameters:
3840
Parameters:
3896
  * eax = 69 - function number
3841
  * eax = 69 - function number
3897
  * ebx = 4 - subfunction number
3842
  * ebx = 4 - subfunction number
3898
  * ecx = thread identifier
3843
  * ecx = thread identifier
3899
Returned value:
3844
Returned value:
3900
  * function does not return value
3845
  * function does not return value
3901
Remarks:
3846
Remarks:
3902
  * Process must be loaded for debugging (as is shown in
3847
  * Process must be loaded for debugging (as is shown in
3903
    general description).
3848
    general description).
3904
 
3849
 
3905
======================================================================
3850
======================================================================
3906
======== Function 69, subfunction 5 - resume debugged thread. ========
3851
======== Function 69, subfunction 5 - resume debugged thread. ========
3907
======================================================================
3852
======================================================================
3908
Parameters:
3853
Parameters:
3909
  * eax = 69 - function number
3854
  * eax = 69 - function number
3910
  * ebx = 5 - subfunction number
3855
  * ebx = 5 - subfunction number
3911
  * ecx = thread identifier
3856
  * ecx = thread identifier
3912
Returned value:
3857
Returned value:
3913
  * function does not return value
3858
  * function does not return value
3914
Remarks:
3859
Remarks:
3915
  * Process must be loaded for debugging (as is shown in
3860
  * Process must be loaded for debugging (as is shown in
3916
    general description).
3861
    general description).
3917
 
3862
 
3918
======================================================================
3863
======================================================================
3919
= Fucntion 69, subfunction 6 - read from memory of debugged process. =
3864
= Fucntion 69, subfunction 6 - read from memory of debugged process. =
3920
======================================================================
3865
======================================================================
3921
Parameters:
3866
Parameters:
3922
  * eax = 69 - function number
3867
  * eax = 69 - function number
3923
  * ebx = 6 - subfunction number
3868
  * ebx = 6 - subfunction number
3924
  * ecx = identifier
3869
  * ecx = identifier
3925
  * edx = number of bytes to read
3870
  * edx = number of bytes to read
3926
  * esi = address in the memory of debugged process
3871
  * esi = address in the memory of debugged process
3927
  * edi = pointer to buffer for data
3872
  * edi = pointer to buffer for data
3928
Returned value:
3873
Returned value:
3929
  * eax = -1 at an error (invalid PID or buffer)
3874
  * eax = -1 at an error (invalid PID or buffer)
3930
  * otherwise eax = number of read bytes (possibly, 0,
3875
  * otherwise eax = number of read bytes (possibly, 0,
3931
    if esi is too large)
3876
    if esi is too large)
3932
Remarks:
3877
Remarks:
3933
  * Process must be loaded for debugging (as is shown in
3878
  * Process must be loaded for debugging (as is shown in
3934
    general description).
3879
    general description).
3935
 
3880
 
3936
======================================================================
3881
======================================================================
3937
== Function 69, subfunction 7 - write to memory of debugged process. =
3882
== Function 69, subfunction 7 - write to memory of debugged process. =
3938
======================================================================
3883
======================================================================
3939
Parameters:
3884
Parameters:
3940
  * eax = 69 - function number
3885
  * eax = 69 - function number
3941
  * ebx = 7 - subfunction number
3886
  * ebx = 7 - subfunction number
3942
  * ecx = identifier
3887
  * ecx = identifier
3943
  * edx = number of bytes to write
3888
  * edx = number of bytes to write
3944
  * esi = address of memory in debugged process
3889
  * esi = address of memory in debugged process
3945
  * edi = pointer to data
3890
  * edi = pointer to data
3946
Returned value:
3891
Returned value:
3947
  * eax = -1 at an error (invalid PID or buffer)
3892
  * eax = -1 at an error (invalid PID or buffer)
3948
  * otherwise eax = number of written bytes (possibly, 0,
3893
  * otherwise eax = number of written bytes (possibly, 0,
3949
    if esi is too large)
3894
    if esi is too large)
3950
Remarks:
3895
Remarks:
3951
  * Process must be loaded for debugging (as is shown in
3896
  * Process must be loaded for debugging (as is shown in
3952
    general description).
3897
    general description).
3953
 
3898
 
3954
======================================================================
3899
======================================================================
3955
======= Function 69, subfunction 8 - terminate debugged thread. ======
3900
======= Function 69, subfunction 8 - terminate debugged thread. ======
3956
======================================================================
3901
======================================================================
3957
Parameters:
3902
Parameters:
3958
  * eax = 69 - function number
3903
  * eax = 69 - function number
3959
  * ebx = 8 - subfunction number
3904
  * ebx = 8 - subfunction number
3960
  * ecx = identifier
3905
  * ecx = identifier
3961
Returned value:
3906
Returned value:
3962
  * function does not return value
3907
  * function does not return value
3963
Remarks:
3908
Remarks:
3964
  * Process must be loaded for debugging (as is shown in
3909
  * Process must be loaded for debugging (as is shown in
3965
    general description).
3910
    general description).
3966
  * The function is similar to subfunction 2 of function 18
3911
  * The function is similar to subfunction 2 of function 18
3967
    with two differences: it requires first remark and
3912
    with two differences: it requires first remark and
3968
    accepts PID rather than slot number.
3913
    accepts PID rather than slot number.
3969
 
3914
 
3970
======================================================================
3915
======================================================================
3971
===== Function 69, subfunction 9 - set/clear hardware breakpoint. ====
3916
===== Function 69, subfunction 9 - set/clear hardware breakpoint. ====
3972
======================================================================
3917
======================================================================
3973
Parameters:
3918
Parameters:
3974
  * eax = 69 - function number
3919
  * eax = 69 - function number
3975
  * ebx = 9 - subfunction number
3920
  * ebx = 9 - subfunction number
3976
  * ecx = thread identifier
3921
  * ecx = thread identifier
3977
  * dl = index of breakpoint, from 0 to 3 inclusively
3922
  * dl = index of breakpoint, from 0 to 3 inclusively
3978
  * dh = flags:
3923
  * dh = flags:
3979
    * if high bit is cleared - set breakpoint:
3924
    * if high bit is cleared - set breakpoint:
3980
      * bits 0-1 - condition:
3925
      * bits 0-1 - condition:
3981
        * 00 = breakpoint on execution
3926
        * 00 = breakpoint on execution
3982
        * 01 = breakpoint on read
3927
        * 01 = breakpoint on read
3983
        * 11 = breakpoint on read/write
3928
        * 11 = breakpoint on read/write
3984
      * bits 2-3 - length; for breakpoints on exception it must be
3929
      * bits 2-3 - length; for breakpoints on exception it must be
3985
        00, otherwise one of
3930
        00, otherwise one of
3986
        * 00 = byte
3931
        * 00 = byte
3987
        * 01 = word
3932
        * 01 = word
3988
        * 11 = dword
3933
        * 11 = dword
3989
      * esi = breakpoint address; must be aligned according to
3934
      * esi = breakpoint address; must be aligned according to
3990
        the length (i.e. must be even for word breakpoints,
3935
        the length (i.e. must be even for word breakpoints,
3991
        divisible by 4 for dword)
3936
        divisible by 4 for dword)
3992
    * if high bit is set - clear breakpoint
3937
    * if high bit is set - clear breakpoint
3993
Returned value:
3938
Returned value:
3994
  * eax = 0 - success
3939
  * eax = 0 - success
3995
  * eax = 1 - error in the input data
3940
  * eax = 1 - error in the input data
3996
  * eax = 2 - (reserved, is never returned in the current
3941
  * eax = 2 - (reserved, is never returned in the current
3997
    implementation) a global breakpoint with that index is already set
3942
    implementation) a global breakpoint with that index is already set
3998
Remarks:
3943
Remarks:
3999
  * Process must be loaded for debugging (as is shown in
3944
  * Process must be loaded for debugging (as is shown in
4000
    general description).
3945
    general description).
4001
  * Hardware breakpoints are implemented through DRx-registers of
3946
  * Hardware breakpoints are implemented through DRx-registers of
4002
    the processor, all limitations results from this.
3947
    the processor, all limitations results from this.
4003
  * The function can reinstall the breakpoint, previously set
3948
  * The function can reinstall the breakpoint, previously set
4004
    by it (and it does not inform on this).
3949
    by it (and it does not inform on this).
4005
    Carry on the list of set breakpoints in the debugger.
3950
    Carry on the list of set breakpoints in the debugger.
4006
  * Breakpoints generate debug exception #DB, on which the system
3951
  * Breakpoints generate debug exception #DB, on which the system
4007
    notifies debugger.
3952
    notifies debugger.
4008
  * Breakpoints on write and read/write act after
3953
  * Breakpoints on write and read/write act after
4009
    execution of the caused it instruction.
3954
    execution of the caused it instruction.
4010
 
3955
 
4011
======================================================================
3956
======================================================================
4012
==== Function 70 - work with file system with long names support. ====
3957
==== Function 70 - work with file system with long names support. ====
4013
======================================================================
3958
======================================================================
4014
Parameters:
3959
Parameters:
4015
  * eax = 70
3960
  * eax = 70
4016
  * ebx = pointer to the information structure
3961
  * ebx = pointer to the information structure
4017
Returned value:
3962
Returned value:
4018
  * eax = 0 - success; otherwise file system error code
3963
  * eax = 0 - success; otherwise file system error code
4019
  * some subfunctions return value in other registers too
3964
  * some subfunctions return value in other registers too
4020
General format of the information structure:
3965
General format of the information structure:
4021
  * +0: dword: subfunction number
3966
  * +0: dword: subfunction number
4022
  * +4: dword: file offset
3967
  * +4: dword: file offset
4023
  * +8: dword: high dword of offset (must be 0) or flags field
3968
  * +8: dword: high dword of offset (must be 0) or flags field
4024
  * +12 = +0xC: dword: size
3969
  * +12 = +0xC: dword: size
4025
  * +16 = +0x10: dword: pointer to data
3970
  * +16 = +0x10: dword: pointer to data
4026
  * +20 = +0x14: n db: ASCIIZ-string with the filename
3971
  * +20 = +0x14: n db: ASCIIZ-string with the filename
4027
    or
3972
    or
4028
  * +20 = +0x14: db 0
3973
  * +20 = +0x14: db 0
4029
  * +21 = +0x15: dd pointer to ASCIIZ-string with the filename
3974
  * +21 = +0x15: dd pointer to ASCIIZ-string with the filename
4030
Specifications - in documentation on the appropriate subfunction.
3975
Specifications - in documentation on the appropriate subfunction.
4031
Filename is case-insensitive. Russian letters must be written in
3976
Filename is case-insensitive. Russian letters must be written in
4032
the encoding cp866 (DOS).
3977
the encoding cp866 (DOS).
4033
Format of filename:
3978
Format of filename:
4034
/base/number/dir1/dir2/.../dirn/file,
3979
/base/number/dir1/dir2/.../dirn/file,
4035
where /base/number identifies device, on which file is located:
3980
where /base/number identifies device, on which file is located:
4036
one of
3981
one of
4037
  * /RD/1 = /RAMDISK/1 to access ramdisk
3982
  * /RD/1 = /RAMDISK/1 to access ramdisk
4038
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
3983
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
4039
    /FD/2 = /FLOPPYDISK/2 to access second one
3984
    /FD/2 = /FLOPPYDISK/2 to access second one
4040
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
3985
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
4041
    IDE0 (Primary Master), IDE1 (Primary Slave),
3986
    IDE0 (Primary Master), IDE1 (Primary Slave),
4042
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
3987
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
4043
    x - partition number on the selected hard drive, varies from 1
3988
    x - partition number on the selected hard drive, varies from 1
4044
    to 255 (on each hard drive the indexing starts from 1)
3989
    to 255 (on each hard drive the indexing starts from 1)
4045
  * /CD0/1, /CD1/1, /CD2/1, /CD3/1 to access accordingly to
3990
  * /CD0/1, /CD1/1, /CD2/1, /CD3/1 to access accordingly to
4046
    CD on IDE0 (Primary Master), IDE1 (Primary Slave),
3991
    CD on IDE0 (Primary Master), IDE1 (Primary Slave),
4047
    IDE2 (Secondary Master), IDE3 (Secondary Slave)
3992
    IDE2 (Secondary Master), IDE3 (Secondary Slave)
4048
Examples:
3993
Examples:
4049
  * '/rd/1/kernel.asm',0
3994
  * '/rd/1/kernel.asm',0
4050
  * '/HD0/1/kernel.asm',0
3995
  * '/HD0/1/kernel.asm',0
4051
  * '/hd0/2/menuet/pics/tanzania.bmp',0
3996
  * '/hd0/2/menuet/pics/tanzania.bmp',0
4052
  * '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0
3997
  * '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0
4053
Available subfunctions:
3998
Available subfunctions:
4054
  * subfunction 0 - read file
3999
  * subfunction 0 - read file
4055
  * subfunction 1 - read folder
4000
  * subfunction 1 - read folder
4056
  * subfunction 2 - create/rewrite file
4001
  * subfunction 2 - create/rewrite file
4057
  * subfunction 3 - write to existing file
4002
  * subfunction 3 - write to existing file
4058
  * subfunction 4 - set file size
4003
  * subfunction 4 - set file size
4059
  * subfunction 5 - get attributes of file/folder
4004
  * subfunction 5 - get attributes of file/folder
4060
  * subfunction 6 - set attributes of file/folder
4005
  * subfunction 6 - set attributes of file/folder
4061
  * subfunction 7 - start application
4006
  * subfunction 7 - start application
4062
  * subfunction 8 - delete file/folder
4007
  * subfunction 8 - delete file/folder
-
 
4008
  * subfunction 9 - create folder
4063
For CD-drives due to hardware limitations only subfunctions
4009
For CD-drives due to hardware limitations only subfunctions
4064
0,1,5 and 7 are available, other subfunctions return error
4010
0,1,5 and 7 are available, other subfunctions return error
4065
with code 2.
4011
with code 2.
4066
 
4012
 
4067
======================================================================
4013
======================================================================
4068
=== Function 70, subfunction 0 - read file with long names support. ==
4014
=== Function 70, subfunction 0 - read file with long names support. ==
4069
======================================================================
4015
======================================================================
4070
Parameters:
4016
Parameters:
4071
  * eax = 70 - function number
4017
  * eax = 70 - function number
4072
  * ebx = pointer to the information structure
4018
  * ebx = pointer to the information structure
4073
Format of the information structure:
4019
Format of the information structure:
4074
  * +0: dword: 0 = subfunction number
4020
  * +0: dword: 0 = subfunction number
4075
  * +4: dword: file offset (in bytes)
4021
  * +4: dword: file offset (in bytes)
4076
  * +8: dword: 0 (reserved for high dword of offset)
4022
  * +8: dword: 0 (reserved for high dword of offset)
4077
  * +12 = +0xC: dword: number of bytes to read
4023
  * +12 = +0xC: dword: number of bytes to read
4078
  * +16 = +0x10: dword: pointer to buffer for data
4024
  * +16 = +0x10: dword: pointer to buffer for data
4079
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4025
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4080
    given in the general description
4026
    given in the general description
4081
    or
4027
    or
4082
  * +20 = +0x14: db 0
4028
  * +20 = +0x14: db 0
4083
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4029
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4084
Returned value:
4030
Returned value:
4085
  * eax = 0 - success, otherwise file system error code
4031
  * eax = 0 - success, otherwise file system error code
4086
  * ebx = number of read bytes or -1=0xffffffff if file was not found
4032
  * ebx = number of read bytes or -1=0xffffffff if file was not found
4087
Remarks:
4033
Remarks:
4088
  * If file was ended before last requested block was read,
4034
  * If file was ended before last requested block was read,
4089
    the function will read as many as it can, and after that return
4035
    the function will read as many as it can, and after that return
4090
    eax=6 (EOF).
4036
    eax=6 (EOF).
4091
  * The function does not allow to read folder (returns eax=10,
4037
  * The function does not allow to read folder (returns eax=10,
4092
    access denied).
4038
    access denied).
4093
 
4039
 
4094
======================================================================
4040
======================================================================
4095
== Function 70, subfunction 1 - read folder with long names support. =
4041
== Function 70, subfunction 1 - read folder with long names support. =
4096
======================================================================
4042
======================================================================
4097
Parameters:
4043
Parameters:
4098
  * eax = 70 - function number
4044
  * eax = 70 - function number
4099
  * ebx = pointer to the information structure
4045
  * ebx = pointer to the information structure
4100
Format of the information structure:
4046
Format of the information structure:
4101
  * +0: dword: 1 = subfunction number
4047
  * +0: dword: 1 = subfunction number
4102
  * +4: dword: index of starting block (beginning from 0)
4048
  * +4: dword: index of starting block (beginning from 0)
4103
  * +8: dword: flags field:
4049
  * +8: dword: flags field:
4104
    * bit 0 (mask 1): in what format to return names,
4050
    * bit 0 (mask 1): in what format to return names,
4105
      0=ANSI, 1=UNICODE
4051
      0=ANSI, 1=UNICODE
4106
    * other bits are reserved and must be set to 0 for the future
4052
    * other bits are reserved and must be set to 0 for the future
4107
      compatibility
4053
      compatibility
4108
  * +12 = +0xC: dword: number of blocks to read
4054
  * +12 = +0xC: dword: number of blocks to read
4109
  * +16 = +0x10: dword: pointer to buffer for data, buffer size
4055
  * +16 = +0x10: dword: pointer to buffer for data, buffer size
4110
    must be not less than 32 + [+12]*560 bytes
4056
    must be not less than 32 + [+12]*560 bytes
4111
  * +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
4057
  * +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
4112
    given in the general description
4058
    given in the general description
4113
    or
4059
    or
4114
  * +20 = +0x14: db 0
4060
  * +20 = +0x14: db 0
4115
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4061
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4116
Returned value:
4062
Returned value:
4117
  * eax = 0 - success, otherwise file system error code
4063
  * eax = 0 - success, otherwise file system error code
4118
  * ebx = number of files, information on which was written to
4064
  * ebx = number of files, information on which was written to
4119
    the buffer, or -1=0xffffffff, if folder was not found
4065
    the buffer, or -1=0xffffffff, if folder was not found
4120
Structure of the buffer:
4066
Structure of the buffer:
4121
  * +0: 32*byte: header
4067
  * +0: 32*byte: header
4122
  * +32 = +0x20: n1*byte: block with information on file 1
4068
  * +32 = +0x20: n1*byte: block with information on file 1
4123
  * +32+n1: n2*byte: block with information on file 2
4069
  * +32+n1: n2*byte: block with information on file 2
4124
  * ...
4070
  * ...
4125
Structure of header:
4071
Structure of header:
4126
  * +0: dword: version of structure (current is 1)
4072
  * +0: dword: version of structure (current is 1)
4127
  * +4: dword: number of placed blocks; is not greater than requested
4073
  * +4: dword: number of placed blocks; is not greater than requested
4128
    in the field +12 of information structure; can be less, if
4074
    in the field +12 of information structure; can be less, if
4129
    there are no more files in folder (the same as in ebx)
4075
    there are no more files in folder (the same as in ebx)
4130
  * +8: dword: total number of files in folder
4076
  * +8: dword: total number of files in folder
4131
  * +12 = +0xC: 20*byte: reserved (zeroed)
4077
  * +12 = +0xC: 20*byte: reserved (zeroed)
4132
Structure of block of data for folder entry (BDFE):
4078
Structure of block of data for folder entry (BDFE):
4133
  * +0: dword: attributes of file:
4079
  * +0: dword: attributes of file:
4134
    * bit 0 (mask 1): file is read-only
4080
    * bit 0 (mask 1): file is read-only
4135
    * bit 1 (mask 2): file is hidden
4081
    * bit 1 (mask 2): file is hidden
4136
    * bit 2 (mask 4): file is system
4082
    * bit 2 (mask 4): file is system
4137
    * bit 3 (mask 8): this is not a file but volume label
4083
    * bit 3 (mask 8): this is not a file but volume label
4138
      (for one partition meets no more than once and
4084
      (for one partition meets no more than once and
4139
      only in root folder)
4085
      only in root folder)
4140
    * bit 4 (mask 0x10): this is a folder
4086
    * bit 4 (mask 0x10): this is a folder
4141
    * bit 5 (mask 0x20): file was not archived - many archivation
4087
    * bit 5 (mask 0x20): file was not archived - many archivation
4142
      programs have an option to archive only files with this bit set,
4088
      programs have an option to archive only files with this bit set,
4143
      and after archiving this bit is cleared - it can be useful
4089
      and after archiving this bit is cleared - it can be useful
4144
      for automatically creating of backup-archives as at writing
4090
      for automatically creating of backup-archives as at writing
4145
      this bit is usually set
4091
      this bit is usually set
4146
  * +4: byte: type of name data:
4092
  * +4: byte: type of name data:
4147
    (coincides with bit 0 of flags in the information structure)
4093
    (coincides with bit 0 of flags in the information structure)
4148
    * 0 = ASCII = 1-byte representation of each character
4094
    * 0 = ASCII = 1-byte representation of each character
4149
    * 1 = UNICODE = 2-byte representation of each character
4095
    * 1 = UNICODE = 2-byte representation of each character
4150
  * +5: 3*byte: reserved (zero)
4096
  * +5: 3*byte: reserved (zero)
4151
  * +8: 4*byte: time of file creation
4097
  * +8: 4*byte: time of file creation
4152
  * +12 = +0xC: 4*byte: date of file creation
4098
  * +12 = +0xC: 4*byte: date of file creation
4153
  * +16 = +0x10: 4*byte: time of last access (read or write)
4099
  * +16 = +0x10: 4*byte: time of last access (read or write)
4154
  * +20 = +0x14: 4*byte: date of last access
4100
  * +20 = +0x14: 4*byte: date of last access
4155
  * +24 = +0x18: 4*byte: time of last modification
4101
  * +24 = +0x18: 4*byte: time of last modification
4156
  * +28 = +0x1C: 4*byte: date of last modification
4102
  * +28 = +0x1C: 4*byte: date of last modification
4157
  * +32 = +0x20: qword: file size in bytes (up to 16777216 Tb)
4103
  * +32 = +0x20: qword: file size in bytes (up to 16777216 Tb)
4158
  * +40 = +0x28: name
4104
  * +40 = +0x28: name
4159
    * for ASCII format: maximum length is 263 characters
4105
    * for ASCII format: maximum length is 263 characters
4160
      (263 bytes), byte after the name has value 0
4106
      (263 bytes), byte after the name has value 0
4161
    * äëÿ ôîðìàòà UNICODE: maximum length is 259 characters
4107
    * for UNICODE format: maximum length is 259 characters
4162
      (518 bytes), 2 bytes after the name have value 0
4108
      (518 bytes), 2 bytes after the name have value 0
4163
Time format:
4109
Time format:
4164
  * +0: byte: seconds
4110
  * +0: byte: seconds
4165
  * +1: byte: minutes
4111
  * +1: byte: minutes
4166
  * +2: byte: hours
4112
  * +2: byte: hours
4167
  * +3: byte: reserved (0)
4113
  * +3: byte: reserved (0)
4168
  * for example, 23.59.59 is written as (in hex) 3B 3B 17 00
4114
  * for example, 23.59.59 is written as (in hex) 3B 3B 17 00
4169
Date format:
4115
Date format:
4170
  * +0: byte: day
4116
  * +0: byte: day
4171
  * +1: byte: month
4117
  * +1: byte: month
4172
  * +2: word: year
4118
  * +2: word: year
4173
  * for example, 25.11.1979 is written as (in hex) 19 0B BB 07
4119
  * for example, 25.11.1979 is written as (in hex) 19 0B BB 07
4174
Remarks:
4120
Remarks:
4175
  * If BDFE contains ASCII name, the length of BDFE is 304 bytes,
4121
  * If BDFE contains ASCII name, the length of BDFE is 304 bytes,
4176
    if UNICODE name - 560 bytes. Value of length is aligned
4122
    if UNICODE name - 560 bytes. Value of length is aligned
4177
    on 16-byte bound (to accelerate processing in CPU cache).
4123
    on 16-byte bound (to accelerate processing in CPU cache).
4178
  * First character after a name is zero (ASCIIZ-string). The further
4124
  * First character after a name is zero (ASCIIZ-string). The further
4179
    data contain garbage.
4125
    data contain garbage.
4180
  * If files in folder were ended before requested number was read,
4126
  * If files in folder were ended before requested number was read,
4181
    the function will read as many as it can, and after that return
4127
    the function will read as many as it can, and after that return
4182
    eax=6 (EOF).
4128
    eax=6 (EOF).
4183
  * Any folder on the disk, except for root, contains two special
4129
  * Any folder on the disk, except for root, contains two special
4184
    entries "." and "..", identifying accordingly the folder itself
4130
    entries "." and "..", identifying accordingly the folder itself
4185
    and the parent folder.
4131
    and the parent folder.
4186
  * The function allows also to read virtual folders "/", "/rd",
4132
  * The function allows also to read virtual folders "/", "/rd",
4187
    "/fd", "/hd[n]", thus attributes of subfolders are set to 0x10,
4133
    "/fd", "/hd[n]", thus attributes of subfolders are set to 0x10,
4188
    and times and dates are zeroed. An alternative way to get the
4134
    and times and dates are zeroed. An alternative way to get the
4189
    equipment information - subfunction 11 of function 18.
4135
    equipment information - subfunction 11 of function 18.
4190
 
4136
 
4191
======================================================================
4137
======================================================================
4192
===================== Function 70, subfunction 2 =====================
4138
===================== Function 70, subfunction 2 =====================
4193
============ Create/rewrite file with long names support. ============
4139
============ Create/rewrite file with long names support. ============
4194
======================================================================
4140
======================================================================
4195
Parameters:
4141
Parameters:
4196
  * eax = 70 - function number
4142
  * eax = 70 - function number
4197
  * ebx = pointer to the information structure
4143
  * ebx = pointer to the information structure
4198
Format of the information structure:
4144
Format of the information structure:
4199
  * +0: dword: 2 = subfunction number
4145
  * +0: dword: 2 = subfunction number
4200
  * +4: dword: 0 (reserved)
4146
  * +4: dword: 0 (reserved)
4201
  * +8: dword: 0 (reserved)
4147
  * +8: dword: 0 (reserved)
4202
  * +12 = +0xC: dword: number of bytes to read
4148
  * +12 = +0xC: dword: number of bytes to read
4203
  * +16 = +0x10: dword: pointer to data
4149
  * +16 = +0x10: dword: pointer to data
4204
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4150
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4205
    given in the general description
4151
    given in the general description
4206
    or
4152
    or
4207
  * +20 = +0x14: db 0
4153
  * +20 = +0x14: db 0
4208
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4154
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4209
Returned value:
4155
Returned value:
4210
  * eax = 0 - success, otherwise file system error code
4156
  * eax = 0 - success, otherwise file system error code
4211
  * ebx = number of written bytes (possibly 0)
4157
  * ebx = number of written bytes (possibly 0)
4212
Remarks:
4158
Remarks:
4213
  * If a file with given name did not exist, it is created;
4159
  * If a file with given name did not exist, it is created;
4214
    if it existed, it is rewritten.
4160
    if it existed, it is rewritten.
4215
  * If there is not enough free space on disk, the function will
4161
  * If there is not enough free space on disk, the function will
4216
    write as many as can and then return error code 8.
4162
    write as many as can and then return error code 8.
4217
  * The function is not supported for CD (returns error code 2).
4163
  * The function is not supported for CD (returns error code 2).
4218
 
4164
 
4219
======================================================================
4165
======================================================================
4220
===================== Function 70, subfunction 3 =====================
4166
===================== Function 70, subfunction 3 =====================
4221
=========== Write to existing file with long names support. ==========
4167
=========== Write to existing file with long names support. ==========
4222
======================================================================
4168
======================================================================
4223
Parameters:
4169
Parameters:
4224
  * eax = 70 - function number
4170
  * eax = 70 - function number
4225
  * ebx = pointer to the information structure
4171
  * ebx = pointer to the information structure
4226
Format of the information structure:
4172
Format of the information structure:
4227
  * +0: dword: 3 = subfunction number
4173
  * +0: dword: 3 = subfunction number
4228
  * +4: dword: file offset (in bytes)
4174
  * +4: dword: file offset (in bytes)
4229
  * +8: dword: high dword of offset (must be 0 for FAT)
4175
  * +8: dword: high dword of offset (must be 0 for FAT)
4230
  * +12 = +0xC: dword: number of bytes to write
4176
  * +12 = +0xC: dword: number of bytes to write
4231
  * +16 = +0x10: dword: pointer to data
4177
  * +16 = +0x10: dword: pointer to data
4232
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4178
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4233
    given in the general description
4179
    given in the general description
4234
    or
4180
    or
4235
  * +20 = +0x14: db 0
4181
  * +20 = +0x14: db 0
4236
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4182
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4237
Returned value:
4183
Returned value:
4238
  * eax = 0 - success, otherwise file system error code
4184
  * eax = 0 - success, otherwise file system error code
4239
  * ebx = number of written bytes (possibly 0)
4185
  * ebx = number of written bytes (possibly 0)
4240
Remarks:
4186
Remarks:
4241
  * The file must already exist, otherwise function returns eax=5.
4187
  * The file must already exist, otherwise function returns eax=5.
4242
  * The only result of write 0 bytes is update in the file attributes
4188
  * The only result of write 0 bytes is update in the file attributes
4243
    date/time of modification and access to the current date/time.
4189
    date/time of modification and access to the current date/time.
4244
  * If beginning and/or ending position is greater than file size
4190
  * If beginning and/or ending position is greater than file size
4245
    (except for the previous case), the file is expanded to needed
4191
    (except for the previous case), the file is expanded to needed
4246
    size with zero characters.
4192
    size with zero characters.
4247
  * The function is not supported for CD (returns error code 2).
4193
  * The function is not supported for CD (returns error code 2).
4248
 
4194
 
4249
======================================================================
4195
======================================================================
4250
============ Function 70, subfunction 4 - set end of file. ===========
4196
============ Function 70, subfunction 4 - set end of file. ===========
4251
======================================================================
4197
======================================================================
4252
Parameters:
4198
Parameters:
4253
  * eax = 70 - function number
4199
  * eax = 70 - function number
4254
  * ebx = pointer to the information structure
4200
  * ebx = pointer to the information structure
4255
Format of the information structure:
4201
Format of the information structure:
4256
  * +0: dword: 4 = subfunction number
4202
  * +0: dword: 4 = subfunction number
4257
  * +4: dword: low dword of new file size
4203
  * +4: dword: low dword of new file size
4258
  * +8: dword: high dword of new file size (must be 0 for FAT)
4204
  * +8: dword: high dword of new file size (must be 0 for FAT)
4259
  * +12 = +0xC: dword: 0 (reserved)
4205
  * +12 = +0xC: dword: 0 (reserved)
4260
  * +16 = +0x10: dword: 0 (reserved)
4206
  * +16 = +0x10: dword: 0 (reserved)
4261
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4207
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4262
    given in the general description
4208
    given in the general description
4263
    or
4209
    or
4264
  * +20 = +0x14: db 0
4210
  * +20 = +0x14: db 0
4265
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4211
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4266
Returned value:
4212
Returned value:
4267
  * eax = 0 - success, otherwise file system error code
4213
  * eax = 0 - success, otherwise file system error code
4268
  * ebx destroyed
4214
  * ebx destroyed
4269
Remarks:
4215
Remarks:
4270
  * If the new file size is less than old one, file is truncated.
4216
  * If the new file size is less than old one, file is truncated.
4271
    If the new size is greater than old one, file is expanded with
4217
    If the new size is greater than old one, file is expanded with
4272
    characters with code 0. If the new size is equal to old one,
4218
    characters with code 0. If the new size is equal to old one,
4273
    the only result of call is set date/time of modification and
4219
    the only result of call is set date/time of modification and
4274
    access to the current date/time.
4220
    access to the current date/time.
4275
  * If there is not enough free space on disk for expansion, the
4221
  * If there is not enough free space on disk for expansion, the
4276
    function will expand to maximum possible size and then return
4222
    function will expand to maximum possible size and then return
4277
    error code 8.
4223
    error code 8.
4278
  * The function is not supported for CD (returns error code 2).
4224
  * The function is not supported for CD (returns error code 2).
4279
 
4225
 
4280
======================================================================
4226
======================================================================
4281
==== Function 70, subfunction 5 - get information on file/folder. ====
4227
==== Function 70, subfunction 5 - get information on file/folder. ====
4282
======================================================================
4228
======================================================================
4283
Parameters:
4229
Parameters:
4284
  * eax = 70 - function number
4230
  * eax = 70 - function number
4285
  * ebx = pointer to the information structure
4231
  * ebx = pointer to the information structure
4286
Format of the information structure:
4232
Format of the information structure:
4287
  * +0: dword: 5 = subfunction number
4233
  * +0: dword: 5 = subfunction number
4288
  * +4: dword: 0 (reserved)
4234
  * +4: dword: 0 (reserved)
4289
  * +8: dword: 0 (reserved)
4235
  * +8: dword: 0 (reserved)
4290
  * +12 = +0xC: dword: 0 (reserved)
4236
  * +12 = +0xC: dword: 0 (reserved)
4291
  * +16 = +0x10: dword: pointer to buffer for data (40 bytes)
4237
  * +16 = +0x10: dword: pointer to buffer for data (40 bytes)
4292
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4238
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4293
    given in the general description
4239
    given in the general description
4294
    or
4240
    or
4295
  * +20 = +0x14: db 0
4241
  * +20 = +0x14: db 0
4296
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4242
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4297
Returned value:
4243
Returned value:
4298
  * eax = 0 - success, otherwise file system error code
4244
  * eax = 0 - success, otherwise file system error code
4299
  * ebx destroyed
4245
  * ebx destroyed
4300
Information on file is returned in the BDFE format (block of data
4246
Information on file is returned in the BDFE format (block of data
4301
for folder entry), explained in the description of
4247
for folder entry), explained in the description of
4302
subfunction 1, but without filename
4248
subfunction 1, but without filename
4303
(i.e. only first 40 = 0x28 bytes).
4249
(i.e. only first 40 = 0x28 bytes).
4304
Remarks:
4250
Remarks:
4305
  * The function does not support virtual folders such as /, /rd and
4251
  * The function does not support virtual folders such as /, /rd and
4306
    root folders like /rd/1.
4252
    root folders like /rd/1.
4307
 
4253
 
4308
======================================================================
4254
======================================================================
4309
===== Function 70, subfunction 6 - set attributes of file/folder. ====
4255
===== Function 70, subfunction 6 - set attributes of file/folder. ====
4310
======================================================================
4256
======================================================================
4311
Parameters:
4257
Parameters:
4312
  * eax = 70 - function number
4258
  * eax = 70 - function number
4313
  * ebx = pointer to the information structure
4259
  * ebx = pointer to the information structure
4314
Format of the information structure:
4260
Format of the information structure:
4315
  * +0: dword: 6 = subfunction number
4261
  * +0: dword: 6 = subfunction number
4316
  * +4: dword: 0 (reserved)
4262
  * +4: dword: 0 (reserved)
4317
  * +8: dword: 0 (reserved)
4263
  * +8: dword: 0 (reserved)
4318
  * +12 = +0xC: dword: 0 (reserved)
4264
  * +12 = +0xC: dword: 0 (reserved)
4319
  * +16 = +0x10: dword: pointer to buffer with attributes (32 bytes)
4265
  * +16 = +0x10: dword: pointer to buffer with attributes (32 bytes)
4320
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4266
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4321
    given in the general description
4267
    given in the general description
4322
    or
4268
    or
4323
  * +20 = +0x14: db 0
4269
  * +20 = +0x14: db 0
4324
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4270
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4325
Returned value:
4271
Returned value:
4326
  * eax = 0 - success, otherwise file system error code
4272
  * eax = 0 - success, otherwise file system error code
4327
  * ebx destroyed
4273
  * ebx destroyed
4328
File attributes are first 32 bytes in BDFE (block of data
4274
File attributes are first 32 bytes in BDFE (block of data
4329
for folder entry), explained in the description of subfunction 1
4275
for folder entry), explained in the description of subfunction 1
4330
(that is, without name and size of file). Attribute
4276
(that is, without name and size of file). Attribute
4331
file/folder/volume label (bits 3,4 in dword +0) is not changed.
4277
file/folder/volume label (bits 3,4 in dword +0) is not changed.
4332
Byte +4 (name format) is ignored.
4278
Byte +4 (name format) is ignored.
4333
Remarks:
4279
Remarks:
4334
  * The function does not support virtual folders such as /, /rd and
4280
  * The function does not support virtual folders such as /, /rd and
4335
    root folders like /rd/1.
4281
    root folders like /rd/1.
4336
  * The function is not supported for CD (returns error code 2).
4282
  * The function is not supported for CD (returns error code 2).
4337
 
4283
 
4338
======================================================================
4284
======================================================================
4339
=========== Function 70, subfunction 7 - start application. ==========
4285
=========== Function 70, subfunction 7 - start application. ==========
4340
======================================================================
4286
======================================================================
4341
Parameters:
4287
Parameters:
4342
  * eax = 70 - function number
4288
  * eax = 70 - function number
4343
  * ebx = pointer to the information structure
4289
  * ebx = pointer to the information structure
4344
Format of the information structure:
4290
Format of the information structure:
4345
  * +0: dword: 7 = subfunction number
4291
  * +0: dword: 7 = subfunction number
4346
  * +4: dword: flags field:
4292
  * +4: dword: flags field:
4347
    * áèò 0: start process as debugged
4293
    * áèò 0: start process as debugged
4348
    * other bits are reserved and must be set to 0
4294
    * other bits are reserved and must be set to 0
4349
  * +8: dword: 0 or pointer to ASCIIZ-string with parameters
4295
  * +8: dword: 0 or pointer to ASCIIZ-string with parameters
4350
  * +12 = +0xC: dword: 0 (reserved)
4296
  * +12 = +0xC: dword: 0 (reserved)
4351
  * +16 = +0x10: dword: 0 (reserved)
4297
  * +16 = +0x10: dword: 0 (reserved)
4352
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4298
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4353
    given in the general description
4299
    given in the general description
4354
    or
4300
    or
4355
  * +20 = +0x14: db 0
4301
  * +20 = +0x14: db 0
4356
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4302
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4357
Returned value:
4303
Returned value:
4358
  * eax > 0 - program is loaded, eax contains PID
4304
  * eax > 0 - program is loaded, eax contains PID
4359
  * eax < 0 - an error has occured, -eax contains
4305
  * eax < 0 - an error has occured, -eax contains
4360
    file system error code
4306
    file system error code
4361
  * ebx destroyed
4307
  * ebx destroyed
4362
Remarks:
4308
Remarks:
4363
  * Command line must be terminated by the character with the code 0
4309
  * Command line must be terminated by the character with the code 0
4364
    (ASCIIZ-string); function takes into account either all characters
4310
    (ASCIIZ-string); function takes into account either all characters
4365
    up to terminating zero inclusively or first 256 character
4311
    up to terminating zero inclusively or first 256 character
4366
    regarding what is less.
4312
    regarding what is less.
4367
  * If the process is started as debugged, it is created in
4313
  * If the process is started as debugged, it is created in
4368
    the suspended state; to run use subfunction 5 of function 69.
4314
    the suspended state; to run use subfunction 5 of function 69.
4369
 
4315
 
4370
======================================================================
4316
======================================================================
4371
========== Function 70, subfunction 8 - delete file/folder. ==========
4317
========== Function 70, subfunction 8 - delete file/folder. ==========
4372
======================================================================
4318
======================================================================
4373
Parameters:
4319
Parameters:
4374
  * eax = 70 - function number
4320
  * eax = 70 - function number
4375
  * ebx = pointer to the information structure
4321
  * ebx = pointer to the information structure
4376
Format of the information structure:
4322
Format of the information structure:
4377
  * +0: dword: 8 = subfunction number
4323
  * +0: dword: 8 = subfunction number
4378
  * +4: dword: 0 (reserved)
4324
  * +4: dword: 0 (reserved)
4379
  * +8: dword: 0 (reserved)
4325
  * +8: dword: 0 (reserved)
4380
  * +12 = +0xC: dword: 0 (reserved)
4326
  * +12 = +0xC: dword: 0 (reserved)
4381
  * +16 = +0x10: dword: 0 (reserved)
4327
  * +16 = +0x10: dword: 0 (reserved)
4382
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4328
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4383
    given in the general description
4329
    given in the general description
4384
    or
4330
    or
4385
  * +20 = +0x14: db 0
4331
  * +20 = +0x14: db 0
4386
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4332
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4387
Returned value:
4333
Returned value:
4388
  * eax = 0 - success, otherwise file system error code
4334
  * eax = 0 - success, otherwise file system error code
4389
  * ebx destroyed
4335
  * ebx destroyed
4390
Remarks:
4336
Remarks:
4391
  * The function is not supported for CD (returns error code 2).
4337
  * The function is not supported for CD (returns error code 2).
4392
  * The function can delete only empty folders (attempt to delete
4338
  * The function can delete only empty folders (attempt to delete
4393
    nonempty folder results in error with code 10, "access denied").
4339
    nonempty folder results in error with code 10, "access denied").
-
 
4340
 
-
 
4341
======================================================================
-
 
4342
============= Function 70, subfunction 9 - create folder. ============
-
 
4343
======================================================================
-
 
4344
Parameters:
-
 
4345
  * eax = 70 - function number
-
 
4346
  * ebx = pointer to the information structure
-
 
4347
Format of the information structure:
-
 
4348
  * +0: dword: 9 = subfunction number
-
 
4349
  * +4: dword: 0 (reserved)
-
 
4350
  * +8: dword: 0 (reserved)
-
 
4351
  * +12 = +0xC: dword: 0 (reserved)
-
 
4352
  * +16 = +0x10: dword: 0 (reserved)
-
 
4353
  * +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
-
 
4354
    given in the general description
-
 
4355
    or
-
 
4356
  * +20 = +0x14: db 0
-
 
4357
  * +21 = +0x15: dd pointer to ASCIIZ-string with folder name
-
 
4358
Returned value:
-
 
4359
  * eax = 0 - success, otherwise file system error code
-
 
4360
  * ebx destroyed
-
 
4361
Remarks:
-
 
4362
  * The function is not supported for CD (returns error code 2).
-
 
4363
  * The parent folder must already exist.
-
 
4364
  * If target folder already exists, function returns success (eax=0).
4394
 
4365
 
4395
======================================================================
4366
======================================================================
4396
========== Function 71, subfunction 1 - set window caption. ==========
4367
========== Function 71, subfunction 1 - set window caption. ==========
4397
======================================================================
4368
======================================================================
4398
Parameters:
4369
Parameters:
4399
  * eax = 71 - function number
4370
  * eax = 71 - function number
4400
  * ebx = 1 - subfunction number
4371
  * ebx = 1 - subfunction number
4401
  * ecx = pointer to caption string
4372
  * ecx = pointer to caption string
4402
Returned value:
4373
Returned value:
4403
  * function does not return value
4374
  * function does not return value
4404
Remarks:
4375
Remarks:
4405
  * String must be in the ASCIIZ-format. Disregarding real string
4376
  * String must be in the ASCIIZ-format. Disregarding real string
4406
    length, no more than 255 characters are drawn.
4377
    length, no more than 255 characters are drawn.
4407
  * Pass NULL in ecx to remove caption.
4378
  * Pass NULL in ecx to remove caption.
4408
 
4379
 
4409
======================================================================
4380
======================================================================
4410
=============== Function -1 - terminate thread/process ===============
4381
=============== Function -1 - terminate thread/process ===============
4411
======================================================================
4382
======================================================================
4412
Parameters:
4383
Parameters:
4413
  * eax = -1 - function number
4384
  * eax = -1 - function number
4414
Returned value:
4385
Returned value:
4415
  * function does not return neither value nor control
4386
  * function does not return neither value nor control
4416
Remarks:
4387
Remarks:
4417
  * If the process did not create threads obviously, it has only
4388
  * If the process did not create threads obviously, it has only
4418
    one thread, which termination results in process termination.
4389
    one thread, which termination results in process termination.
4419
  * If the current thread is last in the process, its termination
4390
  * If the current thread is last in the process, its termination
4420
    also results in process terminates.
4391
    also results in process terminates.
4421
  * This function terminates the current thread. Other thread can be
4392
  * This function terminates the current thread. Other thread can be
4422
    killed by call to subfunction 2 of function 18.
4393
    killed by call to subfunction 2 of function 18.
4423
 
4394
 
4424
======================================================================
4395
======================================================================
4425
=========================== List of events ===========================
4396
=========================== List of events ===========================
4426
======================================================================
4397
======================================================================
4427
Next event can be retrieved by the call of one from functions 10
4398
Next event can be retrieved by the call of one from functions 10
4428
(to wait for event), 11 (to check without waiting), 23
4399
(to wait for event), 11 (to check without waiting), 23
4429
(to wait during the given time).
4400
(to wait during the given time).
4430
These functions return only those events, which enter into a mask set
4401
These functions return only those events, which enter into a mask set
4431
by function 40. By default it is first three,
4402
by function 40. By default it is first three,
4432
there is enough for most applications.
4403
there is enough for most applications.
4433
Codes of events:
4404
Codes of events:
4434
  * 1 = redraw event (is reset by call to function 0)
4405
  * 1 = redraw event (is reset by call to function 0)
4435
  * 2 = key on keyboard is pressed (acts, only when the window is
4406
  * 2 = key on keyboard is pressed (acts, only when the window is
4436
    active) or hotkey is pressed; is reset, when all keys from
4407
    active) or hotkey is pressed; is reset, when all keys from
4437
    the buffer are read out by function 2
4408
    the buffer are read out by function 2
4438
  * 3 = button is pressed, defined earlier by function 8
4409
  * 3 = button is pressed, defined earlier by function 8
4439
    (or close button, created implicitly by function 0;
4410
    (or close button, created implicitly by function 0;
4440
    minimize button is handled by the system and sends no message;
4411
    minimize button is handled by the system and sends no message;
4441
    acts, only when the window is active;
4412
    acts, only when the window is active;
4442
    is reset when all buttons from the buffer
4413
    is reset when all buttons from the buffer
4443
    are read out by function 17)
4414
    are read out by function 17)
4444
  * 4 = reserved (in current implementation never comes even after
4415
  * 4 = reserved (in current implementation never comes even after
4445
    unmasking by function 40)
4416
    unmasking by function 40)
4446
  * 5 = the desktop background is redrawed (is reset automatically
4417
  * 5 = the desktop background is redrawed (is reset automatically
4447
    after redraw, so if in redraw time program does not wait and
4418
    after redraw, so if in redraw time program does not wait and
4448
    does not check events, it will not remark this event)
4419
    does not check events, it will not remark this event)
4449
  * 6 = mouse event (something happened - button pressing or moving;
4420
  * 6 = mouse event (something happened - button pressing or moving;
4450
    is reset at reading)
4421
    is reset at reading)
4451
  * 7 = IPC event (see function 60 -
4422
  * 7 = IPC event (see function 60 -
4452
    Inter Process Communication; is reset at reading)
4423
    Inter Process Communication; is reset at reading)
4453
  * 8 = network event (is reset at reading)
4424
  * 8 = network event (is reset at reading)
4454
  * 9 = debug event (is reset at reading; see
4425
  * 9 = debug event (is reset at reading; see
4455
    debug subsystem)
4426
    debug subsystem)
4456
  * 16..31 = event with appropriate IRQ
4427
  * 16..31 = event with appropriate IRQ
4457
    (16=IRQ0, 31=IRQ15) (is reset after reading all IRQ data)
4428
    (16=IRQ0, 31=IRQ15) (is reset after reading all IRQ data)
4458
 
4429
 
4459
======================================================================
4430
======================================================================
4460
=================== Error codes of the file system ===================
4431
=================== Error codes of the file system ===================
4461
======================================================================
4432
======================================================================
4462
  * 0 = success
4433
  * 0 = success
4463
  * 1 = base and/or partition of a hard disk is not defined
4434
  * 1 = base and/or partition of a hard disk is not defined
4464
    (by subfunctions 7, 8 of function 21)
4435
    (by subfunctions 7, 8 of function 21)
4465
  * 2 = function is not supported for the given file system
4436
  * 2 = function is not supported for the given file system
4466
  * 3 = unknown file system
4437
  * 3 = unknown file system
4467
  * 4 = is returned only from function 'rename' by transmission of
4438
  * 4 = is returned only from function 'rename' by transmission of
4468
    the strongly incorrect parameter and in any way does not
4439
    the strongly incorrect parameter and in any way does not
4469
    correspond to the description in the kernel sources
4440
    correspond to the description in the kernel sources
4470
    "partition not defined at hd"
4441
    "partition not defined at hd"
4471
  * 5 = file not found
4442
  * 5 = file not found
4472
  * 6 = end of file, EOF
4443
  * 6 = end of file, EOF
4473
  * 7 = pointer lies outside of application memory
4444
  * 7 = pointer lies outside of application memory
4474
  * 8 = disk is full
4445
  * 8 = disk is full
4475
  * 9 = FAT table is destroyed
4446
  * 9 = FAT table is destroyed
4476
  * 10 = access denied
4447
  * 10 = access denied
4477
  * 11 = device error
4448
  * 11 = device error
4478
Application start functions can return also following errors:
4449
Application start functions can return also following errors:
4479
  * 30 = 0x1E = not enough memory
4450
  * 30 = 0x1E = not enough memory
4480
  * 31 = 0x1F = file is not executable
4451
  * 31 = 0x1F = file is not executable
4481
  * 32 = 0x20 = too many processes
4452
  * 32 = 0x20 = too many processes
4482
>
4453
>
4483
>
4454
>
4484
>
4455
>
4485
>
4456
>