Subversion Repositories Kolibri OS

Rev

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

Rev 139 Rev 142
1
SYSTEM FUNCTIONS of OS Kolibri 0.5.8.1
1
SYSTEM FUNCTIONS of OS Kolibri 0.5.8.1
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 is reserved (set to 0)
35
      * C is reserved (set to 0)
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: alignment, this byte preserves
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
-
 
344
    * +54 = +0x36: dword: coordinate of the client area on axis x
-
 
345
    * +58 = +0x3A: dword: coordinate of the client area on axis y
-
 
346
    * +62 = +0x3E: dword: width of the client area
-
 
347
    * +66 = +0x42: dword: height of the client area
-
 
348
    * +70 = +0x46: byte: state of the window - bitfield
-
 
349
      * bit 0 (mask 1): window is maximized
-
 
350
      * bit 1 (mask 2): window is minimized to panel
-
 
351
      * bit 2 (mask 4): window is rolled up
343
Remarks:
352
Remarks:
344
  * Slots are numbered starting from 1.
353
  * Slots are numbered starting from 1.
345
  * Returned value is not a total number of threads, because there
354
  * Returned value is not a total number of threads, because there
346
    can be free slots.
355
    can be free slots.
347
  * When process is starting, system automatically creates
356
  * When process is starting, system automatically creates
348
    execution thread.
357
    execution thread.
349
  * Function gives information on the thread. Each process has
358
  * Function gives information on the thread. Each process has
350
    at least one thread. One process can create many threads,
359
    at least one thread. One process can create many threads,
351
    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
352
    +10, +22, +26 in these slots coincide.
361
    +10, +22, +26 in these slots coincide.
353
    Applications have no common way to define whether two threads
362
    Applications have no common way to define whether two threads
354
    belong to one process.
363
    belong to one process.
355
  * The active window - window on top of the window stack -
364
  * The active window - window on top of the window stack -
356
    receives the messages on a keyboard input. For such window
365
    receives the messages on a keyboard input. For such window
357
    the position in the window stack coincides with returned value.
366
    the position in the window stack coincides with returned value.
358
  * Slot 1 corresponds to special system thread, for which:
367
  * Slot 1 corresponds to special system thread, for which:
359
    * 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
360
      +4 and +6 contain value 1
369
      +4 and +6 contain value 1
361
    * name of the process - "OS/IDLE" (supplemented by spaces)
370
    * name of the process - "OS/IDLE" (supplemented by spaces)
362
    * 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
363
      16 Mb (0x1000000)
372
      16 Mb (0x1000000)
364
    * PID=1
373
    * PID=1
365
    * coordinates and sizes of the window are by convention set to 0
374
    * coordinates and sizes of the window and the client area are by
-
 
375
      convention set to 0
366
    * status of the slot is always 0 (running)
376
    * status of the slot is always 0 (running)
367
    * the execution time adds of time leaving on operations itself
377
    * the execution time adds of time leaving on operations itself
368
      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
369
      to subfunction 4 of function 18).
379
      to subfunction 4 of function 18).
370
  * Beginning from slot 2, the normal applications are placed.
380
  * Beginning from slot 2, the normal applications are placed.
371
  * The normal applications are placed in memory at the address
381
  * The normal applications are placed in memory at the address
372
    0x10000000 (kernel constand 'std_application_base_address').
382
    0x10000000 (kernel constand 'std_application_base_address').
373
    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.
374
  * At creation of the thread it is assigned the slot
384
  * At creation of the thread it is assigned the slot
375
    in the system table and identifier (Process/Thread IDentifier =
385
    in the system table and identifier (Process/Thread IDentifier =
376
    PID/TID), which do not vary with time for given thread.
386
    PID/TID), which do not vary with time for given thread.
377
    After completion of the thread its slot can be anew used
387
    After completion of the thread its slot can be anew used
378
    for another thread. The thread identifier can not be assigned
388
    for another thread. The thread identifier can not be assigned
379
    to other thread even after completion of this thread.
389
    to other thread even after completion of this thread.
380
    Identifiers, assigned to new threads, grow monotonously.
390
    Identifiers, assigned to new threads, grow monotonously.
381
  * 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
382
    function 0, the position and the sizes
392
    function 0, the position and the sizes
383
    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.
384
  * 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
385
    52 = 0x34 bytes is used. Nevertheless it is recommended to use
396
    71 = 0x37 bytes is used. Nevertheless it is recommended to use
386
    1-Kb buffer for the future compatibility, in the future
397
    1-Kb buffer for the future compatibility, in the future
387
    some fields can be added.
398
    some fields can be added.
388
 
399
 
389
======================================================================
400
======================================================================
390
==================== Function 10 - wait for event. ===================
401
==================== Function 10 - wait for event. ===================
391
======================================================================
402
======================================================================
392
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
393
in queue. In this state thread does not consume CPU time.
404
in queue. In this state thread does not consume CPU time.
394
Then reads out the message from queue.
405
Then reads out the message from queue.
395
 
406
 
396
Parameters:
407
Parameters:
397
  * eax = 10 - function number
408
  * eax = 10 - function number
398
Returned value:
409
Returned value:
399
  * eax = event (see the list of events)
410
  * eax = event (see the list of events)
400
Remarks:
411
Remarks:
401
  * Those events are taken into account only which enter into
412
  * Those events are taken into account only which enter into
402
    a mask set by function 40. By default it is
413
    a mask set by function 40. By default it is
403
    redraw, key and button events.
414
    redraw, key and button events.
404
  * 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.
405
    To wait for no more than given time, use function 23.
416
    To wait for no more than given time, use function 23.
406
 
417
 
407
======================================================================
418
======================================================================
408
=============== Function 11 - check for event, no wait. ==============
419
=============== Function 11 - check for event, no wait. ==============
409
======================================================================
420
======================================================================
410
If the message queue contains event, function reads out
421
If the message queue contains event, function reads out
411
and return it. If the queue is empty, function returns 0.
422
and return it. If the queue is empty, function returns 0.
412
Parameters:
423
Parameters:
413
  * eax = 11 - function number
424
  * eax = 11 - function number
414
Returned value:
425
Returned value:
415
  * eax = 0 - message queue is empty
426
  * eax = 0 - message queue is empty
416
  * else eax = event (see the list of events)
427
  * else eax = event (see the list of events)
417
Remarks:
428
Remarks:
418
  * Those events are taken into account only, which enter into
429
  * Those events are taken into account only, which enter into
419
    a mask set by function 40. By default it is
430
    a mask set by function 40. By default it is
420
    redraw, key and button events.
431
    redraw, key and button events.
421
  * To wait for event, use function 10.
432
  * To wait for event, use function 10.
422
    To wait for no more than given time, use function 23.
433
    To wait for no more than given time, use function 23.
423
 
434
 
424
======================================================================
435
======================================================================
425
=============== Function 12 - begin/end window redraw. ===============
436
=============== Function 12 - begin/end window redraw. ===============
426
======================================================================
437
======================================================================
427
 
438
 
428
---------------- Subfunction 1 - begin window redraw. ----------------
439
---------------- Subfunction 1 - begin window redraw. ----------------
429
Parameters:
440
Parameters:
430
  * eax = 12 - function number
441
  * eax = 12 - function number
431
  * ebx = 1 - subfunction number
442
  * ebx = 1 - subfunction number
432
Returned value:
443
Returned value:
433
  * function does not return value
444
  * function does not return value
434
 
445
 
435
----------------- Subfunction 2 - end window redraw. -----------------
446
----------------- Subfunction 2 - end window redraw. -----------------
436
Parameters:
447
Parameters:
437
  * eax = 12 - function number
448
  * eax = 12 - function number
438
  * ebx = 2 - subfunction number
449
  * ebx = 2 - subfunction number
439
Returned value:
450
Returned value:
440
  * function does not return value
451
  * function does not return value
441
Remarks:
452
Remarks:
442
  * Subfunction 1 deletes all buttons defined with
453
  * Subfunction 1 deletes all buttons defined with
443
    function 8, they must be defined again.
454
    function 8, they must be defined again.
444
 
455
 
445
======================================================================
456
======================================================================
446
============ Function 13 - draw a rectangle in the window. ===========
457
============ Function 13 - draw a rectangle in the window. ===========
447
======================================================================
458
======================================================================
448
Parameters:
459
Parameters:
449
  * eax = 13 - function number
460
  * eax = 13 - function number
450
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
461
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
451
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
462
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
452
  * edx = color 0xRRGGBB or 0x80RRGGBB for gradient fill
463
  * edx = color 0xRRGGBB or 0x80RRGGBB for gradient fill
453
Returned value:
464
Returned value:
454
  * function does not return value
465
  * function does not return value
455
Remarks:
466
Remarks:
456
  * Coordinates are understood as coordinates of the left upper corner
467
  * Coordinates are understood as coordinates of the left upper corner
457
    of a rectangle relative to the window.
468
    of a rectangle relative to the window.
458
 
469
 
459
======================================================================
470
======================================================================
460
=================== Function 14 - get screen size. ===================
471
=================== Function 14 - get screen size. ===================
461
======================================================================
472
======================================================================
462
Parameters:
473
Parameters:
463
  * eax = 14 - function number
474
  * eax = 14 - function number
464
Returned value:
475
Returned value:
465
  * eax = [xsize]*65536 + [ysize], where
476
  * eax = [xsize]*65536 + [ysize], where
466
  * xsize = x-coordinate of the right lower corner of the screen =
477
  * xsize = x-coordinate of the right lower corner of the screen =
467
            horizontal size - 1
478
            horizontal size - 1
468
  * ysize = y-coordinate of the right lower corner of the screen =
479
  * ysize = y-coordinate of the right lower corner of the screen =
469
            vertical size - 1
480
            vertical size - 1
470
Remarks:
481
Remarks:
471
  * See also subfunction 5 of function 48 - get sizes of
482
  * See also subfunction 5 of function 48 - get sizes of
472
    working area of the screen.
483
    working area of the screen.
473
 
484
 
474
======================================================================
485
======================================================================
475
== Function 15, subfunction 1 - set a size of the background image. ==
486
== Function 15, subfunction 1 - set a size of the background image. ==
476
======================================================================
487
======================================================================
477
Parameters:
488
Parameters:
478
  * eax = 15 - function number
489
  * eax = 15 - function number
479
  * ebx = 1 - subfunction number
490
  * ebx = 1 - subfunction number
480
  * ecx = width of the image
491
  * ecx = width of the image
481
  * edx = height of the image
492
  * edx = height of the image
482
Returned value:
493
Returned value:
483
  * function does not return value
494
  * function does not return value
484
Remarks:
495
Remarks:
485
  * There is no checks for correctness. The setting of too large
496
  * There is no checks for correctness. The setting of too large
486
    values will result that the background will contain data abroad
497
    values will result that the background will contain data abroad
487
    of buffer for the background image. Buffer size = 0x160000-0x10,
498
    of buffer for the background image. Buffer size = 0x160000-0x10,
488
    that corresponds to maximum size 800*600. (800*600*3=0x15F900)
499
    that corresponds to maximum size 800*600. (800*600*3=0x15F900)
489
  * 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
490
    working with a background) call subfunction 3.
501
    working with a background) call subfunction 3.
491
  * 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 -
492
    subfunction 1 of function 39.
503
    subfunction 1 of function 39.
493
 
504
 
494
======================================================================
505
======================================================================
495
=== Function 15, subfunction 2 - put pixel on the background image. ==
506
=== Function 15, subfunction 2 - put pixel on the background image. ==
496
======================================================================
507
======================================================================
497
Parameters:
508
Parameters:
498
  * eax = 15 - function number
509
  * eax = 15 - function number
499
  * ebx = 2 - subfunction number
510
  * ebx = 2 - subfunction number
500
  * ecx = offset
511
  * ecx = offset
501
  * edx = color of a pixel 0xRRGGBB
512
  * edx = color of a pixel 0xRRGGBB
502
Returned value:
513
Returned value:
503
  * function does not return value
514
  * function does not return value
504
Remarks:
515
Remarks:
505
  * Offset for a pixel with coordinates (x,y) is calculated as
516
  * Offset for a pixel with coordinates (x,y) is calculated as
506
    (x+y*xsize)*3.
517
    (x+y*xsize)*3.
507
  * 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,
508
    the call is ignored.
519
    the call is ignored.
509
  * 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
510
    working with a background) call subfunction 3.
521
    working with a background) call subfunction 3.
511
  * 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 -
512
    subfunction 2 of function 39.
523
    subfunction 2 of function 39.
513
 
524
 
514
======================================================================
525
======================================================================
515
=========== Function 15, subfunction 3 - redraw background. ==========
526
=========== Function 15, subfunction 3 - redraw background. ==========
516
======================================================================
527
======================================================================
517
Parameters:
528
Parameters:
518
  * eax = 15 - function number
529
  * eax = 15 - function number
519
  * ebx = 3 - subfunction number
530
  * ebx = 3 - subfunction number
520
Returned value:
531
Returned value:
521
  * function does not return value
532
  * function does not return value
522
 
533
 
523
======================================================================
534
======================================================================
524
== Function 15, subfunction 4 - set drawing mode for the background. =
535
== Function 15, subfunction 4 - set drawing mode for the background. =
525
======================================================================
536
======================================================================
526
Parameters:
537
Parameters:
527
  * eax = 15 - function number
538
  * eax = 15 - function number
528
  * ebx = 4 - subfunction number
539
  * ebx = 4 - subfunction number
529
  * ecx = drawing mode:
540
  * ecx = drawing mode:
530
    * 1 = tile
541
    * 1 = tile
531
    * 2 = stretch
542
    * 2 = stretch
532
Returned value:
543
Returned value:
533
  * function does not return value
544
  * function does not return value
534
Remarks:
545
Remarks:
535
  * 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
536
    working with a background) call subfunction 3.
547
    working with a background) call subfunction 3.
537
  * 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 -
538
    subfunction 4 of function 39.
549
    subfunction 4 of function 39.
539
 
550
 
540
======================================================================
551
======================================================================
541
===================== Function 15, subfunction 5 =====================
552
===================== Function 15, subfunction 5 =====================
542
============ Put block of pixels on the background image. ============
553
============ Put block of pixels on the background image. ============
543
======================================================================
554
======================================================================
544
Parameters:
555
Parameters:
545
  * eax = 15 - function number
556
  * eax = 15 - function number
546
  * ebx = 5 - subfunction number
557
  * ebx = 5 - subfunction number
547
  * ecx = pointer to the data in the format BBGGRRBBGGRR...
558
  * ecx = pointer to the data in the format BBGGRRBBGGRR...
548
  * edx = offset in data of the background image
559
  * edx = offset in data of the background image
549
  * esi = size of data in bytes = 3 * number of pixels
560
  * esi = size of data in bytes = 3 * number of pixels
550
Returned value:
561
Returned value:
551
  * function does not return value
562
  * function does not return value
552
Remarks:
563
Remarks:
553
  * 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,
554
    the call is ignored.
565
    the call is ignored.
555
  * Color of each pixel is stored as 3-bytes value BBGGRR.
566
  * Color of each pixel is stored as 3-bytes value BBGGRR.
556
  * Pixels of the background image are written sequentially
567
  * Pixels of the background image are written sequentially
557
    from left to right, from up to down.
568
    from left to right, from up to down.
558
  * 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.
559
  * 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
560
    working with a background) call subfunction 3.
571
    working with a background) call subfunction 3.
561
 
572
 
562
======================================================================
573
======================================================================
563
=============== Function 16 - save ramdisk on a floppy. ==============
574
=============== Function 16 - save ramdisk on a floppy. ==============
564
======================================================================
575
======================================================================
565
Parameters:
576
Parameters:
566
  * eax = 16 - function number
577
  * eax = 16 - function number
567
  * ebx = 1 or ebx = 2 - on which floppy save
578
  * ebx = 1 or ebx = 2 - on which floppy save
568
Returned value:
579
Returned value:
569
  * eax = 0 - success
580
  * eax = 0 - success
570
  * eax = 1 - error
581
  * eax = 1 - error
571
 
582
 
572
======================================================================
583
======================================================================
573
======= Function 17 - get the identifier of the pressed button. ======
584
======= Function 17 - get the identifier of the pressed button. ======
574
======================================================================
585
======================================================================
575
Takes away the code of the pressed button from the buffer.
586
Takes away the code of the pressed button from the buffer.
576
Parameters:
587
Parameters:
577
  * eax = 17 - function number
588
  * eax = 17 - function number
578
Returned value:
589
Returned value:
579
  * if the buffer is empty, function returns eax=1
590
  * if the buffer is empty, function returns eax=1
580
  * if the buffer is not empty, function returns al=0,
591
  * if the buffer is not empty, function returns al=0,
581
    high 24 bits of eax contain button identifier (in particular, ah
592
    high 24 bits of eax contain button identifier (in particular, ah
582
    contains low byte of the identifier; if all buttons have
593
    contains low byte of the identifier; if all buttons have
583
    the identifier less than 256, ah is enough to distinguish).
594
    the identifier less than 256, ah is enough to distinguish).
584
Remarks:
595
Remarks:
585
  * "Buffer" keeps only one button, at pressing the new button the
596
  * "Buffer" keeps only one button, at pressing the new button the
586
    information about old is lost.
597
    information about old is lost.
587
  * The call of this function by an application with inactive window
598
  * The call of this function by an application with inactive window
588
    will return answer "buffer is empty".
599
    will return answer "buffer is empty".
589
 
600
 
590
======================================================================
601
======================================================================
591
============ Function 18, subfunction 1 - system shutdown. ===========
602
============ Function 18, subfunction 1 - system shutdown. ===========
592
======================================================================
603
======================================================================
593
Parameters:
604
Parameters:
594
  * eax = 18 - function number
605
  * eax = 18 - function number
595
  * ebx = 1 - subfunction number
606
  * ebx = 1 - subfunction number
596
Returned value:
607
Returned value:
597
  * function always return eax = 0 as tag of success
608
  * function always return eax = 0 as tag of success
598
Remarks:
609
Remarks:
599
  * 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
600
    response of the user.
611
    response of the user.
601
  * See also subfunction 9, system shutdown with
612
  * See also subfunction 9, system shutdown with
602
    the parameter to force the choice in the exit menu.
613
    the parameter to force the choice in the exit menu.
603
 
614
 
604
======================================================================
615
======================================================================
605
= Function 18, subfunction 2 - terminate process/thread by the slot. =
616
= Function 18, subfunction 2 - terminate process/thread by the slot. =
606
======================================================================
617
======================================================================
607
Parameters:
618
Parameters:
608
  * eax = 18 - function number
619
  * eax = 18 - function number
609
  * ebx = 2 - subfunction number
620
  * ebx = 2 - subfunction number
610
  * ecx = number of the slot of process/thread
621
  * ecx = number of the slot of process/thread
611
Returned value:
622
Returned value:
612
  * function does not return value
623
  * function does not return value
613
Remarks:
624
Remarks:
614
  * It is impossible to terminate system thread OS/IDLE (with
625
  * It is impossible to terminate system thread OS/IDLE (with
615
    number of the slot 1),
626
    number of the slot 1),
616
    it is possible to terminate any normal process/thread.
627
    it is possible to terminate any normal process/thread.
617
  * See also subfunction 18 - terminate
628
  * See also subfunction 18 - terminate
618
    process/thread by the identifier.
629
    process/thread by the identifier.
619
 
630
 
620
======================================================================
631
======================================================================
621
===================== Function 18, subfunction 3 =====================
632
===================== Function 18, subfunction 3 =====================
622
============= Make active the window of the given thread. ============
633
============= Make active the window of the given thread. ============
623
======================================================================
634
======================================================================
624
Parameters:
635
Parameters:
625
  * eax = 18 - function number
636
  * eax = 18 - function number
626
  * ebx = 3 - subfunction number
637
  * ebx = 3 - subfunction number
627
  * ecx = number of the thread slot
638
  * ecx = number of the thread slot
628
Returned value:
639
Returned value:
629
  * function does not return value
640
  * function does not return value
630
Remarks:
641
Remarks:
631
  * If correct, but nonexistent slot is given,
642
  * If correct, but nonexistent slot is given,
632
    some window is made active.
643
    some window is made active.
633
  * To find out, which window is active, use subfunction 7.
644
  * To find out, which window is active, use subfunction 7.
634
 
645
 
635
======================================================================
646
======================================================================
636
===================== Function 18, subfunction 4 =====================
647
===================== Function 18, subfunction 4 =====================
637
=========== Get counter of idle time units per one second. ===========
648
=========== Get counter of idle time units per one second. ===========
638
======================================================================
649
======================================================================
639
Idle time units are units, in which the processor stands idle
650
Idle time units are units, in which the processor stands idle
640
in waiting for interrupt (in the command 'hlt').
651
in waiting for interrupt (in the command 'hlt').
641
 
652
 
642
Parameters:
653
Parameters:
643
  * eax = 18 - function number
654
  * eax = 18 - function number
644
  * ebx = 4 - subfunction number
655
  * ebx = 4 - subfunction number
645
Returned value:
656
Returned value:
646
  * 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
647
 
658
 
648
======================================================================
659
======================================================================
649
========== Function 18, subfunction 5 - get CPU clock rate. ==========
660
========== Function 18, subfunction 5 - get CPU clock rate. ==========
650
======================================================================
661
======================================================================
651
Parameters:
662
Parameters:
652
  * eax = 18 - function number
663
  * eax = 18 - function number
653
  * ebx = 5 - subfunction number
664
  * ebx = 5 - subfunction number
654
Returned value:
665
Returned value:
655
  * eax = clock rate (modulo 2^32 clock ticks = 4GHz)
666
  * eax = clock rate (modulo 2^32 clock ticks = 4GHz)
656
 
667
 
657
======================================================================
668
======================================================================
658
 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. 
659
======================================================================
670
======================================================================
660
Parameters:
671
Parameters:
661
  * eax = 18 - function number
672
  * eax = 18 - function number
662
  * ebx = 6 - subfunction number
673
  * ebx = 6 - subfunction number
663
  * ecx defines path to the file:
674
  * ecx defines path to the file:
664
    * 1 = in the folder "/KOLIBRI"
675
    * 1 = in the folder "/KOLIBRI"
665
    * 2 = in the root folder
676
    * 2 = in the root folder
666
    * 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,
667
      divided by '/')
678
      divided by '/')
668
Returned value:
679
Returned value:
669
  * eax = 0 - success
680
  * eax = 0 - success
670
  * else eax = error code of the file system
681
  * else eax = error code of the file system
671
Çàìå÷àíèÿ:
682
Çàìå÷àíèÿ:
672
  * Filename is fixed, "menuet.img" (global kernel variable
683
  * Filename is fixed, "menuet.img" (global kernel variable
673
    'image_save' from 'preboot.inc')
684
    'image_save' from 'preboot.inc')
674
  * Drive and partition are defined by subfunction 7
685
  * Drive and partition are defined by subfunction 7
675
    and subfunction 8 of function 21.
686
    and subfunction 8 of function 21.
676
  * All folders in the given path must exist, otherwise function
687
  * All folders in the given path must exist, otherwise function
677
    returns value 5, "file not found".
688
    returns value 5, "file not found".
678
 
689
 
679
======================================================================
690
======================================================================
680
=========== Function 18, subfunction 7 - get active window. ==========
691
=========== Function 18, subfunction 7 - get active window. ==========
681
======================================================================
692
======================================================================
682
Parameters:
693
Parameters:
683
  * eax = 18 - function number
694
  * eax = 18 - function number
684
  * ebx = 7 - subfunction number
695
  * ebx = 7 - subfunction number
685
Returned value:
696
Returned value:
686
  * eax = number of the active window
697
  * eax = number of the active window
687
    (number of the slot of the thread with active window)
698
    (number of the slot of the thread with active window)
688
Remarks:
699
Remarks:
689
  * 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
690
    messages on all keyboard input.
701
    messages on all keyboard input.
691
  * To make a window active, use subfunction 3.
702
  * To make a window active, use subfunction 3.
692
 
703
 
693
======================================================================
704
======================================================================
694
== Function 18, subfunction 8 - disable/enable the internal speaker. =
705
== Function 18, subfunction 8 - disable/enable the internal speaker. =
695
======================================================================
706
======================================================================
696
If speaker sound is disabled, all calls to subfunction 55 of
707
If speaker sound is disabled, all calls to subfunction 55 of
697
function 55 are ignored. If speaker sound is enabled,
708
function 55 are ignored. If speaker sound is enabled,
698
they are routed on builtin speaker.
709
they are routed on builtin speaker.
699
 
710
 
700
------------------- Subsubfunction 1 - get status. -------------------
711
------------------- Subsubfunction 1 - get status. -------------------
701
Parameters:
712
Parameters:
702
  * eax = 18 - function number
713
  * eax = 18 - function number
703
  * ebx = 8 - subfunction number
714
  * ebx = 8 - subfunction number
704
  * ecx = 1 - number of the subsubfunction
715
  * ecx = 1 - number of the subsubfunction
705
Returned value:
716
Returned value:
706
  * eax = 0 - speaker sound is enabled; 1 - disabled
717
  * eax = 0 - speaker sound is enabled; 1 - disabled
707
 
718
 
708
----------------- Subsubfunction 2 - toggle status. ------------------
719
----------------- Subsubfunction 2 - toggle status. ------------------
709
Toggles states of disable/enable.
720
Toggles states of disable/enable.
710
Parameters:
721
Parameters:
711
  * eax = 18 - function number
722
  * eax = 18 - function number
712
  * ebx = 8 - subfunction number
723
  * ebx = 8 - subfunction number
713
  * ecx = 2 - number of the subsubfunction
724
  * ecx = 2 - number of the subsubfunction
714
Returned value:
725
Returned value:
715
  * function does not return value
726
  * function does not return value
716
 
727
 
717
======================================================================
728
======================================================================
718
== Function 18, subfunction 9 - system shutdown with the parameter. ==
729
== Function 18, subfunction 9 - system shutdown with the parameter. ==
719
======================================================================
730
======================================================================
720
Parameters:
731
Parameters:
721
  * eax = 18 - function number
732
  * eax = 18 - function number
722
  * ebx = 9 - subfunction number
733
  * ebx = 9 - subfunction number
723
  * ecx = parameter:
734
  * ecx = parameter:
724
    * 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
725
      then show the exit menu and request further operations
736
      then show the exit menu and request further operations
726
      from the user
737
      from the user
727
    * 2 = turn off computer
738
    * 2 = turn off computer
728
    * 3 = reboot computer
739
    * 3 = reboot computer
729
    * 4 = restart the kernel from the file 'kernel.mnt' on ramdisk
740
    * 4 = restart the kernel from the file 'kernel.mnt' on ramdisk
730
Returned value:
741
Returned value:
731
  * 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)
732
  * by correct call function always returns eax=0
743
  * by correct call function always returns eax=0
733
    as the tag of success
744
    as the tag of success
734
Remarks:
745
Remarks:
735
  * 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
736
    changed in future versions of the kernel.
747
    changed in future versions of the kernel.
737
  * 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
738
    the user makes choice himself.
749
    the user makes choice himself.
739
  * 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
740
    with excessive questions); to save ramdisk on a floppy use
751
    with excessive questions); to save ramdisk on a floppy use
741
    function 16 (which admits specification, on which floppy to
752
    function 16 (which admits specification, on which floppy to
742
    write), and to shutdown with the exit menu use already mentioned
753
    write), and to shutdown with the exit menu use already mentioned
743
    subfunction 1.
754
    subfunction 1.
744
 
755
 
745
======================================================================
756
======================================================================
746
===== Function 18, subfunction 10 - minimize application window. =====
757
===== Function 18, subfunction 10 - minimize application window. =====
747
======================================================================
758
======================================================================
748
Minimizes the own window.
759
Minimizes the own window.
749
Parameters:
760
Parameters:
750
  * eax = 18 - function number
761
  * eax = 18 - function number
751
  * ebx = 10 - subfunction number
762
  * ebx = 10 - subfunction number
752
Returned value:
763
Returned value:
753
  * function does not return value
764
  * function does not return value
754
Remarks:
765
Remarks:
755
  * The minimized window from the point of view of function 9
766
  * The minimized window from the point of view of function 9
756
    keeps position and sizes.
767
    keeps position and sizes.
757
  * Restoring of an application window occurs at its activation by 
768
  * Restoring of an application window occurs at its activation by 
758
    subfunction 3.
769
    subfunction 3.
759
  * Usually there is no necessity to minimize/restire a window
770
  * Usually there is no necessity to minimize/restire a window
760
    obviously: minimization of a window is carried out by the system
771
    obviously: minimization of a window is carried out by the system
761
    at pressing the minimization button (for skinned windows
772
    at pressing the minimization button (for skinned windows
762
    it is defined automatically by function 0,
773
    it is defined automatically by function 0,
763
    for other windows it can be defined manually by function 8),
774
    for other windows it can be defined manually by function 8),
764
    restore of a window is done by the application '@panel'.
775
    restore of a window is done by the application '@panel'.
765
 
776
 
766
======================================================================
777
======================================================================
767
 Function 18, subfunction 11 - get information on the disk subsystem. 
778
 Function 18, subfunction 11 - get information on the disk subsystem. 
768
======================================================================
779
======================================================================
769
Parameters:
780
Parameters:
770
  * eax = 18 - function number
781
  * eax = 18 - function number
771
  * ebx = 11 - subfunction number
782
  * ebx = 11 - subfunction number
772
  * ecx = type of the table:
783
  * ecx = type of the table:
773
    * 1 = short version, 10 bytes
784
    * 1 = short version, 10 bytes
774
    * 2 = full version, 65536 bytes
785
    * 2 = full version, 65536 bytes
775
  * edx = pointer to the buffer (in the application) for the table
786
  * edx = pointer to the buffer (in the application) for the table
776
Returned value:
787
Returned value:
777
  * function does not return value
788
  * function does not return value
778
Format of the table: short version:
789
Format of the table: short version:
779
  * +0: byte: information about FDD's (drives for floppies),
790
  * +0: byte: information about FDD's (drives for floppies),
780
    AAAABBBB, where AAAA gives type of the first drive, BBBB -
791
    AAAABBBB, where AAAA gives type of the first drive, BBBB -
781
    of the second regarding to the following list:
792
    of the second regarding to the following list:
782
    * 0 = there is no drive
793
    * 0 = there is no drive
783
    * 1 = 360Kb, 5.25''
794
    * 1 = 360Kb, 5.25''
784
    * 2 = 1.2Mb, 5.25''
795
    * 2 = 1.2Mb, 5.25''
785
    * 3 = 720Kb, 3.5''
796
    * 3 = 720Kb, 3.5''
786
    * 4 = 1.44Mb, 3.5''
797
    * 4 = 1.44Mb, 3.5''
787
    * 5 = 2.88Mb, 3.5'' (such drives are not used anymore)
798
    * 5 = 2.88Mb, 3.5'' (such drives are not used anymore)
788
    For example, for the standard configuration from one 1.44-drive
799
    For example, for the standard configuration from one 1.44-drive
789
    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:
790
    the value is 24h.
801
    the value is 24h.
791
  * +1: byte: information about hard disks and CD-drives, AABBCCDD,
802
  * +1: byte: information about hard disks and CD-drives, AABBCCDD,
792
    where AA corresponds to the controller IDE0, ..., DD - IDE3:
803
    where AA corresponds to the controller IDE0, ..., DD - IDE3:
793
    * 0 = device is absent
804
    * 0 = device is absent
794
    * 1 = hard drive
805
    * 1 = hard drive
795
    * 2 = CD-drive
806
    * 2 = CD-drive
796
    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
797
    this field contains 48h.
808
    this field contains 48h.
798
  * +2: 4 db: number of the retrieved partitions on hard disks
809
  * +2: 4 db: number of the retrieved partitions on hard disks
799
    at accordingly IDE0,...,IDE3.
810
    at accordingly IDE0,...,IDE3.
800
    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,
801
    otherwise it shows number of the recognized partitions, which
812
    otherwise it shows number of the recognized partitions, which
802
    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
803
    the file system is not supported). Current version of the kernel
814
    the file system is not supported). Current version of the kernel
804
    supports only FAT16 and FAT32 for hard disks.
815
    supports only FAT16 and FAT32 for hard disks.
805
  * +6: 4 db: reserved
816
  * +6: 4 db: reserved
806
Format of the table: full version:
817
Format of the table: full version:
807
  * +0: 10 db: same as for the short version
818
  * +0: 10 db: same as for the short version
808
  * +10: 100 db: data for the first partition
819
  * +10: 100 db: data for the first partition
809
  * +110: 100 db: data for the second partition
820
  * +110: 100 db: data for the second partition
810
  * ...
821
  * ...
811
  * +10+100*(n-1): 100 db: data for the last partition
822
  * +10+100*(n-1): 100 db: data for the last partition
812
The partitions are located as follows: at first sequentially all
823
The partitions are located as follows: at first sequentially all
813
recoginzed partitions on HD on IDE0 (if present),
824
recoginzed partitions on HD on IDE0 (if present),
814
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.
815
Format of the information about partition
826
Format of the information about partition
816
(at moment only FAT is supported):
827
(at moment only FAT is supported):
817
  * +0: dword: first physical sector of the partition
828
  * +0: dword: first physical sector of the partition
818
  * +4: dword: last physical sector of the partition
829
  * +4: dword: last physical sector of the partition
819
    (belongs to the partition)
830
    (belongs to the partition)
820
  * +8: dword: sectors per one copy of FAT
831
  * +8: dword: sectors per one copy of FAT
821
  * +12 = +0xC: dword: number of copies of FAT
832
  * +12 = +0xC: dword: number of copies of FAT
822
  * +16 = +0x10: dword: number of sectors per cluster
833
  * +16 = +0x10: dword: number of sectors per cluster
823
  * +20 = +0x14: dword: bytes per sector;
834
  * +20 = +0x14: dword: bytes per sector;
824
    current implementation expects 0x200 = 512 in this field
835
    current implementation expects 0x200 = 512 in this field
825
  * +24 = +0x18: dword: first root cluster in FAT32, 0 for FAT16
836
  * +24 = +0x18: dword: first root cluster in FAT32, 0 for FAT16
826
  * +28 = +0x1C: dword: first physical sector of FAT
837
  * +28 = +0x1C: dword: first physical sector of FAT
827
  * +32 = +0x20: dword: first physical root sector for FAT16,
838
  * +32 = +0x20: dword: first physical root sector for FAT16,
828
    ignored for FAT32
839
    ignored for FAT32
829
  * +36 = +0x24: dword: number of root sectors for FAT16,
840
  * +36 = +0x24: dword: number of root sectors for FAT16,
830
    0 for FAT32
841
    0 for FAT32
831
  * +40 = +0x28: dword: physical sector of the beginning of
842
  * +40 = +0x28: dword: physical sector of the beginning of
832
    the data area
843
    the data area
833
  * +44 = +0x2C: dword: maximum number of a cluster
844
  * +44 = +0x2C: dword: maximum number of a cluster
834
  * +48 = +0x30: dword: physical sector of the information
845
  * +48 = +0x30: dword: physical sector of the information
835
    about the file system for FAT32, ignored for FAT16
846
    about the file system for FAT32, ignored for FAT16
836
  * +52 = +0x34: dword: value used as boundary for special
847
  * +52 = +0x34: dword: value used as boundary for special
837
    values in FAT
848
    values in FAT
838
  * +56 = +0x38: dword: value used for bad clusters in FAT
849
  * +56 = +0x38: dword: value used for bad clusters in FAT
839
  * +60 = +0x3C: dword: value used as the end marker for FAT chain
850
  * +60 = +0x3C: dword: value used as the end marker for FAT chain
840
  * +64 = +0x40: dword: mask for FAT items
851
  * +64 = +0x40: dword: mask for FAT items
841
  * +68 = +0x44: byte: file system type: 16 èëè 32
852
  * +68 = +0x44: byte: file system type: 16 èëè 32
842
  * +69 = +0x45: 31 db: reserved
853
  * +69 = +0x45: 31 db: reserved
843
Remarks:
854
Remarks:
844
  * The short table can be used for obtaining the information about
855
  * The short table can be used for obtaining the information about
845
    available devices.
856
    available devices.
846
  * First two fields in the information about partition
857
  * First two fields in the information about partition
847
    gives the parameters of partition, other - parameters of
858
    gives the parameters of partition, other - parameters of
848
    FAT file system. For other file systems (when they will be
859
    FAT file system. For other file systems (when they will be
849
    supported) specific for file system information will be, of
860
    supported) specific for file system information will be, of
850
    course, another, but first two fields will have the same sense.
861
    course, another, but first two fields will have the same sense.
851
 
862
 
852
======================================================================
863
======================================================================
853
========== Function 18, subfunction 13 - get kernel version. =========
864
========== Function 18, subfunction 13 - get kernel version. =========
854
======================================================================
865
======================================================================
855
Parameters:
866
Parameters:
856
  * eax = 18 - function number
867
  * eax = 18 - function number
857
  * ebx = 13 - subfunction number
868
  * ebx = 13 - subfunction number
858
  * ecx = pointer to the buffer (not less than 16 bytes), where
869
  * ecx = pointer to the buffer (not less than 16 bytes), where
859
    the information will be placed
870
    the information will be placed
860
Returned value:
871
Returned value:
861
  * function does not return value
872
  * function does not return value
862
Structure of the buffer:
873
Structure of the buffer:
863
db a,b,c,d for version a.b.c.d
874
db a,b,c,d for version a.b.c.d
864
db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
875
db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
865
db 'name',0 - ASCIIZ-string with the name
876
db 'name',0 - ASCIIZ-string with the name
866
For Kolibri 0.5.8.1 kernel:
877
For Kolibri 0.5.8.1 kernel:
867
db 0,5,8,1
878
db 0,5,8,1
868
db 2
879
db 2
869
db 'Kolibri',0
880
db 'Kolibri',0
870
 
881
 
871
======================================================================
882
======================================================================
872
======= Function 18, subfunction 14 - wait for screen retrace. =======
883
======= Function 18, subfunction 14 - wait for screen retrace. =======
873
======================================================================
884
======================================================================
874
Waits for the beginning of retrace of the scanning ray of the screen
885
Waits for the beginning of retrace of the scanning ray of the screen
875
monitor.
886
monitor.
876
Parameters:
887
Parameters:
877
  * eax = 18 - function number
888
  * eax = 18 - function number
878
  * ebx = 14 - subfunction number
889
  * ebx = 14 - subfunction number
879
Returned value:
890
Returned value:
880
  * eax = 0 as the tag of success
891
  * eax = 0 as the tag of success
881
Remarks:
892
Remarks:
882
  * Function is intended only for active high-efficiency graphics
893
  * Function is intended only for active high-efficiency graphics
883
    applications; is used for smooth output of a graphics.
894
    applications; is used for smooth output of a graphics.
884
 
895
 
885
======================================================================
896
======================================================================
886
== Function 18, subfunction 15 - center mouse cursor on the screen. ==
897
== Function 18, subfunction 15 - center mouse cursor on the screen. ==
887
======================================================================
898
======================================================================
888
Parameters:
899
Parameters:
889
  * eax = 18 - function number
900
  * eax = 18 - function number
890
  * ebx = 15 - subfunction number
901
  * ebx = 15 - subfunction number
891
Returned value:
902
Returned value:
892
  * eax = 0 as the tag of success
903
  * eax = 0 as the tag of success
893
 
904
 
894
======================================================================
905
======================================================================
895
========= Function 18, subfunction 16 - get size of free RAM. ========
906
========= Function 18, subfunction 16 - get size of free RAM. ========
896
======================================================================
907
======================================================================
897
Parameters:
908
Parameters:
898
  * eax = 18 - function number
909
  * eax = 18 - function number
899
  * ebx = 16 - subfunction number
910
  * ebx = 16 - subfunction number
900
Returned value:
911
Returned value:
901
  * eax = size of free memory in kilobytes
912
  * eax = size of free memory in kilobytes
902
 
913
 
903
======================================================================
914
======================================================================
904
======== Function 18, subfunction 17 - get full amount of RAM. =======
915
======== Function 18, subfunction 17 - get full amount of RAM. =======
905
======================================================================
916
======================================================================
906
Parameters:
917
Parameters:
907
  * eax = 18 - function number
918
  * eax = 18 - function number
908
  * ebx = 17 - subfunction number
919
  * ebx = 17 - subfunction number
909
Returned value:
920
Returned value:
910
  * eax = total size of existing memory in kilobytes
921
  * eax = total size of existing memory in kilobytes
911
 
922
 
912
======================================================================
923
======================================================================
913
===================== Function 18, subfunction 18 ====================
924
===================== Function 18, subfunction 18 ====================
914
============= Terminate process/thread by the identifier. ============
925
============= Terminate process/thread by the identifier. ============
915
======================================================================
926
======================================================================
916
Parameters:
927
Parameters:
917
  * eax = 18 - function number
928
  * eax = 18 - function number
918
  * ebx = 18 - subfunction number
929
  * ebx = 18 - subfunction number
919
  * ecx = identifer of process/thread (PID/TID)
930
  * ecx = identifer of process/thread (PID/TID)
920
Returned value:
931
Returned value:
921
  * eax = 0 - success
932
  * eax = 0 - success
922
  * eax = -1 - error (process is not found or is system)
933
  * eax = -1 - error (process is not found or is system)
923
Remarks:
934
Remarks:
924
  * It is impossible to terminate system thread OS/IDLE (identifier
935
  * It is impossible to terminate system thread OS/IDLE (identifier
925
    1), it is possible to terminate any normal process/thread.
936
    1), it is possible to terminate any normal process/thread.
926
  * See also subfunction 2 - terminate
937
  * See also subfunction 2 - terminate
927
    process/thread by given slot.
938
    process/thread by given slot.
928
 
939
 
929
======================================================================
940
======================================================================
930
======== Function 18, subfunction 19 - get/set mouse features. =======
941
======== Function 18, subfunction 19 - get/set mouse features. =======
931
======================================================================
942
======================================================================
932
 
943
 
933
---------------- Subsubfunction 0 - get mouse speed. -----------------
944
---------------- Subsubfunction 0 - get mouse speed. -----------------
934
Parameters:
945
Parameters:
935
  * eax = 18 - function number
946
  * eax = 18 - function number
936
  * ebx = 19 - subfunction number
947
  * ebx = 19 - subfunction number
937
  * ecx = 0 - subsubfunction number
948
  * ecx = 0 - subsubfunction number
938
Returned value:
949
Returned value:
939
  * eax = current mouse speed
950
  * eax = current mouse speed
940
 
951
 
941
---------------- Subsubfunction 1 - set mouse speed. -----------------
952
---------------- Subsubfunction 1 - set mouse speed. -----------------
942
Parameters:
953
Parameters:
943
  * eax = 18 - function number
954
  * eax = 18 - function number
944
  * ebx = 19 - subfunction number
955
  * ebx = 19 - subfunction number
945
  * ecx = 1 - subsubfunction number
956
  * ecx = 1 - subsubfunction number
946
  * edx = new value for speed
957
  * edx = new value for speed
947
Returned value:
958
Returned value:
948
  * function does not return value
959
  * function does not return value
949
 
960
 
950
---------------- Subsubfunction 2 - get mouse delay. -----------------
961
---------------- Subsubfunction 2 - get mouse delay. -----------------
951
Parameters:
962
Parameters:
952
  * eax = 18 - function number
963
  * eax = 18 - function number
953
  * ebx = 19 - subfunction number
964
  * ebx = 19 - subfunction number
954
  * ecx = 2 - subsubfunction number
965
  * ecx = 2 - subsubfunction number
955
Returned value:
966
Returned value:
956
  * eax = current mouse delay
967
  * eax = current mouse delay
957
 
968
 
958
---------------- Subsubfunction 3 - set mouse delay. -----------------
969
---------------- Subsubfunction 3 - set mouse delay. -----------------
959
Parameters:
970
Parameters:
960
  * eax = 18 - function number
971
  * eax = 18 - function number
961
  * ebx = 19 - subfunction number
972
  * ebx = 19 - subfunction number
962
  * ecx = 3 - subsubfunction number
973
  * ecx = 3 - subsubfunction number
963
  * edx = new value for mouse delay
974
  * edx = new value for mouse delay
964
Returned value:
975
Returned value:
965
  * function does not return value
976
  * function does not return value
966
 
977
 
967
----------- Subsubfunction 4 - set mouse pointer position. -----------
978
----------- Subsubfunction 4 - set mouse pointer position. -----------
968
Parameters:
979
Parameters:
969
  * eax = 18 - function number
980
  * eax = 18 - function number
970
  * ebx = 19 - subfunction number
981
  * ebx = 19 - subfunction number
971
  * ecx = 4 - subsubfunction number
982
  * ecx = 4 - subsubfunction number
972
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
983
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
973
Returned value:
984
Returned value:
974
  * function does not return value
985
  * function does not return value
975
Remarks:
986
Remarks:
976
  * It is recommended to set speed of the mouse (in subsubfunction 1)
987
  * It is recommended to set speed of the mouse (in subsubfunction 1)
977
    from 1 up to 9. The installed value is not inspected by the kernel
988
    from 1 up to 9. The installed value is not inspected by the kernel
978
    code, so set it carefully, at incorrect value the cursor
989
    code, so set it carefully, at incorrect value the cursor
979
    can "freeze". Speed of the mouse can be regulated through the
990
    can "freeze". Speed of the mouse can be regulated through the
980
    application SETUP.
991
    application SETUP.
981
  * Recommended delay of the mouse (in subsubfunction 3) = 10. Lower
992
  * Recommended delay of the mouse (in subsubfunction 3) = 10. Lower
982
    value is not handled by COM mice. At the very large values the
993
    value is not handled by COM mice. At the very large values the
983
    movement of the mouse on 1 pixel is impossible and the cursor will
994
    movement of the mouse on 1 pixel is impossible and the cursor will
984
    jump on the value of installed speed (subsubfunction 1). The
995
    jump on the value of installed speed (subsubfunction 1). The
985
    installed value is not inspected by the kernel code.
996
    installed value is not inspected by the kernel code.
986
    Mouse delay can be regulated through the application SETUP.
997
    Mouse delay can be regulated through the application SETUP.
987
  * The subsubfunction 4 does not check the passed value. Before
998
  * The subsubfunction 4 does not check the passed value. Before
988
    its call find out current screen resolution (with function 14)
999
    its call find out current screen resolution (with function 14)
989
    and check that the value of position is inside the limits of the
1000
    and check that the value of position is inside the limits of the
990
    screen.
1001
    screen.
991
 
1002
 
992
======================================================================
1003
======================================================================
993
============ Function 19 - start application from ramdisk. ===========
1004
============ Function 19 - start application from ramdisk. ===========
994
======================================================================
1005
======================================================================
995
Parameters:
1006
Parameters:
996
  * eax = 19 - function number
1007
  * eax = 19 - function number
997
  * ebx = pointer to the application name in format similar
1008
  * ebx = pointer to the application name in format similar
998
    to function 6
1009
    to function 6
999
  * ecx = 0 or ecx = pointer to command line parameters
1010
  * ecx = 0 or ecx = pointer to command line parameters
1000
Returned value:
1011
Returned value:
1001
  * If eax > 0, then eax contains PID of the created process
1012
  * If eax > 0, then eax contains PID of the created process
1002
  * If eax < 0, then -eax - file system error code
1013
  * If eax < 0, then -eax - file system error code
1003
Remarks:
1014
Remarks:
1004
  * This function is obsolete; use subfunction 7 of function 70.
1015
  * This function is obsolete; use subfunction 7 of function 70.
1005
  * Command line must be terminated by the character with the code 0
1016
  * Command line must be terminated by the character with the code 0
1006
    (ASCIIZ-string); function takes into account either all characters
1017
    (ASCIIZ-string); function takes into account either all characters
1007
    up to terminating zero inclusively or first 256 character
1018
    up to terminating zero inclusively or first 256 character
1008
    regarding what is less.
1019
    regarding what is less.
1009
 
1020
 
1010
======================================================================
1021
======================================================================
1011
==================== Function 20 - MIDI interface. ===================
1022
==================== Function 20 - MIDI interface. ===================
1012
======================================================================
1023
======================================================================
1013
 
1024
 
1014
----------------------- Subfunction 1 - reset ------------------------
1025
----------------------- Subfunction 1 - reset ------------------------
1015
Parameters:
1026
Parameters:
1016
  * eax = 20 - function number
1027
  * eax = 20 - function number
1017
  * ebx = 1 - subfunction number
1028
  * ebx = 1 - subfunction number
1018
 
1029
 
1019
-------------------- Subfunction 2 - output byte ---------------------
1030
-------------------- Subfunction 2 - output byte ---------------------
1020
Parameters:
1031
Parameters:
1021
  * eax = 20 - function number
1032
  * eax = 20 - function number
1022
  * ebx = 2 - subfunction number
1033
  * ebx = 2 - subfunction number
1023
  * cl = byte for output
1034
  * cl = byte for output
1024
Returned value (is the same for both subfunctions):
1035
Returned value (is the same for both subfunctions):
1025
  * eax = 0 - success
1036
  * eax = 0 - success
1026
  * eax = 1 - base port is not defined
1037
  * eax = 1 - base port is not defined
1027
Remarks:
1038
Remarks:
1028
  * Previously the base port must be defined by 
1039
  * Previously the base port must be defined by 
1029
    subfunction 1 of function 21.
1040
    subfunction 1 of function 21.
1030
 
1041
 
1031
======================================================================
1042
======================================================================
1032
======== Function 21, subfunction 1 - set MPU MIDI base port. ========
1043
======== Function 21, subfunction 1 - set MPU MIDI base port. ========
1033
======================================================================
1044
======================================================================
1034
Parameters:
1045
Parameters:
1035
  * eax = 21 - function number
1046
  * eax = 21 - function number
1036
  * ebx = 1 - subfunction number
1047
  * ebx = 1 - subfunction number
1037
  * ecx = number of base port
1048
  * ecx = number of base port
1038
Returned value
1049
Returned value
1039
  * eax = 0 - success
1050
  * eax = 0 - success
1040
  * eax = -1 - erratic number of a port
1051
  * eax = -1 - erratic number of a port
1041
Remarks:
1052
Remarks:
1042
  * Number of a port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1053
  * Number of a port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1043
  * The installation of base is necessary for function 20.
1054
  * The installation of base is necessary for function 20.
1044
  * To get base port use subfunction 1 of function 26.
1055
  * To get base port use subfunction 1 of function 26.
1045
 
1056
 
1046
======================================================================
1057
======================================================================
1047
========== Function 21, subfunction 2 - set keyboard layout. =========
1058
========== Function 21, subfunction 2 - set keyboard layout. =========
1048
======================================================================
1059
======================================================================
1049
Keyboard layout is used to convert keyboard scancodes to ASCII-codes,
1060
Keyboard layout is used to convert keyboard scancodes to ASCII-codes,
1050
which will be read by function 2.
1061
which will be read by function 2.
1051
Parameters:
1062
Parameters:
1052
  * eax = 21 - function number
1063
  * eax = 21 - function number
1053
  * ebx = 2 - subfunction number
1064
  * ebx = 2 - subfunction number
1054
  * ecx = which layout to set:
1065
  * ecx = which layout to set:
1055
    * 1 = normal layout
1066
    * 1 = normal layout
1056
    * 2 = layout at pressed Shift
1067
    * 2 = layout at pressed Shift
1057
    * 3 = layout at pressed Alt
1068
    * 3 = layout at pressed Alt
1058
  * edx = pointer to layout - table of length 128 bytes
1069
  * edx = pointer to layout - table of length 128 bytes
1059
Or:
1070
Or:
1060
  * ecx = 9
1071
  * ecx = 9
1061
  * dx = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1072
  * dx = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1062
Returned value:
1073
Returned value:
1063
  * eax = 0 - success
1074
  * eax = 0 - success
1064
  * eax = 1 - incorrect parameter
1075
  * eax = 1 - incorrect parameter
1065
Remarks:
1076
Remarks:
1066
  * If Alt is pressed, the layout with Alt is used;
1077
  * If Alt is pressed, the layout with Alt is used;
1067
    if Alt is not pressed, but Shift is pressed,
1078
    if Alt is not pressed, but Shift is pressed,
1068
    the layout with Shift is used;
1079
    the layout with Shift is used;
1069
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1080
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1070
    layout is used and then from the code is subtracted 0x60;
1081
    layout is used and then from the code is subtracted 0x60;
1071
    if no control key is pressed, the normal layout is used.
1082
    if no control key is pressed, the normal layout is used.
1072
  * To get layout and country identifier use 
1083
  * To get layout and country identifier use 
1073
    subfunction 2 of function 26.
1084
    subfunction 2 of function 26.
1074
  * Country identifier is global system variable, which is not used
1085
  * Country identifier is global system variable, which is not used
1075
    by the kernel itself; however the application '@panel' displays
1086
    by the kernel itself; however the application '@panel' displays
1076
    the corresponding icon.
1087
    the corresponding icon.
1077
  * The application @panel switches layouts on user request.
1088
  * The application @panel switches layouts on user request.
1078
 
1089
 
1079
======================================================================
1090
======================================================================
1080
============== Function 21, subfunction 3 - set CD base. =============
1091
============== Function 21, subfunction 3 - set CD base. =============
1081
======================================================================
1092
======================================================================
1082
Parameters:
1093
Parameters:
1083
  * eax = 21 - function number
1094
  * eax = 21 - function number
1084
  * ebx = 3 - subfunction number
1095
  * ebx = 3 - subfunction number
1085
  * ecx = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1096
  * ecx = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1086
Returned value:
1097
Returned value:
1087
  * eax = 0
1098
  * eax = 0
1088
Remarks:
1099
Remarks:
1089
  * CD base is used by function 24.
1100
  * CD base is used by function 24.
1090
  * To get CD base use subfunction 3 of function 26.
1101
  * To get CD base use subfunction 3 of function 26.
1091
 
1102
 
1092
======================================================================
1103
======================================================================
1093
====== Function 21, subfunction 4 - set Sound Blaster base port. =====
1104
====== Function 21, subfunction 4 - set Sound Blaster base port. =====
1094
======================================================================
1105
======================================================================
1095
Parameters:
1106
Parameters:
1096
  * eax = 21 - function number
1107
  * eax = 21 - function number
1097
  * ebx = 4 - subfunction number
1108
  * ebx = 4 - subfunction number
1098
  * ecx = number of the base port
1109
  * ecx = number of the base port
1099
Returned value:
1110
Returned value:
1100
  * eax = 0 - success
1111
  * eax = 0 - success
1101
  * eax = -1 - erratic port number
1112
  * eax = -1 - erratic port number
1102
Remarks:
1113
Remarks:
1103
  * Number of the port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1114
  * Number of the port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1104
  * The installation of the base is necessary for
1115
  * The installation of the base is necessary for
1105
    functions 25, 28, 55.
1116
    functions 25, 28, 55.
1106
  * To get base port use subfunction 4 of function 26.
1117
  * To get base port use subfunction 4 of function 26.
1107
 
1118
 
1108
======================================================================
1119
======================================================================
1109
========== Function 21, subfunction 5 - set system language. =========
1120
========== Function 21, subfunction 5 - set system language. =========
1110
======================================================================
1121
======================================================================
1111
Parameters:
1122
Parameters:
1112
  * eax = 21 - function number
1123
  * eax = 21 - function number
1113
  * ebx = 5 - subfunction number
1124
  * ebx = 5 - subfunction number
1114
  * ecx = system language (1=eng, 2=fi, 3=ger, 4=rus)
1125
  * ecx = system language (1=eng, 2=fi, 3=ger, 4=rus)
1115
Returned value:
1126
Returned value:
1116
  * eax = 0
1127
  * eax = 0
1117
Remarks:
1128
Remarks:
1118
  * System language is global system variable and is not used
1129
  * System language is global system variable and is not used
1119
    by the kernel itself, however application @panel draws the
1130
    by the kernel itself, however application @panel draws the
1120
    appropriate icon.
1131
    appropriate icon.
1121
  * Function does not check for correctness, as the kernel does not
1132
  * Function does not check for correctness, as the kernel does not
1122
    use this variable.
1133
    use this variable.
1123
  * To get system language use subfunction 5 of function 26.
1134
  * To get system language use subfunction 5 of function 26.
1124
 
1135
 
1125
======================================================================
1136
======================================================================
1126
=========== Function 21, subfunction 6 - set WSS base port. ==========
1137
=========== Function 21, subfunction 6 - set WSS base port. ==========
1127
======================================================================
1138
======================================================================
1128
Parameters:
1139
Parameters:
1129
  * eax = 21 - function number
1140
  * eax = 21 - function number
1130
  * ebx = 6 - subfunction number
1141
  * ebx = 6 - subfunction number
1131
  * ecx = base port
1142
  * ecx = base port
1132
Returned value:
1143
Returned value:
1133
  * eax = 0 - success
1144
  * eax = 0 - success
1134
  * eax = -1 - erratic port number
1145
  * eax = -1 - erratic port number
1135
Remarks:
1146
Remarks:
1136
  * Port number must satisfy to condition 0x100<=ecx.
1147
  * Port number must satisfy to condition 0x100<=ecx.
1137
  * WSS base is used by function 27.
1148
  * WSS base is used by function 27.
1138
  * To get WSS base port use subfunction 6 of function 26.
1149
  * To get WSS base port use subfunction 6 of function 26.
1139
 
1150
 
1140
======================================================================
1151
======================================================================
1141
============== Function 21, subfunction 7 - set HD base. =============
1152
============== Function 21, subfunction 7 - set HD base. =============
1142
======================================================================
1153
======================================================================
1143
The HD base defines hard disk to write with usage of obsolete
1154
The HD base defines hard disk to write with usage of obsolete
1144
file system functions and functions implicitly using the hard disk
1155
file system functions and functions implicitly using the hard disk
1145
(such as subfunction 6 of function 18);
1156
(such as subfunction 6 of function 18);
1146
at usage of function 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1157
at usage of function 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1147
these function set base themselves.
1158
these function set base themselves.
1148
Parameters:
1159
Parameters:
1149
  * eax = 21 - function number
1160
  * eax = 21 - function number
1150
  * ebx = 7 - subfunction number
1161
  * ebx = 7 - subfunction number
1151
  * ecx = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1162
  * ecx = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1152
Returned value:
1163
Returned value:
1153
  * eax = 0
1164
  * eax = 0
1154
Remarks:
1165
Remarks:
1155
  * Any application at any time can change the base.
1166
  * Any application at any time can change the base.
1156
  * Do not change base, when any application works with hard disk.
1167
  * Do not change base, when any application works with hard disk.
1157
    If you do not want system bugs.
1168
    If you do not want system bugs.
1158
  * To get HD base use subfunction 7 of function 26.
1169
  * To get HD base use subfunction 7 of function 26.
1159
  * It is also necessary to define used partition of hard disk by 
1170
  * It is also necessary to define used partition of hard disk by 
1160
    subfunction 8.
1171
    subfunction 8.
1161
 
1172
 
1162
======================================================================
1173
======================================================================
1163
========= Function 21, subfunction 8 - set used HD partition. ========
1174
========= Function 21, subfunction 8 - set used HD partition. ========
1164
======================================================================
1175
======================================================================
1165
The HD partition defines partition of the hard disk to write with
1176
The HD partition defines partition of the hard disk to write with
1166
usage of obsolete file system functions and functions implicitly
1177
usage of obsolete file system functions and functions implicitly
1167
using the hard disk (such as subfunction 6 of function 18);
1178
using the hard disk (such as subfunction 6 of function 18);
1168
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1179
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1169
these functions set base and partition themselves.
1180
these functions set base and partition themselves.
1170
Parameters:
1181
Parameters:
1171
  * eax = 21 - function number
1182
  * eax = 21 - function number
1172
  * ebx = 8 - subfunction number
1183
  * ebx = 8 - subfunction number
1173
  * ecx = HD partition (beginning from 1)
1184
  * ecx = HD partition (beginning from 1)
1174
Return value:
1185
Return value:
1175
  * eax = 0
1186
  * eax = 0
1176
Remarks:
1187
Remarks:
1177
  * Any application at any time can change partition.
1188
  * Any application at any time can change partition.
1178
  * Do not change partition when any application works with hard disk.
1189
  * Do not change partition when any application works with hard disk.
1179
    If you do not want system bugs.
1190
    If you do not want system bugs.
1180
  * To get used partition use subfunction 8 of function 26.
1191
  * To get used partition use subfunction 8 of function 26.
1181
  * There is no correctness checks.
1192
  * There is no correctness checks.
1182
  * To get the number of partitions of a hard disk use 
1193
  * To get the number of partitions of a hard disk use 
1183
    subfunction 11 of function 18.
1194
    subfunction 11 of function 18.
1184
  * It is also necessary to define used HD base by subfunction 7.
1195
  * It is also necessary to define used HD base by subfunction 7.
1185
 
1196
 
1186
======================================================================
1197
======================================================================
1187
======== Function 21, subfunction 10 - set sound DMA channel. ========
1198
======== Function 21, subfunction 10 - set sound DMA channel. ========
1188
======================================================================
1199
======================================================================
1189
Parameters:
1200
Parameters:
1190
  * eax = 21 - function number
1201
  * eax = 21 - function number
1191
  * ebx = 10 - subfunction number
1202
  * ebx = 10 - subfunction number
1192
  * ecx = number of channel (from 0 up to 3 inclusively)
1203
  * ecx = number of channel (from 0 up to 3 inclusively)
1193
Returned value:
1204
Returned value:
1194
  * eax = 0 - success
1205
  * eax = 0 - success
1195
  * eax = -1 - incorrect channel number
1206
  * eax = -1 - incorrect channel number
1196
Remarks:
1207
Remarks:
1197
  * Number of DMA channel is used in subfunction 1 of function 55.
1208
  * Number of DMA channel is used in subfunction 1 of function 55.
1198
  * To get sound DMA channel use subfunction 10 of function 26.
1209
  * To get sound DMA channel use subfunction 10 of function 26.
1199
 
1210
 
1200
======================================================================
1211
======================================================================
1201
 Function 21, subfunction 11 - enable/disable low-level access to HD. 
1212
 Function 21, subfunction 11 - enable/disable low-level access to HD. 
1202
======================================================================
1213
======================================================================
1203
Parameters:
1214
Parameters:
1204
  * eax = 21 - function number
1215
  * eax = 21 - function number
1205
  * ebx = 11 - subfunction number
1216
  * ebx = 11 - subfunction number
1206
  * ecx = 0/1 - disable/enable
1217
  * ecx = 0/1 - disable/enable
1207
Returned value:
1218
Returned value:
1208
  * eax = 0
1219
  * eax = 0
1209
Remarks:
1220
Remarks:
1210
  * Is used in LBA-read (subfunction 8 of function 58).
1221
  * Is used in LBA-read (subfunction 8 of function 58).
1211
  * The current implementation uses only low bit of ecx.
1222
  * The current implementation uses only low bit of ecx.
1212
  * To get current status use subfunction 11 of function 26.
1223
  * To get current status use subfunction 11 of function 26.
1213
 
1224
 
1214
======================================================================
1225
======================================================================
1215
 Function 21, subfunction 12 - enable/disable low-level access to PCI. 
1226
 Function 21, subfunction 12 - enable/disable low-level access to PCI. 
1216
======================================================================
1227
======================================================================
1217
Parameters:
1228
Parameters:
1218
  * eax = 21 - function number
1229
  * eax = 21 - function number
1219
  * ebx = 12 - subfunction number
1230
  * ebx = 12 - subfunction number
1220
  * ecx = 0/1 - disable/enable
1231
  * ecx = 0/1 - disable/enable
1221
Returned value:
1232
Returned value:
1222
  * eax = 0
1233
  * eax = 0
1223
Remarks:
1234
Remarks:
1224
  * Is used in operations with PCI bus (function 62).
1235
  * Is used in operations with PCI bus (function 62).
1225
  * The current implementation uses only low bit of ecx.
1236
  * The current implementation uses only low bit of ecx.
1226
  * To get current status use subfunction 12 of function 26.
1237
  * To get current status use subfunction 12 of function 26.
1227
 
1238
 
1228
======================================================================
1239
======================================================================
1229
============ Function 21, subfunction 13, subsubfunction 1 ===========
1240
============ Function 21, subfunction 13, subsubfunction 1 ===========
1230
======== Initialize + get information on the driver vmode.mdr. =======
1241
======== Initialize + get information on the driver vmode.mdr. =======
1231
======================================================================
1242
======================================================================
1232
Parameters:
1243
Parameters:
1233
  * eax = 21 - function number
1244
  * eax = 21 - function number
1234
  * ebx = 13 - subfunction number
1245
  * ebx = 13 - subfunction number
1235
  * ecx = 1 - number of the driver function
1246
  * ecx = 1 - number of the driver function
1236
  * edx = pointer to 512-bytes buffer
1247
  * edx = pointer to 512-bytes buffer
1237
Returned value:
1248
Returned value:
1238
  * if driver is not loaded
1249
  * if driver is not loaded
1239
    (never happens in the current implementation):
1250
    (never happens in the current implementation):
1240
    * eax = -1
1251
    * eax = -1
1241
    * ebx, ecx destroyed
1252
    * ebx, ecx destroyed
1242
  * if driver is loaded:
1253
  * if driver is loaded:
1243
    * eax = 'MDAZ' (in fasm style, that is 'M' - low byte, 'Z' - high)
1254
    * eax = 'MDAZ' (in fasm style, that is 'M' - low byte, 'Z' - high)
1244
      - signature
1255
      - signature
1245
    * ebx = current frequency of the scanning (in Hz)
1256
    * ebx = current frequency of the scanning (in Hz)
1246
    * ecx destroyed
1257
    * ecx destroyed
1247
    * buffer pointed to by edx is filled
1258
    * buffer pointed to by edx is filled
1248
Format of the buffer:
1259
Format of the buffer:
1249
  * +0: 32*byte: driver name, "Trans VideoDriver"
1260
  * +0: 32*byte: driver name, "Trans VideoDriver"
1250
    (without quotes, supplemented by spaces)
1261
    (without quotes, supplemented by spaces)
1251
  * +32 = +0x20: dword: driver version (version x.y is encoded as
1262
  * +32 = +0x20: dword: driver version (version x.y is encoded as
1252
    y*65536+x), for the current implementation is 1 (1.0)
1263
    y*65536+x), for the current implementation is 1 (1.0)
1253
  * +36 = +0x24: 7*dword: reserved (0 in the current implementation)
1264
  * +36 = +0x24: 7*dword: reserved (0 in the current implementation)
1254
  * +64 = +0x40: 32*word: list of supported videomodes (each word
1265
  * +64 = +0x40: 32*word: list of supported videomodes (each word
1255
    is number of a videomode, after list itself there are zeroes)
1266
    is number of a videomode, after list itself there are zeroes)
1256
  * +128 = +0x80: 32*(5*word): list of supported frequences of the
1267
  * +128 = +0x80: 32*(5*word): list of supported frequences of the
1257
    scannings for videomodes: for each videomode listed in the
1268
    scannings for videomodes: for each videomode listed in the
1258
    previous field up to 5 supported frequences are given
1269
    previous field up to 5 supported frequences are given
1259
    (unused positions contain zeroes)
1270
    (unused positions contain zeroes)
1260
Remarks:
1271
Remarks:
1261
  * Function initializes the driver (if it is not initialized yet)
1272
  * Function initializes the driver (if it is not initialized yet)
1262
    and must be called first, before others (otherwise they will do
1273
    and must be called first, before others (otherwise they will do
1263
    nothing and return -1).
1274
    nothing and return -1).
1264
  * The current implementation supports only one frequency
1275
  * The current implementation supports only one frequency
1265
    of the scanning on videomode.
1276
    of the scanning on videomode.
1266
 
1277
 
1267
======================================================================
1278
======================================================================
1268
============ Function 21, subfunction 13, subsubfunction 2 ===========
1279
============ Function 21, subfunction 13, subsubfunction 2 ===========
1269
================ Get information on current videomode. ===============
1280
================ Get information on current videomode. ===============
1270
======================================================================
1281
======================================================================
1271
Parameters:
1282
Parameters:
1272
  * eax = 21 - function number
1283
  * eax = 21 - function number
1273
  * ebx = 13 - subfunction number
1284
  * ebx = 13 - subfunction number
1274
  * ecx = 2 - number of the driver function
1285
  * ecx = 2 - number of the driver function
1275
Returned value:
1286
Returned value:
1276
  * eax = -1 - driver is not loaded or not initialized;
1287
  * eax = -1 - driver is not loaded or not initialized;
1277
    ebx,ecx are destroyed
1288
    ebx,ecx are destroyed
1278
  * eax = [width]*65536 + [height]
1289
  * eax = [width]*65536 + [height]
1279
  * ebx = frequency of the vertical scanning (in Hz)
1290
  * ebx = frequency of the vertical scanning (in Hz)
1280
  * ecx = number of current videomode
1291
  * ecx = number of current videomode
1281
Remarks:
1292
Remarks:
1282
  * Driver must be initialized by call to 
1293
  * Driver must be initialized by call to 
1283
    driver function 1.
1294
    driver function 1.
1284
  * If only screen sizes are required, it is more expedient to use
1295
  * If only screen sizes are required, it is more expedient to use
1285
    function 14 taking into account that it
1296
    function 14 taking into account that it
1286
    returns sizes on 1 less.
1297
    returns sizes on 1 less.
1287
 
1298
 
1288
======================================================================
1299
======================================================================
1289
=== Function 21, subfunction 13, subsubfunction 3 - set videomode. ===
1300
=== Function 21, subfunction 13, subsubfunction 3 - set videomode. ===
1290
======================================================================
1301
======================================================================
1291
Parameters:
1302
Parameters:
1292
  * eax = 21 - function number
1303
  * eax = 21 - function number
1293
  * ebx = 13 - subfunction number
1304
  * ebx = 13 - subfunction number
1294
  * ecx = 3 - number of the driver function
1305
  * ecx = 3 - number of the driver function
1295
  * edx = [scanning frequency]*65536 + [videomode number]
1306
  * edx = [scanning frequency]*65536 + [videomode number]
1296
Returned value:
1307
Returned value:
1297
  * eax = -1 - driver is not loaded, not initialized or
1308
  * eax = -1 - driver is not loaded, not initialized or
1298
    an error has occured
1309
    an error has occured
1299
  * eax = 0 - success
1310
  * eax = 0 - success
1300
  * ebx, ecx destroyed
1311
  * ebx, ecx destroyed
1301
Remarks:
1312
Remarks:
1302
  * Driver must be initialized by driver function 1.
1313
  * Driver must be initialized by driver function 1.
1303
  * The videomode number and frequency must be in the table
1314
  * The videomode number and frequency must be in the table
1304
    returned by driver function 1.
1315
    returned by driver function 1.
1305
 
1316
 
1306
======================================================================
1317
======================================================================
1307
============ Function 21, subfunction 13, subsubfunction 4 ===========
1318
============ Function 21, subfunction 13, subsubfunction 4 ===========
1308
================== Return to the initial videomode. ==================
1319
================== Return to the initial videomode. ==================
1309
======================================================================
1320
======================================================================
1310
Returns the screen to the videomode set at system boot.
1321
Returns the screen to the videomode set at system boot.
1311
Parameters:
1322
Parameters:
1312
  * eax = 21 - function number
1323
  * eax = 21 - function number
1313
  * ebx = 13 - subfunction number
1324
  * ebx = 13 - subfunction number
1314
  * ecx = 4 - number of the driver function
1325
  * ecx = 4 - number of the driver function
1315
Returned value:
1326
Returned value:
1316
  * eax = -1 - driver is not loaded or not initialized
1327
  * eax = -1 - driver is not loaded or not initialized
1317
  * eax = 0 - success
1328
  * eax = 0 - success
1318
  * ebx, ecx destroyed
1329
  * ebx, ecx destroyed
1319
Remarks:
1330
Remarks:
1320
  * Driver must be initialized by call to driver function 1.
1331
  * Driver must be initialized by call to driver function 1.
1321
 
1332
 
1322
======================================================================
1333
======================================================================
1323
============ Function 21, subfunction 13, subsubfunction 5 ===========
1334
============ Function 21, subfunction 13, subsubfunction 5 ===========
1324
===== Increase/decrease the size of the visible area of monitor. =====
1335
===== Increase/decrease the size of the visible area of monitor. =====
1325
======================================================================
1336
======================================================================
1326
Parameters:
1337
Parameters:
1327
  * eax = 21 - function number
1338
  * eax = 21 - function number
1328
  * ebx = 13 - subfunction number
1339
  * ebx = 13 - subfunction number
1329
  * ecx = 5 - number of the driver function
1340
  * ecx = 5 - number of the driver function
1330
  * edx = 0/1 - decrease/increase horizontal size on 1 position
1341
  * edx = 0/1 - decrease/increase horizontal size on 1 position
1331
  * edx = 2/3 - is not supported in the current implementation;
1342
  * edx = 2/3 - is not supported in the current implementation;
1332
    is planned as decrease/increase vertical size on 1 position
1343
    is planned as decrease/increase vertical size on 1 position
1333
Returned value:
1344
Returned value:
1334
  * eax = -1 - driver is not loaded or not initialized
1345
  * eax = -1 - driver is not loaded or not initialized
1335
  * eax = 0 - success
1346
  * eax = 0 - success
1336
  * ebx, ecx destroyed
1347
  * ebx, ecx destroyed
1337
Remarks:
1348
Remarks:
1338
  * Driver must be initialized by call to driver function 1.
1349
  * Driver must be initialized by call to driver function 1.
1339
  * Function influences only the physical size of the screen image;
1350
  * Function influences only the physical size of the screen image;
1340
    the logical size (number of pixels) does not change.
1351
    the logical size (number of pixels) does not change.
1341
 
1352
 
1342
======================================================================
1353
======================================================================
1343
================= Function 22 - set system date/time. ================
1354
================= Function 22 - set system date/time. ================
1344
======================================================================
1355
======================================================================
1345
Parameters:
1356
Parameters:
1346
  * eax = 22 - function number
1357
  * eax = 22 - function number
1347
  * ebx = 0 - set time
1358
  * ebx = 0 - set time
1348
    * ecx = 0x00SSMMHH - time in the binary-decimal code (BCD):
1359
    * ecx = 0x00SSMMHH - time in the binary-decimal code (BCD):
1349
    * HH=hour 00..23
1360
    * HH=hour 00..23
1350
    * MM=minute 00..59
1361
    * MM=minute 00..59
1351
    * SS=second 00..59
1362
    * SS=second 00..59
1352
  * ebx = 1 - set date
1363
  * ebx = 1 - set date
1353
    * ecx = 0x00DDMMYY - date in the binary-decimal code (BCD):
1364
    * ecx = 0x00DDMMYY - date in the binary-decimal code (BCD):
1354
    * DD=day 01..31
1365
    * DD=day 01..31
1355
    * MM=month 01..12
1366
    * MM=month 01..12
1356
    * YY=year 00..99
1367
    * YY=year 00..99
1357
  * ebx = 2 - set day of week
1368
  * ebx = 2 - set day of week
1358
    * ecx = 1 for Sunday, ..., 7 for Saturday
1369
    * ecx = 1 for Sunday, ..., 7 for Saturday
1359
  * ebx = 3 - set alarm clock
1370
  * ebx = 3 - set alarm clock
1360
    * ecx = 0x00SSMMHH
1371
    * ecx = 0x00SSMMHH
1361
Returned value:
1372
Returned value:
1362
  * eax = 0 - success
1373
  * eax = 0 - success
1363
  * eax = 1 - incorrect parameter
1374
  * eax = 1 - incorrect parameter
1364
  * eax = 2 - CMOS-battery was unloaded
1375
  * eax = 2 - CMOS-battery was unloaded
1365
Remarks:
1376
Remarks:
1366
  * Value of installation of day of week seems to be doubtful,
1377
  * Value of installation of day of week seems to be doubtful,
1367
    as it a little where is used
1378
    as it a little where is used
1368
    (day of week can be calculated by date).
1379
    (day of week can be calculated by date).
1369
  * Alarm clock can be set on operation in the given time every day.
1380
  * Alarm clock can be set on operation in the given time every day.
1370
    But there is no existing system function to disable it.
1381
    But there is no existing system function to disable it.
1371
  * Operation of alarm clock consists in generation IRQ8.
1382
  * Operation of alarm clock consists in generation IRQ8.
1372
  * Generally CMOS supports for alarm clock set of value 0xFF
1383
  * Generally CMOS supports for alarm clock set of value 0xFF
1373
    as one of parameters and it means that the appropriate parameter
1384
    as one of parameters and it means that the appropriate parameter
1374
    is ignored. But current implementation does not allow this
1385
    is ignored. But current implementation does not allow this
1375
    (will return 1).
1386
    (will return 1).
1376
  * Alarm clock is a global system resource; the set of
1387
  * Alarm clock is a global system resource; the set of
1377
    an alarm clock cancels automatically the previous set.
1388
    an alarm clock cancels automatically the previous set.
1378
    However, at moment no program uses it.
1389
    However, at moment no program uses it.
1379
 
1390
 
1380
======================================================================
1391
======================================================================
1381
============= Function 23 - wait for event with timeout. =============
1392
============= Function 23 - wait for event with timeout. =============
1382
======================================================================
1393
======================================================================
1383
If the message queue is empty, waits for new message in the queue,
1394
If the message queue is empty, waits for new message in the queue,
1384
but no more than given time. Then reads out a message from the queue.
1395
but no more than given time. Then reads out a message from the queue.
1385
 
1396
 
1386
Parameters:
1397
Parameters:
1387
  * eax = 23 - function number
1398
  * eax = 23 - function number
1388
  * ebx = timeout (in 1/100 of second)
1399
  * ebx = timeout (in 1/100 of second)
1389
Returned value:
1400
Returned value:
1390
  * eax = 0 - the message queue is empty
1401
  * eax = 0 - the message queue is empty
1391
  * otherwise eax = event (see the list of events)
1402
  * otherwise eax = event (see the list of events)
1392
Remarks:
1403
Remarks:
1393
  * Only those events are taken into account, which enter into
1404
  * Only those events are taken into account, which enter into
1394
    the mask set by function 40. By default it is
1405
    the mask set by function 40. By default it is
1395
    redraw, key and button events.
1406
    redraw, key and button events.
1396
  * To check for presence of a message in the queue use function 11.
1407
  * To check for presence of a message in the queue use function 11.
1397
    To wait without timeout use function 10.
1408
    To wait without timeout use function 10.
1398
  * Transmission ebx=0 results in immediate returning eax=0.
1409
  * Transmission ebx=0 results in immediate returning eax=0.
1399
  * Current implementation returns immediately with eax=0,
1410
  * Current implementation returns immediately with eax=0,
1400
    if the addition of ebx with the current value of time counter
1411
    if the addition of ebx with the current value of time counter
1401
    makes 32-bit overflow.
1412
    makes 32-bit overflow.
1402
 
1413
 
1403
======================================================================
1414
======================================================================
1404
======== Function 24, subfunction 1 - begin to play CD-audio. ========
1415
======== Function 24, subfunction 1 - begin to play CD-audio. ========
1405
======================================================================
1416
======================================================================
1406
Parameters:
1417
Parameters:
1407
  * eax = 24 - function number
1418
  * eax = 24 - function number
1408
  * ebx = 1 - subfunction number
1419
  * ebx = 1 - subfunction number
1409
  * ecx = 0x00FRSSMM, where
1420
  * ecx = 0x00FRSSMM, where
1410
    * MM = starting minute
1421
    * MM = starting minute
1411
    * SS = starting second
1422
    * SS = starting second
1412
    * FR = starting frame
1423
    * FR = starting frame
1413
Returned value:
1424
Returned value:
1414
  * eax = 0 - success
1425
  * eax = 0 - success
1415
  * eax = 1 - CD base is not defined
1426
  * eax = 1 - CD base is not defined
1416
Remarks:
1427
Remarks:
1417
  * Previously CD base must be defined by the call to 
1428
  * Previously CD base must be defined by the call to 
1418
    subfunction 3 of function 21.
1429
    subfunction 3 of function 21.
1419
  * One second includes 75 frames, one minute includes 60 seconds.
1430
  * One second includes 75 frames, one minute includes 60 seconds.
1420
  * The function is asynchronous (returns control, when play begins).
1431
  * The function is asynchronous (returns control, when play begins).
1421
 
1432
 
1422
======================================================================
1433
======================================================================
1423
======= Function 24, subfunction 2 - get information on tracks. ======
1434
======= Function 24, subfunction 2 - get information on tracks. ======
1424
======================================================================
1435
======================================================================
1425
Parameters:
1436
Parameters:
1426
  * eax = 24 - function number
1437
  * eax = 24 - function number
1427
  * ebx = 2 - subfunction number
1438
  * ebx = 2 - subfunction number
1428
  * ecx = pointer to the buffer for the table
1439
  * ecx = pointer to the buffer for the table
1429
    (maximum 8*64h+4 bytes=100 tracks)
1440
    (maximum 8*64h+4 bytes=100 tracks)
1430
Returned value:
1441
Returned value:
1431
  * eax = 0 - success
1442
  * eax = 0 - success
1432
  * eax = 1 - CD base is not defined
1443
  * eax = 1 - CD base is not defined
1433
Remarks:
1444
Remarks:
1434
  * The format of the table with tracks information is the same as
1445
  * The format of the table with tracks information is the same as
1435
    for ATAPI-CD command 43h (READ TOC), usual table (subcommand 00h).
1446
    for ATAPI-CD command 43h (READ TOC), usual table (subcommand 00h).
1436
    Function returns addresses in MSF.
1447
    Function returns addresses in MSF.
1437
  * Previously CD base port must be set by call to 
1448
  * Previously CD base port must be set by call to 
1438
    subfunction 3 of function 21.
1449
    subfunction 3 of function 21.
1439
  * Function returns information only about no more than 100
1450
  * Function returns information only about no more than 100
1440
    first tracks. In most cases it is enough.
1451
    first tracks. In most cases it is enough.
1441
 
1452
 
1442
======================================================================
1453
======================================================================
1443
========== Function 24, subfunction 3 - stop play CD-audio. ==========
1454
========== Function 24, subfunction 3 - stop play CD-audio. ==========
1444
======================================================================
1455
======================================================================
1445
Parameters:
1456
Parameters:
1446
  * eax = 24 - function number
1457
  * eax = 24 - function number
1447
  * ebx = 1 - subfunction number
1458
  * ebx = 1 - subfunction number
1448
Returned value:
1459
Returned value:
1449
  * eax = 0 - success
1460
  * eax = 0 - success
1450
  * eax = 1 - CD base is not defined
1461
  * eax = 1 - CD base is not defined
1451
Çàìå÷àíèÿ:
1462
Çàìå÷àíèÿ:
1452
  * Previously CD base port must be defined by call to 
1463
  * Previously CD base port must be defined by call to 
1453
    subfunction 3 of function 21.
1464
    subfunction 3 of function 21.
1454
 
1465
 
1455
======================================================================
1466
======================================================================
1456
=================== Function 25 - set SBPro volume. ==================
1467
=================== Function 25 - set SBPro volume. ==================
1457
======================================================================
1468
======================================================================
1458
Parameters:
1469
Parameters:
1459
  * eax = 25 - function number
1470
  * eax = 25 - function number
1460
  * ebx = what to set:
1471
  * ebx = what to set:
1461
    * 1 - set common volume
1472
    * 1 - set common volume
1462
    * 2 - set CD-audio volume
1473
    * 2 - set CD-audio volume
1463
  * cl = volume level: high 4 bits for the left column,
1474
  * cl = volume level: high 4 bits for the left column,
1464
    low 4 bits for the right one
1475
    low 4 bits for the right one
1465
Returned value:
1476
Returned value:
1466
  * eax = 0 - success
1477
  * eax = 0 - success
1467
  * eax = 1 - SB base is not defined
1478
  * eax = 1 - SB base is not defined
1468
  * eax = 2 - incorrect subfunction
1479
  * eax = 2 - incorrect subfunction
1469
Remarks:
1480
Remarks:
1470
  * Previously SB base port must be defined by 
1481
  * Previously SB base port must be defined by 
1471
    subfunction 4 of function 21.
1482
    subfunction 4 of function 21.
1472
  * See also function 28 which sets
1483
  * See also function 28 which sets
1473
    volume for the later standard SB16.
1484
    volume for the later standard SB16.
1474
 
1485
 
1475
======================================================================
1486
======================================================================
1476
======== Function 26, subfunction 1 - get MPU MIDI base port. ========
1487
======== Function 26, subfunction 1 - get MPU MIDI base port. ========
1477
======================================================================
1488
======================================================================
1478
Parameters:
1489
Parameters:
1479
  * eax = 26 - function number
1490
  * eax = 26 - function number
1480
  * ebx = 1 - subfunction number
1491
  * ebx = 1 - subfunction number
1481
Returned value:
1492
Returned value:
1482
  * eax = port number
1493
  * eax = port number
1483
Parameters:
1494
Parameters:
1484
  * To set base port use subfunction 1 of function 21.
1495
  * To set base port use subfunction 1 of function 21.
1485
 
1496
 
1486
======================================================================
1497
======================================================================
1487
========== Function 26, subfunction 2 - get keyboard layout. =========
1498
========== Function 26, subfunction 2 - get keyboard layout. =========
1488
======================================================================
1499
======================================================================
1489
The keyboard layout is used to convert keyboard scancodes to
1500
The keyboard layout is used to convert keyboard scancodes to
1490
ASCII-codes for function 2.
1501
ASCII-codes for function 2.
1491
Parameters:
1502
Parameters:
1492
  * eax = 26 - function number
1503
  * eax = 26 - function number
1493
  * ebx = 2 - subfunction number
1504
  * ebx = 2 - subfunction number
1494
  * ecx = what layout to get:
1505
  * ecx = what layout to get:
1495
    * 1 = normal layout
1506
    * 1 = normal layout
1496
    * 2 = layout with pressed Shift
1507
    * 2 = layout with pressed Shift
1497
    * 3 = layout with pressed Alt
1508
    * 3 = layout with pressed Alt
1498
  * edx = pointer to the 128-bytes buffer, where the layout will be
1509
  * edx = pointer to the 128-bytes buffer, where the layout will be
1499
    copied
1510
    copied
1500
Returned value:
1511
Returned value:
1501
  * function does not return value
1512
  * function does not return value
1502
Or:
1513
Or:
1503
  * eax = 26 - function number
1514
  * eax = 26 - function number
1504
  * ebx = 2 - subfunction number
1515
  * ebx = 2 - subfunction number
1505
  * ecx = 9
1516
  * ecx = 9
1506
Returned value:
1517
Returned value:
1507
  * eax = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1518
  * eax = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1508
Remarks:
1519
Remarks:
1509
  * If Alt is pressed, the layout with Alt is used;
1520
  * If Alt is pressed, the layout with Alt is used;
1510
    if Alt is not pressed, but Shift is pressed,
1521
    if Alt is not pressed, but Shift is pressed,
1511
    the layout with Shift is used;
1522
    the layout with Shift is used;
1512
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1523
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1513
    layout is used and then from the code is subtracted 0x60;
1524
    layout is used and then from the code is subtracted 0x60;
1514
    if no control key is pressed, the normal layout is used.
1525
    if no control key is pressed, the normal layout is used.
1515
  * To set layout and country identifier use 
1526
  * To set layout and country identifier use 
1516
    subfunction 2 of function 21.
1527
    subfunction 2 of function 21.
1517
  * Country identifier is global system variable, which is not used
1528
  * Country identifier is global system variable, which is not used
1518
    by the kernel itself; however the application '@panel' displays
1529
    by the kernel itself; however the application '@panel' displays
1519
    the corresponding icon (using this function).
1530
    the corresponding icon (using this function).
1520
  * The application @panel switches layouts on user request.
1531
  * The application @panel switches layouts on user request.
1521
 
1532
 
1522
======================================================================
1533
======================================================================
1523
============== Function 26, subfunction 3 - get CD base. =============
1534
============== Function 26, subfunction 3 - get CD base. =============
1524
======================================================================
1535
======================================================================
1525
Parameters:
1536
Parameters:
1526
  * eax = 26 - function number
1537
  * eax = 26 - function number
1527
  * ebx = 3 - subfunction number
1538
  * ebx = 3 - subfunction number
1528
Returned value:
1539
Returned value:
1529
  * eax = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1540
  * eax = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1530
Remarks:
1541
Remarks:
1531
  * CD base is used by function 24.
1542
  * CD base is used by function 24.
1532
  * To set CD base use subfunction 3 of function 21.
1543
  * To set CD base use subfunction 3 of function 21.
1533
 
1544
 
1534
======================================================================
1545
======================================================================
1535
====== Function 26, subfunction 4 - get Sound Blaster base port. =====
1546
====== Function 26, subfunction 4 - get Sound Blaster base port. =====
1536
======================================================================
1547
======================================================================
1537
Parameters:
1548
Parameters:
1538
  * eax = 26 - function number
1549
  * eax = 26 - function number
1539
  * ebx = 4 - subfunction number
1550
  * ebx = 4 - subfunction number
1540
Returned value:
1551
Returned value:
1541
  * eax = base port number
1552
  * eax = base port number
1542
Remarks:
1553
Remarks:
1543
  * Bae port is used by functions 25, 55.
1554
  * Bae port is used by functions 25, 55.
1544
  * To set base port use subfunction 4 of function 21.
1555
  * To set base port use subfunction 4 of function 21.
1545
 
1556
 
1546
======================================================================
1557
======================================================================
1547
========== Function 26, subfunction 5 - get system language. =========
1558
========== Function 26, subfunction 5 - get system language. =========
1548
======================================================================
1559
======================================================================
1549
Parameters:
1560
Parameters:
1550
  * eax = 26 - function number
1561
  * eax = 26 - function number
1551
  * ebx = 5 - subfunction number
1562
  * ebx = 5 - subfunction number
1552
Returned value:
1563
Returned value:
1553
  * eax = system language (1=eng, 2=fi, 3=ger, 4=rus)
1564
  * eax = system language (1=eng, 2=fi, 3=ger, 4=rus)
1554
Remarks:
1565
Remarks:
1555
  * System language is global system variable and is not used
1566
  * System language is global system variable and is not used
1556
    by the kernel itself, however application @panel draws the
1567
    by the kernel itself, however application @panel draws the
1557
    appropriate icon (using this function).
1568
    appropriate icon (using this function).
1558
  * To set system language use subfunction 5 of function 21.
1569
  * To set system language use subfunction 5 of function 21.
1559
 
1570
 
1560
======================================================================
1571
======================================================================
1561
=========== Function 26, subfunction 6 - get WSS base port. ==========
1572
=========== Function 26, subfunction 6 - get WSS base port. ==========
1562
======================================================================
1573
======================================================================
1563
Parameters:
1574
Parameters:
1564
  * eax = 26 - function number
1575
  * eax = 26 - function number
1565
  * ebx = 6 - subfunction number
1576
  * ebx = 6 - subfunction number
1566
Returned value:
1577
Returned value:
1567
  * eax = base port
1578
  * eax = base port
1568
Remarks:
1579
Remarks:
1569
  * WSS base is used by function 27.
1580
  * WSS base is used by function 27.
1570
  * To set WSS base port use subfunction 6 of function 21.
1581
  * To set WSS base port use subfunction 6 of function 21.
1571
 
1582
 
1572
======================================================================
1583
======================================================================
1573
============== Function 26, subfunction 7 - get HD base. =============
1584
============== Function 26, subfunction 7 - get HD base. =============
1574
======================================================================
1585
======================================================================
1575
The HD base defines hard disk to write with usage of obsolete
1586
The HD base defines hard disk to write with usage of obsolete
1576
file system functions and functions implicitly using the hard disk
1587
file system functions and functions implicitly using the hard disk
1577
(such as subfunction 6 of function 18);
1588
(such as subfunction 6 of function 18);
1578
at usage of function 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1589
at usage of function 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1579
these function set base themselves.
1590
these function set base themselves.
1580
Parameters:
1591
Parameters:
1581
  * eax = 26 - function number
1592
  * eax = 26 - function number
1582
  * ebx = 7 - subfunction number
1593
  * ebx = 7 - subfunction number
1583
Returned value:
1594
Returned value:
1584
  * eax = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1595
  * eax = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1585
Remarks:
1596
Remarks:
1586
  * Any application in any time can change HD base.
1597
  * Any application in any time can change HD base.
1587
  * To set base use subfunction 7 of function 21.
1598
  * To set base use subfunction 7 of function 21.
1588
  * To get used partition of hard disk use subfunction 8.
1599
  * To get used partition of hard disk use subfunction 8.
1589
 
1600
 
1590
======================================================================
1601
======================================================================
1591
========= Function 26, subfunction 8 - get used HD partition. ========
1602
========= Function 26, subfunction 8 - get used HD partition. ========
1592
======================================================================
1603
======================================================================
1593
The HD partition defines partition of the hard disk to write with
1604
The HD partition defines partition of the hard disk to write with
1594
usage of obsolete file system functions and functions implicitly
1605
usage of obsolete file system functions and functions implicitly
1595
using the hard disk (such as subfunction 6 of function 18);
1606
using the hard disk (such as subfunction 6 of function 18);
1596
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1607
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1597
these functions set base and partition themselves.
1608
these functions set base and partition themselves.
1598
Parameters:
1609
Parameters:
1599
  * eax = 26 - function number
1610
  * eax = 26 - function number
1600
  * ebx = 8 - subfunction number
1611
  * ebx = 8 - subfunction number
1601
Returned value:
1612
Returned value:
1602
  * eax = HD partition (beginning from 1)
1613
  * eax = HD partition (beginning from 1)
1603
Remarks:
1614
Remarks:
1604
  * Any application in any time can change partition.
1615
  * Any application in any time can change partition.
1605
  * To set partition use subfunction 8 of function 21.
1616
  * To set partition use subfunction 8 of function 21.
1606
  * To get number of partitions on a hard disk use
1617
  * To get number of partitions on a hard disk use
1607
    subfunction 11 of function 18.
1618
    subfunction 11 of function 18.
1608
  * To get base of used hard disk, use subfunction 7.
1619
  * To get base of used hard disk, use subfunction 7.
1609
 
1620
 
1610
======================================================================
1621
======================================================================
1611
=== Function 26, subfunction 9 - get the value of the time counter. ==
1622
=== Function 26, subfunction 9 - get the value of the time counter. ==
1612
======================================================================
1623
======================================================================
1613
Parameters:
1624
Parameters:
1614
  * eax = 26 - function number
1625
  * eax = 26 - function number
1615
  * ebx = 9 - subfunction number
1626
  * ebx = 9 - subfunction number
1616
Returned value:
1627
Returned value:
1617
  * eax = number of 1/100s of second, past from the system boot time
1628
  * eax = number of 1/100s of second, past from the system boot time
1618
Remarks:
1629
Remarks:
1619
  * Counter takes modulo 2^32, that correspond to a little more
1630
  * Counter takes modulo 2^32, that correspond to a little more
1620
    than 497 days.
1631
    than 497 days.
1621
  * To get system time use function 3.
1632
  * To get system time use function 3.
1622
 
1633
 
1623
======================================================================
1634
======================================================================
1624
======== Function 26, subfunction 10 - get sound DMA channel. ========
1635
======== Function 26, subfunction 10 - get sound DMA channel. ========
1625
======================================================================
1636
======================================================================
1626
Parameters:
1637
Parameters:
1627
  * eax = 26 - function number
1638
  * eax = 26 - function number
1628
  * ebx = 10 - subfunction number
1639
  * ebx = 10 - subfunction number
1629
Returned value:
1640
Returned value:
1630
  * eax = number of the channel (from 0 to 3 inclusive)
1641
  * eax = number of the channel (from 0 to 3 inclusive)
1631
Remarks:
1642
Remarks:
1632
  * Number of the DMA channel is used by subfunction 1 of function 55.
1643
  * Number of the DMA channel is used by subfunction 1 of function 55.
1633
  * To set the sound DMA channel use subfunction 10 of function 21.
1644
  * To set the sound DMA channel use subfunction 10 of function 21.
1634
 
1645
 
1635
======================================================================
1646
======================================================================
1636
===================== Function 26, subfunction 11 ====================
1647
===================== Function 26, subfunction 11 ====================
1637
========== Find out whether low-level HD access is enabled. ==========
1648
========== Find out whether low-level HD access is enabled. ==========
1638
======================================================================
1649
======================================================================
1639
Parameters:
1650
Parameters:
1640
  * eax = 26 - function number
1651
  * eax = 26 - function number
1641
  * ebx = 11 - subfunction number
1652
  * ebx = 11 - subfunction number
1642
Returned value:
1653
Returned value:
1643
  * eax = 0/1 - disabled/enabled
1654
  * eax = 0/1 - disabled/enabled
1644
Remarks:
1655
Remarks:
1645
  * Is used in LBA read (subfunction 8 of function 58).
1656
  * Is used in LBA read (subfunction 8 of function 58).
1646
  * To set current state use subfunction 11 of function 21.
1657
  * To set current state use subfunction 11 of function 21.
1647
 
1658
 
1648
======================================================================
1659
======================================================================
1649
===================== Function 26, subfunction 12 ====================
1660
===================== Function 26, subfunction 12 ====================
1650
========== Find out whether low-level PCI access is enabled. =========
1661
========== Find out whether low-level PCI access is enabled. =========
1651
======================================================================
1662
======================================================================
1652
Parameters:
1663
Parameters:
1653
  * eax = 26 - function number
1664
  * eax = 26 - function number
1654
  * ebx = 12 - subfunction number
1665
  * ebx = 12 - subfunction number
1655
Returned value:
1666
Returned value:
1656
  * eax = 0/1 - disabled/enabled
1667
  * eax = 0/1 - disabled/enabled
1657
Remarks:
1668
Remarks:
1658
  * Is used by operations with PCI bus (function 62).
1669
  * Is used by operations with PCI bus (function 62).
1659
  * The current implementation uses only low bit of ecx.
1670
  * The current implementation uses only low bit of ecx.
1660
  * To set the current state use subfunction 12 of function 21.
1671
  * To set the current state use subfunction 12 of function 21.
1661
 
1672
 
1662
======================================================================
1673
======================================================================
1663
======== Function 27 - set Windows Sound System (WSS) volume. ========
1674
======== Function 27 - set Windows Sound System (WSS) volume. ========
1664
======================================================================
1675
======================================================================
1665
Parameters:
1676
Parameters:
1666
  * eax = 27 - function number
1677
  * eax = 27 - function number
1667
  * ebx = what to set:
1678
  * ebx = what to set:
1668
    * 1 - set common volume
1679
    * 1 - set common volume
1669
    * 2 - set Line In volume
1680
    * 2 - set Line In volume
1670
  * cl = volume level (0x0=highest, 0x1F=lowest,
1681
  * cl = volume level (0x0=highest, 0x1F=lowest,
1671
    if bit 0x80 is set=disable)
1682
    if bit 0x80 is set=disable)
1672
Returned value:
1683
Returned value:
1673
  * eax = 0 - success
1684
  * eax = 0 - success
1674
  * eax = 1 - WSS base is not defined
1685
  * eax = 1 - WSS base is not defined
1675
  * eax = 2 - incorrect subfunction
1686
  * eax = 2 - incorrect subfunction
1676
Remarks:
1687
Remarks:
1677
  * Previously WSS base port must be defined by call to 
1688
  * Previously WSS base port must be defined by call to 
1678
    subfunction 6 of function 21.
1689
    subfunction 6 of function 21.
1679
  * Set of common volume is ignored (function simply returns eax=0).
1690
  * Set of common volume is ignored (function simply returns eax=0).
1680
  * Old documentation and kernel sources erraticly name function 2
1691
  * Old documentation and kernel sources erraticly name function 2
1681
    as CD-audio volume.
1692
    as CD-audio volume.
1682
 
1693
 
1683
======================================================================
1694
======================================================================
1684
=================== Function 28 - set SB16 volume. ===================
1695
=================== Function 28 - set SB16 volume. ===================
1685
======================================================================
1696
======================================================================
1686
Parameters:
1697
Parameters:
1687
  * eax = 28 - function number
1698
  * eax = 28 - function number
1688
  * ebx = what to install:
1699
  * ebx = what to install:
1689
    * 1 - install common volume
1700
    * 1 - install common volume
1690
    * 2 - install CD-audio volume
1701
    * 2 - install CD-audio volume
1691
  * cl = volume level (0=off, 0xFF=max)
1702
  * cl = volume level (0=off, 0xFF=max)
1692
Returned value:
1703
Returned value:
1693
  * eax = 0 - success
1704
  * eax = 0 - success
1694
  * eax = 1 - SB base is not defined
1705
  * eax = 1 - SB base is not defined
1695
  * eax = 2 - incorrect subfunction
1706
  * eax = 2 - incorrect subfunction
1696
Remarks:
1707
Remarks:
1697
  * Previously SB base port must be defined by
1708
  * Previously SB base port must be defined by
1698
    subfunction 4 of function 21.
1709
    subfunction 4 of function 21.
1699
  * This function gives more variants for volume, that function 25.
1710
  * This function gives more variants for volume, that function 25.
1700
 
1711
 
1701
======================================================================
1712
======================================================================
1702
=================== Function 29 - get system date. ===================
1713
=================== Function 29 - get system date. ===================
1703
======================================================================
1714
======================================================================
1704
Parameters:
1715
Parameters:
1705
  * eax = 29 - function number
1716
  * eax = 29 - function number
1706
Returned value:
1717
Returned value:
1707
  * eax = 0x00DDMMYY, where
1718
  * eax = 0x00DDMMYY, where
1708
    (binary-decimal coding, BCD, is used)
1719
    (binary-decimal coding, BCD, is used)
1709
  * YY = two low digits of year (00..99)
1720
  * YY = two low digits of year (00..99)
1710
  * MM = month (01..12)
1721
  * MM = month (01..12)
1711
  * DD = day (01..31)
1722
  * DD = day (01..31)
1712
Remarks:
1723
Remarks:
1713
  * To set system date use function 22.
1724
  * To set system date use function 22.
1714
 
1725
 
1715
======================================================================
1726
======================================================================
1716
=============== Function 32 - delete file from ramdisk. ==============
1727
=============== Function 32 - delete file from ramdisk. ==============
1717
======================================================================
1728
======================================================================
1718
Parameters:
1729
Parameters:
1719
  * eax = 32 - function number
1730
  * eax = 32 - function number
1720
  * ebx = pointer to the filename
1731
  * ebx = pointer to the filename
1721
Returned value:
1732
Returned value:
1722
  * eax = 0 - success; otherwise file system error code
1733
  * eax = 0 - success; otherwise file system error code
1723
Remarks:
1734
Remarks:
1724
  * This function is obsolete; function 58 allows to fulfill
1735
  * This function is obsolete; function 58 allows to fulfill
1725
    the same operations with the extended possibilities.
1736
    the same operations with the extended possibilities.
1726
  * The current implementation returns only values 0(success) and
1737
  * The current implementation returns only values 0(success) and
1727
    5(file not found).
1738
    5(file not found).
1728
  * The filename must be either in the format 8+3 characters
1739
  * The filename must be either in the format 8+3 characters
1729
    (first 8 characters - name itself, last 3 - extension,
1740
    (first 8 characters - name itself, last 3 - extension,
1730
    the short names and extensions are supplemented with spaces),
1741
    the short names and extensions are supplemented with spaces),
1731
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1742
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1732
    (name no more than 8 characters, dot, extension 3 characters
1743
    (name no more than 8 characters, dot, extension 3 characters
1733
    supplemented if necessary by spaces).
1744
    supplemented if necessary by spaces).
1734
    The filename must be written with capital letters. The terminating
1745
    The filename must be written with capital letters. The terminating
1735
    character with code 0 is not necessary (not ASCIIZ-string).
1746
    character with code 0 is not necessary (not ASCIIZ-string).
1736
  * This function does not support folders on the ramdisk.
1747
  * This function does not support folders on the ramdisk.
1737
 
1748
 
1738
======================================================================
1749
======================================================================
1739
================ Function 33 - write file to ramdisk. ================
1750
================ Function 33 - write file to ramdisk. ================
1740
======================================================================
1751
======================================================================
1741
Parameters:
1752
Parameters:
1742
  * eax = 33 - function number
1753
  * eax = 33 - function number
1743
  * ebx = pointer to the filename
1754
  * ebx = pointer to the filename
1744
  * ecx = pointer to data for writing
1755
  * ecx = pointer to data for writing
1745
  * edx = number of bytes for writing
1756
  * edx = number of bytes for writing
1746
  * should be set esi=0
1757
  * should be set esi=0
1747
Returned value:
1758
Returned value:
1748
  * eax = 0 - success, otherwise file system error code
1759
  * eax = 0 - success, otherwise file system error code
1749
Remarks:
1760
Remarks:
1750
  * This function is obsolete; function 70 allows to fulfil
1761
  * This function is obsolete; function 70 allows to fulfil
1751
    the same operations with extended possibilities.
1762
    the same operations with extended possibilities.
1752
  * If esi contains non-zero value and selected file already exists,
1763
  * If esi contains non-zero value and selected file already exists,
1753
    one more file with the same name will be created.
1764
    one more file with the same name will be created.
1754
  * Otherwise file will be overwritten.
1765
  * Otherwise file will be overwritten.
1755
  * The filename must be either in the format 8+3 characters
1766
  * The filename must be either in the format 8+3 characters
1756
    (first 8 characters - name itself, last 3 - extension,
1767
    (first 8 characters - name itself, last 3 - extension,
1757
    the short names and extensions are supplemented with spaces),
1768
    the short names and extensions are supplemented with spaces),
1758
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1769
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1759
    (name no more than 8 characters, dot, extension 3 characters
1770
    (name no more than 8 characters, dot, extension 3 characters
1760
    supplemented if necessary by spaces).
1771
    supplemented if necessary by spaces).
1761
    The filename must be written with capital letters. The terminating
1772
    The filename must be written with capital letters. The terminating
1762
    character with code 0 is not necessary (not ASCIIZ-string).
1773
    character with code 0 is not necessary (not ASCIIZ-string).
1763
  * This function does not support folders on the ramdisk.
1774
  * This function does not support folders on the ramdisk.
1764
 
1775
 
1765
======================================================================
1776
======================================================================
1766
======= Function 35 - read the color of a pixel on the screen. =======
1777
======= Function 35 - read the color of a pixel on the screen. =======
1767
======================================================================
1778
======================================================================
1768
Parameters:
1779
Parameters:
1769
  * eax = 35
1780
  * eax = 35
1770
  * ebx = y*xsize+x, where
1781
  * ebx = y*xsize+x, where
1771
  * (x,y) = coordinates of a pixel (beginning from 0)
1782
  * (x,y) = coordinates of a pixel (beginning from 0)
1772
  * xsize = horizontal screen size
1783
  * xsize = horizontal screen size
1773
Returned value:
1784
Returned value:
1774
  * eax = color 0x00RRGGBB
1785
  * eax = color 0x00RRGGBB
1775
Remarks:
1786
Remarks:
1776
  * To get screen sizes use function 14. Pay attention,
1787
  * To get screen sizes use function 14. Pay attention,
1777
    that it subtracts 1 from both sizes.
1788
    that it subtracts 1 from both sizes.
1778
  * There is also direct access (without any system calls)
1789
  * There is also direct access (without any system calls)
1779
    to videomemory through the selector gs. To get parameters of
1790
    to videomemory through the selector gs. To get parameters of
1780
    the current videomode, use function 61.
1791
    the current videomode, use function 61.
1781
 
1792
 
1782
======================================================================
1793
======================================================================
1783
========= Function 37 - get coordinates/status of the mouse. =========
1794
========= Function 37 - get coordinates/status of the mouse. =========
1784
======================================================================
1795
======================================================================
1785
 
1796
 
1786
---------- Subfunction 0 - screen coordinates of the mouse -----------
1797
---------- Subfunction 0 - screen coordinates of the mouse -----------
1787
Parameters:
1798
Parameters:
1788
  * eax = 37 - function number
1799
  * eax = 37 - function number
1789
  * ebx = 0 - subfunction number
1800
  * ebx = 0 - subfunction number
1790
Returned value:
1801
Returned value:
1791
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1802
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1792
    (beginning from 0)
1803
    (beginning from 0)
1793
 
1804
 
1794
-- Subfunction 1 - coordinates of the mouse relative to the window ---
1805
-- Subfunction 1 - coordinates of the mouse relative to the window ---
1795
Parameters:
1806
Parameters:
1796
  * eax = 37 - function number
1807
  * eax = 37 - function number
1797
  * ebx = 1 - subfunction number
1808
  * ebx = 1 - subfunction number
1798
Returned value:
1809
Returned value:
1799
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1810
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1800
    relative to the application window (beginning from 0)
1811
    relative to the application window (beginning from 0)
1801
Remarks:
1812
Remarks:
1802
  * The value is calculated by formula (x-xwnd)*65536 + (y-ywnd).
1813
  * The value is calculated by formula (x-xwnd)*65536 + (y-ywnd).
1803
    If y>=ywnd, the low word is non-negative and contains
1814
    If y>=ywnd, the low word is non-negative and contains
1804
    relative y-coordinate, and the high word - relative x-coordinate
1815
    relative y-coordinate, and the high word - relative x-coordinate
1805
    (with correct sign). Otherwise the low word is negative and still
1816
    (with correct sign). Otherwise the low word is negative and still
1806
    contains relative y-coordinate, and to the high word
1817
    contains relative y-coordinate, and to the high word
1807
    1 should be added.
1818
    1 should be added.
1808
 
1819
 
1809
------------ Subfunction 2 - pressed buttons of the mouse ------------
1820
------------ Subfunction 2 - pressed buttons of the mouse ------------
1810
Parameters:
1821
Parameters:
1811
  * eax = 37 - function number
1822
  * eax = 37 - function number
1812
  * ebx = 2 - subfunction number
1823
  * ebx = 2 - subfunction number
1813
Returned value:
1824
Returned value:
1814
  * eax contains information on the pressed mouse buttons:
1825
  * eax contains information on the pressed mouse buttons:
1815
  * bit 0 is set = left button is pressed
1826
  * bit 0 is set = left button is pressed
1816
  * bit 1 is set = right button is pressed
1827
  * bit 1 is set = right button is pressed
1817
  * other bits are cleared
1828
  * other bits are cleared
1818
 
1829
 
1819
======================================================================
1830
======================================================================
1820
====================== Function 38 - draw line. ======================
1831
====================== Function 38 - draw line. ======================
1821
======================================================================
1832
======================================================================
1822
Parameters:
1833
Parameters:
1823
  * eax = 38 - function number
1834
  * eax = 38 - function number
1824
  * ebx = [start coordinate on axis x]*65536 +
1835
  * ebx = [start coordinate on axis x]*65536 +
1825
              [end coordinate on axis x]
1836
              [end coordinate on axis x]
1826
  * ecx = [start coordinate on axis y]*65536 +
1837
  * ecx = [start coordinate on axis y]*65536 +
1827
              [end coordinate on axis y]
1838
              [end coordinate on axis y]
1828
  * edx = 0x00RRGGBB - color
1839
  * edx = 0x00RRGGBB - color
1829
    edx = 0x01xxxxxx - draw inversed line
1840
    edx = 0x01xxxxxx - draw inversed line
1830
          (low 24 bits are ignored)
1841
          (low 24 bits are ignored)
1831
Returned value:
1842
Returned value:
1832
  * function does not return value
1843
  * function does not return value
1833
Remarks:
1844
Remarks:
1834
  * Coordinates are relative to the window.
1845
  * Coordinates are relative to the window.
1835
  * End point is also drawn.
1846
  * End point is also drawn.
1836
 
1847
 
1837
======================================================================
1848
======================================================================
1838
== Function 39, subfunction 1 - get a size of the background image. ==
1849
== Function 39, subfunction 1 - get a size of the background image. ==
1839
======================================================================
1850
======================================================================
1840
Parameters:
1851
Parameters:
1841
  * eax = 39 - function number
1852
  * eax = 39 - function number
1842
  * ebx = 1 - subfunction number
1853
  * ebx = 1 - subfunction number
1843
Returned value:
1854
Returned value:
1844
  * eax = [width]*65536 + [height]
1855
  * eax = [width]*65536 + [height]
1845
Remarks:
1856
Remarks:
1846
  * There is a pair function to set sizes of background image -
1857
  * There is a pair function to set sizes of background image -
1847
    subfunction 1 of function 15. After which it is necessary,
1858
    subfunction 1 of function 15. After which it is necessary,
1848
    of course, anew to define image.
1859
    of course, anew to define image.
1849
 
1860
 
1850
======================================================================
1861
======================================================================
1851
== Function 39, subfunction 2 - get pixel from the background image. =
1862
== Function 39, subfunction 2 - get pixel from the background image. =
1852
======================================================================
1863
======================================================================
1853
Parameters:
1864
Parameters:
1854
  * eax = 39 - function number
1865
  * eax = 39 - function number
1855
  * ebx = 2 - subfunction number
1866
  * ebx = 2 - subfunction number
1856
  * ecx = offset
1867
  * ecx = offset
1857
Returned value:
1868
Returned value:
1858
  * eax = 0x00RRGGBB - pixel color, if offset is valid
1869
  * eax = 0x00RRGGBB - pixel color, if offset is valid
1859
    (less than 0x160000-16)
1870
    (less than 0x160000-16)
1860
  * eax = 2 otherwise
1871
  * eax = 2 otherwise
1861
Remarks:
1872
Remarks:
1862
  * Do not rely on returned value for invalid offsets, it may be
1873
  * Do not rely on returned value for invalid offsets, it may be
1863
    changed in future kernel versions.
1874
    changed in future kernel versions.
1864
  * Offset for pixel with coordinates (x,y)
1875
  * Offset for pixel with coordinates (x,y)
1865
    is calculated as (x+y*xsize)*3.
1876
    is calculated as (x+y*xsize)*3.
1866
  * There is a pair function to set pixel on the background image - 
1877
  * There is a pair function to set pixel on the background image - 
1867
    subfunction 2 of function 15.
1878
    subfunction 2 of function 15.
1868
 
1879
 
1869
======================================================================
1880
======================================================================
1870
== Function 39, subfunction 4 - get drawing mode for the background. =
1881
== Function 39, subfunction 4 - get drawing mode for the background. =
1871
======================================================================
1882
======================================================================
1872
Parameters:
1883
Parameters:
1873
  * eax = 39 - function number
1884
  * eax = 39 - function number
1874
  * ebx = 4 - subfunction number
1885
  * ebx = 4 - subfunction number
1875
Returned value:
1886
Returned value:
1876
  * eax = 1 - tile
1887
  * eax = 1 - tile
1877
  * eax = 2 - stretch
1888
  * eax = 2 - stretch
1878
Remarks:
1889
Remarks:
1879
  * There is a pair function to set drawing mode - 
1890
  * There is a pair function to set drawing mode - 
1880
    subfunction 4 of function 15.
1891
    subfunction 4 of function 15.
1881
 
1892
 
1882
======================================================================
1893
======================================================================
1883
=========== Function 40 - set the mask for expected events. ==========
1894
=========== Function 40 - set the mask for expected events. ==========
1884
======================================================================
1895
======================================================================
1885
The mask for expected events affects function working with events
1896
The mask for expected events affects function working with events
1886
10, 11, 23 - they notify only about events allowed by this mask.
1897
10, 11, 23 - they notify only about events allowed by this mask.
1887
Parameters:
1898
Parameters:
1888
  * eax = 40 - function number
1899
  * eax = 40 - function number
1889
  * ebx = mask: bit i corresponds to event i+1 (see list of events)
1900
  * ebx = mask: bit i corresponds to event i+1 (see list of events)
1890
    (set bit permits notice on event)
1901
    (set bit permits notice on event)
1891
Returned value:
1902
Returned value:
1892
  * function does not return value
1903
  * function does not return value
1893
Remarks:
1904
Remarks:
1894
  * Default mask (7=111b) enables nofices about redraw,
1905
  * Default mask (7=111b) enables nofices about redraw,
1895
    keys and buttons. This is enough for many applications.
1906
    keys and buttons. This is enough for many applications.
1896
  * Events prohibited in the mask are saved anyway, when come;
1907
  * Events prohibited in the mask are saved anyway, when come;
1897
    they are simply not informed with event functions.
1908
    they are simply not informed with event functions.
1898
  * Event functions take into account the mask on moment of
1909
  * Event functions take into account the mask on moment of
1899
    function call, not on moment of event arrival.
1910
    function call, not on moment of event arrival.
1900
 
1911
 
1901
======================================================================
1912
======================================================================
1902
==================== Function 41 - get IRQ owner. ====================
1913
==================== Function 41 - get IRQ owner. ====================
1903
======================================================================
1914
======================================================================
1904
Parameters:
1915
Parameters:
1905
  * eax = 41 - function number
1916
  * eax = 41 - function number
1906
  * ebx = IRQ number, 0..15
1917
  * ebx = IRQ number, 0..15
1907
Returned value:
1918
Returned value:
1908
  * eax = owner PID
1919
  * eax = owner PID
1909
  * eax = 0, if there is no owner
1920
  * eax = 0, if there is no owner
1910
  * eax = -1 for incorrect ebx
1921
  * eax = -1 for incorrect ebx
1911
 
1922
 
1912
======================================================================
1923
======================================================================
1913
==================== Function 42 - read IRQ data. ====================
1924
==================== Function 42 - read IRQ data. ====================
1914
======================================================================
1925
======================================================================
1915
When an IRQ occurs, the system reads data from ports indicated
1926
When an IRQ occurs, the system reads data from ports indicated
1916
earlier by function 44 and writes this data to
1927
earlier by function 44 and writes this data to
1917
internal buffer. This function reads out data from that buffer
1928
internal buffer. This function reads out data from that buffer
1918
bytewise.
1929
bytewise.
1919
Parameters:
1930
Parameters:
1920
  * eax = 42 - function number
1931
  * eax = 42 - function number
1921
  * ebx = IRQ number, 0..15
1932
  * ebx = IRQ number, 0..15
1922
Returned value: (use value of ecx to distinguish)
1933
Returned value: (use value of ecx to distinguish)
1923
  * if the thread is not IRQ owner (or IRQ number is incorrect):
1934
  * if the thread is not IRQ owner (or IRQ number is incorrect):
1924
    * ecx = 2
1935
    * ecx = 2
1925
  * if there is no data:
1936
  * if there is no data:
1926
    * eax = 0
1937
    * eax = 0
1927
    * ecx = 1
1938
    * ecx = 1
1928
    * ebx destroyed
1939
    * ebx destroyed
1929
  * if all is ok:
1940
  * if all is ok:
1930
    * eax = byte size of data, not yet read from buffer
1941
    * eax = byte size of data, not yet read from buffer
1931
    * ecx = 0
1942
    * ecx = 0
1932
    * ebx = current byte
1943
    * ebx = current byte
1933
Remarks:
1944
Remarks:
1934
  * Previously the thread must reserve indicated IRQ for itself
1945
  * Previously the thread must reserve indicated IRQ for itself
1935
    by function 45.
1946
    by function 45.
1936
  * The size of data buffer is 4000 bytes, on overflow
1947
  * The size of data buffer is 4000 bytes, on overflow
1937
    "fresh" data cease to be written in the buffer.
1948
    "fresh" data cease to be written in the buffer.
1938
 
1949
 
1939
======================================================================
1950
======================================================================
1940
================ Function 43 - input/output to a port. ===============
1951
================ Function 43 - input/output to a port. ===============
1941
======================================================================
1952
======================================================================
1942
 
1953
 
1943
------------------------ Output data to port -------------------------
1954
------------------------ Output data to port -------------------------
1944
Parameters:
1955
Parameters:
1945
  * eax = 43 - function number
1956
  * eax = 43 - function number
1946
  * bl = byte for output
1957
  * bl = byte for output
1947
  * ecx = port number 0xnnnn (from 0 to 0xFFFF)
1958
  * ecx = port number 0xnnnn (from 0 to 0xFFFF)
1948
Returned value:
1959
Returned value:
1949
  * eax = 0 - success
1960
  * eax = 0 - success
1950
  * eax = 1 - the thread has not reserved the selected port
1961
  * eax = 1 - the thread has not reserved the selected port
1951
 
1962
 
1952
------------------------ Input data from port ------------------------
1963
------------------------ Input data from port ------------------------
1953
Parameters:
1964
Parameters:
1954
  * eax = 43 - function number
1965
  * eax = 43 - function number
1955
  * ebx is ignored
1966
  * ebx is ignored
1956
  * ecx = 0x8000nnnn, where nnnn = port number (from 0 to 0xFFFF)
1967
  * ecx = 0x8000nnnn, where nnnn = port number (from 0 to 0xFFFF)
1957
Returned value:
1968
Returned value:
1958
  * eax = 0 - success, thus ebx = entered byte
1969
  * eax = 0 - success, thus ebx = entered byte
1959
  * eax = 1 - the thread has not reserved the selected port
1970
  * eax = 1 - the thread has not reserved the selected port
1960
Remarks:
1971
Remarks:
1961
  * Previously the thread must reserve the selected port
1972
  * Previously the thread must reserve the selected port
1962
    for itself by function 46.
1973
    for itself by function 46.
1963
  * Instead of call to this function it is better to use
1974
  * Instead of call to this function it is better to use
1964
    processor instructions in/out - this is much
1975
    processor instructions in/out - this is much
1965
    faster and a bit shorter and easier.
1976
    faster and a bit shorter and easier.
1966
 
1977
 
1967
======================================================================
1978
======================================================================
1968
=========== Function 44 - define operations at IRQ arrival. ==========
1979
=========== Function 44 - define operations at IRQ arrival. ==========
1969
======================================================================
1980
======================================================================
1970
At IRQ arrival the system can read the data from ports defined
1981
At IRQ arrival the system can read the data from ports defined
1971
by this function and write these data to internal buffer, whence
1982
by this function and write these data to internal buffer, whence
1972
they can be read by ôóíêöèåé 42.
1983
they can be read by ôóíêöèåé 42.
1973
Parameters:
1984
Parameters:
1974
  * eax = 44 - function number
1985
  * eax = 44 - function number
1975
  * ebx = pointer to the array of structures each describing one port:
1986
  * ebx = pointer to the array of structures each describing one port:
1976
    * +0: word: 0 means end of array, otherwise port number
1987
    * +0: word: 0 means end of array, otherwise port number
1977
    * +2: byte: reserved (ignored)
1988
    * +2: byte: reserved (ignored)
1978
    * +3: byte: 1=read byte from this port, 2=read word
1989
    * +3: byte: 1=read byte from this port, 2=read word
1979
  * ecx = IRQ number, 0..15
1990
  * ecx = IRQ number, 0..15
1980
Returned value:
1991
Returned value:
1981
  * eax = 0 - success
1992
  * eax = 0 - success
1982
  * eax = 1 - the thread is not owner of selected IRQ
1993
  * eax = 1 - the thread is not owner of selected IRQ
1983
Remarks:
1994
Remarks:
1984
  * Previously the thread must reserve for itself selected IRQ
1995
  * Previously the thread must reserve for itself selected IRQ
1985
    by function 45.
1996
    by function 45.
1986
  * First 16 ports are considered only.
1997
  * First 16 ports are considered only.
1987
  * The current implementation considers incorrect value of field +3
1998
  * The current implementation considers incorrect value of field +3
1988
    as a signal to terminate IRQ processing.
1999
    as a signal to terminate IRQ processing.
1989
 
2000
 
1990
======================================================================
2001
======================================================================
1991
=================== Function 45 - reserve/free IRQ. ==================
2002
=================== Function 45 - reserve/free IRQ. ==================
1992
======================================================================
2003
======================================================================
1993
Parameters:
2004
Parameters:
1994
  * eax = 45 - function number
2005
  * eax = 45 - function number
1995
  * ebx = 0 - reserve, 1 = free
2006
  * ebx = 0 - reserve, 1 = free
1996
  * ecx = IRQ number, 0..15
2007
  * ecx = IRQ number, 0..15
1997
Returned value:
2008
Returned value:
1998
  * eax = 0 - success
2009
  * eax = 0 - success
1999
  * eax = 1 - error (invalid IRQ number
2010
  * eax = 1 - error (invalid IRQ number
2000
    or attempt to reserve not free IRQ
2011
    or attempt to reserve not free IRQ
2001
    or to free IRQ, not reserved by this thread)
2012
    or to free IRQ, not reserved by this thread)
2002
Remarks:
2013
Remarks:
2003
  * IRQ reservation is required for functions 42 and 44.
2014
  * IRQ reservation is required for functions 42 and 44.
2004
  * Only one thread can reserve the specific IRQ.
2015
  * Only one thread can reserve the specific IRQ.
2005
  * IRQs, handled by the system itself, are reserved by the system
2016
  * IRQs, handled by the system itself, are reserved by the system
2006
    (thread 1) at booting.
2017
    (thread 1) at booting.
2007
  * When a thread terminates, all reserved by it IRQs
2018
  * When a thread terminates, all reserved by it IRQs
2008
    are freed automatically.
2019
    are freed automatically.
2009
 
2020
 
2010
======================================================================
2021
======================================================================
2011
====== Function 46 - reserve/free a group of input/output ports. =====
2022
====== Function 46 - reserve/free a group of input/output ports. =====
2012
======================================================================
2023
======================================================================
2013
To work with reserved ports an application can access directly by
2024
To work with reserved ports an application can access directly by
2014
commands in/out (recommended way) and can use function 43
2025
commands in/out (recommended way) and can use function 43
2015
(not recommended way).
2026
(not recommended way).
2016
Parameters:
2027
Parameters:
2017
  * eax = 46 - function number
2028
  * eax = 46 - function number
2018
  * ebx = 0 - reserve, 1 - free
2029
  * ebx = 0 - reserve, 1 - free
2019
  * ecx = start port number
2030
  * ecx = start port number
2020
  * edx = end port number (inclusive)
2031
  * edx = end port number (inclusive)
2021
Returned value:
2032
Returned value:
2022
  * eax = 0 - success
2033
  * eax = 0 - success
2023
  * eax = 1 - error
2034
  * eax = 1 - error
2024
Remarks:
2035
Remarks:
2025
  * For ports reservation: an error occurs if and only if
2036
  * For ports reservation: an error occurs if and only if
2026
    one from the following condition satisfies:
2037
    one from the following condition satisfies:
2027
    * start port is more than end port;
2038
    * start port is more than end port;
2028
    * the selected range contains incorrect port number
2039
    * the selected range contains incorrect port number
2029
      (correct are from 0 to 0xFFFF);
2040
      (correct are from 0 to 0xFFFF);
2030
    * limit for the total number of reserved areas is exceeded
2041
    * limit for the total number of reserved areas is exceeded
2031
      (maximum 255 are allowed);
2042
      (maximum 255 are allowed);
2032
    * the selected range intersects with any of earlier reserved
2043
    * the selected range intersects with any of earlier reserved
2033
  * For ports free: an error is an attempt to free range,
2044
  * For ports free: an error is an attempt to free range,
2034
    that was not earlier reserved by this function
2045
    that was not earlier reserved by this function
2035
    (with same ecx,edx).
2046
    (with same ecx,edx).
2036
  * If an error occurs (for both cases) function performs no action.
2047
  * If an error occurs (for both cases) function performs no action.
2037
  * At booting the system reserves for itself ports 0..0xff, and if
2048
  * At booting the system reserves for itself ports 0..0xff, and if
2038
    COM-mouse is detected - additionally range of COM-ports
2049
    COM-mouse is detected - additionally range of COM-ports
2039
    0x3f0..0x3ff and/or 0x2f0..0x2ff.
2050
    0x3f0..0x3ff and/or 0x2f0..0x2ff.
2040
  * When a thread terminates, all reserved by it ports
2051
  * When a thread terminates, all reserved by it ports
2041
    are freed automatically.
2052
    are freed automatically.
2042
 
2053
 
2043
======================================================================
2054
======================================================================
2044
============= Function 47 - draw a number in the window. =============
2055
============= Function 47 - draw a number in the window. =============
2045
======================================================================
2056
======================================================================
2046
Parameters:
2057
Parameters:
2047
  * eax = 47 - function number
2058
  * eax = 47 - function number
2048
  * ebx = parameters of conversion number to text:
2059
  * ebx = parameters of conversion number to text:
2049
    * bl = 0 - ecx contains number
2060
    * bl = 0 - ecx contains number
2050
    * bl = 1 - ecx contains pointer to dword-number
2061
    * bl = 1 - ecx contains pointer to dword-number
2051
    * bh = 0 - display in decimal number system
2062
    * bh = 0 - display in decimal number system
2052
    * bh = 1 - display in hexadecimal system
2063
    * bh = 1 - display in hexadecimal system
2053
    * bh = 2 - display in binary system
2064
    * bh = 2 - display in binary system
2054
    * áèòû 16-21 = how many digits to display
2065
    * áèòû 16-21 = how many digits to display
2055
    * áèòû 22-31 reserved and must be set to 0
2066
    * áèòû 22-31 reserved and must be set to 0
2056
  * ecx = number (if bl=0) or pointer (if bl=1)
2067
  * ecx = number (if bl=0) or pointer (if bl=1)
2057
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
2068
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
2058
  * esi = 0xX0RRGGBB:
2069
  * esi = 0xX0RRGGBB:
2059
    * RR, GG, BB specify the color
2070
    * RR, GG, BB specify the color
2060
    * X = ABnn (bits)
2071
    * X = ABnn (bits)
2061
    * nn = font (0/1)
2072
    * nn = font (0/1)
2062
    * A is ignored
2073
    * A is ignored
2063
    * B=1 - fill background with the color edi
2074
    * B=1 - fill background with the color edi
2064
Returned value:
2075
Returned value:
2065
  * function does not return value
2076
  * function does not return value
2066
Remarks:
2077
Remarks:
2067
  * The given length must not exceed 60.
2078
  * The given length must not exceed 60.
2068
  * The exactly given amount of digits is output. If number is small
2079
  * The exactly given amount of digits is output. If number is small
2069
    and can be written by smaller amount of digits, it is supplemented
2080
    and can be written by smaller amount of digits, it is supplemented
2070
    by leading zeroes; if the number is big and can not be written by
2081
    by leading zeroes; if the number is big and can not be written by
2071
    given amount of digits, extra digits are not drawn.
2082
    given amount of digits, extra digits are not drawn.
2072
  * Parameters of fonts are shown in the description of function 4
2083
  * Parameters of fonts are shown in the description of function 4
2073
    (text output).
2084
    (text output).
2074
 
2085
 
2075
======================================================================
2086
======================================================================
2076
========= Function 48, subfunction 0 - apply screen settings. ========
2087
========= Function 48, subfunction 0 - apply screen settings. ========
2077
======================================================================
2088
======================================================================
2078
Parameters:
2089
Parameters:
2079
  * eax = 48 - function number
2090
  * eax = 48 - function number
2080
  * ebx = 0 - subfunction number
2091
  * ebx = 0 - subfunction number
2081
  * ecx = 0 - reserved
2092
  * ecx = 0 - reserved
2082
Returned value:
2093
Returned value:
2083
  * function does not return value
2094
  * function does not return value
2084
Remarks:
2095
Remarks:
2085
  * Function redraws the screen after parameters change by
2096
  * Function redraws the screen after parameters change by
2086
    subfunctions 1 and 2.
2097
    subfunctions 1 and 2.
2087
  * Function call without prior call to one of indicated subfunctions
2098
  * Function call without prior call to one of indicated subfunctions
2088
    is ignored.
2099
    is ignored.
2089
  * Function call with nonzero ecx is ignored.
2100
  * Function call with nonzero ecx is ignored.
2090
 
2101
 
2091
======================================================================
2102
======================================================================
2092
=========== Function 48, subfunction 1 - set button style. ===========
2103
=========== Function 48, subfunction 1 - set button style. ===========
2093
======================================================================
2104
======================================================================
2094
Parameters:
2105
Parameters:
2095
  * eax = 48 - function number
2106
  * eax = 48 - function number
2096
  * ebx = 1 - subfunction number
2107
  * ebx = 1 - subfunction number
2097
  * ecx = button style:
2108
  * ecx = button style:
2098
    * 0 = flat
2109
    * 0 = flat
2099
    * 1 = 3d
2110
    * 1 = 3d
2100
Returned value:
2111
Returned value:
2101
  * function does not return value
2112
  * function does not return value
2102
Remarks:
2113
Remarks:
2103
  * After call to this function one should redraw the screen by
2114
  * After call to this function one should redraw the screen by
2104
    subfunction 0.
2115
    subfunction 0.
2105
  * Button style influences only to their draw of function 8.
2116
  * Button style influences only to their draw of function 8.
2106
 
2117
 
2107
======================================================================
2118
======================================================================
2108
====== Function 48, subfunction 2 - set standard window colors. ======
2119
====== Function 48, subfunction 2 - set standard window colors. ======
2109
======================================================================
2120
======================================================================
2110
Parameters:
2121
Parameters:
2111
  * eax = 48 - function number
2122
  * eax = 48 - function number
2112
  * ebx = 2 - subfunction number
2123
  * ebx = 2 - subfunction number
2113
  * ecx = pointer to the color table
2124
  * ecx = pointer to the color table
2114
  * edx = size of the color table
2125
  * edx = size of the color table
2115
    (must be 40 bytes for future compatibility)
2126
    (must be 40 bytes for future compatibility)
2116
Format of the color table is shown in description of subfunction 3.
2127
Format of the color table is shown in description of subfunction 3.
2117
Returned value:
2128
Returned value:
2118
  * function does not return value
2129
  * function does not return value
2119
Remarks:
2130
Remarks:
2120
  * After call to this function one should redraw the screen by
2131
  * After call to this function one should redraw the screen by
2121
    subfunction 0.
2132
    subfunction 0.
2122
  * Table of standard colors influences only to applications,
2133
  * Table of standard colors influences only to applications,
2123
    which receive this table obviously (by subfunction 3)
2134
    which receive this table obviously (by subfunction 3)
2124
    and use it (specifying colors from it to drawing functions).
2135
    and use it (specifying colors from it to drawing functions).
2125
  * Table of standard colors is included in skin and is installed
2136
  * Table of standard colors is included in skin and is installed
2126
    anew with skin installation (by subfunction 8).
2137
    anew with skin installation (by subfunction 8).
2127
  * Color table can be viewed/changed interactively with
2138
  * Color table can be viewed/changed interactively with
2128
    the application 'desktop'.
2139
    the application 'desktop'.
2129
 
2140
 
2130
======================================================================
2141
======================================================================
2131
====== Function 48, subfunction 3 - get standard window colors. ======
2142
====== Function 48, subfunction 3 - get standard window colors. ======
2132
======================================================================
2143
======================================================================
2133
Parameters:
2144
Parameters:
2134
  * eax = 48 - function number
2145
  * eax = 48 - function number
2135
  * ebx = 3 - subfunction number
2146
  * ebx = 3 - subfunction number
2136
  * ecx = pointer to the buffer with size edx bytes,
2147
  * ecx = pointer to the buffer with size edx bytes,
2137
    where table will be written
2148
    where table will be written
2138
  * edx = size of color table
2149
  * edx = size of color table
2139
    (must be 40 bytes for future compatibility)
2150
    (must be 40 bytes for future compatibility)
2140
Returned value:
2151
Returned value:
2141
  * function does not return value
2152
  * function does not return value
2142
Format of the color table:
2153
Format of the color table:
2143
each item is dword-value for color 0x00RRGGBB
2154
each item is dword-value for color 0x00RRGGBB
2144
  * +0: dword: frames - color of frame
2155
  * +0: dword: frames - color of frame
2145
  * +4: dword: grab - color of header
2156
  * +4: dword: grab - color of header
2146
  * +8: dword: grab_button - color of button on header bar
2157
  * +8: dword: grab_button - color of button on header bar
2147
  * +12 = +0xC: dword: grab_button_text - color of text on button
2158
  * +12 = +0xC: dword: grab_button_text - color of text on button
2148
    on header bar
2159
    on header bar
2149
  * +16 = +0x10: dword: grab_text - color of text on header
2160
  * +16 = +0x10: dword: grab_text - color of text on header
2150
  * +20 = +0x14: dword: work - color of working area
2161
  * +20 = +0x14: dword: work - color of working area
2151
  * +24 = +0x18: dword: work_button - color of button in working area
2162
  * +24 = +0x18: dword: work_button - color of button in working area
2152
  * +28 = +0x1C: dword: work_button_text - color of text on button
2163
  * +28 = +0x1C: dword: work_button_text - color of text on button
2153
    in working area
2164
    in working area
2154
  * +32 = +0x20: dword: work_text - color of text in working area
2165
  * +32 = +0x20: dword: work_text - color of text in working area
2155
  * +36 = +0x24: dword: work_graph - color of graphics in working area
2166
  * +36 = +0x24: dword: work_graph - color of graphics in working area
2156
Remarks:
2167
Remarks:
2157
  * Structure of the color table is described in the standard
2168
  * Structure of the color table is described in the standard
2158
    include file 'macros.inc' as 'system_colors'; for example,
2169
    include file 'macros.inc' as 'system_colors'; for example,
2159
    it is possible to write:
2170
    it is possible to write:
2160
    	sc	system_colors		; variable declaration
2171
    	sc	system_colors		; variable declaration
2161
    	...				; somewhere one must call
2172
    	...				; somewhere one must call
2162
    					; this function with ecx=sc
2173
    					; this function with ecx=sc
2163
    	mov	ecx, [sc.work_button_text]	; read text color on
2174
    	mov	ecx, [sc.work_button_text]	; read text color on
2164
    					; buttin in working area
2175
    					; buttin in working area
2165
  * A program itself desides to use or not to use color table.
2176
  * A program itself desides to use or not to use color table.
2166
    For usage program must simply at calls to drawing functions select
2177
    For usage program must simply at calls to drawing functions select
2167
    color taken from the table.
2178
    color taken from the table.
2168
  * At change of the table of standard colors (by subfunction 2 with
2179
  * At change of the table of standard colors (by subfunction 2 with
2169
    the subsequent application of changes by subfunction 0 or
2180
    the subsequent application of changes by subfunction 0 or
2170
    at skin set by subfunction 8) the system sends to all windows
2181
    at skin set by subfunction 8) the system sends to all windows
2171
    redraw message (the event with code 1).
2182
    redraw message (the event with code 1).
2172
  * Color table can be viewed/changed interactively with
2183
  * Color table can be viewed/changed interactively with
2173
    the application 'desktop'.
2184
    the application 'desktop'.
2174
 
2185
 
2175
======================================================================
2186
======================================================================
2176
============ Function 48, subfunction 4 - get skin height. ===========
2187
============ Function 48, subfunction 4 - get skin height. ===========
2177
======================================================================
2188
======================================================================
2178
Parameters:
2189
Parameters:
2179
  * eax = 48 - function number
2190
  * eax = 48 - function number
2180
  * ebx = 4 - subfunction number
2191
  * ebx = 4 - subfunction number
2181
Returned value:
2192
Returned value:
2182
  * eax = skin height
2193
  * eax = skin height
2183
Remarks:
2194
Remarks:
2184
  * Skin height is defined as the height of a header
2195
  * Skin height is defined as the height of a header
2185
    of skinned windows.
2196
    of skinned windows.
2186
  * See also general structure of window in the description
2197
  * See also general structure of window in the description
2187
    of function 0.
2198
    of function 0.
2188
 
2199
 
2189
======================================================================
2200
======================================================================
2190
======== Function 48, subfunction 5 - get screen working area. =======
2201
======== Function 48, subfunction 5 - get screen working area. =======
2191
======================================================================
2202
======================================================================
2192
Parameters:
2203
Parameters:
2193
  * eax = 48 - function number
2204
  * eax = 48 - function number
2194
  * ebx = 5 - subfunction number
2205
  * ebx = 5 - subfunction number
2195
Returned value:
2206
Returned value:
2196
  * eax = [left]*65536 + [right]
2207
  * eax = [left]*65536 + [right]
2197
  * ebx = [top]*65536 + [bottom]
2208
  * ebx = [top]*65536 + [bottom]
2198
Remarks:
2209
Remarks:
2199
  * The screen working area defines position and coordinates of
2210
  * The screen working area defines position and coordinates of
2200
    a maximized window.
2211
    a maximized window.
2201
  * The screen working area in view of normal work is all screen
2212
  * The screen working area in view of normal work is all screen
2202
    without system panel (the application '@panel').
2213
    without system panel (the application '@panel').
2203
  * (left,top) are coordinates of the left upper corner,
2214
  * (left,top) are coordinates of the left upper corner,
2204
    (right,bottom) are coordinates of the right lower one.
2215
    (right,bottom) are coordinates of the right lower one.
2205
    Thus the size of working area on x axis can be calculated by
2216
    Thus the size of working area on x axis can be calculated by
2206
    formula right-left+1, on y axis - by formula bottom-right+1.
2217
    formula right-left+1, on y axis - by formula bottom-right+1.
2207
  * See also function 14,
2218
  * See also function 14,
2208
    to get sizes of all screen.
2219
    to get sizes of all screen.
2209
  * There is a pair function to set working area - subfunction 6.
2220
  * There is a pair function to set working area - subfunction 6.
2210
 
2221
 
2211
======================================================================
2222
======================================================================
2212
======== Function 48, subfunction 6 - set screen working area. =======
2223
======== Function 48, subfunction 6 - set screen working area. =======
2213
======================================================================
2224
======================================================================
2214
Parameters:
2225
Parameters:
2215
  * eax = 48 - function number
2226
  * eax = 48 - function number
2216
  * ebx = 6 - subfunction number
2227
  * ebx = 6 - subfunction number
2217
  * ecx = [left]*65536 + [right]
2228
  * ecx = [left]*65536 + [right]
2218
  * edx = [top]*65536 + [bottom]
2229
  * edx = [top]*65536 + [bottom]
2219
Returned value:
2230
Returned value:
2220
  * function does not return value
2231
  * function does not return value
2221
Remarks:
2232
Remarks:
2222
  * The screen working area defines position and coordinates of
2233
  * The screen working area defines position and coordinates of
2223
    a maximized window.
2234
    a maximized window.
2224
  * This function is used only by the application '@panel',
2235
  * This function is used only by the application '@panel',
2225
    which set working area to all screen without system panel.
2236
    which set working area to all screen without system panel.
2226
  * (left,top) are coordinates of the left upper corner,
2237
  * (left,top) are coordinates of the left upper corner,
2227
    (right,bottom) are coordinates of the right lower one.
2238
    (right,bottom) are coordinates of the right lower one.
2228
    Thus the size of working area on x axis can be calculated by
2239
    Thus the size of working area on x axis can be calculated by
2229
    formula right-left+1, on y axis - by formula bottom-right+1.
2240
    formula right-left+1, on y axis - by formula bottom-right+1.
2230
  * If 'left'>='right', x-coordinate of working area is not changed.
2241
  * If 'left'>='right', x-coordinate of working area is not changed.
2231
    If 'left'<0, 'left' will not be set. If 'right' is greater than or
2242
    If 'left'<0, 'left' will not be set. If 'right' is greater than or
2232
    equal to screen width, 'right' will not be set.
2243
    equal to screen width, 'right' will not be set.
2233
    Similarly on y axis.
2244
    Similarly on y axis.
2234
  * See also function 14,
2245
  * See also function 14,
2235
    to get sizes of all screen.
2246
    to get sizes of all screen.
2236
  * There is a pair function to get working area - subfunction 5.
2247
  * There is a pair function to get working area - subfunction 5.
2237
  * This function redraws the screen automatically,
2248
  * This function redraws the screen automatically,
2238
    updating coordinates and sizes of maximized windows.
2249
    updating coordinates and sizes of maximized windows.
2239
    The system sends to all windows redraw message (the event 1).
2250
    The system sends to all windows redraw message (the event 1).
2240
 
2251
 
2241
======================================================================
2252
======================================================================
2242
=========== Function 48, subfunction 7 - get skin margins. ===========
2253
=========== Function 48, subfunction 7 - get skin margins. ===========
2243
======================================================================
2254
======================================================================
2244
Returns the area of a header of a skinned window, intended for
2255
Returns the area of a header of a skinned window, intended for
2245
a text of a header.
2256
a text of a header.
2246
Parameters:
2257
Parameters:
2247
  * eax = 48 - function number
2258
  * eax = 48 - function number
2248
  * ebx = 7 - subfunction number
2259
  * ebx = 7 - subfunction number
2249
Returned value:
2260
Returned value:
2250
  * eax = [left]*65536 + [right]
2261
  * eax = [left]*65536 + [right]
2251
  * ebx = [top]*65536 + [bottom]
2262
  * ebx = [top]*65536 + [bottom]
2252
Remarks:
2263
Remarks:
2253
  * An application decides itself to use or not to use this function.
2264
  * An application decides itself to use or not to use this function.
2254
  * It is recommended to take into account returned value
2265
  * It is recommended to take into account returned value
2255
    of this function for choice of a place for drawing header text
2266
    of this function for choice of a place for drawing header text
2256
    (by function 4) or a substitute of header text
2267
    (by function 4) or a substitute of header text
2257
    (at the discretion of an application).
2268
    (at the discretion of an application).
2258
 
2269
 
2259
======================================================================
2270
======================================================================
2260
============= Function 48, subfunction 8 - set used skin. ============
2271
============= Function 48, subfunction 8 - set used skin. ============
2261
======================================================================
2272
======================================================================
2262
Parameters:
2273
Parameters:
2263
  * eax = 48 - function number
2274
  * eax = 48 - function number
2264
  * ebx = 8 - subfunction number
2275
  * ebx = 8 - subfunction number
2265
  * ecx = pointer to a block for function 58, in
2276
  * ecx = pointer to a block for function 58, in
2266
    which the fields of intermediate buffer and file name are filled
2277
    which the fields of intermediate buffer and file name are filled
2267
Returned value:
2278
Returned value:
2268
  * eax = 0 - success
2279
  * eax = 0 - success
2269
  * otherwise eax = file system error code; if file does not
2280
  * otherwise eax = file system error code; if file does not
2270
    contain valid skin, function returns error 3
2281
    contain valid skin, function returns error 3
2271
    (unknown file system).
2282
    (unknown file system).
2272
Remarks:
2283
Remarks:
2273
  * After successful skin loading the system sends to all windows
2284
  * After successful skin loading the system sends to all windows
2274
    redraw message (the event 1).
2285
    redraw message (the event 1).
2275
  * At booting the system reads skin from file 'default.skn'
2286
  * At booting the system reads skin from file 'default.skn'
2276
    on ramdisk.
2287
    on ramdisk.
2277
  * User can change the skin statically by creating hisself
2288
  * User can change the skin statically by creating hisself
2278
    'default.skn' or dynamically with the application 'desktop'.
2289
    'default.skn' or dynamically with the application 'desktop'.
2279
 
2290
 
2280
======================================================================
2291
======================================================================
2281
=========== Function 49 - Advanced Power Management (APM). ===========
2292
=========== Function 49 - Advanced Power Management (APM). ===========
2282
======================================================================
2293
======================================================================
2283
Parameters:
2294
Parameters:
2284
  * eax = 49 - function number
2295
  * eax = 49 - function number
2285
  * dx = number of the APM function
2296
  * dx = number of the APM function
2286
    (analogue of ax in APM specification)
2297
    (analogue of ax in APM specification)
2287
  * bx, cx = parameters of the APM function
2298
  * bx, cx = parameters of the APM function
2288
Returned value:
2299
Returned value:
2289
  * 16-bit registers ax, bx, cx, dx, si, di and carry flag CF
2300
  * 16-bit registers ax, bx, cx, dx, si, di and carry flag CF
2290
    are set according to the APM specification
2301
    are set according to the APM specification
2291
  * high halves of 32-bit registers eax, ebx, ecx,
2302
  * high halves of 32-bit registers eax, ebx, ecx,
2292
    edx, esi, edi are destroyed
2303
    edx, esi, edi are destroyed
2293
Remarks:
2304
Remarks:
2294
  * APM 1.2 specification is described in the document
2305
  * APM 1.2 specification is described in the document
2295
    "Advanced Power Management (APM) BIOS Specification"
2306
    "Advanced Power Management (APM) BIOS Specification"
2296
    (Revision 1.2), available at
2307
    (Revision 1.2), available at
2297
    http://www.microsoft.com/whdc/archive/amp_12.mspx;
2308
    http://www.microsoft.com/whdc/archive/amp_12.mspx;
2298
    besides it is included in famous Interrupt List by Ralf Brown
2309
    besides it is included in famous Interrupt List by Ralf Brown
2299
    (http://www.pobox.com/~ralf/files.html,
2310
    (http://www.pobox.com/~ralf/files.html,
2300
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/).
2311
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/).
2301
 
2312
 
2302
======================================================================
2313
======================================================================
2303
=================== Function 50 - set window shape. ==================
2314
=================== Function 50 - set window shape. ==================
2304
======================================================================
2315
======================================================================
2305
Normal windows have rectangular shape. This function can give to
2316
Normal windows have rectangular shape. This function can give to
2306
a window any shape. The shape is given by a set of points inside
2317
a window any shape. The shape is given by a set of points inside
2307
the base rectangle belonging to a window. Position and coordinates
2318
the base rectangle belonging to a window. Position and coordinates
2308
of the base rectangle are set by function 0
2319
of the base rectangle are set by function 0
2309
and changed by function 67.
2320
and changed by function 67.
2310
 
2321
 
2311
--------------------------- Set shape data ---------------------------
2322
--------------------------- Set shape data ---------------------------
2312
Parameters:
2323
Parameters:
2313
  * eax = 50 - function number
2324
  * eax = 50 - function number
2314
  * ebx = 0 - subfunction number
2325
  * ebx = 0 - subfunction number
2315
  * ecx = pointer to shape data (array of bytes 0/1)
2326
  * ecx = pointer to shape data (array of bytes 0/1)
2316
Returned value:
2327
Returned value:
2317
  * function does not return value
2328
  * function does not return value
2318
 
2329
 
2319
-------------------------- Set shape scale ---------------------------
2330
-------------------------- Set shape scale ---------------------------
2320
Parameters:
2331
Parameters:
2321
  * eax = 50 - function number
2332
  * eax = 50 - function number
2322
  * ebx = 1 - subfunction number
2333
  * ebx = 1 - subfunction number
2323
  * ecx sets a scale: each byte of data defines
2334
  * ecx sets a scale: each byte of data defines
2324
    (2^scale)*(2^scale) pixels
2335
    (2^scale)*(2^scale) pixels
2325
Returned value:
2336
Returned value:
2326
  * function does not return value
2337
  * function does not return value
2327
Remarks:
2338
Remarks:
2328
  * Default scale is 0 (scale factor is 1). If in the shape data
2339
  * Default scale is 0 (scale factor is 1). If in the shape data
2329
    one byte corresponds to one pixel, there is no necessity
2340
    one byte corresponds to one pixel, there is no necessity
2330
    to set scale.
2341
    to set scale.
2331
  * Let's designate xsize = window width (in pixels), ysize = height;
2342
  * Let's designate xsize = window width (in pixels), ysize = height;
2332
    pay attention, that they are one pixel more than defined by
2343
    pay attention, that they are one pixel more than defined by
2333
    functions 0, 67.
2344
    functions 0, 67.
2334
  * On definition of scale xsize and ysize must be divisible
2345
  * On definition of scale xsize and ysize must be divisible
2335
    on 2^scale.
2346
    on 2^scale.
2336
  * Byte of data on offset 'a' must be 0/1 and defines belonging
2347
  * Byte of data on offset 'a' must be 0/1 and defines belonging
2337
    to a window of square with the side 2^scale (if scale=0,
2348
    to a window of square with the side 2^scale (if scale=0,
2338
    this is one pixel) and coordinates of the left upper corner
2349
    this is one pixel) and coordinates of the left upper corner
2339
    (a mod (xsize shr scale), a div (xsize shr scale))
2350
    (a mod (xsize shr scale), a div (xsize shr scale))
2340
  * Data size: (xsize shr scale)*(ysize shr scale).
2351
  * Data size: (xsize shr scale)*(ysize shr scale).
2341
  * Data must be presented in the memory and not change
2352
  * Data must be presented in the memory and not change
2342
    after set of shape.
2353
    after set of shape.
2343
  * The system views the shape data at every window redraw by
2354
  * The system views the shape data at every window redraw by
2344
    function 0.
2355
    function 0.
2345
  * The call of subfunction 0 with NULL pointer results in return
2356
  * The call of subfunction 0 with NULL pointer results in return
2346
    to the rectangular shape.
2357
    to the rectangular shape.
2347
 
2358
 
2348
======================================================================
2359
======================================================================
2349
==================== Function 51 - create thread. ====================
2360
==================== Function 51 - create thread. ====================
2350
======================================================================
2361
======================================================================
2351
Parameters:
2362
Parameters:
2352
  * eax = 51 - function number
2363
  * eax = 51 - function number
2353
  * ebx = 1 - unique subfunction
2364
  * ebx = 1 - unique subfunction
2354
  * ecx = address of thread entry point (starting eip)
2365
  * ecx = address of thread entry point (starting eip)
2355
  * edx = pointer to thread stack (starting esp)
2366
  * edx = pointer to thread stack (starting esp)
2356
Returned value:
2367
Returned value:
2357
  * eax = -1 - error (there is too many threads)
2368
  * eax = -1 - error (there is too many threads)
2358
  * otherwise eax = TID - thread identifier
2369
  * otherwise eax = TID - thread identifier
2359
         
2370
         
2360
 
2371
 
2361
======================================================================
2372
======================================================================
2362
=== Function 52, subfunction 0 - get network driver configuration. ===
2373
=== Function 52, subfunction 0 - get network driver configuration. ===
2363
======================================================================
2374
======================================================================
2364
Parameters:
2375
Parameters:
2365
  * eax = 52 - function number
2376
  * eax = 52 - function number
2366
  * ebx = 0 - subfunction number
2377
  * ebx = 0 - subfunction number
2367
Returned value:
2378
Returned value:
2368
  * eax = configuration dword
2379
  * eax = configuration dword
2369
Remarks:
2380
Remarks:
2370
  * Configuration dword can be set by subfunction 2.
2381
  * Configuration dword can be set by subfunction 2.
2371
  * The kernel does not use this variable. The value of this
2382
  * The kernel does not use this variable. The value of this
2372
    variable and working with it subfunctions 0 and 2 is represented
2383
    variable and working with it subfunctions 0 and 2 is represented
2373
    doubtful.
2384
    doubtful.
2374
 
2385
 
2375
======================================================================
2386
======================================================================
2376
========= Function 52, subfunction 1 - get local IP-address. =========
2387
========= Function 52, subfunction 1 - get local IP-address. =========
2377
======================================================================
2388
======================================================================
2378
Parameters:
2389
Parameters:
2379
  * eax = 52 - function number
2390
  * eax = 52 - function number
2380
  * ebx = 1 - subfunction number
2391
  * ebx = 1 - subfunction number
2381
Returned value:
2392
Returned value:
2382
  * eax = IP-address (4 bytes)
2393
  * eax = IP-address (4 bytes)
2383
Remarks:
2394
Remarks:
2384
  * Local IP-address is set by subfunction 3.
2395
  * Local IP-address is set by subfunction 3.
2385
 
2396
 
2386
======================================================================
2397
======================================================================
2387
=== Function 52, subfunction 2 - set network driver configuration. ===
2398
=== Function 52, subfunction 2 - set network driver configuration. ===
2388
======================================================================
2399
======================================================================
2389
Parameters:
2400
Parameters:
2390
  * eax = 52 - function number
2401
  * eax = 52 - function number
2391
  * ebx = 2 - subfunction number
2402
  * ebx = 2 - subfunction number
2392
  * ecx = configuration dword; if low 7 bits derivate the number 3,
2403
  * ecx = configuration dword; if low 7 bits derivate the number 3,
2393
    function [re-]initializes Ethernet-card, otherwise
2404
    function [re-]initializes Ethernet-card, otherwise
2394
    Ethernet turns off
2405
    Ethernet turns off
2395
Returned value:
2406
Returned value:
2396
  * if Ethernet-interface is not requested, function returns eax=2,
2407
  * if Ethernet-interface is not requested, function returns eax=2,
2397
    but this can be changed in future kernel versions
2408
    but this can be changed in future kernel versions
2398
  * if Ethernet-interface is requested, eax=0 means error
2409
  * if Ethernet-interface is requested, eax=0 means error
2399
    (absence of Ethernet-card), and nonzero value - success
2410
    (absence of Ethernet-card), and nonzero value - success
2400
Remarks:
2411
Remarks:
2401
  * Configuration dword can be read by subfunction 0.
2412
  * Configuration dword can be read by subfunction 0.
2402
  * The kernel does not use this variable. The value of this
2413
  * The kernel does not use this variable. The value of this
2403
    variable, subfunction 0 and part of subfunction 2, which set it,
2414
    variable, subfunction 0 and part of subfunction 2, which set it,
2404
    is represented doubtful.
2415
    is represented doubtful.
2405
 
2416
 
2406
======================================================================
2417
======================================================================
2407
========= Function 52, subfunction 3 - set local IP-address. =========
2418
========= Function 52, subfunction 3 - set local IP-address. =========
2408
======================================================================
2419
======================================================================
2409
Parameters:
2420
Parameters:
2410
  * eax = 52 - function number
2421
  * eax = 52 - function number
2411
  * ebx = 3 - subfunction number
2422
  * ebx = 3 - subfunction number
2412
  * ecx = IP-address (4 bytes)
2423
  * ecx = IP-address (4 bytes)
2413
Returned value:
2424
Returned value:
2414
  * the current implementation returns eax=3, but this can be changed
2425
  * the current implementation returns eax=3, but this can be changed
2415
    in future versions
2426
    in future versions
2416
Remarks:
2427
Remarks:
2417
  * Local IP-address can be get by subfunction 1.
2428
  * Local IP-address can be get by subfunction 1.
2418
 
2429
 
2419
======================================================================
2430
======================================================================
2420
= Function 52, subfunction 6 - add data to the stack of input queue. =
2431
= Function 52, subfunction 6 - add data to the stack of input queue. =
2421
======================================================================
2432
======================================================================
2422
Parameters:
2433
Parameters:
2423
  * eax = 52 - function number
2434
  * eax = 52 - function number
2424
  * ebx = 6 - subfunction number
2435
  * ebx = 6 - subfunction number
2425
  * edx = data size
2436
  * edx = data size
2426
  * esi = data pointer
2437
  * esi = data pointer
2427
Returned value:
2438
Returned value:
2428
  * eax = -1 - error
2439
  * eax = -1 - error
2429
  * eax = 0 - success
2440
  * eax = 0 - success
2430
Remarks:
2441
Remarks:
2431
  * This function is intended only for slow network drivers
2442
  * This function is intended only for slow network drivers
2432
    (PPP, SLIP).
2443
    (PPP, SLIP).
2433
  * Data size must not exceed 1500 bytes, though function
2444
  * Data size must not exceed 1500 bytes, though function
2434
    performs no checks on correctness.
2445
    performs no checks on correctness.
2435
 
2446
 
2436
======================================================================
2447
======================================================================
2437
 Function 52, subfunction 8 - read data from the network output queue. 
2448
 Function 52, subfunction 8 - read data from the network output queue. 
2438
======================================================================
2449
======================================================================
2439
Parameters:
2450
Parameters:
2440
  * eax = 52 - function number
2451
  * eax = 52 - function number
2441
  * ebx = 8 - subfunction number
2452
  * ebx = 8 - subfunction number
2442
  * esi = pointer to 1500-byte buffer
2453
  * esi = pointer to 1500-byte buffer
2443
Returned value:
2454
Returned value:
2444
  * eax = number of read bytes (in the current implementation
2455
  * eax = number of read bytes (in the current implementation
2445
    either 0 = no data or 1500)
2456
    either 0 = no data or 1500)
2446
  * data was copied in buffer
2457
  * data was copied in buffer
2447
Remarks:
2458
Remarks:
2448
  * This function is intended only for slow network drivers
2459
  * This function is intended only for slow network drivers
2449
    (PPP, SLIP).
2460
    (PPP, SLIP).
2450
 
2461
 
2451
======================================================================
2462
======================================================================
2452
============ Function 52, subfunction 9 - get gateway IP. ============
2463
============ Function 52, subfunction 9 - get gateway IP. ============
2453
======================================================================
2464
======================================================================
2454
Parameters:
2465
Parameters:
2455
  * eax = 52 - function number
2466
  * eax = 52 - function number
2456
  * ebx = 9 - subfunction number
2467
  * ebx = 9 - subfunction number
2457
Returned value:
2468
Returned value:
2458
  * eax = gateway IP (4 bytes)
2469
  * eax = gateway IP (4 bytes)
2459
 
2470
 
2460
======================================================================
2471
======================================================================
2461
=========== Function 52, subfunction 10 - get subnet mask. ===========
2472
=========== Function 52, subfunction 10 - get subnet mask. ===========
2462
======================================================================
2473
======================================================================
2463
Parameters:
2474
Parameters:
2464
  * eax = 52 - function number
2475
  * eax = 52 - function number
2465
  * ebx = 10 - subfunction number
2476
  * ebx = 10 - subfunction number
2466
Returned value:
2477
Returned value:
2467
  * eax = subnet mask
2478
  * eax = subnet mask
2468
 
2479
 
2469
======================================================================
2480
======================================================================
2470
============ Function 52, subfunction 11 - set gateway IP. ===========
2481
============ Function 52, subfunction 11 - set gateway IP. ===========
2471
======================================================================
2482
======================================================================
2472
Parameters:
2483
Parameters:
2473
  * eax = 52 - function number
2484
  * eax = 52 - function number
2474
  * ebx = 11 - subfunction number
2485
  * ebx = 11 - subfunction number
2475
  * ecx = gateway IP (4 bytes)
2486
  * ecx = gateway IP (4 bytes)
2476
Returned value:
2487
Returned value:
2477
  * the current implementation returns eax=11, but this can be changed
2488
  * the current implementation returns eax=11, but this can be changed
2478
    in future versions
2489
    in future versions
2479
 
2490
 
2480
======================================================================
2491
======================================================================
2481
=========== Function 52, subfunction 12 - set subnet mask. ===========
2492
=========== Function 52, subfunction 12 - set subnet mask. ===========
2482
======================================================================
2493
======================================================================
2483
Parameters:
2494
Parameters:
2484
  * eax = 52 - function number
2495
  * eax = 52 - function number
2485
  * ebx = 12 - subfunction number
2496
  * ebx = 12 - subfunction number
2486
  * ecx = subnet mask
2497
  * ecx = subnet mask
2487
Returned value:
2498
Returned value:
2488
  * the current implementation returns eax=12, but this can be changed
2499
  * the current implementation returns eax=12, but this can be changed
2489
    in future versions
2500
    in future versions
2490
 
2501
 
2491
======================================================================
2502
======================================================================
2492
============== Function 52, subfunction 13 - get DNS IP. =============
2503
============== Function 52, subfunction 13 - get DNS IP. =============
2493
======================================================================
2504
======================================================================
2494
Parameters:
2505
Parameters:
2495
  * eax = 52 - function number
2506
  * eax = 52 - function number
2496
  * ebx = 13 - subfunction number
2507
  * ebx = 13 - subfunction number
2497
Returned value:
2508
Returned value:
2498
  * eax = DNS IP (4 bytes)
2509
  * eax = DNS IP (4 bytes)
2499
 
2510
 
2500
======================================================================
2511
======================================================================
2501
============== Function 52, subfunction 14 - set DNS IP. =============
2512
============== Function 52, subfunction 14 - set DNS IP. =============
2502
======================================================================
2513
======================================================================
2503
Parameters:
2514
Parameters:
2504
  * eax = 52 - function number
2515
  * eax = 52 - function number
2505
  * ebx = 14 - subfunction number
2516
  * ebx = 14 - subfunction number
2506
  * ecx = DNS IP (4 bytes)
2517
  * ecx = DNS IP (4 bytes)
2507
Returned value:
2518
Returned value:
2508
  * the current implementation returns eax=14, but this can be changed
2519
  * the current implementation returns eax=14, but this can be changed
2509
    in future versions
2520
    in future versions
2510
 
2521
 
2511
======================================================================
2522
======================================================================
2512
============ Function 53, subfunction 0 - open UDP-socket. ===========
2523
============ Function 53, subfunction 0 - open UDP-socket. ===========
2513
======================================================================
2524
======================================================================
2514
Parameters:
2525
Parameters:
2515
  * eax = 53 - function number
2526
  * eax = 53 - function number
2516
  * ebx = 0 - subfunction number
2527
  * ebx = 0 - subfunction number
2517
  * ecx = local port (only low word is taken into account)
2528
  * ecx = local port (only low word is taken into account)
2518
  * edx = remote port (only low word is taken into account)
2529
  * edx = remote port (only low word is taken into account)
2519
  * esi = remote IP
2530
  * esi = remote IP
2520
Returned value:
2531
Returned value:
2521
  * eax = -1 = 0xFFFFFFFF - error; ebx destroyed
2532
  * eax = -1 = 0xFFFFFFFF - error; ebx destroyed
2522
  * eax = socket handle (some number which unambiguously identifies
2533
  * eax = socket handle (some number which unambiguously identifies
2523
    socket and have sense only for the system) - success;
2534
    socket and have sense only for the system) - success;
2524
    ebx destroyed
2535
    ebx destroyed
2525
 
2536
 
2526
======================================================================
2537
======================================================================
2527
=========== Function 53, subfunction 1 - close UDP-socket. ===========
2538
=========== Function 53, subfunction 1 - close UDP-socket. ===========
2528
======================================================================
2539
======================================================================
2529
Parameters:
2540
Parameters:
2530
  * eax = 53 - function number
2541
  * eax = 53 - function number
2531
  * ebx = 1 - subfunction number
2542
  * ebx = 1 - subfunction number
2532
  * ecx = socket handle
2543
  * ecx = socket handle
2533
Returned value:
2544
Returned value:
2534
  * eax = -1 - incorrect handle
2545
  * eax = -1 - incorrect handle
2535
  * eax = 0 - success
2546
  * eax = 0 - success
2536
  * ebx destroyed
2547
  * ebx destroyed
2537
Remarks:
2548
Remarks:
2538
  * The current implementation does not close automatically all
2549
  * The current implementation does not close automatically all
2539
    sockets of a thread at termination. In particular, one should not
2550
    sockets of a thread at termination. In particular, one should not
2540
    kill a thread with many opened sockets - there will be an outflow
2551
    kill a thread with many opened sockets - there will be an outflow
2541
    of resources.
2552
    of resources.
2542
  * The current implementation does no checks on correctness
2553
  * The current implementation does no checks on correctness
2543
    (function returns error only if thread tries to close not opened
2554
    (function returns error only if thread tries to close not opened
2544
    socket with correct handle).
2555
    socket with correct handle).
2545
 
2556
 
2546
======================================================================
2557
======================================================================
2547
============== Function 53, subfunction 2 - poll socket. =============
2558
============== Function 53, subfunction 2 - poll socket. =============
2548
======================================================================
2559
======================================================================
2549
Parameters:
2560
Parameters:
2550
  * eax = 53 - function number
2561
  * eax = 53 - function number
2551
  * ebx = 2 - subfunction number
2562
  * ebx = 2 - subfunction number
2552
  * ecx = socket handle
2563
  * ecx = socket handle
2553
Returned value:
2564
Returned value:
2554
  * eax = number of read bytes
2565
  * eax = number of read bytes
2555
  * ebx destroyed
2566
  * ebx destroyed
2556
Remarks:
2567
Remarks:
2557
  * There is no checks for correctness.
2568
  * There is no checks for correctness.
2558
 
2569
 
2559
======================================================================
2570
======================================================================
2560
========= Function 53, subfunction 3 - read byte from socket. ========
2571
========= Function 53, subfunction 3 - read byte from socket. ========
2561
======================================================================
2572
======================================================================
2562
Parameters:
2573
Parameters:
2563
  * eax = 53 - function number
2574
  * eax = 53 - function number
2564
  * ebx = 3 - subfunction number
2575
  * ebx = 3 - subfunction number
2565
  * ecx = socket handle
2576
  * ecx = socket handle
2566
Returned value:
2577
Returned value:
2567
  * if there is no read data: eax=0, bl=0,
2578
  * if there is no read data: eax=0, bl=0,
2568
    other bytes of ebx are destroyed
2579
    other bytes of ebx are destroyed
2569
  * if there are read data: eax=number of rest bytes
2580
  * if there are read data: eax=number of rest bytes
2570
    (possibly 0), bl=read byte, other bytes of ebx are destroyed
2581
    (possibly 0), bl=read byte, other bytes of ebx are destroyed
2571
Remarks:
2582
Remarks:
2572
  * There is no checks for correctness.
2583
  * There is no checks for correctness.
2573
 
2584
 
2574
======================================================================
2585
======================================================================
2575
========== Function 53, subfunction 4 - write to UDP-socket. =========
2586
========== Function 53, subfunction 4 - write to UDP-socket. =========
2576
======================================================================
2587
======================================================================
2577
Parameters:
2588
Parameters:
2578
  * eax = 53 - function number
2589
  * eax = 53 - function number
2579
  * ebx = 4 - subfunction number
2590
  * ebx = 4 - subfunction number
2580
  * ecx = socket handle
2591
  * ecx = socket handle
2581
  * edx = number of bytes to write
2592
  * edx = number of bytes to write
2582
  * esi = pointer to data to write
2593
  * esi = pointer to data to write
2583
Returned value:
2594
Returned value:
2584
  * eax = 0xffffffff - invalid handle
2595
  * eax = 0xffffffff - invalid handle
2585
  * eax = 0xffff - not enough memory
2596
  * eax = 0xffff - not enough memory
2586
  * eax = 0 - success
2597
  * eax = 0 - success
2587
  * ebx destroyed
2598
  * ebx destroyed
2588
Remarks:
2599
Remarks:
2589
  * Check on validity of handle is minimal - only not very incorrect
2600
  * Check on validity of handle is minimal - only not very incorrect
2590
    not opened handles are eliminated.
2601
    not opened handles are eliminated.
2591
  * Number of bytes to write must not exceed 1500-28, though
2602
  * Number of bytes to write must not exceed 1500-28, though
2592
    the appropriate check is not made.
2603
    the appropriate check is not made.
2593
 
2604
 
2594
======================================================================
2605
======================================================================
2595
============ Function 53, subfunction 5 - open TCP-socket. ===========
2606
============ Function 53, subfunction 5 - open TCP-socket. ===========
2596
======================================================================
2607
======================================================================
2597
Parameters:
2608
Parameters:
2598
  * eax = 53 - function number
2609
  * eax = 53 - function number
2599
  * ebx = 5 - subfunction number
2610
  * ebx = 5 - subfunction number
2600
  * ecx = local port (only low word is taken into account)
2611
  * ecx = local port (only low word is taken into account)
2601
  * edx = remote port (only low word is taken into account)
2612
  * edx = remote port (only low word is taken into account)
2602
  * esi = remote IP
2613
  * esi = remote IP
2603
  * edi = open mode: SOCKET_PASSIVE=0 or SOCKET_ACTIVE=1
2614
  * edi = open mode: SOCKET_PASSIVE=0 or SOCKET_ACTIVE=1
2604
Returned value:
2615
Returned value:
2605
  * eax = -1 = 0xFFFFFFFF - error; ebx destroys
2616
  * eax = -1 = 0xFFFFFFFF - error; ebx destroys
2606
  * eax = socket handle (some number which unambiguously identifies
2617
  * eax = socket handle (some number which unambiguously identifies
2607
    socket and have sense only for the system) - success;
2618
    socket and have sense only for the system) - success;
2608
    ebx destroyed
2619
    ebx destroyed
2609
 
2620
 
2610
======================================================================
2621
======================================================================
2611
========= Function 53, subfunction 6 - get TCP-socket status. ========
2622
========= Function 53, subfunction 6 - get TCP-socket status. ========
2612
======================================================================
2623
======================================================================
2613
Parameters:
2624
Parameters:
2614
  * eax = 53 - function number
2625
  * eax = 53 - function number
2615
  * ebx = 6 - subfunction number
2626
  * ebx = 6 - subfunction number
2616
  * ecx = socket handle
2627
  * ecx = socket handle
2617
Returned value:
2628
Returned value:
2618
  * eax = socket status: one of
2629
  * eax = socket status: one of
2619
  * TCB_LISTEN = 1
2630
  * TCB_LISTEN = 1
2620
  * TCB_SYN_SENT = 2
2631
  * TCB_SYN_SENT = 2
2621
  * TCB_SYN_RECEIVED = 3
2632
  * TCB_SYN_RECEIVED = 3
2622
  * TCB_ESTABLISHED = 4
2633
  * TCB_ESTABLISHED = 4
2623
  * TCB_FIN_WAIT_1 = 5
2634
  * TCB_FIN_WAIT_1 = 5
2624
  * TCB_FIN_WAIT_2 = 6
2635
  * TCB_FIN_WAIT_2 = 6
2625
  * TCB_CLOSE_WAIT = 7
2636
  * TCB_CLOSE_WAIT = 7
2626
  * TCB_CLOSING = 8
2637
  * TCB_CLOSING = 8
2627
  * TCB_LAST_ASK = 9
2638
  * TCB_LAST_ASK = 9
2628
  * TCB_TIME_WAIT = 10
2639
  * TCB_TIME_WAIT = 10
2629
  * TCB_CLOSED = 11
2640
  * TCB_CLOSED = 11
2630
  * ebx destroys
2641
  * ebx destroys
2631
Remarks:
2642
Remarks:
2632
  * There is no checks for correctness.
2643
  * There is no checks for correctness.
2633
 
2644
 
2634
======================================================================
2645
======================================================================
2635
========== Function 53, subfunction 7 - write to TCP-socket. =========
2646
========== Function 53, subfunction 7 - write to TCP-socket. =========
2636
======================================================================
2647
======================================================================
2637
Parameters:
2648
Parameters:
2638
  * eax = 53 - function number
2649
  * eax = 53 - function number
2639
  * ebx = 7 - subfunction number
2650
  * ebx = 7 - subfunction number
2640
  * ecx = socket handle
2651
  * ecx = socket handle
2641
  * edx = number of bytes to write
2652
  * edx = number of bytes to write
2642
  * esi = pointer to data to write
2653
  * esi = pointer to data to write
2643
Returned value:
2654
Returned value:
2644
  * eax = 0xffffffff - error
2655
  * eax = 0xffffffff - error
2645
  * eax = 0xffff - not enough memory
2656
  * eax = 0xffff - not enough memory
2646
  * eax = 0 - success
2657
  * eax = 0 - success
2647
  * ebx destroyed
2658
  * ebx destroyed
2648
Remarks:
2659
Remarks:
2649
  * Check on validity of handle is minimal - only not very incorrect
2660
  * Check on validity of handle is minimal - only not very incorrect
2650
    not opened handles are eliminated.
2661
    not opened handles are eliminated.
2651
  * Number of bytes to write must not exceed 1500-40, though
2662
  * Number of bytes to write must not exceed 1500-40, though
2652
    the appropriate check is not made.
2663
    the appropriate check is not made.
2653
 
2664
 
2654
======================================================================
2665
======================================================================
2655
=========== Function 53, subfunction 8 - close TCP-socket. ===========
2666
=========== Function 53, subfunction 8 - close TCP-socket. ===========
2656
======================================================================
2667
======================================================================
2657
Parameters:
2668
Parameters:
2658
  * eax = 53 - function number
2669
  * eax = 53 - function number
2659
  * ebx = 8 - subfunction number
2670
  * ebx = 8 - subfunction number
2660
  * ecx = socket handle
2671
  * ecx = socket handle
2661
Returned value:
2672
Returned value:
2662
  * eax = -1 - invalid handle
2673
  * eax = -1 - invalid handle
2663
  * eax = 0xffff - not enough memory for socket close packet
2674
  * eax = 0xffff - not enough memory for socket close packet
2664
  * eax = 0 - success
2675
  * eax = 0 - success
2665
  * in many cases eax is destroyed (the result of function 'queue'
2676
  * in many cases eax is destroyed (the result of function 'queue'
2666
    is returned) - probably this is bug, which will be corrected
2677
    is returned) - probably this is bug, which will be corrected
2667
  * ebx destroyed
2678
  * ebx destroyed
2668
Remarks:
2679
Remarks:
2669
  * The current implementation does not close automatically all
2680
  * The current implementation does not close automatically all
2670
    sockets of a thread at termination. In particular, one should not
2681
    sockets of a thread at termination. In particular, one should not
2671
    kill a thread with many opened sockets - there will be an outflow
2682
    kill a thread with many opened sockets - there will be an outflow
2672
    of resources.
2683
    of resources.
2673
  * The current implementation does no checks on correctness
2684
  * The current implementation does no checks on correctness
2674
    (function returns error only if thread tries to close not opened
2685
    (function returns error only if thread tries to close not opened
2675
    socket with correct handle).
2686
    socket with correct handle).
2676
 
2687
 
2677
======================================================================
2688
======================================================================
2678
=== Function 53, subfunction 9 - check whether local port is free. ===
2689
=== Function 53, subfunction 9 - check whether local port is free. ===
2679
======================================================================
2690
======================================================================
2680
Parameters:
2691
Parameters:
2681
  * eax = 53 - function number
2692
  * eax = 53 - function number
2682
  * ebx = 9 - subfunction number
2693
  * ebx = 9 - subfunction number
2683
  * ecx = local port number (low 16 bits are used only)
2694
  * ecx = local port number (low 16 bits are used only)
2684
Returned value:
2695
Returned value:
2685
  * eax = 0 - port is used
2696
  * eax = 0 - port is used
2686
  * eax = 1 - port is free
2697
  * eax = 1 - port is free
2687
  * ebx destroyed
2698
  * ebx destroyed
2688
 
2699
 
2689
======================================================================
2700
======================================================================
2690
= Function 53, subfunction 255 - debug information of network driver. 
2701
= Function 53, subfunction 255 - debug information of network driver. 
2691
======================================================================
2702
======================================================================
2692
Parameters:
2703
Parameters:
2693
  * eax = 53 - function number
2704
  * eax = 53 - function number
2694
  * ebx = 255 - subfunction number
2705
  * ebx = 255 - subfunction number
2695
  * ecx = type of requested information (see below)
2706
  * ecx = type of requested information (see below)
2696
Returned value:
2707
Returned value:
2697
  * eax = requested information
2708
  * eax = requested information
2698
  * ebx destroyed
2709
  * ebx destroyed
2699
Possible values for ecx:
2710
Possible values for ecx:
2700
  * 100: length of queue 0 (empty queue)
2711
  * 100: length of queue 0 (empty queue)
2701
  * 101: length of queue 1 (ip-out queue)
2712
  * 101: length of queue 1 (ip-out queue)
2702
  * 102: length of queue 2 (ip-in queue)
2713
  * 102: length of queue 2 (ip-in queue)
2703
  * 103: length of queue 3 (net1out queue)
2714
  * 103: length of queue 3 (net1out queue)
2704
  * 200: number of items in the ARP table
2715
  * 200: number of items in the ARP table
2705
  * 201: size of the ARP table (in items) (20 for current version)
2716
  * 201: size of the ARP table (in items) (20 for current version)
2706
  * 202: read item at edx of the ARP table to the temporary buffer,
2717
  * 202: read item at edx of the ARP table to the temporary buffer,
2707
    whence 5 following types take information;
2718
    whence 5 following types take information;
2708
    in this case eax is not defined
2719
    in this case eax is not defined
2709
  * 203: IP-address saved by type 202
2720
  * 203: IP-address saved by type 202
2710
  * 204: high dword of MAC-address saved by type 202
2721
  * 204: high dword of MAC-address saved by type 202
2711
  * 205: low word of MAC-address saved by type 202
2722
  * 205: low word of MAC-address saved by type 202
2712
  * 206: status word saved by type 202
2723
  * 206: status word saved by type 202
2713
  * 207: ttl word saved by type 202
2724
  * 207: ttl word saved by type 202
2714
  * 2: total number of received IP-packets
2725
  * 2: total number of received IP-packets
2715
  * 3: total number of transferred IP-packets
2726
  * 3: total number of transferred IP-packets
2716
  * 4: total number of dumped received packets
2727
  * 4: total number of dumped received packets
2717
  * 5: total number of received ARP-packets
2728
  * 5: total number of received ARP-packets
2718
  * 6: status of packet driver, 0=inactive, nonzero=active
2729
  * 6: status of packet driver, 0=inactive, nonzero=active
2719
 
2730
 
2720
======================================================================
2731
======================================================================
2721
========== Function 55, subfunction 0 - load data for SB16. ==========
2732
========== Function 55, subfunction 0 - load data for SB16. ==========
2722
======================================================================
2733
======================================================================
2723
Parameters:
2734
Parameters:
2724
  * eax = 55 - function number
2735
  * eax = 55 - function number
2725
  * ebx = 0 - subfunction number
2736
  * ebx = 0 - subfunction number
2726
  * ecx = pointer to data (is copied 64 kilobytes, is used as much as
2737
  * ecx = pointer to data (is copied 64 kilobytes, is used as much as
2727
    set by subfunction 2)
2738
    set by subfunction 2)
2728
Returned value:
2739
Returned value:
2729
  * function does not return value
2740
  * function does not return value
2730
Remarks:
2741
Remarks:
2731
  * Format and size of data are set by subfunction 2.
2742
  * Format and size of data are set by subfunction 2.
2732
 
2743
 
2733
======================================================================
2744
======================================================================
2734
======== Function 55, subfunction 1 - begin play data on SB16. =======
2745
======== Function 55, subfunction 1 - begin play data on SB16. =======
2735
======================================================================
2746
======================================================================
2736
Parameters:
2747
Parameters:
2737
  * eax = 55 - function number
2748
  * eax = 55 - function number
2738
  * ebx = 1 - subfunction number
2749
  * ebx = 1 - subfunction number
2739
Returned value:
2750
Returned value:
2740
  * function does not return value
2751
  * function does not return value
2741
Remarks:
2752
Remarks:
2742
  * Previously data must be loaded by subfunction 0 and
2753
  * Previously data must be loaded by subfunction 0 and
2743
    their format must be defined by subfunction 2.
2754
    their format must be defined by subfunction 2.
2744
  * Function returns control, when playing of data began; after that
2755
  * Function returns control, when playing of data began; after that
2745
    play goes independently from application (and does not use
2756
    play goes independently from application (and does not use
2746
    processor time at all).
2757
    processor time at all).
2747
  * Previously must be defined SB16 base port
2758
  * Previously must be defined SB16 base port
2748
    (by subfunction 4 of function 21) and DMA channel
2759
    (by subfunction 4 of function 21) and DMA channel
2749
    (by subfunction 10 of function 21).
2760
    (by subfunction 10 of function 21).
2750
 
2761
 
2751
======================================================================
2762
======================================================================
2752
======== Function 55, subfunction 2 - set format of SB16 data. =======
2763
======== Function 55, subfunction 2 - set format of SB16 data. =======
2753
======================================================================
2764
======================================================================
2754
Parameters:
2765
Parameters:
2755
  * eax = 55 - function number
2766
  * eax = 55 - function number
2756
  * ebx = 2 - subfunction number
2767
  * ebx = 2 - subfunction number
2757
  * ecx = 0 - set digit capacity
2768
  * ecx = 0 - set digit capacity
2758
    * edx = 1 - 8bit mono
2769
    * edx = 1 - 8bit mono
2759
    * edx = 2 - 8bit stereo
2770
    * edx = 2 - 8bit stereo
2760
  * ecx = 1 - set data size
2771
  * ecx = 1 - set data size
2761
    * edx = size in bytes
2772
    * edx = size in bytes
2762
  * ecx = 2 - set play frequency
2773
  * ecx = 2 - set play frequency
2763
    * edx = frequency
2774
    * edx = frequency
2764
Returned value:
2775
Returned value:
2765
  * function does not return value
2776
  * function does not return value
2766
Remarks:
2777
Remarks:
2767
  * When the system boots, it sets following default parameters:
2778
  * When the system boots, it sets following default parameters:
2768
    digit capacity - 8bit mono, size - 64 Kb, frequency - 44100 Hz.
2779
    digit capacity - 8bit mono, size - 64 Kb, frequency - 44100 Hz.
2769
    Nevertheless it is recommended to set necessary values obviously
2780
    Nevertheless it is recommended to set necessary values obviously
2770
    as they could be reset by some application.
2781
    as they could be reset by some application.
2771
 
2782
 
2772
======================================================================
2783
======================================================================
2773
 Function 55, subfunction 55 - begin to play data on built-in speaker. 
2784
 Function 55, subfunction 55 - begin to play data on built-in speaker. 
2774
======================================================================
2785
======================================================================
2775
Parameters:
2786
Parameters:
2776
  * eax = 55 - function number
2787
  * eax = 55 - function number
2777
  * ebx = 55 - subfunction number
2788
  * ebx = 55 - subfunction number
2778
  * esi = pointer to data
2789
  * esi = pointer to data
2779
Returned value:
2790
Returned value:
2780
  * eax = 0 - success
2791
  * eax = 0 - success
2781
  * eax = 55 - error (speaker is off or busy)
2792
  * eax = 55 - error (speaker is off or busy)
2782
Data is an array of items with variable length.
2793
Data is an array of items with variable length.
2783
Format of each item is defined by first byte:
2794
Format of each item is defined by first byte:
2784
  * 0 = end of data
2795
  * 0 = end of data
2785
  * 1..0x80 = sets sound duration on 1/100 of second; sound note
2796
  * 1..0x80 = sets sound duration on 1/100 of second; sound note
2786
    is defined by immediate value of frequency
2797
    is defined by immediate value of frequency
2787
    * following word (2 bytes) contains frequency divider;
2798
    * following word (2 bytes) contains frequency divider;
2788
      frequency is defined as 1193180/divider
2799
      frequency is defined as 1193180/divider
2789
  * 0x81 = invalid
2800
  * 0x81 = invalid
2790
  * 0x82..0xFF = note is defined by octave and number:
2801
  * 0x82..0xFF = note is defined by octave and number:
2791
    * duration in 1/100 of second = (first byte)-0x81
2802
    * duration in 1/100 of second = (first byte)-0x81
2792
    * there is one more byte;
2803
    * there is one more byte;
2793
    * (second byte)=0xFF - delay
2804
    * (second byte)=0xFF - delay
2794
    * otherwise it looks like a*0x10+b, where b=number of the note in
2805
    * otherwise it looks like a*0x10+b, where b=number of the note in
2795
      an octave from 1 to 12, a=number of octave (beginning from 0)
2806
      an octave from 1 to 12, a=number of octave (beginning from 0)
2796
Remarks:
2807
Remarks:
2797
  * Speaker play can be disabled/enabled by
2808
  * Speaker play can be disabled/enabled by
2798
    subfunction 8 of function 18.
2809
    subfunction 8 of function 18.
2799
  * Function returns control, having informed the system
2810
  * Function returns control, having informed the system
2800
    an information on request. Play itself goes independently from
2811
    an information on request. Play itself goes independently from
2801
    the program.
2812
    the program.
2802
  * The data must be kept in the memory at least up to the end
2813
  * The data must be kept in the memory at least up to the end
2803
    of play.
2814
    of play.
2804
 
2815
 
2805
======================================================================
2816
======================================================================
2806
=============== Function 56 - write file to hard disk. ===============
2817
=============== Function 56 - write file to hard disk. ===============
2807
======================================================================
2818
======================================================================
2808
Parameters:
2819
Parameters:
2809
  * eax = 56 - function number
2820
  * eax = 56 - function number
2810
  * ebx = pointer to the file name
2821
  * ebx = pointer to the file name
2811
  * ecx = size of data to write (in bytes)
2822
  * ecx = size of data to write (in bytes)
2812
  * edx = pointer to data to write
2823
  * edx = pointer to data to write
2813
  * esi = pointer to path (ASCIIZ-string)
2824
  * esi = pointer to path (ASCIIZ-string)
2814
Returned value:
2825
Returned value:
2815
  * eax = 0 - success, otherwise file system error code
2826
  * eax = 0 - success, otherwise file system error code
2816
Remarks:
2827
Remarks:
2817
  * This function is obsolete; function 70 allows to fulfil the same
2828
  * This function is obsolete; function 70 allows to fulfil the same
2818
    operations with the extended possibilities.
2829
    operations with the extended possibilities.
2819
  * This function assumes that during its call by one application
2830
  * This function assumes that during its call by one application
2820
    no other application works with hard disk.
2831
    no other application works with hard disk.
2821
  * The path to file is ASCIIZ-string, which may be empty
2832
  * The path to file is ASCIIZ-string, which may be empty
2822
    (if the file is created in the root folder) or have the format
2833
    (if the file is created in the root folder) or have the format
2823
    /d1/d2/.../dn, where all folder names must have the 8+3 format,
2834
    /d1/d2/.../dn, where all folder names must have the 8+3 format,
2824
    i.e. 8 characters of name and 3 characters of the extension
2835
    i.e. 8 characters of name and 3 characters of the extension
2825
    without separator, supplemented by blanks if necessary;
2836
    without separator, supplemented by blanks if necessary;
2826
    all letters must be capital.
2837
    all letters must be capital.
2827
  * The file name must also have the format 8+3.
2838
  * The file name must also have the format 8+3.
2828
 
2839
 
2829
======================================================================
2840
======================================================================
2830
================ Function 58 - work with file system. ================
2841
================ Function 58 - work with file system. ================
2831
======================================================================
2842
======================================================================
2832
Parameters:
2843
Parameters:
2833
  * eax = 58
2844
  * eax = 58
2834
  * ebx = pointer to the information structure
2845
  * ebx = pointer to the information structure
2835
Returned value:
2846
Returned value:
2836
  * eax = 0 - success; otherwise file system error code
2847
  * eax = 0 - success; otherwise file system error code
2837
  * some subfunctions return value in other registers too
2848
  * some subfunctions return value in other registers too
2838
General format of the information structure:
2849
General format of the information structure:
2839
  * +0: dword: subfunction number
2850
  * +0: dword: subfunction number
2840
  * +4: dword: number of block
2851
  * +4: dword: number of block
2841
  * +8: dword: size
2852
  * +8: dword: size
2842
  * +12 = +0xC: dword: pointer to data
2853
  * +12 = +0xC: dword: pointer to data
2843
  * +16 = +0x10: dword: pointer to a memory for system operations
2854
  * +16 = +0x10: dword: pointer to a memory for system operations
2844
    (4096 bytes)
2855
    (4096 bytes)
2845
  * +20 = +0x14: n db: ASCIIZ-string with the file name
2856
  * +20 = +0x14: n db: ASCIIZ-string with the file name
2846
Specifications - in documentation on the appropriate subfunction.
2857
Specifications - in documentation on the appropriate subfunction.
2847
Filename is case-insensitive for latin letters, russian letters
2858
Filename is case-insensitive for latin letters, russian letters
2848
must be capital.
2859
must be capital.
2849
Format of filename:
2860
Format of filename:
2850
/base/number/dir1/dir2/.../dirn/file,
2861
/base/number/dir1/dir2/.../dirn/file,
2851
where /base/number identifies device, on which file is located:
2862
where /base/number identifies device, on which file is located:
2852
one of
2863
one of
2853
  * /RD/1 = /RAMDISK/1 to access ramdisk
2864
  * /RD/1 = /RAMDISK/1 to access ramdisk
2854
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
2865
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
2855
    /FD/2 = /FLOPPYDISK/2 to access second one
2866
    /FD/2 = /FLOPPYDISK/2 to access second one
2856
  * /HD/x = /HARDDISK/x - obsolete variant of access to hard disk
2867
  * /HD/x = /HARDDISK/x - obsolete variant of access to hard disk
2857
    (in this case base is defined by subfunction 7 of function 21),
2868
    (in this case base is defined by subfunction 7 of function 21),
2858
    x - partition number (beginning from 1)
2869
    x - partition number (beginning from 1)
2859
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
2870
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
2860
    IDE0 (Primary Master), IDE1 (Primary Slave),
2871
    IDE0 (Primary Master), IDE1 (Primary Slave),
2861
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
2872
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
2862
    x - partition number on the selected hard drive, varies from 1
2873
    x - partition number on the selected hard drive, varies from 1
2863
    to 255 (on each hard drive the indexing starts from 1)
2874
    to 255 (on each hard drive the indexing starts from 1)
2864
Remarks:
2875
Remarks:
2865
  * In the first two cases it is also possible to use FIRST
2876
  * In the first two cases it is also possible to use FIRST
2866
    instead of 1, SECOND instead of 2, but it is not recommended
2877
    instead of 1, SECOND instead of 2, but it is not recommended
2867
    for convenience of transition to the future extensions.
2878
    for convenience of transition to the future extensions.
2868
  * Limitation n<=39 is imposed.
2879
  * Limitation n<=39 is imposed.
2869
  * Names of folders and file dir1,...,dirn,file must have the
2880
  * Names of folders and file dir1,...,dirn,file must have the
2870
    format 8.3: name no more than 8 characters, dot, extension no
2881
    format 8.3: name no more than 8 characters, dot, extension no
2871
    more than 3 characters. Trailing spaces are ignored, no other
2882
    more than 3 characters. Trailing spaces are ignored, no other
2872
    spaces is allowed. If name occupies equally 8 characters,
2883
    spaces is allowed. If name occupies equally 8 characters,
2873
    dot may be omitted (though it is not recommended to use this
2884
    dot may be omitted (though it is not recommended to use this
2874
    feature for convenience of transition to the future extensions).
2885
    feature for convenience of transition to the future extensions).
2875
  * This function does not support folders on ramdisk.
2886
  * This function does not support folders on ramdisk.
2876
Examples:
2887
Examples:
2877
  * '/RAMDISK/FIRST/KERNEL.ASM',0
2888
  * '/RAMDISK/FIRST/KERNEL.ASM',0
2878
    '/rd/1/kernel.asm',0
2889
    '/rd/1/kernel.asm',0
2879
  * '/HD0/1/kernel.asm',0
2890
  * '/HD0/1/kernel.asm',0
2880
  * '/hd0/1/menuet/pics/tanzania.bmp',0
2891
  * '/hd0/1/menuet/pics/tanzania.bmp',0
2881
Existing subfunctions:
2892
Existing subfunctions:
2882
  * subfunction 0 - read file/folder
2893
  * subfunction 0 - read file/folder
2883
  * subfunction 1 - rewrite file
2894
  * subfunction 1 - rewrite file
2884
  * subfunction 2 - delete file/folder
2895
  * subfunction 2 - delete file/folder
2885
  * subfunction 4 - make folder
2896
  * subfunction 4 - make folder
2886
  * subfunction 5 - rename/move file/folder
2897
  * subfunction 5 - rename/move file/folder
2887
  * subfunction 8 - LBA-read from device
2898
  * subfunction 8 - LBA-read from device
2888
  * subfunction 15 - get file system information
2899
  * subfunction 15 - get file system information
2889
  * subfunction 16 - start application
2900
  * subfunction 16 - start application
2890
 
2901
 
2891
======================================================================
2902
======================================================================
2892
=========== Function 58, subfunction 0 - read file/folder. ===========
2903
=========== Function 58, subfunction 0 - read file/folder. ===========
2893
======================================================================
2904
======================================================================
2894
Parameters:
2905
Parameters:
2895
  * eax = 58
2906
  * eax = 58
2896
  * ebx = pointer to the information structure
2907
  * ebx = pointer to the information structure
2897
Format of the information structure:
2908
Format of the information structure:
2898
  * +0: dword: 0 = subfunction number
2909
  * +0: dword: 0 = subfunction number
2899
  * +4: dword: first block to read (beginning from 0)
2910
  * +4: dword: first block to read (beginning from 0)
2900
  * +8: dword: amount of blocks to read
2911
  * +8: dword: amount of blocks to read
2901
  * +12 = +0xC: dword: pointer to buffer for data
2912
  * +12 = +0xC: dword: pointer to buffer for data
2902
  * +16 = +0x10: dword: pointer to buffer for system operations
2913
  * +16 = +0x10: dword: pointer to buffer for system operations
2903
    (4096 bytes)
2914
    (4096 bytes)
2904
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2915
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2905
    given in the general description
2916
    given in the general description
2906
Returned value:
2917
Returned value:
2907
  * eax = 0 - success, otherwise file system error code
2918
  * eax = 0 - success, otherwise file system error code
2908
  * ebx = file size (in bytes) or -1=0xffffffff, if file was not found
2919
  * ebx = file size (in bytes) or -1=0xffffffff, if file was not found
2909
Remarks:
2920
Remarks:
2910
  * Block size is 512 bytes.
2921
  * Block size is 512 bytes.
2911
  * This function is obsolete, for reading files use subfunction 0
2922
  * This function is obsolete, for reading files use subfunction 0
2912
    of function 70, for reading folders - subfunction 1 of
2923
    of function 70, for reading folders - subfunction 1 of
2913
    function 70.
2924
    function 70.
2914
  * Function can read contents of a folder. Only FAT file system is
2925
  * Function can read contents of a folder. Only FAT file system is
2915
    supported. The format of FAT-folder is described
2926
    supported. The format of FAT-folder is described
2916
    in any FAT documentation.
2927
    in any FAT documentation.
2917
  * Size of a folder is determined by size of FAT clusters chain.
2928
  * Size of a folder is determined by size of FAT clusters chain.
2918
  * If file was ended before last requested block was read,
2929
  * If file was ended before last requested block was read,
2919
    the function will read as many as it can, and after that return
2930
    the function will read as many as it can, and after that return
2920
    eax=6 (EOF).
2931
    eax=6 (EOF).
2921
  * Function can read root folders /rd/1,/fd/x,/hd[n]/x, but
2932
  * Function can read root folders /rd/1,/fd/x,/hd[n]/x, but
2922
    in the first two cases the current implementation does not follow
2933
    in the first two cases the current implementation does not follow
2923
    to the declared rules:
2934
    to the declared rules:
2924
    for /rd/1:
2935
    for /rd/1:
2925
    * if one want to read 0 blocks, function considers,
2936
    * if one want to read 0 blocks, function considers,
2926
      that he requested 1;
2937
      that he requested 1;
2927
    * if one requests more than 14 blocks or starting block is
2938
    * if one requests more than 14 blocks or starting block is
2928
      not less than 14, function returns eax=5 (not found) è ebx=-1;
2939
      not less than 14, function returns eax=5 (not found) è ebx=-1;
2929
    * size of ramdisk root folder is 14 blocks, 
2940
    * size of ramdisk root folder is 14 blocks, 
2930
      0x1C00=7168 áàéò; but function returns ebx=0
2941
      0x1C00=7168 áàéò; but function returns ebx=0
2931
      (except of the case of previous item);
2942
      (except of the case of previous item);
2932
    * strangely enough, it is possible to read 14th block (which
2943
    * strangely enough, it is possible to read 14th block (which
2933
      generally contains a garbage - I remind, the indexing begins
2944
      generally contains a garbage - I remind, the indexing begins
2934
      from 0);
2945
      from 0);
2935
    * if some block with the number not less than 14 was requested,
2946
    * if some block with the number not less than 14 was requested,
2936
      function returns eax=6(EOF); otherwise eax=0.
2947
      function returns eax=6(EOF); otherwise eax=0.
2937
    For /fd/x:
2948
    For /fd/x:
2938
    * if the start block is not less than 14, function returns
2949
    * if the start block is not less than 14, function returns
2939
      eax=5 (not found) and ebx=0;
2950
      eax=5 (not found) and ebx=0;
2940
    * note that format of FAT12 allows floppies with the root size
2951
    * note that format of FAT12 allows floppies with the root size
2941
      more or less than 14 blocks;
2952
      more or less than 14 blocks;
2942
    * check for length is not performed;
2953
    * check for length is not performed;
2943
    * if data was successful read, function returns
2954
    * if data was successful read, function returns
2944
      eax=0,ebx=0; otherwise eax=10 (access denied), ebx=-1.
2955
      eax=0,ebx=0; otherwise eax=10 (access denied), ebx=-1.
2945
  * The function handles reading of special folders /,/rd,/fd,/hd[n];
2956
  * The function handles reading of special folders /,/rd,/fd,/hd[n];
2946
    but the result does not correspond to expected (on operations with
2957
    but the result does not correspond to expected (on operations with
2947
    normal files/folders), does not follow the declared rules,
2958
    normal files/folders), does not follow the declared rules,
2948
    may be changed in future versions of the kernel and consequently
2959
    may be changed in future versions of the kernel and consequently
2949
    is not described. To obtain the information about the equipment
2960
    is not described. To obtain the information about the equipment
2950
    use subfunction 11 of function 18 or
2961
    use subfunction 11 of function 18 or
2951
    read corresponding folder with subfunction 1 of function 70.
2962
    read corresponding folder with subfunction 1 of function 70.
2952
 
2963
 
2953
======================================================================
2964
======================================================================
2954
============= Function 58, subfunction 1 - rewrite file. =============
2965
============= Function 58, subfunction 1 - rewrite file. =============
2955
======================================================================
2966
======================================================================
2956
If the file does not exist, it is created.
2967
If the file does not exist, it is created.
2957
If the file exists, it is rewritten.
2968
If the file exists, it is rewritten.
2958
Parameters:
2969
Parameters:
2959
  * eax = 58 - function number
2970
  * eax = 58 - function number
2960
  * ebx = pointer to the information structure
2971
  * ebx = pointer to the information structure
2961
Format of the information structure:
2972
Format of the information structure:
2962
  * +0: dword: 1 = subfunction number
2973
  * +0: dword: 1 = subfunction number
2963
  * +4: dword: ignored (set to 0)
2974
  * +4: dword: ignored (set to 0)
2964
  * +8: dword: number of bytes to write
2975
  * +8: dword: number of bytes to write
2965
  * +12 = +0xC: dword: pointer to data to write
2976
  * +12 = +0xC: dword: pointer to data to write
2966
  * +16 = +0x10: dword: pointer to buffer for system operations
2977
  * +16 = +0x10: dword: pointer to buffer for system operations
2967
    (4096 bytes)
2978
    (4096 bytes)
2968
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2979
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2969
    given in the general description
2980
    given in the general description
2970
Returned value:
2981
Returned value:
2971
  * eax = 0 - success, otherwise file system error code
2982
  * eax = 0 - success, otherwise file system error code
2972
  * ebx destroyed
2983
  * ebx destroyed
2973
Remarks:
2984
Remarks:
2974
  * This function is obsolete, use subfunction 2 of function 70.
2985
  * This function is obsolete, use subfunction 2 of function 70.
2975
 
2986
 
2976
======================================================================
2987
======================================================================
2977
========== Function 58, subfunction 2 - delete file/folder. ==========
2988
========== Function 58, subfunction 2 - delete file/folder. ==========
2978
======================================================================
2989
======================================================================
2979
Parameters:
2990
Parameters:
2980
  * eax = 58 - function number
2991
  * eax = 58 - function number
2981
  * ebx = pointer to the information structure
2992
  * ebx = pointer to the information structure
2982
Format of the information structure:
2993
Format of the information structure:
2983
  * +0: dword: 2 = subfunction number
2994
  * +0: dword: 2 = subfunction number
2984
  * +4: dword: ignored
2995
  * +4: dword: ignored
2985
  * +8: dword: ignored
2996
  * +8: dword: ignored
2986
  * +12 = +0xC: dword: ignored
2997
  * +12 = +0xC: dword: ignored
2987
  * +16 = +0x10: dword: pointer to buffer for system operations
2998
  * +16 = +0x10: dword: pointer to buffer for system operations
2988
    (4096 bytes)
2999
    (4096 bytes)
2989
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
3000
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2990
    given in the general description
3001
    given in the general description
2991
Returned value:
3002
Returned value:
2992
  * eax = 0 - success, otherwise file system error code
3003
  * eax = 0 - success, otherwise file system error code
2993
  * ebx destroyed
3004
  * ebx destroyed
2994
Remarks:
3005
Remarks:
2995
  * By operations with a floppy one should not delete not empty
3006
  * By operations with a floppy one should not delete not empty
2996
    folder. The code working with hard disk deletes not empty folders
3007
    folder. The code working with hard disk deletes not empty folders
2997
    correctly (i.e. recursively with all files and nested folders).
3008
    correctly (i.e. recursively with all files and nested folders).
2998
    Function 58 does not support folders on ramdisk.
3009
    Function 58 does not support folders on ramdisk.
2999
 
3010
 
3000
======================================================================
3011
======================================================================
3001
============== Function 58, subfunction 4 - make folder. =============
3012
============== Function 58, subfunction 4 - make folder. =============
3002
======================================================================
3013
======================================================================
3003
Parameters:
3014
Parameters:
3004
  * eax = 58 - function number
3015
  * eax = 58 - function number
3005
  * ebx = pointer to the information structure
3016
  * ebx = pointer to the information structure
3006
Format of the information structure:
3017
Format of the information structure:
3007
  * +0: dword: 4 = subfunction number
3018
  * +0: dword: 4 = subfunction number
3008
  * +4: dword: ignored
3019
  * +4: dword: ignored
3009
  * +8: dword: ignored
3020
  * +8: dword: ignored
3010
  * +12 = +0xC: dword: ignored
3021
  * +12 = +0xC: dword: ignored
3011
  * +16 = +0x10: dword: pointer to buffer for system operations
3022
  * +16 = +0x10: dword: pointer to buffer for system operations
3012
    (4096 bytes)
3023
    (4096 bytes)
3013
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
3024
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
3014
    given in the general description
3025
    given in the general description
3015
Returned value:
3026
Returned value:
3016
  * eax = 0 - success, otherwise file system error code
3027
  * eax = 0 - success, otherwise file system error code
3017
  * ebx destroyed
3028
  * ebx destroyed
3018
Remarks:
3029
Remarks:
3019
  * Ramdisk and floppies do not support this function, it is only
3030
  * Ramdisk and floppies do not support this function, it is only
3020
    for hard disks.
3031
    for hard disks.
3021
 
3032
 
3022
======================================================================
3033
======================================================================
3023
======== Function 58, subfunction 5 - rename/move file/folder. =======
3034
======== Function 58, subfunction 5 - rename/move file/folder. =======
3024
======================================================================
3035
======================================================================
3025
Parameters:
3036
Parameters:
3026
  * eax = 58 - function number
3037
  * eax = 58 - function number
3027
  * ebx = pointer to the information structure
3038
  * ebx = pointer to the information structure
3028
Format of the information structure:
3039
Format of the information structure:
3029
  * +0: dword: 5 = subfunction number
3040
  * +0: dword: 5 = subfunction number
3030
  * +4: dword: ignored
3041
  * +4: dword: ignored
3031
  * +8: dword: ignored
3042
  * +8: dword: ignored
3032
  * +12 = +0xC: dword: ignored
3043
  * +12 = +0xC: dword: ignored
3033
  * +16 = +0x10: dword: pointer to buffer for system operations
3044
  * +16 = +0x10: dword: pointer to buffer for system operations
3034
    (4096 bytes)
3045
    (4096 bytes)
3035
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
3046
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
3036
    given in the general description
3047
    given in the general description
3037
  * +20+n: (at once after terminating null character) new
3048
  * +20+n: (at once after terminating null character) new
3038
    ASCIIZ-name, must start from /hd/1, that is interpreted as
3049
    ASCIIZ-name, must start from /hd/1, that is interpreted as
3039
    the hard disk, indicated in the first name
3050
    the hard disk, indicated in the first name
3040
    (moving from one disk to another is not supported)
3051
    (moving from one disk to another is not supported)
3041
Returned value:
3052
Returned value:
3042
  * eax = 0 - success, otherwise file system error code
3053
  * eax = 0 - success, otherwise file system error code
3043
  * ebx destroyed
3054
  * ebx destroyed
3044
Remarks:
3055
Remarks:
3045
  * Ramdisk and floppies do not support this function, it is only
3056
  * Ramdisk and floppies do not support this function, it is only
3046
    for hard disks.
3057
    for hard disks.
3047
  * If the new ASCIIZ-name is strongly incorrect, i.e. does not start
3058
  * If the new ASCIIZ-name is strongly incorrect, i.e. does not start
3048
    from /hd/1, /hd/first, /harddisk/1, /harddisk/first or after this
3059
    from /hd/1, /hd/first, /harddisk/1, /harddisk/first or after this
3049
    space or null character follows, function returns, strangely
3060
    space or null character follows, function returns, strangely
3050
    enough, error code 4. It is the only function which returns
3061
    enough, error code 4. It is the only function which returns
3051
    this code.
3062
    this code.
3052
 
3063
 
3053
======================================================================
3064
======================================================================
3054
========= Function 58, subfunction 8 - LBA-read from device. =========
3065
========= Function 58, subfunction 8 - LBA-read from device. =========
3055
======================================================================
3066
======================================================================
3056
Parameters:
3067
Parameters:
3057
  * eax = 58 - function number
3068
  * eax = 58 - function number
3058
  * ebx = pointer to the information structure
3069
  * ebx = pointer to the information structure
3059
Format of the information structure:
3070
Format of the information structure:
3060
  * +0: dword: 8 = subfunction number
3071
  * +0: dword: 8 = subfunction number
3061
  * +4: dword: number of block to read (beginning from 0)
3072
  * +4: dword: number of block to read (beginning from 0)
3062
  * +8: dword: ignored (set to 1)
3073
  * +8: dword: ignored (set to 1)
3063
  * +12 = +0xC: dword: pointer to buffer for data (512 bytes)
3074
  * +12 = +0xC: dword: pointer to buffer for data (512 bytes)
3064
  * +16 = +0x10: dword: pointer to buffer for system operations
3075
  * +16 = +0x10: dword: pointer to buffer for system operations
3065
    (4096 bytes)
3076
    (4096 bytes)
3066
  * +20 = +0x14: ASCIIZ-name of device: case-insensitive, one of
3077
  * +20 = +0x14: ASCIIZ-name of device: case-insensitive, one of
3067
    /rd/1 = /RamDisk/1, /hd/n = /HardDisk/n,
3078
    /rd/1 = /RamDisk/1, /hd/n = /HardDisk/n,
3068
    1<=n<=4 - number of device: 1=IDE0, ..., 4=IDE3.
3079
    1<=n<=4 - number of device: 1=IDE0, ..., 4=IDE3.
3069
    Instead of digits it is allowed, though not recommended for
3080
    Instead of digits it is allowed, though not recommended for
3070
    convenience of transition to future extensions, to use
3081
    convenience of transition to future extensions, to use
3071
    'first','second','third','fourth'.
3082
    'first','second','third','fourth'.
3072
Returned value:
3083
Returned value:
3073
  * for device name /hd/xxx, where xxx is not in the list above:
3084
  * for device name /hd/xxx, where xxx is not in the list above:
3074
    * eax = ebx = 1
3085
    * eax = ebx = 1
3075
  * for invalid device name (except for the previous case):
3086
  * for invalid device name (except for the previous case):
3076
    * eax = 5
3087
    * eax = 5
3077
    * ebx does not change
3088
    * ebx does not change
3078
  * if LBA-access is disabled by subfunction 11 of function 21:
3089
  * if LBA-access is disabled by subfunction 11 of function 21:
3079
    * eax = 2
3090
    * eax = 2
3080
    * ebx destroyed
3091
    * ebx destroyed
3081
  * for ramdisk: attempt to read block outside ramdisk
3092
  * for ramdisk: attempt to read block outside ramdisk
3082
    (18*2*80 blocks) results in
3093
    (18*2*80 blocks) results in
3083
    * eax = 3
3094
    * eax = 3
3084
    * ebx = 0
3095
    * ebx = 0
3085
  * for successful read:
3096
  * for successful read:
3086
    * eax = ebx = 0
3097
    * eax = ebx = 0
3087
Remarks:
3098
Remarks:
3088
  * Block size is 512 bytes; function reads one block.
3099
  * Block size is 512 bytes; function reads one block.
3089
  * Do not depend on returned value, it can be changed
3100
  * Do not depend on returned value, it can be changed
3090
    in future versions.
3101
    in future versions.
3091
  * Function requires that LBA-access to devices is enabled by 
3102
  * Function requires that LBA-access to devices is enabled by 
3092
    subfunction 11 of function 21. To check this one can use 
3103
    subfunction 11 of function 21. To check this one can use 
3093
    subfunction 11 of function 26.
3104
    subfunction 11 of function 26.
3094
  * LBA-read of floppy is not supported.
3105
  * LBA-read of floppy is not supported.
3095
  * Function reads data on physical hard drive; if for any reason
3106
  * Function reads data on physical hard drive; if for any reason
3096
    data of the concrete partition are required, application must
3107
    data of the concrete partition are required, application must
3097
    define starting sector of this partition (either directly
3108
    define starting sector of this partition (either directly
3098
    through MBR, or from the full structure returned by
3109
    through MBR, or from the full structure returned by
3099
    ïîäôóíêöèåé 11 ôóíêöèè 18).
3110
    ïîäôóíêöèåé 11 ôóíêöèè 18).
3100
  * Function does not check error code of hard disk, so request of
3111
  * Function does not check error code of hard disk, so request of
3101
    nonexisting sector reads something (most probably it will be
3112
    nonexisting sector reads something (most probably it will be
3102
    zeroes, but this is defined by device) and this is considered
3113
    zeroes, but this is defined by device) and this is considered
3103
    as success (eax=0).
3114
    as success (eax=0).
3104
 
3115
 
3105
======================================================================
3116
======================================================================
3106
==== Function 58, subfunction 15 - get information on file system. ===
3117
==== Function 58, subfunction 15 - get information on file system. ===
3107
======================================================================
3118
======================================================================
3108
Parameters:
3119
Parameters:
3109
  * eax = 58 - function number
3120
  * eax = 58 - function number
3110
  * ebx = pointer to the information structure
3121
  * ebx = pointer to the information structure
3111
Format of the information structure:
3122
Format of the information structure:
3112
  * +0: dword: 15 = subfunction number
3123
  * +0: dword: 15 = subfunction number
3113
  * +4: dword: ignored
3124
  * +4: dword: ignored
3114
  * +8: dword: ignored
3125
  * +8: dword: ignored
3115
  * +12 = +0xC: dword: ignored
3126
  * +12 = +0xC: dword: ignored
3116
  * +16 = +0x10: dword: ignored
3127
  * +16 = +0x10: dword: ignored
3117
  * +20 = +0x14: (only second character is checked)
3128
  * +20 = +0x14: (only second character is checked)
3118
    /rd=/RAMDISK or /hd=/HARDDISK
3129
    /rd=/RAMDISK or /hd=/HARDDISK
3119
Returned value:
3130
Returned value:
3120
  * if the second character does not belong to set {'r','R','h','H'}:
3131
  * if the second character does not belong to set {'r','R','h','H'}:
3121
    * eax = 3
3132
    * eax = 3
3122
    * ebx = ecx = dword [fileinfo] = 0
3133
    * ebx = ecx = dword [fileinfo] = 0
3123
  * for ramdisk:
3134
  * for ramdisk:
3124
    * eax = 0 (success)
3135
    * eax = 0 (success)
3125
    * ebx = total number of clusters = 2847
3136
    * ebx = total number of clusters = 2847
3126
    * ecx = number of free clusters
3137
    * ecx = number of free clusters
3127
    * dword [fileinfo] = cluster size = 512
3138
    * dword [fileinfo] = cluster size = 512
3128
  * for hard disk: base and partition are defined by subfunctions
3139
  * for hard disk: base and partition are defined by subfunctions
3129
    7 and 8 of function 21:
3140
    7 and 8 of function 21:
3130
    * eax = 0 (success)
3141
    * eax = 0 (success)
3131
    * ebx = total number of clusters
3142
    * ebx = total number of clusters
3132
    * ecx = number of free clusters
3143
    * ecx = number of free clusters
3133
    * dword [fileinfo] = cluster size (in bytes)
3144
    * dword [fileinfo] = cluster size (in bytes)
3134
Remarks:
3145
Remarks:
3135
  * Be not surprised to strange layout of 4th returned parameter
3146
  * Be not surprised to strange layout of 4th returned parameter
3136
    - when this code was writing, at system calls application got
3147
    - when this code was writing, at system calls application got
3137
    only registers eax,ebx,ecx (from pushad-structure transmitted
3148
    only registers eax,ebx,ecx (from pushad-structure transmitted
3138
    as argument to the system function). Now it is corrected, so,
3149
    as argument to the system function). Now it is corrected, so,
3139
    probably, it is meaningful to return cluster size in edx, while
3150
    probably, it is meaningful to return cluster size in edx, while
3140
    this function is not used yet.
3151
    this function is not used yet.
3141
  * There exists also subfunction 11 of function 18,
3152
  * There exists also subfunction 11 of function 18,
3142
    which returns information on file system. From the full table
3153
    which returns information on file system. From the full table
3143
    of disk subsystem it is possible to deduce cluster size (there
3154
    of disk subsystem it is possible to deduce cluster size (there
3144
    it is stored in sectors) and total number of clusters
3155
    it is stored in sectors) and total number of clusters
3145
    for hard disks.
3156
    for hard disks.
3146
 
3157
 
3147
======================================================================
3158
======================================================================
3148
========== Function 58, subfunction 16 - start application. ==========
3159
========== Function 58, subfunction 16 - start application. ==========
3149
======================================================================
3160
======================================================================
3150
Parameters:
3161
Parameters:
3151
  * eax = 58 - function number
3162
  * eax = 58 - function number
3152
  * ebx = pointer to the information structure
3163
  * ebx = pointer to the information structure
3153
Format of the information structure:
3164
Format of the information structure:
3154
  * +0: dword: 16 = subfunction number
3165
  * +0: dword: 16 = subfunction number
3155
  * +4: dword: flags:
3166
  * +4: dword: flags:
3156
    * bit 0: start the process as debugged
3167
    * bit 0: start the process as debugged
3157
    * other bits are reserved and must be cleared
3168
    * other bits are reserved and must be cleared
3158
  * +8: dword: 0 or pointer to ASCIIZ-string with parameters
3169
  * +8: dword: 0 or pointer to ASCIIZ-string with parameters
3159
  * +12 = +0xC: dword: ignored
3170
  * +12 = +0xC: dword: ignored
3160
  * +16 = +0x10: dword: pointer to buffer for system operations
3171
  * +16 = +0x10: dword: pointer to buffer for system operations
3161
    (4096 bytes)
3172
    (4096 bytes)
3162
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
3173
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
3163
    given in the general description
3174
    given in the general description
3164
Returned value:
3175
Returned value:
3165
  * eax > 0 - the program is loaded, eax contains PID
3176
  * eax > 0 - the program is loaded, eax contains PID
3166
  * eax < 0 - an error has occured, -eax contains
3177
  * eax < 0 - an error has occured, -eax contains
3167
    file system error code
3178
    file system error code
3168
Remarks:
3179
Remarks:
3169
  * This function is obsolete, use subfunction 7 of function 70.
3180
  * This function is obsolete, use subfunction 7 of function 70.
3170
  * Command line must be terminated by character with code 0
3181
  * Command line must be terminated by character with code 0
3171
    (ASCIIZ-string); function takes into account either all characters
3182
    (ASCIIZ-string); function takes into account either all characters
3172
    up to terminating null inclusively or the first 256 charachters
3183
    up to terminating null inclusively or the first 256 charachters
3173
    depending on what is less.
3184
    depending on what is less.
3174
  * If the process is started as debugged, it is created in
3185
  * If the process is started as debugged, it is created in
3175
    the suspended state; to run use subfunction 5 of function 69.
3186
    the suspended state; to run use subfunction 5 of function 69.
3176
 
3187
 
3177
======================================================================
3188
======================================================================
3178
=============== Function 59 - trace last system calls. ===============
3189
=============== Function 59 - trace last system calls. ===============
3179
======================================================================
3190
======================================================================
3180
Gets data on all system calls of all processes.
3191
Gets data on all system calls of all processes.
3181
Parameters:
3192
Parameters:
3182
  * eax = 59 - function number
3193
  * eax = 59 - function number
3183
  * ebx = 0 - unique subfunction
3194
  * ebx = 0 - unique subfunction
3184
  * ecx = pointer to the buffer
3195
  * ecx = pointer to the buffer
3185
  * edx = size of the buffer
3196
  * edx = size of the buffer
3186
Returned value:
3197
Returned value:
3187
  * eax = total number of system calls made from system boot
3198
  * eax = total number of system calls made from system boot
3188
    (modulo 2^32)
3199
    (modulo 2^32)
3189
  * ebx = 0
3200
  * ebx = 0
3190
Format of information on one call: (size = 0x40 = 64 bytes)
3201
Format of information on one call: (size = 0x40 = 64 bytes)
3191
  * +0: dword: PID of process/thread
3202
  * +0: dword: PID of process/thread
3192
  * +4: 7*dword: garbage
3203
  * +4: 7*dword: garbage
3193
  * +32 = +0x20: dword: value of edi at the call
3204
  * +32 = +0x20: dword: value of edi at the call
3194
  * +36 = +0x24: dword: esi
3205
  * +36 = +0x24: dword: esi
3195
  * +40 = +0x28: dword: ebp
3206
  * +40 = +0x28: dword: ebp
3196
  * +44 = +0x2C: dword: stack pointer of the kernel handler
3207
  * +44 = +0x2C: dword: stack pointer of the kernel handler
3197
  * +48 = +0x30: dword: ebx
3208
  * +48 = +0x30: dword: ebx
3198
  * +52 = +0x34: dword: edx
3209
  * +52 = +0x34: dword: edx
3199
  * +56 = +0x38: dword: ecx
3210
  * +56 = +0x38: dword: ecx
3200
  * +60 = +0x3C: dword: eax (=number of system function)
3211
  * +60 = +0x3C: dword: eax (=number of system function)
3201
Remarks:
3212
Remarks:
3202
  * The function is used only in the application 'systrace'.
3213
  * The function is used only in the application 'systrace'.
3203
    It is rather difficult to imagine a situation, in which
3214
    It is rather difficult to imagine a situation, in which
3204
    this application or this function are really useful;
3215
    this application or this function are really useful;
3205
    and all system calls for support of this function are a little
3216
    and all system calls for support of this function are a little
3206
    decelerated (though not strongly)...
3217
    decelerated (though not strongly)...
3207
  * So there is a proposition to delete from the kernel
3218
  * So there is a proposition to delete from the kernel
3208
    support of this function, together with application 'systrace'.
3219
    support of this function, together with application 'systrace'.
3209
  * The information on system calls saves in the system
3220
  * The information on system calls saves in the system
3210
    ring buffer with 0x10 entries.
3221
    ring buffer with 0x10 entries.
3211
    This function simply copies the given size of data
3222
    This function simply copies the given size of data
3212
    from this buffer to the given address.
3223
    from this buffer to the given address.
3213
  * One can determine, which entry in the buffer corresponds to
3224
  * One can determine, which entry in the buffer corresponds to
3214
    last system call, by value of eax, namely, it is the entry
3225
    last system call, by value of eax, namely, it is the entry
3215
    (eax and 0xF) (at offset (eax and 0xF)*0x40).
3226
    (eax and 0xF) (at offset (eax and 0xF)*0x40).
3216
  * In the current implementation there can be the seldom
3227
  * In the current implementation there can be the seldom
3217
    meeting problems of unsynchronization, when the information
3228
    meeting problems of unsynchronization, when the information
3218
    on some calls becomes outdated.
3229
    on some calls becomes outdated.
3219
  * Under the system buffer one page, 4Kb, is allocated.
3230
  * Under the system buffer one page, 4Kb, is allocated.
3220
    Size of an entry = 64 bytes. Why only 16 entries are used,
3231
    Size of an entry = 64 bytes. Why only 16 entries are used,
3221
    is not clearly.
3232
    is not clearly.
3222
  * The value of esp at the moment of system call cannot
3233
  * The value of esp at the moment of system call cannot
3223
    be determined by this function.
3234
    be determined by this function.
3224
  * The current implementation does not check edx for correctness.
3235
  * The current implementation does not check edx for correctness.
3225
 
3236
 
3226
======================================================================
3237
======================================================================
3227
========== Function 60 - Inter Process Communication (IPC). ==========
3238
========== Function 60 - Inter Process Communication (IPC). ==========
3228
======================================================================
3239
======================================================================
3229
IPC is used for message dispatching from one process/thread to
3240
IPC is used for message dispatching from one process/thread to
3230
another. Previously it is necessary to agree how to interpret
3241
another. Previously it is necessary to agree how to interpret
3231
the concrete message.
3242
the concrete message.
3232
 
3243
 
3233
----------- Subfunction 1 - set the area for IPC receiving -----------
3244
----------- Subfunction 1 - set the area for IPC receiving -----------
3234
Is called by process-receiver.
3245
Is called by process-receiver.
3235
Parameters:
3246
Parameters:
3236
  * eax = 60 - function number
3247
  * eax = 60 - function number
3237
  * ebx = 1 - subfunction number
3248
  * ebx = 1 - subfunction number
3238
  * ecx = pointer to the buffer
3249
  * ecx = pointer to the buffer
3239
  * edx = size of the buffer
3250
  * edx = size of the buffer
3240
Returned value:
3251
Returned value:
3241
  * eax = 0 - always success
3252
  * eax = 0 - always success
3242
Format of IPC-buffer:
3253
Format of IPC-buffer:
3243
  * +0: dword: if nonzero, buffer is considered locked;
3254
  * +0: dword: if nonzero, buffer is considered locked;
3244
    lock/unlock the buffer, when you work with it and need that
3255
    lock/unlock the buffer, when you work with it and need that
3245
    buffer data are not changed from outside (no new messages)
3256
    buffer data are not changed from outside (no new messages)
3246
  * +4: dword: occupied place in the buffer (in bytes)
3257
  * +4: dword: occupied place in the buffer (in bytes)
3247
  * +8: first message
3258
  * +8: first message
3248
  * +8+n: second message
3259
  * +8+n: second message
3249
  * ...
3260
  * ...
3250
Format of a message:
3261
Format of a message:
3251
  * +0: dword: PID of sender
3262
  * +0: dword: PID of sender
3252
  * +4: dword: message length (not including this header)
3263
  * +4: dword: message length (not including this header)
3253
  * +8: n*byte: message data
3264
  * +8: n*byte: message data
3254
 
3265
 
3255
------------------ Subfunction 2 - send IPC message ------------------
3266
------------------ Subfunction 2 - send IPC message ------------------
3256
Is called by process-sender.
3267
Is called by process-sender.
3257
Parameters:
3268
Parameters:
3258
  * eax = 60 - function number
3269
  * eax = 60 - function number
3259
  * ebx = 2 - subfunction number
3270
  * ebx = 2 - subfunction number
3260
  * ecx = PID of receiver
3271
  * ecx = PID of receiver
3261
  * edx = pointer to the message data
3272
  * edx = pointer to the message data
3262
  * esi = message length (in bytes)
3273
  * esi = message length (in bytes)
3263
Returned value:
3274
Returned value:
3264
  * eax = 0 - success
3275
  * eax = 0 - success
3265
  * eax = 1 - the receiver has not defined buffer for IPC messages
3276
  * eax = 1 - the receiver has not defined buffer for IPC messages
3266
    (can be, still have no time,
3277
    (can be, still have no time,
3267
    and can be, this is not right process)
3278
    and can be, this is not right process)
3268
  * eax = 2 - the receiver has blocked IPC-buffer; try to wait a bit
3279
  * eax = 2 - the receiver has blocked IPC-buffer; try to wait a bit
3269
  * eax = 3 - overflow of IPC-buffer of the receiver
3280
  * eax = 3 - overflow of IPC-buffer of the receiver
3270
  * eax = 4 - process/thread with such PID does not exist
3281
  * eax = 4 - process/thread with such PID does not exist
3271
Remarks:
3282
Remarks:
3272
  * Immediately after writing of IPC-message to the buffer the system
3283
  * Immediately after writing of IPC-message to the buffer the system
3273
    sends to the receiver the event with code 7 (see event codes).
3284
    sends to the receiver the event with code 7 (see event codes).
3274
 
3285
 
3275
======================================================================
3286
======================================================================
3276
==== Function 61 - get parameters for the direct graphics access. ====
3287
==== Function 61 - get parameters for the direct graphics access. ====
3277
======================================================================
3288
======================================================================
3278
The data of the graphics screen (the memory area which displays
3289
The data of the graphics screen (the memory area which displays
3279
screen contents) are accessible to a program directly, without
3290
screen contents) are accessible to a program directly, without
3280
any system calls, through the selector gs:
3291
any system calls, through the selector gs:
3281
	mov	eax, [gs:0]
3292
	mov	eax, [gs:0]
3282
places in eax the first dword of the buffer, which contains
3293
places in eax the first dword of the buffer, which contains
3283
information on color of the left upper point (and, possibly, colors
3294
information on color of the left upper point (and, possibly, colors
3284
of several following).
3295
of several following).
3285
	mov	[gs:0], eax
3296
	mov	[gs:0], eax
3286
by work in VESA modes with LFB sets color of the left upper point
3297
by work in VESA modes with LFB sets color of the left upper point
3287
(and, possibly, colors of several following).
3298
(and, possibly, colors of several following).
3288
To interpret the data of graphics screen program needs to know
3299
To interpret the data of graphics screen program needs to know
3289
some parameters, returning by this function.
3300
some parameters, returning by this function.
3290
Remarks:
3301
Remarks:
3291
  * Graphics parameters changes very seldom at work,
3302
  * Graphics parameters changes very seldom at work,
3292
    namely, only in cases, when user works with the application VRR.
3303
    namely, only in cases, when user works with the application VRR.
3293
  * At videomode change the system redraws all windows (event
3304
  * At videomode change the system redraws all windows (event
3294
    with code 1) and redraws the background (event 5).
3305
    with code 1) and redraws the background (event 5).
3295
    Same events occur in other cases too, which meet much more often,
3306
    Same events occur in other cases too, which meet much more often,
3296
    than videomode change.
3307
    than videomode change.
3297
  * By operation in videomodes with LFB the selector gs points to
3308
  * By operation in videomodes with LFB the selector gs points to
3298
    LFB itself, so reading/writing on gs result directly in
3309
    LFB itself, so reading/writing on gs result directly in
3299
    change of screen contents. By operation in videomodes without
3310
    change of screen contents. By operation in videomodes without
3300
    LFB gs points to some data area in the kernel, and all functions
3311
    LFB gs points to some data area in the kernel, and all functions
3301
    of screen output fulfil honesty double operation on writing
3312
    of screen output fulfil honesty double operation on writing
3302
    directly to the screen and writing to this buffer. In result
3313
    directly to the screen and writing to this buffer. In result
3303
    at reading contents of this buffer the results correspond to
3314
    at reading contents of this buffer the results correspond to
3304
    screen contents (with, generally speaking, large color
3315
    screen contents (with, generally speaking, large color
3305
    resolution), and writing is ignored.
3316
    resolution), and writing is ignored.
3306
    One exception is the mode 320*200, for which main loop of the
3317
    One exception is the mode 320*200, for which main loop of the
3307
    system thread updates the screen according to mouse movements.
3318
    system thread updates the screen according to mouse movements.
3308
 
3319
 
3309
------------------------- Screen resolution --------------------------
3320
------------------------- Screen resolution --------------------------
3310
Parameters:
3321
Parameters:
3311
  * eax = 61 - function number
3322
  * eax = 61 - function number
3312
  * ebx = 1 - subfunction number
3323
  * ebx = 1 - subfunction number
3313
Returned value:
3324
Returned value:
3314
  * eax = [resolution on x axis]*65536 + [resolution on y axis]
3325
  * eax = [resolution on x axis]*65536 + [resolution on y axis]
3315
Remarks:
3326
Remarks:
3316
  * One can use function 14 paying attention that
3327
  * One can use function 14 paying attention that
3317
    it returns sizes on 1 pixel less. It is fully equivalent way.
3328
    it returns sizes on 1 pixel less. It is fully equivalent way.
3318
 
3329
 
3319
---------------------- Number of bits per pixel ----------------------
3330
---------------------- Number of bits per pixel ----------------------
3320
Parameters:
3331
Parameters:
3321
  * eax = 61 - function number
3332
  * eax = 61 - function number
3322
  * ebx = 2 - subfunction number
3333
  * ebx = 2 - subfunction number
3323
Returned value:
3334
Returned value:
3324
  * eax = number of bits per pixel (24 or 32)
3335
  * eax = number of bits per pixel (24 or 32)
3325
 
3336
 
3326
-------------------- Number of bytes per scanline --------------------
3337
-------------------- Number of bytes per scanline --------------------
3327
Parameters:
3338
Parameters:
3328
  * eax = 61 - function number
3339
  * eax = 61 - function number
3329
  * ebx = 3 - subfunction number
3340
  * ebx = 3 - subfunction number
3330
Returned value:
3341
Returned value:
3331
  * eax = number of bytes occupied by one scanline
3342
  * eax = number of bytes occupied by one scanline
3332
    (horizontal line on the screen)
3343
    (horizontal line on the screen)
3333
 
3344
 
3334
======================================================================
3345
======================================================================
3335
===== Function 62, subfunction 0 - get version of PCI-interface. =====
3346
===== Function 62, subfunction 0 - get version of PCI-interface. =====
3336
======================================================================
3347
======================================================================
3337
Parameters:
3348
Parameters:
3338
  * eax = 62 - function number
3349
  * eax = 62 - function number
3339
  * bl = 0 - subfunction number
3350
  * bl = 0 - subfunction number
3340
Returned value:
3351
Returned value:
3341
  * eax = -1 - PCI access is disabled; otherwise
3352
  * eax = -1 - PCI access is disabled; otherwise
3342
  * ah.al = version of PCI-interface (ah=version, al=subversion)
3353
  * ah.al = version of PCI-interface (ah=version, al=subversion)
3343
  * high word of eax is zeroed
3354
  * high word of eax is zeroed
3344
Remarks:
3355
Remarks:
3345
  * Previously low-level access to PCI for applications must be
3356
  * Previously low-level access to PCI for applications must be
3346
    enabled by subfunction 12 of function 21.
3357
    enabled by subfunction 12 of function 21.
3347
  * If PCI BIOS is not supported, the value of ax is undefined.
3358
  * If PCI BIOS is not supported, the value of ax is undefined.
3348
 
3359
 
3349
======================================================================
3360
======================================================================
3350
==== Function 62, subfunction 1 - get number of the last PCI-bus. ====
3361
==== Function 62, subfunction 1 - get number of the last PCI-bus. ====
3351
======================================================================
3362
======================================================================
3352
Parameters:
3363
Parameters:
3353
  * eax = 62 - function number
3364
  * eax = 62 - function number
3354
  * bl = 1 - subfunction number
3365
  * bl = 1 - subfunction number
3355
Returned value:
3366
Returned value:
3356
  * eax = -1 - access to PCI is disabled; otherwise
3367
  * eax = -1 - access to PCI is disabled; otherwise
3357
  * al = number of the last PCI-bus; other bytes of eax are destroyed
3368
  * al = number of the last PCI-bus; other bytes of eax are destroyed
3358
Remarks:
3369
Remarks:
3359
  * Previously low-level access to PCI for applications must be
3370
  * Previously low-level access to PCI for applications must be
3360
    enabled by subfunction 12 of function 21.
3371
    enabled by subfunction 12 of function 21.
3361
  * If PCI BIOS is not supported, the value of ax is undefined.
3372
  * If PCI BIOS is not supported, the value of ax is undefined.
3362
 
3373
 
3363
======================================================================
3374
======================================================================
3364
===================== Function 62, subfunction 2 =====================
3375
===================== Function 62, subfunction 2 =====================
3365
===== Get mechanism of addressing to the PCI configuration space. ====
3376
===== Get mechanism of addressing to the PCI configuration space. ====
3366
======================================================================
3377
======================================================================
3367
Parameters:
3378
Parameters:
3368
  * eax = 62 - function number
3379
  * eax = 62 - function number
3369
  * bl = 2 - subfunction number
3380
  * bl = 2 - subfunction number
3370
Returned value:
3381
Returned value:
3371
  * eax = -1 - access to PCI is disabled; otherwise
3382
  * eax = -1 - access to PCI is disabled; otherwise
3372
  * al = mechanism (1 or 2); other bytes of eax are destroyed
3383
  * al = mechanism (1 or 2); other bytes of eax are destroyed
3373
Remarks:
3384
Remarks:
3374
  * Previously low-level access to PCI for applications must be
3385
  * Previously low-level access to PCI for applications must be
3375
    enabled by subfunction 12 of function 21.
3386
    enabled by subfunction 12 of function 21.
3376
  * Addressing mechanism is selected depending on
3387
  * Addressing mechanism is selected depending on
3377
    equipment characteristics.
3388
    equipment characteristics.
3378
  * Subfunctions of read and write work automatically
3389
  * Subfunctions of read and write work automatically
3379
    with the selected mechanism.
3390
    with the selected mechanism.
3380
 
3391
 
3381
======================================================================
3392
======================================================================
3382
======== Function 62, subfunctions 4,5,6 - read PCI-register. ========
3393
======== Function 62, subfunctions 4,5,6 - read PCI-register. ========
3383
======================================================================
3394
======================================================================
3384
Parameters:
3395
Parameters:
3385
  * eax = 62 - function number
3396
  * eax = 62 - function number
3386
  * bl = 4 - read byte
3397
  * bl = 4 - read byte
3387
  * bl = 5 - read word
3398
  * bl = 5 - read word
3388
  * bl = 6 - read dword
3399
  * bl = 6 - read dword
3389
  * bh = number of PCI-bus
3400
  * bh = number of PCI-bus
3390
  * ch = dddddfff, where ddddd = number of the device on the bus,
3401
  * ch = dddddfff, where ddddd = number of the device on the bus,
3391
    fff = function number of device
3402
    fff = function number of device
3392
  * cl = number of register (must be even for bl=5,
3403
  * cl = number of register (must be even for bl=5,
3393
    divisible by 4 for bl=6)
3404
    divisible by 4 for bl=6)
3394
Returned value:
3405
Returned value:
3395
  * eax = -1 - error (access to PCI is disabled or parameters
3406
  * eax = -1 - error (access to PCI is disabled or parameters
3396
    are not supported); otherwise
3407
    are not supported); otherwise
3397
  * al/ax/eax (depending on requested size) contains the data;
3408
  * al/ax/eax (depending on requested size) contains the data;
3398
    the other part of register eax is destroyed
3409
    the other part of register eax is destroyed
3399
Remarks:
3410
Remarks:
3400
  * Previously low-level access to PCI for applications must be
3411
  * Previously low-level access to PCI for applications must be
3401
    enabled by subfunction 12 of function 21.
3412
    enabled by subfunction 12 of function 21.
3402
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3413
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3403
    function number. To get access mechanism use subfunction 2.
3414
    function number. To get access mechanism use subfunction 2.
3404
  * Some registers are standard and exist for all devices, some are
3415
  * Some registers are standard and exist for all devices, some are
3405
    defined by the concrete device. The list of registers of the
3416
    defined by the concrete device. The list of registers of the
3406
    first type can be found e.g. in famous
3417
    first type can be found e.g. in famous
3407
    Interrupt List by Ralf Brown
3418
    Interrupt List by Ralf Brown
3408
    (http://www.pobox.com/~ralf/files.html,
3419
    (http://www.pobox.com/~ralf/files.html,
3409
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/);
3420
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/);
3410
    registers of the second type must be listed
3421
    registers of the second type must be listed
3411
    in the device documentation.
3422
    in the device documentation.
3412
 
3423
 
3413
======================================================================
3424
======================================================================
3414
====== Function 62, subfunctions 8,9,10 - write to PCI-register. =====
3425
====== Function 62, subfunctions 8,9,10 - write to PCI-register. =====
3415
======================================================================
3426
======================================================================
3416
Parameters:
3427
Parameters:
3417
  * eax = 62 - function number
3428
  * eax = 62 - function number
3418
  * bl = 8 - write byte
3429
  * bl = 8 - write byte
3419
  * bl = 9 - write word
3430
  * bl = 9 - write word
3420
  * bl = 10 - write dword
3431
  * bl = 10 - write dword
3421
  * bh = number of PCI-bus
3432
  * bh = number of PCI-bus
3422
  * ch = dddddfff, where ddddd = number of the device on the bus,
3433
  * ch = dddddfff, where ddddd = number of the device on the bus,
3423
    fff = function number of device
3434
    fff = function number of device
3424
  * cl = number of register (must be even for bl=9,
3435
  * cl = number of register (must be even for bl=9,
3425
    divisible by 4 for bl=10)
3436
    divisible by 4 for bl=10)
3426
  * dl/dx/edx (depending on requested size) contatins
3437
  * dl/dx/edx (depending on requested size) contatins
3427
    the data to write
3438
    the data to write
3428
Returned value:
3439
Returned value:
3429
  * eax = -1 - error (access to PCI is disabled or parameters
3440
  * eax = -1 - error (access to PCI is disabled or parameters
3430
    are not supported)
3441
    are not supported)
3431
  * eax = 0 - success
3442
  * eax = 0 - success
3432
Remarks:
3443
Remarks:
3433
  * Previously low-level access to PCI for applications must be
3444
  * Previously low-level access to PCI for applications must be
3434
    enabled by subfunction 12 of function 21.
3445
    enabled by subfunction 12 of function 21.
3435
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3446
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3436
    function number. To get access mechanism use subfunction 2.
3447
    function number. To get access mechanism use subfunction 2.
3437
  * Some registers are standard and exist for all devices, some are
3448
  * Some registers are standard and exist for all devices, some are
3438
    defined by the concrete device. The list of registers of the
3449
    defined by the concrete device. The list of registers of the
3439
    first type can be found e.g. in famous Interrupt List by
3450
    first type can be found e.g. in famous Interrupt List by
3440
    Ralf Brown; registers of the second type must be listed
3451
    Ralf Brown; registers of the second type must be listed
3441
    in the device documentation.
3452
    in the device documentation.
3442
 
3453
 
3443
======================================================================
3454
======================================================================
3444
============== Function 63 - work with the debug board. ==============
3455
============== Function 63 - work with the debug board. ==============
3445
======================================================================
3456
======================================================================
3446
The debug board is the global system buffer (with the size
3457
The debug board is the global system buffer (with the size
3447
512 bytes), to which any program can write (generally speaking,
3458
512 bytes), to which any program can write (generally speaking,
3448
arbitrary) data and from which other program can read these data.
3459
arbitrary) data and from which other program can read these data.
3449
By the agreement written data are text strings interpreted as
3460
By the agreement written data are text strings interpreted as
3450
debug messages on a course of program execution. The kernel in
3461
debug messages on a course of program execution. The kernel in
3451
some situations also writes to the debug board information on
3462
some situations also writes to the debug board information on
3452
execution of some functions; by the agreement kernel messages
3463
execution of some functions; by the agreement kernel messages
3453
begins from the prefix "K : ".
3464
begins from the prefix "K : ".
3454
For view of the debug board the application 'board' was created,
3465
For view of the debug board the application 'board' was created,
3455
which reads data from the buffer and displays them in its window.
3466
which reads data from the buffer and displays them in its window.
3456
'board' interpretes the sequence of codes 13,10 as newline.
3467
'board' interpretes the sequence of codes 13,10 as newline.
3457
A character with null code in an end of line is not necessary,
3468
A character with null code in an end of line is not necessary,
3458
but also does not prevent.
3469
but also does not prevent.
3459
Because debugger has been written, the value of the debug board
3470
Because debugger has been written, the value of the debug board
3460
has decreased, as debugger allows to inspect completely a course of
3471
has decreased, as debugger allows to inspect completely a course of
3461
program execution without any efforts from the direction of program
3472
program execution without any efforts from the direction of program
3462
itself. Nevertheless in some cases the debug board is still useful.
3473
itself. Nevertheless in some cases the debug board is still useful.
3463
 
3474
 
3464
----------------------------- Write byte -----------------------------
3475
----------------------------- Write byte -----------------------------
3465
Parameters:
3476
Parameters:
3466
  * eax = 63 - function number
3477
  * eax = 63 - function number
3467
  * ebx = 1 - subfunction number
3478
  * ebx = 1 - subfunction number
3468
  * cl = data byte
3479
  * cl = data byte
3469
Returned value:
3480
Returned value:
3470
  * function does not return value
3481
  * function does not return value
3471
Remarks:
3482
Remarks:
3472
  * Byte is written to the buffer. Buffer size is 512 bytes.
3483
  * Byte is written to the buffer. Buffer size is 512 bytes.
3473
    At buffer overflow all obtained data are lost.
3484
    At buffer overflow all obtained data are lost.
3474
  * For output to the debug board of more complicated objects
3485
  * For output to the debug board of more complicated objects
3475
    (strings, numbers) it is enough to call this function in cycle.
3486
    (strings, numbers) it is enough to call this function in cycle.
3476
    It is possible not to write the appropriate code manually and use
3487
    It is possible not to write the appropriate code manually and use
3477
    file 'debug.inc', which is included into the distributive.
3488
    file 'debug.inc', which is included into the distributive.
3478
 
3489
 
3479
----------------------------- Read byte ------------------------------
3490
----------------------------- Read byte ------------------------------
3480
Takes away byte from the buffer.
3491
Takes away byte from the buffer.
3481
Parameters:
3492
Parameters:
3482
  * eax = 63 - function number
3493
  * eax = 63 - function number
3483
  * ebx = 2 - subfunction number
3494
  * ebx = 2 - subfunction number
3484
Returned value:
3495
Returned value:
3485
  * eax = ebx = 0 - the buffer is empty
3496
  * eax = ebx = 0 - the buffer is empty
3486
  * eax = byte, ebx = 1 - byte was successfully read
3497
  * eax = byte, ebx = 1 - byte was successfully read
3487
 
3498
 
3488
======================================================================
3499
======================================================================
3489
============== Function 64 - resize application memory. ==============
3500
============== Function 64 - resize application memory. ==============
3490
======================================================================
3501
======================================================================
3491
Parameters:
3502
Parameters:
3492
  * eax = 64 - function number
3503
  * eax = 64 - function number
3493
  * ebx = 1 - unique subfunction
3504
  * ebx = 1 - unique subfunction
3494
  * ecx = new memory size
3505
  * ecx = new memory size
3495
Returned value:
3506
Returned value:
3496
  * eax = 0 - success
3507
  * eax = 0 - success
3497
  * eax = 1 - not enough memory
3508
  * eax = 1 - not enough memory
3498
Remarks:
3509
Remarks:
3499
  * At the moment this function is a sole resource for dynamic
3510
  * At the moment this function is a sole resource for dynamic
3500
    allocation/free of application memory.
3511
    allocation/free of application memory.
3501
 
3512
 
3502
======================================================================
3513
======================================================================
3503
================== Function 66 - work with keyboard. =================
3514
================== Function 66 - work with keyboard. =================
3504
======================================================================
3515
======================================================================
3505
The input mode influences results of reading keys by function 2.
3516
The input mode influences results of reading keys by function 2.
3506
When a program loads, ASCII input mode is set for it.
3517
When a program loads, ASCII input mode is set for it.
3507
 
3518
 
3508
-------------- Subfunction 1 - set keyboard input mode. --------------
3519
-------------- Subfunction 1 - set keyboard input mode. --------------
3509
Parameters:
3520
Parameters:
3510
  * eax = 66 - function number
3521
  * eax = 66 - function number
3511
  * ebx = 1 - subfunction number
3522
  * ebx = 1 - subfunction number
3512
  * ecx = mode:
3523
  * ecx = mode:
3513
    * 0 = normal (ASCII-characters)
3524
    * 0 = normal (ASCII-characters)
3514
    * 1 = scancodes
3525
    * 1 = scancodes
3515
Returned value:
3526
Returned value:
3516
  * function does not return value
3527
  * function does not return value
3517
 
3528
 
3518
-------------- Subfunction 2 - get keyboard input mode. --------------
3529
-------------- Subfunction 2 - get keyboard input mode. --------------
3519
Parameters:
3530
Parameters:
3520
  * eax = 66 - function number
3531
  * eax = 66 - function number
3521
  * ebx = 2 - subfunction number
3532
  * ebx = 2 - subfunction number
3522
Returned value:
3533
Returned value:
3523
  * eax = current mode
3534
  * eax = current mode
3524
 
3535
 
3525
------------ Subfunction 3 - get status of control keys. -------------
3536
------------ Subfunction 3 - get status of control keys. -------------
3526
Parameters:
3537
Parameters:
3527
  * eax = 66 - function number
3538
  * eax = 66 - function number
3528
  * ebx = 3 - subfunction number
3539
  * ebx = 3 - subfunction number
3529
Returned value:
3540
Returned value:
3530
  * eax = bit mask:
3541
  * eax = bit mask:
3531
  * bit 0 (mask 1): left Shift is pressed
3542
  * bit 0 (mask 1): left Shift is pressed
3532
  * bit 1 (mask 2): right Shift is pressed
3543
  * bit 1 (mask 2): right Shift is pressed
3533
  * bit 2 (mask 4): left Ctrl is pressed
3544
  * bit 2 (mask 4): left Ctrl is pressed
3534
  * bit 3 (mask 8): right Ctrl is pressed
3545
  * bit 3 (mask 8): right Ctrl is pressed
3535
  * bit 4 (mask 0x10): left Alt is pressed
3546
  * bit 4 (mask 0x10): left Alt is pressed
3536
  * bit 5 (mask 0x20): right Alt is pressed
3547
  * bit 5 (mask 0x20): right Alt is pressed
3537
  * bit 6 (mask 0x40): CapsLock is on
3548
  * bit 6 (mask 0x40): CapsLock is on
3538
  * bit 7 (mask 0x80): NumLock is on
3549
  * bit 7 (mask 0x80): NumLock is on
3539
  * bit 8 (mask 0x100): ScrollLock is on
3550
  * bit 8 (mask 0x100): ScrollLock is on
3540
  * other bits are cleared
3551
  * other bits are cleared
3541
 
3552
 
3542
-------------- Subfunction 4 - set system-wide hotkey. ---------------
3553
-------------- Subfunction 4 - set system-wide hotkey. ---------------
3543
When hotkey is pressed, the system notifies only those applications,
3554
When hotkey is pressed, the system notifies only those applications,
3544
which have installed it; the active application (which receives
3555
which have installed it; the active application (which receives
3545
all normal input) does not receive such keys.
3556
all normal input) does not receive such keys.
3546
The notification consists in sending event with the code 2.
3557
The notification consists in sending event with the code 2.
3547
Reading hotkey is the same as reading normal key - by function 2.
3558
Reading hotkey is the same as reading normal key - by function 2.
3548
Parameters:
3559
Parameters:
3549
  * eax = 66 - function number
3560
  * eax = 66 - function number
3550
  * ebx = 4 - subfunction number
3561
  * ebx = 4 - subfunction number
3551
  * cl determines key scancode;
3562
  * cl determines key scancode;
3552
    use cl=0 to give combinations such as Ctrl+Shift
3563
    use cl=0 to give combinations such as Ctrl+Shift
3553
  * edx = 0xXYZ determines possible states of control keys:
3564
  * edx = 0xXYZ determines possible states of control keys:
3554
    * Z (low 4 bits) determines state of LShift and RShift:
3565
    * Z (low 4 bits) determines state of LShift and RShift:
3555
      * 0 = no key must be pressed;
3566
      * 0 = no key must be pressed;
3556
      * 1 = exactly one key must be pressed;
3567
      * 1 = exactly one key must be pressed;
3557
      * 2 = both keys must be pressed;
3568
      * 2 = both keys must be pressed;
3558
      * 3 = must be pressed LShift, but not RShift;
3569
      * 3 = must be pressed LShift, but not RShift;
3559
      * 4 = must be pressed RShift, but not LShift
3570
      * 4 = must be pressed RShift, but not LShift
3560
    * Y - similar for LCtrl and RCtrl;
3571
    * Y - similar for LCtrl and RCtrl;
3561
    * X - similar for LAlt and RAlt
3572
    * X - similar for LAlt and RAlt
3562
Returned value:
3573
Returned value:
3563
  * eax=0 - success
3574
  * eax=0 - success
3564
  * eax=1 - too mant hotkeys (maximum 256 are allowed)
3575
  * eax=1 - too mant hotkeys (maximum 256 are allowed)
3565
Remarks:
3576
Remarks:
3566
  * Hotkey can work either at pressing or at release. Release
3577
  * Hotkey can work either at pressing or at release. Release
3567
    scancode of a key is more on 128 than pressing scancode
3578
    scancode of a key is more on 128 than pressing scancode
3568
    (i.e. high bit is set).
3579
    (i.e. high bit is set).
3569
  * Several applications can set the same combination;
3580
  * Several applications can set the same combination;
3570
    all such applications will be informed on pressing
3581
    all such applications will be informed on pressing
3571
    such combination.
3582
    such combination.
3572
 
3583
 
3573
-------------- Subfunction 5 - delete installed hotkey. --------------
3584
-------------- Subfunction 5 - delete installed hotkey. --------------
3574
Parameters:
3585
Parameters:
3575
  * eax = 66 - function number
3586
  * eax = 66 - function number
3576
  * ebx = 5 - subfunction number
3587
  * ebx = 5 - subfunction number
3577
  * cl = scancode of key and edx = 0xXYZ the same as in subfunction 4
3588
  * cl = scancode of key and edx = 0xXYZ the same as in subfunction 4
3578
Returned value:
3589
Returned value:
3579
  * eax = 0 - success
3590
  * eax = 0 - success
3580
  * eax = 1 - there is no such hotkey
3591
  * eax = 1 - there is no such hotkey
3581
Remarks:
3592
Remarks:
3582
  * When a process/thread terminates, all hotkey installed by it are
3593
  * When a process/thread terminates, all hotkey installed by it are
3583
    deleted.
3594
    deleted.
3584
  * The call to this subfunction does not affect other applications.
3595
  * The call to this subfunction does not affect other applications.
3585
    If other application has defined the same combination, it will
3596
    If other application has defined the same combination, it will
3586
    still receive notices.
3597
    still receive notices.
3587
 
3598
 
3588
======================================================================
3599
======================================================================
3589
========= Function 67 - change position/sizes of the window. =========
3600
========= Function 67 - change position/sizes of the window. =========
3590
======================================================================
3601
======================================================================
3591
Parameters:
3602
Parameters:
3592
  * eax = 67 - function number
3603
  * eax = 67 - function number
3593
  * ebx = new x-coordinate of the window
3604
  * ebx = new x-coordinate of the window
3594
  * ecx = new y-coordinate of the window
3605
  * ecx = new y-coordinate of the window
3595
  * edx = new x-size of the window
3606
  * edx = new x-size of the window
3596
  * esi = new y-size of the window
3607
  * esi = new y-size of the window
3597
Returned value:
3608
Returned value:
3598
  * function does not return value
3609
  * function does not return value
3599
Remarks:
3610
Remarks:
3600
  * The value -1 for a parameter means "do not change"; e.g. to move
3611
  * The value -1 for a parameter means "do not change"; e.g. to move
3601
    the window without resizing it is possible to specify edx=esi=-1.
3612
    the window without resizing it is possible to specify edx=esi=-1.
3602
  * Previously the window must be defined by function 0.
3613
  * Previously the window must be defined by function 0.
3603
    It sets initial coordinates and sizes of the window.
3614
    It sets initial coordinates and sizes of the window.
3604
  * Sizes of the window are understood in sense of function 0,
3615
  * Sizes of the window are understood in sense of function 0,
3605
    that is one pixel less than real sizes.
3616
    that is one pixel less than real sizes.
3606
  * The function call for maximized windows is simply ignored.
3617
  * The function call for maximized windows is simply ignored.
3607
  * For windows of appropriate styles position and/or sizes can be
3618
  * For windows of appropriate styles position and/or sizes can be
3608
    changed by user; current position and sizes can be obtained by
3619
    changed by user; current position and sizes can be obtained by
3609
    call to function 9.
3620
    call to function 9.
3610
  * The function sends to the window redraw event (with the code 1).
3621
  * The function sends to the window redraw event (with the code 1).
3611
 
3622
 
3612
======================================================================
3623
======================================================================
3613
====== Function 68, subfunction 0 - get the task switch counter. =====
3624
====== Function 68, subfunction 0 - get the task switch counter. =====
3614
======================================================================
3625
======================================================================
3615
Parameters:
3626
Parameters:
3616
  * eax = 68 - function number
3627
  * eax = 68 - function number
3617
  * ebx = 0 - subfunction number
3628
  * ebx = 0 - subfunction number
3618
Returned value:
3629
Returned value:
3619
  * eax = number of task switches from the system booting
3630
  * eax = number of task switches from the system booting
3620
    (modulo 2^32)
3631
    (modulo 2^32)
3621
 
3632
 
3622
======================================================================
3633
======================================================================
3623
======= Function 68, subfunction 1 - switch to the next thread. ======
3634
======= Function 68, subfunction 1 - switch to the next thread. ======
3624
======================================================================
3635
======================================================================
3625
The function completes the current time slice allocated to the
3636
The function completes the current time slice allocated to the
3626
thread and switches to the next. (Which thread in which process
3637
thread and switches to the next. (Which thread in which process
3627
will be next, is unpredictable). Later, when execution queue
3638
will be next, is unpredictable). Later, when execution queue
3628
will reach the current thread, execution will be continued.
3639
will reach the current thread, execution will be continued.
3629
Parameters:
3640
Parameters:
3630
  * eax = 68 - function number
3641
  * eax = 68 - function number
3631
  * ebx = 1 - subfunction number
3642
  * ebx = 1 - subfunction number
3632
Returned value:
3643
Returned value:
3633
  * function does not return value
3644
  * function does not return value
3634
 
3645
 
3635
======================================================================
3646
======================================================================
3636
============= Function 68, subfunction 2 - cache + rdpmc. ============
3647
============= Function 68, subfunction 2 - cache + rdpmc. ============
3637
======================================================================
3648
======================================================================
3638
Parameters:
3649
Parameters:
3639
  * eax = 68 - function number
3650
  * eax = 68 - function number
3640
  * ebx = 2 - subfunction number
3651
  * ebx = 2 - subfunction number
3641
  * ecx = required action:
3652
  * ecx = required action:
3642
    * ecx = 0 - enable instruction 'rdpmc'
3653
    * ecx = 0 - enable instruction 'rdpmc'
3643
      (ReaD Performance-Monitoring Counters) for applications
3654
      (ReaD Performance-Monitoring Counters) for applications
3644
    * ecx = 1 - find out whether cache is disabled/enabled
3655
    * ecx = 1 - find out whether cache is disabled/enabled
3645
    * ecx = 2 - enable cache
3656
    * ecx = 2 - enable cache
3646
    * ecx = 3 - disable cache
3657
    * ecx = 3 - disable cache
3647
Returned value:
3658
Returned value:
3648
  * for ecx=0:
3659
  * for ecx=0:
3649
    * eax = the value of cr4
3660
    * eax = the value of cr4
3650
  * for ecx=1:
3661
  * for ecx=1:
3651
    * eax = (cr0 and 0x60000000):
3662
    * eax = (cr0 and 0x60000000):
3652
    * eax = 0 - cache is on
3663
    * eax = 0 - cache is on
3653
    * eax <> 0 - cache is off
3664
    * eax <> 0 - cache is off
3654
  * for ecx=2 and ecx=3:
3665
  * for ecx=2 and ecx=3:
3655
    * function does not return value
3666
    * function does not return value
3656
 
3667
 
3657
======================================================================
3668
======================================================================
3658
=========== Function 68, subfunction 3 - read MSR-register. ==========
3669
=========== Function 68, subfunction 3 - read MSR-register. ==========
3659
======================================================================
3670
======================================================================
3660
MSR = Model Specific Register; the complete list of MSR-registers
3671
MSR = Model Specific Register; the complete list of MSR-registers
3661
of a processor is included to the documentation on it (for example,
3672
of a processor is included to the documentation on it (for example,
3662
IA-32 Intel Architecture Software Developer's Manual,
3673
IA-32 Intel Architecture Software Developer's Manual,
3663
Volume 3, Appendix B); each processor family has its own subset
3674
Volume 3, Appendix B); each processor family has its own subset
3664
of the MSR-registers.
3675
of the MSR-registers.
3665
Parameters:
3676
Parameters:
3666
  * eax = 68 - function number
3677
  * eax = 68 - function number
3667
  * ebx = 3 - subfunction number
3678
  * ebx = 3 - subfunction number
3668
  * ecx is ignored
3679
  * ecx is ignored
3669
  * edx = MSR address
3680
  * edx = MSR address
3670
Returned value:
3681
Returned value:
3671
  * ebx:eax = high:low dword of the result
3682
  * ebx:eax = high:low dword of the result
3672
Remarks:
3683
Remarks:
3673
  * If ecx contains nonexistent or not implemented for this processor
3684
  * If ecx contains nonexistent or not implemented for this processor
3674
    MSR, processor will generate an exception in the kernel, which
3685
    MSR, processor will generate an exception in the kernel, which
3675
    will kill the thread.
3686
    will kill the thread.
3676
  * Previously it is necessary to check, whether MSRs are supported
3687
  * Previously it is necessary to check, whether MSRs are supported
3677
    as a whole, with the instruction 'cpuid'. Otherwise processor
3688
    as a whole, with the instruction 'cpuid'. Otherwise processor
3678
    will generate other exception in the kernel, which will anyway
3689
    will generate other exception in the kernel, which will anyway
3679
    kill the thread.
3690
    kill the thread.
3680
 
3691
 
3681
======================================================================
3692
======================================================================
3682
========= Function 68, subfunction 4 - write to MSR-register. ========
3693
========= Function 68, subfunction 4 - write to MSR-register. ========
3683
======================================================================
3694
======================================================================
3684
MSR = Model Specific Register; the complete list of MSR-registers
3695
MSR = Model Specific Register; the complete list of MSR-registers
3685
of a processor is included to the documentation on it (for example,
3696
of a processor is included to the documentation on it (for example,
3686
IA-32 Intel Architecture Software Developer's Manual,
3697
IA-32 Intel Architecture Software Developer's Manual,
3687
Volume 3, Appendix B); each processor family has its own subset
3698
Volume 3, Appendix B); each processor family has its own subset
3688
of the MSR-registers.
3699
of the MSR-registers.
3689
Parameters:
3700
Parameters:
3690
  * eax = 68 - function number
3701
  * eax = 68 - function number
3691
  * ebx = 4 - subfunction number
3702
  * ebx = 4 - subfunction number
3692
  * ecx is ignored
3703
  * ecx is ignored
3693
  * edx = MSR address
3704
  * edx = MSR address
3694
  * esi:edi = high:low dword
3705
  * esi:edi = high:low dword
3695
Returned value:
3706
Returned value:
3696
  * ebx:eax = copy of esi:edi
3707
  * ebx:eax = copy of esi:edi
3697
Çàìå÷àíèÿ:
3708
Çàìå÷àíèÿ:
3698
  * If ecx contains nonexistent or not implemented for this processor
3709
  * If ecx contains nonexistent or not implemented for this processor
3699
    MSR, processor will generate an exception in the kernel, which
3710
    MSR, processor will generate an exception in the kernel, which
3700
    will kill the thread.
3711
    will kill the thread.
3701
  * Previously it is necessary to check, whether MSRs are supported
3712
  * Previously it is necessary to check, whether MSRs are supported
3702
    as a whole, with the instruction 'cpuid'. Otherwise processor
3713
    as a whole, with the instruction 'cpuid'. Otherwise processor
3703
    will generate other exception in the kernel, which will anyway
3714
    will generate other exception in the kernel, which will anyway
3704
    kill the thread.
3715
    kill the thread.
3705
 
3716
 
3706
======================================================================
3717
======================================================================
3707
======= Function 68, subfunction 5 - allocate physical memory. =======
3718
======= Function 68, subfunction 5 - allocate physical memory. =======
3708
======================================================================
3719
======================================================================
3709
Parameters:
3720
Parameters:
3710
  * eax = 68 - function number
3721
  * eax = 68 - function number
3711
  * ebx = 5 - subfunction number
3722
  * ebx = 5 - subfunction number
3712
  * ecx = size (in bytes)
3723
  * ecx = size (in bytes)
3713
Returned value:
3724
Returned value:
3714
  * eax = physical address of allocated memory
3725
  * eax = physical address of allocated memory
3715
Remarks:
3726
Remarks:
3716
  * Normal applications must not use this function, it is intended
3727
  * Normal applications must not use this function, it is intended
3717
    for the case, when for some device it is required to place
3728
    for the case, when for some device it is required to place
3718
    data to the known physical address. (In effect, this function
3729
    data to the known physical address. (In effect, this function
3719
    was developed for AC97WAV.)
3730
    was developed for AC97WAV.)
3720
  * The number of blocks of physical memory is limited (by constant
3731
  * The number of blocks of physical memory is limited (by constant
3721
    24, and this constant includes some blocks for kernel).
3732
    24, and this constant includes some blocks for kernel).
3722
  * To free a memory allocated by such way use
3733
  * To free a memory allocated by such way use
3723
    subfunction 6, to copy data there and back
3734
    subfunction 6, to copy data there and back
3724
    use subfunctions 7 and 8.
3735
    use subfunctions 7 and 8.
3725
 
3736
 
3726
======================================================================
3737
======================================================================
3727
========= Function 68, subfunction 6 - free physical memory. =========
3738
========= Function 68, subfunction 6 - free physical memory. =========
3728
======================================================================
3739
======================================================================
3729
Parameters:
3740
Parameters:
3730
  * eax = 68 - function number
3741
  * eax = 68 - function number
3731
  * ebx = 6 - subfunction number
3742
  * ebx = 6 - subfunction number
3732
  * ecx = physical address of memory
3743
  * ecx = physical address of memory
3733
Returned value:
3744
Returned value:
3734
  * function does not return value
3745
  * function does not return value
3735
Remarks:
3746
Remarks:
3736
  * Normal applications must not use this function, it is intended
3747
  * Normal applications must not use this function, it is intended
3737
    for the case, when for some device it is required to place
3748
    for the case, when for some device it is required to place
3738
    data to the known physical address. (In effect, this function
3749
    data to the known physical address. (In effect, this function
3739
    was developed for AC97WAV.)
3750
    was developed for AC97WAV.)
3740
  * The memory must be previously allocated by subfunction 5.
3751
  * The memory must be previously allocated by subfunction 5.
3741
 
3752
 
3742
======================================================================
3753
======================================================================
3743
===== Function 68, subfunction 7 - write data to physical memory. ====
3754
===== Function 68, subfunction 7 - write data to physical memory. ====
3744
======================================================================
3755
======================================================================
3745
Parameters:
3756
Parameters:
3746
  * eax = 68 - function number
3757
  * eax = 68 - function number
3747
  * ebx = 7 - subfunction number
3758
  * ebx = 7 - subfunction number
3748
  * ecx = physical address
3759
  * ecx = physical address
3749
  * edx = pointer to the data (in the application)
3760
  * edx = pointer to the data (in the application)
3750
  * esi = size of the data (in bytes)
3761
  * esi = size of the data (in bytes)
3751
Returned value:
3762
Returned value:
3752
  * function does not return value
3763
  * function does not return value
3753
Remarks:
3764
Remarks:
3754
  * Normal applications must not use this function, it is intended
3765
  * Normal applications must not use this function, it is intended
3755
    for the case, when for some device it is required to place
3766
    for the case, when for some device it is required to place
3756
    data to the known physical address. (In effect, this function
3767
    data to the known physical address. (In effect, this function
3757
    was developed for AC97WAV.)
3768
    was developed for AC97WAV.)
3758
  * The range of physical addresses should lie inside of previously
3769
  * The range of physical addresses should lie inside of previously
3759
    allocated by subfunction 5 block of physical memory.
3770
    allocated by subfunction 5 block of physical memory.
3760
  * There is no check for correctness.
3771
  * There is no check for correctness.
3761
 
3772
 
3762
======================================================================
3773
======================================================================
3763
==== Function 68, subfunction 8 - read data from physical memory. ====
3774
==== Function 68, subfunction 8 - read data from physical memory. ====
3764
======================================================================
3775
======================================================================
3765
Parameters:
3776
Parameters:
3766
  * eax = 68 - function number
3777
  * eax = 68 - function number
3767
  * ebx = 8 - subfunction number
3778
  * ebx = 8 - subfunction number
3768
  * ecx = physical address
3779
  * ecx = physical address
3769
  * edx = pointer to buffer for data (in application)
3780
  * edx = pointer to buffer for data (in application)
3770
  * esi = size of data (in bytes)
3781
  * esi = size of data (in bytes)
3771
Returned value:
3782
Returned value:
3772
  * function does not return value
3783
  * function does not return value
3773
Remarks:
3784
Remarks:
3774
  * Normal applications must not use this function, it is intended
3785
  * Normal applications must not use this function, it is intended
3775
    for the case, when for some device it is required to place
3786
    for the case, when for some device it is required to place
3776
    data to the known physical address. (In effect, this function
3787
    data to the known physical address. (In effect, this function
3777
    was developed for AC97WAV.)
3788
    was developed for AC97WAV.)
3778
  * The range of physical addresses should lie inside of previously
3789
  * The range of physical addresses should lie inside of previously
3779
    allocated by subfunction 5 block of physical memory.
3790
    allocated by subfunction 5 block of physical memory.
3780
  * There is no check for correctness.
3791
  * There is no check for correctness.
3781
 
3792
 
3782
======================================================================
3793
======================================================================
3783
====================== Fucntion 69 - debugging. ======================
3794
====================== Fucntion 69 - debugging. ======================
3784
======================================================================
3795
======================================================================
3785
A process can load other process as debugged by set of corresponding
3796
A process can load other process as debugged by set of corresponding
3786
bit by call to subfunction 16 of function 58
3797
bit by call to subfunction 16 of function 58
3787
or subfunction 7 of function 70.
3798
or subfunction 7 of function 70.
3788
A process can have only one debugger; one process can debug some
3799
A process can have only one debugger; one process can debug some
3789
others. The system notifies debugger on events occuring with
3800
others. The system notifies debugger on events occuring with
3790
debugged process. Messages are written to the buffer defined by
3801
debugged process. Messages are written to the buffer defined by
3791
subfunction 0.
3802
subfunction 0.
3792
Format of a message:
3803
Format of a message:
3793
  * +0: dword: message code
3804
  * +0: dword: message code
3794
  * +4: dword: PID of debugged process
3805
  * +4: dword: PID of debugged process
3795
  * +8: there can be additional data depending on message code
3806
  * +8: there can be additional data depending on message code
3796
Message codes:
3807
Message codes:
3797
  * 1 = exception
3808
  * 1 = exception
3798
    * in addition dword-number of the exception is given
3809
    * in addition dword-number of the exception is given
3799
    * process is suspended
3810
    * process is suspended
3800
  * 2 = process has terminated
3811
  * 2 = process has terminated
3801
    * comes at any termination: both through the system function -1,
3812
    * comes at any termination: both through the system function -1,
3802
      and at "murder" by any other process (including debugger itself)
3813
      and at "murder" by any other process (including debugger itself)
3803
  * 3 = debug exception int 1 = #DB
3814
  * 3 = debug exception int 1 = #DB
3804
    * in addition dword-image of the register DR6 is given:
3815
    * in addition dword-image of the register DR6 is given:
3805
      * bits 0-3: condition of the corresponding breakpoint (set by
3816
      * bits 0-3: condition of the corresponding breakpoint (set by
3806
        subfunction 9) is satisfied
3817
        subfunction 9) is satisfied
3807
      * áèò 14: exception has occured because of the trace mode
3818
      * áèò 14: exception has occured because of the trace mode
3808
        (flag TF is set TF)
3819
        (flag TF is set TF)
3809
    * process is suspended
3820
    * process is suspended
3810
When debugger terminates, all debugged processes are killed.
3821
When debugger terminates, all debugged processes are killed.
3811
If debugger does not want this, it must previously detach by
3822
If debugger does not want this, it must previously detach by
3812
subfunction 3.
3823
subfunction 3.
3813
 
3824
 
3814
All subfunctions are applicable only to processes/threads started
3825
All subfunctions are applicable only to processes/threads started
3815
from the current by function 58 or 70 with set debugging flag.
3826
from the current by function 58 or 70 with set debugging flag.
3816
Debugging of multithreaded programs is not supported yet.
3827
Debugging of multithreaded programs is not supported yet.
3817
The full list of subfunctions:
3828
The full list of subfunctions:
3818
  * subfunction 0 - define data area for debug messages
3829
  * subfunction 0 - define data area for debug messages
3819
  * subfunction 1 - get contents of registers of debugged thread
3830
  * subfunction 1 - get contents of registers of debugged thread
3820
  * subfunction 2 - set contents of registers of debugged thread
3831
  * subfunction 2 - set contents of registers of debugged thread
3821
  * subfunction 3 - detach from debugged process
3832
  * subfunction 3 - detach from debugged process
3822
  * subfunction 4 - suspend debugged thread
3833
  * subfunction 4 - suspend debugged thread
3823
  * subfunction 5 - resume debugged thread
3834
  * subfunction 5 - resume debugged thread
3824
  * subfunction 6 - read from the memory of debugged process
3835
  * subfunction 6 - read from the memory of debugged process
3825
  * subfunction 7 - write to the memory of debugged process
3836
  * subfunction 7 - write to the memory of debugged process
3826
  * subfunction 8 - terminate debugged thread
3837
  * subfunction 8 - terminate debugged thread
3827
  * subfunction 9 - set/clear hardware breakpoint
3838
  * subfunction 9 - set/clear hardware breakpoint
3828
 
3839
 
3829
======================================================================
3840
======================================================================
3830
= Function 69, subfunction 0 - define data area fror debug messages. =
3841
= Function 69, subfunction 0 - define data area fror debug messages. =
3831
======================================================================
3842
======================================================================
3832
Parameters:
3843
Parameters:
3833
  * eax = 69 - function number
3844
  * eax = 69 - function number
3834
  * ebx = 0 - subfunction number
3845
  * ebx = 0 - subfunction number
3835
  * ecx = pointer
3846
  * ecx = pointer
3836
Format of data area:
3847
Format of data area:
3837
  * +0: dword: N = buffer size (not including this header)
3848
  * +0: dword: N = buffer size (not including this header)
3838
  * +4: dword: occupied place
3849
  * +4: dword: occupied place
3839
  * +8: N*byte: buffer
3850
  * +8: N*byte: buffer
3840
Returned value:
3851
Returned value:
3841
  * function does not return value
3852
  * function does not return value
3842
Remarks:
3853
Remarks:
3843
  * If the size field is negative, the buffer is considered locked
3854
  * If the size field is negative, the buffer is considered locked
3844
    and at arrival of new message the system will wait.
3855
    and at arrival of new message the system will wait.
3845
    For synchronization frame all work with the buffer by operations
3856
    For synchronization frame all work with the buffer by operations
3846
    lock/unlock
3857
    lock/unlock
3847
    	neg	[bufsize]
3858
    	neg	[bufsize]
3848
  * Data in the buffer are considered as array of items with variable
3859
  * Data in the buffer are considered as array of items with variable
3849
    length - messages. Format of a message is explained in
3860
    length - messages. Format of a message is explained in
3850
    general description.
3861
    general description.
3851
 
3862
 
3852
======================================================================
3863
======================================================================
3853
===================== Function 69, subfunction 1 =====================
3864
===================== Function 69, subfunction 1 =====================
3854
============ Get contents of registers of debugged thread. ===========
3865
============ Get contents of registers of debugged thread. ===========
3855
======================================================================
3866
======================================================================
3856
Parameters:
3867
Parameters:
3857
  * eax = 69 - function number
3868
  * eax = 69 - function number
3858
  * ebx = 1 - subfunction number
3869
  * ebx = 1 - subfunction number
3859
  * ecx = thread identifier
3870
  * ecx = thread identifier
3860
  * edx = size of context structure, must be 0x28=40 bytes
3871
  * edx = size of context structure, must be 0x28=40 bytes
3861
  * esi = pointer to context structure
3872
  * esi = pointer to context structure
3862
Returned value:
3873
Returned value:
3863
  * function does not return value
3874
  * function does not return value
3864
Format of context structure: (FPU is not supported yet)
3875
Format of context structure: (FPU is not supported yet)
3865
  * +0: dword: eip
3876
  * +0: dword: eip
3866
  * +4: dword: eflags
3877
  * +4: dword: eflags
3867
  * +8: dword: eax
3878
  * +8: dword: eax
3868
  * +12 = +0xC: dword: ecx
3879
  * +12 = +0xC: dword: ecx
3869
  * +16 = +0x10: dword: edx
3880
  * +16 = +0x10: dword: edx
3870
  * +20 = +0x14: dword: ebx
3881
  * +20 = +0x14: dword: ebx
3871
  * +24 = +0x18: dword: esp
3882
  * +24 = +0x18: dword: esp
3872
  * +28 = +0x1C: dword: ebp
3883
  * +28 = +0x1C: dword: ebp
3873
  * +32 = +0x20: dword: esi
3884
  * +32 = +0x20: dword: esi
3874
  * +36 = +0x24: dword: edi
3885
  * +36 = +0x24: dword: edi
3875
Remarks:
3886
Remarks:
3876
  * If the thread executes code of ring-0, the function returns
3887
  * If the thread executes code of ring-0, the function returns
3877
    contents of registers of ring-3.
3888
    contents of registers of ring-3.
3878
  * Process must be loaded for debugging (as is shown in
3889
  * Process must be loaded for debugging (as is shown in
3879
    general description).
3890
    general description).
3880
 
3891
 
3881
======================================================================
3892
======================================================================
3882
===================== Function 69, subfunction 2 =====================
3893
===================== Function 69, subfunction 2 =====================
3883
============ Set contents of registers of debugged thread. ===========
3894
============ Set contents of registers of debugged thread. ===========
3884
======================================================================
3895
======================================================================
3885
Parameters:
3896
Parameters:
3886
  * eax = 69 - function number
3897
  * eax = 69 - function number
3887
  * ebx = 2 - subfunction number
3898
  * ebx = 2 - subfunction number
3888
  * ecx = thread identifier
3899
  * ecx = thread identifier
3889
  * edx = size of context structure, must be 0x28=40 bytes
3900
  * edx = size of context structure, must be 0x28=40 bytes
3890
Returned value:
3901
Returned value:
3891
  * function does not return value
3902
  * function does not return value
3892
Format of context structure is shown in the description of
3903
Format of context structure is shown in the description of
3893
subfunction 1.
3904
subfunction 1.
3894
Remarks:
3905
Remarks:
3895
  * If the thread executes code of ring-0, the function returns
3906
  * If the thread executes code of ring-0, the function returns
3896
    contents of registers of ring-3.
3907
    contents of registers of ring-3.
3897
  * Process must be loaded for debugging (as is shown in
3908
  * Process must be loaded for debugging (as is shown in
3898
    general description).
3909
    general description).
3899
 
3910
 
3900
======================================================================
3911
======================================================================
3901
===== Function 69, subfunction 3 - detach from debugged process. =====
3912
===== Function 69, subfunction 3 - detach from debugged process. =====
3902
======================================================================
3913
======================================================================
3903
Parameters:
3914
Parameters:
3904
  * eax = 69 - function number
3915
  * eax = 69 - function number
3905
  * ebx = 3 - subfunction number
3916
  * ebx = 3 - subfunction number
3906
  * ecx = identifier
3917
  * ecx = identifier
3907
Returned value:
3918
Returned value:
3908
  * function does not return value
3919
  * function does not return value
3909
Remarks:
3920
Remarks:
3910
  * If the process was suspended, it resumes execution.
3921
  * If the process was suspended, it resumes execution.
3911
 
3922
 
3912
======================================================================
3923
======================================================================
3913
======== Function 69, subfunction 4 - suspend debugged thread. =======
3924
======== Function 69, subfunction 4 - suspend debugged thread. =======
3914
======================================================================
3925
======================================================================
3915
Parameters:
3926
Parameters:
3916
  * eax = 69 - function number
3927
  * eax = 69 - function number
3917
  * ebx = 4 - subfunction number
3928
  * ebx = 4 - subfunction number
3918
  * ecx = thread identifier
3929
  * ecx = thread identifier
3919
Returned value:
3930
Returned value:
3920
  * function does not return value
3931
  * function does not return value
3921
Remarks:
3932
Remarks:
3922
  * Process must be loaded for debugging (as is shown in
3933
  * Process must be loaded for debugging (as is shown in
3923
    general description).
3934
    general description).
3924
 
3935
 
3925
======================================================================
3936
======================================================================
3926
======== Function 69, subfunction 5 - resume debugged thread. ========
3937
======== Function 69, subfunction 5 - resume debugged thread. ========
3927
======================================================================
3938
======================================================================
3928
Parameters:
3939
Parameters:
3929
  * eax = 69 - function number
3940
  * eax = 69 - function number
3930
  * ebx = 5 - subfunction number
3941
  * ebx = 5 - subfunction number
3931
  * ecx = thread identifier
3942
  * ecx = thread identifier
3932
Returned value:
3943
Returned value:
3933
  * function does not return value
3944
  * function does not return value
3934
Remarks:
3945
Remarks:
3935
  * Process must be loaded for debugging (as is shown in
3946
  * Process must be loaded for debugging (as is shown in
3936
    general description).
3947
    general description).
3937
 
3948
 
3938
======================================================================
3949
======================================================================
3939
= Fucntion 69, subfunction 6 - read from memory of debugged process. =
3950
= Fucntion 69, subfunction 6 - read from memory of debugged process. =
3940
======================================================================
3951
======================================================================
3941
Parameters:
3952
Parameters:
3942
  * eax = 69 - function number
3953
  * eax = 69 - function number
3943
  * ebx = 6 - subfunction number
3954
  * ebx = 6 - subfunction number
3944
  * ecx = identifier
3955
  * ecx = identifier
3945
  * edx = number of bytes to read
3956
  * edx = number of bytes to read
3946
  * esi = address in the memory of debugged process
3957
  * esi = address in the memory of debugged process
3947
  * edi = pointer to buffer for data
3958
  * edi = pointer to buffer for data
3948
Returned value:
3959
Returned value:
3949
  * eax = -1 at an error (invalid PID or buffer)
3960
  * eax = -1 at an error (invalid PID or buffer)
3950
  * otherwise eax = number of read bytes (possibly, 0,
3961
  * otherwise eax = number of read bytes (possibly, 0,
3951
    if esi is too large)
3962
    if esi is too large)
3952
Remarks:
3963
Remarks:
3953
  * Process must be loaded for debugging (as is shown in
3964
  * Process must be loaded for debugging (as is shown in
3954
    general description).
3965
    general description).
3955
 
3966
 
3956
======================================================================
3967
======================================================================
3957
== Function 69, subfunction 7 - write to memory of debugged process. =
3968
== Function 69, subfunction 7 - write to memory of debugged process. =
3958
======================================================================
3969
======================================================================
3959
Parameters:
3970
Parameters:
3960
  * eax = 69 - function number
3971
  * eax = 69 - function number
3961
  * ebx = 7 - subfunction number
3972
  * ebx = 7 - subfunction number
3962
  * ecx = identifier
3973
  * ecx = identifier
3963
  * edx = number of bytes to write
3974
  * edx = number of bytes to write
3964
  * esi = address of memory in debugged process
3975
  * esi = address of memory in debugged process
3965
  * edi = pointer to data
3976
  * edi = pointer to data
3966
Returned value:
3977
Returned value:
3967
  * eax = -1 at an error (invalid PID or buffer)
3978
  * eax = -1 at an error (invalid PID or buffer)
3968
  * otherwise eax = number of written bytes (possibly, 0,
3979
  * otherwise eax = number of written bytes (possibly, 0,
3969
    if esi is too large)
3980
    if esi is too large)
3970
Remarks:
3981
Remarks:
3971
  * Process must be loaded for debugging (as is shown in
3982
  * Process must be loaded for debugging (as is shown in
3972
    general description).
3983
    general description).
3973
 
3984
 
3974
======================================================================
3985
======================================================================
3975
======= Function 69, subfunction 8 - terminate debugged thread. ======
3986
======= Function 69, subfunction 8 - terminate debugged thread. ======
3976
======================================================================
3987
======================================================================
3977
Parameters:
3988
Parameters:
3978
  * eax = 69 - function number
3989
  * eax = 69 - function number
3979
  * ebx = 8 - subfunction number
3990
  * ebx = 8 - subfunction number
3980
  * ecx = identifier
3991
  * ecx = identifier
3981
Returned value:
3992
Returned value:
3982
  * function does not return value
3993
  * function does not return value
3983
Remarks:
3994
Remarks:
3984
  * Process must be loaded for debugging (as is shown in
3995
  * Process must be loaded for debugging (as is shown in
3985
    general description).
3996
    general description).
3986
  * The function is similar to subfunction 2 of function 18
3997
  * The function is similar to subfunction 2 of function 18
3987
    with two differences: it requires first remark and
3998
    with two differences: it requires first remark and
3988
    accepts PID rather than slot number.
3999
    accepts PID rather than slot number.
3989
 
4000
 
3990
======================================================================
4001
======================================================================
3991
===== Function 69, subfunction 9 - set/clear hardware breakpoint. ====
4002
===== Function 69, subfunction 9 - set/clear hardware breakpoint. ====
3992
======================================================================
4003
======================================================================
3993
Parameters:
4004
Parameters:
3994
  * eax = 69 - function number
4005
  * eax = 69 - function number
3995
  * ebx = 9 - subfunction number
4006
  * ebx = 9 - subfunction number
3996
  * ecx = thread identifier
4007
  * ecx = thread identifier
3997
  * dl = index of breakpoint, from 0 to 3 inclusively
4008
  * dl = index of breakpoint, from 0 to 3 inclusively
3998
  * dh = flags:
4009
  * dh = flags:
3999
    * if high bit is cleared - set breakpoint:
4010
    * if high bit is cleared - set breakpoint:
4000
      * bits 0-1 - condition:
4011
      * bits 0-1 - condition:
4001
        * 00 = breakpoint on execution
4012
        * 00 = breakpoint on execution
4002
        * 01 = breakpoint on read
4013
        * 01 = breakpoint on read
4003
        * 11 = breakpoint on read/write
4014
        * 11 = breakpoint on read/write
4004
      * bits 2-3 - length; for breakpoints on exception it must be
4015
      * bits 2-3 - length; for breakpoints on exception it must be
4005
        00, otherwise one of
4016
        00, otherwise one of
4006
        * 00 = byte
4017
        * 00 = byte
4007
        * 01 = word
4018
        * 01 = word
4008
        * 11 = dword
4019
        * 11 = dword
4009
      * esi = breakpoint address; must be aligned according to
4020
      * esi = breakpoint address; must be aligned according to
4010
        the length (i.e. must be even for word breakpoints,
4021
        the length (i.e. must be even for word breakpoints,
4011
        divisible by 4 for dword)
4022
        divisible by 4 for dword)
4012
    * if high bit is set - clear breakpoint
4023
    * if high bit is set - clear breakpoint
4013
Returned value:
4024
Returned value:
4014
  * eax = 0 - success
4025
  * eax = 0 - success
4015
  * eax = 1 - error in the input data
4026
  * eax = 1 - error in the input data
4016
  * eax = 2 - (reserved, is never returned in the current
4027
  * eax = 2 - (reserved, is never returned in the current
4017
    implementation) a global breakpoint with that index is already set
4028
    implementation) a global breakpoint with that index is already set
4018
Remarks:
4029
Remarks:
4019
  * Process must be loaded for debugging (as is shown in
4030
  * Process must be loaded for debugging (as is shown in
4020
    general description).
4031
    general description).
4021
  * Hardware breakpoints are implemented through DRx-registers of
4032
  * Hardware breakpoints are implemented through DRx-registers of
4022
    the processor, all limitations results from this.
4033
    the processor, all limitations results from this.
4023
  * The function can reinstall the breakpoint, previously set
4034
  * The function can reinstall the breakpoint, previously set
4024
    by it (and it does not inform on this).
4035
    by it (and it does not inform on this).
4025
    Carry on the list of set breakpoints in the debugger.
4036
    Carry on the list of set breakpoints in the debugger.
4026
  * Breakpoints generate debug exception #DB, on which the system
4037
  * Breakpoints generate debug exception #DB, on which the system
4027
    notifies debugger.
4038
    notifies debugger.
4028
  * Breakpoints on write and read/write act after
4039
  * Breakpoints on write and read/write act after
4029
    execution of the caused it instruction.
4040
    execution of the caused it instruction.
4030
 
4041
 
4031
======================================================================
4042
======================================================================
4032
==== Function 70 - work with file system with long names support. ====
4043
==== Function 70 - work with file system with long names support. ====
4033
======================================================================
4044
======================================================================
4034
Parameters:
4045
Parameters:
4035
  * eax = 70
4046
  * eax = 70
4036
  * ebx = pointer to the information structure
4047
  * ebx = pointer to the information structure
4037
Returned value:
4048
Returned value:
4038
  * eax = 0 - success; otherwise file system error code
4049
  * eax = 0 - success; otherwise file system error code
4039
  * some subfunctions return value in other registers too
4050
  * some subfunctions return value in other registers too
4040
General format of the information structure:
4051
General format of the information structure:
4041
  * +0: dword: subfunction number
4052
  * +0: dword: subfunction number
4042
  * +4: dword: file offset
4053
  * +4: dword: file offset
4043
  * +8: dword: high dword of offset (must be 0) or flags field
4054
  * +8: dword: high dword of offset (must be 0) or flags field
4044
  * +12 = +0xC: dword: size
4055
  * +12 = +0xC: dword: size
4045
  * +16 = +0x10: dword: pointer to data
4056
  * +16 = +0x10: dword: pointer to data
4046
  * +20 = +0x14: n db: ASCIIZ-string with the filename
4057
  * +20 = +0x14: n db: ASCIIZ-string with the filename
4047
    or
4058
    or
4048
  * +20 = +0x14: db 0
4059
  * +20 = +0x14: db 0
4049
  * +21 = +0x15: dd pointer to ASCIIZ-string with the filename
4060
  * +21 = +0x15: dd pointer to ASCIIZ-string with the filename
4050
Specifications - in documentation on the appropriate subfunction.
4061
Specifications - in documentation on the appropriate subfunction.
4051
Filename is case-insensitive. Russian letters must be written in
4062
Filename is case-insensitive. Russian letters must be written in
4052
the encoding cp866 (DOS).
4063
the encoding cp866 (DOS).
4053
Format of filename:
4064
Format of filename:
4054
/base/number/dir1/dir2/.../dirn/file,
4065
/base/number/dir1/dir2/.../dirn/file,
4055
where /base/number identifies device, on which file is located:
4066
where /base/number identifies device, on which file is located:
4056
one of
4067
one of
4057
  * /RD/1 = /RAMDISK/1 to access ramdisk
4068
  * /RD/1 = /RAMDISK/1 to access ramdisk
4058
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
4069
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
4059
    /FD/2 = /FLOPPYDISK/2 to access second one
4070
    /FD/2 = /FLOPPYDISK/2 to access second one
4060
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
4071
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
4061
    IDE0 (Primary Master), IDE1 (Primary Slave),
4072
    IDE0 (Primary Master), IDE1 (Primary Slave),
4062
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
4073
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
4063
    x - partition number on the selected hard drive, varies from 1
4074
    x - partition number on the selected hard drive, varies from 1
4064
    to 255 (on each hard drive the indexing starts from 1)
4075
    to 255 (on each hard drive the indexing starts from 1)
4065
  * /CD0/1, /CD1/1, /CD2/1, /CD3/1 to access accordingly to
4076
  * /CD0/1, /CD1/1, /CD2/1, /CD3/1 to access accordingly to
4066
    CD on IDE0 (Primary Master), IDE1 (Primary Slave),
4077
    CD on IDE0 (Primary Master), IDE1 (Primary Slave),
4067
    IDE2 (Secondary Master), IDE3 (Secondary Slave)
4078
    IDE2 (Secondary Master), IDE3 (Secondary Slave)
4068
Examples:
4079
Examples:
4069
  * '/rd/1/kernel.asm',0
4080
  * '/rd/1/kernel.asm',0
4070
  * '/HD0/1/kernel.asm',0
4081
  * '/HD0/1/kernel.asm',0
4071
  * '/hd0/2/menuet/pics/tanzania.bmp',0
4082
  * '/hd0/2/menuet/pics/tanzania.bmp',0
4072
  * '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0
4083
  * '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0
4073
Available subfunctions:
4084
Available subfunctions:
4074
  * subfunction 0 - read file
4085
  * subfunction 0 - read file
4075
  * subfunction 1 - read folder
4086
  * subfunction 1 - read folder
4076
  * subfunction 2 - create/rewrite file
4087
  * subfunction 2 - create/rewrite file
4077
  * subfunction 3 - write to existing file
4088
  * subfunction 3 - write to existing file
4078
  * subfunction 4 - set file size
4089
  * subfunction 4 - set file size
4079
  * subfunction 5 - get attributes of file/folder
4090
  * subfunction 5 - get attributes of file/folder
4080
  * subfunction 6 - set attributes of file/folder
4091
  * subfunction 6 - set attributes of file/folder
4081
  * subfunction 7 - start application
4092
  * subfunction 7 - start application
4082
For CD-drives due to hardware limitations only subfunctions
4093
For CD-drives due to hardware limitations only subfunctions
4083
0,1,5 and 7 are available, other subfunctions return error
4094
0,1,5 and 7 are available, other subfunctions return error
4084
with code 2.
4095
with code 2.
4085
 
4096
 
4086
======================================================================
4097
======================================================================
4087
=== Function 70, subfunction 0 - read file with long names support. ==
4098
=== Function 70, subfunction 0 - read file with long names support. ==
4088
======================================================================
4099
======================================================================
4089
Parameters:
4100
Parameters:
4090
  * eax = 70 - function number
4101
  * eax = 70 - function number
4091
  * ebx = pointer to the information structure
4102
  * ebx = pointer to the information structure
4092
Format of the information structure:
4103
Format of the information structure:
4093
  * +0: dword: 0 = subfunction number
4104
  * +0: dword: 0 = subfunction number
4094
  * +4: dword: file offset (in bytes)
4105
  * +4: dword: file offset (in bytes)
4095
  * +8: dword: 0 (reserved for high dword of offset)
4106
  * +8: dword: 0 (reserved for high dword of offset)
4096
  * +12 = +0xC: dword: number of bytes to read
4107
  * +12 = +0xC: dword: number of bytes to read
4097
  * +16 = +0x10: dword: pointer to buffer for data
4108
  * +16 = +0x10: dword: pointer to buffer for data
4098
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4109
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4099
    given in the general description
4110
    given in the general description
4100
    or
4111
    or
4101
  * +20 = +0x14: db 0
4112
  * +20 = +0x14: db 0
4102
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4113
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4103
Returned value:
4114
Returned value:
4104
  * eax = 0 - success, otherwise file system error code
4115
  * eax = 0 - success, otherwise file system error code
4105
  * ebx = number of read bytes or -1=0xffffffff if file was not found
4116
  * ebx = number of read bytes or -1=0xffffffff if file was not found
4106
Remarks:
4117
Remarks:
4107
  * If file was ended before last requested block was read,
4118
  * If file was ended before last requested block was read,
4108
    the function will read as many as it can, and after that return
4119
    the function will read as many as it can, and after that return
4109
    eax=6 (EOF).
4120
    eax=6 (EOF).
4110
  * The function does not allow to read folder (returns eax=10,
4121
  * The function does not allow to read folder (returns eax=10,
4111
    access denied).
4122
    access denied).
4112
 
4123
 
4113
======================================================================
4124
======================================================================
4114
== Function 70, subfunction 1 - read folder with long names support. =
4125
== Function 70, subfunction 1 - read folder with long names support. =
4115
======================================================================
4126
======================================================================
4116
Parameters:
4127
Parameters:
4117
  * eax = 70 - function number
4128
  * eax = 70 - function number
4118
  * ebx = pointer to the information structure
4129
  * ebx = pointer to the information structure
4119
Format of the information structure:
4130
Format of the information structure:
4120
  * +0: dword: 1 = subfunction number
4131
  * +0: dword: 1 = subfunction number
4121
  * +4: dword: index of starting block (beginning from 0)
4132
  * +4: dword: index of starting block (beginning from 0)
4122
  * +8: dword: flags field:
4133
  * +8: dword: flags field:
4123
    * bit 0 (mask 1): in what format to return names,
4134
    * bit 0 (mask 1): in what format to return names,
4124
      0=ANSI, 1=UNICODE
4135
      0=ANSI, 1=UNICODE
4125
    * other bits are reserved and must be set to 0 for the future
4136
    * other bits are reserved and must be set to 0 for the future
4126
      compatibility
4137
      compatibility
4127
  * +12 = +0xC: dword: number of blocks to read
4138
  * +12 = +0xC: dword: number of blocks to read
4128
  * +16 = +0x10: dword: pointer to buffer for data, buffer size
4139
  * +16 = +0x10: dword: pointer to buffer for data, buffer size
4129
    must be not less than 32 + [+12]*560 bytes
4140
    must be not less than 32 + [+12]*560 bytes
4130
  * +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
4141
  * +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
4131
    given in the general description
4142
    given in the general description
4132
    or
4143
    or
4133
  * +20 = +0x14: db 0
4144
  * +20 = +0x14: db 0
4134
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4145
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4135
Returned value:
4146
Returned value:
4136
  * eax = 0 - success, otherwise file system error code
4147
  * eax = 0 - success, otherwise file system error code
4137
  * ebx = number of files, information on which was written to
4148
  * ebx = number of files, information on which was written to
4138
    the buffer, or -1=0xffffffff, if folder was not found
4149
    the buffer, or -1=0xffffffff, if folder was not found
4139
Structure of the buffer:
4150
Structure of the buffer:
4140
  * +0: 32*byte: header
4151
  * +0: 32*byte: header
4141
  * +32 = +0x20: n1*byte: block with information on file 1
4152
  * +32 = +0x20: n1*byte: block with information on file 1
4142
  * +32+n1: n2*byte: block with information on file 2
4153
  * +32+n1: n2*byte: block with information on file 2
4143
  * ...
4154
  * ...
4144
Structure of header:
4155
Structure of header:
4145
  * +0: dword: version of structure (current is 1)
4156
  * +0: dword: version of structure (current is 1)
4146
  * +4: dword: number of placed blocks; is not greater than requested
4157
  * +4: dword: number of placed blocks; is not greater than requested
4147
    in the field +12 of information structure; can be less, if
4158
    in the field +12 of information structure; can be less, if
4148
    there are no more files in folder (the same as in ebx)
4159
    there are no more files in folder (the same as in ebx)
4149
  * +8: dword: total number of files in folder
4160
  * +8: dword: total number of files in folder
4150
  * +12 = +0xC: 20*byte: reserved (zeroed)
4161
  * +12 = +0xC: 20*byte: reserved (zeroed)
4151
Structure of block of data for folder entry (BDFE):
4162
Structure of block of data for folder entry (BDFE):
4152
  * +0: dword: attributes of file:
4163
  * +0: dword: attributes of file:
4153
    * bit 0 (mask 1): file is read-only
4164
    * bit 0 (mask 1): file is read-only
4154
    * bit 1 (mask 2): file is hidden
4165
    * bit 1 (mask 2): file is hidden
4155
    * bit 2 (mask 4): file is system
4166
    * bit 2 (mask 4): file is system
4156
    * bit 3 (mask 8): this is not a file but volume label
4167
    * bit 3 (mask 8): this is not a file but volume label
4157
      (for one partition meets no more than once and
4168
      (for one partition meets no more than once and
4158
      only in root folder)
4169
      only in root folder)
4159
    * bit 4 (mask 0x10): this is a folder
4170
    * bit 4 (mask 0x10): this is a folder
4160
    * bit 5 (mask 0x20): file was not archived - many archivation
4171
    * bit 5 (mask 0x20): file was not archived - many archivation
4161
      programs have an option to archive only files with this bit set,
4172
      programs have an option to archive only files with this bit set,
4162
      and after archiving this bit is cleared - it can be useful
4173
      and after archiving this bit is cleared - it can be useful
4163
      for automatically creating of backup-archives as at writing
4174
      for automatically creating of backup-archives as at writing
4164
      this bit is usually set
4175
      this bit is usually set
4165
  * +4: byte: type of name data:
4176
  * +4: byte: type of name data:
4166
    (coincides with bit 0 of flags in the information structure)
4177
    (coincides with bit 0 of flags in the information structure)
4167
    * 0 = ASCII = 1-byte representation of each character
4178
    * 0 = ASCII = 1-byte representation of each character
4168
    * 1 = UNICODE = 2-byte representation of each character
4179
    * 1 = UNICODE = 2-byte representation of each character
4169
  * +5: 3*byte: reserved (zero)
4180
  * +5: 3*byte: reserved (zero)
4170
  * +8: 4*byte: time of file creation
4181
  * +8: 4*byte: time of file creation
4171
  * +12 = +0xC: 4*byte: date of file creation
4182
  * +12 = +0xC: 4*byte: date of file creation
4172
  * +16 = +0x10: 4*byte: time of last access (read or write)
4183
  * +16 = +0x10: 4*byte: time of last access (read or write)
4173
  * +20 = +0x14: 4*byte: date of last access
4184
  * +20 = +0x14: 4*byte: date of last access
4174
  * +24 = +0x18: 4*byte: time of last modification
4185
  * +24 = +0x18: 4*byte: time of last modification
4175
  * +28 = +0x1C: 4*byte: date of last modification
4186
  * +28 = +0x1C: 4*byte: date of last modification
4176
  * +32 = +0x20: qword: file size in bytes (up to 16777216 Tb)
4187
  * +32 = +0x20: qword: file size in bytes (up to 16777216 Tb)
4177
  * +40 = +0x28: name
4188
  * +40 = +0x28: name
4178
    * for ASCII format: maximum length is 263 characters
4189
    * for ASCII format: maximum length is 263 characters
4179
      (263 bytes), byte after the name has value 0
4190
      (263 bytes), byte after the name has value 0
4180
    * äëÿ ôîðìàòà UNICODE: maximum length is 259 characters
4191
    * äëÿ ôîðìàòà UNICODE: maximum length is 259 characters
4181
      (518 bytes), 2 bytes after the name have value 0
4192
      (518 bytes), 2 bytes after the name have value 0
4182
Time format:
4193
Time format:
4183
  * +0: byte: seconds
4194
  * +0: byte: seconds
4184
  * +1: byte: minutes
4195
  * +1: byte: minutes
4185
  * +2: byte: hours
4196
  * +2: byte: hours
4186
  * +3: byte: reserved (0)
4197
  * +3: byte: reserved (0)
4187
  * for example, 23.59.59 is written as (in hex) 3B 3B 17 00
4198
  * for example, 23.59.59 is written as (in hex) 3B 3B 17 00
4188
Date format:
4199
Date format:
4189
  * +0: byte: day
4200
  * +0: byte: day
4190
  * +1: byte: month
4201
  * +1: byte: month
4191
  * +2: word: year
4202
  * +2: word: year
4192
  * for example, 25.11.1979 is written as (in hex) 19 0B BB 07
4203
  * for example, 25.11.1979 is written as (in hex) 19 0B BB 07
4193
Remarks:
4204
Remarks:
4194
  * If BDFE contains ASCII name, the length of BDFE is 304 bytes,
4205
  * If BDFE contains ASCII name, the length of BDFE is 304 bytes,
4195
    if UNICODE name - 560 bytes. Value of length is aligned
4206
    if UNICODE name - 560 bytes. Value of length is aligned
4196
    on 16-byte bound (to accelerate processing in CPU cache).
4207
    on 16-byte bound (to accelerate processing in CPU cache).
4197
  * First character after a name is zero (ASCIIZ-string). The further
4208
  * First character after a name is zero (ASCIIZ-string). The further
4198
    data contain garbage.
4209
    data contain garbage.
4199
  * If files in folder were ended before requested number was read,
4210
  * If files in folder were ended before requested number was read,
4200
    the function will read as many as it can, and after that return
4211
    the function will read as many as it can, and after that return
4201
    eax=6 (EOF).
4212
    eax=6 (EOF).
4202
  * Any folder on the disk, except for root, contains two special
4213
  * Any folder on the disk, except for root, contains two special
4203
    entries "." and "..", identifying accordingly the folder itself
4214
    entries "." and "..", identifying accordingly the folder itself
4204
    and the parent folder.
4215
    and the parent folder.
4205
  * The function allows also to read virtual folders "/", "/rd",
4216
  * The function allows also to read virtual folders "/", "/rd",
4206
    "/fd", "/hd[n]", thus attributes of subfolders are set to 0x10,
4217
    "/fd", "/hd[n]", thus attributes of subfolders are set to 0x10,
4207
    and times and dates are zeroed. An alternative way to get the
4218
    and times and dates are zeroed. An alternative way to get the
4208
    equipment information - subfunction 11 of function 18.
4219
    equipment information - subfunction 11 of function 18.
4209
 
4220
 
4210
======================================================================
4221
======================================================================
4211
===================== Function 70, subfunction 2 =====================
4222
===================== Function 70, subfunction 2 =====================
4212
============ Create/rewrite file with long names support. ============
4223
============ Create/rewrite file with long names support. ============
4213
======================================================================
4224
======================================================================
4214
Parameters:
4225
Parameters:
4215
  * eax = 70 - function number
4226
  * eax = 70 - function number
4216
  * ebx = pointer to the information structure
4227
  * ebx = pointer to the information structure
4217
Format of the information structure:
4228
Format of the information structure:
4218
  * +0: dword: 2 = subfunction number
4229
  * +0: dword: 2 = subfunction number
4219
  * +4: dword: 0 (reserved)
4230
  * +4: dword: 0 (reserved)
4220
  * +8: dword: 0 (reserved)
4231
  * +8: dword: 0 (reserved)
4221
  * +12 = +0xC: dword: number of bytes to read
4232
  * +12 = +0xC: dword: number of bytes to read
4222
  * +16 = +0x10: dword: pointer to data
4233
  * +16 = +0x10: dword: pointer to data
4223
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4234
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4224
    given in the general description
4235
    given in the general description
4225
    or
4236
    or
4226
  * +20 = +0x14: db 0
4237
  * +20 = +0x14: db 0
4227
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4238
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4228
Returned value:
4239
Returned value:
4229
  * eax = 0 - success, otherwise file system error code
4240
  * eax = 0 - success, otherwise file system error code
4230
  * ebx = number of written bytes (possibly 0)
4241
  * ebx = number of written bytes (possibly 0)
4231
Remarks:
4242
Remarks:
4232
  * If a file with given name did not exist, it is created;
4243
  * If a file with given name did not exist, it is created;
4233
    if it existed, it is rewritten.
4244
    if it existed, it is rewritten.
4234
  * If there is not enough free space on disk, the function will
4245
  * If there is not enough free space on disk, the function will
4235
    write as many as can and then return error code 8.
4246
    write as many as can and then return error code 8.
4236
  * The function is not supported for CD (returns error code 2).
4247
  * The function is not supported for CD (returns error code 2).
4237
 
4248
 
4238
======================================================================
4249
======================================================================
4239
===================== Function 70, subfunction 3 =====================
4250
===================== Function 70, subfunction 3 =====================
4240
=========== Write to existing file with long names support. ==========
4251
=========== Write to existing file with long names support. ==========
4241
======================================================================
4252
======================================================================
4242
Parameters:
4253
Parameters:
4243
  * eax = 70 - function number
4254
  * eax = 70 - function number
4244
  * ebx = pointer to the information structure
4255
  * ebx = pointer to the information structure
4245
Format of the information structure:
4256
Format of the information structure:
4246
  * +0: dword: 3 = subfunction number
4257
  * +0: dword: 3 = subfunction number
4247
  * +4: dword: file offset (in bytes)
4258
  * +4: dword: file offset (in bytes)
4248
  * +8: dword: high dword of offset (must be 0 for FAT)
4259
  * +8: dword: high dword of offset (must be 0 for FAT)
4249
  * +12 = +0xC: dword: number of bytes to write
4260
  * +12 = +0xC: dword: number of bytes to write
4250
  * +16 = +0x10: dword: pointer to data
4261
  * +16 = +0x10: dword: pointer to data
4251
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4262
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4252
    given in the general description
4263
    given in the general description
4253
    or
4264
    or
4254
  * +20 = +0x14: db 0
4265
  * +20 = +0x14: db 0
4255
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4266
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4256
Returned value:
4267
Returned value:
4257
  * eax = 0 - success, otherwise file system error code
4268
  * eax = 0 - success, otherwise file system error code
4258
  * ebx = number of written bytes (possibly 0)
4269
  * ebx = number of written bytes (possibly 0)
4259
Remarks:
4270
Remarks:
4260
  * The file must already exist, otherwise function returns eax=5.
4271
  * The file must already exist, otherwise function returns eax=5.
4261
  * The only result of write 0 bytes is update in the file attributes
4272
  * The only result of write 0 bytes is update in the file attributes
4262
    date/time of modification and access to the current date/time.
4273
    date/time of modification and access to the current date/time.
4263
  * If beginning and/or ending position is greater than file size
4274
  * If beginning and/or ending position is greater than file size
4264
    (except for the previous case), the file is expanded to needed
4275
    (except for the previous case), the file is expanded to needed
4265
    size with zero characters.
4276
    size with zero characters.
4266
  * The function is not supported for CD (returns error code 2).
4277
  * The function is not supported for CD (returns error code 2).
4267
 
4278
 
4268
======================================================================
4279
======================================================================
4269
============ Function 70, subfunction 4 - set end of file. ===========
4280
============ Function 70, subfunction 4 - set end of file. ===========
4270
======================================================================
4281
======================================================================
4271
Parameters:
4282
Parameters:
4272
  * eax = 70 - function number
4283
  * eax = 70 - function number
4273
  * ebx = pointer to the information structure
4284
  * ebx = pointer to the information structure
4274
Format of the information structure:
4285
Format of the information structure:
4275
  * +0: dword: 4 = subfunction number
4286
  * +0: dword: 4 = subfunction number
4276
  * +4: dword: low dword of new file size
4287
  * +4: dword: low dword of new file size
4277
  * +8: dword: high dword of new file size (must be 0 for FAT)
4288
  * +8: dword: high dword of new file size (must be 0 for FAT)
4278
  * +12 = +0xC: dword: 0 (reserved)
4289
  * +12 = +0xC: dword: 0 (reserved)
4279
  * +16 = +0x10: dword: 0 (reserved)
4290
  * +16 = +0x10: dword: 0 (reserved)
4280
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4291
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4281
    given in the general description
4292
    given in the general description
4282
    or
4293
    or
4283
  * +20 = +0x14: db 0
4294
  * +20 = +0x14: db 0
4284
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4295
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4285
Returned value:
4296
Returned value:
4286
  * eax = 0 - success, otherwise file system error code
4297
  * eax = 0 - success, otherwise file system error code
4287
  * ebx destroyed
4298
  * ebx destroyed
4288
Remarks:
4299
Remarks:
4289
  * If the new file size is less than old one, file is truncated.
4300
  * If the new file size is less than old one, file is truncated.
4290
    If the new size is greater than old one, file is expanded with
4301
    If the new size is greater than old one, file is expanded with
4291
    characters with code 0. If the new size is equal to old one,
4302
    characters with code 0. If the new size is equal to old one,
4292
    the only result of call is set date/time of modification and
4303
    the only result of call is set date/time of modification and
4293
    access to the current date/time.
4304
    access to the current date/time.
4294
  * If there is not enough free space on disk for expansion, the
4305
  * If there is not enough free space on disk for expansion, the
4295
    function will expand to maximum possible size and then return
4306
    function will expand to maximum possible size and then return
4296
    error code 8.
4307
    error code 8.
4297
  * The function is not supported for CD (returns error code 2).
4308
  * The function is not supported for CD (returns error code 2).
4298
 
4309
 
4299
======================================================================
4310
======================================================================
4300
==== Function 70, subfunction 5 - get information on file/folder. ====
4311
==== Function 70, subfunction 5 - get information on file/folder. ====
4301
======================================================================
4312
======================================================================
4302
Parameters:
4313
Parameters:
4303
  * eax = 70 - function number
4314
  * eax = 70 - function number
4304
  * ebx = pointer to the information structure
4315
  * ebx = pointer to the information structure
4305
Format of the information structure:
4316
Format of the information structure:
4306
  * +0: dword: 5 = subfunction number
4317
  * +0: dword: 5 = subfunction number
4307
  * +4: dword: 0 (reserved)
4318
  * +4: dword: 0 (reserved)
4308
  * +8: dword: 0 (reserved)
4319
  * +8: dword: 0 (reserved)
4309
  * +12 = +0xC: dword: 0 (reserved)
4320
  * +12 = +0xC: dword: 0 (reserved)
4310
  * +16 = +0x10: dword: pointer to buffer for data (40 bytes)
4321
  * +16 = +0x10: dword: pointer to buffer for data (40 bytes)
4311
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4322
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4312
    given in the general description
4323
    given in the general description
4313
    or
4324
    or
4314
  * +20 = +0x14: db 0
4325
  * +20 = +0x14: db 0
4315
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4326
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4316
Returned value:
4327
Returned value:
4317
  * eax = 0 - success, otherwise file system error code
4328
  * eax = 0 - success, otherwise file system error code
4318
  * ebx destroyed
4329
  * ebx destroyed
4319
Information on file is returned in the BDFE format (block of data
4330
Information on file is returned in the BDFE format (block of data
4320
for folder entry), explained in the description of
4331
for folder entry), explained in the description of
4321
subfunction 1, but without filename
4332
subfunction 1, but without filename
4322
(i.e. only first 40 = 0x28 bytes).
4333
(i.e. only first 40 = 0x28 bytes).
4323
Remarks:
4334
Remarks:
4324
  * The function does not support virtual folders such as /, /rd and
4335
  * The function does not support virtual folders such as /, /rd and
4325
    root folders like /rd/1.
4336
    root folders like /rd/1.
4326
 
4337
 
4327
======================================================================
4338
======================================================================
4328
===== Function 70, subfunction 6 - set attributes of file/folder. ====
4339
===== Function 70, subfunction 6 - set attributes of file/folder. ====
4329
======================================================================
4340
======================================================================
4330
Parameters:
4341
Parameters:
4331
  * eax = 70 - function number
4342
  * eax = 70 - function number
4332
  * ebx = pointer to the information structure
4343
  * ebx = pointer to the information structure
4333
Format of the information structure:
4344
Format of the information structure:
4334
  * +0: dword: 6 = subfunction number
4345
  * +0: dword: 6 = subfunction number
4335
  * +4: dword: 0 (reserved)
4346
  * +4: dword: 0 (reserved)
4336
  * +8: dword: 0 (reserved)
4347
  * +8: dword: 0 (reserved)
4337
  * +12 = +0xC: dword: 0 (reserved)
4348
  * +12 = +0xC: dword: 0 (reserved)
4338
  * +16 = +0x10: dword: pointer to buffer with attributes (32 bytes)
4349
  * +16 = +0x10: dword: pointer to buffer with attributes (32 bytes)
4339
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4350
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4340
    given in the general description
4351
    given in the general description
4341
    or
4352
    or
4342
  * +20 = +0x14: db 0
4353
  * +20 = +0x14: db 0
4343
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4354
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4344
Returned value:
4355
Returned value:
4345
  * eax = 0 - success, otherwise file system error code
4356
  * eax = 0 - success, otherwise file system error code
4346
  * ebx destroyed
4357
  * ebx destroyed
4347
File attributes are first 32 bytes in BDFE (block of data
4358
File attributes are first 32 bytes in BDFE (block of data
4348
for folder entry), explained in the description of subfunction 1
4359
for folder entry), explained in the description of subfunction 1
4349
(that is, without name and size of file). Attribute
4360
(that is, without name and size of file). Attribute
4350
file/folder/volume label (bits 3,4 in dword +0) is not changed.
4361
file/folder/volume label (bits 3,4 in dword +0) is not changed.
4351
Byte +4 (name format) is ignored.
4362
Byte +4 (name format) is ignored.
4352
Remarks:
4363
Remarks:
4353
  * The function does not support virtual folders such as /, /rd and
4364
  * The function does not support virtual folders such as /, /rd and
4354
    root folders like /rd/1.
4365
    root folders like /rd/1.
4355
  * The function is not supported for CD (returns error code 2).
4366
  * The function is not supported for CD (returns error code 2).
4356
 
4367
 
4357
======================================================================
4368
======================================================================
4358
=========== Function 70, subfunction 7 - start application. ==========
4369
=========== Function 70, subfunction 7 - start application. ==========
4359
======================================================================
4370
======================================================================
4360
Parameters:
4371
Parameters:
4361
  * eax = 70 - function number
4372
  * eax = 70 - function number
4362
  * ebx = pointer to the information structure
4373
  * ebx = pointer to the information structure
4363
Format of the information structure:
4374
Format of the information structure:
4364
  * +0: dword: 7 = subfunction number
4375
  * +0: dword: 7 = subfunction number
4365
  * +4: dword: flags field:
4376
  * +4: dword: flags field:
4366
    * áèò 0: start process as debugged
4377
    * áèò 0: start process as debugged
4367
    * other bits are reserved and must be set to 0
4378
    * other bits are reserved and must be set to 0
4368
  * +8: dword: 0 or pointer to ASCIIZ-string with parameters
4379
  * +8: dword: 0 or pointer to ASCIIZ-string with parameters
4369
  * +12 = +0xC: dword: 0 (reserved)
4380
  * +12 = +0xC: dword: 0 (reserved)
4370
  * +16 = +0x10: dword: 0 (reserved)
4381
  * +16 = +0x10: dword: 0 (reserved)
4371
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4382
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4372
    given in the general description
4383
    given in the general description
4373
    or
4384
    or
4374
  * +20 = +0x14: db 0
4385
  * +20 = +0x14: db 0
4375
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4386
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4376
Returned value:
4387
Returned value:
4377
  * eax > 0 - program is loaded, eax contains PID
4388
  * eax > 0 - program is loaded, eax contains PID
4378
  * eax < 0 - an error has occured, -eax contains
4389
  * eax < 0 - an error has occured, -eax contains
4379
    file system error code
4390
    file system error code
4380
  * ebx destroyed
4391
  * ebx destroyed
4381
Remarks:
4392
Remarks:
4382
  * Command line must be terminated by the character with the code 0
4393
  * Command line must be terminated by the character with the code 0
4383
    (ASCIIZ-string); function takes into account either all characters
4394
    (ASCIIZ-string); function takes into account either all characters
4384
    up to terminating zero inclusively or first 256 character
4395
    up to terminating zero inclusively or first 256 character
4385
    regarding what is less.
4396
    regarding what is less.
4386
  * If the process is started as debugged, it is created in
4397
  * If the process is started as debugged, it is created in
4387
    the suspended state; to run use subfunction 5 of function 69.
4398
    the suspended state; to run use subfunction 5 of function 69.
4388
 
4399
 
4389
======================================================================
4400
======================================================================
4390
========== Function 71, subfunction 1 - set window caption. ==========
4401
========== Function 71, subfunction 1 - set window caption. ==========
4391
======================================================================
4402
======================================================================
4392
Parameters:
4403
Parameters:
4393
  * eax = 71 - function number
4404
  * eax = 71 - function number
4394
  * ebx = 1 - subfunction number
4405
  * ebx = 1 - subfunction number
4395
  * ecx = pointer to caption string
4406
  * ecx = pointer to caption string
4396
Returned value:
4407
Returned value:
4397
  * function does not return value
4408
  * function does not return value
4398
Remarks:
4409
Remarks:
4399
  * String must be in the ASCIIZ-format. Disregarding real string
4410
  * String must be in the ASCIIZ-format. Disregarding real string
4400
    length, no more than 255 characters are drawn.
4411
    length, no more than 255 characters are drawn.
4401
  * Pass NULL in ecx to remove caption.
4412
  * Pass NULL in ecx to remove caption.
4402
 
4413
 
4403
======================================================================
4414
======================================================================
4404
=============== Function -1 - terminate thread/process ===============
4415
=============== Function -1 - terminate thread/process ===============
4405
======================================================================
4416
======================================================================
4406
Parameters:
4417
Parameters:
4407
  * eax = -1 - function number
4418
  * eax = -1 - function number
4408
Returned value:
4419
Returned value:
4409
  * function does not return neither value nor control
4420
  * function does not return neither value nor control
4410
Remarks:
4421
Remarks:
4411
  * If the process did not create threads obviously, it has only
4422
  * If the process did not create threads obviously, it has only
4412
    one thread, which termination results in process termination.
4423
    one thread, which termination results in process termination.
4413
  * If the current thread is last in the process, its termination
4424
  * If the current thread is last in the process, its termination
4414
    also results in process terminates.
4425
    also results in process terminates.
4415
  * This function terminates the current thread. Other thread can be
4426
  * This function terminates the current thread. Other thread can be
4416
    killed by call to subfunction 2 of function 18.
4427
    killed by call to subfunction 2 of function 18.
4417
 
4428
 
4418
======================================================================
4429
======================================================================
4419
=========================== List of events ===========================
4430
=========================== List of events ===========================
4420
======================================================================
4431
======================================================================
4421
Next event can be retrieved by the call of one from functions 10
4432
Next event can be retrieved by the call of one from functions 10
4422
(to wait for event), 11 (to check without waiting), 23
4433
(to wait for event), 11 (to check without waiting), 23
4423
(to wait during the given time).
4434
(to wait during the given time).
4424
These functions return only those events, which enter into a mask set
4435
These functions return only those events, which enter into a mask set
4425
by function 40. By default it is first three,
4436
by function 40. By default it is first three,
4426
there is enough for most applications.
4437
there is enough for most applications.
4427
Codes of events:
4438
Codes of events:
4428
  * 1 = redraw event (is reset by call to function 0)
4439
  * 1 = redraw event (is reset by call to function 0)
4429
  * 2 = key on keyboard is pressed (acts, only when the window is
4440
  * 2 = key on keyboard is pressed (acts, only when the window is
4430
    active) or hotkey is pressed; is reset, when all keys from
4441
    active) or hotkey is pressed; is reset, when all keys from
4431
    the buffer are read out by function 2
4442
    the buffer are read out by function 2
4432
  * 3 = button is pressed, defined earlier by function 8
4443
  * 3 = button is pressed, defined earlier by function 8
4433
    (or close button, created implicitly by function 0;
4444
    (or close button, created implicitly by function 0;
4434
    minimize button is handled by the system and sends no message;
4445
    minimize button is handled by the system and sends no message;
4435
    acts, only when the window is active;
4446
    acts, only when the window is active;
4436
    is reset when all buttons from the buffer
4447
    is reset when all buttons from the buffer
4437
    are read out by function 17)
4448
    are read out by function 17)
4438
  * 4 = reserved (in current implementation never comes even after
4449
  * 4 = reserved (in current implementation never comes even after
4439
    unmasking by function 40)
4450
    unmasking by function 40)
4440
  * 5 = the desktop background is redrawed (is reset automatically
4451
  * 5 = the desktop background is redrawed (is reset automatically
4441
    after redraw, so if in redraw time program does not wait and
4452
    after redraw, so if in redraw time program does not wait and
4442
    does not check events, it will not remark this event)
4453
    does not check events, it will not remark this event)
4443
  * 6 = mouse event (something happened - button pressing or moving;
4454
  * 6 = mouse event (something happened - button pressing or moving;
4444
    is reset at reading)
4455
    is reset at reading)
4445
  * 7 = IPC event (see function 60 -
4456
  * 7 = IPC event (see function 60 -
4446
    Inter Process Communication; is reset at reading)
4457
    Inter Process Communication; is reset at reading)
4447
  * 8 = network event (is reset at reading)
4458
  * 8 = network event (is reset at reading)
4448
  * 9 = debug event (is reset at reading; see
4459
  * 9 = debug event (is reset at reading; see
4449
    debug subsystem)
4460
    debug subsystem)
4450
  * 16..31 = event with appropriate IRQ
4461
  * 16..31 = event with appropriate IRQ
4451
    (16=IRQ0, 31=IRQ15) (is reset after reading all IRQ data)
4462
    (16=IRQ0, 31=IRQ15) (is reset after reading all IRQ data)
4452
 
4463
 
4453
======================================================================
4464
======================================================================
4454
=================== Error codes of the file system ===================
4465
=================== Error codes of the file system ===================
4455
======================================================================
4466
======================================================================
4456
  * 0 = success
4467
  * 0 = success
4457
  * 1 = base and/or partition of a hard disk is not defined
4468
  * 1 = base and/or partition of a hard disk is not defined
4458
    (by subfunctions 7, 8 of function 21)
4469
    (by subfunctions 7, 8 of function 21)
4459
  * 2 = function is not supported for the given file system
4470
  * 2 = function is not supported for the given file system
4460
  * 3 = unknown file system
4471
  * 3 = unknown file system
4461
  * 4 = is returned only from function 'rename' by transmission of
4472
  * 4 = is returned only from function 'rename' by transmission of
4462
    the strongly incorrect parameter and in any way does not
4473
    the strongly incorrect parameter and in any way does not
4463
    correspond to the description in the kernel sources
4474
    correspond to the description in the kernel sources
4464
    "partition not defined at hd"
4475
    "partition not defined at hd"
4465
  * 5 = file not found
4476
  * 5 = file not found
4466
  * 6 = end of file, EOF
4477
  * 6 = end of file, EOF
4467
  * 7 = pointer lies outside of application memory
4478
  * 7 = pointer lies outside of application memory
4468
  * 8 = disk is full
4479
  * 8 = disk is full
4469
  * 9 = FAT table is destroyed
4480
  * 9 = FAT table is destroyed
4470
  * 10 = access denied
4481
  * 10 = access denied
4471
  * 11 = device error
4482
  * 11 = device error
4472
Application start functions can return also following errors:
4483
Application start functions can return also following errors:
4473
  * 30 = 0x1E = not enough memory
4484
  * 30 = 0x1E = not enough memory
4474
  * 31 = 0x1F = file is not executable
4485
  * 31 = 0x1F = file is not executable
4475
  * 32 = 0x20 = too many processes
4486
  * 32 = 0x20 = too many processes
4476
>
4487
>
4477
>
4488
>
4478
>
4489
>
4479
>
4490
>
4480
>
4491
>