Subversion Repositories Kolibri OS

Rev

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

Rev 133 Rev 139
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 specifies the used font: 0=system monospaced,
192
    * nn specifies the used font: 0=system monospaced,
192
      1=system font of variable width
193
      1=system font of variable width
-
 
194
    * A=0 - output esi characters, A=1 - output ASCIIZ-string
-
 
195
    * B=1 - fill background with the color edi
193
  * edx = pointer to the beginning of the string
196
  * edx = pointer to the beginning of the string
194
  * esi = 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
195
Returned value:
199
Returned value:
196
  * function does not return value
200
  * function does not return value
197
Remarks:
201
Remarks:
198
  * Function outputs either first (esi and 0xFF) characters or
-
 
199
    all characters before (but not including) terminating zero
-
 
200
    (for ASCIIZ-strings) depending on what occurs first.
-
 
201
  * 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,
202
    second - from char2.mt.
203
    second - from char2.mt.
203
  * Both fonts have height 9 pixels, width of the monospaced font
204
  * Both fonts have height 9 pixels, width of the monospaced font
204
    is equal to 6 pixels.
205
    is equal to 6 pixels.
205
 
206
 
206
======================================================================
207
======================================================================
207
========================= Function 5 - delay. ========================
208
========================= Function 5 - delay. ========================
208
======================================================================
209
======================================================================
209
Delays execution of the program on the given time.
210
Delays execution of the program on the given time.
210
Parameters:
211
Parameters:
211
  * eax = 5 - function number
212
  * eax = 5 - function number
212
  * ebx = time in the 1/100 of second
213
  * ebx = time in the 1/100 of second
213
Returned value:
214
Returned value:
214
  * function does not return value
215
  * function does not return value
215
Remarks:
216
Remarks:
216
  * Passing ebx=0 does not transfer control to the next process
217
  * Passing ebx=0 does not transfer control to the next process
217
    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
218
    to transfer control to the next process (to complete a current
219
    to transfer control to the next process (to complete a current
219
    time slice), use subfunction 1 of function 68.
220
    time slice), use subfunction 1 of function 68.
220
  * At current implementation there will be an immediate return from
221
  * At current implementation there will be an immediate return from
221
    the function, if the addition of ebx with current value of
222
    the function, if the addition of ebx with current value of
222
    time counter will call 32-bit overflow.
223
    time counter will call 32-bit overflow.
223
 
224
 
224
======================================================================
225
======================================================================
225
============== Function 6 - read the file from ramdisk. ==============
226
============== Function 6 - read the file from ramdisk. ==============
226
======================================================================
227
======================================================================
227
Parameters:
228
Parameters:
228
  * eax = 6 - function number
229
  * eax = 6 - function number
229
  * ebx = pointer to the filename
230
  * ebx = pointer to the filename
230
  * ecx = number of start block, beginning from 1;
231
  * ecx = number of start block, beginning from 1;
231
    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)
232
  * edx = number of blocks to read;
233
  * edx = number of blocks to read;
233
    edx=0 - read one block (same as edx=1)
234
    edx=0 - read one block (same as edx=1)
234
  * esi = pointer to memory area for the data
235
  * esi = pointer to memory area for the data
235
Returned value:
236
Returned value:
236
  * eax = file size in bytes, if the file was successfully read
237
  * eax = file size in bytes, if the file was successfully read
237
  * eax = -1, if the file was not found
238
  * eax = -1, if the file was not found
238
Remarks:
239
Remarks:
239
  * This function is out-of-date; function 70 allows
240
  * This function is out-of-date; function 70 allows
240
    to fulfil the same operations with the extended possibilities.
241
    to fulfil the same operations with the extended possibilities.
241
  * Block = 512 bytes.
242
  * Block = 512 bytes.
242
  * For reading all file you can specify the certainly large value
243
  * For reading all file you can specify the certainly large value
243
    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
244
    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
245
    not be placed in the program memory.
246
    not be placed in the program memory.
246
  * The filename must be either in the format 8+3 characters
247
  * The filename must be either in the format 8+3 characters
247
    (first 8 characters - name itself, last 3 - extension,
248
    (first 8 characters - name itself, last 3 - extension,
248
    the short names and extensions are supplemented with spaces),
249
    the short names and extensions are supplemented with spaces),
249
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
250
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
250
    (name no more than 8 characters, dot, extension 3 characters
251
    (name no more than 8 characters, dot, extension 3 characters
251
    supplemented if necessary by spaces).
252
    supplemented if necessary by spaces).
252
    The filename must be written with capital letters. The terminating
253
    The filename must be written with capital letters. The terminating
253
    character with code 0 is not necessary (not ASCIIZ-string).
254
    character with code 0 is not necessary (not ASCIIZ-string).
254
  * This function does not support folders on the ramdisk.
255
  * This function does not support folders on the ramdisk.
255
 
256
 
256
======================================================================
257
======================================================================
257
=============== Function 7 - draw image in the window. ===============
258
=============== Function 7 - draw image in the window. ===============
258
======================================================================
259
======================================================================
259
Paramters:
260
Paramters:
260
  * eax = 7 - function number
261
  * eax = 7 - function number
261
  * ebx = pointer to the image in the format BBGGRRBBGGRR...
262
  * ebx = pointer to the image in the format BBGGRRBBGGRR...
262
  * ecx = [size on axis x]*65536 + [size on axis y]
263
  * ecx = [size on axis x]*65536 + [size on axis y]
263
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
264
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
264
Returned value:
265
Returned value:
265
  * function does not return value
266
  * function does not return value
266
Remarks:
267
Remarks:
267
  * Coordinates of the image are coordinates of the upper left corner
268
  * Coordinates of the image are coordinates of the upper left corner
268
    of the image relative to the window.
269
    of the image relative to the window.
269
  * Size of the image in bytes is 3*xsize*ysize.
270
  * Size of the image in bytes is 3*xsize*ysize.
270
 
271
 
271
======================================================================
272
======================================================================
272
=============== Function 8 - define/delete the button. ===============
273
=============== Function 8 - define/delete the button. ===============
273
======================================================================
274
======================================================================
274
Parameters for button definition:
275
Parameters for button definition:
275
  * eax = 8 - function number
276
  * eax = 8 - function number
276
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
277
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
277
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
278
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
278
  * edx = 0xXYnnnnnn, where:
279
  * edx = 0xXYnnnnnn, where:
279
    * nnnnnn = identifier of the button
280
    * nnnnnn = identifier of the button
280
    * high (31st) bit of edx is cleared
281
    * high (31st) bit of edx is cleared
281
    * 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
282
    * 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
283
      at pressing the button
284
      at pressing the button
284
  * esi = 0x00RRGGBB - color of the button
285
  * esi = 0x00RRGGBB - color of the button
285
Parameters for button deleting:
286
Parameters for button deleting:
286
  * eax = 8 - function number
287
  * eax = 8 - function number
287
  * edx = 0x80nnnnnn, where nnnnnn - identifier of the button
288
  * edx = 0x80nnnnnn, where nnnnnn - identifier of the button
288
Returned value:
289
Returned value:
289
  * function does not return value
290
  * function does not return value
290
Remarks:
291
Remarks:
291
  * 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.
292
  * For skinned windows definition of the window
293
  * For skinned windows definition of the window
293
    (call of 0th function) creates two standard buttons -
294
    (call of 0th function) creates two standard buttons -
294
    for close of the window with identifier 1 and
295
    for close of the window with identifier 1 and
295
    for minimize of the window with identifier 0xffff.
296
    for minimize of the window with identifier 0xffff.
296
  * The creation of two buttons with same identifiers is admitted.
297
  * The creation of two buttons with same identifiers is admitted.
297
  * The button with the identifier 0xffff at pressing is interpreted
298
  * The button with the identifier 0xffff at pressing is interpreted
298
    by the system as the button of minimization, the system handles
299
    by the system as the button of minimization, the system handles
299
    such pressing independently, not accessing to the application.
300
    such pressing independently, not accessing to the application.
300
    In rest it is usual button.
301
    In rest it is usual button.
301
  * Total number of buttons for all applications is limited to 4095.
302
  * Total number of buttons for all applications is limited to 4095.
302
 
303
 
303
======================================================================
304
======================================================================
304
============ Function 9 - information on execution thread. ===========
305
============ Function 9 - information on execution thread. ===========
305
======================================================================
306
======================================================================
306
Parameters:
307
Parameters:
307
  * eax = 9 - function number
308
  * eax = 9 - function number
308
  * ebx = pointer to 1-Kb buffer
309
  * ebx = pointer to 1-Kb buffer
309
  * ecx = number of the slot of the thread
310
  * ecx = number of the slot of the thread
310
    ecx = -1 - get information on the current thread
311
    ecx = -1 - get information on the current thread
311
Returned value:
312
Returned value:
312
  * eax = maximum number of the slot of a thread
313
  * eax = maximum number of the slot of a thread
313
  * buffer pointed to by ebx contains the following information:
314
  * buffer pointed to by ebx contains the following information:
314
    * +0: dword: usage of the processor (how many time units
315
    * +0: dword: usage of the processor (how many time units
315
      per second leaves on execution of this thread)
316
      per second leaves on execution of this thread)
316
    * +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
317
    * +6: word: (has no relation to the specified thread)
318
    * +6: word: (has no relation to the specified thread)
318
      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
319
      position ecx
320
      position ecx
320
    * +8: word: reserved
321
    * +8: word: reserved
321
    * +10 = +0xA: 11 bytes: name of the process
322
    * +10 = +0xA: 11 bytes: name of the process
322
      (name of corresponding executable file in the format 8+3)
323
      (name of corresponding executable file in the format 8+3)
323
    * +21 = +0x15: byte: alignment, this byte preserves
324
    * +21 = +0x15: byte: alignment, this byte preserves
324
    * +22 = +0x16: dword: address of the process in memory
325
    * +22 = +0x16: dword: address of the process in memory
325
    * +26 = +0x1A: dword: size of used memory - 1
326
    * +26 = +0x1A: dword: size of used memory - 1
326
    * +30 = +0x1E: dword: identifier (PID/TID)
327
    * +30 = +0x1E: dword: identifier (PID/TID)
327
    * +34 = +0x22: dword: coordinate of the thread window on axis x
328
    * +34 = +0x22: dword: coordinate of the thread window on axis x
328
    * +38 = +0x26: dword: coordinate of the thread window on axis y
329
    * +38 = +0x26: dword: coordinate of the thread window on axis y
329
    * +42 = +0x2A: dword: size of the thread window on axis x
330
    * +42 = +0x2A: dword: size of the thread window on axis x
330
    * +46 = +0x2E: dword: size of the thread window on axis y
331
    * +46 = +0x2E: dword: size of the thread window on axis y
331
    * +50 = +0x32: word: status of the thread slot:
332
    * +50 = +0x32: word: status of the thread slot:
332
      * 0 = thread is running
333
      * 0 = thread is running
333
      * 1 = thread is suspended
334
      * 1 = thread is suspended
334
      * 2 = thread is suspended while waiting for event
335
      * 2 = thread is suspended while waiting for event
335
      * 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
336
        or under duress as a result of call to subfunction 2
337
        or under duress as a result of call to subfunction 2
337
        of function 18 or termination of the system
338
        of function 18 or termination of the system
338
      * 4 = thread is terminating as a result of exception
339
      * 4 = thread is terminating as a result of exception
339
      * 5 = thread waits for event
340
      * 5 = thread waits for event
340
      * 9 = requested slot is free, all other information on the slot
341
      * 9 = requested slot is free, all other information on the slot
341
        is not meaningful
342
        is not meaningful
342
Remarks:
343
Remarks:
343
  * Slots are numbered starting from 1.
344
  * Slots are numbered starting from 1.
344
  * Returned value is not a total number of threads, because there
345
  * Returned value is not a total number of threads, because there
345
    can be free slots.
346
    can be free slots.
346
  * When process is starting, system automatically creates
347
  * When process is starting, system automatically creates
347
    execution thread.
348
    execution thread.
348
  * Function gives information on the thread. Each process has
349
  * Function gives information on the thread. Each process has
349
    at least one thread. One process can create many threads,
350
    at least one thread. One process can create many threads,
350
    in this case each thread has its own slot and the fields
351
    in this case each thread has its own slot and the fields
351
    +10, +22, +26 in these slots coincide.
352
    +10, +22, +26 in these slots coincide.
352
    Applications have no common way to define whether two threads
353
    Applications have no common way to define whether two threads
353
    belong to one process.
354
    belong to one process.
354
  * The active window - window on top of the window stack -
355
  * The active window - window on top of the window stack -
355
    receives the messages on a keyboard input. For such window
356
    receives the messages on a keyboard input. For such window
356
    the position in the window stack coincides with returned value.
357
    the position in the window stack coincides with returned value.
357
  * Slot 1 corresponds to special system thread, for which:
358
  * Slot 1 corresponds to special system thread, for which:
358
    * the window is in the bottom of the window stack, the fields
359
    * the window is in the bottom of the window stack, the fields
359
      +4 and +6 contain value 1
360
      +4 and +6 contain value 1
360
    * name of the process - "OS/IDLE" (supplemented by spaces)
361
    * name of the process - "OS/IDLE" (supplemented by spaces)
361
    * address of the process in memory is 0, size of used memory is
362
    * address of the process in memory is 0, size of used memory is
362
      16 Mb (0x1000000)
363
      16 Mb (0x1000000)
363
    * PID=1
364
    * PID=1
364
    * coordinates and sizes of the window are by convention set to 0
365
    * coordinates and sizes of the window are by convention set to 0
365
    * status of the slot is always 0 (running)
366
    * status of the slot is always 0 (running)
366
    * the execution time adds of time leaving on operations itself
367
    * the execution time adds of time leaving on operations itself
367
      and idle time in waiting for interrupt (which can be got by call
368
      and idle time in waiting for interrupt (which can be got by call
368
      to subfunction 4 of function 18).
369
      to subfunction 4 of function 18).
369
  * Beginning from slot 2, the normal applications are placed.
370
  * Beginning from slot 2, the normal applications are placed.
370
  * The normal applications are placed in memory at the address
371
  * The normal applications are placed in memory at the address
371
    0x10000000 (kernel constand 'std_application_base_address').
372
    0x10000000 (kernel constand 'std_application_base_address').
372
    There is no intersection, as each process has its own page table.
373
    There is no intersection, as each process has its own page table.
373
  * At creation of the thread it is assigned the slot
374
  * At creation of the thread it is assigned the slot
374
    in the system table and identifier (Process/Thread IDentifier =
375
    in the system table and identifier (Process/Thread IDentifier =
375
    PID/TID), which do not vary with time for given thread.
376
    PID/TID), which do not vary with time for given thread.
376
    After completion of the thread its slot can be anew used
377
    After completion of the thread its slot can be anew used
377
    for another thread. The thread identifier can not be assigned
378
    for another thread. The thread identifier can not be assigned
378
    to other thread even after completion of this thread.
379
    to other thread even after completion of this thread.
379
    Identifiers, assigned to new threads, grow monotonously.
380
    Identifiers, assigned to new threads, grow monotonously.
380
  * If the thread has not yet defined the window by call to
381
  * If the thread has not yet defined the window by call to
381
    function 0, the position and the sizes
382
    function 0, the position and the sizes
382
    of its window are considered to be zero.
383
    of its window are considered to be zero.
383
  * At the moment only the part of the buffer by a size
384
  * At the moment only the part of the buffer by a size
384
    52 = 0x34 bytes is used. Nevertheless it is recommended to use
385
    52 = 0x34 bytes is used. Nevertheless it is recommended to use
385
    1-Kb buffer for the future compatibility, in the future
386
    1-Kb buffer for the future compatibility, in the future
386
    some fields can be added.
387
    some fields can be added.
387
 
388
 
388
======================================================================
389
======================================================================
389
==================== Function 10 - wait for event. ===================
390
==================== Function 10 - wait for event. ===================
390
======================================================================
391
======================================================================
391
If the message queue is empty, waits for appearance of the message
392
If the message queue is empty, waits for appearance of the message
392
in queue. In this state thread does not consume CPU time.
393
in queue. In this state thread does not consume CPU time.
393
Then reads out the message from queue.
394
Then reads out the message from queue.
394
 
395
 
395
Parameters:
396
Parameters:
396
  * eax = 10 - function number
397
  * eax = 10 - function number
397
Returned value:
398
Returned value:
398
  * eax = event (see the list of events)
399
  * eax = event (see the list of events)
399
Remarks:
400
Remarks:
400
  * Those events are taken into account only which enter into
401
  * Those events are taken into account only which enter into
401
    a mask set by function 40. By default it is
402
    a mask set by function 40. By default it is
402
    redraw, key and button events.
403
    redraw, key and button events.
403
  * To check, whether there is a message in queue, use function 11.
404
  * To check, whether there is a message in queue, use function 11.
404
    To wait for no more than given time, use function 23.
405
    To wait for no more than given time, use function 23.
405
 
406
 
406
======================================================================
407
======================================================================
407
=============== Function 11 - check for event, no wait. ==============
408
=============== Function 11 - check for event, no wait. ==============
408
======================================================================
409
======================================================================
409
If the message queue contains event, function reads out
410
If the message queue contains event, function reads out
410
and return it. If the queue is empty, function returns 0.
411
and return it. If the queue is empty, function returns 0.
411
Parameters:
412
Parameters:
412
  * eax = 11 - function number
413
  * eax = 11 - function number
413
Returned value:
414
Returned value:
414
  * eax = 0 - message queue is empty
415
  * eax = 0 - message queue is empty
415
  * else eax = event (see the list of events)
416
  * else eax = event (see the list of events)
416
Remarks:
417
Remarks:
417
  * Those events are taken into account only, which enter into
418
  * Those events are taken into account only, which enter into
418
    a mask set by function 40. By default it is
419
    a mask set by function 40. By default it is
419
    redraw, key and button events.
420
    redraw, key and button events.
420
  * To wait for event, use function 10.
421
  * To wait for event, use function 10.
421
    To wait for no more than given time, use function 23.
422
    To wait for no more than given time, use function 23.
422
 
423
 
423
======================================================================
424
======================================================================
424
=============== Function 12 - begin/end window redraw. ===============
425
=============== Function 12 - begin/end window redraw. ===============
425
======================================================================
426
======================================================================
426
 
427
 
427
------------ Subfunction 1 - begin redraw of the window. -------------
428
---------------- Subfunction 1 - begin window redraw. ----------------
428
Parameters:
429
Parameters:
429
  * eax = 12 - function number
430
  * eax = 12 - function number
430
  * ebx = 1 - subfunction number
431
  * ebx = 1 - subfunction number
431
Returned value:
432
Returned value:
432
  * function does not return value
433
  * function does not return value
433
 
434
 
434
------------- Subfunction 2 - end redraw of the window. --------------
435
----------------- Subfunction 2 - end window redraw. -----------------
435
Parameters:
436
Parameters:
436
  * eax = 12 - function number
437
  * eax = 12 - function number
437
  * ebx = 2 - subfunction number
438
  * ebx = 2 - subfunction number
438
Returned value:
439
Returned value:
439
  * function does not return value
440
  * function does not return value
440
Remarks:
441
Remarks:
441
  * Subfunction 1 deletes all buttons defined with
442
  * Subfunction 1 deletes all buttons defined with
442
    function 8, they must be defined again.
443
    function 8, they must be defined again.
443
 
444
 
444
======================================================================
445
======================================================================
445
============ Function 13 - draw a rectangle in the window. ===========
446
============ Function 13 - draw a rectangle in the window. ===========
446
======================================================================
447
======================================================================
447
Parameters:
448
Parameters:
448
  * eax = 13 - function number
449
  * eax = 13 - function number
449
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
450
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
450
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
451
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
451
  * edx = color 0xRRGGBB or 0x80RRGGBB for gradient fill
452
  * edx = color 0xRRGGBB or 0x80RRGGBB for gradient fill
452
Returned value:
453
Returned value:
453
  * function does not return value
454
  * function does not return value
454
Remarks:
455
Remarks:
455
  * Coordinates are understood as coordinates of the left upper corner
456
  * Coordinates are understood as coordinates of the left upper corner
456
    of a rectangle relative to the window.
457
    of a rectangle relative to the window.
457
 
458
 
458
======================================================================
459
======================================================================
459
=================== Function 14 - get screen size. ===================
460
=================== Function 14 - get screen size. ===================
460
======================================================================
461
======================================================================
461
Parameters:
462
Parameters:
462
  * eax = 14 - function number
463
  * eax = 14 - function number
463
Returned value:
464
Returned value:
464
  * eax = [xsize]*65536 + [ysize], where
465
  * eax = [xsize]*65536 + [ysize], where
465
  * xsize = x-coordinate of the right lower corner of the screen =
466
  * xsize = x-coordinate of the right lower corner of the screen =
466
            horizontal size - 1
467
            horizontal size - 1
467
  * ysize = y-coordinate of the right lower corner of the screen =
468
  * ysize = y-coordinate of the right lower corner of the screen =
468
            vertical size - 1
469
            vertical size - 1
469
Remarks:
470
Remarks:
470
  * See also subfunction 5 of function 48 - get sizes of
471
  * See also subfunction 5 of function 48 - get sizes of
471
    working area of the screen.
472
    working area of the screen.
472
 
473
 
473
======================================================================
474
======================================================================
474
== Function 15, subfunction 1 - set a size of the background image. ==
475
== Function 15, subfunction 1 - set a size of the background image. ==
475
======================================================================
476
======================================================================
476
Parameters:
477
Parameters:
477
  * eax = 15 - function number
478
  * eax = 15 - function number
478
  * ebx = 1 - subfunction number
479
  * ebx = 1 - subfunction number
479
  * ecx = width of the image
480
  * ecx = width of the image
480
  * edx = height of the image
481
  * edx = height of the image
481
Returned value:
482
Returned value:
482
  * function does not return value
483
  * function does not return value
483
Remarks:
484
Remarks:
484
  * There is no checks for correctness. The setting of too large
485
  * There is no checks for correctness. The setting of too large
485
    values will result that the background will contain data abroad
486
    values will result that the background will contain data abroad
486
    of buffer for the background image. Buffer size = 0x160000-0x10,
487
    of buffer for the background image. Buffer size = 0x160000-0x10,
487
    that corresponds to maximum size 800*600. (800*600*3=0x15F900)
488
    that corresponds to maximum size 800*600. (800*600*3=0x15F900)
488
  * For update of the screen (after completion of a series of commands
489
  * For update of the screen (after completion of a series of commands
489
    working with a background) call subfunction 3.
490
    working with a background) call subfunction 3.
490
  * There is a pair function for get size of the background image -
491
  * There is a pair function for get size of the background image -
491
    subfunction 1 of function 39.
492
    subfunction 1 of function 39.
492
 
493
 
493
======================================================================
494
======================================================================
494
=== Function 15, subfunction 2 - put pixel on the background image. ==
495
=== Function 15, subfunction 2 - put pixel on the background image. ==
495
======================================================================
496
======================================================================
496
Parameters:
497
Parameters:
497
  * eax = 15 - function number
498
  * eax = 15 - function number
498
  * ebx = 2 - subfunction number
499
  * ebx = 2 - subfunction number
499
  * ecx = offset
500
  * ecx = offset
500
  * edx = color of a pixel 0xRRGGBB
501
  * edx = color of a pixel 0xRRGGBB
501
Returned value:
502
Returned value:
502
  * function does not return value
503
  * function does not return value
503
Remarks:
504
Remarks:
504
  * Offset for a pixel with coordinates (x,y) is calculated as
505
  * Offset for a pixel with coordinates (x,y) is calculated as
505
    (x+y*xsize)*3.
506
    (x+y*xsize)*3.
506
  * If the given offset exceeds 0x160000-16 = 1.375 Mb - 16 bytes,
507
  * If the given offset exceeds 0x160000-16 = 1.375 Mb - 16 bytes,
507
    the call is ignored.
508
    the call is ignored.
508
  * For update of the screen (after completion of a series of commands
509
  * For update of the screen (after completion of a series of commands
509
    working with a background) call subfunction 3.
510
    working with a background) call subfunction 3.
510
  * There is a pair function for get pixel on the background image -
511
  * There is a pair function for get pixel on the background image -
511
    subfunction 2 of function 39.
512
    subfunction 2 of function 39.
512
 
513
 
513
======================================================================
514
======================================================================
514
=========== Function 15, subfunction 3 - redraw background. ==========
515
=========== Function 15, subfunction 3 - redraw background. ==========
515
======================================================================
516
======================================================================
516
Parameters:
517
Parameters:
517
  * eax = 15 - function number
518
  * eax = 15 - function number
518
  * ebx = 3 - subfunction number
519
  * ebx = 3 - subfunction number
519
Returned value:
520
Returned value:
520
  * function does not return value
521
  * function does not return value
521
 
522
 
522
======================================================================
523
======================================================================
523
== Function 15, subfunction 4 - set drawing mode for the background. =
524
== Function 15, subfunction 4 - set drawing mode for the background. =
524
======================================================================
525
======================================================================
525
Parameters:
526
Parameters:
526
  * eax = 15 - function number
527
  * eax = 15 - function number
527
  * ebx = 4 - subfunction number
528
  * ebx = 4 - subfunction number
528
  * ecx = drawing mode:
529
  * ecx = drawing mode:
529
    * 1 = tile
530
    * 1 = tile
530
    * 2 = stretch
531
    * 2 = stretch
531
Returned value:
532
Returned value:
532
  * function does not return value
533
  * function does not return value
533
Remarks:
534
Remarks:
534
  * For update of the screen (after completion of a series of commands
535
  * For update of the screen (after completion of a series of commands
535
    working with a background) call subfunction 3.
536
    working with a background) call subfunction 3.
536
  * There is a pair function for get drawing mode of the background -
537
  * There is a pair function for get drawing mode of the background -
537
    subfunction 4 of function 39.
538
    subfunction 4 of function 39.
538
 
539
 
539
======================================================================
540
======================================================================
540
===================== Function 15, subfunction 5 =====================
541
===================== Function 15, subfunction 5 =====================
541
============ Put block of pixels on the background image. ============
542
============ Put block of pixels on the background image. ============
542
======================================================================
543
======================================================================
543
Parameters:
544
Parameters:
544
  * eax = 15 - function number
545
  * eax = 15 - function number
545
  * ebx = 5 - subfunction number
546
  * ebx = 5 - subfunction number
546
  * ecx = pointer to the data in the format BBGGRRBBGGRR...
547
  * ecx = pointer to the data in the format BBGGRRBBGGRR...
547
  * edx = offset in data of the background image
548
  * edx = offset in data of the background image
548
  * esi = size of data in bytes = 3 * number of pixels
549
  * esi = size of data in bytes = 3 * number of pixels
549
Returned value:
550
Returned value:
550
  * function does not return value
551
  * function does not return value
551
Remarks:
552
Remarks:
552
  * If the block gets out abroad 0x160000-16 = 1.375 Mb - 16 bytes,
553
  * If the block gets out abroad 0x160000-16 = 1.375 Mb - 16 bytes,
553
    the call is ignored.
554
    the call is ignored.
554
  * Color of each pixel is stored as 3-bytes value BBGGRR.
555
  * Color of each pixel is stored as 3-bytes value BBGGRR.
555
  * Pixels of the background image are written sequentially
556
  * Pixels of the background image are written sequentially
556
    from left to right, from up to down.
557
    from left to right, from up to down.
557
  * Offset of pixel with coordinates (x,y) is (x+y*xsize)*3.
558
  * Offset of pixel with coordinates (x,y) is (x+y*xsize)*3.
558
  * For update of the screen (after completion of a series of commands
559
  * For update of the screen (after completion of a series of commands
559
    working with a background) call subfunction 3.
560
    working with a background) call subfunction 3.
560
 
561
 
561
======================================================================
562
======================================================================
562
=============== Function 16 - save ramdisk on a floppy. ==============
563
=============== Function 16 - save ramdisk on a floppy. ==============
563
======================================================================
564
======================================================================
564
Parameters:
565
Parameters:
565
  * eax = 16 - function number
566
  * eax = 16 - function number
566
  * ebx = 1 or ebx = 2 - on which floppy save
567
  * ebx = 1 or ebx = 2 - on which floppy save
567
Returned value:
568
Returned value:
568
  * eax = 0 - success
569
  * eax = 0 - success
569
  * eax = 1 - error
570
  * eax = 1 - error
570
 
571
 
571
======================================================================
572
======================================================================
572
======= Function 17 - get the identifier of the pressed button. ======
573
======= Function 17 - get the identifier of the pressed button. ======
573
======================================================================
574
======================================================================
574
Takes away the code of the pressed button from the buffer.
575
Takes away the code of the pressed button from the buffer.
575
Parameters:
576
Parameters:
576
  * eax = 17 - function number
577
  * eax = 17 - function number
577
Returned value:
578
Returned value:
578
  * if the buffer is empty, function returns eax=1
579
  * if the buffer is empty, function returns eax=1
579
  * if the buffer is not empty, function returns al=0,
580
  * if the buffer is not empty, function returns al=0,
580
    high 24 bits of eax contain button identifier (in particular, ah
581
    high 24 bits of eax contain button identifier (in particular, ah
581
    contains low byte of the identifier; if all buttons have
582
    contains low byte of the identifier; if all buttons have
582
    the identifier less than 256, ah is enough to distinguish).
583
    the identifier less than 256, ah is enough to distinguish).
583
Remarks:
584
Remarks:
584
  * "Buffer" keeps only one button, at pressing the new button the
585
  * "Buffer" keeps only one button, at pressing the new button the
585
    information about old is lost.
586
    information about old is lost.
586
  * The call of this function by an application with inactive window
587
  * The call of this function by an application with inactive window
587
    will return answer "buffer is empty".
588
    will return answer "buffer is empty".
588
 
589
 
589
======================================================================
590
======================================================================
590
============ Function 18, subfunction 1 - system shutdown. ===========
591
============ Function 18, subfunction 1 - system shutdown. ===========
591
======================================================================
592
======================================================================
592
Parameters:
593
Parameters:
593
  * eax = 18 - function number
594
  * eax = 18 - function number
594
  * ebx = 1 - subfunction number
595
  * ebx = 1 - subfunction number
595
Returned value:
596
Returned value:
596
  * function always return eax = 0 as tag of success
597
  * function always return eax = 0 as tag of success
597
Remarks:
598
Remarks:
598
  * On the last step menu of exit from the system appears and waits
599
  * On the last step menu of exit from the system appears and waits
599
    response of the user.
600
    response of the user.
600
  * See also subfunction 9, system shutdown with
601
  * See also subfunction 9, system shutdown with
601
    the parameter to force the choice in the exit menu.
602
    the parameter to force the choice in the exit menu.
602
 
603
 
603
======================================================================
604
======================================================================
604
= Function 18, subfunction 2 - terminate process/thread by the slot. =
605
= Function 18, subfunction 2 - terminate process/thread by the slot. =
605
======================================================================
606
======================================================================
606
Parameters:
607
Parameters:
607
  * eax = 18 - function number
608
  * eax = 18 - function number
608
  * ebx = 2 - subfunction number
609
  * ebx = 2 - subfunction number
609
  * ecx = number of the slot of process/thread
610
  * ecx = number of the slot of process/thread
610
Returned value:
611
Returned value:
611
  * function does not return value
612
  * function does not return value
612
Remarks:
613
Remarks:
613
  * It is impossible to terminate system thread OS/IDLE (with
614
  * It is impossible to terminate system thread OS/IDLE (with
614
    number of the slot 1),
615
    number of the slot 1),
615
    it is possible to terminate any normal process/thread.
616
    it is possible to terminate any normal process/thread.
616
  * See also subfunction 18 - terminate
617
  * See also subfunction 18 - terminate
617
    process/thread by the identifier.
618
    process/thread by the identifier.
618
 
619
 
619
======================================================================
620
======================================================================
620
===================== Function 18, subfunction 3 =====================
621
===================== Function 18, subfunction 3 =====================
621
============= Make active the window of the given thread. ============
622
============= Make active the window of the given thread. ============
622
======================================================================
623
======================================================================
623
Parameters:
624
Parameters:
624
  * eax = 18 - function number
625
  * eax = 18 - function number
625
  * ebx = 3 - subfunction number
626
  * ebx = 3 - subfunction number
626
  * ecx = number of the thread slot
627
  * ecx = number of the thread slot
627
Returned value:
628
Returned value:
628
  * function does not return value
629
  * function does not return value
629
Remarks:
630
Remarks:
630
  * If correct, but nonexistent slot is given,
631
  * If correct, but nonexistent slot is given,
631
    some window is made active.
632
    some window is made active.
632
  * To find out, which window is active, use subfunction 7.
633
  * To find out, which window is active, use subfunction 7.
633
 
634
 
634
======================================================================
635
======================================================================
635
===================== Function 18, subfunction 4 =====================
636
===================== Function 18, subfunction 4 =====================
636
=========== Get counter of idle time units per one second. ===========
637
=========== Get counter of idle time units per one second. ===========
637
======================================================================
638
======================================================================
638
Idle time units are units, in which the processor stands idle
639
Idle time units are units, in which the processor stands idle
639
in waiting for interrupt (in the command 'hlt').
640
in waiting for interrupt (in the command 'hlt').
640
 
641
 
641
Parameters:
642
Parameters:
642
  * eax = 18 - function number
643
  * eax = 18 - function number
643
  * ebx = 4 - subfunction number
644
  * ebx = 4 - subfunction number
644
Returned value:
645
Returned value:
645
  * eax = value of the counter of idle time units per one second
646
  * eax = value of the counter of idle time units per one second
646
 
647
 
647
======================================================================
648
======================================================================
648
========== Function 18, subfunction 5 - get CPU clock rate. ==========
649
========== Function 18, subfunction 5 - get CPU clock rate. ==========
649
======================================================================
650
======================================================================
650
Parameters:
651
Parameters:
651
  * eax = 18 - function number
652
  * eax = 18 - function number
652
  * ebx = 5 - subfunction number
653
  * ebx = 5 - subfunction number
653
Returned value:
654
Returned value:
654
  * eax = clock rate (modulo 2^32 clock ticks = 4GHz)
655
  * eax = clock rate (modulo 2^32 clock ticks = 4GHz)
655
 
656
 
656
======================================================================
657
======================================================================
657
 Function 18, subfunction 6 - save ramdisk to the file on hard drive. 
658
 Function 18, subfunction 6 - save ramdisk to the file on hard drive. 
658
======================================================================
659
======================================================================
659
Parameters:
660
Parameters:
660
  * eax = 18 - function number
661
  * eax = 18 - function number
661
  * ebx = 6 - subfunction number
662
  * ebx = 6 - subfunction number
662
  * ecx defines path to the file:
663
  * ecx defines path to the file:
663
    * 1 = in the folder "/KOLIBRI"
664
    * 1 = in the folder "/KOLIBRI"
664
    * 2 = in the root folder
665
    * 2 = in the root folder
665
    * 3 = edx points to the path (names of folders in the format 8+3,
666
    * 3 = edx points to the path (names of folders in the format 8+3,
666
      divided by '/')
667
      divided by '/')
667
Returned value:
668
Returned value:
668
  * eax = 0 - success
669
  * eax = 0 - success
669
  * else eax = error code of the file system
670
  * else eax = error code of the file system
670
Çàìå÷àíèÿ:
671
Çàìå÷àíèÿ:
671
  * Filename is fixed, "menuet.img" (global kernel variable
672
  * Filename is fixed, "menuet.img" (global kernel variable
672
    'image_save' from 'preboot.inc')
673
    'image_save' from 'preboot.inc')
673
  * Drive and partition are defined by subfunction 7
674
  * Drive and partition are defined by subfunction 7
674
    and subfunction 8 of function 21.
675
    and subfunction 8 of function 21.
675
  * All folders in the given path must exist, otherwise function
676
  * All folders in the given path must exist, otherwise function
676
    returns value 5, "file not found".
677
    returns value 5, "file not found".
677
 
678
 
678
======================================================================
679
======================================================================
679
=========== Function 18, subfunction 7 - get active window. ==========
680
=========== Function 18, subfunction 7 - get active window. ==========
680
======================================================================
681
======================================================================
681
Parameters:
682
Parameters:
682
  * eax = 18 - function number
683
  * eax = 18 - function number
683
  * ebx = 7 - subfunction number
684
  * ebx = 7 - subfunction number
684
Returned value:
685
Returned value:
685
  * eax = number of the active window
686
  * eax = number of the active window
686
    (number of the slot of the thread with active window)
687
    (number of the slot of the thread with active window)
687
Remarks:
688
Remarks:
688
  * Active window is at the top of the window stack and receives
689
  * Active window is at the top of the window stack and receives
689
    messages on all keyboard input.
690
    messages on all keyboard input.
690
  * To make a window active, use subfunction 3.
691
  * To make a window active, use subfunction 3.
691
 
692
 
692
======================================================================
693
======================================================================
693
== Function 18, subfunction 8 - disable/enable the internal speaker. =
694
== Function 18, subfunction 8 - disable/enable the internal speaker. =
694
======================================================================
695
======================================================================
695
If speaker sound is disabled, all calls to subfunction 55 of
696
If speaker sound is disabled, all calls to subfunction 55 of
696
function 55 are ignored. If speaker sound is enabled,
697
function 55 are ignored. If speaker sound is enabled,
697
they are routed on builtin speaker.
698
they are routed on builtin speaker.
698
 
699
 
699
------------------- Subsubfunction 1 - get status. -------------------
700
------------------- Subsubfunction 1 - get status. -------------------
700
Parameters:
701
Parameters:
701
  * eax = 18 - function number
702
  * eax = 18 - function number
702
  * ebx = 8 - subfunction number
703
  * ebx = 8 - subfunction number
703
  * ecx = 1 - number of the subsubfunction
704
  * ecx = 1 - number of the subsubfunction
704
Returned value:
705
Returned value:
705
  * eax = 0 - speaker sound is enabled; 1 - disabled
706
  * eax = 0 - speaker sound is enabled; 1 - disabled
706
 
707
 
707
----------------- Subsubfunction 2 - toggle status. ------------------
708
----------------- Subsubfunction 2 - toggle status. ------------------
708
Toggles states of disable/enable.
709
Toggles states of disable/enable.
709
Parameters:
710
Parameters:
710
  * eax = 18 - function number
711
  * eax = 18 - function number
711
  * ebx = 8 - subfunction number
712
  * ebx = 8 - subfunction number
712
  * ecx = 2 - number of the subsubfunction
713
  * ecx = 2 - number of the subsubfunction
713
Returned value:
714
Returned value:
714
  * function does not return value
715
  * function does not return value
715
 
716
 
716
======================================================================
717
======================================================================
717
== Function 18, subfunction 9 - system shutdown with the parameter. ==
718
== Function 18, subfunction 9 - system shutdown with the parameter. ==
718
======================================================================
719
======================================================================
719
Parameters:
720
Parameters:
720
  * eax = 18 - function number
721
  * eax = 18 - function number
721
  * ebx = 9 - subfunction number
722
  * ebx = 9 - subfunction number
722
  * ecx = parameter:
723
  * ecx = parameter:
723
    * 1 = on the last step of shutdown save ramdisk on a floppy and
724
    * 1 = on the last step of shutdown save ramdisk on a floppy and
724
      then show the exit menu and request further operations
725
      then show the exit menu and request further operations
725
      from the user
726
      from the user
726
    * 2 = turn off computer
727
    * 2 = turn off computer
727
    * 3 = reboot computer
728
    * 3 = reboot computer
728
    * 4 = restart the kernel from the file 'kernel.mnt' on ramdisk
729
    * 4 = restart the kernel from the file 'kernel.mnt' on ramdisk
729
Returned value:
730
Returned value:
730
  * at incorrect ecx the registers do not change (i.e. eax=18)
731
  * at incorrect ecx the registers do not change (i.e. eax=18)
731
  * by correct call function always returns eax=0
732
  * by correct call function always returns eax=0
732
    as the tag of success
733
    as the tag of success
733
Remarks:
734
Remarks:
734
  * Do not rely on returned value by incorrect call, it can be
735
  * Do not rely on returned value by incorrect call, it can be
735
    changed in future versions of the kernel.
736
    changed in future versions of the kernel.
736
  * It is possible to use subfunction 1, that on the last step
737
  * It is possible to use subfunction 1, that on the last step
737
    the user makes choice himself.
738
    the user makes choice himself.
738
  * It is not recommended to use value ecx=1 (to not irritate the user
739
  * It is not recommended to use value ecx=1 (to not irritate the user
739
    with excessive questions); to save ramdisk on a floppy use
740
    with excessive questions); to save ramdisk on a floppy use
740
    function 16 (which admits specification, on which floppy to
741
    function 16 (which admits specification, on which floppy to
741
    write), and to shutdown with the exit menu use already mentioned
742
    write), and to shutdown with the exit menu use already mentioned
742
    subfunction 1.
743
    subfunction 1.
743
 
744
 
744
======================================================================
745
======================================================================
745
===== Function 18, subfunction 10 - minimize application window. =====
746
===== Function 18, subfunction 10 - minimize application window. =====
746
======================================================================
747
======================================================================
747
Minimizes the own window.
748
Minimizes the own window.
748
Parameters:
749
Parameters:
749
  * eax = 18 - function number
750
  * eax = 18 - function number
750
  * ebx = 10 - subfunction number
751
  * ebx = 10 - subfunction number
751
Returned value:
752
Returned value:
752
  * function does not return value
753
  * function does not return value
753
Remarks:
754
Remarks:
754
  * The minimized window from the point of view of function 9
755
  * The minimized window from the point of view of function 9
755
    keeps position and sizes.
756
    keeps position and sizes.
756
  * Restoring of an application window occurs at its activation by 
757
  * Restoring of an application window occurs at its activation by 
757
    subfunction 3.
758
    subfunction 3.
758
  * Usually there is no necessity to minimize/restire a window
759
  * Usually there is no necessity to minimize/restire a window
759
    obviously: minimization of a window is carried out by the system
760
    obviously: minimization of a window is carried out by the system
760
    at pressing the minimization button (for skinned windows
761
    at pressing the minimization button (for skinned windows
761
    it is defined automatically by function 0,
762
    it is defined automatically by function 0,
762
    for other windows it can be defined manually by function 8),
763
    for other windows it can be defined manually by function 8),
763
    restore of a window is done by the application '@panel'.
764
    restore of a window is done by the application '@panel'.
764
 
765
 
765
======================================================================
766
======================================================================
766
 Function 18, subfunction 11 - get information on the disk subsystem. 
767
 Function 18, subfunction 11 - get information on the disk subsystem. 
767
======================================================================
768
======================================================================
768
Parameters:
769
Parameters:
769
  * eax = 18 - function number
770
  * eax = 18 - function number
770
  * ebx = 11 - subfunction number
771
  * ebx = 11 - subfunction number
771
  * ecx = type of the table:
772
  * ecx = type of the table:
772
    * 1 = short version, 10 bytes
773
    * 1 = short version, 10 bytes
773
    * 2 = full version, 65536 bytes
774
    * 2 = full version, 65536 bytes
774
  * edx = pointer to the buffer (in the application) for the table
775
  * edx = pointer to the buffer (in the application) for the table
775
Returned value:
776
Returned value:
776
  * function does not return value
777
  * function does not return value
777
Format of the table: short version:
778
Format of the table: short version:
778
  * +0: byte: information about FDD's (drives for floppies),
779
  * +0: byte: information about FDD's (drives for floppies),
779
    AAAABBBB, where AAAA gives type of the first drive, BBBB -
780
    AAAABBBB, where AAAA gives type of the first drive, BBBB -
780
    of the second regarding to the following list:
781
    of the second regarding to the following list:
781
    * 0 = there is no drive
782
    * 0 = there is no drive
782
    * 1 = 360Kb, 5.25''
783
    * 1 = 360Kb, 5.25''
783
    * 2 = 1.2Mb, 5.25''
784
    * 2 = 1.2Mb, 5.25''
784
    * 3 = 720Kb, 3.5''
785
    * 3 = 720Kb, 3.5''
785
    * 4 = 1.44Mb, 3.5''
786
    * 4 = 1.44Mb, 3.5''
786
    * 5 = 2.88Mb, 3.5'' (such drives are not used anymore)
787
    * 5 = 2.88Mb, 3.5'' (such drives are not used anymore)
787
    For example, for the standard configuration from one 1.44-drive
788
    For example, for the standard configuration from one 1.44-drive
788
    here will be 40h, and for the case 1.2Mb on A: and 1.44Mb on B:
789
    here will be 40h, and for the case 1.2Mb on A: and 1.44Mb on B:
789
    the value is 24h.
790
    the value is 24h.
790
  * +1: byte: information about hard disks and CD-drives, AABBCCDD,
791
  * +1: byte: information about hard disks and CD-drives, AABBCCDD,
791
    where AA corresponds to the controller IDE0, ..., DD - IDE3:
792
    where AA corresponds to the controller IDE0, ..., DD - IDE3:
792
    * 0 = device is absent
793
    * 0 = device is absent
793
    * 1 = hard drive
794
    * 1 = hard drive
794
    * 2 = CD-drive
795
    * 2 = CD-drive
795
    For example, in the case HD on IDE0 and CD on IDE2
796
    For example, in the case HD on IDE0 and CD on IDE2
796
    this field contains 48h.
797
    this field contains 48h.
797
  * +2: 4 db: number of the retrieved partitions on hard disks
798
  * +2: 4 db: number of the retrieved partitions on hard disks
798
    at accordingly IDE0,...,IDE3.
799
    at accordingly IDE0,...,IDE3.
799
    If the hard disk on IDEx is absent, appropriate byte is zero,
800
    If the hard disk on IDEx is absent, appropriate byte is zero,
800
    otherwise it shows number of the recognized partitions, which
801
    otherwise it shows number of the recognized partitions, which
801
    can be not presented (if the drive is not formatted or if
802
    can be not presented (if the drive is not formatted or if
802
    the file system is not supported). Current version of the kernel
803
    the file system is not supported). Current version of the kernel
803
    supports only FAT16 and FAT32 for hard disks.
804
    supports only FAT16 and FAT32 for hard disks.
804
  * +6: 4 db: reserved
805
  * +6: 4 db: reserved
805
Format of the table: full version:
806
Format of the table: full version:
806
  * +0: 10 db: same as for the short version
807
  * +0: 10 db: same as for the short version
807
  * +10: 100 db: data for the first partition
808
  * +10: 100 db: data for the first partition
808
  * +110: 100 db: data for the second partition
809
  * +110: 100 db: data for the second partition
809
  * ...
810
  * ...
810
  * +10+100*(n-1): 100 db: data for the last partition
811
  * +10+100*(n-1): 100 db: data for the last partition
811
The partitions are located as follows: at first sequentially all
812
The partitions are located as follows: at first sequentially all
812
recoginzed partitions on HD on IDE0 (if present),
813
recoginzed partitions on HD on IDE0 (if present),
813
then on HD on IDE1 (if present) and so on up to IDE3.
814
then on HD on IDE1 (if present) and so on up to IDE3.
814
Format of the information about partition
815
Format of the information about partition
815
(at moment only FAT is supported):
816
(at moment only FAT is supported):
816
  * +0: dword: first physical sector of the partition
817
  * +0: dword: first physical sector of the partition
817
  * +4: dword: last physical sector of the partition
818
  * +4: dword: last physical sector of the partition
818
    (belongs to the partition)
819
    (belongs to the partition)
819
  * +8: dword: sectors per one copy of FAT
820
  * +8: dword: sectors per one copy of FAT
820
  * +12 = +0xC: dword: number of copies of FAT
821
  * +12 = +0xC: dword: number of copies of FAT
821
  * +16 = +0x10: dword: number of sectors per cluster
822
  * +16 = +0x10: dword: number of sectors per cluster
822
  * +20 = +0x14: dword: bytes per sector;
823
  * +20 = +0x14: dword: bytes per sector;
823
    current implementation expects 0x200 = 512 in this field
824
    current implementation expects 0x200 = 512 in this field
824
  * +24 = +0x18: dword: first root cluster in FAT32, 0 for FAT16
825
  * +24 = +0x18: dword: first root cluster in FAT32, 0 for FAT16
825
  * +28 = +0x1C: dword: first physical sector of FAT
826
  * +28 = +0x1C: dword: first physical sector of FAT
826
  * +32 = +0x20: dword: first physical root sector for FAT16,
827
  * +32 = +0x20: dword: first physical root sector for FAT16,
827
    ignored for FAT32
828
    ignored for FAT32
828
  * +36 = +0x24: dword: number of root sectors for FAT16,
829
  * +36 = +0x24: dword: number of root sectors for FAT16,
829
    0 for FAT32
830
    0 for FAT32
830
  * +40 = +0x28: dword: physical sector of the beginning of
831
  * +40 = +0x28: dword: physical sector of the beginning of
831
    the data area
832
    the data area
832
  * +44 = +0x2C: dword: maximum number of a cluster
833
  * +44 = +0x2C: dword: maximum number of a cluster
833
  * +48 = +0x30: dword: physical sector of the information
834
  * +48 = +0x30: dword: physical sector of the information
834
    about the file system for FAT32, ignored for FAT16
835
    about the file system for FAT32, ignored for FAT16
835
  * +52 = +0x34: dword: value used as boundary for special
836
  * +52 = +0x34: dword: value used as boundary for special
836
    values in FAT
837
    values in FAT
837
  * +56 = +0x38: dword: value used for bad clusters in FAT
838
  * +56 = +0x38: dword: value used for bad clusters in FAT
838
  * +60 = +0x3C: dword: value used as the end marker for FAT chain
839
  * +60 = +0x3C: dword: value used as the end marker for FAT chain
839
  * +64 = +0x40: dword: mask for FAT items
840
  * +64 = +0x40: dword: mask for FAT items
840
  * +68 = +0x44: byte: file system type: 16 èëè 32
841
  * +68 = +0x44: byte: file system type: 16 èëè 32
841
  * +69 = +0x45: 31 db: reserved
842
  * +69 = +0x45: 31 db: reserved
842
Remarks:
843
Remarks:
843
  * The short table can be used for obtaining the information about
844
  * The short table can be used for obtaining the information about
844
    available devices.
845
    available devices.
845
  * First two fields in the information about partition
846
  * First two fields in the information about partition
846
    gives the parameters of partition, other - parameters of
847
    gives the parameters of partition, other - parameters of
847
    FAT file system. For other file systems (when they will be
848
    FAT file system. For other file systems (when they will be
848
    supported) specific for file system information will be, of
849
    supported) specific for file system information will be, of
849
    course, another, but first two fields will have the same sense.
850
    course, another, but first two fields will have the same sense.
850
 
851
 
851
======================================================================
852
======================================================================
852
========== Function 18, subfunction 13 - get kernel version. =========
853
========== Function 18, subfunction 13 - get kernel version. =========
853
======================================================================
854
======================================================================
854
Parameters:
855
Parameters:
855
  * eax = 18 - function number
856
  * eax = 18 - function number
856
  * ebx = 13 - subfunction number
857
  * ebx = 13 - subfunction number
857
  * ecx = pointer to the buffer (not less than 16 bytes), where
858
  * ecx = pointer to the buffer (not less than 16 bytes), where
858
    the information will be placed
859
    the information will be placed
859
Returned value:
860
Returned value:
860
  * function does not return value
861
  * function does not return value
861
Structure of the buffer:
862
Structure of the buffer:
862
db a,b,c,d for version a.b.c.d
863
db a,b,c,d for version a.b.c.d
863
db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
864
db UID_xxx: one of UID_NONE=0, UID_MENUET=1, UID_KOLIBRI=2
864
db 'name',0 - ASCIIZ-string with the name
865
db 'name',0 - ASCIIZ-string with the name
865
For Kolibri 0.5.8.1 kernel:
866
For Kolibri 0.5.8.1 kernel:
866
db 0,5,8,1
867
db 0,5,8,1
867
db 2
868
db 2
868
db 'Kolibri',0
869
db 'Kolibri',0
869
 
870
 
870
======================================================================
871
======================================================================
871
======= Function 18, subfunction 14 - wait for screen retrace. =======
872
======= Function 18, subfunction 14 - wait for screen retrace. =======
872
======================================================================
873
======================================================================
873
Waits for the beginning of retrace of the scanning ray of the screen
874
Waits for the beginning of retrace of the scanning ray of the screen
874
monitor.
875
monitor.
875
Parameters:
876
Parameters:
876
  * eax = 18 - function number
877
  * eax = 18 - function number
877
  * ebx = 14 - subfunction number
878
  * ebx = 14 - subfunction number
878
Returned value:
879
Returned value:
879
  * eax = 0 as the tag of success
880
  * eax = 0 as the tag of success
880
Remarks:
881
Remarks:
881
  * Function is intended only for active high-efficiency graphics
882
  * Function is intended only for active high-efficiency graphics
882
    applications; is used for smooth output of a graphics.
883
    applications; is used for smooth output of a graphics.
883
 
884
 
884
======================================================================
885
======================================================================
885
== Function 18, subfunction 15 - center mouse cursor on the screen. ==
886
== Function 18, subfunction 15 - center mouse cursor on the screen. ==
886
======================================================================
887
======================================================================
887
Parameters:
888
Parameters:
888
  * eax = 18 - function number
889
  * eax = 18 - function number
889
  * ebx = 15 - subfunction number
890
  * ebx = 15 - subfunction number
890
Returned value:
891
Returned value:
891
  * eax = 0 as the tag of success
892
  * eax = 0 as the tag of success
892
 
893
 
893
======================================================================
894
======================================================================
894
========= Function 18, subfunction 16 - get size of free RAM. ========
895
========= Function 18, subfunction 16 - get size of free RAM. ========
895
======================================================================
896
======================================================================
896
Parameters:
897
Parameters:
897
  * eax = 18 - function number
898
  * eax = 18 - function number
898
  * ebx = 16 - subfunction number
899
  * ebx = 16 - subfunction number
899
Returned value:
900
Returned value:
900
  * eax = size of free memory in kilobytes
901
  * eax = size of free memory in kilobytes
901
 
902
 
902
======================================================================
903
======================================================================
903
======== Function 18, subfunction 17 - get full amount of RAM. =======
904
======== Function 18, subfunction 17 - get full amount of RAM. =======
904
======================================================================
905
======================================================================
905
Parameters:
906
Parameters:
906
  * eax = 18 - function number
907
  * eax = 18 - function number
907
  * ebx = 17 - subfunction number
908
  * ebx = 17 - subfunction number
908
Returned value:
909
Returned value:
909
  * eax = total size of existing memory in kilobytes
910
  * eax = total size of existing memory in kilobytes
910
 
911
 
911
======================================================================
912
======================================================================
912
===================== Function 18, subfunction 18 ====================
913
===================== Function 18, subfunction 18 ====================
913
============= Terminate process/thread by the identifier. ============
914
============= Terminate process/thread by the identifier. ============
914
======================================================================
915
======================================================================
915
Parameters:
916
Parameters:
916
  * eax = 18 - function number
917
  * eax = 18 - function number
917
  * ebx = 18 - subfunction number
918
  * ebx = 18 - subfunction number
918
  * ecx = identifer of process/thread (PID/TID)
919
  * ecx = identifer of process/thread (PID/TID)
919
Returned value:
920
Returned value:
920
  * eax = 0 - success
921
  * eax = 0 - success
921
  * eax = -1 - error (process is not found or is system)
922
  * eax = -1 - error (process is not found or is system)
922
Remarks:
923
Remarks:
923
  * It is impossible to terminate system thread OS/IDLE (identifier
924
  * It is impossible to terminate system thread OS/IDLE (identifier
924
    1), it is possible to terminate any normal process/thread.
925
    1), it is possible to terminate any normal process/thread.
925
  * See also subfunction 2 - terminate
926
  * See also subfunction 2 - terminate
926
    process/thread by given slot.
927
    process/thread by given slot.
927
 
928
 
928
======================================================================
929
======================================================================
929
======== Function 18, subfunction 19 - get/set mouse features. =======
930
======== Function 18, subfunction 19 - get/set mouse features. =======
930
======================================================================
931
======================================================================
931
 
932
 
932
---------------- Subsubfunction 0 - get mouse speed. -----------------
933
---------------- Subsubfunction 0 - get mouse speed. -----------------
933
Parameters:
934
Parameters:
934
  * eax = 18 - function number
935
  * eax = 18 - function number
935
  * ebx = 19 - subfunction number
936
  * ebx = 19 - subfunction number
936
  * ecx = 0 - subsubfunction number
937
  * ecx = 0 - subsubfunction number
937
Returned value:
938
Returned value:
938
  * eax = current mouse speed
939
  * eax = current mouse speed
939
 
940
 
940
---------------- Subsubfunction 1 - set mouse speed. -----------------
941
---------------- Subsubfunction 1 - set mouse speed. -----------------
941
Parameters:
942
Parameters:
942
  * eax = 18 - function number
943
  * eax = 18 - function number
943
  * ebx = 19 - subfunction number
944
  * ebx = 19 - subfunction number
944
  * ecx = 1 - subsubfunction number
945
  * ecx = 1 - subsubfunction number
945
  * edx = new value for speed
946
  * edx = new value for speed
946
Returned value:
947
Returned value:
947
  * function does not return value
948
  * function does not return value
948
 
949
 
949
---------------- Subsubfunction 2 - get mouse delay. -----------------
950
---------------- Subsubfunction 2 - get mouse delay. -----------------
950
Parameters:
951
Parameters:
951
  * eax = 18 - function number
952
  * eax = 18 - function number
952
  * ebx = 19 - subfunction number
953
  * ebx = 19 - subfunction number
953
  * ecx = 2 - subsubfunction number
954
  * ecx = 2 - subsubfunction number
954
Returned value:
955
Returned value:
955
  * eax = current mouse delay
956
  * eax = current mouse delay
956
 
957
 
957
---------------- Subsubfunction 3 - set mouse delay. -----------------
958
---------------- Subsubfunction 3 - set mouse delay. -----------------
958
Parameters:
959
Parameters:
959
  * eax = 18 - function number
960
  * eax = 18 - function number
960
  * ebx = 19 - subfunction number
961
  * ebx = 19 - subfunction number
961
  * ecx = 3 - subsubfunction number
962
  * ecx = 3 - subsubfunction number
962
  * edx = new value for mouse delay
963
  * edx = new value for mouse delay
963
Returned value:
964
Returned value:
964
  * function does not return value
965
  * function does not return value
965
 
966
 
966
----------- Subsubfunction 4 - set mouse pointer position. -----------
967
----------- Subsubfunction 4 - set mouse pointer position. -----------
967
Parameters:
968
Parameters:
968
  * eax = 18 - function number
969
  * eax = 18 - function number
969
  * ebx = 19 - subfunction number
970
  * ebx = 19 - subfunction number
970
  * ecx = 4 - subsubfunction number
971
  * ecx = 4 - subsubfunction number
971
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
972
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
972
Returned value:
973
Returned value:
973
  * function does not return value
974
  * function does not return value
974
Remarks:
975
Remarks:
975
  * It is recommended to set speed of the mouse (in subsubfunction 1)
976
  * It is recommended to set speed of the mouse (in subsubfunction 1)
976
    from 1 up to 9. The installed value is not inspected by the kernel
977
    from 1 up to 9. The installed value is not inspected by the kernel
977
    code, so set it carefully, at incorrect value the cursor
978
    code, so set it carefully, at incorrect value the cursor
978
    can "freeze". Speed of the mouse can be regulated through the
979
    can "freeze". Speed of the mouse can be regulated through the
979
    application SETUP.
980
    application SETUP.
980
  * Recommended delay of the mouse (in subsubfunction 3) = 10. Lower
981
  * Recommended delay of the mouse (in subsubfunction 3) = 10. Lower
981
    value is not handled by COM mice. At the very large values the
982
    value is not handled by COM mice. At the very large values the
982
    movement of the mouse on 1 pixel is impossible and the cursor will
983
    movement of the mouse on 1 pixel is impossible and the cursor will
983
    jump on the value of installed speed (subsubfunction 1). The
984
    jump on the value of installed speed (subsubfunction 1). The
984
    installed value is not inspected by the kernel code.
985
    installed value is not inspected by the kernel code.
985
    Mouse delay can be regulated through the application SETUP.
986
    Mouse delay can be regulated through the application SETUP.
986
  * The subsubfunction 4 does not check the passed value. Before
987
  * The subsubfunction 4 does not check the passed value. Before
987
    its call find out current screen resolution (with function 14)
988
    its call find out current screen resolution (with function 14)
988
    and check that the value of position is inside the limits of the
989
    and check that the value of position is inside the limits of the
989
    screen.
990
    screen.
990
 
991
 
991
======================================================================
992
======================================================================
992
============ Function 19 - start application from ramdisk. ===========
993
============ Function 19 - start application from ramdisk. ===========
993
======================================================================
994
======================================================================
994
Parameters:
995
Parameters:
995
  * eax = 19 - function number
996
  * eax = 19 - function number
996
  * ebx = pointer to the application name in format similar
997
  * ebx = pointer to the application name in format similar
997
    to function 6
998
    to function 6
998
  * ecx = 0 or ecx = pointer to command line parameters
999
  * ecx = 0 or ecx = pointer to command line parameters
999
Returned value:
1000
Returned value:
1000
  * If eax > 0, then eax contains PID of the created process
1001
  * If eax > 0, then eax contains PID of the created process
1001
  * If eax < 0, then -eax - file system error code
1002
  * If eax < 0, then -eax - file system error code
1002
Remarks:
1003
Remarks:
1003
  * This function is obsolete; use subfunction 7 of function 70.
1004
  * This function is obsolete; use subfunction 7 of function 70.
1004
  * Command line must be terminated by the character with the code 0
1005
  * Command line must be terminated by the character with the code 0
1005
    (ASCIIZ-string); function takes into account either all characters
1006
    (ASCIIZ-string); function takes into account either all characters
1006
    up to terminating zero inclusively or first 256 character
1007
    up to terminating zero inclusively or first 256 character
1007
    regarding what is less.
1008
    regarding what is less.
1008
 
1009
 
1009
======================================================================
1010
======================================================================
1010
==================== Function 20 - MIDI interface. ===================
1011
==================== Function 20 - MIDI interface. ===================
1011
======================================================================
1012
======================================================================
1012
 
1013
 
1013
----------------------- Subfunction 1 - reset ------------------------
1014
----------------------- Subfunction 1 - reset ------------------------
1014
Parameters:
1015
Parameters:
1015
  * eax = 20 - function number
1016
  * eax = 20 - function number
1016
  * ebx = 1 - subfunction number
1017
  * ebx = 1 - subfunction number
1017
 
1018
 
1018
-------------------- Subfunction 2 - output byte ---------------------
1019
-------------------- Subfunction 2 - output byte ---------------------
1019
Parameters:
1020
Parameters:
1020
  * eax = 20 - function number
1021
  * eax = 20 - function number
1021
  * ebx = 2 - subfunction number
1022
  * ebx = 2 - subfunction number
1022
  * cl = byte for output
1023
  * cl = byte for output
1023
Returned value (is the same for both subfunctions):
1024
Returned value (is the same for both subfunctions):
1024
  * eax = 0 - success
1025
  * eax = 0 - success
1025
  * eax = 1 - base port is not defined
1026
  * eax = 1 - base port is not defined
1026
Remarks:
1027
Remarks:
1027
  * Previously the base port must be defined by 
1028
  * Previously the base port must be defined by 
1028
    subfunction 1 of function 21.
1029
    subfunction 1 of function 21.
1029
 
1030
 
1030
======================================================================
1031
======================================================================
1031
======== Function 21, subfunction 1 - set MPU MIDI base port. ========
1032
======== Function 21, subfunction 1 - set MPU MIDI base port. ========
1032
======================================================================
1033
======================================================================
1033
Parameters:
1034
Parameters:
1034
  * eax = 21 - function number
1035
  * eax = 21 - function number
1035
  * ebx = 1 - subfunction number
1036
  * ebx = 1 - subfunction number
1036
  * ecx = number of base port
1037
  * ecx = number of base port
1037
Returned value
1038
Returned value
1038
  * eax = 0 - success
1039
  * eax = 0 - success
1039
  * eax = -1 - erratic number of a port
1040
  * eax = -1 - erratic number of a port
1040
Remarks:
1041
Remarks:
1041
  * Number of a port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1042
  * Number of a port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1042
  * The installation of base is necessary for function 20.
1043
  * The installation of base is necessary for function 20.
1043
  * To get base port use subfunction 1 of function 26.
1044
  * To get base port use subfunction 1 of function 26.
1044
 
1045
 
1045
======================================================================
1046
======================================================================
1046
========== Function 21, subfunction 2 - set keyboard layout. =========
1047
========== Function 21, subfunction 2 - set keyboard layout. =========
1047
======================================================================
1048
======================================================================
1048
Keyboard layout is used to convert keyboard scancodes to ASCII-codes,
1049
Keyboard layout is used to convert keyboard scancodes to ASCII-codes,
1049
which will be read by function 2.
1050
which will be read by function 2.
1050
Parameters:
1051
Parameters:
1051
  * eax = 21 - function number
1052
  * eax = 21 - function number
1052
  * ebx = 2 - subfunction number
1053
  * ebx = 2 - subfunction number
1053
  * ecx = which layout to set:
1054
  * ecx = which layout to set:
1054
    * 1 = normal layout
1055
    * 1 = normal layout
1055
    * 2 = layout at pressed Shift
1056
    * 2 = layout at pressed Shift
1056
    * 3 = layout at pressed Alt
1057
    * 3 = layout at pressed Alt
1057
  * edx = pointer to layout - table of length 128 bytes
1058
  * edx = pointer to layout - table of length 128 bytes
1058
Or:
1059
Or:
1059
  * ecx = 9
1060
  * ecx = 9
1060
  * dx = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1061
  * dx = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1061
Returned value:
1062
Returned value:
1062
  * eax = 0 - success
1063
  * eax = 0 - success
1063
  * eax = 1 - incorrect parameter
1064
  * eax = 1 - incorrect parameter
1064
Remarks:
1065
Remarks:
1065
  * If Alt is pressed, the layout with Alt is used;
1066
  * If Alt is pressed, the layout with Alt is used;
1066
    if Alt is not pressed, but Shift is pressed,
1067
    if Alt is not pressed, but Shift is pressed,
1067
    the layout with Shift is used;
1068
    the layout with Shift is used;
1068
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1069
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1069
    layout is used and then from the code is subtracted 0x60;
1070
    layout is used and then from the code is subtracted 0x60;
1070
    if no control key is pressed, the normal layout is used.
1071
    if no control key is pressed, the normal layout is used.
1071
  * To get layout and country identifier use 
1072
  * To get layout and country identifier use 
1072
    subfunction 2 of function 26.
1073
    subfunction 2 of function 26.
1073
  * Country identifier is global system variable, which is not used
1074
  * Country identifier is global system variable, which is not used
1074
    by the kernel itself; however the application '@panel' displays
1075
    by the kernel itself; however the application '@panel' displays
1075
    the corresponding icon.
1076
    the corresponding icon.
1076
  * The application @panel switches layouts on user request.
1077
  * The application @panel switches layouts on user request.
1077
 
1078
 
1078
======================================================================
1079
======================================================================
1079
============== Function 21, subfunction 3 - set CD base. =============
1080
============== Function 21, subfunction 3 - set CD base. =============
1080
======================================================================
1081
======================================================================
1081
Parameters:
1082
Parameters:
1082
  * eax = 21 - function number
1083
  * eax = 21 - function number
1083
  * ebx = 3 - subfunction number
1084
  * ebx = 3 - subfunction number
1084
  * ecx = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1085
  * ecx = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1085
Returned value:
1086
Returned value:
1086
  * eax = 0
1087
  * eax = 0
1087
Remarks:
1088
Remarks:
1088
  * CD base is used by function 24.
1089
  * CD base is used by function 24.
1089
  * To get CD base use subfunction 3 of function 26.
1090
  * To get CD base use subfunction 3 of function 26.
1090
 
1091
 
1091
======================================================================
1092
======================================================================
1092
====== Function 21, subfunction 4 - set Sound Blaster base port. =====
1093
====== Function 21, subfunction 4 - set Sound Blaster base port. =====
1093
======================================================================
1094
======================================================================
1094
Parameters:
1095
Parameters:
1095
  * eax = 21 - function number
1096
  * eax = 21 - function number
1096
  * ebx = 4 - subfunction number
1097
  * ebx = 4 - subfunction number
1097
  * ecx = number of the base port
1098
  * ecx = number of the base port
1098
Returned value:
1099
Returned value:
1099
  * eax = 0 - success
1100
  * eax = 0 - success
1100
  * eax = -1 - erratic port number
1101
  * eax = -1 - erratic port number
1101
Remarks:
1102
Remarks:
1102
  * Number of the port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1103
  * Number of the port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1103
  * The installation of the base is necessary for
1104
  * The installation of the base is necessary for
1104
    functions 25, 28, 55.
1105
    functions 25, 28, 55.
1105
  * To get base port use subfunction 4 of function 26.
1106
  * To get base port use subfunction 4 of function 26.
1106
 
1107
 
1107
======================================================================
1108
======================================================================
1108
========== Function 21, subfunction 5 - set system language. =========
1109
========== Function 21, subfunction 5 - set system language. =========
1109
======================================================================
1110
======================================================================
1110
Parameters:
1111
Parameters:
1111
  * eax = 21 - function number
1112
  * eax = 21 - function number
1112
  * ebx = 5 - subfunction number
1113
  * ebx = 5 - subfunction number
1113
  * ecx = system language (1=eng, 2=fi, 3=ger, 4=rus)
1114
  * ecx = system language (1=eng, 2=fi, 3=ger, 4=rus)
1114
Returned value:
1115
Returned value:
1115
  * eax = 0
1116
  * eax = 0
1116
Remarks:
1117
Remarks:
1117
  * System language is global system variable and is not used
1118
  * System language is global system variable and is not used
1118
    by the kernel itself, however application @panel draws the
1119
    by the kernel itself, however application @panel draws the
1119
    appropriate icon.
1120
    appropriate icon.
1120
  * Function does not check for correctness, as the kernel does not
1121
  * Function does not check for correctness, as the kernel does not
1121
    use this variable.
1122
    use this variable.
1122
  * To get system language use subfunction 5 of function 26.
1123
  * To get system language use subfunction 5 of function 26.
1123
 
1124
 
1124
======================================================================
1125
======================================================================
1125
=========== Function 21, subfunction 6 - set WSS base port. ==========
1126
=========== Function 21, subfunction 6 - set WSS base port. ==========
1126
======================================================================
1127
======================================================================
1127
Parameters:
1128
Parameters:
1128
  * eax = 21 - function number
1129
  * eax = 21 - function number
1129
  * ebx = 6 - subfunction number
1130
  * ebx = 6 - subfunction number
1130
  * ecx = base port
1131
  * ecx = base port
1131
Returned value:
1132
Returned value:
1132
  * eax = 0 - success
1133
  * eax = 0 - success
1133
  * eax = -1 - erratic port number
1134
  * eax = -1 - erratic port number
1134
Remarks:
1135
Remarks:
1135
  * Port number must satisfy to condition 0x100<=ecx.
1136
  * Port number must satisfy to condition 0x100<=ecx.
1136
  * WSS base is used by function 27.
1137
  * WSS base is used by function 27.
1137
  * To get WSS base port use subfunction 6 of function 26.
1138
  * To get WSS base port use subfunction 6 of function 26.
1138
 
1139
 
1139
======================================================================
1140
======================================================================
1140
============== Function 21, subfunction 7 - set HD base. =============
1141
============== Function 21, subfunction 7 - set HD base. =============
1141
======================================================================
1142
======================================================================
1142
The HD base defines hard disk to write with usage of obsolete
1143
The HD base defines hard disk to write with usage of obsolete
1143
file system functions and functions implicitly using the hard disk
1144
file system functions and functions implicitly using the hard disk
1144
(such as subfunction 6 of function 18);
1145
(such as subfunction 6 of function 18);
1145
at usage of function 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1146
at usage of function 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1146
these function set base themselves.
1147
these function set base themselves.
1147
Parameters:
1148
Parameters:
1148
  * eax = 21 - function number
1149
  * eax = 21 - function number
1149
  * ebx = 7 - subfunction number
1150
  * ebx = 7 - subfunction number
1150
  * ecx = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1151
  * ecx = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1151
Returned value:
1152
Returned value:
1152
  * eax = 0
1153
  * eax = 0
1153
Remarks:
1154
Remarks:
1154
  * Any application at any time can change the base.
1155
  * Any application at any time can change the base.
1155
  * Do not change base, when any application works with hard disk.
1156
  * Do not change base, when any application works with hard disk.
1156
    If you do not want system bugs.
1157
    If you do not want system bugs.
1157
  * To get HD base use subfunction 7 of function 26.
1158
  * To get HD base use subfunction 7 of function 26.
1158
  * It is also necessary to define used partition of hard disk by 
1159
  * It is also necessary to define used partition of hard disk by 
1159
    subfunction 8.
1160
    subfunction 8.
1160
 
1161
 
1161
======================================================================
1162
======================================================================
1162
========= Function 21, subfunction 8 - set used HD partition. ========
1163
========= Function 21, subfunction 8 - set used HD partition. ========
1163
======================================================================
1164
======================================================================
1164
The HD partition defines partition of the hard disk to write with
1165
The HD partition defines partition of the hard disk to write with
1165
usage of obsolete file system functions and functions implicitly
1166
usage of obsolete file system functions and functions implicitly
1166
using the hard disk (such as subfunction 6 of function 18);
1167
using the hard disk (such as subfunction 6 of function 18);
1167
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1168
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1168
these functions set base and partition themselves.
1169
these functions set base and partition themselves.
1169
Parameters:
1170
Parameters:
1170
  * eax = 21 - function number
1171
  * eax = 21 - function number
1171
  * ebx = 8 - subfunction number
1172
  * ebx = 8 - subfunction number
1172
  * ecx = HD partition (beginning from 1)
1173
  * ecx = HD partition (beginning from 1)
1173
Return value:
1174
Return value:
1174
  * eax = 0
1175
  * eax = 0
1175
Remarks:
1176
Remarks:
1176
  * Any application at any time can change partition.
1177
  * Any application at any time can change partition.
1177
  * Do not change partition when any application works with hard disk.
1178
  * Do not change partition when any application works with hard disk.
1178
    If you do not want system bugs.
1179
    If you do not want system bugs.
1179
  * To get used partition use subfunction 8 of function 26.
1180
  * To get used partition use subfunction 8 of function 26.
1180
  * There is no correctness checks.
1181
  * There is no correctness checks.
1181
  * To get the number of partitions of a hard disk use 
1182
  * To get the number of partitions of a hard disk use 
1182
    subfunction 11 of function 18.
1183
    subfunction 11 of function 18.
1183
  * It is also necessary to define used HD base by subfunction 7.
1184
  * It is also necessary to define used HD base by subfunction 7.
1184
 
1185
 
1185
======================================================================
1186
======================================================================
1186
======== Function 21, subfunction 10 - set sound DMA channel. ========
1187
======== Function 21, subfunction 10 - set sound DMA channel. ========
1187
======================================================================
1188
======================================================================
1188
Parameters:
1189
Parameters:
1189
  * eax = 21 - function number
1190
  * eax = 21 - function number
1190
  * ebx = 10 - subfunction number
1191
  * ebx = 10 - subfunction number
1191
  * ecx = number of channel (from 0 up to 3 inclusively)
1192
  * ecx = number of channel (from 0 up to 3 inclusively)
1192
Returned value:
1193
Returned value:
1193
  * eax = 0 - success
1194
  * eax = 0 - success
1194
  * eax = -1 - incorrect channel number
1195
  * eax = -1 - incorrect channel number
1195
Remarks:
1196
Remarks:
1196
  * Number of DMA channel is used in subfunction 1 of function 55.
1197
  * Number of DMA channel is used in subfunction 1 of function 55.
1197
  * To get sound DMA channel use subfunction 10 of function 26.
1198
  * To get sound DMA channel use subfunction 10 of function 26.
1198
 
1199
 
1199
======================================================================
1200
======================================================================
1200
 Function 21, subfunction 11 - enable/disable low-level access to HD. 
1201
 Function 21, subfunction 11 - enable/disable low-level access to HD. 
1201
======================================================================
1202
======================================================================
1202
Parameters:
1203
Parameters:
1203
  * eax = 21 - function number
1204
  * eax = 21 - function number
1204
  * ebx = 11 - subfunction number
1205
  * ebx = 11 - subfunction number
1205
  * ecx = 0/1 - disable/enable
1206
  * ecx = 0/1 - disable/enable
1206
Returned value:
1207
Returned value:
1207
  * eax = 0
1208
  * eax = 0
1208
Remarks:
1209
Remarks:
1209
  * Is used in LBA-read (subfunction 8 of function 58).
1210
  * Is used in LBA-read (subfunction 8 of function 58).
1210
  * The current implementation uses only low bit of ecx.
1211
  * The current implementation uses only low bit of ecx.
1211
  * To get current status use subfunction 11 of function 26.
1212
  * To get current status use subfunction 11 of function 26.
1212
 
1213
 
1213
======================================================================
1214
======================================================================
1214
 Function 21, subfunction 12 - enable/disable low-level access to PCI. 
1215
 Function 21, subfunction 12 - enable/disable low-level access to PCI. 
1215
======================================================================
1216
======================================================================
1216
Parameters:
1217
Parameters:
1217
  * eax = 21 - function number
1218
  * eax = 21 - function number
1218
  * ebx = 12 - subfunction number
1219
  * ebx = 12 - subfunction number
1219
  * ecx = 0/1 - disable/enable
1220
  * ecx = 0/1 - disable/enable
1220
Returned value:
1221
Returned value:
1221
  * eax = 0
1222
  * eax = 0
1222
Remarks:
1223
Remarks:
1223
  * Is used in operations with PCI bus (function 62).
1224
  * Is used in operations with PCI bus (function 62).
1224
  * The current implementation uses only low bit of ecx.
1225
  * The current implementation uses only low bit of ecx.
1225
  * To get current status use subfunction 12 of function 26.
1226
  * To get current status use subfunction 12 of function 26.
1226
 
1227
 
1227
======================================================================
1228
======================================================================
1228
============ Function 21, subfunction 13, subsubfunction 1 ===========
1229
============ Function 21, subfunction 13, subsubfunction 1 ===========
1229
======== Initialize + get information on the driver vmode.mdr. =======
1230
======== Initialize + get information on the driver vmode.mdr. =======
1230
======================================================================
1231
======================================================================
1231
Parameters:
1232
Parameters:
1232
  * eax = 21 - function number
1233
  * eax = 21 - function number
1233
  * ebx = 13 - subfunction number
1234
  * ebx = 13 - subfunction number
1234
  * ecx = 1 - number of the driver function
1235
  * ecx = 1 - number of the driver function
1235
  * edx = pointer to 512-bytes buffer
1236
  * edx = pointer to 512-bytes buffer
1236
Returned value:
1237
Returned value:
1237
  * if driver is not loaded
1238
  * if driver is not loaded
1238
    (never happens in the current implementation):
1239
    (never happens in the current implementation):
1239
    * eax = -1
1240
    * eax = -1
1240
    * ebx, ecx destroyed
1241
    * ebx, ecx destroyed
1241
  * if driver is loaded:
1242
  * if driver is loaded:
1242
    * eax = 'MDAZ' (in fasm style, that is 'M' - low byte, 'Z' - high)
1243
    * eax = 'MDAZ' (in fasm style, that is 'M' - low byte, 'Z' - high)
1243
      - signature
1244
      - signature
1244
    * ebx = current frequency of the scanning (in Hz)
1245
    * ebx = current frequency of the scanning (in Hz)
1245
    * ecx destroyed
1246
    * ecx destroyed
1246
    * buffer pointed to by edx is filled
1247
    * buffer pointed to by edx is filled
1247
Format of the buffer:
1248
Format of the buffer:
1248
  * +0: 32*byte: driver name, "Trans VideoDriver"
1249
  * +0: 32*byte: driver name, "Trans VideoDriver"
1249
    (without quotes, supplemented by spaces)
1250
    (without quotes, supplemented by spaces)
1250
  * +32 = +0x20: dword: driver version (version x.y is encoded as
1251
  * +32 = +0x20: dword: driver version (version x.y is encoded as
1251
    y*65536+x), for the current implementation is 1 (1.0)
1252
    y*65536+x), for the current implementation is 1 (1.0)
1252
  * +36 = +0x24: 7*dword: reserved (0 in the current implementation)
1253
  * +36 = +0x24: 7*dword: reserved (0 in the current implementation)
1253
  * +64 = +0x40: 32*word: list of supported videomodes (each word
1254
  * +64 = +0x40: 32*word: list of supported videomodes (each word
1254
    is number of a videomode, after list itself there are zeroes)
1255
    is number of a videomode, after list itself there are zeroes)
1255
  * +128 = +0x80: 32*(5*word): list of supported frequences of the
1256
  * +128 = +0x80: 32*(5*word): list of supported frequences of the
1256
    scannings for videomodes: for each videomode listed in the
1257
    scannings for videomodes: for each videomode listed in the
1257
    previous field up to 5 supported frequences are given
1258
    previous field up to 5 supported frequences are given
1258
    (unused positions contain zeroes)
1259
    (unused positions contain zeroes)
1259
Remarks:
1260
Remarks:
1260
  * Function initializes the driver (if it is not initialized yet)
1261
  * Function initializes the driver (if it is not initialized yet)
1261
    and must be called first, before others (otherwise they will do
1262
    and must be called first, before others (otherwise they will do
1262
    nothing and return -1).
1263
    nothing and return -1).
1263
  * The current implementation supports only one frequency
1264
  * The current implementation supports only one frequency
1264
    of the scanning on videomode.
1265
    of the scanning on videomode.
1265
 
1266
 
1266
======================================================================
1267
======================================================================
1267
============ Function 21, subfunction 13, subsubfunction 2 ===========
1268
============ Function 21, subfunction 13, subsubfunction 2 ===========
1268
================ Get information on current videomode. ===============
1269
================ Get information on current videomode. ===============
1269
======================================================================
1270
======================================================================
1270
Parameters:
1271
Parameters:
1271
  * eax = 21 - function number
1272
  * eax = 21 - function number
1272
  * ebx = 13 - subfunction number
1273
  * ebx = 13 - subfunction number
1273
  * ecx = 2 - number of the driver function
1274
  * ecx = 2 - number of the driver function
1274
Returned value:
1275
Returned value:
1275
  * eax = -1 - driver is not loaded or not initialized;
1276
  * eax = -1 - driver is not loaded or not initialized;
1276
    ebx,ecx are destroyed
1277
    ebx,ecx are destroyed
1277
  * eax = [width]*65536 + [height]
1278
  * eax = [width]*65536 + [height]
1278
  * ebx = frequency of the vertical scanning (in Hz)
1279
  * ebx = frequency of the vertical scanning (in Hz)
1279
  * ecx = number of current videomode
1280
  * ecx = number of current videomode
1280
Remarks:
1281
Remarks:
1281
  * Driver must be initialized by call to 
1282
  * Driver must be initialized by call to 
1282
    driver function 1.
1283
    driver function 1.
1283
  * If only screen sizes are required, it is more expedient to use
1284
  * If only screen sizes are required, it is more expedient to use
1284
    function 14 taking into account that it
1285
    function 14 taking into account that it
1285
    returns sizes on 1 less.
1286
    returns sizes on 1 less.
1286
 
1287
 
1287
======================================================================
1288
======================================================================
1288
=== Function 21, subfunction 13, subsubfunction 3 - set videomode. ===
1289
=== Function 21, subfunction 13, subsubfunction 3 - set videomode. ===
1289
======================================================================
1290
======================================================================
1290
Parameters:
1291
Parameters:
1291
  * eax = 21 - function number
1292
  * eax = 21 - function number
1292
  * ebx = 13 - subfunction number
1293
  * ebx = 13 - subfunction number
1293
  * ecx = 3 - number of the driver function
1294
  * ecx = 3 - number of the driver function
1294
  * edx = [scanning frequency]*65536 + [videomode number]
1295
  * edx = [scanning frequency]*65536 + [videomode number]
1295
Returned value:
1296
Returned value:
1296
  * eax = -1 - driver is not loaded, not initialized or
1297
  * eax = -1 - driver is not loaded, not initialized or
1297
    an error has occured
1298
    an error has occured
1298
  * eax = 0 - success
1299
  * eax = 0 - success
1299
  * ebx, ecx destroyed
1300
  * ebx, ecx destroyed
1300
Remarks:
1301
Remarks:
1301
  * Driver must be initialized by driver function 1.
1302
  * Driver must be initialized by driver function 1.
1302
  * The videomode number and frequency must be in the table
1303
  * The videomode number and frequency must be in the table
1303
    returned by driver function 1.
1304
    returned by driver function 1.
1304
 
1305
 
1305
======================================================================
1306
======================================================================
1306
============ Function 21, subfunction 13, subsubfunction 4 ===========
1307
============ Function 21, subfunction 13, subsubfunction 4 ===========
1307
================== Return to the initial videomode. ==================
1308
================== Return to the initial videomode. ==================
1308
======================================================================
1309
======================================================================
1309
Returns the screen to the videomode set at system boot.
1310
Returns the screen to the videomode set at system boot.
1310
Parameters:
1311
Parameters:
1311
  * eax = 21 - function number
1312
  * eax = 21 - function number
1312
  * ebx = 13 - subfunction number
1313
  * ebx = 13 - subfunction number
1313
  * ecx = 4 - number of the driver function
1314
  * ecx = 4 - number of the driver function
1314
Returned value:
1315
Returned value:
1315
  * eax = -1 - driver is not loaded or not initialized
1316
  * eax = -1 - driver is not loaded or not initialized
1316
  * eax = 0 - success
1317
  * eax = 0 - success
1317
  * ebx, ecx destroyed
1318
  * ebx, ecx destroyed
1318
Remarks:
1319
Remarks:
1319
  * Driver must be initialized by call to driver function 1.
1320
  * Driver must be initialized by call to driver function 1.
1320
 
1321
 
1321
======================================================================
1322
======================================================================
1322
============ Function 21, subfunction 13, subsubfunction 5 ===========
1323
============ Function 21, subfunction 13, subsubfunction 5 ===========
1323
===== Increase/decrease the size of the visible area of monitor. =====
1324
===== Increase/decrease the size of the visible area of monitor. =====
1324
======================================================================
1325
======================================================================
1325
Parameters:
1326
Parameters:
1326
  * eax = 21 - function number
1327
  * eax = 21 - function number
1327
  * ebx = 13 - subfunction number
1328
  * ebx = 13 - subfunction number
1328
  * ecx = 5 - number of the driver function
1329
  * ecx = 5 - number of the driver function
1329
  * edx = 0/1 - decrease/increase horizontal size on 1 position
1330
  * edx = 0/1 - decrease/increase horizontal size on 1 position
1330
  * edx = 2/3 - is not supported in the current implementation;
1331
  * edx = 2/3 - is not supported in the current implementation;
1331
    is planned as decrease/increase vertical size on 1 position
1332
    is planned as decrease/increase vertical size on 1 position
1332
Returned value:
1333
Returned value:
1333
  * eax = -1 - driver is not loaded or not initialized
1334
  * eax = -1 - driver is not loaded or not initialized
1334
  * eax = 0 - success
1335
  * eax = 0 - success
1335
  * ebx, ecx destroyed
1336
  * ebx, ecx destroyed
1336
Remarks:
1337
Remarks:
1337
  * Driver must be initialized by call to driver function 1.
1338
  * Driver must be initialized by call to driver function 1.
1338
  * Function influences only the physical size of the screen image;
1339
  * Function influences only the physical size of the screen image;
1339
    the logical size (number of pixels) does not change.
1340
    the logical size (number of pixels) does not change.
1340
 
1341
 
1341
======================================================================
1342
======================================================================
1342
================= Function 22 - set system date/time. ================
1343
================= Function 22 - set system date/time. ================
1343
======================================================================
1344
======================================================================
1344
Parameters:
1345
Parameters:
1345
  * eax = 22 - function number
1346
  * eax = 22 - function number
1346
  * ebx = 0 - set time
1347
  * ebx = 0 - set time
1347
    * ecx = 0x00SSMMHH - time in the binary-decimal code (BCD):
1348
    * ecx = 0x00SSMMHH - time in the binary-decimal code (BCD):
1348
    * HH=hour 00..23
1349
    * HH=hour 00..23
1349
    * MM=minute 00..59
1350
    * MM=minute 00..59
1350
    * SS=second 00..59
1351
    * SS=second 00..59
1351
  * ebx = 1 - set date
1352
  * ebx = 1 - set date
1352
    * ecx = 0x00DDMMYY - date in the binary-decimal code (BCD):
1353
    * ecx = 0x00DDMMYY - date in the binary-decimal code (BCD):
1353
    * DD=day 01..31
1354
    * DD=day 01..31
1354
    * MM=month 01..12
1355
    * MM=month 01..12
1355
    * YY=year 00..99
1356
    * YY=year 00..99
1356
  * ebx = 2 - set day of week
1357
  * ebx = 2 - set day of week
1357
    * ecx = 1 for Sunday, ..., 7 for Saturday
1358
    * ecx = 1 for Sunday, ..., 7 for Saturday
1358
  * ebx = 3 - set alarm clock
1359
  * ebx = 3 - set alarm clock
1359
    * ecx = 0x00SSMMHH
1360
    * ecx = 0x00SSMMHH
1360
Returned value:
1361
Returned value:
1361
  * eax = 0 - success
1362
  * eax = 0 - success
1362
  * eax = 1 - incorrect parameter
1363
  * eax = 1 - incorrect parameter
1363
  * eax = 2 - CMOS-battery was unloaded
1364
  * eax = 2 - CMOS-battery was unloaded
1364
Remarks:
1365
Remarks:
1365
  * Value of installation of day of week seems to be doubtful,
1366
  * Value of installation of day of week seems to be doubtful,
1366
    as it a little where is used
1367
    as it a little where is used
1367
    (day of week can be calculated by date).
1368
    (day of week can be calculated by date).
1368
  * Alarm clock can be set on operation in the given time every day.
1369
  * Alarm clock can be set on operation in the given time every day.
1369
    But there is no existing system function to disable it.
1370
    But there is no existing system function to disable it.
1370
  * Operation of alarm clock consists in generation IRQ8.
1371
  * Operation of alarm clock consists in generation IRQ8.
1371
  * Generally CMOS supports for alarm clock set of value 0xFF
1372
  * Generally CMOS supports for alarm clock set of value 0xFF
1372
    as one of parameters and it means that the appropriate parameter
1373
    as one of parameters and it means that the appropriate parameter
1373
    is ignored. But current implementation does not allow this
1374
    is ignored. But current implementation does not allow this
1374
    (will return 1).
1375
    (will return 1).
1375
  * Alarm clock is a global system resource; the set of
1376
  * Alarm clock is a global system resource; the set of
1376
    an alarm clock cancels automatically the previous set.
1377
    an alarm clock cancels automatically the previous set.
1377
    However, at moment no program uses it.
1378
    However, at moment no program uses it.
1378
 
1379
 
1379
======================================================================
1380
======================================================================
1380
============= Function 23 - wait for event with timeout. =============
1381
============= Function 23 - wait for event with timeout. =============
1381
======================================================================
1382
======================================================================
1382
If the message queue is empty, waits for new message in the queue,
1383
If the message queue is empty, waits for new message in the queue,
1383
but no more than given time. Then reads out a message from the queue.
1384
but no more than given time. Then reads out a message from the queue.
1384
 
1385
 
1385
Parameters:
1386
Parameters:
1386
  * eax = 23 - function number
1387
  * eax = 23 - function number
1387
  * ebx = timeout (in 1/100 of second)
1388
  * ebx = timeout (in 1/100 of second)
1388
Returned value:
1389
Returned value:
1389
  * eax = 0 - the message queue is empty
1390
  * eax = 0 - the message queue is empty
1390
  * otherwise eax = event (see the list of events)
1391
  * otherwise eax = event (see the list of events)
1391
Remarks:
1392
Remarks:
1392
  * Only those events are taken into account, which enter into
1393
  * Only those events are taken into account, which enter into
1393
    the mask set by function 40. By default it is
1394
    the mask set by function 40. By default it is
1394
    redraw, key and button events.
1395
    redraw, key and button events.
1395
  * To check for presence of a message in the queue use function 11.
1396
  * To check for presence of a message in the queue use function 11.
1396
    To wait without timeout use function 10.
1397
    To wait without timeout use function 10.
1397
  * Transmission ebx=0 results in immediate returning eax=0.
1398
  * Transmission ebx=0 results in immediate returning eax=0.
1398
  * Current implementation returns immediately with eax=0,
1399
  * Current implementation returns immediately with eax=0,
1399
    if the addition of ebx with the current value of time counter
1400
    if the addition of ebx with the current value of time counter
1400
    makes 32-bit overflow.
1401
    makes 32-bit overflow.
1401
 
1402
 
1402
======================================================================
1403
======================================================================
1403
======== Function 24, subfunction 1 - begin to play CD-audio. ========
1404
======== Function 24, subfunction 1 - begin to play CD-audio. ========
1404
======================================================================
1405
======================================================================
1405
Parameters:
1406
Parameters:
1406
  * eax = 24 - function number
1407
  * eax = 24 - function number
1407
  * ebx = 1 - subfunction number
1408
  * ebx = 1 - subfunction number
1408
  * ecx = 0x00FRSSMM, where
1409
  * ecx = 0x00FRSSMM, where
1409
    * MM = starting minute
1410
    * MM = starting minute
1410
    * SS = starting second
1411
    * SS = starting second
1411
    * FR = starting frame
1412
    * FR = starting frame
1412
Returned value:
1413
Returned value:
1413
  * eax = 0 - success
1414
  * eax = 0 - success
1414
  * eax = 1 - CD base is not defined
1415
  * eax = 1 - CD base is not defined
1415
Remarks:
1416
Remarks:
1416
  * Previously CD base must be defined by the call to 
1417
  * Previously CD base must be defined by the call to 
1417
    subfunction 3 of function 21.
1418
    subfunction 3 of function 21.
1418
  * One second includes 75 frames, one minute includes 60 seconds.
1419
  * One second includes 75 frames, one minute includes 60 seconds.
1419
  * The function is asynchronous (returns control, when play begins).
1420
  * The function is asynchronous (returns control, when play begins).
1420
 
1421
 
1421
======================================================================
1422
======================================================================
1422
======= Function 24, subfunction 2 - get information on tracks. ======
1423
======= Function 24, subfunction 2 - get information on tracks. ======
1423
======================================================================
1424
======================================================================
1424
Parameters:
1425
Parameters:
1425
  * eax = 24 - function number
1426
  * eax = 24 - function number
1426
  * ebx = 2 - subfunction number
1427
  * ebx = 2 - subfunction number
1427
  * ecx = pointer to the buffer for the table
1428
  * ecx = pointer to the buffer for the table
1428
    (maximum 8*64h+4 bytes=100 tracks)
1429
    (maximum 8*64h+4 bytes=100 tracks)
1429
Returned value:
1430
Returned value:
1430
  * eax = 0 - success
1431
  * eax = 0 - success
1431
  * eax = 1 - CD base is not defined
1432
  * eax = 1 - CD base is not defined
1432
Remarks:
1433
Remarks:
1433
  * The format of the table with tracks information is the same as
1434
  * The format of the table with tracks information is the same as
1434
    for ATAPI-CD command 43h (READ TOC), usual table (subcommand 00h).
1435
    for ATAPI-CD command 43h (READ TOC), usual table (subcommand 00h).
1435
    Function returns addresses in MSF.
1436
    Function returns addresses in MSF.
1436
  * Previously CD base port must be set by call to 
1437
  * Previously CD base port must be set by call to 
1437
    subfunction 3 of function 21.
1438
    subfunction 3 of function 21.
1438
  * Function returns information only about no more than 100
1439
  * Function returns information only about no more than 100
1439
    first tracks. In most cases it is enough.
1440
    first tracks. In most cases it is enough.
1440
 
1441
 
1441
======================================================================
1442
======================================================================
1442
========== Function 24, subfunction 3 - stop play CD-audio. ==========
1443
========== Function 24, subfunction 3 - stop play CD-audio. ==========
1443
======================================================================
1444
======================================================================
1444
Parameters:
1445
Parameters:
1445
  * eax = 24 - function number
1446
  * eax = 24 - function number
1446
  * ebx = 1 - subfunction number
1447
  * ebx = 1 - subfunction number
1447
Returned value:
1448
Returned value:
1448
  * eax = 0 - success
1449
  * eax = 0 - success
1449
  * eax = 1 - CD base is not defined
1450
  * eax = 1 - CD base is not defined
1450
Çàìå÷àíèÿ:
1451
Çàìå÷àíèÿ:
1451
  * Previously CD base port must be defined by call to 
1452
  * Previously CD base port must be defined by call to 
1452
    subfunction 3 of function 21.
1453
    subfunction 3 of function 21.
1453
 
1454
 
1454
======================================================================
1455
======================================================================
1455
=================== Function 25 - set SBPro volume. ==================
1456
=================== Function 25 - set SBPro volume. ==================
1456
======================================================================
1457
======================================================================
1457
Parameters:
1458
Parameters:
1458
  * eax = 25 - function number
1459
  * eax = 25 - function number
1459
  * ebx = what to set:
1460
  * ebx = what to set:
1460
    * 1 - set common volume
1461
    * 1 - set common volume
1461
    * 2 - set CD-audio volume
1462
    * 2 - set CD-audio volume
1462
  * cl = volume level: high 4 bits for the left column,
1463
  * cl = volume level: high 4 bits for the left column,
1463
    low 4 bits for the right one
1464
    low 4 bits for the right one
1464
Returned value:
1465
Returned value:
1465
  * eax = 0 - success
1466
  * eax = 0 - success
1466
  * eax = 1 - SB base is not defined
1467
  * eax = 1 - SB base is not defined
1467
  * eax = 2 - incorrect subfunction
1468
  * eax = 2 - incorrect subfunction
1468
Remarks:
1469
Remarks:
1469
  * Previously SB base port must be defined by 
1470
  * Previously SB base port must be defined by 
1470
    subfunction 4 of function 21.
1471
    subfunction 4 of function 21.
1471
  * See also function 28 which sets
1472
  * See also function 28 which sets
1472
    volume for the later standard SB16.
1473
    volume for the later standard SB16.
1473
 
1474
 
1474
======================================================================
1475
======================================================================
1475
======== Function 26, subfunction 1 - get MPU MIDI base port. ========
1476
======== Function 26, subfunction 1 - get MPU MIDI base port. ========
1476
======================================================================
1477
======================================================================
1477
Parameters:
1478
Parameters:
1478
  * eax = 26 - function number
1479
  * eax = 26 - function number
1479
  * ebx = 1 - subfunction number
1480
  * ebx = 1 - subfunction number
1480
Returned value:
1481
Returned value:
1481
  * eax = port number
1482
  * eax = port number
1482
Parameters:
1483
Parameters:
1483
  * To set base port use subfunction 1 of function 21.
1484
  * To set base port use subfunction 1 of function 21.
1484
 
1485
 
1485
======================================================================
1486
======================================================================
1486
========== Function 26, subfunction 2 - get keyboard layout. =========
1487
========== Function 26, subfunction 2 - get keyboard layout. =========
1487
======================================================================
1488
======================================================================
1488
The keyboard layout is used to convert keyboard scancodes to
1489
The keyboard layout is used to convert keyboard scancodes to
1489
ASCII-codes for function 2.
1490
ASCII-codes for function 2.
1490
Parameters:
1491
Parameters:
1491
  * eax = 26 - function number
1492
  * eax = 26 - function number
1492
  * ebx = 2 - subfunction number
1493
  * ebx = 2 - subfunction number
1493
  * ecx = what layout to get:
1494
  * ecx = what layout to get:
1494
    * 1 = normal layout
1495
    * 1 = normal layout
1495
    * 2 = layout with pressed Shift
1496
    * 2 = layout with pressed Shift
1496
    * 3 = layout with pressed Alt
1497
    * 3 = layout with pressed Alt
1497
  * edx = pointer to the 128-bytes buffer, where the layout will be
1498
  * edx = pointer to the 128-bytes buffer, where the layout will be
1498
    copied
1499
    copied
1499
Returned value:
1500
Returned value:
1500
  * function does not return value
1501
  * function does not return value
1501
Or:
1502
Or:
1502
  * eax = 26 - function number
1503
  * eax = 26 - function number
1503
  * ebx = 2 - subfunction number
1504
  * ebx = 2 - subfunction number
1504
  * ecx = 9
1505
  * ecx = 9
1505
Returned value:
1506
Returned value:
1506
  * eax = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1507
  * eax = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
1507
Remarks:
1508
Remarks:
1508
  * If Alt is pressed, the layout with Alt is used;
1509
  * If Alt is pressed, the layout with Alt is used;
1509
    if Alt is not pressed, but Shift is pressed,
1510
    if Alt is not pressed, but Shift is pressed,
1510
    the layout with Shift is used;
1511
    the layout with Shift is used;
1511
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1512
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1512
    layout is used and then from the code is subtracted 0x60;
1513
    layout is used and then from the code is subtracted 0x60;
1513
    if no control key is pressed, the normal layout is used.
1514
    if no control key is pressed, the normal layout is used.
1514
  * To set layout and country identifier use 
1515
  * To set layout and country identifier use 
1515
    subfunction 2 of function 21.
1516
    subfunction 2 of function 21.
1516
  * Country identifier is global system variable, which is not used
1517
  * Country identifier is global system variable, which is not used
1517
    by the kernel itself; however the application '@panel' displays
1518
    by the kernel itself; however the application '@panel' displays
1518
    the corresponding icon (using this function).
1519
    the corresponding icon (using this function).
1519
  * The application @panel switches layouts on user request.
1520
  * The application @panel switches layouts on user request.
1520
 
1521
 
1521
======================================================================
1522
======================================================================
1522
============== Function 26, subfunction 3 - get CD base. =============
1523
============== Function 26, subfunction 3 - get CD base. =============
1523
======================================================================
1524
======================================================================
1524
Parameters:
1525
Parameters:
1525
  * eax = 26 - function number
1526
  * eax = 26 - function number
1526
  * ebx = 3 - subfunction number
1527
  * ebx = 3 - subfunction number
1527
Returned value:
1528
Returned value:
1528
  * eax = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1529
  * eax = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1529
Remarks:
1530
Remarks:
1530
  * CD base is used by function 24.
1531
  * CD base is used by function 24.
1531
  * To set CD base use subfunction 3 of function 21.
1532
  * To set CD base use subfunction 3 of function 21.
1532
 
1533
 
1533
======================================================================
1534
======================================================================
1534
====== Function 26, subfunction 4 - get Sound Blaster base port. =====
1535
====== Function 26, subfunction 4 - get Sound Blaster base port. =====
1535
======================================================================
1536
======================================================================
1536
Parameters:
1537
Parameters:
1537
  * eax = 26 - function number
1538
  * eax = 26 - function number
1538
  * ebx = 4 - subfunction number
1539
  * ebx = 4 - subfunction number
1539
Returned value:
1540
Returned value:
1540
  * eax = base port number
1541
  * eax = base port number
1541
Remarks:
1542
Remarks:
1542
  * Bae port is used by functions 25, 55.
1543
  * Bae port is used by functions 25, 55.
1543
  * To set base port use subfunction 4 of function 21.
1544
  * To set base port use subfunction 4 of function 21.
1544
 
1545
 
1545
======================================================================
1546
======================================================================
1546
========== Function 26, subfunction 5 - get system language. =========
1547
========== Function 26, subfunction 5 - get system language. =========
1547
======================================================================
1548
======================================================================
1548
Parameters:
1549
Parameters:
1549
  * eax = 26 - function number
1550
  * eax = 26 - function number
1550
  * ebx = 5 - subfunction number
1551
  * ebx = 5 - subfunction number
1551
Returned value:
1552
Returned value:
1552
  * eax = system language (1=eng, 2=fi, 3=ger, 4=rus)
1553
  * eax = system language (1=eng, 2=fi, 3=ger, 4=rus)
1553
Remarks:
1554
Remarks:
1554
  * System language is global system variable and is not used
1555
  * System language is global system variable and is not used
1555
    by the kernel itself, however application @panel draws the
1556
    by the kernel itself, however application @panel draws the
1556
    appropriate icon (using this function).
1557
    appropriate icon (using this function).
1557
  * To set system language use subfunction 5 of function 21.
1558
  * To set system language use subfunction 5 of function 21.
1558
 
1559
 
1559
======================================================================
1560
======================================================================
1560
=========== Function 26, subfunction 6 - get WSS base port. ==========
1561
=========== Function 26, subfunction 6 - get WSS base port. ==========
1561
======================================================================
1562
======================================================================
1562
Parameters:
1563
Parameters:
1563
  * eax = 26 - function number
1564
  * eax = 26 - function number
1564
  * ebx = 6 - subfunction number
1565
  * ebx = 6 - subfunction number
1565
Returned value:
1566
Returned value:
1566
  * eax = base port
1567
  * eax = base port
1567
Remarks:
1568
Remarks:
1568
  * WSS base is used by function 27.
1569
  * WSS base is used by function 27.
1569
  * To set WSS base port use subfunction 6 of function 21.
1570
  * To set WSS base port use subfunction 6 of function 21.
1570
 
1571
 
1571
======================================================================
1572
======================================================================
1572
============== Function 26, subfunction 7 - get HD base. =============
1573
============== Function 26, subfunction 7 - get HD base. =============
1573
======================================================================
1574
======================================================================
1574
The HD base defines hard disk to write with usage of obsolete
1575
The HD base defines hard disk to write with usage of obsolete
1575
file system functions and functions implicitly using the hard disk
1576
file system functions and functions implicitly using the hard disk
1576
(such as subfunction 6 of function 18);
1577
(such as subfunction 6 of function 18);
1577
at usage of function 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1578
at usage of function 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1578
these function set base themselves.
1579
these function set base themselves.
1579
Parameters:
1580
Parameters:
1580
  * eax = 26 - function number
1581
  * eax = 26 - function number
1581
  * ebx = 7 - subfunction number
1582
  * ebx = 7 - subfunction number
1582
Returned value:
1583
Returned value:
1583
  * eax = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1584
  * eax = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3
1584
Remarks:
1585
Remarks:
1585
  * Any application in any time can change HD base.
1586
  * Any application in any time can change HD base.
1586
  * To set base use subfunction 7 of function 21.
1587
  * To set base use subfunction 7 of function 21.
1587
  * To get used partition of hard disk use subfunction 8.
1588
  * To get used partition of hard disk use subfunction 8.
1588
 
1589
 
1589
======================================================================
1590
======================================================================
1590
========= Function 26, subfunction 8 - get used HD partition. ========
1591
========= Function 26, subfunction 8 - get used HD partition. ========
1591
======================================================================
1592
======================================================================
1592
The HD partition defines partition of the hard disk to write with
1593
The HD partition defines partition of the hard disk to write with
1593
usage of obsolete file system functions and functions implicitly
1594
usage of obsolete file system functions and functions implicitly
1594
using the hard disk (such as subfunction 6 of function 18);
1595
using the hard disk (such as subfunction 6 of function 18);
1595
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1596
at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3
1596
these functions set base and partition themselves.
1597
these functions set base and partition themselves.
1597
Parameters:
1598
Parameters:
1598
  * eax = 26 - function number
1599
  * eax = 26 - function number
1599
  * ebx = 8 - subfunction number
1600
  * ebx = 8 - subfunction number
1600
Returned value:
1601
Returned value:
1601
  * eax = HD partition (beginning from 1)
1602
  * eax = HD partition (beginning from 1)
1602
Remarks:
1603
Remarks:
1603
  * Any application in any time can change partition.
1604
  * Any application in any time can change partition.
1604
  * To set partition use subfunction 8 of function 21.
1605
  * To set partition use subfunction 8 of function 21.
1605
  * To get number of partitions on a hard disk use
1606
  * To get number of partitions on a hard disk use
1606
    subfunction 11 of function 18.
1607
    subfunction 11 of function 18.
1607
  * To get base of used hard disk, use subfunction 7.
1608
  * To get base of used hard disk, use subfunction 7.
1608
 
1609
 
1609
======================================================================
1610
======================================================================
1610
=== Function 26, subfunction 9 - get the value of the time counter. ==
1611
=== Function 26, subfunction 9 - get the value of the time counter. ==
1611
======================================================================
1612
======================================================================
1612
Parameters:
1613
Parameters:
1613
  * eax = 26 - function number
1614
  * eax = 26 - function number
1614
  * ebx = 9 - subfunction number
1615
  * ebx = 9 - subfunction number
1615
Returned value:
1616
Returned value:
1616
  * eax = number of 1/100s of second, past from the system boot time
1617
  * eax = number of 1/100s of second, past from the system boot time
1617
Remarks:
1618
Remarks:
1618
  * Counter takes modulo 2^32, that correspond to a little more
1619
  * Counter takes modulo 2^32, that correspond to a little more
1619
    than 497 days.
1620
    than 497 days.
1620
  * To get system time use function 3.
1621
  * To get system time use function 3.
1621
 
1622
 
1622
======================================================================
1623
======================================================================
1623
======== Function 26, subfunction 10 - get sound DMA channel. ========
1624
======== Function 26, subfunction 10 - get sound DMA channel. ========
1624
======================================================================
1625
======================================================================
1625
Parameters:
1626
Parameters:
1626
  * eax = 26 - function number
1627
  * eax = 26 - function number
1627
  * ebx = 10 - subfunction number
1628
  * ebx = 10 - subfunction number
1628
Returned value:
1629
Returned value:
1629
  * eax = number of the channel (from 0 to 3 inclusive)
1630
  * eax = number of the channel (from 0 to 3 inclusive)
1630
Remarks:
1631
Remarks:
1631
  * Number of the DMA channel is used by subfunction 1 of function 55.
1632
  * Number of the DMA channel is used by subfunction 1 of function 55.
1632
  * To set the sound DMA channel use subfunction 10 of function 21.
1633
  * To set the sound DMA channel use subfunction 10 of function 21.
1633
 
1634
 
1634
======================================================================
1635
======================================================================
1635
===================== Function 26, subfunction 11 ====================
1636
===================== Function 26, subfunction 11 ====================
1636
========== Find out whether low-level HD access is enabled. ==========
1637
========== Find out whether low-level HD access is enabled. ==========
1637
======================================================================
1638
======================================================================
1638
Parameters:
1639
Parameters:
1639
  * eax = 26 - function number
1640
  * eax = 26 - function number
1640
  * ebx = 11 - subfunction number
1641
  * ebx = 11 - subfunction number
1641
Returned value:
1642
Returned value:
1642
  * eax = 0/1 - disabled/enabled
1643
  * eax = 0/1 - disabled/enabled
1643
Remarks:
1644
Remarks:
1644
  * Is used in LBA read (subfunction 8 of function 58).
1645
  * Is used in LBA read (subfunction 8 of function 58).
1645
  * To set current state use subfunction 11 of function 21.
1646
  * To set current state use subfunction 11 of function 21.
1646
 
1647
 
1647
======================================================================
1648
======================================================================
1648
===================== Function 26, subfunction 12 ====================
1649
===================== Function 26, subfunction 12 ====================
1649
========== Find out whether low-level PCI access is enabled. =========
1650
========== Find out whether low-level PCI access is enabled. =========
1650
======================================================================
1651
======================================================================
1651
Parameters:
1652
Parameters:
1652
  * eax = 26 - function number
1653
  * eax = 26 - function number
1653
  * ebx = 12 - subfunction number
1654
  * ebx = 12 - subfunction number
1654
Returned value:
1655
Returned value:
1655
  * eax = 0/1 - disabled/enabled
1656
  * eax = 0/1 - disabled/enabled
1656
Remarks:
1657
Remarks:
1657
  * Is used by operations with PCI bus (function 62).
1658
  * Is used by operations with PCI bus (function 62).
1658
  * The current implementation uses only low bit of ecx.
1659
  * The current implementation uses only low bit of ecx.
1659
  * To set the current state use subfunction 12 of function 21.
1660
  * To set the current state use subfunction 12 of function 21.
1660
 
1661
 
1661
======================================================================
1662
======================================================================
1662
======== Function 27 - set Windows Sound System (WSS) volume. ========
1663
======== Function 27 - set Windows Sound System (WSS) volume. ========
1663
======================================================================
1664
======================================================================
1664
Parameters:
1665
Parameters:
1665
  * eax = 27 - function number
1666
  * eax = 27 - function number
1666
  * ebx = what to set:
1667
  * ebx = what to set:
1667
    * 1 - set common volume
1668
    * 1 - set common volume
1668
    * 2 - set Line In volume
1669
    * 2 - set Line In volume
1669
  * cl = volume level (0x0=highest, 0x1F=lowest,
1670
  * cl = volume level (0x0=highest, 0x1F=lowest,
1670
    if bit 0x80 is set=disable)
1671
    if bit 0x80 is set=disable)
1671
Returned value:
1672
Returned value:
1672
  * eax = 0 - success
1673
  * eax = 0 - success
1673
  * eax = 1 - WSS base is not defined
1674
  * eax = 1 - WSS base is not defined
1674
  * eax = 2 - incorrect subfunction
1675
  * eax = 2 - incorrect subfunction
1675
Remarks:
1676
Remarks:
1676
  * Previously WSS base port must be defined by call to 
1677
  * Previously WSS base port must be defined by call to 
1677
    subfunction 6 of function 21.
1678
    subfunction 6 of function 21.
1678
  * Set of common volume is ignored (function simply returns eax=0).
1679
  * Set of common volume is ignored (function simply returns eax=0).
1679
  * Old documentation and kernel sources erraticly name function 2
1680
  * Old documentation and kernel sources erraticly name function 2
1680
    as CD-audio volume.
1681
    as CD-audio volume.
1681
 
1682
 
1682
======================================================================
1683
======================================================================
1683
=================== Function 28 - set SB16 volume. ===================
1684
=================== Function 28 - set SB16 volume. ===================
1684
======================================================================
1685
======================================================================
1685
Parameters:
1686
Parameters:
1686
  * eax = 28 - function number
1687
  * eax = 28 - function number
1687
  * ebx = what to install:
1688
  * ebx = what to install:
1688
    * 1 - install common volume
1689
    * 1 - install common volume
1689
    * 2 - install CD-audio volume
1690
    * 2 - install CD-audio volume
1690
  * cl = volume level (0=off, 0xFF=max)
1691
  * cl = volume level (0=off, 0xFF=max)
1691
Returned value:
1692
Returned value:
1692
  * eax = 0 - success
1693
  * eax = 0 - success
1693
  * eax = 1 - SB base is not defined
1694
  * eax = 1 - SB base is not defined
1694
  * eax = 2 - incorrect subfunction
1695
  * eax = 2 - incorrect subfunction
1695
Remarks:
1696
Remarks:
1696
  * Previously SB base port must be defined by
1697
  * Previously SB base port must be defined by
1697
    subfunction 4 of function 21.
1698
    subfunction 4 of function 21.
1698
  * This function gives more variants for volume, that function 25.
1699
  * This function gives more variants for volume, that function 25.
1699
 
1700
 
1700
======================================================================
1701
======================================================================
1701
=================== Function 29 - get system date. ===================
1702
=================== Function 29 - get system date. ===================
1702
======================================================================
1703
======================================================================
1703
Parameters:
1704
Parameters:
1704
  * eax = 29 - function number
1705
  * eax = 29 - function number
1705
Returned value:
1706
Returned value:
1706
  * eax = 0x00DDMMYY, where
1707
  * eax = 0x00DDMMYY, where
1707
    (binary-decimal coding, BCD, is used)
1708
    (binary-decimal coding, BCD, is used)
1708
  * YY = two low digits of year (00..99)
1709
  * YY = two low digits of year (00..99)
1709
  * MM = month (01..12)
1710
  * MM = month (01..12)
1710
  * DD = day (01..31)
1711
  * DD = day (01..31)
1711
Remarks:
1712
Remarks:
1712
  * To set system date use function 22.
1713
  * To set system date use function 22.
1713
 
1714
 
1714
======================================================================
1715
======================================================================
1715
=============== Function 32 - delete file from ramdisk. ==============
1716
=============== Function 32 - delete file from ramdisk. ==============
1716
======================================================================
1717
======================================================================
1717
Parameters:
1718
Parameters:
1718
  * eax = 32 - function number
1719
  * eax = 32 - function number
1719
  * ebx = pointer to the filename
1720
  * ebx = pointer to the filename
1720
Returned value:
1721
Returned value:
1721
  * eax = 0 - success; otherwise file system error code
1722
  * eax = 0 - success; otherwise file system error code
1722
Remarks:
1723
Remarks:
1723
  * This function is obsolete; function 58 allows to fulfill
1724
  * This function is obsolete; function 58 allows to fulfill
1724
    the same operations with the extended possibilities.
1725
    the same operations with the extended possibilities.
1725
  * The current implementation returns only values 0(success) and
1726
  * The current implementation returns only values 0(success) and
1726
    5(file not found).
1727
    5(file not found).
1727
  * The filename must be either in the format 8+3 characters
1728
  * The filename must be either in the format 8+3 characters
1728
    (first 8 characters - name itself, last 3 - extension,
1729
    (first 8 characters - name itself, last 3 - extension,
1729
    the short names and extensions are supplemented with spaces),
1730
    the short names and extensions are supplemented with spaces),
1730
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1731
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1731
    (name no more than 8 characters, dot, extension 3 characters
1732
    (name no more than 8 characters, dot, extension 3 characters
1732
    supplemented if necessary by spaces).
1733
    supplemented if necessary by spaces).
1733
    The filename must be written with capital letters. The terminating
1734
    The filename must be written with capital letters. The terminating
1734
    character with code 0 is not necessary (not ASCIIZ-string).
1735
    character with code 0 is not necessary (not ASCIIZ-string).
1735
  * This function does not support folders on the ramdisk.
1736
  * This function does not support folders on the ramdisk.
1736
 
1737
 
1737
======================================================================
1738
======================================================================
1738
================ Function 33 - write file to ramdisk. ================
1739
================ Function 33 - write file to ramdisk. ================
1739
======================================================================
1740
======================================================================
1740
Parameters:
1741
Parameters:
1741
  * eax = 33 - function number
1742
  * eax = 33 - function number
1742
  * ebx = pointer to the filename
1743
  * ebx = pointer to the filename
1743
  * ecx = pointer to data for writing
1744
  * ecx = pointer to data for writing
1744
  * edx = number of bytes for writing
1745
  * edx = number of bytes for writing
1745
  * should be set esi=0
1746
  * should be set esi=0
1746
Returned value:
1747
Returned value:
1747
  * eax = 0 - success, otherwise file system error code
1748
  * eax = 0 - success, otherwise file system error code
1748
Remarks:
1749
Remarks:
1749
  * This function is obsolete; function 70 allows to fulfil
1750
  * This function is obsolete; function 70 allows to fulfil
1750
    the same operations with extended possibilities.
1751
    the same operations with extended possibilities.
1751
  * If esi contains non-zero value and selected file already exists,
1752
  * If esi contains non-zero value and selected file already exists,
1752
    one more file with the same name will be created.
1753
    one more file with the same name will be created.
1753
  * Otherwise file will be overwritten.
1754
  * Otherwise file will be overwritten.
1754
  * The filename must be either in the format 8+3 characters
1755
  * The filename must be either in the format 8+3 characters
1755
    (first 8 characters - name itself, last 3 - extension,
1756
    (first 8 characters - name itself, last 3 - extension,
1756
    the short names and extensions are supplemented with spaces),
1757
    the short names and extensions are supplemented with spaces),
1757
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1758
    or in the format 8.3 characters "FILE.EXT"/"FILE.EX "
1758
    (name no more than 8 characters, dot, extension 3 characters
1759
    (name no more than 8 characters, dot, extension 3 characters
1759
    supplemented if necessary by spaces).
1760
    supplemented if necessary by spaces).
1760
    The filename must be written with capital letters. The terminating
1761
    The filename must be written with capital letters. The terminating
1761
    character with code 0 is not necessary (not ASCIIZ-string).
1762
    character with code 0 is not necessary (not ASCIIZ-string).
1762
  * This function does not support folders on the ramdisk.
1763
  * This function does not support folders on the ramdisk.
1763
 
1764
 
1764
======================================================================
1765
======================================================================
1765
======= Function 35 - read the color of a pixel on the screen. =======
1766
======= Function 35 - read the color of a pixel on the screen. =======
1766
======================================================================
1767
======================================================================
1767
Parameters:
1768
Parameters:
1768
  * eax = 35
1769
  * eax = 35
1769
  * ebx = y*xsize+x, where
1770
  * ebx = y*xsize+x, where
1770
  * (x,y) = coordinates of a pixel (beginning from 0)
1771
  * (x,y) = coordinates of a pixel (beginning from 0)
1771
  * xsize = horizontal screen size
1772
  * xsize = horizontal screen size
1772
Returned value:
1773
Returned value:
1773
  * eax = color 0x00RRGGBB
1774
  * eax = color 0x00RRGGBB
1774
Remarks:
1775
Remarks:
1775
  * To get screen sizes use function 14. Pay attention,
1776
  * To get screen sizes use function 14. Pay attention,
1776
    that it subtracts 1 from both sizes.
1777
    that it subtracts 1 from both sizes.
1777
  * There is also direct access (without any system calls)
1778
  * There is also direct access (without any system calls)
1778
    to videomemory through the selector gs. To get parameters of
1779
    to videomemory through the selector gs. To get parameters of
1779
    the current videomode, use function 61.
1780
    the current videomode, use function 61.
1780
 
1781
 
1781
======================================================================
1782
======================================================================
1782
========= Function 37 - get coordinates/status of the mouse. =========
1783
========= Function 37 - get coordinates/status of the mouse. =========
1783
======================================================================
1784
======================================================================
1784
 
1785
 
1785
---------- Subfunction 0 - screen coordinates of the mouse -----------
1786
---------- Subfunction 0 - screen coordinates of the mouse -----------
1786
Parameters:
1787
Parameters:
1787
  * eax = 37 - function number
1788
  * eax = 37 - function number
1788
  * ebx = 0 - subfunction number
1789
  * ebx = 0 - subfunction number
1789
Returned value:
1790
Returned value:
1790
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1791
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1791
    (beginning from 0)
1792
    (beginning from 0)
1792
 
1793
 
1793
-- Subfunction 1 - coordinates of the mouse relative to the window ---
1794
-- Subfunction 1 - coordinates of the mouse relative to the window ---
1794
Parameters:
1795
Parameters:
1795
  * eax = 37 - function number
1796
  * eax = 37 - function number
1796
  * ebx = 1 - subfunction number
1797
  * ebx = 1 - subfunction number
1797
Returned value:
1798
Returned value:
1798
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1799
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1799
    relative to the application window (beginning from 0)
1800
    relative to the application window (beginning from 0)
1800
Remarks:
1801
Remarks:
1801
  * The value is calculated by formula (x-xwnd)*65536 + (y-ywnd).
1802
  * The value is calculated by formula (x-xwnd)*65536 + (y-ywnd).
1802
    If y>=ywnd, the low word is non-negative and contains
1803
    If y>=ywnd, the low word is non-negative and contains
1803
    relative y-coordinate, and the high word - relative x-coordinate
1804
    relative y-coordinate, and the high word - relative x-coordinate
1804
    (with correct sign). Otherwise the low word is negative and still
1805
    (with correct sign). Otherwise the low word is negative and still
1805
    contains relative y-coordinate, and to the high word
1806
    contains relative y-coordinate, and to the high word
1806
    1 should be added.
1807
    1 should be added.
1807
 
1808
 
1808
------------ Subfunction 2 - pressed buttons of the mouse ------------
1809
------------ Subfunction 2 - pressed buttons of the mouse ------------
1809
Parameters:
1810
Parameters:
1810
  * eax = 37 - function number
1811
  * eax = 37 - function number
1811
  * ebx = 2 - subfunction number
1812
  * ebx = 2 - subfunction number
1812
Returned value:
1813
Returned value:
1813
  * eax contains information on the pressed mouse buttons:
1814
  * eax contains information on the pressed mouse buttons:
1814
  * bit 0 is set = left button is pressed
1815
  * bit 0 is set = left button is pressed
1815
  * bit 1 is set = right button is pressed
1816
  * bit 1 is set = right button is pressed
1816
  * other bits are cleared
1817
  * other bits are cleared
1817
 
1818
 
1818
======================================================================
1819
======================================================================
1819
====================== Function 38 - draw line. ======================
1820
====================== Function 38 - draw line. ======================
1820
======================================================================
1821
======================================================================
1821
Parameters:
1822
Parameters:
1822
  * eax = 38 - function number
1823
  * eax = 38 - function number
1823
  * ebx = [start coordinate on axis x]*65536 +
1824
  * ebx = [start coordinate on axis x]*65536 +
1824
              [end coordinate on axis x]
1825
              [end coordinate on axis x]
1825
  * ecx = [start coordinate on axis y]*65536 +
1826
  * ecx = [start coordinate on axis y]*65536 +
1826
              [end coordinate on axis y]
1827
              [end coordinate on axis y]
1827
  * edx = 0x00RRGGBB - color
1828
  * edx = 0x00RRGGBB - color
1828
    edx = 0x01xxxxxx - draw inversed line
1829
    edx = 0x01xxxxxx - draw inversed line
1829
          (low 24 bits are ignored)
1830
          (low 24 bits are ignored)
1830
Returned value:
1831
Returned value:
1831
  * function does not return value
1832
  * function does not return value
1832
Remarks:
1833
Remarks:
1833
  * Coordinates are relative to the window.
1834
  * Coordinates are relative to the window.
1834
  * End point is also drawn.
1835
  * End point is also drawn.
1835
 
1836
 
1836
======================================================================
1837
======================================================================
1837
== Function 39, subfunction 1 - get a size of the background image. ==
1838
== Function 39, subfunction 1 - get a size of the background image. ==
1838
======================================================================
1839
======================================================================
1839
Parameters:
1840
Parameters:
1840
  * eax = 39 - function number
1841
  * eax = 39 - function number
1841
  * ebx = 1 - subfunction number
1842
  * ebx = 1 - subfunction number
1842
Returned value:
1843
Returned value:
1843
  * eax = [width]*65536 + [height]
1844
  * eax = [width]*65536 + [height]
1844
Remarks:
1845
Remarks:
1845
  * There is a pair function to set sizes of background image -
1846
  * There is a pair function to set sizes of background image -
1846
    subfunction 1 of function 15. After which it is necessary,
1847
    subfunction 1 of function 15. After which it is necessary,
1847
    of course, anew to define image.
1848
    of course, anew to define image.
1848
 
1849
 
1849
======================================================================
1850
======================================================================
1850
== Function 39, subfunction 2 - get pixel from the background image. =
1851
== Function 39, subfunction 2 - get pixel from the background image. =
1851
======================================================================
1852
======================================================================
1852
Parameters:
1853
Parameters:
1853
  * eax = 39 - function number
1854
  * eax = 39 - function number
1854
  * ebx = 2 - subfunction number
1855
  * ebx = 2 - subfunction number
1855
  * ecx = offset
1856
  * ecx = offset
1856
Returned value:
1857
Returned value:
1857
  * eax = 0x00RRGGBB - pixel color, if offset is valid
1858
  * eax = 0x00RRGGBB - pixel color, if offset is valid
1858
    (less than 0x160000-16)
1859
    (less than 0x160000-16)
1859
  * eax = 2 otherwise
1860
  * eax = 2 otherwise
1860
Remarks:
1861
Remarks:
1861
  * Do not rely on returned value for invalid offsets, it may be
1862
  * Do not rely on returned value for invalid offsets, it may be
1862
    changed in future kernel versions.
1863
    changed in future kernel versions.
1863
  * Offset for pixel with coordinates (x,y)
1864
  * Offset for pixel with coordinates (x,y)
1864
    is calculated as (x+y*xsize)*3.
1865
    is calculated as (x+y*xsize)*3.
1865
  * There is a pair function to set pixel on the background image - 
1866
  * There is a pair function to set pixel on the background image - 
1866
    subfunction 2 of function 15.
1867
    subfunction 2 of function 15.
1867
 
1868
 
1868
======================================================================
1869
======================================================================
1869
== Function 39, subfunction 4 - get drawing mode for the background. =
1870
== Function 39, subfunction 4 - get drawing mode for the background. =
1870
======================================================================
1871
======================================================================
1871
Parameters:
1872
Parameters:
1872
  * eax = 39 - function number
1873
  * eax = 39 - function number
1873
  * ebx = 4 - subfunction number
1874
  * ebx = 4 - subfunction number
1874
Returned value:
1875
Returned value:
1875
  * eax = 1 - tile
1876
  * eax = 1 - tile
1876
  * eax = 2 - stretch
1877
  * eax = 2 - stretch
1877
Remarks:
1878
Remarks:
1878
  * There is a pair function to set drawing mode - 
1879
  * There is a pair function to set drawing mode - 
1879
    subfunction 4 of function 15.
1880
    subfunction 4 of function 15.
1880
 
1881
 
1881
======================================================================
1882
======================================================================
1882
=========== Function 40 - set the mask for expected events. ==========
1883
=========== Function 40 - set the mask for expected events. ==========
1883
======================================================================
1884
======================================================================
1884
The mask for expected events affects function working with events
1885
The mask for expected events affects function working with events
1885
10, 11, 23 - they notify only about events allowed by this mask.
1886
10, 11, 23 - they notify only about events allowed by this mask.
1886
Parameters:
1887
Parameters:
1887
  * eax = 40 - function number
1888
  * eax = 40 - function number
1888
  * ebx = mask: bit i corresponds to event i+1 (see list of events)
1889
  * ebx = mask: bit i corresponds to event i+1 (see list of events)
1889
    (set bit permits notice on event)
1890
    (set bit permits notice on event)
1890
Returned value:
1891
Returned value:
1891
  * function does not return value
1892
  * function does not return value
1892
Remarks:
1893
Remarks:
1893
  * Default mask (7=111b) enables nofices about redraw,
1894
  * Default mask (7=111b) enables nofices about redraw,
1894
    keys and buttons. This is enough for many applications.
1895
    keys and buttons. This is enough for many applications.
1895
  * Events prohibited in the mask are saved anyway, when come;
1896
  * Events prohibited in the mask are saved anyway, when come;
1896
    they are simply not informed with event functions.
1897
    they are simply not informed with event functions.
1897
  * Event functions take into account the mask on moment of
1898
  * Event functions take into account the mask on moment of
1898
    function call, not on moment of event arrival.
1899
    function call, not on moment of event arrival.
1899
 
1900
 
1900
======================================================================
1901
======================================================================
1901
==================== Function 41 - get IRQ owner. ====================
1902
==================== Function 41 - get IRQ owner. ====================
1902
======================================================================
1903
======================================================================
1903
Parameters:
1904
Parameters:
1904
  * eax = 41 - function number
1905
  * eax = 41 - function number
1905
  * ebx = IRQ number, 0..15
1906
  * ebx = IRQ number, 0..15
1906
Returned value:
1907
Returned value:
1907
  * eax = owner PID
1908
  * eax = owner PID
1908
  * eax = 0, if there is no owner
1909
  * eax = 0, if there is no owner
1909
  * eax = -1 for incorrect ebx
1910
  * eax = -1 for incorrect ebx
1910
 
1911
 
1911
======================================================================
1912
======================================================================
1912
==================== Function 42 - read IRQ data. ====================
1913
==================== Function 42 - read IRQ data. ====================
1913
======================================================================
1914
======================================================================
1914
When an IRQ occurs, the system reads data from ports indicated
1915
When an IRQ occurs, the system reads data from ports indicated
1915
earlier by function 44 and writes this data to
1916
earlier by function 44 and writes this data to
1916
internal buffer. This function reads out data from that buffer
1917
internal buffer. This function reads out data from that buffer
1917
bytewise.
1918
bytewise.
1918
Parameters:
1919
Parameters:
1919
  * eax = 42 - function number
1920
  * eax = 42 - function number
1920
  * ebx = IRQ number, 0..15
1921
  * ebx = IRQ number, 0..15
1921
Returned value: (use value of ecx to distinguish)
1922
Returned value: (use value of ecx to distinguish)
1922
  * if the thread is not IRQ owner (or IRQ number is incorrect):
1923
  * if the thread is not IRQ owner (or IRQ number is incorrect):
1923
    * ecx = 2
1924
    * ecx = 2
1924
  * if there is no data:
1925
  * if there is no data:
1925
    * eax = 0
1926
    * eax = 0
1926
    * ecx = 1
1927
    * ecx = 1
1927
    * ebx destroyed
1928
    * ebx destroyed
1928
  * if all is ok:
1929
  * if all is ok:
1929
    * eax = byte size of data, not yet read from buffer
1930
    * eax = byte size of data, not yet read from buffer
1930
    * ecx = 0
1931
    * ecx = 0
1931
    * ebx = current byte
1932
    * ebx = current byte
1932
Remarks:
1933
Remarks:
1933
  * Previously the thread must reserve indicated IRQ for itself
1934
  * Previously the thread must reserve indicated IRQ for itself
1934
    by function 45.
1935
    by function 45.
1935
  * The size of data buffer is 4000 bytes, on overflow
1936
  * The size of data buffer is 4000 bytes, on overflow
1936
    "fresh" data cease to be written in the buffer.
1937
    "fresh" data cease to be written in the buffer.
1937
 
1938
 
1938
======================================================================
1939
======================================================================
1939
================ Function 43 - input/output to a port. ===============
1940
================ Function 43 - input/output to a port. ===============
1940
======================================================================
1941
======================================================================
1941
 
1942
 
1942
------------------------ Output data to port -------------------------
1943
------------------------ Output data to port -------------------------
1943
Parameters:
1944
Parameters:
1944
  * eax = 43 - function number
1945
  * eax = 43 - function number
1945
  * bl = byte for output
1946
  * bl = byte for output
1946
  * ecx = port number 0xnnnn (from 0 to 0xFFFF)
1947
  * ecx = port number 0xnnnn (from 0 to 0xFFFF)
1947
Returned value:
1948
Returned value:
1948
  * eax = 0 - success
1949
  * eax = 0 - success
1949
  * eax = 1 - the thread has not reserved the selected port
1950
  * eax = 1 - the thread has not reserved the selected port
1950
 
1951
 
1951
------------------------ Input data from port ------------------------
1952
------------------------ Input data from port ------------------------
1952
Parameters:
1953
Parameters:
1953
  * eax = 43 - function number
1954
  * eax = 43 - function number
1954
  * ebx is ignored
1955
  * ebx is ignored
1955
  * ecx = 0x8000nnnn, where nnnn = port number (from 0 to 0xFFFF)
1956
  * ecx = 0x8000nnnn, where nnnn = port number (from 0 to 0xFFFF)
1956
Returned value:
1957
Returned value:
1957
  * eax = 0 - success, thus ebx = entered byte
1958
  * eax = 0 - success, thus ebx = entered byte
1958
  * eax = 1 - the thread has not reserved the selected port
1959
  * eax = 1 - the thread has not reserved the selected port
1959
Remarks:
1960
Remarks:
1960
  * Previously the thread must reserve the selected port
1961
  * Previously the thread must reserve the selected port
1961
    for itself by function 46.
1962
    for itself by function 46.
1962
  * Instead of call to this function it is better to use
1963
  * Instead of call to this function it is better to use
1963
    processor instructions in/out - this is much
1964
    processor instructions in/out - this is much
1964
    faster and a bit shorter and easier.
1965
    faster and a bit shorter and easier.
1965
 
1966
 
1966
======================================================================
1967
======================================================================
1967
=========== Function 44 - define operations at IRQ arrival. ==========
1968
=========== Function 44 - define operations at IRQ arrival. ==========
1968
======================================================================
1969
======================================================================
1969
At IRQ arrival the system can read the data from ports defined
1970
At IRQ arrival the system can read the data from ports defined
1970
by this function and write these data to internal buffer, whence
1971
by this function and write these data to internal buffer, whence
1971
they can be read by ôóíêöèåé 42.
1972
they can be read by ôóíêöèåé 42.
1972
Parameters:
1973
Parameters:
1973
  * eax = 44 - function number
1974
  * eax = 44 - function number
1974
  * ebx = pointer to the array of structures each describing one port:
1975
  * ebx = pointer to the array of structures each describing one port:
1975
    * +0: word: 0 means end of array, otherwise port number
1976
    * +0: word: 0 means end of array, otherwise port number
1976
    * +2: byte: reserved (ignored)
1977
    * +2: byte: reserved (ignored)
1977
    * +3: byte: 1=read byte from this port, 2=read word
1978
    * +3: byte: 1=read byte from this port, 2=read word
1978
  * ecx = IRQ number, 0..15
1979
  * ecx = IRQ number, 0..15
1979
Returned value:
1980
Returned value:
1980
  * eax = 0 - success
1981
  * eax = 0 - success
1981
  * eax = 1 - the thread is not owner of selected IRQ
1982
  * eax = 1 - the thread is not owner of selected IRQ
1982
Remarks:
1983
Remarks:
1983
  * Previously the thread must reserve for itself selected IRQ
1984
  * Previously the thread must reserve for itself selected IRQ
1984
    by function 45.
1985
    by function 45.
1985
  * First 16 ports are considered only.
1986
  * First 16 ports are considered only.
1986
  * The current implementation considers incorrect value of field +3
1987
  * The current implementation considers incorrect value of field +3
1987
    as a signal to terminate IRQ processing.
1988
    as a signal to terminate IRQ processing.
1988
 
1989
 
1989
======================================================================
1990
======================================================================
1990
=================== Function 45 - reserve/free IRQ. ==================
1991
=================== Function 45 - reserve/free IRQ. ==================
1991
======================================================================
1992
======================================================================
1992
Parameters:
1993
Parameters:
1993
  * eax = 45 - function number
1994
  * eax = 45 - function number
1994
  * ebx = 0 - reserve, 1 = free
1995
  * ebx = 0 - reserve, 1 = free
1995
  * ecx = IRQ number, 0..15
1996
  * ecx = IRQ number, 0..15
1996
Returned value:
1997
Returned value:
1997
  * eax = 0 - success
1998
  * eax = 0 - success
1998
  * eax = 1 - error (invalid IRQ number
1999
  * eax = 1 - error (invalid IRQ number
1999
    or attempt to reserve not free IRQ
2000
    or attempt to reserve not free IRQ
2000
    or to free IRQ, not reserved by this thread)
2001
    or to free IRQ, not reserved by this thread)
2001
Remarks:
2002
Remarks:
2002
  * IRQ reservation is required for functions 42 and 44.
2003
  * IRQ reservation is required for functions 42 and 44.
2003
  * Only one thread can reserve the specific IRQ.
2004
  * Only one thread can reserve the specific IRQ.
2004
  * IRQs, handled by the system itself, are reserved by the system
2005
  * IRQs, handled by the system itself, are reserved by the system
2005
    (thread 1) at booting.
2006
    (thread 1) at booting.
2006
  * When a thread terminates, all reserved by it IRQs
2007
  * When a thread terminates, all reserved by it IRQs
2007
    are freed automatically.
2008
    are freed automatically.
2008
 
2009
 
2009
======================================================================
2010
======================================================================
2010
====== Function 46 - reserve/free a group of input/output ports. =====
2011
====== Function 46 - reserve/free a group of input/output ports. =====
2011
======================================================================
2012
======================================================================
2012
To work with reserved ports an application can access directly by
2013
To work with reserved ports an application can access directly by
2013
commands in/out (recommended way) and can use function 43
2014
commands in/out (recommended way) and can use function 43
2014
(not recommended way).
2015
(not recommended way).
2015
Parameters:
2016
Parameters:
2016
  * eax = 46 - function number
2017
  * eax = 46 - function number
2017
  * ebx = 0 - reserve, 1 - free
2018
  * ebx = 0 - reserve, 1 - free
2018
  * ecx = start port number
2019
  * ecx = start port number
2019
  * edx = end port number (inclusive)
2020
  * edx = end port number (inclusive)
2020
Returned value:
2021
Returned value:
2021
  * eax = 0 - success
2022
  * eax = 0 - success
2022
  * eax = 1 - error
2023
  * eax = 1 - error
2023
Remarks:
2024
Remarks:
2024
  * For ports reservation: an error occurs if and only if
2025
  * For ports reservation: an error occurs if and only if
2025
    one from the following condition satisfies:
2026
    one from the following condition satisfies:
2026
    * start port is more than end port;
2027
    * start port is more than end port;
2027
    * the selected range contains incorrect port number
2028
    * the selected range contains incorrect port number
2028
      (correct are from 0 to 0xFFFF);
2029
      (correct are from 0 to 0xFFFF);
2029
    * limit for the total number of reserved areas is exceeded
2030
    * limit for the total number of reserved areas is exceeded
2030
      (maximum 255 are allowed);
2031
      (maximum 255 are allowed);
2031
    * the selected range intersects with any of earlier reserved
2032
    * the selected range intersects with any of earlier reserved
2032
  * For ports free: an error is an attempt to free range,
2033
  * For ports free: an error is an attempt to free range,
2033
    that was not earlier reserved by this function
2034
    that was not earlier reserved by this function
2034
    (with same ecx,edx).
2035
    (with same ecx,edx).
2035
  * If an error occurs (for both cases) function performs no action.
2036
  * If an error occurs (for both cases) function performs no action.
2036
  * At booting the system reserves for itself ports 0..0xff, and if
2037
  * At booting the system reserves for itself ports 0..0xff, and if
2037
    COM-mouse is detected - additionally range of COM-ports
2038
    COM-mouse is detected - additionally range of COM-ports
2038
    0x3f0..0x3ff and/or 0x2f0..0x2ff.
2039
    0x3f0..0x3ff and/or 0x2f0..0x2ff.
2039
  * When a thread terminates, all reserved by it ports
2040
  * When a thread terminates, all reserved by it ports
2040
    are freed automatically.
2041
    are freed automatically.
2041
 
2042
 
2042
======================================================================
2043
======================================================================
2043
============= Function 47 - draw a number in the window. =============
2044
============= Function 47 - draw a number in the window. =============
2044
======================================================================
2045
======================================================================
2045
Parameters:
2046
Parameters:
2046
  * eax = 47 - function number
2047
  * eax = 47 - function number
2047
  * ebx = parameters of conversion number to text:
2048
  * ebx = parameters of conversion number to text:
2048
    * bl = 0 - ecx contains number
2049
    * bl = 0 - ecx contains number
2049
    * bl = 1 - ecx contains pointer to dword-number
2050
    * bl = 1 - ecx contains pointer to dword-number
2050
    * bh = 0 - display in decimal number system
2051
    * bh = 0 - display in decimal number system
2051
    * bh = 1 - display in hexadecimal system
2052
    * bh = 1 - display in hexadecimal system
2052
    * bh = 2 - display in binary system
2053
    * bh = 2 - display in binary system
2053
    * áèòû 16-21 = how many digits to display
2054
    * áèòû 16-21 = how many digits to display
2054
    * áèòû 22-31 reserved and must be set to 0
2055
    * áèòû 22-31 reserved and must be set to 0
2055
  * ecx = number (if bl=0) or pointer (if bl=1)
2056
  * ecx = number (if bl=0) or pointer (if bl=1)
2056
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
2057
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
2057
  * esi = 0xN0RRGGBB, RRGGBB=color, N=font (0/1)
2058
  * esi = 0xX0RRGGBB:
-
 
2059
    * RR, GG, BB specify the color
-
 
2060
    * X = ABnn (bits)
-
 
2061
    * nn = font (0/1)
-
 
2062
    * A is ignored
-
 
2063
    * B=1 - fill background with the color edi
2058
Returned value:
2064
Returned value:
2059
  * function does not return value
2065
  * function does not return value
2060
Remarks:
2066
Remarks:
2061
  * The given length must not exceed 60.
2067
  * The given length must not exceed 60.
2062
  * The exactly given amount of digits is output. If number is small
2068
  * The exactly given amount of digits is output. If number is small
2063
    and can be written by smaller amount of digits, it is supplemented
2069
    and can be written by smaller amount of digits, it is supplemented
2064
    by leading zeroes; if the number is big and can not be written by
2070
    by leading zeroes; if the number is big and can not be written by
2065
    given amount of digits, extra digits are not drawn.
2071
    given amount of digits, extra digits are not drawn.
2066
  * Parameters of fonts are shown in the description of function 4
2072
  * Parameters of fonts are shown in the description of function 4
2067
    (text output).
2073
    (text output).
2068
 
2074
 
2069
======================================================================
2075
======================================================================
2070
========= Function 48, subfunction 0 - apply screen settings. ========
2076
========= Function 48, subfunction 0 - apply screen settings. ========
2071
======================================================================
2077
======================================================================
2072
Parameters:
2078
Parameters:
2073
  * eax = 48 - function number
2079
  * eax = 48 - function number
2074
  * ebx = 0 - subfunction number
2080
  * ebx = 0 - subfunction number
2075
  * ecx = 0 - reserved
2081
  * ecx = 0 - reserved
2076
Returned value:
2082
Returned value:
2077
  * function does not return value
2083
  * function does not return value
2078
Remarks:
2084
Remarks:
2079
  * Function redraws the screen after parameters change by
2085
  * Function redraws the screen after parameters change by
2080
    subfunctions 1 and 2.
2086
    subfunctions 1 and 2.
2081
  * Function call without prior call to one of indicated subfunctions
2087
  * Function call without prior call to one of indicated subfunctions
2082
    is ignored.
2088
    is ignored.
2083
  * Function call with nonzero ecx is ignored.
2089
  * Function call with nonzero ecx is ignored.
2084
 
2090
 
2085
======================================================================
2091
======================================================================
2086
=========== Function 48, subfunction 1 - set button style. ===========
2092
=========== Function 48, subfunction 1 - set button style. ===========
2087
======================================================================
2093
======================================================================
2088
Parameters:
2094
Parameters:
2089
  * eax = 48 - function number
2095
  * eax = 48 - function number
2090
  * ebx = 1 - subfunction number
2096
  * ebx = 1 - subfunction number
2091
  * ecx = button style:
2097
  * ecx = button style:
2092
    * 0 = flat
2098
    * 0 = flat
2093
    * 1 = 3d
2099
    * 1 = 3d
2094
Returned value:
2100
Returned value:
2095
  * function does not return value
2101
  * function does not return value
2096
Remarks:
2102
Remarks:
2097
  * After call to this function one should redraw the screen by
2103
  * After call to this function one should redraw the screen by
2098
    subfunction 0.
2104
    subfunction 0.
2099
  * Button style influences only to their draw of function 8.
2105
  * Button style influences only to their draw of function 8.
2100
 
2106
 
2101
======================================================================
2107
======================================================================
2102
====== Function 48, subfunction 2 - set standard window colors. ======
2108
====== Function 48, subfunction 2 - set standard window colors. ======
2103
======================================================================
2109
======================================================================
2104
Parameters:
2110
Parameters:
2105
  * eax = 48 - function number
2111
  * eax = 48 - function number
2106
  * ebx = 2 - subfunction number
2112
  * ebx = 2 - subfunction number
2107
  * ecx = pointer to the color table
2113
  * ecx = pointer to the color table
2108
  * edx = size of the color table
2114
  * edx = size of the color table
2109
    (must be 40 bytes for future compatibility)
2115
    (must be 40 bytes for future compatibility)
2110
Format of the color table is shown in description of subfunction 3.
2116
Format of the color table is shown in description of subfunction 3.
2111
Returned value:
2117
Returned value:
2112
  * function does not return value
2118
  * function does not return value
2113
Remarks:
2119
Remarks:
2114
  * After call to this function one should redraw the screen by
2120
  * After call to this function one should redraw the screen by
2115
    subfunction 0.
2121
    subfunction 0.
2116
  * Table of standard colors influences only to applications,
2122
  * Table of standard colors influences only to applications,
2117
    which receive this table obviously (by subfunction 3)
2123
    which receive this table obviously (by subfunction 3)
2118
    and use it (specifying colors from it to drawing functions).
2124
    and use it (specifying colors from it to drawing functions).
2119
  * Table of standard colors is included in skin and is installed
2125
  * Table of standard colors is included in skin and is installed
2120
    anew with skin installation (by subfunction 8).
2126
    anew with skin installation (by subfunction 8).
2121
  * Color table can be viewed/changed interactively with
2127
  * Color table can be viewed/changed interactively with
2122
    the application 'desktop'.
2128
    the application 'desktop'.
2123
 
2129
 
2124
======================================================================
2130
======================================================================
2125
====== Function 48, subfunction 3 - get standard window colors. ======
2131
====== Function 48, subfunction 3 - get standard window colors. ======
2126
======================================================================
2132
======================================================================
2127
Parameters:
2133
Parameters:
2128
  * eax = 48 - function number
2134
  * eax = 48 - function number
2129
  * ebx = 3 - subfunction number
2135
  * ebx = 3 - subfunction number
2130
  * ecx = pointer to the buffer with size edx bytes,
2136
  * ecx = pointer to the buffer with size edx bytes,
2131
    where table will be written
2137
    where table will be written
2132
  * edx = size of color table
2138
  * edx = size of color table
2133
    (must be 40 bytes for future compatibility)
2139
    (must be 40 bytes for future compatibility)
2134
Returned value:
2140
Returned value:
2135
  * function does not return value
2141
  * function does not return value
2136
Format of the color table:
2142
Format of the color table:
2137
each item is dword-value for color 0x00RRGGBB
2143
each item is dword-value for color 0x00RRGGBB
2138
  * +0: dword: frames - color of frame
2144
  * +0: dword: frames - color of frame
2139
  * +4: dword: grab - color of header
2145
  * +4: dword: grab - color of header
2140
  * +8: dword: grab_button - color of button on header bar
2146
  * +8: dword: grab_button - color of button on header bar
2141
  * +12 = +0xC: dword: grab_button_text - color of text on button
2147
  * +12 = +0xC: dword: grab_button_text - color of text on button
2142
    on header bar
2148
    on header bar
2143
  * +16 = +0x10: dword: grab_text - color of text on header
2149
  * +16 = +0x10: dword: grab_text - color of text on header
2144
  * +20 = +0x14: dword: work - color of working area
2150
  * +20 = +0x14: dword: work - color of working area
2145
  * +24 = +0x18: dword: work_button - color of button in working area
2151
  * +24 = +0x18: dword: work_button - color of button in working area
2146
  * +28 = +0x1C: dword: work_button_text - color of text on button
2152
  * +28 = +0x1C: dword: work_button_text - color of text on button
2147
    in working area
2153
    in working area
2148
  * +32 = +0x20: dword: work_text - color of text in working area
2154
  * +32 = +0x20: dword: work_text - color of text in working area
2149
  * +36 = +0x24: dword: work_graph - color of graphics in working area
2155
  * +36 = +0x24: dword: work_graph - color of graphics in working area
2150
Remarks:
2156
Remarks:
2151
  * Structure of the color table is described in the standard
2157
  * Structure of the color table is described in the standard
2152
    include file 'macros.inc' as 'system_colors'; for example,
2158
    include file 'macros.inc' as 'system_colors'; for example,
2153
    it is possible to write:
2159
    it is possible to write:
2154
    	sc	system_colors		; variable declaration
2160
    	sc	system_colors		; variable declaration
2155
    	...				; somewhere one must call
2161
    	...				; somewhere one must call
2156
    					; this function with ecx=sc
2162
    					; this function with ecx=sc
2157
    	mov	ecx, [sc.work_button_text]	; read text color on
2163
    	mov	ecx, [sc.work_button_text]	; read text color on
2158
    					; buttin in working area
2164
    					; buttin in working area
2159
  * A program itself desides to use or not to use color table.
2165
  * A program itself desides to use or not to use color table.
2160
    For usage program must simply at calls to drawing functions select
2166
    For usage program must simply at calls to drawing functions select
2161
    color taken from the table.
2167
    color taken from the table.
2162
  * At change of the table of standard colors (by subfunction 2 with
2168
  * At change of the table of standard colors (by subfunction 2 with
2163
    the subsequent application of changes by subfunction 0 or
2169
    the subsequent application of changes by subfunction 0 or
2164
    at skin set by subfunction 8) the system sends to all windows
2170
    at skin set by subfunction 8) the system sends to all windows
2165
    redraw message (the event with code 1).
2171
    redraw message (the event with code 1).
2166
  * Color table can be viewed/changed interactively with
2172
  * Color table can be viewed/changed interactively with
2167
    the application 'desktop'.
2173
    the application 'desktop'.
2168
 
2174
 
2169
======================================================================
2175
======================================================================
2170
============ Function 48, subfunction 4 - get skin height. ===========
2176
============ Function 48, subfunction 4 - get skin height. ===========
2171
======================================================================
2177
======================================================================
2172
Parameters:
2178
Parameters:
2173
  * eax = 48 - function number
2179
  * eax = 48 - function number
2174
  * ebx = 4 - subfunction number
2180
  * ebx = 4 - subfunction number
2175
Returned value:
2181
Returned value:
2176
  * eax = skin height
2182
  * eax = skin height
2177
Remarks:
2183
Remarks:
2178
  * Skin height is defined as the height of a header
2184
  * Skin height is defined as the height of a header
2179
    of skinned windows.
2185
    of skinned windows.
2180
  * See also general structure of window in the description
2186
  * See also general structure of window in the description
2181
    of function 0.
2187
    of function 0.
2182
 
2188
 
2183
======================================================================
2189
======================================================================
2184
======== Function 48, subfunction 5 - get screen working area. =======
2190
======== Function 48, subfunction 5 - get screen working area. =======
2185
======================================================================
2191
======================================================================
2186
Parameters:
2192
Parameters:
2187
  * eax = 48 - function number
2193
  * eax = 48 - function number
2188
  * ebx = 5 - subfunction number
2194
  * ebx = 5 - subfunction number
2189
Returned value:
2195
Returned value:
2190
  * eax = [left]*65536 + [right]
2196
  * eax = [left]*65536 + [right]
2191
  * ebx = [top]*65536 + [bottom]
2197
  * ebx = [top]*65536 + [bottom]
2192
Remarks:
2198
Remarks:
2193
  * The screen working area defines position and coordinates of
2199
  * The screen working area defines position and coordinates of
2194
    a maximized window.
2200
    a maximized window.
2195
  * The screen working area in view of normal work is all screen
2201
  * The screen working area in view of normal work is all screen
2196
    without system panel (the application '@panel').
2202
    without system panel (the application '@panel').
2197
  * (left,top) are coordinates of the left upper corner,
2203
  * (left,top) are coordinates of the left upper corner,
2198
    (right,bottom) are coordinates of the right lower one.
2204
    (right,bottom) are coordinates of the right lower one.
2199
    Thus the size of working area on x axis can be calculated by
2205
    Thus the size of working area on x axis can be calculated by
2200
    formula right-left+1, on y axis - by formula bottom-right+1.
2206
    formula right-left+1, on y axis - by formula bottom-right+1.
2201
  * See also function 14,
2207
  * See also function 14,
2202
    to get sizes of all screen.
2208
    to get sizes of all screen.
2203
  * There is a pair function to set working area - subfunction 6.
2209
  * There is a pair function to set working area - subfunction 6.
2204
 
2210
 
2205
======================================================================
2211
======================================================================
2206
======== Function 48, subfunction 6 - set screen working area. =======
2212
======== Function 48, subfunction 6 - set screen working area. =======
2207
======================================================================
2213
======================================================================
2208
Parameters:
2214
Parameters:
2209
  * eax = 48 - function number
2215
  * eax = 48 - function number
2210
  * ebx = 6 - subfunction number
2216
  * ebx = 6 - subfunction number
2211
  * ecx = [left]*65536 + [right]
2217
  * ecx = [left]*65536 + [right]
2212
  * edx = [top]*65536 + [bottom]
2218
  * edx = [top]*65536 + [bottom]
2213
Returned value:
2219
Returned value:
2214
  * function does not return value
2220
  * function does not return value
2215
Remarks:
2221
Remarks:
2216
  * The screen working area defines position and coordinates of
2222
  * The screen working area defines position and coordinates of
2217
    a maximized window.
2223
    a maximized window.
2218
  * This function is used only by the application '@panel',
2224
  * This function is used only by the application '@panel',
2219
    which set working area to all screen without system panel.
2225
    which set working area to all screen without system panel.
2220
  * (left,top) are coordinates of the left upper corner,
2226
  * (left,top) are coordinates of the left upper corner,
2221
    (right,bottom) are coordinates of the right lower one.
2227
    (right,bottom) are coordinates of the right lower one.
2222
    Thus the size of working area on x axis can be calculated by
2228
    Thus the size of working area on x axis can be calculated by
2223
    formula right-left+1, on y axis - by formula bottom-right+1.
2229
    formula right-left+1, on y axis - by formula bottom-right+1.
2224
  * If 'left'>='right', x-coordinate of working area is not changed.
2230
  * If 'left'>='right', x-coordinate of working area is not changed.
2225
    If 'left'<0, 'left' will not be set. If 'right' is greater than or
2231
    If 'left'<0, 'left' will not be set. If 'right' is greater than or
2226
    equal to screen width, 'right' will not be set.
2232
    equal to screen width, 'right' will not be set.
2227
    Similarly on y axis.
2233
    Similarly on y axis.
2228
  * See also function 14,
2234
  * See also function 14,
2229
    to get sizes of all screen.
2235
    to get sizes of all screen.
2230
  * There is a pair function to get working area - subfunction 5.
2236
  * There is a pair function to get working area - subfunction 5.
2231
  * This function redraws the screen automatically,
2237
  * This function redraws the screen automatically,
2232
    updating coordinates and sizes of maximized windows.
2238
    updating coordinates and sizes of maximized windows.
2233
    The system sends to all windows redraw message (the event 1).
2239
    The system sends to all windows redraw message (the event 1).
2234
 
2240
 
2235
======================================================================
2241
======================================================================
2236
=========== Function 48, subfunction 7 - get skin margins. ===========
2242
=========== Function 48, subfunction 7 - get skin margins. ===========
2237
======================================================================
2243
======================================================================
2238
Returns the area of a header of a skinned window, intended for
2244
Returns the area of a header of a skinned window, intended for
2239
a text of a header.
2245
a text of a header.
2240
Parameters:
2246
Parameters:
2241
  * eax = 48 - function number
2247
  * eax = 48 - function number
2242
  * ebx = 7 - subfunction number
2248
  * ebx = 7 - subfunction number
2243
Returned value:
2249
Returned value:
2244
  * eax = [left]*65536 + [right]
2250
  * eax = [left]*65536 + [right]
2245
  * ebx = [top]*65536 + [bottom]
2251
  * ebx = [top]*65536 + [bottom]
2246
Remarks:
2252
Remarks:
2247
  * An application decides itself to use or not to use this function.
2253
  * An application decides itself to use or not to use this function.
2248
  * It is recommended to take into account returned value
2254
  * It is recommended to take into account returned value
2249
    of this function for choice of a place for drawing header text
2255
    of this function for choice of a place for drawing header text
2250
    (by function 4) or a substitute of header text
2256
    (by function 4) or a substitute of header text
2251
    (at the discretion of an application).
2257
    (at the discretion of an application).
2252
 
2258
 
2253
======================================================================
2259
======================================================================
2254
============= Function 48, subfunction 8 - set used skin. ============
2260
============= Function 48, subfunction 8 - set used skin. ============
2255
======================================================================
2261
======================================================================
2256
Parameters:
2262
Parameters:
2257
  * eax = 48 - function number
2263
  * eax = 48 - function number
2258
  * ebx = 8 - subfunction number
2264
  * ebx = 8 - subfunction number
2259
  * ecx = pointer to a block for function 58, in
2265
  * ecx = pointer to a block for function 58, in
2260
    which the fields of intermediate buffer and file name are filled
2266
    which the fields of intermediate buffer and file name are filled
2261
Returned value:
2267
Returned value:
2262
  * eax = 0 - success
2268
  * eax = 0 - success
2263
  * otherwise eax = file system error code; if file does not
2269
  * otherwise eax = file system error code; if file does not
2264
    contain valid skin, function returns error 3
2270
    contain valid skin, function returns error 3
2265
    (unknown file system).
2271
    (unknown file system).
2266
Remarks:
2272
Remarks:
2267
  * After successful skin loading the system sends to all windows
2273
  * After successful skin loading the system sends to all windows
2268
    redraw message (the event 1).
2274
    redraw message (the event 1).
2269
  * At booting the system reads skin from file 'default.skn'
2275
  * At booting the system reads skin from file 'default.skn'
2270
    on ramdisk.
2276
    on ramdisk.
2271
  * User can change the skin statically by creating hisself
2277
  * User can change the skin statically by creating hisself
2272
    'default.skn' or dynamically with the application 'desktop'.
2278
    'default.skn' or dynamically with the application 'desktop'.
2273
 
2279
 
2274
======================================================================
2280
======================================================================
2275
=========== Function 49 - Advanced Power Management (APM). ===========
2281
=========== Function 49 - Advanced Power Management (APM). ===========
2276
======================================================================
2282
======================================================================
2277
Parameters:
2283
Parameters:
2278
  * eax = 49 - function number
2284
  * eax = 49 - function number
2279
  * dx = number of the APM function
2285
  * dx = number of the APM function
2280
    (analogue of ax in APM specification)
2286
    (analogue of ax in APM specification)
2281
  * bx, cx = parameters of the APM function
2287
  * bx, cx = parameters of the APM function
2282
Returned value:
2288
Returned value:
2283
  * 16-bit registers ax, bx, cx, dx, si, di and carry flag CF
2289
  * 16-bit registers ax, bx, cx, dx, si, di and carry flag CF
2284
    are set according to the APM specification
2290
    are set according to the APM specification
2285
  * high halves of 32-bit registers eax, ebx, ecx,
2291
  * high halves of 32-bit registers eax, ebx, ecx,
2286
    edx, esi, edi are destroyed
2292
    edx, esi, edi are destroyed
2287
Remarks:
2293
Remarks:
2288
  * APM 1.2 specification is described in the document
2294
  * APM 1.2 specification is described in the document
2289
    "Advanced Power Management (APM) BIOS Specification"
2295
    "Advanced Power Management (APM) BIOS Specification"
2290
    (Revision 1.2), available at
2296
    (Revision 1.2), available at
2291
    http://www.microsoft.com/whdc/archive/amp_12.mspx;
2297
    http://www.microsoft.com/whdc/archive/amp_12.mspx;
2292
    besides it is included in famous Interrupt List by Ralf Brown
2298
    besides it is included in famous Interrupt List by Ralf Brown
2293
    (http://www.pobox.com/~ralf/files.html,
2299
    (http://www.pobox.com/~ralf/files.html,
2294
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/).
2300
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/).
2295
 
2301
 
2296
======================================================================
2302
======================================================================
2297
=================== Function 50 - set window shape. ==================
2303
=================== Function 50 - set window shape. ==================
2298
======================================================================
2304
======================================================================
2299
Normal windows have rectangular shape. This function can give to
2305
Normal windows have rectangular shape. This function can give to
2300
a window any shape. The shape is given by a set of points inside
2306
a window any shape. The shape is given by a set of points inside
2301
the base rectangle belonging to a window. Position and coordinates
2307
the base rectangle belonging to a window. Position and coordinates
2302
of the base rectangle are set by function 0
2308
of the base rectangle are set by function 0
2303
and changed by function 67.
2309
and changed by function 67.
2304
 
2310
 
2305
--------------------------- Set shape data ---------------------------
2311
--------------------------- Set shape data ---------------------------
2306
Parameters:
2312
Parameters:
2307
  * eax = 50 - function number
2313
  * eax = 50 - function number
2308
  * ebx = 0 - subfunction number
2314
  * ebx = 0 - subfunction number
2309
  * ecx = pointer to shape data (array of bytes 0/1)
2315
  * ecx = pointer to shape data (array of bytes 0/1)
2310
Returned value:
2316
Returned value:
2311
  * function does not return value
2317
  * function does not return value
2312
 
2318
 
2313
-------------------------- Set shape scale ---------------------------
2319
-------------------------- Set shape scale ---------------------------
2314
Parameters:
2320
Parameters:
2315
  * eax = 50 - function number
2321
  * eax = 50 - function number
2316
  * ebx = 1 - subfunction number
2322
  * ebx = 1 - subfunction number
2317
  * ecx sets a scale: each byte of data defines
2323
  * ecx sets a scale: each byte of data defines
2318
    (2^scale)*(2^scale) pixels
2324
    (2^scale)*(2^scale) pixels
2319
Returned value:
2325
Returned value:
2320
  * function does not return value
2326
  * function does not return value
2321
Remarks:
2327
Remarks:
2322
  * Default scale is 0 (scale factor is 1). If in the shape data
2328
  * Default scale is 0 (scale factor is 1). If in the shape data
2323
    one byte corresponds to one pixel, there is no necessity
2329
    one byte corresponds to one pixel, there is no necessity
2324
    to set scale.
2330
    to set scale.
2325
  * Let's designate xsize = window width (in pixels), ysize = height;
2331
  * Let's designate xsize = window width (in pixels), ysize = height;
2326
    pay attention, that they are one pixel more than defined by
2332
    pay attention, that they are one pixel more than defined by
2327
    functions 0, 67.
2333
    functions 0, 67.
2328
  * On definition of scale xsize and ysize must be divisible
2334
  * On definition of scale xsize and ysize must be divisible
2329
    on 2^scale.
2335
    on 2^scale.
2330
  * Byte of data on offset 'a' must be 0/1 and defines belonging
2336
  * Byte of data on offset 'a' must be 0/1 and defines belonging
2331
    to a window of square with the side 2^scale (if scale=0,
2337
    to a window of square with the side 2^scale (if scale=0,
2332
    this is one pixel) and coordinates of the left upper corner
2338
    this is one pixel) and coordinates of the left upper corner
2333
    (a mod (xsize shr scale), a div (xsize shr scale))
2339
    (a mod (xsize shr scale), a div (xsize shr scale))
2334
  * Data size: (xsize shr scale)*(ysize shr scale).
2340
  * Data size: (xsize shr scale)*(ysize shr scale).
2335
  * Data must be presented in the memory and not change
2341
  * Data must be presented in the memory and not change
2336
    after set of shape.
2342
    after set of shape.
2337
  * The system views the shape data at every window redraw by
2343
  * The system views the shape data at every window redraw by
2338
    function 0.
2344
    function 0.
2339
  * The call of subfunction 0 with NULL pointer results in return
2345
  * The call of subfunction 0 with NULL pointer results in return
2340
    to the rectangular shape.
2346
    to the rectangular shape.
2341
 
2347
 
2342
======================================================================
2348
======================================================================
2343
==================== Function 51 - create thread. ====================
2349
==================== Function 51 - create thread. ====================
2344
======================================================================
2350
======================================================================
2345
Parameters:
2351
Parameters:
2346
  * eax = 51 - function number
2352
  * eax = 51 - function number
2347
  * ebx = 1 - unique subfunction
2353
  * ebx = 1 - unique subfunction
2348
  * ecx = address of thread entry point (starting eip)
2354
  * ecx = address of thread entry point (starting eip)
2349
  * edx = pointer to thread stack (starting esp)
2355
  * edx = pointer to thread stack (starting esp)
2350
Returned value:
2356
Returned value:
2351
  * eax = -1 - error (there is too many threads)
2357
  * eax = -1 - error (there is too many threads)
2352
  * otherwise eax = TID - thread identifier
2358
  * otherwise eax = TID - thread identifier
2353
         
2359
         
2354
 
2360
 
2355
======================================================================
2361
======================================================================
2356
=== Function 52, subfunction 0 - get network driver configuration. ===
2362
=== Function 52, subfunction 0 - get network driver configuration. ===
2357
======================================================================
2363
======================================================================
2358
Parameters:
2364
Parameters:
2359
  * eax = 52 - function number
2365
  * eax = 52 - function number
2360
  * ebx = 0 - subfunction number
2366
  * ebx = 0 - subfunction number
2361
Returned value:
2367
Returned value:
2362
  * eax = configuration dword
2368
  * eax = configuration dword
2363
Remarks:
2369
Remarks:
2364
  * Configuration dword can be set by subfunction 2.
2370
  * Configuration dword can be set by subfunction 2.
2365
  * The kernel does not use this variable. The value of this
2371
  * The kernel does not use this variable. The value of this
2366
    variable and working with it subfunctions 0 and 2 is represented
2372
    variable and working with it subfunctions 0 and 2 is represented
2367
    doubtful.
2373
    doubtful.
2368
 
2374
 
2369
======================================================================
2375
======================================================================
2370
========= Function 52, subfunction 1 - get local IP-address. =========
2376
========= Function 52, subfunction 1 - get local IP-address. =========
2371
======================================================================
2377
======================================================================
2372
Parameters:
2378
Parameters:
2373
  * eax = 52 - function number
2379
  * eax = 52 - function number
2374
  * ebx = 1 - subfunction number
2380
  * ebx = 1 - subfunction number
2375
Returned value:
2381
Returned value:
2376
  * eax = IP-address (4 bytes)
2382
  * eax = IP-address (4 bytes)
2377
Remarks:
2383
Remarks:
2378
  * Local IP-address is set by subfunction 3.
2384
  * Local IP-address is set by subfunction 3.
2379
 
2385
 
2380
======================================================================
2386
======================================================================
2381
=== Function 52, subfunction 2 - set network driver configuration. ===
2387
=== Function 52, subfunction 2 - set network driver configuration. ===
2382
======================================================================
2388
======================================================================
2383
Parameters:
2389
Parameters:
2384
  * eax = 52 - function number
2390
  * eax = 52 - function number
2385
  * ebx = 2 - subfunction number
2391
  * ebx = 2 - subfunction number
2386
  * ecx = configuration dword; if low 7 bits derivate the number 3,
2392
  * ecx = configuration dword; if low 7 bits derivate the number 3,
2387
    function [re-]initializes Ethernet-card, otherwise
2393
    function [re-]initializes Ethernet-card, otherwise
2388
    Ethernet turns off
2394
    Ethernet turns off
2389
Returned value:
2395
Returned value:
2390
  * if Ethernet-interface is not requested, function returns eax=2,
2396
  * if Ethernet-interface is not requested, function returns eax=2,
2391
    but this can be changed in future kernel versions
2397
    but this can be changed in future kernel versions
2392
  * if Ethernet-interface is requested, eax=0 means error
2398
  * if Ethernet-interface is requested, eax=0 means error
2393
    (absence of Ethernet-card), and nonzero value - success
2399
    (absence of Ethernet-card), and nonzero value - success
2394
Remarks:
2400
Remarks:
2395
  * Configuration dword can be read by subfunction 0.
2401
  * Configuration dword can be read by subfunction 0.
2396
  * The kernel does not use this variable. The value of this
2402
  * The kernel does not use this variable. The value of this
2397
    variable, subfunction 0 and part of subfunction 2, which set it,
2403
    variable, subfunction 0 and part of subfunction 2, which set it,
2398
    is represented doubtful.
2404
    is represented doubtful.
2399
 
2405
 
2400
======================================================================
2406
======================================================================
2401
========= Function 52, subfunction 3 - set local IP-address. =========
2407
========= Function 52, subfunction 3 - set local IP-address. =========
2402
======================================================================
2408
======================================================================
2403
Parameters:
2409
Parameters:
2404
  * eax = 52 - function number
2410
  * eax = 52 - function number
2405
  * ebx = 3 - subfunction number
2411
  * ebx = 3 - subfunction number
2406
  * ecx = IP-address (4 bytes)
2412
  * ecx = IP-address (4 bytes)
2407
Returned value:
2413
Returned value:
2408
  * the current implementation returns eax=3, but this can be changed
2414
  * the current implementation returns eax=3, but this can be changed
2409
    in future versions
2415
    in future versions
2410
Remarks:
2416
Remarks:
2411
  * Local IP-address can be get by subfunction 1.
2417
  * Local IP-address can be get by subfunction 1.
2412
 
2418
 
2413
======================================================================
2419
======================================================================
2414
= Function 52, subfunction 6 - add data to the stack of input queue. =
2420
= Function 52, subfunction 6 - add data to the stack of input queue. =
2415
======================================================================
2421
======================================================================
2416
Parameters:
2422
Parameters:
2417
  * eax = 52 - function number
2423
  * eax = 52 - function number
2418
  * ebx = 6 - subfunction number
2424
  * ebx = 6 - subfunction number
2419
  * edx = data size
2425
  * edx = data size
2420
  * esi = data pointer
2426
  * esi = data pointer
2421
Returned value:
2427
Returned value:
2422
  * eax = -1 - error
2428
  * eax = -1 - error
2423
  * eax = 0 - success
2429
  * eax = 0 - success
2424
Remarks:
2430
Remarks:
2425
  * This function is intended only for slow network drivers
2431
  * This function is intended only for slow network drivers
2426
    (PPP, SLIP).
2432
    (PPP, SLIP).
2427
  * Data size must not exceed 1500 bytes, though function
2433
  * Data size must not exceed 1500 bytes, though function
2428
    performs no checks on correctness.
2434
    performs no checks on correctness.
2429
 
2435
 
2430
======================================================================
2436
======================================================================
2431
 Function 52, subfunction 8 - read data from the network output queue. 
2437
 Function 52, subfunction 8 - read data from the network output queue. 
2432
======================================================================
2438
======================================================================
2433
Parameters:
2439
Parameters:
2434
  * eax = 52 - function number
2440
  * eax = 52 - function number
2435
  * ebx = 8 - subfunction number
2441
  * ebx = 8 - subfunction number
2436
  * esi = pointer to 1500-byte buffer
2442
  * esi = pointer to 1500-byte buffer
2437
Returned value:
2443
Returned value:
2438
  * eax = number of read bytes (in the current implementation
2444
  * eax = number of read bytes (in the current implementation
2439
    either 0 = no data or 1500)
2445
    either 0 = no data or 1500)
2440
  * data was copied in buffer
2446
  * data was copied in buffer
2441
Remarks:
2447
Remarks:
2442
  * This function is intended only for slow network drivers
2448
  * This function is intended only for slow network drivers
2443
    (PPP, SLIP).
2449
    (PPP, SLIP).
2444
 
2450
 
2445
======================================================================
2451
======================================================================
2446
============ Function 52, subfunction 9 - get gateway IP. ============
2452
============ Function 52, subfunction 9 - get gateway IP. ============
2447
======================================================================
2453
======================================================================
2448
Parameters:
2454
Parameters:
2449
  * eax = 52 - function number
2455
  * eax = 52 - function number
2450
  * ebx = 9 - subfunction number
2456
  * ebx = 9 - subfunction number
2451
Returned value:
2457
Returned value:
2452
  * eax = gateway IP (4 bytes)
2458
  * eax = gateway IP (4 bytes)
2453
 
2459
 
2454
======================================================================
2460
======================================================================
2455
=========== Function 52, subfunction 10 - get subnet mask. ===========
2461
=========== Function 52, subfunction 10 - get subnet mask. ===========
2456
======================================================================
2462
======================================================================
2457
Parameters:
2463
Parameters:
2458
  * eax = 52 - function number
2464
  * eax = 52 - function number
2459
  * ebx = 10 - subfunction number
2465
  * ebx = 10 - subfunction number
2460
Returned value:
2466
Returned value:
2461
  * eax = subnet mask
2467
  * eax = subnet mask
2462
 
2468
 
2463
======================================================================
2469
======================================================================
2464
============ Function 52, subfunction 11 - set gateway IP. ===========
2470
============ Function 52, subfunction 11 - set gateway IP. ===========
2465
======================================================================
2471
======================================================================
2466
Parameters:
2472
Parameters:
2467
  * eax = 52 - function number
2473
  * eax = 52 - function number
2468
  * ebx = 11 - subfunction number
2474
  * ebx = 11 - subfunction number
2469
  * ecx = gateway IP (4 bytes)
2475
  * ecx = gateway IP (4 bytes)
2470
Returned value:
2476
Returned value:
2471
  * the current implementation returns eax=11, but this can be changed
2477
  * the current implementation returns eax=11, but this can be changed
2472
    in future versions
2478
    in future versions
2473
 
2479
 
2474
======================================================================
2480
======================================================================
2475
=========== Function 52, subfunction 12 - set subnet mask. ===========
2481
=========== Function 52, subfunction 12 - set subnet mask. ===========
2476
======================================================================
2482
======================================================================
2477
Parameters:
2483
Parameters:
2478
  * eax = 52 - function number
2484
  * eax = 52 - function number
2479
  * ebx = 12 - subfunction number
2485
  * ebx = 12 - subfunction number
2480
  * ecx = subnet mask
2486
  * ecx = subnet mask
2481
Returned value:
2487
Returned value:
2482
  * the current implementation returns eax=12, but this can be changed
2488
  * the current implementation returns eax=12, but this can be changed
2483
    in future versions
2489
    in future versions
2484
 
2490
 
2485
======================================================================
2491
======================================================================
2486
============== Function 52, subfunction 13 - get DNS IP. =============
2492
============== Function 52, subfunction 13 - get DNS IP. =============
2487
======================================================================
2493
======================================================================
2488
Parameters:
2494
Parameters:
2489
  * eax = 52 - function number
2495
  * eax = 52 - function number
2490
  * ebx = 13 - subfunction number
2496
  * ebx = 13 - subfunction number
2491
Returned value:
2497
Returned value:
2492
  * eax = DNS IP (4 bytes)
2498
  * eax = DNS IP (4 bytes)
2493
 
2499
 
2494
======================================================================
2500
======================================================================
2495
============== Function 52, subfunction 14 - set DNS IP. =============
2501
============== Function 52, subfunction 14 - set DNS IP. =============
2496
======================================================================
2502
======================================================================
2497
Parameters:
2503
Parameters:
2498
  * eax = 52 - function number
2504
  * eax = 52 - function number
2499
  * ebx = 14 - subfunction number
2505
  * ebx = 14 - subfunction number
2500
  * ecx = DNS IP (4 bytes)
2506
  * ecx = DNS IP (4 bytes)
2501
Returned value:
2507
Returned value:
2502
  * the current implementation returns eax=14, but this can be changed
2508
  * the current implementation returns eax=14, but this can be changed
2503
    in future versions
2509
    in future versions
2504
 
2510
 
2505
======================================================================
2511
======================================================================
2506
============ Function 53, subfunction 0 - open UDP-socket. ===========
2512
============ Function 53, subfunction 0 - open UDP-socket. ===========
2507
======================================================================
2513
======================================================================
2508
Parameters:
2514
Parameters:
2509
  * eax = 53 - function number
2515
  * eax = 53 - function number
2510
  * ebx = 0 - subfunction number
2516
  * ebx = 0 - subfunction number
2511
  * ecx = local port (only low word is taken into account)
2517
  * ecx = local port (only low word is taken into account)
2512
  * edx = remote port (only low word is taken into account)
2518
  * edx = remote port (only low word is taken into account)
2513
  * esi = remote IP
2519
  * esi = remote IP
2514
Returned value:
2520
Returned value:
2515
  * eax = -1 = 0xFFFFFFFF - error; ebx destroyed
2521
  * eax = -1 = 0xFFFFFFFF - error; ebx destroyed
2516
  * eax = socket handle (some number which unambiguously identifies
2522
  * eax = socket handle (some number which unambiguously identifies
2517
    socket and have sense only for the system) - success;
2523
    socket and have sense only for the system) - success;
2518
    ebx destroyed
2524
    ebx destroyed
2519
 
2525
 
2520
======================================================================
2526
======================================================================
2521
=========== Function 53, subfunction 1 - close UDP-socket. ===========
2527
=========== Function 53, subfunction 1 - close UDP-socket. ===========
2522
======================================================================
2528
======================================================================
2523
Parameters:
2529
Parameters:
2524
  * eax = 53 - function number
2530
  * eax = 53 - function number
2525
  * ebx = 1 - subfunction number
2531
  * ebx = 1 - subfunction number
2526
  * ecx = socket handle
2532
  * ecx = socket handle
2527
Returned value:
2533
Returned value:
2528
  * eax = -1 - incorrect handle
2534
  * eax = -1 - incorrect handle
2529
  * eax = 0 - success
2535
  * eax = 0 - success
2530
  * ebx destroyed
2536
  * ebx destroyed
2531
Remarks:
2537
Remarks:
2532
  * The current implementation does not close automatically all
2538
  * The current implementation does not close automatically all
2533
    sockets of a thread at termination. In particular, one should not
2539
    sockets of a thread at termination. In particular, one should not
2534
    kill a thread with many opened sockets - there will be an outflow
2540
    kill a thread with many opened sockets - there will be an outflow
2535
    of resources.
2541
    of resources.
2536
  * The current implementation does no checks on correctness
2542
  * The current implementation does no checks on correctness
2537
    (function returns error only if thread tries to close not opened
2543
    (function returns error only if thread tries to close not opened
2538
    socket with correct handle).
2544
    socket with correct handle).
2539
 
2545
 
2540
======================================================================
2546
======================================================================
2541
============== Function 53, subfunction 2 - poll socket. =============
2547
============== Function 53, subfunction 2 - poll socket. =============
2542
======================================================================
2548
======================================================================
2543
Parameters:
2549
Parameters:
2544
  * eax = 53 - function number
2550
  * eax = 53 - function number
2545
  * ebx = 2 - subfunction number
2551
  * ebx = 2 - subfunction number
2546
  * ecx = socket handle
2552
  * ecx = socket handle
2547
Returned value:
2553
Returned value:
2548
  * eax = number of read bytes
2554
  * eax = number of read bytes
2549
  * ebx destroyed
2555
  * ebx destroyed
2550
Remarks:
2556
Remarks:
2551
  * There is no checks for correctness.
2557
  * There is no checks for correctness.
2552
 
2558
 
2553
======================================================================
2559
======================================================================
2554
========= Function 53, subfunction 3 - read byte from socket. ========
2560
========= Function 53, subfunction 3 - read byte from socket. ========
2555
======================================================================
2561
======================================================================
2556
Parameters:
2562
Parameters:
2557
  * eax = 53 - function number
2563
  * eax = 53 - function number
2558
  * ebx = 3 - subfunction number
2564
  * ebx = 3 - subfunction number
2559
  * ecx = socket handle
2565
  * ecx = socket handle
2560
Returned value:
2566
Returned value:
2561
  * if there is no read data: eax=0, bl=0,
2567
  * if there is no read data: eax=0, bl=0,
2562
    other bytes of ebx are destroyed
2568
    other bytes of ebx are destroyed
2563
  * if there are read data: eax=number of rest bytes
2569
  * if there are read data: eax=number of rest bytes
2564
    (possibly 0), bl=read byte, other bytes of ebx are destroyed
2570
    (possibly 0), bl=read byte, other bytes of ebx are destroyed
2565
Remarks:
2571
Remarks:
2566
  * There is no checks for correctness.
2572
  * There is no checks for correctness.
2567
 
2573
 
2568
======================================================================
2574
======================================================================
2569
========== Function 53, subfunction 4 - write to UDP-socket. =========
2575
========== Function 53, subfunction 4 - write to UDP-socket. =========
2570
======================================================================
2576
======================================================================
2571
Parameters:
2577
Parameters:
2572
  * eax = 53 - function number
2578
  * eax = 53 - function number
2573
  * ebx = 4 - subfunction number
2579
  * ebx = 4 - subfunction number
2574
  * ecx = socket handle
2580
  * ecx = socket handle
2575
  * edx = number of bytes to write
2581
  * edx = number of bytes to write
2576
  * esi = pointer to data to write
2582
  * esi = pointer to data to write
2577
Returned value:
2583
Returned value:
2578
  * eax = 0xffffffff - invalid handle
2584
  * eax = 0xffffffff - invalid handle
2579
  * eax = 0xffff - not enough memory
2585
  * eax = 0xffff - not enough memory
2580
  * eax = 0 - success
2586
  * eax = 0 - success
2581
  * ebx destroyed
2587
  * ebx destroyed
2582
Remarks:
2588
Remarks:
2583
  * Check on validity of handle is minimal - only not very incorrect
2589
  * Check on validity of handle is minimal - only not very incorrect
2584
    not opened handles are eliminated.
2590
    not opened handles are eliminated.
2585
  * Number of bytes to write must not exceed 1500-28, though
2591
  * Number of bytes to write must not exceed 1500-28, though
2586
    the appropriate check is not made.
2592
    the appropriate check is not made.
2587
 
2593
 
2588
======================================================================
2594
======================================================================
2589
============ Function 53, subfunction 5 - open TCP-socket. ===========
2595
============ Function 53, subfunction 5 - open TCP-socket. ===========
2590
======================================================================
2596
======================================================================
2591
Parameters:
2597
Parameters:
2592
  * eax = 53 - function number
2598
  * eax = 53 - function number
2593
  * ebx = 5 - subfunction number
2599
  * ebx = 5 - subfunction number
2594
  * ecx = local port (only low word is taken into account)
2600
  * ecx = local port (only low word is taken into account)
2595
  * edx = remote port (only low word is taken into account)
2601
  * edx = remote port (only low word is taken into account)
2596
  * esi = remote IP
2602
  * esi = remote IP
2597
  * edi = open mode: SOCKET_PASSIVE=0 or SOCKET_ACTIVE=1
2603
  * edi = open mode: SOCKET_PASSIVE=0 or SOCKET_ACTIVE=1
2598
Returned value:
2604
Returned value:
2599
  * eax = -1 = 0xFFFFFFFF - error; ebx destroys
2605
  * eax = -1 = 0xFFFFFFFF - error; ebx destroys
2600
  * eax = socket handle (some number which unambiguously identifies
2606
  * eax = socket handle (some number which unambiguously identifies
2601
    socket and have sense only for the system) - success;
2607
    socket and have sense only for the system) - success;
2602
    ebx destroyed
2608
    ebx destroyed
2603
 
2609
 
2604
======================================================================
2610
======================================================================
2605
========= Function 53, subfunction 6 - get TCP-socket status. ========
2611
========= Function 53, subfunction 6 - get TCP-socket status. ========
2606
======================================================================
2612
======================================================================
2607
Parameters:
2613
Parameters:
2608
  * eax = 53 - function number
2614
  * eax = 53 - function number
2609
  * ebx = 6 - subfunction number
2615
  * ebx = 6 - subfunction number
2610
  * ecx = socket handle
2616
  * ecx = socket handle
2611
Returned value:
2617
Returned value:
2612
  * eax = socket status: one of
2618
  * eax = socket status: one of
2613
  * TCB_LISTEN = 1
2619
  * TCB_LISTEN = 1
2614
  * TCB_SYN_SENT = 2
2620
  * TCB_SYN_SENT = 2
2615
  * TCB_SYN_RECEIVED = 3
2621
  * TCB_SYN_RECEIVED = 3
2616
  * TCB_ESTABLISHED = 4
2622
  * TCB_ESTABLISHED = 4
2617
  * TCB_FIN_WAIT_1 = 5
2623
  * TCB_FIN_WAIT_1 = 5
2618
  * TCB_FIN_WAIT_2 = 6
2624
  * TCB_FIN_WAIT_2 = 6
2619
  * TCB_CLOSE_WAIT = 7
2625
  * TCB_CLOSE_WAIT = 7
2620
  * TCB_CLOSING = 8
2626
  * TCB_CLOSING = 8
2621
  * TCB_LAST_ASK = 9
2627
  * TCB_LAST_ASK = 9
2622
  * TCB_TIME_WAIT = 10
2628
  * TCB_TIME_WAIT = 10
2623
  * TCB_CLOSED = 11
2629
  * TCB_CLOSED = 11
2624
  * ebx destroys
2630
  * ebx destroys
2625
Remarks:
2631
Remarks:
2626
  * There is no checks for correctness.
2632
  * There is no checks for correctness.
2627
 
2633
 
2628
======================================================================
2634
======================================================================
2629
========== Function 53, subfunction 7 - write to TCP-socket. =========
2635
========== Function 53, subfunction 7 - write to TCP-socket. =========
2630
======================================================================
2636
======================================================================
2631
Parameters:
2637
Parameters:
2632
  * eax = 53 - function number
2638
  * eax = 53 - function number
2633
  * ebx = 7 - subfunction number
2639
  * ebx = 7 - subfunction number
2634
  * ecx = socket handle
2640
  * ecx = socket handle
2635
  * edx = number of bytes to write
2641
  * edx = number of bytes to write
2636
  * esi = pointer to data to write
2642
  * esi = pointer to data to write
2637
Returned value:
2643
Returned value:
2638
  * eax = 0xffffffff - error
2644
  * eax = 0xffffffff - error
2639
  * eax = 0xffff - not enough memory
2645
  * eax = 0xffff - not enough memory
2640
  * eax = 0 - success
2646
  * eax = 0 - success
2641
  * ebx destroyed
2647
  * ebx destroyed
2642
Remarks:
2648
Remarks:
2643
  * Check on validity of handle is minimal - only not very incorrect
2649
  * Check on validity of handle is minimal - only not very incorrect
2644
    not opened handles are eliminated.
2650
    not opened handles are eliminated.
2645
  * Number of bytes to write must not exceed 1500-40, though
2651
  * Number of bytes to write must not exceed 1500-40, though
2646
    the appropriate check is not made.
2652
    the appropriate check is not made.
2647
 
2653
 
2648
======================================================================
2654
======================================================================
2649
=========== Function 53, subfunction 8 - close TCP-socket. ===========
2655
=========== Function 53, subfunction 8 - close TCP-socket. ===========
2650
======================================================================
2656
======================================================================
2651
Parameters:
2657
Parameters:
2652
  * eax = 53 - function number
2658
  * eax = 53 - function number
2653
  * ebx = 8 - subfunction number
2659
  * ebx = 8 - subfunction number
2654
  * ecx = socket handle
2660
  * ecx = socket handle
2655
Returned value:
2661
Returned value:
2656
  * eax = -1 - invalid handle
2662
  * eax = -1 - invalid handle
2657
  * eax = 0xffff - not enough memory for socket close packet
2663
  * eax = 0xffff - not enough memory for socket close packet
2658
  * eax = 0 - success
2664
  * eax = 0 - success
2659
  * in many cases eax is destroyed (the result of function 'queue'
2665
  * in many cases eax is destroyed (the result of function 'queue'
2660
    is returned) - probably this is bug, which will be corrected
2666
    is returned) - probably this is bug, which will be corrected
2661
  * ebx destroyed
2667
  * ebx destroyed
2662
Remarks:
2668
Remarks:
2663
  * The current implementation does not close automatically all
2669
  * The current implementation does not close automatically all
2664
    sockets of a thread at termination. In particular, one should not
2670
    sockets of a thread at termination. In particular, one should not
2665
    kill a thread with many opened sockets - there will be an outflow
2671
    kill a thread with many opened sockets - there will be an outflow
2666
    of resources.
2672
    of resources.
2667
  * The current implementation does no checks on correctness
2673
  * The current implementation does no checks on correctness
2668
    (function returns error only if thread tries to close not opened
2674
    (function returns error only if thread tries to close not opened
2669
    socket with correct handle).
2675
    socket with correct handle).
2670
 
2676
 
2671
======================================================================
2677
======================================================================
2672
=== Function 53, subfunction 9 - check whether local port is free. ===
2678
=== Function 53, subfunction 9 - check whether local port is free. ===
2673
======================================================================
2679
======================================================================
2674
Parameters:
2680
Parameters:
2675
  * eax = 53 - function number
2681
  * eax = 53 - function number
2676
  * ebx = 9 - subfunction number
2682
  * ebx = 9 - subfunction number
2677
  * ecx = local port number (low 16 bits are used only)
2683
  * ecx = local port number (low 16 bits are used only)
2678
Returned value:
2684
Returned value:
2679
  * eax = 0 - port is used
2685
  * eax = 0 - port is used
2680
  * eax = 1 - port is free
2686
  * eax = 1 - port is free
2681
  * ebx destroyed
2687
  * ebx destroyed
2682
 
2688
 
2683
======================================================================
2689
======================================================================
2684
= Function 53, subfunction 255 - debug information of network driver. 
2690
= Function 53, subfunction 255 - debug information of network driver. 
2685
======================================================================
2691
======================================================================
2686
Parameters:
2692
Parameters:
2687
  * eax = 53 - function number
2693
  * eax = 53 - function number
2688
  * ebx = 255 - subfunction number
2694
  * ebx = 255 - subfunction number
2689
  * ecx = type of requested information (see below)
2695
  * ecx = type of requested information (see below)
2690
Returned value:
2696
Returned value:
2691
  * eax = requested information
2697
  * eax = requested information
2692
  * ebx destroyed
2698
  * ebx destroyed
2693
Possible values for ecx:
2699
Possible values for ecx:
2694
  * 100: length of queue 0 (empty queue)
2700
  * 100: length of queue 0 (empty queue)
2695
  * 101: length of queue 1 (ip-out queue)
2701
  * 101: length of queue 1 (ip-out queue)
2696
  * 102: length of queue 2 (ip-in queue)
2702
  * 102: length of queue 2 (ip-in queue)
2697
  * 103: length of queue 3 (net1out queue)
2703
  * 103: length of queue 3 (net1out queue)
2698
  * 200: number of items in the ARP table
2704
  * 200: number of items in the ARP table
2699
  * 201: size of the ARP table (in items) (20 for current version)
2705
  * 201: size of the ARP table (in items) (20 for current version)
2700
  * 202: read item at edx of the ARP table to the temporary buffer,
2706
  * 202: read item at edx of the ARP table to the temporary buffer,
2701
    whence 5 following types take information;
2707
    whence 5 following types take information;
2702
    in this case eax is not defined
2708
    in this case eax is not defined
2703
  * 203: IP-address saved by type 202
2709
  * 203: IP-address saved by type 202
2704
  * 204: high dword of MAC-address saved by type 202
2710
  * 204: high dword of MAC-address saved by type 202
2705
  * 205: low word of MAC-address saved by type 202
2711
  * 205: low word of MAC-address saved by type 202
2706
  * 206: status word saved by type 202
2712
  * 206: status word saved by type 202
2707
  * 207: ttl word saved by type 202
2713
  * 207: ttl word saved by type 202
2708
  * 2: total number of received IP-packets
2714
  * 2: total number of received IP-packets
2709
  * 3: total number of transferred IP-packets
2715
  * 3: total number of transferred IP-packets
2710
  * 4: total number of dumped received packets
2716
  * 4: total number of dumped received packets
2711
  * 5: total number of received ARP-packets
2717
  * 5: total number of received ARP-packets
2712
  * 6: status of packet driver, 0=inactive, nonzero=active
2718
  * 6: status of packet driver, 0=inactive, nonzero=active
2713
 
2719
 
2714
======================================================================
2720
======================================================================
2715
========== Function 55, subfunction 0 - load data for SB16. ==========
2721
========== Function 55, subfunction 0 - load data for SB16. ==========
2716
======================================================================
2722
======================================================================
2717
Parameters:
2723
Parameters:
2718
  * eax = 55 - function number
2724
  * eax = 55 - function number
2719
  * ebx = 0 - subfunction number
2725
  * ebx = 0 - subfunction number
2720
  * ecx = pointer to data (is copied 64 kilobytes, is used as much as
2726
  * ecx = pointer to data (is copied 64 kilobytes, is used as much as
2721
    set by subfunction 2)
2727
    set by subfunction 2)
2722
Returned value:
2728
Returned value:
2723
  * function does not return value
2729
  * function does not return value
2724
Remarks:
2730
Remarks:
2725
  * Format and size of data are set by subfunction 2.
2731
  * Format and size of data are set by subfunction 2.
2726
 
2732
 
2727
======================================================================
2733
======================================================================
2728
======== Function 55, subfunction 1 - begin play data on SB16. =======
2734
======== Function 55, subfunction 1 - begin play data on SB16. =======
2729
======================================================================
2735
======================================================================
2730
Parameters:
2736
Parameters:
2731
  * eax = 55 - function number
2737
  * eax = 55 - function number
2732
  * ebx = 1 - subfunction number
2738
  * ebx = 1 - subfunction number
2733
Returned value:
2739
Returned value:
2734
  * function does not return value
2740
  * function does not return value
2735
Remarks:
2741
Remarks:
2736
  * Previously data must be loaded by subfunction 0 and
2742
  * Previously data must be loaded by subfunction 0 and
2737
    their format must be defined by subfunction 2.
2743
    their format must be defined by subfunction 2.
2738
  * Function returns control, when playing of data began; after that
2744
  * Function returns control, when playing of data began; after that
2739
    play goes independently from application (and does not use
2745
    play goes independently from application (and does not use
2740
    processor time at all).
2746
    processor time at all).
2741
  * Previously must be defined SB16 base port
2747
  * Previously must be defined SB16 base port
2742
    (by subfunction 4 of function 21) and DMA channel
2748
    (by subfunction 4 of function 21) and DMA channel
2743
    (by subfunction 10 of function 21).
2749
    (by subfunction 10 of function 21).
2744
 
2750
 
2745
======================================================================
2751
======================================================================
2746
======== Function 55, subfunction 2 - set format of SB16 data. =======
2752
======== Function 55, subfunction 2 - set format of SB16 data. =======
2747
======================================================================
2753
======================================================================
2748
Parameters:
2754
Parameters:
2749
  * eax = 55 - function number
2755
  * eax = 55 - function number
2750
  * ebx = 2 - subfunction number
2756
  * ebx = 2 - subfunction number
2751
  * ecx = 0 - set digit capacity
2757
  * ecx = 0 - set digit capacity
2752
    * edx = 1 - 8bit mono
2758
    * edx = 1 - 8bit mono
2753
    * edx = 2 - 8bit stereo
2759
    * edx = 2 - 8bit stereo
2754
  * ecx = 1 - set data size
2760
  * ecx = 1 - set data size
2755
    * edx = size in bytes
2761
    * edx = size in bytes
2756
  * ecx = 2 - set play frequency
2762
  * ecx = 2 - set play frequency
2757
    * edx = frequency
2763
    * edx = frequency
2758
Returned value:
2764
Returned value:
2759
  * function does not return value
2765
  * function does not return value
2760
Remarks:
2766
Remarks:
2761
  * When the system boots, it sets following default parameters:
2767
  * When the system boots, it sets following default parameters:
2762
    digit capacity - 8bit mono, size - 64 Kb, frequency - 44100 Hz.
2768
    digit capacity - 8bit mono, size - 64 Kb, frequency - 44100 Hz.
2763
    Nevertheless it is recommended to set necessary values obviously
2769
    Nevertheless it is recommended to set necessary values obviously
2764
    as they could be reset by some application.
2770
    as they could be reset by some application.
2765
 
2771
 
2766
======================================================================
2772
======================================================================
2767
 Function 55, subfunction 55 - begin to play data on built-in speaker. 
2773
 Function 55, subfunction 55 - begin to play data on built-in speaker. 
2768
======================================================================
2774
======================================================================
2769
Parameters:
2775
Parameters:
2770
  * eax = 55 - function number
2776
  * eax = 55 - function number
2771
  * ebx = 55 - subfunction number
2777
  * ebx = 55 - subfunction number
2772
  * esi = pointer to data
2778
  * esi = pointer to data
2773
Returned value:
2779
Returned value:
2774
  * eax = 0 - success
2780
  * eax = 0 - success
2775
  * eax = 55 - error (speaker is off or busy)
2781
  * eax = 55 - error (speaker is off or busy)
2776
Data is an array of items with variable length.
2782
Data is an array of items with variable length.
2777
Format of each item is defined by first byte:
2783
Format of each item is defined by first byte:
2778
  * 0 = end of data
2784
  * 0 = end of data
2779
  * 1..0x80 = sets sound duration on 1/100 of second; sound note
2785
  * 1..0x80 = sets sound duration on 1/100 of second; sound note
2780
    is defined by immediate value of frequency
2786
    is defined by immediate value of frequency
2781
    * following word (2 bytes) contains frequency divider;
2787
    * following word (2 bytes) contains frequency divider;
2782
      frequency is defined as 1193180/divider
2788
      frequency is defined as 1193180/divider
2783
  * 0x81 = invalid
2789
  * 0x81 = invalid
2784
  * 0x82..0xFF = note is defined by octave and number:
2790
  * 0x82..0xFF = note is defined by octave and number:
2785
    * duration in 1/100 of second = (first byte)-0x81
2791
    * duration in 1/100 of second = (first byte)-0x81
2786
    * there is one more byte;
2792
    * there is one more byte;
2787
    * (second byte)=0xFF - delay
2793
    * (second byte)=0xFF - delay
2788
    * otherwise it looks like a*0x10+b, where b=number of the note in
2794
    * otherwise it looks like a*0x10+b, where b=number of the note in
2789
      an octave from 1 to 12, a=number of octave (beginning from 0)
2795
      an octave from 1 to 12, a=number of octave (beginning from 0)
2790
Remarks:
2796
Remarks:
2791
  * Speaker play can be disabled/enabled by
2797
  * Speaker play can be disabled/enabled by
2792
    subfunction 8 of function 18.
2798
    subfunction 8 of function 18.
2793
  * Function returns control, having informed the system
2799
  * Function returns control, having informed the system
2794
    an information on request. Play itself goes independently from
2800
    an information on request. Play itself goes independently from
2795
    the program.
2801
    the program.
2796
  * The data must be kept in the memory at least up to the end
2802
  * The data must be kept in the memory at least up to the end
2797
    of play.
2803
    of play.
2798
 
2804
 
2799
======================================================================
2805
======================================================================
2800
=============== Function 56 - write file to hard disk. ===============
2806
=============== Function 56 - write file to hard disk. ===============
2801
======================================================================
2807
======================================================================
2802
Parameters:
2808
Parameters:
2803
  * eax = 56 - function number
2809
  * eax = 56 - function number
2804
  * ebx = pointer to the file name
2810
  * ebx = pointer to the file name
2805
  * ecx = size of data to write (in bytes)
2811
  * ecx = size of data to write (in bytes)
2806
  * edx = pointer to data to write
2812
  * edx = pointer to data to write
2807
  * esi = pointer to path (ASCIIZ-string)
2813
  * esi = pointer to path (ASCIIZ-string)
2808
Returned value:
2814
Returned value:
2809
  * eax = 0 - success, otherwise file system error code
2815
  * eax = 0 - success, otherwise file system error code
2810
Remarks:
2816
Remarks:
2811
  * This function is obsolete; function 70 allows to fulfil the same
2817
  * This function is obsolete; function 70 allows to fulfil the same
2812
    operations with the extended possibilities.
2818
    operations with the extended possibilities.
2813
  * This function assumes that during its call by one application
2819
  * This function assumes that during its call by one application
2814
    no other application works with hard disk.
2820
    no other application works with hard disk.
2815
  * The path to file is ASCIIZ-string, which may be empty
2821
  * The path to file is ASCIIZ-string, which may be empty
2816
    (if the file is created in the root folder) or have the format
2822
    (if the file is created in the root folder) or have the format
2817
    /d1/d2/.../dn, where all folder names must have the 8+3 format,
2823
    /d1/d2/.../dn, where all folder names must have the 8+3 format,
2818
    i.e. 8 characters of name and 3 characters of the extension
2824
    i.e. 8 characters of name and 3 characters of the extension
2819
    without separator, supplemented by blanks if necessary;
2825
    without separator, supplemented by blanks if necessary;
2820
    all letters must be capital.
2826
    all letters must be capital.
2821
  * The file name must also have the format 8+3.
2827
  * The file name must also have the format 8+3.
2822
 
2828
 
2823
======================================================================
2829
======================================================================
2824
================ Function 58 - work with file system. ================
2830
================ Function 58 - work with file system. ================
2825
======================================================================
2831
======================================================================
2826
Parameters:
2832
Parameters:
2827
  * eax = 58
2833
  * eax = 58
2828
  * ebx = pointer to the information structure
2834
  * ebx = pointer to the information structure
2829
Returned value:
2835
Returned value:
2830
  * eax = 0 - success; otherwise file system error code
2836
  * eax = 0 - success; otherwise file system error code
2831
  * some subfunctions return value in other registers too
2837
  * some subfunctions return value in other registers too
2832
General format of the information structure:
2838
General format of the information structure:
2833
  * +0: dword: subfunction number
2839
  * +0: dword: subfunction number
2834
  * +4: dword: number of block
2840
  * +4: dword: number of block
2835
  * +8: dword: size
2841
  * +8: dword: size
2836
  * +12 = +0xC: dword: pointer to data
2842
  * +12 = +0xC: dword: pointer to data
2837
  * +16 = +0x10: dword: pointer to a memory for system operations
2843
  * +16 = +0x10: dword: pointer to a memory for system operations
2838
    (4096 bytes)
2844
    (4096 bytes)
2839
  * +20 = +0x14: n db: ASCIIZ-string with the file name
2845
  * +20 = +0x14: n db: ASCIIZ-string with the file name
2840
Specifications - in documentation on the appropriate subfunction.
2846
Specifications - in documentation on the appropriate subfunction.
2841
Filename is case-insensitive for latin letters, russian letters
2847
Filename is case-insensitive for latin letters, russian letters
2842
must be capital.
2848
must be capital.
2843
Format of filename:
2849
Format of filename:
2844
/base/number/dir1/dir2/.../dirn/file,
2850
/base/number/dir1/dir2/.../dirn/file,
2845
where /base/number identifies device, on which file is located:
2851
where /base/number identifies device, on which file is located:
2846
one of
2852
one of
2847
  * /RD/1 = /RAMDISK/1 to access ramdisk
2853
  * /RD/1 = /RAMDISK/1 to access ramdisk
2848
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
2854
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
2849
    /FD/2 = /FLOPPYDISK/2 to access second one
2855
    /FD/2 = /FLOPPYDISK/2 to access second one
2850
  * /HD/x = /HARDDISK/x - obsolete variant of access to hard disk
2856
  * /HD/x = /HARDDISK/x - obsolete variant of access to hard disk
2851
    (in this case base is defined by subfunction 7 of function 21),
2857
    (in this case base is defined by subfunction 7 of function 21),
2852
    x - partition number (beginning from 1)
2858
    x - partition number (beginning from 1)
2853
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
2859
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
2854
    IDE0 (Primary Master), IDE1 (Primary Slave),
2860
    IDE0 (Primary Master), IDE1 (Primary Slave),
2855
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
2861
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
2856
    x - partition number on the selected hard drive, varies from 1
2862
    x - partition number on the selected hard drive, varies from 1
2857
    to 255 (on each hard drive the indexing starts from 1)
2863
    to 255 (on each hard drive the indexing starts from 1)
2858
Remarks:
2864
Remarks:
2859
  * In the first two cases it is also possible to use FIRST
2865
  * In the first two cases it is also possible to use FIRST
2860
    instead of 1, SECOND instead of 2, but it is not recommended
2866
    instead of 1, SECOND instead of 2, but it is not recommended
2861
    for convenience of transition to the future extensions.
2867
    for convenience of transition to the future extensions.
2862
  * Limitation n<=39 is imposed.
2868
  * Limitation n<=39 is imposed.
2863
  * Names of folders and file dir1,...,dirn,file must have the
2869
  * Names of folders and file dir1,...,dirn,file must have the
2864
    format 8.3: name no more than 8 characters, dot, extension no
2870
    format 8.3: name no more than 8 characters, dot, extension no
2865
    more than 3 characters. Trailing spaces are ignored, no other
2871
    more than 3 characters. Trailing spaces are ignored, no other
2866
    spaces is allowed. If name occupies equally 8 characters,
2872
    spaces is allowed. If name occupies equally 8 characters,
2867
    dot may be omitted (though it is not recommended to use this
2873
    dot may be omitted (though it is not recommended to use this
2868
    feature for convenience of transition to the future extensions).
2874
    feature for convenience of transition to the future extensions).
2869
  * This function does not support folders on ramdisk.
2875
  * This function does not support folders on ramdisk.
2870
Examples:
2876
Examples:
2871
  * '/RAMDISK/FIRST/KERNEL.ASM',0
2877
  * '/RAMDISK/FIRST/KERNEL.ASM',0
2872
    '/rd/1/kernel.asm',0
2878
    '/rd/1/kernel.asm',0
2873
  * '/HD0/1/kernel.asm',0
2879
  * '/HD0/1/kernel.asm',0
2874
  * '/hd0/1/menuet/pics/tanzania.bmp',0
2880
  * '/hd0/1/menuet/pics/tanzania.bmp',0
2875
Existing subfunctions:
2881
Existing subfunctions:
2876
  * subfunction 0 - read file/folder
2882
  * subfunction 0 - read file/folder
2877
  * subfunction 1 - rewrite file
2883
  * subfunction 1 - rewrite file
2878
  * subfunction 2 - delete file/folder
2884
  * subfunction 2 - delete file/folder
2879
  * subfunction 4 - make folder
2885
  * subfunction 4 - make folder
2880
  * subfunction 5 - rename/move file/folder
2886
  * subfunction 5 - rename/move file/folder
2881
  * subfunction 8 - LBA-read from device
2887
  * subfunction 8 - LBA-read from device
2882
  * subfunction 15 - get file system information
2888
  * subfunction 15 - get file system information
2883
  * subfunction 16 - start application
2889
  * subfunction 16 - start application
2884
 
2890
 
2885
======================================================================
2891
======================================================================
2886
=========== Function 58, subfunction 0 - read file/folder. ===========
2892
=========== Function 58, subfunction 0 - read file/folder. ===========
2887
======================================================================
2893
======================================================================
2888
Parameters:
2894
Parameters:
2889
  * eax = 58
2895
  * eax = 58
2890
  * ebx = pointer to the information structure
2896
  * ebx = pointer to the information structure
2891
Format of the information structure:
2897
Format of the information structure:
2892
  * +0: dword: 0 = subfunction number
2898
  * +0: dword: 0 = subfunction number
2893
  * +4: dword: first block to read (beginning from 0)
2899
  * +4: dword: first block to read (beginning from 0)
2894
  * +8: dword: amount of blocks to read
2900
  * +8: dword: amount of blocks to read
2895
  * +12 = +0xC: dword: pointer to buffer for data
2901
  * +12 = +0xC: dword: pointer to buffer for data
2896
  * +16 = +0x10: dword: pointer to buffer for system operations
2902
  * +16 = +0x10: dword: pointer to buffer for system operations
2897
    (4096 bytes)
2903
    (4096 bytes)
2898
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2904
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2899
    given in the general description
2905
    given in the general description
2900
Returned value:
2906
Returned value:
2901
  * eax = 0 - success, otherwise file system error code
2907
  * eax = 0 - success, otherwise file system error code
2902
  * ebx = file size (in bytes) or -1=0xffffffff, if file was not found
2908
  * ebx = file size (in bytes) or -1=0xffffffff, if file was not found
2903
Remarks:
2909
Remarks:
2904
  * Block size is 512 bytes.
2910
  * Block size is 512 bytes.
2905
  * This function is obsolete, for reading files use subfunction 0
2911
  * This function is obsolete, for reading files use subfunction 0
2906
    of function 70, for reading folders - subfunction 1 of
2912
    of function 70, for reading folders - subfunction 1 of
2907
    function 70.
2913
    function 70.
2908
  * Function can read contents of a folder. Only FAT file system is
2914
  * Function can read contents of a folder. Only FAT file system is
2909
    supported. The format of FAT-folder is described
2915
    supported. The format of FAT-folder is described
2910
    in any FAT documentation.
2916
    in any FAT documentation.
2911
  * Size of a folder is determined by size of FAT clusters chain.
2917
  * Size of a folder is determined by size of FAT clusters chain.
2912
  * If file was ended before last requested block was read,
2918
  * If file was ended before last requested block was read,
2913
    the function will read as many as it can, and after that return
2919
    the function will read as many as it can, and after that return
2914
    eax=6 (EOF).
2920
    eax=6 (EOF).
2915
  * Function can read root folders /rd/1,/fd/x,/hd[n]/x, but
2921
  * Function can read root folders /rd/1,/fd/x,/hd[n]/x, but
2916
    in the first two cases the current implementation does not follow
2922
    in the first two cases the current implementation does not follow
2917
    to the declared rules:
2923
    to the declared rules:
2918
    for /rd/1:
2924
    for /rd/1:
2919
    * if one want to read 0 blocks, function considers,
2925
    * if one want to read 0 blocks, function considers,
2920
      that he requested 1;
2926
      that he requested 1;
2921
    * if one requests more than 14 blocks or starting block is
2927
    * if one requests more than 14 blocks or starting block is
2922
      not less than 14, function returns eax=5 (not found) è ebx=-1;
2928
      not less than 14, function returns eax=5 (not found) è ebx=-1;
2923
    * size of ramdisk root folder is 14 blocks, 
2929
    * size of ramdisk root folder is 14 blocks, 
2924
      0x1C00=7168 áàéò; but function returns ebx=0
2930
      0x1C00=7168 áàéò; but function returns ebx=0
2925
      (except of the case of previous item);
2931
      (except of the case of previous item);
2926
    * strangely enough, it is possible to read 14th block (which
2932
    * strangely enough, it is possible to read 14th block (which
2927
      generally contains a garbage - I remind, the indexing begins
2933
      generally contains a garbage - I remind, the indexing begins
2928
      from 0);
2934
      from 0);
2929
    * if some block with the number not less than 14 was requested,
2935
    * if some block with the number not less than 14 was requested,
2930
      function returns eax=6(EOF); otherwise eax=0.
2936
      function returns eax=6(EOF); otherwise eax=0.
2931
    For /fd/x:
2937
    For /fd/x:
2932
    * if the start block is not less than 14, function returns
2938
    * if the start block is not less than 14, function returns
2933
      eax=5 (not found) and ebx=0;
2939
      eax=5 (not found) and ebx=0;
2934
    * note that format of FAT12 allows floppies with the root size
2940
    * note that format of FAT12 allows floppies with the root size
2935
      more or less than 14 blocks;
2941
      more or less than 14 blocks;
2936
    * check for length is not performed;
2942
    * check for length is not performed;
2937
    * if data was successful read, function returns
2943
    * if data was successful read, function returns
2938
      eax=0,ebx=0; otherwise eax=10 (access denied), ebx=-1.
2944
      eax=0,ebx=0; otherwise eax=10 (access denied), ebx=-1.
2939
  * The function handles reading of special folders /,/rd,/fd,/hd[n];
2945
  * The function handles reading of special folders /,/rd,/fd,/hd[n];
2940
    but the result does not correspond to expected (on operations with
2946
    but the result does not correspond to expected (on operations with
2941
    normal files/folders), does not follow the declared rules,
2947
    normal files/folders), does not follow the declared rules,
2942
    may be changed in future versions of the kernel and consequently
2948
    may be changed in future versions of the kernel and consequently
2943
    is not described. To obtain the information about the equipment
2949
    is not described. To obtain the information about the equipment
2944
    use subfunction 11 of function 18 or
2950
    use subfunction 11 of function 18 or
2945
    read corresponding folder with subfunction 1 of function 70.
2951
    read corresponding folder with subfunction 1 of function 70.
2946
 
2952
 
2947
======================================================================
2953
======================================================================
2948
============= Function 58, subfunction 1 - rewrite file. =============
2954
============= Function 58, subfunction 1 - rewrite file. =============
2949
======================================================================
2955
======================================================================
2950
If the file does not exist, it is created.
2956
If the file does not exist, it is created.
2951
If the file exists, it is rewritten.
2957
If the file exists, it is rewritten.
2952
Parameters:
2958
Parameters:
2953
  * eax = 58 - function number
2959
  * eax = 58 - function number
2954
  * ebx = pointer to the information structure
2960
  * ebx = pointer to the information structure
2955
Format of the information structure:
2961
Format of the information structure:
2956
  * +0: dword: 1 = subfunction number
2962
  * +0: dword: 1 = subfunction number
2957
  * +4: dword: ignored (set to 0)
2963
  * +4: dword: ignored (set to 0)
2958
  * +8: dword: number of bytes to write
2964
  * +8: dword: number of bytes to write
2959
  * +12 = +0xC: dword: pointer to data to write
2965
  * +12 = +0xC: dword: pointer to data to write
2960
  * +16 = +0x10: dword: pointer to buffer for system operations
2966
  * +16 = +0x10: dword: pointer to buffer for system operations
2961
    (4096 bytes)
2967
    (4096 bytes)
2962
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2968
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2963
    given in the general description
2969
    given in the general description
2964
Returned value:
2970
Returned value:
2965
  * eax = 0 - success, otherwise file system error code
2971
  * eax = 0 - success, otherwise file system error code
2966
  * ebx destroyed
2972
  * ebx destroyed
2967
Remarks:
2973
Remarks:
2968
  * This function is obsolete, use subfunction 2 of function 70.
2974
  * This function is obsolete, use subfunction 2 of function 70.
2969
 
2975
 
2970
======================================================================
2976
======================================================================
2971
========== Function 58, subfunction 2 - delete file/folder. ==========
2977
========== Function 58, subfunction 2 - delete file/folder. ==========
2972
======================================================================
2978
======================================================================
2973
Parameters:
2979
Parameters:
2974
  * eax = 58 - function number
2980
  * eax = 58 - function number
2975
  * ebx = pointer to the information structure
2981
  * ebx = pointer to the information structure
2976
Format of the information structure:
2982
Format of the information structure:
2977
  * +0: dword: 2 = subfunction number
2983
  * +0: dword: 2 = subfunction number
2978
  * +4: dword: ignored
2984
  * +4: dword: ignored
2979
  * +8: dword: ignored
2985
  * +8: dword: ignored
2980
  * +12 = +0xC: dword: ignored
2986
  * +12 = +0xC: dword: ignored
2981
  * +16 = +0x10: dword: pointer to buffer for system operations
2987
  * +16 = +0x10: dword: pointer to buffer for system operations
2982
    (4096 bytes)
2988
    (4096 bytes)
2983
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2989
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
2984
    given in the general description
2990
    given in the general description
2985
Returned value:
2991
Returned value:
2986
  * eax = 0 - success, otherwise file system error code
2992
  * eax = 0 - success, otherwise file system error code
2987
  * ebx destroyed
2993
  * ebx destroyed
2988
Remarks:
2994
Remarks:
2989
  * By operations with a floppy one should not delete not empty
2995
  * By operations with a floppy one should not delete not empty
2990
    folder. The code working with hard disk deletes not empty folders
2996
    folder. The code working with hard disk deletes not empty folders
2991
    correctly (i.e. recursively with all files and nested folders).
2997
    correctly (i.e. recursively with all files and nested folders).
2992
    Function 58 does not support folders on ramdisk.
2998
    Function 58 does not support folders on ramdisk.
2993
 
2999
 
2994
======================================================================
3000
======================================================================
2995
============== Function 58, subfunction 4 - make folder. =============
3001
============== Function 58, subfunction 4 - make folder. =============
2996
======================================================================
3002
======================================================================
2997
Parameters:
3003
Parameters:
2998
  * eax = 58 - function number
3004
  * eax = 58 - function number
2999
  * ebx = pointer to the information structure
3005
  * ebx = pointer to the information structure
3000
Format of the information structure:
3006
Format of the information structure:
3001
  * +0: dword: 4 = subfunction number
3007
  * +0: dword: 4 = subfunction number
3002
  * +4: dword: ignored
3008
  * +4: dword: ignored
3003
  * +8: dword: ignored
3009
  * +8: dword: ignored
3004
  * +12 = +0xC: dword: ignored
3010
  * +12 = +0xC: dword: ignored
3005
  * +16 = +0x10: dword: pointer to buffer for system operations
3011
  * +16 = +0x10: dword: pointer to buffer for system operations
3006
    (4096 bytes)
3012
    (4096 bytes)
3007
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
3013
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
3008
    given in the general description
3014
    given in the general description
3009
Returned value:
3015
Returned value:
3010
  * eax = 0 - success, otherwise file system error code
3016
  * eax = 0 - success, otherwise file system error code
3011
  * ebx destroyed
3017
  * ebx destroyed
3012
Remarks:
3018
Remarks:
3013
  * Ramdisk and floppies do not support this function, it is only
3019
  * Ramdisk and floppies do not support this function, it is only
3014
    for hard disks.
3020
    for hard disks.
3015
 
3021
 
3016
======================================================================
3022
======================================================================
3017
======== Function 58, subfunction 5 - rename/move file/folder. =======
3023
======== Function 58, subfunction 5 - rename/move file/folder. =======
3018
======================================================================
3024
======================================================================
3019
Parameters:
3025
Parameters:
3020
  * eax = 58 - function number
3026
  * eax = 58 - function number
3021
  * ebx = pointer to the information structure
3027
  * ebx = pointer to the information structure
3022
Format of the information structure:
3028
Format of the information structure:
3023
  * +0: dword: 5 = subfunction number
3029
  * +0: dword: 5 = subfunction number
3024
  * +4: dword: ignored
3030
  * +4: dword: ignored
3025
  * +8: dword: ignored
3031
  * +8: dword: ignored
3026
  * +12 = +0xC: dword: ignored
3032
  * +12 = +0xC: dword: ignored
3027
  * +16 = +0x10: dword: pointer to buffer for system operations
3033
  * +16 = +0x10: dword: pointer to buffer for system operations
3028
    (4096 bytes)
3034
    (4096 bytes)
3029
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
3035
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
3030
    given in the general description
3036
    given in the general description
3031
  * +20+n: (at once after terminating null character) new
3037
  * +20+n: (at once after terminating null character) new
3032
    ASCIIZ-name, must start from /hd/1, that is interpreted as
3038
    ASCIIZ-name, must start from /hd/1, that is interpreted as
3033
    the hard disk, indicated in the first name
3039
    the hard disk, indicated in the first name
3034
    (moving from one disk to another is not supported)
3040
    (moving from one disk to another is not supported)
3035
Returned value:
3041
Returned value:
3036
  * eax = 0 - success, otherwise file system error code
3042
  * eax = 0 - success, otherwise file system error code
3037
  * ebx destroyed
3043
  * ebx destroyed
3038
Remarks:
3044
Remarks:
3039
  * Ramdisk and floppies do not support this function, it is only
3045
  * Ramdisk and floppies do not support this function, it is only
3040
    for hard disks.
3046
    for hard disks.
3041
  * If the new ASCIIZ-name is strongly incorrect, i.e. does not start
3047
  * If the new ASCIIZ-name is strongly incorrect, i.e. does not start
3042
    from /hd/1, /hd/first, /harddisk/1, /harddisk/first or after this
3048
    from /hd/1, /hd/first, /harddisk/1, /harddisk/first or after this
3043
    space or null character follows, function returns, strangely
3049
    space or null character follows, function returns, strangely
3044
    enough, error code 4. It is the only function which returns
3050
    enough, error code 4. It is the only function which returns
3045
    this code.
3051
    this code.
3046
 
3052
 
3047
======================================================================
3053
======================================================================
3048
========= Function 58, subfunction 8 - LBA-read from device. =========
3054
========= Function 58, subfunction 8 - LBA-read from device. =========
3049
======================================================================
3055
======================================================================
3050
Parameters:
3056
Parameters:
3051
  * eax = 58 - function number
3057
  * eax = 58 - function number
3052
  * ebx = pointer to the information structure
3058
  * ebx = pointer to the information structure
3053
Format of the information structure:
3059
Format of the information structure:
3054
  * +0: dword: 8 = subfunction number
3060
  * +0: dword: 8 = subfunction number
3055
  * +4: dword: number of block to read (beginning from 0)
3061
  * +4: dword: number of block to read (beginning from 0)
3056
  * +8: dword: ignored (set to 1)
3062
  * +8: dword: ignored (set to 1)
3057
  * +12 = +0xC: dword: pointer to buffer for data (512 bytes)
3063
  * +12 = +0xC: dword: pointer to buffer for data (512 bytes)
3058
  * +16 = +0x10: dword: pointer to buffer for system operations
3064
  * +16 = +0x10: dword: pointer to buffer for system operations
3059
    (4096 bytes)
3065
    (4096 bytes)
3060
  * +20 = +0x14: ASCIIZ-name of device: case-insensitive, one of
3066
  * +20 = +0x14: ASCIIZ-name of device: case-insensitive, one of
3061
    /rd/1 = /RamDisk/1, /hd/n = /HardDisk/n,
3067
    /rd/1 = /RamDisk/1, /hd/n = /HardDisk/n,
3062
    1<=n<=4 - number of device: 1=IDE0, ..., 4=IDE3.
3068
    1<=n<=4 - number of device: 1=IDE0, ..., 4=IDE3.
3063
    Instead of digits it is allowed, though not recommended for
3069
    Instead of digits it is allowed, though not recommended for
3064
    convenience of transition to future extensions, to use
3070
    convenience of transition to future extensions, to use
3065
    'first','second','third','fourth'.
3071
    'first','second','third','fourth'.
3066
Returned value:
3072
Returned value:
3067
  * for device name /hd/xxx, where xxx is not in the list above:
3073
  * for device name /hd/xxx, where xxx is not in the list above:
3068
    * eax = ebx = 1
3074
    * eax = ebx = 1
3069
  * for invalid device name (except for the previous case):
3075
  * for invalid device name (except for the previous case):
3070
    * eax = 5
3076
    * eax = 5
3071
    * ebx does not change
3077
    * ebx does not change
3072
  * if LBA-access is disabled by subfunction 11 of function 21:
3078
  * if LBA-access is disabled by subfunction 11 of function 21:
3073
    * eax = 2
3079
    * eax = 2
3074
    * ebx destroyed
3080
    * ebx destroyed
3075
  * for ramdisk: attempt to read block outside ramdisk
3081
  * for ramdisk: attempt to read block outside ramdisk
3076
    (18*2*80 blocks) results in
3082
    (18*2*80 blocks) results in
3077
    * eax = 3
3083
    * eax = 3
3078
    * ebx = 0
3084
    * ebx = 0
3079
  * for successful read:
3085
  * for successful read:
3080
    * eax = ebx = 0
3086
    * eax = ebx = 0
3081
Remarks:
3087
Remarks:
3082
  * Block size is 512 bytes; function reads one block.
3088
  * Block size is 512 bytes; function reads one block.
3083
  * Do not depend on returned value, it can be changed
3089
  * Do not depend on returned value, it can be changed
3084
    in future versions.
3090
    in future versions.
3085
  * Function requires that LBA-access to devices is enabled by 
3091
  * Function requires that LBA-access to devices is enabled by 
3086
    subfunction 11 of function 21. To check this one can use 
3092
    subfunction 11 of function 21. To check this one can use 
3087
    subfunction 11 of function 26.
3093
    subfunction 11 of function 26.
3088
  * LBA-read of floppy is not supported.
3094
  * LBA-read of floppy is not supported.
3089
  * Function reads data on physical hard drive; if for any reason
3095
  * Function reads data on physical hard drive; if for any reason
3090
    data of the concrete partition are required, application must
3096
    data of the concrete partition are required, application must
3091
    define starting sector of this partition (either directly
3097
    define starting sector of this partition (either directly
3092
    through MBR, or from the full structure returned by
3098
    through MBR, or from the full structure returned by
3093
    ïîäôóíêöèåé 11 ôóíêöèè 18).
3099
    ïîäôóíêöèåé 11 ôóíêöèè 18).
3094
  * Function does not check error code of hard disk, so request of
3100
  * Function does not check error code of hard disk, so request of
3095
    nonexisting sector reads something (most probably it will be
3101
    nonexisting sector reads something (most probably it will be
3096
    zeroes, but this is defined by device) and this is considered
3102
    zeroes, but this is defined by device) and this is considered
3097
    as success (eax=0).
3103
    as success (eax=0).
3098
 
3104
 
3099
======================================================================
3105
======================================================================
3100
==== Function 58, subfunction 15 - get information on file system. ===
3106
==== Function 58, subfunction 15 - get information on file system. ===
3101
======================================================================
3107
======================================================================
3102
Parameters:
3108
Parameters:
3103
  * eax = 58 - function number
3109
  * eax = 58 - function number
3104
  * ebx = pointer to the information structure
3110
  * ebx = pointer to the information structure
3105
Format of the information structure:
3111
Format of the information structure:
3106
  * +0: dword: 15 = subfunction number
3112
  * +0: dword: 15 = subfunction number
3107
  * +4: dword: ignored
3113
  * +4: dword: ignored
3108
  * +8: dword: ignored
3114
  * +8: dword: ignored
3109
  * +12 = +0xC: dword: ignored
3115
  * +12 = +0xC: dword: ignored
3110
  * +16 = +0x10: dword: ignored
3116
  * +16 = +0x10: dword: ignored
3111
  * +20 = +0x14: (only second character is checked)
3117
  * +20 = +0x14: (only second character is checked)
3112
    /rd=/RAMDISK or /hd=/HARDDISK
3118
    /rd=/RAMDISK or /hd=/HARDDISK
3113
Returned value:
3119
Returned value:
3114
  * if the second character does not belong to set {'r','R','h','H'}:
3120
  * if the second character does not belong to set {'r','R','h','H'}:
3115
    * eax = 3
3121
    * eax = 3
3116
    * ebx = ecx = dword [fileinfo] = 0
3122
    * ebx = ecx = dword [fileinfo] = 0
3117
  * for ramdisk:
3123
  * for ramdisk:
3118
    * eax = 0 (success)
3124
    * eax = 0 (success)
3119
    * ebx = total number of clusters = 2847
3125
    * ebx = total number of clusters = 2847
3120
    * ecx = number of free clusters
3126
    * ecx = number of free clusters
3121
    * dword [fileinfo] = cluster size = 512
3127
    * dword [fileinfo] = cluster size = 512
3122
  * for hard disk: base and partition are defined by subfunctions
3128
  * for hard disk: base and partition are defined by subfunctions
3123
    7 and 8 of function 21:
3129
    7 and 8 of function 21:
3124
    * eax = 0 (success)
3130
    * eax = 0 (success)
3125
    * ebx = total number of clusters
3131
    * ebx = total number of clusters
3126
    * ecx = number of free clusters
3132
    * ecx = number of free clusters
3127
    * dword [fileinfo] = cluster size (in bytes)
3133
    * dword [fileinfo] = cluster size (in bytes)
3128
Remarks:
3134
Remarks:
3129
  * Be not surprised to strange layout of 4th returned parameter
3135
  * Be not surprised to strange layout of 4th returned parameter
3130
    - when this code was writing, at system calls application got
3136
    - when this code was writing, at system calls application got
3131
    only registers eax,ebx,ecx (from pushad-structure transmitted
3137
    only registers eax,ebx,ecx (from pushad-structure transmitted
3132
    as argument to the system function). Now it is corrected, so,
3138
    as argument to the system function). Now it is corrected, so,
3133
    probably, it is meaningful to return cluster size in edx, while
3139
    probably, it is meaningful to return cluster size in edx, while
3134
    this function is not used yet.
3140
    this function is not used yet.
3135
  * There exists also subfunction 11 of function 18,
3141
  * There exists also subfunction 11 of function 18,
3136
    which returns information on file system. From the full table
3142
    which returns information on file system. From the full table
3137
    of disk subsystem it is possible to deduce cluster size (there
3143
    of disk subsystem it is possible to deduce cluster size (there
3138
    it is stored in sectors) and total number of clusters
3144
    it is stored in sectors) and total number of clusters
3139
    for hard disks.
3145
    for hard disks.
3140
 
3146
 
3141
======================================================================
3147
======================================================================
3142
========== Function 58, subfunction 16 - start application. ==========
3148
========== Function 58, subfunction 16 - start application. ==========
3143
======================================================================
3149
======================================================================
3144
Parameters:
3150
Parameters:
3145
  * eax = 58 - function number
3151
  * eax = 58 - function number
3146
  * ebx = pointer to the information structure
3152
  * ebx = pointer to the information structure
3147
Format of the information structure:
3153
Format of the information structure:
3148
  * +0: dword: 16 = subfunction number
3154
  * +0: dword: 16 = subfunction number
3149
  * +4: dword: flags:
3155
  * +4: dword: flags:
3150
    * bit 0: start the process as debugged
3156
    * bit 0: start the process as debugged
3151
    * other bits are reserved and must be cleared
3157
    * other bits are reserved and must be cleared
3152
  * +8: dword: 0 or pointer to ASCIIZ-string with parameters
3158
  * +8: dword: 0 or pointer to ASCIIZ-string with parameters
3153
  * +12 = +0xC: dword: ignored
3159
  * +12 = +0xC: dword: ignored
3154
  * +16 = +0x10: dword: pointer to buffer for system operations
3160
  * +16 = +0x10: dword: pointer to buffer for system operations
3155
    (4096 bytes)
3161
    (4096 bytes)
3156
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
3162
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
3157
    given in the general description
3163
    given in the general description
3158
Returned value:
3164
Returned value:
3159
  * eax > 0 - the program is loaded, eax contains PID
3165
  * eax > 0 - the program is loaded, eax contains PID
3160
  * eax < 0 - an error has occured, -eax contains
3166
  * eax < 0 - an error has occured, -eax contains
3161
    file system error code
3167
    file system error code
3162
Remarks:
3168
Remarks:
3163
  * This function is obsolete, use subfunction 7 of function 70.
3169
  * This function is obsolete, use subfunction 7 of function 70.
3164
  * Command line must be terminated by character with code 0
3170
  * Command line must be terminated by character with code 0
3165
    (ASCIIZ-string); function takes into account either all characters
3171
    (ASCIIZ-string); function takes into account either all characters
3166
    up to terminating null inclusively or the first 256 charachters
3172
    up to terminating null inclusively or the first 256 charachters
3167
    depending on what is less.
3173
    depending on what is less.
3168
  * If the process is started as debugged, it is created in
3174
  * If the process is started as debugged, it is created in
3169
    the suspended state; to run use subfunction 5 of function 69.
3175
    the suspended state; to run use subfunction 5 of function 69.
3170
 
3176
 
3171
======================================================================
3177
======================================================================
3172
=============== Function 59 - trace last system calls. ===============
3178
=============== Function 59 - trace last system calls. ===============
3173
======================================================================
3179
======================================================================
3174
Gets data on all system calls of all processes.
3180
Gets data on all system calls of all processes.
3175
Parameters:
3181
Parameters:
3176
  * eax = 59 - function number
3182
  * eax = 59 - function number
3177
  * ebx = 0 - unique subfunction
3183
  * ebx = 0 - unique subfunction
3178
  * ecx = pointer to the buffer
3184
  * ecx = pointer to the buffer
3179
  * edx = size of the buffer
3185
  * edx = size of the buffer
3180
Returned value:
3186
Returned value:
3181
  * eax = total number of system calls made from system boot
3187
  * eax = total number of system calls made from system boot
3182
    (modulo 2^32)
3188
    (modulo 2^32)
3183
  * ebx = 0
3189
  * ebx = 0
3184
Format of information on one call: (size = 0x40 = 64 bytes)
3190
Format of information on one call: (size = 0x40 = 64 bytes)
3185
  * +0: dword: PID of process/thread
3191
  * +0: dword: PID of process/thread
3186
  * +4: 7*dword: garbage
3192
  * +4: 7*dword: garbage
3187
  * +32 = +0x20: dword: value of edi at the call
3193
  * +32 = +0x20: dword: value of edi at the call
3188
  * +36 = +0x24: dword: esi
3194
  * +36 = +0x24: dword: esi
3189
  * +40 = +0x28: dword: ebp
3195
  * +40 = +0x28: dword: ebp
3190
  * +44 = +0x2C: dword: stack pointer of the kernel handler
3196
  * +44 = +0x2C: dword: stack pointer of the kernel handler
3191
  * +48 = +0x30: dword: ebx
3197
  * +48 = +0x30: dword: ebx
3192
  * +52 = +0x34: dword: edx
3198
  * +52 = +0x34: dword: edx
3193
  * +56 = +0x38: dword: ecx
3199
  * +56 = +0x38: dword: ecx
3194
  * +60 = +0x3C: dword: eax (=number of system function)
3200
  * +60 = +0x3C: dword: eax (=number of system function)
3195
Remarks:
3201
Remarks:
3196
  * The function is used only in the application 'systrace'.
3202
  * The function is used only in the application 'systrace'.
3197
    It is rather difficult to imagine a situation, in which
3203
    It is rather difficult to imagine a situation, in which
3198
    this application or this function are really useful;
3204
    this application or this function are really useful;
3199
    and all system calls for support of this function are a little
3205
    and all system calls for support of this function are a little
3200
    decelerated (though not strongly)...
3206
    decelerated (though not strongly)...
3201
  * So there is a proposition to delete from the kernel
3207
  * So there is a proposition to delete from the kernel
3202
    support of this function, together with application 'systrace'.
3208
    support of this function, together with application 'systrace'.
3203
  * The information on system calls saves in the system
3209
  * The information on system calls saves in the system
3204
    ring buffer with 0x10 entries.
3210
    ring buffer with 0x10 entries.
3205
    This function simply copies the given size of data
3211
    This function simply copies the given size of data
3206
    from this buffer to the given address.
3212
    from this buffer to the given address.
3207
  * One can determine, which entry in the buffer corresponds to
3213
  * One can determine, which entry in the buffer corresponds to
3208
    last system call, by value of eax, namely, it is the entry
3214
    last system call, by value of eax, namely, it is the entry
3209
    (eax and 0xF) (at offset (eax and 0xF)*0x40).
3215
    (eax and 0xF) (at offset (eax and 0xF)*0x40).
3210
  * In the current implementation there can be the seldom
3216
  * In the current implementation there can be the seldom
3211
    meeting problems of unsynchronization, when the information
3217
    meeting problems of unsynchronization, when the information
3212
    on some calls becomes outdated.
3218
    on some calls becomes outdated.
3213
  * Under the system buffer one page, 4Kb, is allocated.
3219
  * Under the system buffer one page, 4Kb, is allocated.
3214
    Size of an entry = 64 bytes. Why only 16 entries are used,
3220
    Size of an entry = 64 bytes. Why only 16 entries are used,
3215
    is not clearly.
3221
    is not clearly.
3216
  * The value of esp at the moment of system call cannot
3222
  * The value of esp at the moment of system call cannot
3217
    be determined by this function.
3223
    be determined by this function.
3218
  * The current implementation does not check edx for correctness.
3224
  * The current implementation does not check edx for correctness.
3219
 
3225
 
3220
======================================================================
3226
======================================================================
3221
========== Function 60 - Inter Process Communication (IPC). ==========
3227
========== Function 60 - Inter Process Communication (IPC). ==========
3222
======================================================================
3228
======================================================================
3223
IPC is used for message dispatching from one process/thread to
3229
IPC is used for message dispatching from one process/thread to
3224
another. Previously it is necessary to agree how to interpret
3230
another. Previously it is necessary to agree how to interpret
3225
the concrete message.
3231
the concrete message.
3226
 
3232
 
3227
----------- Subfunction 1 - set the area for IPC receiving -----------
3233
----------- Subfunction 1 - set the area for IPC receiving -----------
3228
Is called by process-receiver.
3234
Is called by process-receiver.
3229
Parameters:
3235
Parameters:
3230
  * eax = 60 - function number
3236
  * eax = 60 - function number
3231
  * ebx = 1 - subfunction number
3237
  * ebx = 1 - subfunction number
3232
  * ecx = pointer to the buffer
3238
  * ecx = pointer to the buffer
3233
  * edx = size of the buffer
3239
  * edx = size of the buffer
3234
Returned value:
3240
Returned value:
3235
  * eax = 0 - always success
3241
  * eax = 0 - always success
3236
Format of IPC-buffer:
3242
Format of IPC-buffer:
3237
  * +0: dword: if nonzero, buffer is considered locked;
3243
  * +0: dword: if nonzero, buffer is considered locked;
3238
    lock/unlock the buffer, when you work with it and need that
3244
    lock/unlock the buffer, when you work with it and need that
3239
    buffer data are not changed from outside (no new messages)
3245
    buffer data are not changed from outside (no new messages)
3240
  * +4: dword: occupied place in the buffer (in bytes)
3246
  * +4: dword: occupied place in the buffer (in bytes)
3241
  * +8: first message
3247
  * +8: first message
3242
  * +8+n: second message
3248
  * +8+n: second message
3243
  * ...
3249
  * ...
3244
Format of a message:
3250
Format of a message:
3245
  * +0: dword: PID of sender
3251
  * +0: dword: PID of sender
3246
  * +4: dword: message length (not including this header)
3252
  * +4: dword: message length (not including this header)
3247
  * +8: n*byte: message data
3253
  * +8: n*byte: message data
3248
 
3254
 
3249
------------------ Subfunction 2 - send IPC message ------------------
3255
------------------ Subfunction 2 - send IPC message ------------------
3250
Is called by process-sender.
3256
Is called by process-sender.
3251
Parameters:
3257
Parameters:
3252
  * eax = 60 - function number
3258
  * eax = 60 - function number
3253
  * ebx = 2 - subfunction number
3259
  * ebx = 2 - subfunction number
3254
  * ecx = PID of receiver
3260
  * ecx = PID of receiver
3255
  * edx = pointer to the message data
3261
  * edx = pointer to the message data
3256
  * esi = message length (in bytes)
3262
  * esi = message length (in bytes)
3257
Returned value:
3263
Returned value:
3258
  * eax = 0 - success
3264
  * eax = 0 - success
3259
  * eax = 1 - the receiver has not defined buffer for IPC messages
3265
  * eax = 1 - the receiver has not defined buffer for IPC messages
3260
    (can be, still have no time,
3266
    (can be, still have no time,
3261
    and can be, this is not right process)
3267
    and can be, this is not right process)
3262
  * eax = 2 - the receiver has blocked IPC-buffer; try to wait a bit
3268
  * eax = 2 - the receiver has blocked IPC-buffer; try to wait a bit
3263
  * eax = 3 - overflow of IPC-buffer of the receiver
3269
  * eax = 3 - overflow of IPC-buffer of the receiver
3264
  * eax = 4 - process/thread with such PID does not exist
3270
  * eax = 4 - process/thread with such PID does not exist
3265
Remarks:
3271
Remarks:
3266
  * Immediately after writing of IPC-message to the buffer the system
3272
  * Immediately after writing of IPC-message to the buffer the system
3267
    sends to the receiver the event with code 7 (see event codes).
3273
    sends to the receiver the event with code 7 (see event codes).
3268
 
3274
 
3269
======================================================================
3275
======================================================================
3270
==== Function 61 - get parameters for the direct graphics access. ====
3276
==== Function 61 - get parameters for the direct graphics access. ====
3271
======================================================================
3277
======================================================================
3272
The data of the graphics screen (the memory area which displays
3278
The data of the graphics screen (the memory area which displays
3273
screen contents) are accessible to a program directly, without
3279
screen contents) are accessible to a program directly, without
3274
any system calls, through the selector gs:
3280
any system calls, through the selector gs:
3275
	mov	eax, [gs:0]
3281
	mov	eax, [gs:0]
3276
places in eax the first dword of the buffer, which contains
3282
places in eax the first dword of the buffer, which contains
3277
information on color of the left upper point (and, possibly, colors
3283
information on color of the left upper point (and, possibly, colors
3278
of several following).
3284
of several following).
3279
	mov	[gs:0], eax
3285
	mov	[gs:0], eax
3280
by work in VESA modes with LFB sets color of the left upper point
3286
by work in VESA modes with LFB sets color of the left upper point
3281
(and, possibly, colors of several following).
3287
(and, possibly, colors of several following).
3282
To interpret the data of graphics screen program needs to know
3288
To interpret the data of graphics screen program needs to know
3283
some parameters, returning by this function.
3289
some parameters, returning by this function.
3284
Remarks:
3290
Remarks:
3285
  * Graphics parameters changes very seldom at work,
3291
  * Graphics parameters changes very seldom at work,
3286
    namely, only in cases, when user works with the application VRR.
3292
    namely, only in cases, when user works with the application VRR.
3287
  * At videomode change the system redraws all windows (event
3293
  * At videomode change the system redraws all windows (event
3288
    with code 1) and redraws the background (event 5).
3294
    with code 1) and redraws the background (event 5).
3289
    Same events occur in other cases too, which meet much more often,
3295
    Same events occur in other cases too, which meet much more often,
3290
    than videomode change.
3296
    than videomode change.
3291
  * By operation in videomodes with LFB the selector gs points to
3297
  * By operation in videomodes with LFB the selector gs points to
3292
    LFB itself, so reading/writing on gs result directly in
3298
    LFB itself, so reading/writing on gs result directly in
3293
    change of screen contents. By operation in videomodes without
3299
    change of screen contents. By operation in videomodes without
3294
    LFB gs points to some data area in the kernel, and all functions
3300
    LFB gs points to some data area in the kernel, and all functions
3295
    of screen output fulfil honesty double operation on writing
3301
    of screen output fulfil honesty double operation on writing
3296
    directly to the screen and writing to this buffer. In result
3302
    directly to the screen and writing to this buffer. In result
3297
    at reading contents of this buffer the results correspond to
3303
    at reading contents of this buffer the results correspond to
3298
    screen contents (with, generally speaking, large color
3304
    screen contents (with, generally speaking, large color
3299
    resolution), and writing is ignored.
3305
    resolution), and writing is ignored.
3300
    One exception is the mode 320*200, for which main loop of the
3306
    One exception is the mode 320*200, for which main loop of the
3301
    system thread updates the screen according to mouse movements.
3307
    system thread updates the screen according to mouse movements.
3302
 
3308
 
3303
------------------------- Screen resolution --------------------------
3309
------------------------- Screen resolution --------------------------
3304
Parameters:
3310
Parameters:
3305
  * eax = 61 - function number
3311
  * eax = 61 - function number
3306
  * ebx = 1 - subfunction number
3312
  * ebx = 1 - subfunction number
3307
Returned value:
3313
Returned value:
3308
  * eax = [resolution on x axis]*65536 + [resolution on y axis]
3314
  * eax = [resolution on x axis]*65536 + [resolution on y axis]
3309
Remarks:
3315
Remarks:
3310
  * One can use function 14 paying attention that
3316
  * One can use function 14 paying attention that
3311
    it returns sizes on 1 pixel less. It is fully equivalent way.
3317
    it returns sizes on 1 pixel less. It is fully equivalent way.
3312
 
3318
 
3313
---------------------- Number of bits per pixel ----------------------
3319
---------------------- Number of bits per pixel ----------------------
3314
Parameters:
3320
Parameters:
3315
  * eax = 61 - function number
3321
  * eax = 61 - function number
3316
  * ebx = 2 - subfunction number
3322
  * ebx = 2 - subfunction number
3317
Returned value:
3323
Returned value:
3318
  * eax = number of bits per pixel (24 or 32)
3324
  * eax = number of bits per pixel (24 or 32)
3319
 
3325
 
3320
-------------------- Number of bytes per scanline --------------------
3326
-------------------- Number of bytes per scanline --------------------
3321
Parameters:
3327
Parameters:
3322
  * eax = 61 - function number
3328
  * eax = 61 - function number
3323
  * ebx = 3 - subfunction number
3329
  * ebx = 3 - subfunction number
3324
Returned value:
3330
Returned value:
3325
  * eax = number of bytes occupied by one scanline
3331
  * eax = number of bytes occupied by one scanline
3326
    (horizontal line on the screen)
3332
    (horizontal line on the screen)
3327
 
3333
 
3328
======================================================================
3334
======================================================================
3329
===== Function 62, subfunction 0 - get version of PCI-interface. =====
3335
===== Function 62, subfunction 0 - get version of PCI-interface. =====
3330
======================================================================
3336
======================================================================
3331
Parameters:
3337
Parameters:
3332
  * eax = 62 - function number
3338
  * eax = 62 - function number
3333
  * bl = 0 - subfunction number
3339
  * bl = 0 - subfunction number
3334
Returned value:
3340
Returned value:
3335
  * eax = -1 - PCI access is disabled; otherwise
3341
  * eax = -1 - PCI access is disabled; otherwise
3336
  * ah.al = version of PCI-interface (ah=version, al=subversion)
3342
  * ah.al = version of PCI-interface (ah=version, al=subversion)
3337
  * high word of eax is zeroed
3343
  * high word of eax is zeroed
3338
Remarks:
3344
Remarks:
3339
  * Previously low-level access to PCI for applications must be
3345
  * Previously low-level access to PCI for applications must be
3340
    enabled by subfunction 12 of function 21.
3346
    enabled by subfunction 12 of function 21.
3341
  * If PCI BIOS is not supported, the value of ax is undefined.
3347
  * If PCI BIOS is not supported, the value of ax is undefined.
3342
 
3348
 
3343
======================================================================
3349
======================================================================
3344
==== Function 62, subfunction 1 - get number of the last PCI-bus. ====
3350
==== Function 62, subfunction 1 - get number of the last PCI-bus. ====
3345
======================================================================
3351
======================================================================
3346
Parameters:
3352
Parameters:
3347
  * eax = 62 - function number
3353
  * eax = 62 - function number
3348
  * bl = 1 - subfunction number
3354
  * bl = 1 - subfunction number
3349
Returned value:
3355
Returned value:
3350
  * eax = -1 - access to PCI is disabled; otherwise
3356
  * eax = -1 - access to PCI is disabled; otherwise
3351
  * al = number of the last PCI-bus; other bytes of eax are destroyed
3357
  * al = number of the last PCI-bus; other bytes of eax are destroyed
3352
Remarks:
3358
Remarks:
3353
  * Previously low-level access to PCI for applications must be
3359
  * Previously low-level access to PCI for applications must be
3354
    enabled by subfunction 12 of function 21.
3360
    enabled by subfunction 12 of function 21.
3355
  * If PCI BIOS is not supported, the value of ax is undefined.
3361
  * If PCI BIOS is not supported, the value of ax is undefined.
3356
 
3362
 
3357
======================================================================
3363
======================================================================
3358
===================== Function 62, subfunction 2 =====================
3364
===================== Function 62, subfunction 2 =====================
3359
===== Get mechanism of addressing to the PCI configuration space. ====
3365
===== Get mechanism of addressing to the PCI configuration space. ====
3360
======================================================================
3366
======================================================================
3361
Parameters:
3367
Parameters:
3362
  * eax = 62 - function number
3368
  * eax = 62 - function number
3363
  * bl = 2 - subfunction number
3369
  * bl = 2 - subfunction number
3364
Returned value:
3370
Returned value:
3365
  * eax = -1 - access to PCI is disabled; otherwise
3371
  * eax = -1 - access to PCI is disabled; otherwise
3366
  * al = mechanism (1 or 2); other bytes of eax are destroyed
3372
  * al = mechanism (1 or 2); other bytes of eax are destroyed
3367
Remarks:
3373
Remarks:
3368
  * Previously low-level access to PCI for applications must be
3374
  * Previously low-level access to PCI for applications must be
3369
    enabled by subfunction 12 of function 21.
3375
    enabled by subfunction 12 of function 21.
3370
  * Addressing mechanism is selected depending on
3376
  * Addressing mechanism is selected depending on
3371
    equipment characteristics.
3377
    equipment characteristics.
3372
  * Subfunctions of read and write work automatically
3378
  * Subfunctions of read and write work automatically
3373
    with the selected mechanism.
3379
    with the selected mechanism.
3374
 
3380
 
3375
======================================================================
3381
======================================================================
3376
======== Function 62, subfunctions 4,5,6 - read PCI-register. ========
3382
======== Function 62, subfunctions 4,5,6 - read PCI-register. ========
3377
======================================================================
3383
======================================================================
3378
Parameters:
3384
Parameters:
3379
  * eax = 62 - function number
3385
  * eax = 62 - function number
3380
  * bl = 4 - read byte
3386
  * bl = 4 - read byte
3381
  * bl = 5 - read word
3387
  * bl = 5 - read word
3382
  * bl = 6 - read dword
3388
  * bl = 6 - read dword
3383
  * bh = number of PCI-bus
3389
  * bh = number of PCI-bus
3384
  * ch = dddddfff, where ddddd = number of the device on the bus,
3390
  * ch = dddddfff, where ddddd = number of the device on the bus,
3385
    fff = function number of device
3391
    fff = function number of device
3386
  * cl = number of register (must be even for bl=5,
3392
  * cl = number of register (must be even for bl=5,
3387
    divisible by 4 for bl=6)
3393
    divisible by 4 for bl=6)
3388
Returned value:
3394
Returned value:
3389
  * eax = -1 - error (access to PCI is disabled or parameters
3395
  * eax = -1 - error (access to PCI is disabled or parameters
3390
    are not supported); otherwise
3396
    are not supported); otherwise
3391
  * al/ax/eax (depending on requested size) contains the data;
3397
  * al/ax/eax (depending on requested size) contains the data;
3392
    the other part of register eax is destroyed
3398
    the other part of register eax is destroyed
3393
Remarks:
3399
Remarks:
3394
  * Previously low-level access to PCI for applications must be
3400
  * Previously low-level access to PCI for applications must be
3395
    enabled by subfunction 12 of function 21.
3401
    enabled by subfunction 12 of function 21.
3396
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3402
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3397
    function number. To get access mechanism use subfunction 2.
3403
    function number. To get access mechanism use subfunction 2.
3398
  * Some registers are standard and exist for all devices, some are
3404
  * Some registers are standard and exist for all devices, some are
3399
    defined by the concrete device. The list of registers of the
3405
    defined by the concrete device. The list of registers of the
3400
    first type can be found e.g. in famous
3406
    first type can be found e.g. in famous
3401
    Interrupt List by Ralf Brown
3407
    Interrupt List by Ralf Brown
3402
    (http://www.pobox.com/~ralf/files.html,
3408
    (http://www.pobox.com/~ralf/files.html,
3403
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/);
3409
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/);
3404
    registers of the second type must be listed
3410
    registers of the second type must be listed
3405
    in the device documentation.
3411
    in the device documentation.
3406
 
3412
 
3407
======================================================================
3413
======================================================================
3408
====== Function 62, subfunctions 8,9,10 - write to PCI-register. =====
3414
====== Function 62, subfunctions 8,9,10 - write to PCI-register. =====
3409
======================================================================
3415
======================================================================
3410
Parameters:
3416
Parameters:
3411
  * eax = 62 - function number
3417
  * eax = 62 - function number
3412
  * bl = 8 - write byte
3418
  * bl = 8 - write byte
3413
  * bl = 9 - write word
3419
  * bl = 9 - write word
3414
  * bl = 10 - write dword
3420
  * bl = 10 - write dword
3415
  * bh = number of PCI-bus
3421
  * bh = number of PCI-bus
3416
  * ch = dddddfff, where ddddd = number of the device on the bus,
3422
  * ch = dddddfff, where ddddd = number of the device on the bus,
3417
    fff = function number of device
3423
    fff = function number of device
3418
  * cl = number of register (must be even for bl=9,
3424
  * cl = number of register (must be even for bl=9,
3419
    divisible by 4 for bl=10)
3425
    divisible by 4 for bl=10)
3420
  * dl/dx/edx (depending on requested size) contatins
3426
  * dl/dx/edx (depending on requested size) contatins
3421
    the data to write
3427
    the data to write
3422
Returned value:
3428
Returned value:
3423
  * eax = -1 - error (access to PCI is disabled or parameters
3429
  * eax = -1 - error (access to PCI is disabled or parameters
3424
    are not supported)
3430
    are not supported)
3425
  * eax = 0 - success
3431
  * eax = 0 - success
3426
Remarks:
3432
Remarks:
3427
  * Previously low-level access to PCI for applications must be
3433
  * Previously low-level access to PCI for applications must be
3428
    enabled by subfunction 12 of function 21.
3434
    enabled by subfunction 12 of function 21.
3429
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3435
  * Access mechanism 2 supports only 16 devices on a bus and ignores
3430
    function number. To get access mechanism use subfunction 2.
3436
    function number. To get access mechanism use subfunction 2.
3431
  * Some registers are standard and exist for all devices, some are
3437
  * Some registers are standard and exist for all devices, some are
3432
    defined by the concrete device. The list of registers of the
3438
    defined by the concrete device. The list of registers of the
3433
    first type can be found e.g. in famous Interrupt List by
3439
    first type can be found e.g. in famous Interrupt List by
3434
    Ralf Brown; registers of the second type must be listed
3440
    Ralf Brown; registers of the second type must be listed
3435
    in the device documentation.
3441
    in the device documentation.
3436
 
3442
 
3437
======================================================================
3443
======================================================================
3438
============== Function 63 - work with the debug board. ==============
3444
============== Function 63 - work with the debug board. ==============
3439
======================================================================
3445
======================================================================
3440
The debug board is the global system buffer (with the size
3446
The debug board is the global system buffer (with the size
3441
512 bytes), to which any program can write (generally speaking,
3447
512 bytes), to which any program can write (generally speaking,
3442
arbitrary) data and from which other program can read these data.
3448
arbitrary) data and from which other program can read these data.
3443
By the agreement written data are text strings interpreted as
3449
By the agreement written data are text strings interpreted as
3444
debug messages on a course of program execution. The kernel in
3450
debug messages on a course of program execution. The kernel in
3445
some situations also writes to the debug board information on
3451
some situations also writes to the debug board information on
3446
execution of some functions; by the agreement kernel messages
3452
execution of some functions; by the agreement kernel messages
3447
begins from the prefix "K : ".
3453
begins from the prefix "K : ".
3448
For view of the debug board the application 'board' was created,
3454
For view of the debug board the application 'board' was created,
3449
which reads data from the buffer and displays them in its window.
3455
which reads data from the buffer and displays them in its window.
3450
'board' interpretes the sequence of codes 13,10 as newline.
3456
'board' interpretes the sequence of codes 13,10 as newline.
3451
A character with null code in an end of line is not necessary,
3457
A character with null code in an end of line is not necessary,
3452
but also does not prevent.
3458
but also does not prevent.
3453
Because debugger has been written, the value of the debug board
3459
Because debugger has been written, the value of the debug board
3454
has decreased, as debugger allows to inspect completely a course of
3460
has decreased, as debugger allows to inspect completely a course of
3455
program execution without any efforts from the direction of program
3461
program execution without any efforts from the direction of program
3456
itself. Nevertheless in some cases the debug board is still useful.
3462
itself. Nevertheless in some cases the debug board is still useful.
3457
 
3463
 
3458
----------------------------- Write byte -----------------------------
3464
----------------------------- Write byte -----------------------------
3459
Parameters:
3465
Parameters:
3460
  * eax = 63 - function number
3466
  * eax = 63 - function number
3461
  * ebx = 1 - subfunction number
3467
  * ebx = 1 - subfunction number
3462
  * cl = data byte
3468
  * cl = data byte
3463
Returned value:
3469
Returned value:
3464
  * function does not return value
3470
  * function does not return value
3465
Remarks:
3471
Remarks:
3466
  * Byte is written to the buffer. Buffer size is 512 bytes.
3472
  * Byte is written to the buffer. Buffer size is 512 bytes.
3467
    At buffer overflow all obtained data are lost.
3473
    At buffer overflow all obtained data are lost.
3468
  * For output to the debug board of more complicated objects
3474
  * For output to the debug board of more complicated objects
3469
    (strings, numbers) it is enough to call this function in cycle.
3475
    (strings, numbers) it is enough to call this function in cycle.
3470
    It is possible not to write the appropriate code manually and use
3476
    It is possible not to write the appropriate code manually and use
3471
    file 'debug.inc', which is included into the distributive.
3477
    file 'debug.inc', which is included into the distributive.
3472
 
3478
 
3473
----------------------------- Read byte ------------------------------
3479
----------------------------- Read byte ------------------------------
3474
Takes away byte from the buffer.
3480
Takes away byte from the buffer.
3475
Parameters:
3481
Parameters:
3476
  * eax = 63 - function number
3482
  * eax = 63 - function number
3477
  * ebx = 2 - subfunction number
3483
  * ebx = 2 - subfunction number
3478
Returned value:
3484
Returned value:
3479
  * eax = ebx = 0 - the buffer is empty
3485
  * eax = ebx = 0 - the buffer is empty
3480
  * eax = byte, ebx = 1 - byte was successfully read
3486
  * eax = byte, ebx = 1 - byte was successfully read
3481
 
3487
 
3482
======================================================================
3488
======================================================================
3483
============== Function 64 - resize application memory. ==============
3489
============== Function 64 - resize application memory. ==============
3484
======================================================================
3490
======================================================================
3485
Parameters:
3491
Parameters:
3486
  * eax = 64 - function number
3492
  * eax = 64 - function number
3487
  * ebx = 1 - unique subfunction
3493
  * ebx = 1 - unique subfunction
3488
  * ecx = new memory size
3494
  * ecx = new memory size
3489
Returned value:
3495
Returned value:
3490
  * eax = 0 - success
3496
  * eax = 0 - success
3491
  * eax = 1 - not enough memory
3497
  * eax = 1 - not enough memory
3492
Remarks:
3498
Remarks:
3493
  * At the moment this function is a sole resource for dynamic
3499
  * At the moment this function is a sole resource for dynamic
3494
    allocation/free of application memory.
3500
    allocation/free of application memory.
3495
 
3501
 
3496
======================================================================
3502
======================================================================
3497
================== Function 66 - work with keyboard. =================
3503
================== Function 66 - work with keyboard. =================
3498
======================================================================
3504
======================================================================
3499
The input mode influences results of reading keys by function 2.
3505
The input mode influences results of reading keys by function 2.
3500
When a program loads, ASCII input mode is set for it.
3506
When a program loads, ASCII input mode is set for it.
3501
 
3507
 
3502
-------------- Subfunction 1 - set keyboard input mode. --------------
3508
-------------- Subfunction 1 - set keyboard input mode. --------------
3503
Parameters:
3509
Parameters:
3504
  * eax = 66 - function number
3510
  * eax = 66 - function number
3505
  * ebx = 1 - subfunction number
3511
  * ebx = 1 - subfunction number
3506
  * ecx = mode:
3512
  * ecx = mode:
3507
    * 0 = normal (ASCII-characters)
3513
    * 0 = normal (ASCII-characters)
3508
    * 1 = scancodes
3514
    * 1 = scancodes
3509
Returned value:
3515
Returned value:
3510
  * function does not return value
3516
  * function does not return value
3511
 
3517
 
3512
-------------- Subfunction 2 - get keyboard input mode. --------------
3518
-------------- Subfunction 2 - get keyboard input mode. --------------
3513
Parameters:
3519
Parameters:
3514
  * eax = 66 - function number
3520
  * eax = 66 - function number
3515
  * ebx = 2 - subfunction number
3521
  * ebx = 2 - subfunction number
3516
Returned value:
3522
Returned value:
3517
  * eax = current mode
3523
  * eax = current mode
3518
 
3524
 
3519
------------ Subfunction 3 - get status of control keys. -------------
3525
------------ Subfunction 3 - get status of control keys. -------------
3520
Parameters:
3526
Parameters:
3521
  * eax = 66 - function number
3527
  * eax = 66 - function number
3522
  * ebx = 3 - subfunction number
3528
  * ebx = 3 - subfunction number
3523
Returned value:
3529
Returned value:
3524
  * eax = bit mask:
3530
  * eax = bit mask:
3525
  * bit 0 (mask 1): left Shift is pressed
3531
  * bit 0 (mask 1): left Shift is pressed
3526
  * bit 1 (mask 2): right Shift is pressed
3532
  * bit 1 (mask 2): right Shift is pressed
3527
  * bit 2 (mask 4): left Ctrl is pressed
3533
  * bit 2 (mask 4): left Ctrl is pressed
3528
  * bit 3 (mask 8): right Ctrl is pressed
3534
  * bit 3 (mask 8): right Ctrl is pressed
3529
  * bit 4 (mask 0x10): left Alt is pressed
3535
  * bit 4 (mask 0x10): left Alt is pressed
3530
  * bit 5 (mask 0x20): right Alt is pressed
3536
  * bit 5 (mask 0x20): right Alt is pressed
3531
  * bit 6 (mask 0x40): CapsLock is on
3537
  * bit 6 (mask 0x40): CapsLock is on
3532
  * bit 7 (mask 0x80): NumLock is on
3538
  * bit 7 (mask 0x80): NumLock is on
3533
  * bit 8 (mask 0x100): ScrollLock is on
3539
  * bit 8 (mask 0x100): ScrollLock is on
3534
  * other bits are cleared
3540
  * other bits are cleared
3535
 
3541
 
3536
-------------- Subfunction 4 - set system-wide hotkey. ---------------
3542
-------------- Subfunction 4 - set system-wide hotkey. ---------------
3537
When hotkey is pressed, the system notifies only those applications,
3543
When hotkey is pressed, the system notifies only those applications,
3538
which have installed it; the active application (which receives
3544
which have installed it; the active application (which receives
3539
all normal input) does not receive such keys.
3545
all normal input) does not receive such keys.
3540
The notification consists in sending event with the code 2.
3546
The notification consists in sending event with the code 2.
3541
Reading hotkey is the same as reading normal key - by function 2.
3547
Reading hotkey is the same as reading normal key - by function 2.
3542
Parameters:
3548
Parameters:
3543
  * eax = 66 - function number
3549
  * eax = 66 - function number
3544
  * ebx = 4 - subfunction number
3550
  * ebx = 4 - subfunction number
3545
  * cl determines key scancode;
3551
  * cl determines key scancode;
3546
    use cl=0 to give combinations such as Ctrl+Shift
3552
    use cl=0 to give combinations such as Ctrl+Shift
3547
  * edx = 0xXYZ determines possible states of control keys:
3553
  * edx = 0xXYZ determines possible states of control keys:
3548
    * Z (low 4 bits) determines state of LShift and RShift:
3554
    * Z (low 4 bits) determines state of LShift and RShift:
3549
      * 0 = no key must be pressed;
3555
      * 0 = no key must be pressed;
3550
      * 1 = exactly one key must be pressed;
3556
      * 1 = exactly one key must be pressed;
3551
      * 2 = both keys must be pressed;
3557
      * 2 = both keys must be pressed;
3552
      * 3 = must be pressed LShift, but not RShift;
3558
      * 3 = must be pressed LShift, but not RShift;
3553
      * 4 = must be pressed RShift, but not LShift
3559
      * 4 = must be pressed RShift, but not LShift
3554
    * Y - similar for LCtrl and RCtrl;
3560
    * Y - similar for LCtrl and RCtrl;
3555
    * X - similar for LAlt and RAlt
3561
    * X - similar for LAlt and RAlt
3556
Returned value:
3562
Returned value:
3557
  * eax=0 - success
3563
  * eax=0 - success
3558
  * eax=1 - too mant hotkeys (maximum 256 are allowed)
3564
  * eax=1 - too mant hotkeys (maximum 256 are allowed)
3559
Remarks:
3565
Remarks:
3560
  * Hotkey can work either at pressing or at release. Release
3566
  * Hotkey can work either at pressing or at release. Release
3561
    scancode of a key is more on 128 than pressing scancode
3567
    scancode of a key is more on 128 than pressing scancode
3562
    (i.e. high bit is set).
3568
    (i.e. high bit is set).
3563
  * Several applications can set the same combination;
3569
  * Several applications can set the same combination;
3564
    all such applications will be informed on pressing
3570
    all such applications will be informed on pressing
3565
    such combination.
3571
    such combination.
3566
 
3572
 
3567
-------------- Subfunction 5 - delete installed hotkey. --------------
3573
-------------- Subfunction 5 - delete installed hotkey. --------------
3568
Parameters:
3574
Parameters:
3569
  * eax = 66 - function number
3575
  * eax = 66 - function number
3570
  * ebx = 5 - subfunction number
3576
  * ebx = 5 - subfunction number
3571
  * cl = scancode of key and edx = 0xXYZ the same as in subfunction 4
3577
  * cl = scancode of key and edx = 0xXYZ the same as in subfunction 4
3572
Returned value:
3578
Returned value:
3573
  * eax = 0 - success
3579
  * eax = 0 - success
3574
  * eax = 1 - there is no such hotkey
3580
  * eax = 1 - there is no such hotkey
3575
Remarks:
3581
Remarks:
3576
  * When a process/thread terminates, all hotkey installed by it are
3582
  * When a process/thread terminates, all hotkey installed by it are
3577
    deleted.
3583
    deleted.
3578
  * The call to this subfunction does not affect other applications.
3584
  * The call to this subfunction does not affect other applications.
3579
    If other application has defined the same combination, it will
3585
    If other application has defined the same combination, it will
3580
    still receive notices.
3586
    still receive notices.
3581
 
3587
 
3582
======================================================================
3588
======================================================================
3583
========= Function 67 - change position/sizes of the window. =========
3589
========= Function 67 - change position/sizes of the window. =========
3584
======================================================================
3590
======================================================================
3585
Parameters:
3591
Parameters:
3586
  * eax = 67 - function number
3592
  * eax = 67 - function number
3587
  * ebx = new x-coordinate of the window
3593
  * ebx = new x-coordinate of the window
3588
  * ecx = new y-coordinate of the window
3594
  * ecx = new y-coordinate of the window
3589
  * edx = new x-size of the window
3595
  * edx = new x-size of the window
3590
  * esi = new y-size of the window
3596
  * esi = new y-size of the window
3591
Returned value:
3597
Returned value:
3592
  * function does not return value
3598
  * function does not return value
3593
Remarks:
3599
Remarks:
3594
  * The value -1 for a parameter means "do not change"; e.g. to move
3600
  * The value -1 for a parameter means "do not change"; e.g. to move
3595
    the window without resizing it is possible to specify edx=esi=-1.
3601
    the window without resizing it is possible to specify edx=esi=-1.
3596
  * Previously the window must be defined by function 0.
3602
  * Previously the window must be defined by function 0.
3597
    It sets initial coordinates and sizes of the window.
3603
    It sets initial coordinates and sizes of the window.
3598
  * Sizes of the window are understood in sense of function 0,
3604
  * Sizes of the window are understood in sense of function 0,
3599
    that is one pixel less than real sizes.
3605
    that is one pixel less than real sizes.
3600
  * The function call for maximized windows is simply ignored.
3606
  * The function call for maximized windows is simply ignored.
3601
  * For windows of appropriate styles position and/or sizes can be
3607
  * For windows of appropriate styles position and/or sizes can be
3602
    changed by user; current position and sizes can be obtained by
3608
    changed by user; current position and sizes can be obtained by
3603
    call to function 9.
3609
    call to function 9.
3604
  * The function sends to the window redraw event (with the code 1).
3610
  * The function sends to the window redraw event (with the code 1).
3605
 
3611
 
3606
======================================================================
3612
======================================================================
3607
====== Function 68, subfunction 0 - get the task switch counter. =====
3613
====== Function 68, subfunction 0 - get the task switch counter. =====
3608
======================================================================
3614
======================================================================
3609
Parameters:
3615
Parameters:
3610
  * eax = 68 - function number
3616
  * eax = 68 - function number
3611
  * ebx = 0 - subfunction number
3617
  * ebx = 0 - subfunction number
3612
Returned value:
3618
Returned value:
3613
  * eax = number of task switches from the system booting
3619
  * eax = number of task switches from the system booting
3614
    (modulo 2^32)
3620
    (modulo 2^32)
3615
 
3621
 
3616
======================================================================
3622
======================================================================
3617
======= Function 68, subfunction 1 - switch to the next thread. ======
3623
======= Function 68, subfunction 1 - switch to the next thread. ======
3618
======================================================================
3624
======================================================================
3619
The function completes the current time slice allocated to the
3625
The function completes the current time slice allocated to the
3620
thread and switches to the next. (Which thread in which process
3626
thread and switches to the next. (Which thread in which process
3621
will be next, is unpredictable). Later, when execution queue
3627
will be next, is unpredictable). Later, when execution queue
3622
will reach the current thread, execution will be continued.
3628
will reach the current thread, execution will be continued.
3623
Parameters:
3629
Parameters:
3624
  * eax = 68 - function number
3630
  * eax = 68 - function number
3625
  * ebx = 1 - subfunction number
3631
  * ebx = 1 - subfunction number
3626
Returned value:
3632
Returned value:
3627
  * function does not return value
3633
  * function does not return value
3628
 
3634
 
3629
======================================================================
3635
======================================================================
3630
============= Function 68, subfunction 2 - cache + rdpmc. ============
3636
============= Function 68, subfunction 2 - cache + rdpmc. ============
3631
======================================================================
3637
======================================================================
3632
Parameters:
3638
Parameters:
3633
  * eax = 68 - function number
3639
  * eax = 68 - function number
3634
  * ebx = 2 - subfunction number
3640
  * ebx = 2 - subfunction number
3635
  * ecx = required action:
3641
  * ecx = required action:
3636
    * ecx = 0 - enable instruction 'rdpmc'
3642
    * ecx = 0 - enable instruction 'rdpmc'
3637
      (ReaD Performance-Monitoring Counters) for applications
3643
      (ReaD Performance-Monitoring Counters) for applications
3638
    * ecx = 1 - find out whether cache is disabled/enabled
3644
    * ecx = 1 - find out whether cache is disabled/enabled
3639
    * ecx = 2 - enable cache
3645
    * ecx = 2 - enable cache
3640
    * ecx = 3 - disable cache
3646
    * ecx = 3 - disable cache
3641
Returned value:
3647
Returned value:
3642
  * for ecx=0:
3648
  * for ecx=0:
3643
    * eax = the value of cr4
3649
    * eax = the value of cr4
3644
  * for ecx=1:
3650
  * for ecx=1:
3645
    * eax = (cr0 and 0x60000000):
3651
    * eax = (cr0 and 0x60000000):
3646
    * eax = 0 - cache is on
3652
    * eax = 0 - cache is on
3647
    * eax <> 0 - cache is off
3653
    * eax <> 0 - cache is off
3648
  * for ecx=2 and ecx=3:
3654
  * for ecx=2 and ecx=3:
3649
    * function does not return value
3655
    * function does not return value
3650
 
3656
 
3651
======================================================================
3657
======================================================================
3652
=========== Function 68, subfunction 3 - read MSR-register. ==========
3658
=========== Function 68, subfunction 3 - read MSR-register. ==========
3653
======================================================================
3659
======================================================================
3654
MSR = Model Specific Register; the complete list of MSR-registers
3660
MSR = Model Specific Register; the complete list of MSR-registers
3655
of a processor is included to the documentation on it (for example,
3661
of a processor is included to the documentation on it (for example,
3656
IA-32 Intel Architecture Software Developer's Manual,
3662
IA-32 Intel Architecture Software Developer's Manual,
3657
Volume 3, Appendix B); each processor family has its own subset
3663
Volume 3, Appendix B); each processor family has its own subset
3658
of the MSR-registers.
3664
of the MSR-registers.
3659
Parameters:
3665
Parameters:
3660
  * eax = 68 - function number
3666
  * eax = 68 - function number
3661
  * ebx = 3 - subfunction number
3667
  * ebx = 3 - subfunction number
3662
  * ecx is ignored
3668
  * ecx is ignored
3663
  * edx = MSR address
3669
  * edx = MSR address
3664
Returned value:
3670
Returned value:
3665
  * ebx:eax = high:low dword of the result
3671
  * ebx:eax = high:low dword of the result
3666
Remarks:
3672
Remarks:
3667
  * If ecx contains nonexistent or not implemented for this processor
3673
  * If ecx contains nonexistent or not implemented for this processor
3668
    MSR, processor will generate an exception in the kernel, which
3674
    MSR, processor will generate an exception in the kernel, which
3669
    will kill the thread.
3675
    will kill the thread.
3670
  * Previously it is necessary to check, whether MSRs are supported
3676
  * Previously it is necessary to check, whether MSRs are supported
3671
    as a whole, with the instruction 'cpuid'. Otherwise processor
3677
    as a whole, with the instruction 'cpuid'. Otherwise processor
3672
    will generate other exception in the kernel, which will anyway
3678
    will generate other exception in the kernel, which will anyway
3673
    kill the thread.
3679
    kill the thread.
3674
 
3680
 
3675
======================================================================
3681
======================================================================
3676
========= Function 68, subfunction 4 - write to MSR-register. ========
3682
========= Function 68, subfunction 4 - write to MSR-register. ========
3677
======================================================================
3683
======================================================================
3678
MSR = Model Specific Register; the complete list of MSR-registers
3684
MSR = Model Specific Register; the complete list of MSR-registers
3679
of a processor is included to the documentation on it (for example,
3685
of a processor is included to the documentation on it (for example,
3680
IA-32 Intel Architecture Software Developer's Manual,
3686
IA-32 Intel Architecture Software Developer's Manual,
3681
Volume 3, Appendix B); each processor family has its own subset
3687
Volume 3, Appendix B); each processor family has its own subset
3682
of the MSR-registers.
3688
of the MSR-registers.
3683
Parameters:
3689
Parameters:
3684
  * eax = 68 - function number
3690
  * eax = 68 - function number
3685
  * ebx = 4 - subfunction number
3691
  * ebx = 4 - subfunction number
3686
  * ecx is ignored
3692
  * ecx is ignored
3687
  * edx = MSR address
3693
  * edx = MSR address
3688
  * esi:edi = high:low dword
3694
  * esi:edi = high:low dword
3689
Returned value:
3695
Returned value:
3690
  * ebx:eax = copy of esi:edi
3696
  * ebx:eax = copy of esi:edi
3691
Çàìå÷àíèÿ:
3697
Çàìå÷àíèÿ:
3692
  * If ecx contains nonexistent or not implemented for this processor
3698
  * If ecx contains nonexistent or not implemented for this processor
3693
    MSR, processor will generate an exception in the kernel, which
3699
    MSR, processor will generate an exception in the kernel, which
3694
    will kill the thread.
3700
    will kill the thread.
3695
  * Previously it is necessary to check, whether MSRs are supported
3701
  * Previously it is necessary to check, whether MSRs are supported
3696
    as a whole, with the instruction 'cpuid'. Otherwise processor
3702
    as a whole, with the instruction 'cpuid'. Otherwise processor
3697
    will generate other exception in the kernel, which will anyway
3703
    will generate other exception in the kernel, which will anyway
3698
    kill the thread.
3704
    kill the thread.
3699
 
3705
 
3700
======================================================================
3706
======================================================================
3701
======= Function 68, subfunction 5 - allocate physical memory. =======
3707
======= Function 68, subfunction 5 - allocate physical memory. =======
3702
======================================================================
3708
======================================================================
3703
Parameters:
3709
Parameters:
3704
  * eax = 68 - function number
3710
  * eax = 68 - function number
3705
  * ebx = 5 - subfunction number
3711
  * ebx = 5 - subfunction number
3706
  * ecx = size (in bytes)
3712
  * ecx = size (in bytes)
3707
Returned value:
3713
Returned value:
3708
  * eax = physical address of allocated memory
3714
  * eax = physical address of allocated memory
3709
Remarks:
3715
Remarks:
3710
  * Normal applications must not use this function, it is intended
3716
  * Normal applications must not use this function, it is intended
3711
    for the case, when for some device it is required to place
3717
    for the case, when for some device it is required to place
3712
    data to the known physical address. (In effect, this function
3718
    data to the known physical address. (In effect, this function
3713
    was developed for AC97WAV.)
3719
    was developed for AC97WAV.)
3714
  * The number of blocks of physical memory is limited (by constant
3720
  * The number of blocks of physical memory is limited (by constant
3715
    24, and this constant includes some blocks for kernel).
3721
    24, and this constant includes some blocks for kernel).
3716
  * To free a memory allocated by such way use
3722
  * To free a memory allocated by such way use
3717
    subfunction 6, to copy data there and back
3723
    subfunction 6, to copy data there and back
3718
    use subfunctions 7 and 8.
3724
    use subfunctions 7 and 8.
3719
 
3725
 
3720
======================================================================
3726
======================================================================
3721
========= Function 68, subfunction 6 - free physical memory. =========
3727
========= Function 68, subfunction 6 - free physical memory. =========
3722
======================================================================
3728
======================================================================
3723
Parameters:
3729
Parameters:
3724
  * eax = 68 - function number
3730
  * eax = 68 - function number
3725
  * ebx = 6 - subfunction number
3731
  * ebx = 6 - subfunction number
3726
  * ecx = physical address of memory
3732
  * ecx = physical address of memory
3727
Returned value:
3733
Returned value:
3728
  * function does not return value
3734
  * function does not return value
3729
Remarks:
3735
Remarks:
3730
  * Normal applications must not use this function, it is intended
3736
  * Normal applications must not use this function, it is intended
3731
    for the case, when for some device it is required to place
3737
    for the case, when for some device it is required to place
3732
    data to the known physical address. (In effect, this function
3738
    data to the known physical address. (In effect, this function
3733
    was developed for AC97WAV.)
3739
    was developed for AC97WAV.)
3734
  * The memory must be previously allocated by subfunction 5.
3740
  * The memory must be previously allocated by subfunction 5.
3735
 
3741
 
3736
======================================================================
3742
======================================================================
3737
===== Function 68, subfunction 7 - write data to physical memory. ====
3743
===== Function 68, subfunction 7 - write data to physical memory. ====
3738
======================================================================
3744
======================================================================
3739
Parameters:
3745
Parameters:
3740
  * eax = 68 - function number
3746
  * eax = 68 - function number
3741
  * ebx = 7 - subfunction number
3747
  * ebx = 7 - subfunction number
3742
  * ecx = physical address
3748
  * ecx = physical address
3743
  * edx = pointer to the data (in the application)
3749
  * edx = pointer to the data (in the application)
3744
  * esi = size of the data (in bytes)
3750
  * esi = size of the data (in bytes)
3745
Returned value:
3751
Returned value:
3746
  * function does not return value
3752
  * function does not return value
3747
Remarks:
3753
Remarks:
3748
  * Normal applications must not use this function, it is intended
3754
  * Normal applications must not use this function, it is intended
3749
    for the case, when for some device it is required to place
3755
    for the case, when for some device it is required to place
3750
    data to the known physical address. (In effect, this function
3756
    data to the known physical address. (In effect, this function
3751
    was developed for AC97WAV.)
3757
    was developed for AC97WAV.)
3752
  * The range of physical addresses should lie inside of previously
3758
  * The range of physical addresses should lie inside of previously
3753
    allocated by subfunction 5 block of physical memory.
3759
    allocated by subfunction 5 block of physical memory.
3754
  * There is no check for correctness.
3760
  * There is no check for correctness.
3755
 
3761
 
3756
======================================================================
3762
======================================================================
3757
==== Function 68, subfunction 8 - read data from physical memory. ====
3763
==== Function 68, subfunction 8 - read data from physical memory. ====
3758
======================================================================
3764
======================================================================
3759
Parameters:
3765
Parameters:
3760
  * eax = 68 - function number
3766
  * eax = 68 - function number
3761
  * ebx = 8 - subfunction number
3767
  * ebx = 8 - subfunction number
3762
  * ecx = physical address
3768
  * ecx = physical address
3763
  * edx = pointer to buffer for data (in application)
3769
  * edx = pointer to buffer for data (in application)
3764
  * esi = size of data (in bytes)
3770
  * esi = size of data (in bytes)
3765
Returned value:
3771
Returned value:
3766
  * function does not return value
3772
  * function does not return value
3767
Remarks:
3773
Remarks:
3768
  * Normal applications must not use this function, it is intended
3774
  * Normal applications must not use this function, it is intended
3769
    for the case, when for some device it is required to place
3775
    for the case, when for some device it is required to place
3770
    data to the known physical address. (In effect, this function
3776
    data to the known physical address. (In effect, this function
3771
    was developed for AC97WAV.)
3777
    was developed for AC97WAV.)
3772
  * The range of physical addresses should lie inside of previously
3778
  * The range of physical addresses should lie inside of previously
3773
    allocated by subfunction 5 block of physical memory.
3779
    allocated by subfunction 5 block of physical memory.
3774
  * There is no check for correctness.
3780
  * There is no check for correctness.
3775
 
3781
 
3776
======================================================================
3782
======================================================================
3777
====================== Fucntion 69 - debugging. ======================
3783
====================== Fucntion 69 - debugging. ======================
3778
======================================================================
3784
======================================================================
3779
A process can load other process as debugged by set of corresponding
3785
A process can load other process as debugged by set of corresponding
3780
bit by call to subfunction 16 of function 58
3786
bit by call to subfunction 16 of function 58
3781
or subfunction 7 of function 70.
3787
or subfunction 7 of function 70.
3782
A process can have only one debugger; one process can debug some
3788
A process can have only one debugger; one process can debug some
3783
others. The system notifies debugger on events occuring with
3789
others. The system notifies debugger on events occuring with
3784
debugged process. Messages are written to the buffer defined by
3790
debugged process. Messages are written to the buffer defined by
3785
subfunction 0.
3791
subfunction 0.
3786
Format of a message:
3792
Format of a message:
3787
  * +0: dword: message code
3793
  * +0: dword: message code
3788
  * +4: dword: PID of debugged process
3794
  * +4: dword: PID of debugged process
3789
  * +8: there can be additional data depending on message code
3795
  * +8: there can be additional data depending on message code
3790
Message codes:
3796
Message codes:
3791
  * 1 = exception
3797
  * 1 = exception
3792
    * in addition dword-number of the exception is given
3798
    * in addition dword-number of the exception is given
3793
    * process is suspended
3799
    * process is suspended
3794
  * 2 = process has terminated
3800
  * 2 = process has terminated
3795
    * comes at any termination: both through the system function -1,
3801
    * comes at any termination: both through the system function -1,
3796
      and at "murder" by any other process (including debugger itself)
3802
      and at "murder" by any other process (including debugger itself)
3797
  * 3 = debug exception int 1 = #DB
3803
  * 3 = debug exception int 1 = #DB
3798
    * in addition dword-image of the register DR6 is given:
3804
    * in addition dword-image of the register DR6 is given:
3799
      * bits 0-3: condition of the corresponding breakpoint (set by
3805
      * bits 0-3: condition of the corresponding breakpoint (set by
3800
        subfunction 9) is satisfied
3806
        subfunction 9) is satisfied
3801
      * áèò 14: exception has occured because of the trace mode
3807
      * áèò 14: exception has occured because of the trace mode
3802
        (flag TF is set TF)
3808
        (flag TF is set TF)
3803
    * process is suspended
3809
    * process is suspended
3804
When debugger terminates, all debugged processes are killed.
3810
When debugger terminates, all debugged processes are killed.
3805
If debugger does not want this, it must previously detach by
3811
If debugger does not want this, it must previously detach by
3806
subfunction 3.
3812
subfunction 3.
3807
 
3813
 
3808
All subfunctions are applicable only to processes/threads started
3814
All subfunctions are applicable only to processes/threads started
3809
from the current by function 58 or 70 with set debugging flag.
3815
from the current by function 58 or 70 with set debugging flag.
3810
Debugging of multithreaded programs is not supported yet.
3816
Debugging of multithreaded programs is not supported yet.
3811
The full list of subfunctions:
3817
The full list of subfunctions:
3812
  * subfunction 0 - define data area for debug messages
3818
  * subfunction 0 - define data area for debug messages
3813
  * subfunction 1 - get contents of registers of debugged thread
3819
  * subfunction 1 - get contents of registers of debugged thread
3814
  * subfunction 2 - set contents of registers of debugged thread
3820
  * subfunction 2 - set contents of registers of debugged thread
3815
  * subfunction 3 - detach from debugged process
3821
  * subfunction 3 - detach from debugged process
3816
  * subfunction 4 - suspend debugged thread
3822
  * subfunction 4 - suspend debugged thread
3817
  * subfunction 5 - resume debugged thread
3823
  * subfunction 5 - resume debugged thread
3818
  * subfunction 6 - read from the memory of debugged process
3824
  * subfunction 6 - read from the memory of debugged process
3819
  * subfunction 7 - write to the memory of debugged process
3825
  * subfunction 7 - write to the memory of debugged process
3820
  * subfunction 8 - terminate debugged thread
3826
  * subfunction 8 - terminate debugged thread
3821
  * subfunction 9 - set/clear hardware breakpoint
3827
  * subfunction 9 - set/clear hardware breakpoint
3822
 
3828
 
3823
======================================================================
3829
======================================================================
3824
= Function 69, subfunction 0 - define data area fror debug messages. =
3830
= Function 69, subfunction 0 - define data area fror debug messages. =
3825
======================================================================
3831
======================================================================
3826
Parameters:
3832
Parameters:
3827
  * eax = 69 - function number
3833
  * eax = 69 - function number
3828
  * ebx = 0 - subfunction number
3834
  * ebx = 0 - subfunction number
3829
  * ecx = pointer
3835
  * ecx = pointer
3830
Format of data area:
3836
Format of data area:
3831
  * +0: dword: N = buffer size (not including this header)
3837
  * +0: dword: N = buffer size (not including this header)
3832
  * +4: dword: occupied place
3838
  * +4: dword: occupied place
3833
  * +8: N*byte: buffer
3839
  * +8: N*byte: buffer
3834
Returned value:
3840
Returned value:
3835
  * function does not return value
3841
  * function does not return value
3836
Remarks:
3842
Remarks:
3837
  * If the size field is negative, the buffer is considered locked
3843
  * If the size field is negative, the buffer is considered locked
3838
    and at arrival of new message the system will wait.
3844
    and at arrival of new message the system will wait.
3839
    For synchronization frame all work with the buffer by operations
3845
    For synchronization frame all work with the buffer by operations
3840
    lock/unlock
3846
    lock/unlock
3841
    	neg	[bufsize]
3847
    	neg	[bufsize]
3842
  * Data in the buffer are considered as array of items with variable
3848
  * Data in the buffer are considered as array of items with variable
3843
    length - messages. Format of a message is explained in
3849
    length - messages. Format of a message is explained in
3844
    general description.
3850
    general description.
3845
 
3851
 
3846
======================================================================
3852
======================================================================
3847
===================== Function 69, subfunction 1 =====================
3853
===================== Function 69, subfunction 1 =====================
3848
============ Get contents of registers of debugged thread. ===========
3854
============ Get contents of registers of debugged thread. ===========
3849
======================================================================
3855
======================================================================
3850
Parameters:
3856
Parameters:
3851
  * eax = 69 - function number
3857
  * eax = 69 - function number
3852
  * ebx = 1 - subfunction number
3858
  * ebx = 1 - subfunction number
3853
  * ecx = thread identifier
3859
  * ecx = thread identifier
3854
  * edx = size of context structure, must be 0x28=40 bytes
3860
  * edx = size of context structure, must be 0x28=40 bytes
3855
  * esi = pointer to context structure
3861
  * esi = pointer to context structure
3856
Returned value:
3862
Returned value:
3857
  * function does not return value
3863
  * function does not return value
3858
Format of context structure: (FPU is not supported yet)
3864
Format of context structure: (FPU is not supported yet)
3859
  * +0: dword: eip
3865
  * +0: dword: eip
3860
  * +4: dword: eflags
3866
  * +4: dword: eflags
3861
  * +8: dword: eax
3867
  * +8: dword: eax
3862
  * +12 = +0xC: dword: ecx
3868
  * +12 = +0xC: dword: ecx
3863
  * +16 = +0x10: dword: edx
3869
  * +16 = +0x10: dword: edx
3864
  * +20 = +0x14: dword: ebx
3870
  * +20 = +0x14: dword: ebx
3865
  * +24 = +0x18: dword: esp
3871
  * +24 = +0x18: dword: esp
3866
  * +28 = +0x1C: dword: ebp
3872
  * +28 = +0x1C: dword: ebp
3867
  * +32 = +0x20: dword: esi
3873
  * +32 = +0x20: dword: esi
3868
  * +36 = +0x24: dword: edi
3874
  * +36 = +0x24: dword: edi
3869
Remarks:
3875
Remarks:
3870
  * If the thread executes code of ring-0, the function returns
3876
  * If the thread executes code of ring-0, the function returns
3871
    contents of registers of ring-3.
3877
    contents of registers of ring-3.
3872
  * Process must be loaded for debugging (as is shown in
3878
  * Process must be loaded for debugging (as is shown in
3873
    general description).
3879
    general description).
3874
 
3880
 
3875
======================================================================
3881
======================================================================
3876
===================== Function 69, subfunction 2 =====================
3882
===================== Function 69, subfunction 2 =====================
3877
============ Set contents of registers of debugged thread. ===========
3883
============ Set contents of registers of debugged thread. ===========
3878
======================================================================
3884
======================================================================
3879
Parameters:
3885
Parameters:
3880
  * eax = 69 - function number
3886
  * eax = 69 - function number
3881
  * ebx = 2 - subfunction number
3887
  * ebx = 2 - subfunction number
3882
  * ecx = thread identifier
3888
  * ecx = thread identifier
3883
  * edx = size of context structure, must be 0x28=40 bytes
3889
  * edx = size of context structure, must be 0x28=40 bytes
3884
Returned value:
3890
Returned value:
3885
  * function does not return value
3891
  * function does not return value
3886
Format of context structure is shown in the description of
3892
Format of context structure is shown in the description of
3887
subfunction 1.
3893
subfunction 1.
3888
Remarks:
3894
Remarks:
3889
  * If the thread executes code of ring-0, the function returns
3895
  * If the thread executes code of ring-0, the function returns
3890
    contents of registers of ring-3.
3896
    contents of registers of ring-3.
3891
  * Process must be loaded for debugging (as is shown in
3897
  * Process must be loaded for debugging (as is shown in
3892
    general description).
3898
    general description).
3893
 
3899
 
3894
======================================================================
3900
======================================================================
3895
===== Function 69, subfunction 3 - detach from debugged process. =====
3901
===== Function 69, subfunction 3 - detach from debugged process. =====
3896
======================================================================
3902
======================================================================
3897
Parameters:
3903
Parameters:
3898
  * eax = 69 - function number
3904
  * eax = 69 - function number
3899
  * ebx = 3 - subfunction number
3905
  * ebx = 3 - subfunction number
3900
  * ecx = identifier
3906
  * ecx = identifier
3901
Returned value:
3907
Returned value:
3902
  * function does not return value
3908
  * function does not return value
3903
Remarks:
3909
Remarks:
3904
  * If the process was suspended, it resumes execution.
3910
  * If the process was suspended, it resumes execution.
3905
 
3911
 
3906
======================================================================
3912
======================================================================
3907
======== Function 69, subfunction 4 - suspend debugged thread. =======
3913
======== Function 69, subfunction 4 - suspend debugged thread. =======
3908
======================================================================
3914
======================================================================
3909
Parameters:
3915
Parameters:
3910
  * eax = 69 - function number
3916
  * eax = 69 - function number
3911
  * ebx = 4 - subfunction number
3917
  * ebx = 4 - subfunction number
3912
  * ecx = thread identifier
3918
  * ecx = thread identifier
3913
Returned value:
3919
Returned value:
3914
  * function does not return value
3920
  * function does not return value
3915
Remarks:
3921
Remarks:
3916
  * Process must be loaded for debugging (as is shown in
3922
  * Process must be loaded for debugging (as is shown in
3917
    general description).
3923
    general description).
3918
 
3924
 
3919
======================================================================
3925
======================================================================
3920
======== Function 69, subfunction 5 - resume debugged thread. ========
3926
======== Function 69, subfunction 5 - resume debugged thread. ========
3921
======================================================================
3927
======================================================================
3922
Parameters:
3928
Parameters:
3923
  * eax = 69 - function number
3929
  * eax = 69 - function number
3924
  * ebx = 5 - subfunction number
3930
  * ebx = 5 - subfunction number
3925
  * ecx = thread identifier
3931
  * ecx = thread identifier
3926
Returned value:
3932
Returned value:
3927
  * function does not return value
3933
  * function does not return value
3928
Remarks:
3934
Remarks:
3929
  * Process must be loaded for debugging (as is shown in
3935
  * Process must be loaded for debugging (as is shown in
3930
    general description).
3936
    general description).
3931
 
3937
 
3932
======================================================================
3938
======================================================================
3933
= Fucntion 69, subfunction 6 - read from memory of debugged process. =
3939
= Fucntion 69, subfunction 6 - read from memory of debugged process. =
3934
======================================================================
3940
======================================================================
3935
Parameters:
3941
Parameters:
3936
  * eax = 69 - function number
3942
  * eax = 69 - function number
3937
  * ebx = 6 - subfunction number
3943
  * ebx = 6 - subfunction number
3938
  * ecx = identifier
3944
  * ecx = identifier
3939
  * edx = number of bytes to read
3945
  * edx = number of bytes to read
3940
  * esi = address in the memory of debugged process
3946
  * esi = address in the memory of debugged process
3941
  * edi = pointer to buffer for data
3947
  * edi = pointer to buffer for data
3942
Returned value:
3948
Returned value:
3943
  * eax = -1 at an error (invalid PID or buffer)
3949
  * eax = -1 at an error (invalid PID or buffer)
3944
  * otherwise eax = number of read bytes (possibly, 0,
3950
  * otherwise eax = number of read bytes (possibly, 0,
3945
    if esi is too large)
3951
    if esi is too large)
3946
Remarks:
3952
Remarks:
3947
  * Process must be loaded for debugging (as is shown in
3953
  * Process must be loaded for debugging (as is shown in
3948
    general description).
3954
    general description).
3949
 
3955
 
3950
======================================================================
3956
======================================================================
3951
== Function 69, subfunction 7 - write to memory of debugged process. =
3957
== Function 69, subfunction 7 - write to memory of debugged process. =
3952
======================================================================
3958
======================================================================
3953
Parameters:
3959
Parameters:
3954
  * eax = 69 - function number
3960
  * eax = 69 - function number
3955
  * ebx = 7 - subfunction number
3961
  * ebx = 7 - subfunction number
3956
  * ecx = identifier
3962
  * ecx = identifier
3957
  * edx = number of bytes to write
3963
  * edx = number of bytes to write
3958
  * esi = address of memory in debugged process
3964
  * esi = address of memory in debugged process
3959
  * edi = pointer to data
3965
  * edi = pointer to data
3960
Returned value:
3966
Returned value:
3961
  * eax = -1 at an error (invalid PID or buffer)
3967
  * eax = -1 at an error (invalid PID or buffer)
3962
  * otherwise eax = number of written bytes (possibly, 0,
3968
  * otherwise eax = number of written bytes (possibly, 0,
3963
    if esi is too large)
3969
    if esi is too large)
3964
Remarks:
3970
Remarks:
3965
  * Process must be loaded for debugging (as is shown in
3971
  * Process must be loaded for debugging (as is shown in
3966
    general description).
3972
    general description).
3967
 
3973
 
3968
======================================================================
3974
======================================================================
3969
======= Function 69, subfunction 8 - terminate debugged thread. ======
3975
======= Function 69, subfunction 8 - terminate debugged thread. ======
3970
======================================================================
3976
======================================================================
3971
Parameters:
3977
Parameters:
3972
  * eax = 69 - function number
3978
  * eax = 69 - function number
3973
  * ebx = 8 - subfunction number
3979
  * ebx = 8 - subfunction number
3974
  * ecx = identifier
3980
  * ecx = identifier
3975
Returned value:
3981
Returned value:
3976
  * function does not return value
3982
  * function does not return value
3977
Remarks:
3983
Remarks:
3978
  * Process must be loaded for debugging (as is shown in
3984
  * Process must be loaded for debugging (as is shown in
3979
    general description).
3985
    general description).
3980
  * The function is similar to subfunction 2 of function 18
3986
  * The function is similar to subfunction 2 of function 18
3981
    with two differences: it requires first remark and
3987
    with two differences: it requires first remark and
3982
    accepts PID rather than slot number.
3988
    accepts PID rather than slot number.
3983
 
3989
 
3984
======================================================================
3990
======================================================================
3985
===== Function 69, subfunction 9 - set/clear hardware breakpoint. ====
3991
===== Function 69, subfunction 9 - set/clear hardware breakpoint. ====
3986
======================================================================
3992
======================================================================
3987
Parameters:
3993
Parameters:
3988
  * eax = 69 - function number
3994
  * eax = 69 - function number
3989
  * ebx = 9 - subfunction number
3995
  * ebx = 9 - subfunction number
3990
  * ecx = thread identifier
3996
  * ecx = thread identifier
3991
  * dl = index of breakpoint, from 0 to 3 inclusively
3997
  * dl = index of breakpoint, from 0 to 3 inclusively
3992
  * dh = flags:
3998
  * dh = flags:
3993
    * if high bit is cleared - set breakpoint:
3999
    * if high bit is cleared - set breakpoint:
3994
      * bits 0-1 - condition:
4000
      * bits 0-1 - condition:
3995
        * 00 = breakpoint on execution
4001
        * 00 = breakpoint on execution
3996
        * 01 = breakpoint on read
4002
        * 01 = breakpoint on read
3997
        * 11 = breakpoint on read/write
4003
        * 11 = breakpoint on read/write
3998
      * bits 2-3 - length; for breakpoints on exception it must be
4004
      * bits 2-3 - length; for breakpoints on exception it must be
3999
        00, otherwise one of
4005
        00, otherwise one of
4000
        * 00 = byte
4006
        * 00 = byte
4001
        * 01 = word
4007
        * 01 = word
4002
        * 11 = dword
4008
        * 11 = dword
4003
      * esi = breakpoint address; must be aligned according to
4009
      * esi = breakpoint address; must be aligned according to
4004
        the length (i.e. must be even for word breakpoints,
4010
        the length (i.e. must be even for word breakpoints,
4005
        divisible by 4 for dword)
4011
        divisible by 4 for dword)
4006
    * if high bit is set - clear breakpoint
4012
    * if high bit is set - clear breakpoint
4007
Returned value:
4013
Returned value:
4008
  * eax = 0 - success
4014
  * eax = 0 - success
4009
  * eax = 1 - error in the input data
4015
  * eax = 1 - error in the input data
4010
  * eax = 2 - (reserved, is never returned in the current
4016
  * eax = 2 - (reserved, is never returned in the current
4011
    implementation) a global breakpoint with that index is already set
4017
    implementation) a global breakpoint with that index is already set
4012
Remarks:
4018
Remarks:
4013
  * Process must be loaded for debugging (as is shown in
4019
  * Process must be loaded for debugging (as is shown in
4014
    general description).
4020
    general description).
4015
  * Hardware breakpoints are implemented through DRx-registers of
4021
  * Hardware breakpoints are implemented through DRx-registers of
4016
    the processor, all limitations results from this.
4022
    the processor, all limitations results from this.
4017
  * The function can reinstall the breakpoint, previously set
4023
  * The function can reinstall the breakpoint, previously set
4018
    by it (and it does not inform on this).
4024
    by it (and it does not inform on this).
4019
    Carry on the list of set breakpoints in the debugger.
4025
    Carry on the list of set breakpoints in the debugger.
4020
  * Breakpoints generate debug exception #DB, on which the system
4026
  * Breakpoints generate debug exception #DB, on which the system
4021
    notifies debugger.
4027
    notifies debugger.
4022
  * Breakpoints on write and read/write act after
4028
  * Breakpoints on write and read/write act after
4023
    execution of the caused it instruction.
4029
    execution of the caused it instruction.
4024
 
4030
 
4025
======================================================================
4031
======================================================================
4026
==== Function 70 - work with file system with long names support. ====
4032
==== Function 70 - work with file system with long names support. ====
4027
======================================================================
4033
======================================================================
4028
Parameters:
4034
Parameters:
4029
  * eax = 70
4035
  * eax = 70
4030
  * ebx = pointer to the information structure
4036
  * ebx = pointer to the information structure
4031
Returned value:
4037
Returned value:
4032
  * eax = 0 - success; otherwise file system error code
4038
  * eax = 0 - success; otherwise file system error code
4033
  * some subfunctions return value in other registers too
4039
  * some subfunctions return value in other registers too
4034
General format of the information structure:
4040
General format of the information structure:
4035
  * +0: dword: subfunction number
4041
  * +0: dword: subfunction number
4036
  * +4: dword: file offset
4042
  * +4: dword: file offset
4037
  * +8: dword: high dword of offset (must be 0) or flags field
4043
  * +8: dword: high dword of offset (must be 0) or flags field
4038
  * +12 = +0xC: dword: size
4044
  * +12 = +0xC: dword: size
4039
  * +16 = +0x10: dword: pointer to data
4045
  * +16 = +0x10: dword: pointer to data
4040
  * +20 = +0x14: n db: ASCIIZ-string with the filename
4046
  * +20 = +0x14: n db: ASCIIZ-string with the filename
4041
    or
4047
    or
4042
  * +20 = +0x14: db 0
4048
  * +20 = +0x14: db 0
4043
  * +21 = +0x15: dd pointer to ASCIIZ-string with the filename
4049
  * +21 = +0x15: dd pointer to ASCIIZ-string with the filename
4044
Specifications - in documentation on the appropriate subfunction.
4050
Specifications - in documentation on the appropriate subfunction.
4045
Filename is case-insensitive. Russian letters must be written in
4051
Filename is case-insensitive. Russian letters must be written in
4046
the encoding cp866 (DOS).
4052
the encoding cp866 (DOS).
4047
Format of filename:
4053
Format of filename:
4048
/base/number/dir1/dir2/.../dirn/file,
4054
/base/number/dir1/dir2/.../dirn/file,
4049
where /base/number identifies device, on which file is located:
4055
where /base/number identifies device, on which file is located:
4050
one of
4056
one of
4051
  * /RD/1 = /RAMDISK/1 to access ramdisk
4057
  * /RD/1 = /RAMDISK/1 to access ramdisk
4052
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
4058
  * /FD/1 = /FLOPPYDISK/1 to access first floppy drive,
4053
    /FD/2 = /FLOPPYDISK/2 to access second one
4059
    /FD/2 = /FLOPPYDISK/2 to access second one
4054
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
4060
  * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices
4055
    IDE0 (Primary Master), IDE1 (Primary Slave),
4061
    IDE0 (Primary Master), IDE1 (Primary Slave),
4056
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
4062
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
4057
    x - partition number on the selected hard drive, varies from 1
4063
    x - partition number on the selected hard drive, varies from 1
4058
    to 255 (on each hard drive the indexing starts from 1)
4064
    to 255 (on each hard drive the indexing starts from 1)
4059
  * /CD0/1, /CD1/1, /CD2/1, /CD3/1 to access accordingly to
4065
  * /CD0/1, /CD1/1, /CD2/1, /CD3/1 to access accordingly to
4060
    CD on IDE0 (Primary Master), IDE1 (Primary Slave),
4066
    CD on IDE0 (Primary Master), IDE1 (Primary Slave),
4061
    IDE2 (Secondary Master), IDE3 (Secondary Slave)
4067
    IDE2 (Secondary Master), IDE3 (Secondary Slave)
4062
Examples:
4068
Examples:
4063
  * '/rd/1/kernel.asm',0
4069
  * '/rd/1/kernel.asm',0
4064
  * '/HD0/1/kernel.asm',0
4070
  * '/HD0/1/kernel.asm',0
4065
  * '/hd0/2/menuet/pics/tanzania.bmp',0
4071
  * '/hd0/2/menuet/pics/tanzania.bmp',0
4066
  * '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0
4072
  * '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0
4067
Available subfunctions:
4073
Available subfunctions:
4068
  * subfunction 0 - read file
4074
  * subfunction 0 - read file
4069
  * subfunction 1 - read folder
4075
  * subfunction 1 - read folder
4070
  * subfunction 2 - create/rewrite file
4076
  * subfunction 2 - create/rewrite file
4071
  * subfunction 3 - write to existing file
4077
  * subfunction 3 - write to existing file
4072
  * subfunction 4 - set file size
4078
  * subfunction 4 - set file size
4073
  * subfunction 5 - get attributes of file/folder
4079
  * subfunction 5 - get attributes of file/folder
4074
  * subfunction 6 - set attributes of file/folder
4080
  * subfunction 6 - set attributes of file/folder
4075
  * subfunction 7 - start application
4081
  * subfunction 7 - start application
4076
For CD-drives due to hardware limitations only subfunctions
4082
For CD-drives due to hardware limitations only subfunctions
4077
0,1,5 and 7 are available, other subfunctions return error
4083
0,1,5 and 7 are available, other subfunctions return error
4078
with code 2.
4084
with code 2.
4079
 
4085
 
4080
======================================================================
4086
======================================================================
4081
=== Function 70, subfunction 0 - read file with long names support. ==
4087
=== Function 70, subfunction 0 - read file with long names support. ==
4082
======================================================================
4088
======================================================================
4083
Parameters:
4089
Parameters:
4084
  * eax = 70 - function number
4090
  * eax = 70 - function number
4085
  * ebx = pointer to the information structure
4091
  * ebx = pointer to the information structure
4086
Format of the information structure:
4092
Format of the information structure:
4087
  * +0: dword: 0 = subfunction number
4093
  * +0: dword: 0 = subfunction number
4088
  * +4: dword: file offset (in bytes)
4094
  * +4: dword: file offset (in bytes)
4089
  * +8: dword: 0 (reserved for high dword of offset)
4095
  * +8: dword: 0 (reserved for high dword of offset)
4090
  * +12 = +0xC: dword: number of bytes to read
4096
  * +12 = +0xC: dword: number of bytes to read
4091
  * +16 = +0x10: dword: pointer to buffer for data
4097
  * +16 = +0x10: dword: pointer to buffer for data
4092
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4098
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4093
    given in the general description
4099
    given in the general description
4094
    or
4100
    or
4095
  * +20 = +0x14: db 0
4101
  * +20 = +0x14: db 0
4096
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4102
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4097
Returned value:
4103
Returned value:
4098
  * eax = 0 - success, otherwise file system error code
4104
  * eax = 0 - success, otherwise file system error code
4099
  * ebx = number of read bytes or -1=0xffffffff if file was not found
4105
  * ebx = number of read bytes or -1=0xffffffff if file was not found
4100
Remarks:
4106
Remarks:
4101
  * If file was ended before last requested block was read,
4107
  * If file was ended before last requested block was read,
4102
    the function will read as many as it can, and after that return
4108
    the function will read as many as it can, and after that return
4103
    eax=6 (EOF).
4109
    eax=6 (EOF).
4104
  * The function does not allow to read folder (returns eax=10,
4110
  * The function does not allow to read folder (returns eax=10,
4105
    access denied).
4111
    access denied).
4106
 
4112
 
4107
======================================================================
4113
======================================================================
4108
== Function 70, subfunction 1 - read folder with long names support. =
4114
== Function 70, subfunction 1 - read folder with long names support. =
4109
======================================================================
4115
======================================================================
4110
Parameters:
4116
Parameters:
4111
  * eax = 70 - function number
4117
  * eax = 70 - function number
4112
  * ebx = pointer to the information structure
4118
  * ebx = pointer to the information structure
4113
Format of the information structure:
4119
Format of the information structure:
4114
  * +0: dword: 1 = subfunction number
4120
  * +0: dword: 1 = subfunction number
4115
  * +4: dword: index of starting block (beginning from 0)
4121
  * +4: dword: index of starting block (beginning from 0)
4116
  * +8: dword: flags field:
4122
  * +8: dword: flags field:
4117
    * bit 0 (mask 1): in what format to return names,
4123
    * bit 0 (mask 1): in what format to return names,
4118
      0=ANSI, 1=UNICODE
4124
      0=ANSI, 1=UNICODE
4119
    * other bits are reserved and must be set to 0 for the future
4125
    * other bits are reserved and must be set to 0 for the future
4120
      compatibility
4126
      compatibility
4121
  * +12 = +0xC: dword: number of blocks to read
4127
  * +12 = +0xC: dword: number of blocks to read
4122
  * +16 = +0x10: dword: pointer to buffer for data, buffer size
4128
  * +16 = +0x10: dword: pointer to buffer for data, buffer size
4123
    must be not less than 32 + [+12]*560 bytes
4129
    must be not less than 32 + [+12]*560 bytes
4124
  * +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
4130
  * +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are
4125
    given in the general description
4131
    given in the general description
4126
    or
4132
    or
4127
  * +20 = +0x14: db 0
4133
  * +20 = +0x14: db 0
4128
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4134
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4129
Returned value:
4135
Returned value:
4130
  * eax = 0 - success, otherwise file system error code
4136
  * eax = 0 - success, otherwise file system error code
4131
  * ebx = number of files, information on which was written to
4137
  * ebx = number of files, information on which was written to
4132
    the buffer, or -1=0xffffffff, if folder was not found
4138
    the buffer, or -1=0xffffffff, if folder was not found
4133
Structure of the buffer:
4139
Structure of the buffer:
4134
  * +0: 32*byte: header
4140
  * +0: 32*byte: header
4135
  * +32 = +0x20: n1*byte: block with information on file 1
4141
  * +32 = +0x20: n1*byte: block with information on file 1
4136
  * +32+n1: n2*byte: block with information on file 2
4142
  * +32+n1: n2*byte: block with information on file 2
4137
  * ...
4143
  * ...
4138
Structure of header:
4144
Structure of header:
4139
  * +0: dword: version of structure (current is 1)
4145
  * +0: dword: version of structure (current is 1)
4140
  * +4: dword: number of placed blocks; is not greater than requested
4146
  * +4: dword: number of placed blocks; is not greater than requested
4141
    in the field +12 of information structure; can be less, if
4147
    in the field +12 of information structure; can be less, if
4142
    there are no more files in folder (the same as in ebx)
4148
    there are no more files in folder (the same as in ebx)
4143
  * +8: dword: total number of files in folder
4149
  * +8: dword: total number of files in folder
4144
  * +12 = +0xC: 20*byte: reserved (zeroed)
4150
  * +12 = +0xC: 20*byte: reserved (zeroed)
4145
Structure of block of data for folder entry (BDFE):
4151
Structure of block of data for folder entry (BDFE):
4146
  * +0: dword: attributes of file:
4152
  * +0: dword: attributes of file:
4147
    * bit 0 (mask 1): file is read-only
4153
    * bit 0 (mask 1): file is read-only
4148
    * bit 1 (mask 2): file is hidden
4154
    * bit 1 (mask 2): file is hidden
4149
    * bit 2 (mask 4): file is system
4155
    * bit 2 (mask 4): file is system
4150
    * bit 3 (mask 8): this is not a file but volume label
4156
    * bit 3 (mask 8): this is not a file but volume label
4151
      (for one partition meets no more than once and
4157
      (for one partition meets no more than once and
4152
      only in root folder)
4158
      only in root folder)
4153
    * bit 4 (mask 0x10): this is a folder
4159
    * bit 4 (mask 0x10): this is a folder
4154
    * bit 5 (mask 0x20): file was not archived - many archivation
4160
    * bit 5 (mask 0x20): file was not archived - many archivation
4155
      programs have an option to archive only files with this bit set,
4161
      programs have an option to archive only files with this bit set,
4156
      and after archiving this bit is cleared - it can be useful
4162
      and after archiving this bit is cleared - it can be useful
4157
      for automatically creating of backup-archives as at writing
4163
      for automatically creating of backup-archives as at writing
4158
      this bit is usually set
4164
      this bit is usually set
4159
  * +4: byte: type of name data:
4165
  * +4: byte: type of name data:
4160
    (coincides with bit 0 of flags in the information structure)
4166
    (coincides with bit 0 of flags in the information structure)
4161
    * 0 = ASCII = 1-byte representation of each character
4167
    * 0 = ASCII = 1-byte representation of each character
4162
    * 1 = UNICODE = 2-byte representation of each character
4168
    * 1 = UNICODE = 2-byte representation of each character
4163
  * +5: 3*byte: reserved (zero)
4169
  * +5: 3*byte: reserved (zero)
4164
  * +8: 4*byte: time of file creation
4170
  * +8: 4*byte: time of file creation
4165
  * +12 = +0xC: 4*byte: date of file creation
4171
  * +12 = +0xC: 4*byte: date of file creation
4166
  * +16 = +0x10: 4*byte: time of last access (read or write)
4172
  * +16 = +0x10: 4*byte: time of last access (read or write)
4167
  * +20 = +0x14: 4*byte: date of last access
4173
  * +20 = +0x14: 4*byte: date of last access
4168
  * +24 = +0x18: 4*byte: time of last modification
4174
  * +24 = +0x18: 4*byte: time of last modification
4169
  * +28 = +0x1C: 4*byte: date of last modification
4175
  * +28 = +0x1C: 4*byte: date of last modification
4170
  * +32 = +0x20: qword: file size in bytes (up to 16777216 Tb)
4176
  * +32 = +0x20: qword: file size in bytes (up to 16777216 Tb)
4171
  * +40 = +0x28: name
4177
  * +40 = +0x28: name
4172
    * for ASCII format: maximum length is 263 characters
4178
    * for ASCII format: maximum length is 263 characters
4173
      (263 bytes), byte after the name has value 0
4179
      (263 bytes), byte after the name has value 0
4174
    * äëÿ ôîðìàòà UNICODE: maximum length is 259 characters
4180
    * äëÿ ôîðìàòà UNICODE: maximum length is 259 characters
4175
      (518 bytes), 2 bytes after the name have value 0
4181
      (518 bytes), 2 bytes after the name have value 0
4176
Time format:
4182
Time format:
4177
  * +0: byte: seconds
4183
  * +0: byte: seconds
4178
  * +1: byte: minutes
4184
  * +1: byte: minutes
4179
  * +2: byte: hours
4185
  * +2: byte: hours
4180
  * +3: byte: reserved (0)
4186
  * +3: byte: reserved (0)
4181
  * for example, 23.59.59 is written as (in hex) 3B 3B 17 00
4187
  * for example, 23.59.59 is written as (in hex) 3B 3B 17 00
4182
Date format:
4188
Date format:
4183
  * +0: byte: day
4189
  * +0: byte: day
4184
  * +1: byte: month
4190
  * +1: byte: month
4185
  * +2: word: year
4191
  * +2: word: year
4186
  * for example, 25.11.1979 is written as (in hex) 19 0B BB 07
4192
  * for example, 25.11.1979 is written as (in hex) 19 0B BB 07
4187
Remarks:
4193
Remarks:
4188
  * If BDFE contains ASCII name, the length of BDFE is 304 bytes,
4194
  * If BDFE contains ASCII name, the length of BDFE is 304 bytes,
4189
    if UNICODE name - 560 bytes. Value of length is aligned
4195
    if UNICODE name - 560 bytes. Value of length is aligned
4190
    on 16-byte bound (to accelerate processing in CPU cache).
4196
    on 16-byte bound (to accelerate processing in CPU cache).
4191
  * First character after a name is zero (ASCIIZ-string). The further
4197
  * First character after a name is zero (ASCIIZ-string). The further
4192
    data contain garbage.
4198
    data contain garbage.
4193
  * If files in folder were ended before requested number was read,
4199
  * If files in folder were ended before requested number was read,
4194
    the function will read as many as it can, and after that return
4200
    the function will read as many as it can, and after that return
4195
    eax=6 (EOF).
4201
    eax=6 (EOF).
4196
  * Any folder on the disk, except for root, contains two special
4202
  * Any folder on the disk, except for root, contains two special
4197
    entries "." and "..", identifying accordingly the folder itself
4203
    entries "." and "..", identifying accordingly the folder itself
4198
    and the parent folder.
4204
    and the parent folder.
4199
  * The function allows also to read virtual folders "/", "/rd",
4205
  * The function allows also to read virtual folders "/", "/rd",
4200
    "/fd", "/hd[n]", thus attributes of subfolders are set to 0x10,
4206
    "/fd", "/hd[n]", thus attributes of subfolders are set to 0x10,
4201
    and times and dates are zeroed. An alternative way to get the
4207
    and times and dates are zeroed. An alternative way to get the
4202
    equipment information - subfunction 11 of function 18.
4208
    equipment information - subfunction 11 of function 18.
4203
 
4209
 
4204
======================================================================
4210
======================================================================
4205
===================== Function 70, subfunction 2 =====================
4211
===================== Function 70, subfunction 2 =====================
4206
============ Create/rewrite file with long names support. ============
4212
============ Create/rewrite file with long names support. ============
4207
======================================================================
4213
======================================================================
4208
Parameters:
4214
Parameters:
4209
  * eax = 70 - function number
4215
  * eax = 70 - function number
4210
  * ebx = pointer to the information structure
4216
  * ebx = pointer to the information structure
4211
Format of the information structure:
4217
Format of the information structure:
4212
  * +0: dword: 2 = subfunction number
4218
  * +0: dword: 2 = subfunction number
4213
  * +4: dword: 0 (reserved)
4219
  * +4: dword: 0 (reserved)
4214
  * +8: dword: 0 (reserved)
4220
  * +8: dword: 0 (reserved)
4215
  * +12 = +0xC: dword: number of bytes to read
4221
  * +12 = +0xC: dword: number of bytes to read
4216
  * +16 = +0x10: dword: pointer to data
4222
  * +16 = +0x10: dword: pointer to data
4217
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4223
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4218
    given in the general description
4224
    given in the general description
4219
    or
4225
    or
4220
  * +20 = +0x14: db 0
4226
  * +20 = +0x14: db 0
4221
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4227
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4222
Returned value:
4228
Returned value:
4223
  * eax = 0 - success, otherwise file system error code
4229
  * eax = 0 - success, otherwise file system error code
4224
  * ebx = number of written bytes (possibly 0)
4230
  * ebx = number of written bytes (possibly 0)
4225
Remarks:
4231
Remarks:
4226
  * If a file with given name did not exist, it is created;
4232
  * If a file with given name did not exist, it is created;
4227
    if it existed, it is rewritten.
4233
    if it existed, it is rewritten.
4228
  * If there is not enough free space on disk, the function will
4234
  * If there is not enough free space on disk, the function will
4229
    write as many as can and then return error code 8.
4235
    write as many as can and then return error code 8.
4230
  * The function is not supported for CD (returns error code 2).
4236
  * The function is not supported for CD (returns error code 2).
4231
 
4237
 
4232
======================================================================
4238
======================================================================
4233
===================== Function 70, subfunction 3 =====================
4239
===================== Function 70, subfunction 3 =====================
4234
=========== Write to existing file with long names support. ==========
4240
=========== Write to existing file with long names support. ==========
4235
======================================================================
4241
======================================================================
4236
Parameters:
4242
Parameters:
4237
  * eax = 70 - function number
4243
  * eax = 70 - function number
4238
  * ebx = pointer to the information structure
4244
  * ebx = pointer to the information structure
4239
Format of the information structure:
4245
Format of the information structure:
4240
  * +0: dword: 3 = subfunction number
4246
  * +0: dword: 3 = subfunction number
4241
  * +4: dword: file offset (in bytes)
4247
  * +4: dword: file offset (in bytes)
4242
  * +8: dword: high dword of offset (must be 0 for FAT)
4248
  * +8: dword: high dword of offset (must be 0 for FAT)
4243
  * +12 = +0xC: dword: number of bytes to write
4249
  * +12 = +0xC: dword: number of bytes to write
4244
  * +16 = +0x10: dword: pointer to data
4250
  * +16 = +0x10: dword: pointer to data
4245
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4251
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4246
    given in the general description
4252
    given in the general description
4247
    or
4253
    or
4248
  * +20 = +0x14: db 0
4254
  * +20 = +0x14: db 0
4249
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4255
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4250
Returned value:
4256
Returned value:
4251
  * eax = 0 - success, otherwise file system error code
4257
  * eax = 0 - success, otherwise file system error code
4252
  * ebx = number of written bytes (possibly 0)
4258
  * ebx = number of written bytes (possibly 0)
4253
Remarks:
4259
Remarks:
4254
  * The file must already exist, otherwise function returns eax=5.
4260
  * The file must already exist, otherwise function returns eax=5.
4255
  * The only result of write 0 bytes is update in the file attributes
4261
  * The only result of write 0 bytes is update in the file attributes
4256
    date/time of modification and access to the current date/time.
4262
    date/time of modification and access to the current date/time.
4257
  * If beginning and/or ending position is greater than file size
4263
  * If beginning and/or ending position is greater than file size
4258
    (except for the previous case), the file is expanded to needed
4264
    (except for the previous case), the file is expanded to needed
4259
    size with zero characters.
4265
    size with zero characters.
4260
  * The function is not supported for CD (returns error code 2).
4266
  * The function is not supported for CD (returns error code 2).
4261
 
4267
 
4262
======================================================================
4268
======================================================================
4263
============ Function 70, subfunction 4 - set end of file. ===========
4269
============ Function 70, subfunction 4 - set end of file. ===========
4264
======================================================================
4270
======================================================================
4265
Parameters:
4271
Parameters:
4266
  * eax = 70 - function number
4272
  * eax = 70 - function number
4267
  * ebx = pointer to the information structure
4273
  * ebx = pointer to the information structure
4268
Format of the information structure:
4274
Format of the information structure:
4269
  * +0: dword: 4 = subfunction number
4275
  * +0: dword: 4 = subfunction number
4270
  * +4: dword: low dword of new file size
4276
  * +4: dword: low dword of new file size
4271
  * +8: dword: high dword of new file size (must be 0 for FAT)
4277
  * +8: dword: high dword of new file size (must be 0 for FAT)
4272
  * +12 = +0xC: dword: 0 (reserved)
4278
  * +12 = +0xC: dword: 0 (reserved)
4273
  * +16 = +0x10: dword: 0 (reserved)
4279
  * +16 = +0x10: dword: 0 (reserved)
4274
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4280
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4275
    given in the general description
4281
    given in the general description
4276
    or
4282
    or
4277
  * +20 = +0x14: db 0
4283
  * +20 = +0x14: db 0
4278
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4284
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4279
Returned value:
4285
Returned value:
4280
  * eax = 0 - success, otherwise file system error code
4286
  * eax = 0 - success, otherwise file system error code
4281
  * ebx destroyed
4287
  * ebx destroyed
4282
Remarks:
4288
Remarks:
4283
  * If the new file size is less than old one, file is truncated.
4289
  * If the new file size is less than old one, file is truncated.
4284
    If the new size is greater than old one, file is expanded with
4290
    If the new size is greater than old one, file is expanded with
4285
    characters with code 0. If the new size is equal to old one,
4291
    characters with code 0. If the new size is equal to old one,
4286
    the only result of call is set date/time of modification and
4292
    the only result of call is set date/time of modification and
4287
    access to the current date/time.
4293
    access to the current date/time.
4288
  * If there is not enough free space on disk for expansion, the
4294
  * If there is not enough free space on disk for expansion, the
4289
    function will expand to maximum possible size and then return
4295
    function will expand to maximum possible size and then return
4290
    error code 8.
4296
    error code 8.
4291
  * The function is not supported for CD (returns error code 2).
4297
  * The function is not supported for CD (returns error code 2).
4292
 
4298
 
4293
======================================================================
4299
======================================================================
4294
==== Function 70, subfunction 5 - get information on file/folder. ====
4300
==== Function 70, subfunction 5 - get information on file/folder. ====
4295
======================================================================
4301
======================================================================
4296
Parameters:
4302
Parameters:
4297
  * eax = 70 - function number
4303
  * eax = 70 - function number
4298
  * ebx = pointer to the information structure
4304
  * ebx = pointer to the information structure
4299
Format of the information structure:
4305
Format of the information structure:
4300
  * +0: dword: 5 = subfunction number
4306
  * +0: dword: 5 = subfunction number
4301
  * +4: dword: 0 (reserved)
4307
  * +4: dword: 0 (reserved)
4302
  * +8: dword: 0 (reserved)
4308
  * +8: dword: 0 (reserved)
4303
  * +12 = +0xC: dword: 0 (reserved)
4309
  * +12 = +0xC: dword: 0 (reserved)
4304
  * +16 = +0x10: dword: pointer to buffer for data (40 bytes)
4310
  * +16 = +0x10: dword: pointer to buffer for data (40 bytes)
4305
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4311
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4306
    given in the general description
4312
    given in the general description
4307
    or
4313
    or
4308
  * +20 = +0x14: db 0
4314
  * +20 = +0x14: db 0
4309
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4315
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4310
Returned value:
4316
Returned value:
4311
  * eax = 0 - success, otherwise file system error code
4317
  * eax = 0 - success, otherwise file system error code
4312
  * ebx destroyed
4318
  * ebx destroyed
4313
Information on file is returned in the BDFE format (block of data
4319
Information on file is returned in the BDFE format (block of data
4314
for folder entry), explained in the description of
4320
for folder entry), explained in the description of
4315
subfunction 1, but without filename
4321
subfunction 1, but without filename
4316
(i.e. only first 40 = 0x28 bytes).
4322
(i.e. only first 40 = 0x28 bytes).
4317
Remarks:
4323
Remarks:
4318
  * The function does not support virtual folders such as /, /rd and
4324
  * The function does not support virtual folders such as /, /rd and
4319
    root folders like /rd/1.
4325
    root folders like /rd/1.
4320
 
4326
 
4321
======================================================================
4327
======================================================================
4322
===== Function 70, subfunction 6 - set attributes of file/folder. ====
4328
===== Function 70, subfunction 6 - set attributes of file/folder. ====
4323
======================================================================
4329
======================================================================
4324
Parameters:
4330
Parameters:
4325
  * eax = 70 - function number
4331
  * eax = 70 - function number
4326
  * ebx = pointer to the information structure
4332
  * ebx = pointer to the information structure
4327
Format of the information structure:
4333
Format of the information structure:
4328
  * +0: dword: 6 = subfunction number
4334
  * +0: dword: 6 = subfunction number
4329
  * +4: dword: 0 (reserved)
4335
  * +4: dword: 0 (reserved)
4330
  * +8: dword: 0 (reserved)
4336
  * +8: dword: 0 (reserved)
4331
  * +12 = +0xC: dword: 0 (reserved)
4337
  * +12 = +0xC: dword: 0 (reserved)
4332
  * +16 = +0x10: dword: pointer to buffer with attributes (32 bytes)
4338
  * +16 = +0x10: dword: pointer to buffer with attributes (32 bytes)
4333
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4339
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4334
    given in the general description
4340
    given in the general description
4335
    or
4341
    or
4336
  * +20 = +0x14: db 0
4342
  * +20 = +0x14: db 0
4337
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4343
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4338
Returned value:
4344
Returned value:
4339
  * eax = 0 - success, otherwise file system error code
4345
  * eax = 0 - success, otherwise file system error code
4340
  * ebx destroyed
4346
  * ebx destroyed
4341
File attributes are first 32 bytes in BDFE (block of data
4347
File attributes are first 32 bytes in BDFE (block of data
4342
for folder entry), explained in the description of subfunction 1
4348
for folder entry), explained in the description of subfunction 1
4343
(that is, without name and size of file). Attribute
4349
(that is, without name and size of file). Attribute
4344
file/folder/volume label (bits 3,4 in dword +0) is not changed.
4350
file/folder/volume label (bits 3,4 in dword +0) is not changed.
4345
Byte +4 (name format) is ignored.
4351
Byte +4 (name format) is ignored.
4346
Remarks:
4352
Remarks:
4347
  * The function does not support virtual folders such as /, /rd and
4353
  * The function does not support virtual folders such as /, /rd and
4348
    root folders like /rd/1.
4354
    root folders like /rd/1.
4349
  * The function is not supported for CD (returns error code 2).
4355
  * The function is not supported for CD (returns error code 2).
4350
 
4356
 
4351
======================================================================
4357
======================================================================
4352
=========== Function 70, subfunction 7 - start application. ==========
4358
=========== Function 70, subfunction 7 - start application. ==========
4353
======================================================================
4359
======================================================================
4354
Parameters:
4360
Parameters:
4355
  * eax = 70 - function number
4361
  * eax = 70 - function number
4356
  * ebx = pointer to the information structure
4362
  * ebx = pointer to the information structure
4357
Format of the information structure:
4363
Format of the information structure:
4358
  * +0: dword: 7 = subfunction number
4364
  * +0: dword: 7 = subfunction number
4359
  * +4: dword: flags field:
4365
  * +4: dword: flags field:
4360
    * áèò 0: start process as debugged
4366
    * áèò 0: start process as debugged
4361
    * other bits are reserved and must be set to 0
4367
    * other bits are reserved and must be set to 0
4362
  * +8: dword: 0 or pointer to ASCIIZ-string with parameters
4368
  * +8: dword: 0 or pointer to ASCIIZ-string with parameters
4363
  * +12 = +0xC: dword: 0 (reserved)
4369
  * +12 = +0xC: dword: 0 (reserved)
4364
  * +16 = +0x10: dword: 0 (reserved)
4370
  * +16 = +0x10: dword: 0 (reserved)
4365
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4371
  * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are
4366
    given in the general description
4372
    given in the general description
4367
    or
4373
    or
4368
  * +20 = +0x14: db 0
4374
  * +20 = +0x14: db 0
4369
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4375
  * +21 = +0x15: dd pointer to ASCIIZ-string with file name
4370
Returned value:
4376
Returned value:
4371
  * eax > 0 - program is loaded, eax contains PID
4377
  * eax > 0 - program is loaded, eax contains PID
4372
  * eax < 0 - an error has occured, -eax contains
4378
  * eax < 0 - an error has occured, -eax contains
4373
    file system error code
4379
    file system error code
4374
  * ebx destroyed
4380
  * ebx destroyed
4375
Remarks:
4381
Remarks:
4376
  * Command line must be terminated by the character with the code 0
4382
  * Command line must be terminated by the character with the code 0
4377
    (ASCIIZ-string); function takes into account either all characters
4383
    (ASCIIZ-string); function takes into account either all characters
4378
    up to terminating zero inclusively or first 256 character
4384
    up to terminating zero inclusively or first 256 character
4379
    regarding what is less.
4385
    regarding what is less.
4380
  * If the process is started as debugged, it is created in
4386
  * If the process is started as debugged, it is created in
4381
    the suspended state; to run use subfunction 5 of function 69.
4387
    the suspended state; to run use subfunction 5 of function 69.
4382
 
4388
 
4383
======================================================================
4389
======================================================================
4384
========== Function 71, subfunction 1 - set window caption. ==========
4390
========== Function 71, subfunction 1 - set window caption. ==========
4385
======================================================================
4391
======================================================================
4386
Parameters:
4392
Parameters:
4387
  * eax = 71 - function number
4393
  * eax = 71 - function number
4388
  * ebx = 1 - subfunction number
4394
  * ebx = 1 - subfunction number
4389
  * ecx = pointer to caption string
4395
  * ecx = pointer to caption string
4390
Returned value:
4396
Returned value:
4391
  * function does not return value
4397
  * function does not return value
4392
Remarks:
4398
Remarks:
4393
  * String must be in the ASCIIZ-format. Disregarding real string
4399
  * String must be in the ASCIIZ-format. Disregarding real string
4394
    length, no more than 255 characters are drawn.
4400
    length, no more than 255 characters are drawn.
4395
  * Pass NULL in ecx to remove caption.
4401
  * Pass NULL in ecx to remove caption.
4396
 
4402
 
4397
======================================================================
4403
======================================================================
4398
=============== Function -1 - terminate thread/process ===============
4404
=============== Function -1 - terminate thread/process ===============
4399
======================================================================
4405
======================================================================
4400
Parameters:
4406
Parameters:
4401
  * eax = -1 - function number
4407
  * eax = -1 - function number
4402
Returned value:
4408
Returned value:
4403
  * function does not return neither value nor control
4409
  * function does not return neither value nor control
4404
Remarks:
4410
Remarks:
4405
  * If the process did not create threads obviously, it has only
4411
  * If the process did not create threads obviously, it has only
4406
    one thread, which termination results in process termination.
4412
    one thread, which termination results in process termination.
4407
  * If the current thread is last in the process, its termination
4413
  * If the current thread is last in the process, its termination
4408
    also results in process terminates.
4414
    also results in process terminates.
4409
  * This function terminates the current thread. Other thread can be
4415
  * This function terminates the current thread. Other thread can be
4410
    killed by call to subfunction 2 of function 18.
4416
    killed by call to subfunction 2 of function 18.
4411
 
4417
 
4412
======================================================================
4418
======================================================================
4413
=========================== List of events ===========================
4419
=========================== List of events ===========================
4414
======================================================================
4420
======================================================================
4415
Next event can be retrieved by the call of one from functions 10
4421
Next event can be retrieved by the call of one from functions 10
4416
(to wait for event), 11 (to check without waiting), 23
4422
(to wait for event), 11 (to check without waiting), 23
4417
(to wait during the given time).
4423
(to wait during the given time).
4418
These functions return only those events, which enter into a mask set
4424
These functions return only those events, which enter into a mask set
4419
by function 40. By default it is first three,
4425
by function 40. By default it is first three,
4420
there is enough for most applications.
4426
there is enough for most applications.
4421
Codes of events:
4427
Codes of events:
4422
  * 1 = redraw event (is reset by call to function 0)
4428
  * 1 = redraw event (is reset by call to function 0)
4423
  * 2 = key on keyboard is pressed (acts, only when the window is
4429
  * 2 = key on keyboard is pressed (acts, only when the window is
4424
    active) or hotkey is pressed; is reset, when all keys from
4430
    active) or hotkey is pressed; is reset, when all keys from
4425
    the buffer are read out by function 2
4431
    the buffer are read out by function 2
4426
  * 3 = button is pressed, defined earlier by function 8
4432
  * 3 = button is pressed, defined earlier by function 8
4427
    (or close button, created implicitly by function 0;
4433
    (or close button, created implicitly by function 0;
4428
    minimize button is handled by the system and sends no message;
4434
    minimize button is handled by the system and sends no message;
4429
    acts, only when the window is active;
4435
    acts, only when the window is active;
4430
    is reset when all buttons from the buffer
4436
    is reset when all buttons from the buffer
4431
    are read out by function 17)
4437
    are read out by function 17)
4432
  * 4 = reserved (in current implementation never comes even after
4438
  * 4 = reserved (in current implementation never comes even after
4433
    unmasking by function 40)
4439
    unmasking by function 40)
4434
  * 5 = the desktop background is redrawed (is reset automatically
4440
  * 5 = the desktop background is redrawed (is reset automatically
4435
    after redraw, so if in redraw time program does not wait and
4441
    after redraw, so if in redraw time program does not wait and
4436
    does not check events, it will not remark this event)
4442
    does not check events, it will not remark this event)
4437
  * 6 = mouse event (something happened - button pressing or moving;
4443
  * 6 = mouse event (something happened - button pressing or moving;
4438
    is reset at reading)
4444
    is reset at reading)
4439
  * 7 = IPC event (see function 60 -
4445
  * 7 = IPC event (see function 60 -
4440
    Inter Process Communication; is reset at reading)
4446
    Inter Process Communication; is reset at reading)
4441
  * 8 = network event (is reset at reading)
4447
  * 8 = network event (is reset at reading)
4442
  * 9 = debug event (is reset at reading; see
4448
  * 9 = debug event (is reset at reading; see
4443
    debug subsystem)
4449
    debug subsystem)
4444
  * 16..31 = event with appropriate IRQ
4450
  * 16..31 = event with appropriate IRQ
4445
    (16=IRQ0, 31=IRQ15) (is reset after reading all IRQ data)
4451
    (16=IRQ0, 31=IRQ15) (is reset after reading all IRQ data)
4446
 
4452
 
4447
======================================================================
4453
======================================================================
4448
=================== Error codes of the file system ===================
4454
=================== Error codes of the file system ===================
4449
======================================================================
4455
======================================================================
4450
  * 0 = success
4456
  * 0 = success
4451
  * 1 = base and/or partition of a hard disk is not defined
4457
  * 1 = base and/or partition of a hard disk is not defined
4452
    (by subfunctions 7, 8 of function 21)
4458
    (by subfunctions 7, 8 of function 21)
4453
  * 2 = function is not supported for the given file system
4459
  * 2 = function is not supported for the given file system
4454
  * 3 = unknown file system
4460
  * 3 = unknown file system
4455
  * 4 = is returned only from function 'rename' by transmission of
4461
  * 4 = is returned only from function 'rename' by transmission of
4456
    the strongly incorrect parameter and in any way does not
4462
    the strongly incorrect parameter and in any way does not
4457
    correspond to the description in the kernel sources
4463
    correspond to the description in the kernel sources
4458
    "partition not defined at hd"
4464
    "partition not defined at hd"
4459
  * 5 = file not found
4465
  * 5 = file not found
4460
  * 6 = end of file, EOF
4466
  * 6 = end of file, EOF
4461
  * 7 = pointer lies outside of application memory
4467
  * 7 = pointer lies outside of application memory
4462
  * 8 = disk is full
4468
  * 8 = disk is full
4463
  * 9 = FAT table is destroyed
4469
  * 9 = FAT table is destroyed
4464
  * 10 = access denied
4470
  * 10 = access denied
4465
  * 11 = device error
4471
  * 11 = device error
4466
Application start functions can return also following errors:
4472
Application start functions can return also following errors:
4467
  * 30 = 0x1E = not enough memory
4473
  * 30 = 0x1E = not enough memory
4468
  * 31 = 0x1F = file is not executable
4474
  * 31 = 0x1F = file is not executable
4469
  * 32 = 0x20 = too many processes
4475
  * 32 = 0x20 = too many processes
4470
>
4476
>
4471
>
4477
>
4472
>
4478
>
4473
>
4479
>
4474
>
4480
>