Rev 2410 | Rev 2455 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1662 | Nasarus | 1 | SYSTEM FUNCTIONS of OS Kolibri 0.7.7.0 |
114 | mikedld | 2 | |
3 | Number of the function is located in the register eax. |
||
118 | diamond | 4 | The call of the system function is executed by "int 0x40" command. |
5 | All registers except explicitly declared in the returned value, |
||
6 | including eflags, are preserved. |
||
114 | mikedld | 7 | |
8 | |||
9 | ====================================================================== |
||
10 | ============== Function 0 - define and draw the window. ============== |
||
11 | ====================================================================== |
||
12 | Defines an application window. Draws a frame of the window, header and |
||
133 | diamond | 13 | working area. For skinned windows defines standard close and minimize |
14 | buttons. |
||
114 | mikedld | 15 | Parameters: |
118 | diamond | 16 | * eax = 0 - function number |
114 | mikedld | 17 | * ebx = [coordinate on axis x]*65536 + [size on axis x] |
18 | * ecx = [coordinate on axis y]*65536 + [size on axis y] |
||
19 | * edx = 0xXYRRGGBB, where: |
||
20 | * Y = style of the window: |
||
131 | diamond | 21 | * Y=0 - type I - fixed-size window |
118 | diamond | 22 | * Y=1 - only define window area, draw nothing |
131 | diamond | 23 | * Y=2 - type II - variable-size window |
24 | * Y=3 - skinned window |
||
641 | diamond | 25 | * Y=4 - skinned fixed-size window |
26 | * other possible values (from 5 up to 15) are reserved, |
||
114 | mikedld | 27 | function call with such Y is ignored |
118 | diamond | 28 | * RR, GG, BB = accordingly red, green, blue components of a color |
29 | of the working area of the window (are ignored for style Y=2) |
||
114 | mikedld | 30 | * X = DCBA (bits) |
641 | diamond | 31 | * A = 1 - window has caption; for styles Y=3,4 caption string |
118 | diamond | 32 | must be passed in edi, for other styles use |
33 | subfunction 1 of function 71 |
||
34 | * B = 1 - coordinates of all graphics primitives are relative to |
||
35 | window client area |
||
303 | mikedld | 36 | * C = 1 - don't fill working area on window draw |
118 | diamond | 37 | * D = 0 - normal filling of the working area, 1 - gradient |
38 | The following parameters are intended for windows |
||
39 | of a type I and II, and ignored for styles Y=1,3: |
||
40 | * esi = 0xXYRRGGBB - color of the header |
||
41 | * RR, GG, BB define color |
||
114 | mikedld | 42 | * Y=0 - usual window, Y=1 - unmovable window |
118 | diamond | 43 | * X defines a gradient of header: X=0 - no gradient, |
114 | mikedld | 44 | X=8 - usual gradient, |
45 | for windows of a type II X=4 - negative gradient |
||
118 | diamond | 46 | * other values of X and Y are reserved |
47 | * edi = 0x00RRGGBB - color of the frame |
||
114 | mikedld | 48 | Returned value: |
49 | * function does not return value |
||
50 | Remarks: |
||
118 | diamond | 51 | * Position and sizes of the window are installed by the first |
52 | call of this function and are ignored at subsequent; to change |
||
53 | position and/or sizes of already created window use function 67. |
||
641 | diamond | 54 | * For windows with styles Y=3,4 and caption (A=1) caption string |
55 | is set by the first call of this function and is ignored |
||
56 | at subsequent (strictly speaking, is ignored after a call to |
||
57 | subfunction 2 of function 12 - end redraw); to change caption of |
||
58 | already created window use subfunction 1 of function 71. |
||
118 | diamond | 59 | * If the window has appropriate styles, position and/or sizes can be |
60 | changed by user. Current position and sizes can be obtained |
||
61 | by function 9. |
||
62 | * The window must fit on the screen. If the transferred |
||
63 | coordinates and sizes do not satisfy to this condition, |
||
64 | appropriate coordinate (or, probably, both) is considered as zero, |
||
131 | diamond | 65 | and if it does not help too, the appropriate size |
118 | diamond | 66 | (or, probably, both) is installed in a size of the screen. |
2409 | Serge | 67 | |
131 | diamond | 68 | Further let us designate xpos,ypos,xsize,ysize - values passed |
69 | in ebx,ecx. The coordinates are resulted concerning |
||
118 | diamond | 70 | the left upper corner of the window, which, thus, is set as (0,0), |
71 | coordinates of the right lower corner essence (xsize,ysize). |
||
72 | * The sizes of the window are understood in sence of coordinates |
||
73 | of the right lower corner. This concerns all other functions too. |
||
74 | It means, that the real sizes are on 1 pixel more. |
||
75 | * The window of type I looks as follows: |
||
76 | * draw external frame of color indicated in edi, 1 pixel in width |
||
77 | * draw header - rectangle with the left upper corner (1,1) and |
||
78 | right lower (xsize-1,min(25,ysize)) color indicated in esi |
||
79 | (taking a gradient into account) |
||
80 | * if ysize>=26, fill the working area of the window - |
||
81 | rectangle with the left upper corner (1,21) and right lower |
||
82 | (xsize-1,ysize-1) (sizes (xsize-1)*(ysize-21)) with color |
||
83 | indicated in edx (taking a gradient into account) |
||
84 | * if A=1 and caption has been already set by subfunction 1 |
||
85 | of function 71, it is drawn in the corresponding place of header |
||
86 | * The window of style Y=1 looks as follows: |
||
114 | mikedld | 87 | * completely defined by the application |
118 | diamond | 88 | * The window of type II looks as follows: |
89 | * draw external frame of width 1 pixel with the "shaded" color |
||
90 | edi (all components of the color decrease twice) |
||
91 | * draw intermediate frame of width 3 pixels with color edi |
||
92 | * draw internal frame of width 1 pixel with the "shaded" color edi |
||
114 | mikedld | 93 | * draw header - rectangle with the left upper corner (4,4) |
118 | diamond | 94 | and right lower (xsize-4,min(20,ysize)) color, indicated in esi |
95 | (taking a gradient into account) |
||
96 | * if ysize>=26, fill the working area of the window - |
||
114 | mikedld | 97 | rectangle with the left upper corner (5,20) and right lower |
118 | diamond | 98 | (xsize-5,ysize-5) with color indicated in edx |
99 | (taking a gradient into account) |
||
100 | * if A=1 and caption has been already set by subfunction 1 |
||
101 | of function 71, it is drawn in the corresponding place of header |
||
102 | * The skinned window looks as follows: |
||
114 | mikedld | 103 | * draw external frame of width 1 pixel |
118 | diamond | 104 | with color 'outer' from the skin |
105 | * draw intermediate frame of width 3 pixel |
||
106 | with color 'frame' from the skin |
||
107 | * draw internal frame of width 1 pixel |
||
108 | with color 'inner' from the skin |
||
109 | * draw header (on bitmaps from the skin) in a rectangle |
||
114 | mikedld | 110 | (0,0) - (xsize,_skinh-1) |
118 | diamond | 111 | * if ysize>=26, fill the working area of the window - |
112 | rectangle with the left upper corner (5,_skinh) and right lower |
||
113 | (xsize-5,ysize-5) with color indicated in edx |
||
114 | (taking a gradient into account) |
||
133 | diamond | 115 | * define two standard buttons: close and minimize |
114 | mikedld | 116 | (see function 8) |
118 | diamond | 117 | * if A=1 and edi contains (nonzero) pointer to caption string, |
118 | it is drawn in place in header defined in the skin |
||
119 | * value _skinh is accessible as the result of call |
||
120 | subfunction 4 of function 48 |
||
114 | mikedld | 121 | |
122 | ====================================================================== |
||
118 | diamond | 123 | ================ Function 1 - put pixel in the window. =============== |
114 | mikedld | 124 | ====================================================================== |
125 | Parameters: |
||
118 | diamond | 126 | * eax = 1 - function number |
127 | * ebx = x-coordinate (relative to the window) |
||
128 | * ecx = y-coordinate (relative to the window) |
||
129 | * edx = 0x00RRGGBB - color of a pixel |
||
130 | edx = 0x01xxxxxx - invert color of a pixel |
||
131 | (low 24 bits are ignored) |
||
114 | mikedld | 132 | Returned value: |
133 | * function does not return value |
||
134 | |||
135 | ====================================================================== |
||
118 | diamond | 136 | ============ Function 2 - get the code of the pressed key. =========== |
114 | mikedld | 137 | ====================================================================== |
138 | Takes away the code of the pressed key from the buffer. |
||
139 | Parameters: |
||
118 | diamond | 140 | * eax = 2 - function number |
114 | mikedld | 141 | Returned value: |
118 | diamond | 142 | * if the buffer is empty, function returns eax=1 |
143 | * if the buffer is not empty, function returns al=0, |
||
144 | ah=code of the pressed key, high word of eax is zero |
||
145 | * if there is "hotkey", function returns al=2, |
||
146 | ah=scancode of the pressed key (0 for control keys), |
||
147 | high word of eax contains a status of control keys at the moment |
||
148 | of pressing a hotkey |
||
114 | mikedld | 149 | Remarks: |
118 | diamond | 150 | * There is a common system buffer of the pressed keys |
151 | by a size of 120 bytes, organized as queue. |
||
152 | * There is one more common system buffer on 120 "hotkeys". |
||
153 | * If the application with the inactive window calls this function, |
||
154 | the buffer of the pressed keys is considered to be empty. |
||
155 | * By default this function returns ASCII-codes; to switch |
||
156 | to the scancodes mode (and back) use function 66. |
||
157 | However, hotkeys are always notificated as scancodes. |
||
158 | * To find out, what keys correspond to what codes, start |
||
159 | the application keyascii and scancode. |
||
160 | * Scancodes come directly from keyboard and are fixed; |
||
161 | ASCII-codes turn out with usage of the conversion tables, |
||
162 | which can be set by subfunction 2 of function 21 |
||
163 | and get by subfunction 2 of function 26. |
||
164 | * As a consequence, ASCII-codes take into account current |
||
165 | keyboard layout (rus/en) as opposed to scancodes. |
||
166 | * This function notifies only about those hotkeys, which were |
||
167 | defined by this thread by subfunction 4 of function 66. |
||
114 | mikedld | 168 | |
169 | ====================================================================== |
||
118 | diamond | 170 | ==================== Function 3 - get system time. =================== |
114 | mikedld | 171 | ====================================================================== |
172 | Parameters: |
||
118 | diamond | 173 | * eax = 3 - function number |
114 | mikedld | 174 | Returned value: |
175 | * eax = 0x00SSMMHH, where HH:MM:SS = Hours:Minutes:Seconds |
||
118 | diamond | 176 | * each item is BCD-number, for example, |
177 | for time 23:59:59 function returns 0x00595923 |
||
114 | mikedld | 178 | Remarks: |
118 | diamond | 179 | * See also subfunction 9 of function 26 - get time from |
180 | the moment of start of the system; it is more convenient, because |
||
181 | returns simply DWORD-value of the time counter. |
||
182 | * System time can be set by function 22. |
||
114 | mikedld | 183 | |
184 | ====================================================================== |
||
118 | diamond | 185 | ============ Function 4 - draw text string in the window. ============ |
114 | mikedld | 186 | ====================================================================== |
187 | Parameters: |
||
118 | diamond | 188 | * eax = 4 - function number |
114 | mikedld | 189 | * ebx = [coordinate on axis x]*65536 + [coordinate on axis y] |
190 | * ecx = 0xX0RRGGBB, where |
||
118 | diamond | 191 | * RR, GG, BB specify text color |
139 | diamond | 192 | * X=ABnn (bits): |
185 | heavyiron | 193 | * nn specifies the used font: 0=system monospaced, |
194 | 1=system font of variable width |
||
139 | diamond | 195 | * A=0 - output esi characters, A=1 - output ASCIIZ-string |
196 | * B=1 - fill background with the color edi |
||
118 | diamond | 197 | * edx = pointer to the beginning of the string |
139 | diamond | 198 | * esi = for A=0 length of the string, must not exceed 255; |
199 | for A=1 is ignored |
||
114 | mikedld | 200 | Returned value: |
201 | * function does not return value |
||
202 | Remarks: |
||
118 | diamond | 203 | * First system font is read out at loading from the file char.mt, |
204 | second - from char2.mt. |
||
205 | * Both fonts have height 9 pixels, width of the monospaced font |
||
206 | is equal to 6 pixels. |
||
114 | mikedld | 207 | |
208 | ====================================================================== |
||
118 | diamond | 209 | ========================= Function 5 - delay. ======================== |
114 | mikedld | 210 | ====================================================================== |
211 | Delays execution of the program on the given time. |
||
212 | Parameters: |
||
118 | diamond | 213 | * eax = 5 - function number |
114 | mikedld | 214 | * ebx = time in the 1/100 of second |
215 | Returned value: |
||
216 | * function does not return value |
||
217 | Remarks: |
||
118 | diamond | 218 | * Passing ebx=0 does not transfer control to the next process |
219 | and does not make any operations at all. If it is really required |
||
220 | to transfer control to the next process (to complete a current |
||
221 | time slice), use subfunction 1 of function 68. |
||
114 | mikedld | 222 | |
223 | ====================================================================== |
||
118 | diamond | 224 | ============== Function 6 - read the file from ramdisk. ============== |
114 | mikedld | 225 | ====================================================================== |
226 | Parameters: |
||
118 | diamond | 227 | * eax = 6 - function number |
228 | * ebx = pointer to the filename |
||
229 | * ecx = number of start block, beginning from 1; |
||
230 | ecx=0 - read from the beginning of the file (same as ecx=1) |
||
231 | * edx = number of blocks to read; |
||
232 | edx=0 - read one block (same as edx=1) |
||
233 | * esi = pointer to memory area for the data |
||
114 | mikedld | 234 | Returned value: |
118 | diamond | 235 | * eax = file size in bytes, if the file was successfully read |
236 | * eax = -1, if the file was not found |
||
114 | mikedld | 237 | Remarks: |
118 | diamond | 238 | * This function is out-of-date; function 70 allows |
239 | to fulfil the same operations with the extended possibilities. |
||
114 | mikedld | 240 | * Block = 512 bytes. |
118 | diamond | 241 | * For reading all file you can specify the certainly large value |
242 | in edx, for example, edx = -1; but in this case be ready that |
||
243 | the program will "fall", if the file will appear too large and can |
||
244 | not be placed in the program memory. |
||
245 | * The filename must be either in the format 8+3 characters |
||
246 | (first 8 characters - name itself, last 3 - extension, |
||
247 | the short names and extensions are supplemented with spaces), |
||
248 | or in the format 8.3 characters "FILE.EXT"/"FILE.EX " |
||
249 | (name no more than 8 characters, dot, extension 3 characters |
||
250 | supplemented if necessary by spaces). |
||
251 | The filename must be written with capital letters. The terminating |
||
252 | character with code 0 is not necessary (not ASCIIZ-string). |
||
253 | * This function does not support folders on the ramdisk. |
||
114 | mikedld | 254 | |
255 | ====================================================================== |
||
256 | =============== Function 7 - draw image in the window. =============== |
||
257 | ====================================================================== |
||
118 | diamond | 258 | Paramters: |
259 | * eax = 7 - function number |
||
260 | * ebx = pointer to the image in the format BBGGRRBBGGRR... |
||
114 | mikedld | 261 | * ecx = [size on axis x]*65536 + [size on axis y] |
262 | * edx = [coordinate on axis x]*65536 + [coordinate on axis y] |
||
263 | Returned value: |
||
264 | * function does not return value |
||
265 | Remarks: |
||
118 | diamond | 266 | * Coordinates of the image are coordinates of the upper left corner |
267 | of the image relative to the window. |
||
114 | mikedld | 268 | * Size of the image in bytes is 3*xsize*ysize. |
269 | |||
270 | ====================================================================== |
||
271 | =============== Function 8 - define/delete the button. =============== |
||
272 | ====================================================================== |
||
118 | diamond | 273 | Parameters for button definition: |
274 | * eax = 8 - function number |
||
114 | mikedld | 275 | * ebx = [coordinate on axis x]*65536 + [size on axis x] |
276 | * ecx = [coordinate on axis y]*65536 + [size on axis y] |
||
277 | * edx = 0xXYnnnnnn, where: |
||
278 | * nnnnnn = identifier of the button |
||
118 | diamond | 279 | * high (31st) bit of edx is cleared |
280 | * if 30th bit of edx is set - do not draw the button |
||
281 | * if 29th bit of edx is set - do not draw a frame |
||
114 | mikedld | 282 | at pressing the button |
118 | diamond | 283 | * esi = 0x00RRGGBB - color of the button |
284 | Parameters for button deleting: |
||
285 | * eax = 8 - function number |
||
114 | mikedld | 286 | * edx = 0x80nnnnnn, where nnnnnn - identifier of the button |
287 | Returned value: |
||
288 | * function does not return value |
||
289 | Remarks: |
||
118 | diamond | 290 | * Sizes of the button must be more than 0 and less than 0x8000. |
131 | diamond | 291 | * For skinned windows definition of the window |
118 | diamond | 292 | (call of 0th function) creates two standard buttons - |
293 | for close of the window with identifier 1 and |
||
294 | for minimize of the window with identifier 0xffff. |
||
295 | * The creation of two buttons with same identifiers is admitted. |
||
296 | * The button with the identifier 0xffff at pressing is interpreted |
||
297 | by the system as the button of minimization, the system handles |
||
298 | such pressing independently, not accessing to the application. |
||
299 | In rest it is usual button. |
||
300 | * Total number of buttons for all applications is limited to 4095. |
||
114 | mikedld | 301 | |
302 | ====================================================================== |
||
118 | diamond | 303 | ============ Function 9 - information on execution thread. =========== |
114 | mikedld | 304 | ====================================================================== |
305 | Parameters: |
||
118 | diamond | 306 | * eax = 9 - function number |
307 | * ebx = pointer to 1-Kb buffer |
||
308 | * ecx = number of the slot of the thread |
||
309 | ecx = -1 - get information on the current thread |
||
114 | mikedld | 310 | Returned value: |
118 | diamond | 311 | * eax = maximum number of the slot of a thread |
312 | * buffer pointed to by ebx contains the following information: |
||
313 | * +0: dword: usage of the processor (how many time units |
||
314 | per second leaves on execution of this thread) |
||
114 | mikedld | 315 | * +4: word: position of the window of thread in the window stack |
118 | diamond | 316 | * +6: word: (has no relation to the specified thread) |
317 | number of the thread slot, which window has in the window stack |
||
318 | position ecx |
||
114 | mikedld | 319 | * +8: word: reserved |
320 | * +10 = +0xA: 11 bytes: name of the process |
||
118 | diamond | 321 | (name of corresponding executable file in the format 8+3) |
142 | diamond | 322 | * +21 = +0x15: byte: reserved, this byte is not changed |
114 | mikedld | 323 | * +22 = +0x16: dword: address of the process in memory |
324 | * +26 = +0x1A: dword: size of used memory - 1 |
||
325 | * +30 = +0x1E: dword: identifier (PID/TID) |
||
118 | diamond | 326 | * +34 = +0x22: dword: coordinate of the thread window on axis x |
327 | * +38 = +0x26: dword: coordinate of the thread window on axis y |
||
328 | * +42 = +0x2A: dword: size of the thread window on axis x |
||
329 | * +46 = +0x2E: dword: size of the thread window on axis y |
||
330 | * +50 = +0x32: word: status of the thread slot: |
||
331 | * 0 = thread is running |
||
332 | * 1 = thread is suspended |
||
333 | * 2 = thread is suspended while waiting for event |
||
334 | * 3 = thread is terminating as a result of call to function -1 |
||
335 | or under duress as a result of call to subfunction 2 |
||
336 | of function 18 or termination of the system |
||
337 | * 4 = thread is terminating as a result of exception |
||
338 | * 5 = thread waits for event |
||
339 | * 9 = requested slot is free, all other information on the slot |
||
340 | is not meaningful |
||
142 | diamond | 341 | * +52 = +0x34: word: reserved, this word is not changed |
342 | * +54 = +0x36: dword: coordinate of the client area on axis x |
||
343 | * +58 = +0x3A: dword: coordinate of the client area on axis y |
||
344 | * +62 = +0x3E: dword: width of the client area |
||
345 | * +66 = +0x42: dword: height of the client area |
||
346 | * +70 = +0x46: byte: state of the window - bitfield |
||
347 | * bit 0 (mask 1): window is maximized |
||
348 | * bit 1 (mask 2): window is minimized to panel |
||
349 | * bit 2 (mask 4): window is rolled up |
||
1663 | Nasarus | 350 | * +71 = +0x47: dword: event mask |
114 | mikedld | 351 | Remarks: |
118 | diamond | 352 | * Slots are numbered starting from 1. |
353 | * Returned value is not a total number of threads, because there |
||
354 | can be free slots. |
||
355 | * When process is starting, system automatically creates |
||
356 | execution thread. |
||
357 | * Function gives information on the thread. Each process has |
||
358 | at least one thread. One process can create many threads, |
||
359 | in this case each thread has its own slot and the fields |
||
360 | +10, +22, +26 in these slots coincide. |
||
361 | Applications have no common way to define whether two threads |
||
114 | mikedld | 362 | belong to one process. |
118 | diamond | 363 | * The active window - window on top of the window stack - |
364 | receives the messages on a keyboard input. For such window |
||
365 | the position in the window stack coincides with returned value. |
||
366 | * Slot 1 corresponds to special system thread, for which: |
||
367 | * the window is in the bottom of the window stack, the fields |
||
368 | +4 and +6 contain value 1 |
||
369 | * name of the process - "OS/IDLE" (supplemented by spaces) |
||
370 | * address of the process in memory is 0, size of used memory is |
||
114 | mikedld | 371 | 16 Mb (0x1000000) |
372 | * PID=1 |
||
142 | diamond | 373 | * coordinates and sizes of the window and the client area are by |
374 | convention set to 0 |
||
118 | diamond | 375 | * status of the slot is always 0 (running) |
376 | * the execution time adds of time leaving on operations itself |
||
377 | and idle time in waiting for interrupt (which can be got by call |
||
378 | to subfunction 4 of function 18). |
||
379 | * Beginning from slot 2, the normal applications are placed. |
||
1662 | Nasarus | 380 | * The normal applications are placed in memory at the address |
381 | |||
118 | diamond | 382 | There is no intersection, as each process has its own page table. |
383 | * At creation of the thread it is assigned the slot |
||
384 | in the system table and identifier (Process/Thread IDentifier = |
||
385 | PID/TID), which do not vary with time for given thread. |
||
386 | After completion of the thread its slot can be anew used |
||
387 | for another thread. The thread identifier can not be assigned |
||
388 | to other thread even after completion of this thread. |
||
389 | Identifiers, assigned to new threads, grow monotonously. |
||
390 | * If the thread has not yet defined the window by call to |
||
391 | function 0, the position and the sizes |
||
392 | of its window are considered to be zero. |
||
142 | diamond | 393 | * Coordinates of the client area are relative to the window. |
118 | diamond | 394 | * At the moment only the part of the buffer by a size |
142 | diamond | 395 | 71 = 0x37 bytes is used. Nevertheless it is recommended to use |
118 | diamond | 396 | 1-Kb buffer for the future compatibility, in the future |
397 | some fields can be added. |
||
114 | mikedld | 398 | |
399 | ====================================================================== |
||
118 | diamond | 400 | ==================== Function 10 - wait for event. =================== |
114 | mikedld | 401 | ====================================================================== |
118 | diamond | 402 | If the message queue is empty, waits for appearance of the message |
403 | in queue. In this state thread does not consume CPU time. |
||
114 | mikedld | 404 | Then reads out the message from queue. |
405 | |||
406 | Parameters: |
||
118 | diamond | 407 | * eax = 10 - function number |
114 | mikedld | 408 | Returned value: |
118 | diamond | 409 | * eax = event (see the list of events) |
114 | mikedld | 410 | Remarks: |
118 | diamond | 411 | * Those events are taken into account only which enter into |
412 | a mask set by function 40. By default it is |
||
413 | redraw, key and button events. |
||
414 | * To check, whether there is a message in queue, use function 11. |
||
415 | To wait for no more than given time, use function 23. |
||
114 | mikedld | 416 | |
118 | diamond | 417 | ====================================================================== |
418 | =============== Function 11 - check for event, no wait. ============== |
||
419 | ====================================================================== |
||
420 | If the message queue contains event, function reads out |
||
421 | and return it. If the queue is empty, function returns 0. |
||
114 | mikedld | 422 | Parameters: |
118 | diamond | 423 | * eax = 11 - function number |
114 | mikedld | 424 | Returned value: |
425 | * eax = 0 - message queue is empty |
||
118 | diamond | 426 | * else eax = event (see the list of events) |
114 | mikedld | 427 | Remarks: |
118 | diamond | 428 | * Those events are taken into account only, which enter into |
429 | a mask set by function 40. By default it is |
||
430 | redraw, key and button events. |
||
431 | * To wait for event, use function 10. |
||
432 | To wait for no more than given time, use function 23. |
||
114 | mikedld | 433 | |
434 | ====================================================================== |
||
118 | diamond | 435 | =============== Function 12 - begin/end window redraw. =============== |
114 | mikedld | 436 | ====================================================================== |
437 | |||
139 | diamond | 438 | ---------------- Subfunction 1 - begin window redraw. ---------------- |
114 | mikedld | 439 | Parameters: |
118 | diamond | 440 | * eax = 12 - function number |
441 | * ebx = 1 - subfunction number |
||
114 | mikedld | 442 | Returned value: |
443 | * function does not return value |
||
444 | |||
139 | diamond | 445 | ----------------- Subfunction 2 - end window redraw. ----------------- |
114 | mikedld | 446 | Parameters: |
118 | diamond | 447 | * eax = 12 - function number |
448 | * ebx = 2 - subfunction number |
||
114 | mikedld | 449 | Returned value: |
450 | * function does not return value |
||
451 | Remarks: |
||
118 | diamond | 452 | * Subfunction 1 deletes all buttons defined with |
453 | function 8, they must be defined again. |
||
114 | mikedld | 454 | |
455 | ====================================================================== |
||
456 | ============ Function 13 - draw a rectangle in the window. =========== |
||
457 | ====================================================================== |
||
458 | Parameters: |
||
118 | diamond | 459 | * eax = 13 - function number |
114 | mikedld | 460 | * ebx = [coordinate on axis x]*65536 + [size on axis x] |
461 | * ecx = [coordinate on axis y]*65536 + [size on axis y] |
||
118 | diamond | 462 | * edx = color 0xRRGGBB or 0x80RRGGBB for gradient fill |
114 | mikedld | 463 | Returned value: |
464 | * function does not return value |
||
465 | Remarks: |
||
466 | * Coordinates are understood as coordinates of the left upper corner |
||
118 | diamond | 467 | of a rectangle relative to the window. |
114 | mikedld | 468 | |
469 | ====================================================================== |
||
118 | diamond | 470 | =================== Function 14 - get screen size. =================== |
114 | mikedld | 471 | ====================================================================== |
472 | Parameters: |
||
118 | diamond | 473 | * eax = 14 - function number |
114 | mikedld | 474 | Returned value: |
475 | * eax = [xsize]*65536 + [ysize], where |
||
476 | * xsize = x-coordinate of the right lower corner of the screen = |
||
118 | diamond | 477 | horizontal size - 1 |
114 | mikedld | 478 | * ysize = y-coordinate of the right lower corner of the screen = |
118 | diamond | 479 | vertical size - 1 |
114 | mikedld | 480 | Remarks: |
118 | diamond | 481 | * See also subfunction 5 of function 48 - get sizes of |
482 | working area of the screen. |
||
114 | mikedld | 483 | |
118 | diamond | 484 | ====================================================================== |
485 | == Function 15, subfunction 1 - set a size of the background image. == |
||
486 | ====================================================================== |
||
114 | mikedld | 487 | Parameters: |
118 | diamond | 488 | * eax = 15 - function number |
489 | * ebx = 1 - subfunction number |
||
114 | mikedld | 490 | * ecx = width of the image |
491 | * edx = height of the image |
||
492 | Returned value: |
||
493 | * function does not return value |
||
494 | Remarks: |
||
499 | diamond | 495 | * Before calling subfunctions 2 and 5 you should call this function |
485 | heavyiron | 496 | to set image size! |
118 | diamond | 497 | * For update of the screen (after completion of a series of commands |
498 | working with a background) call subfunction 3. |
||
499 | * There is a pair function for get size of the background image - |
||
500 | subfunction 1 of function 39. |
||
114 | mikedld | 501 | |
502 | ====================================================================== |
||
118 | diamond | 503 | === Function 15, subfunction 2 - put pixel on the background image. == |
114 | mikedld | 504 | ====================================================================== |
505 | Parameters: |
||
118 | diamond | 506 | * eax = 15 - function number |
507 | * ebx = 2 - subfunction number |
||
114 | mikedld | 508 | * ecx = offset |
118 | diamond | 509 | * edx = color of a pixel 0xRRGGBB |
114 | mikedld | 510 | Returned value: |
511 | * function does not return value |
||
512 | Remarks: |
||
118 | diamond | 513 | * Offset for a pixel with coordinates (x,y) is calculated as |
114 | mikedld | 514 | (x+y*xsize)*3. |
499 | diamond | 515 | * If the given offset exceeds size set by subfunction 1, |
118 | diamond | 516 | the call is ignored. |
517 | * For update of the screen (after completion of a series of commands |
||
518 | working with a background) call subfunction 3. |
||
519 | * There is a pair function for get pixel on the background image - |
||
520 | subfunction 2 of function 39. |
||
114 | mikedld | 521 | |
522 | ====================================================================== |
||
523 | =========== Function 15, subfunction 3 - redraw background. ========== |
||
524 | ====================================================================== |
||
525 | Parameters: |
||
118 | diamond | 526 | * eax = 15 - function number |
527 | * ebx = 3 - subfunction number |
||
114 | mikedld | 528 | Returned value: |
529 | * function does not return value |
||
530 | |||
118 | diamond | 531 | ====================================================================== |
532 | == Function 15, subfunction 4 - set drawing mode for the background. = |
||
533 | ====================================================================== |
||
114 | mikedld | 534 | Parameters: |
118 | diamond | 535 | * eax = 15 - function number |
536 | * ebx = 4 - subfunction number |
||
537 | * ecx = drawing mode: |
||
114 | mikedld | 538 | * 1 = tile |
539 | * 2 = stretch |
||
540 | Returned value: |
||
541 | * function does not return value |
||
542 | Remarks: |
||
118 | diamond | 543 | * For update of the screen (after completion of a series of commands |
544 | working with a background) call subfunction 3. |
||
545 | * There is a pair function for get drawing mode of the background - |
||
546 | subfunction 4 of function 39. |
||
114 | mikedld | 547 | |
118 | diamond | 548 | ====================================================================== |
549 | ===================== Function 15, subfunction 5 ===================== |
||
550 | ============ Put block of pixels on the background image. ============ |
||
551 | ====================================================================== |
||
114 | mikedld | 552 | Parameters: |
118 | diamond | 553 | * eax = 15 - function number |
554 | * ebx = 5 - subfunction number |
||
555 | * ecx = pointer to the data in the format BBGGRRBBGGRR... |
||
114 | mikedld | 556 | * edx = offset in data of the background image |
118 | diamond | 557 | * esi = size of data in bytes = 3 * number of pixels |
114 | mikedld | 558 | Returned value: |
559 | * function does not return value |
||
560 | Remarks: |
||
499 | diamond | 561 | * Offset and size are not checked for correctness. |
118 | diamond | 562 | * Color of each pixel is stored as 3-bytes value BBGGRR. |
563 | * Pixels of the background image are written sequentially |
||
564 | from left to right, from up to down. |
||
565 | * Offset of pixel with coordinates (x,y) is (x+y*xsize)*3. |
||
566 | * For update of the screen (after completion of a series of commands |
||
567 | working with a background) call subfunction 3. |
||
114 | mikedld | 568 | |
569 | ====================================================================== |
||
546 | diamond | 570 | ===================== Function 15, subfunction 6 ===================== |
571 | ======== Map background data to the address space of process. ======== |
||
572 | ====================================================================== |
||
573 | Parameters: |
||
574 | * eax = 15 - function number |
||
575 | * ebx = 6 - subfunction number |
||
576 | Returned value: |
||
577 | * eax = pointer to background data, 0 if error |
||
578 | Remarks: |
||
579 | * Mapped data are available for read and write. |
||
580 | * Size of background data is 3*xsize*ysize. The system blocks |
||
581 | changes of background sizes while process works with mapped data. |
||
582 | * Color of each pixel is stored as 3-bytes value BBGGRR. |
||
583 | * Pixels of the background image are written sequentially |
||
584 | from left to right, from up to down. |
||
585 | |||
586 | ====================================================================== |
||
587 | ===== Function 15, subfunction 7 - close mapped background data. ===== |
||
588 | ====================================================================== |
||
589 | Parameters: |
||
590 | * eax = 15 - function number |
||
591 | * ebx = 7 - subfunction number |
||
592 | * ecx = pointer to mapped data |
||
593 | Returned value: |
||
594 | * eax = 1 - success, 0 - error |
||
595 | |||
596 | ====================================================================== |
||
118 | diamond | 597 | =============== Function 16 - save ramdisk on a floppy. ============== |
114 | mikedld | 598 | ====================================================================== |
599 | Parameters: |
||
118 | diamond | 600 | * eax = 16 - function number |
601 | * ebx = 1 or ebx = 2 - on which floppy save |
||
114 | mikedld | 602 | Returned value: |
118 | diamond | 603 | * eax = 0 - success |
114 | mikedld | 604 | * eax = 1 - error |
605 | |||
606 | ====================================================================== |
||
118 | diamond | 607 | ======= Function 17 - get the identifier of the pressed button. ====== |
114 | mikedld | 608 | ====================================================================== |
609 | Takes away the code of the pressed button from the buffer. |
||
610 | Parameters: |
||
118 | diamond | 611 | * eax = 17 - function number |
114 | mikedld | 612 | Returned value: |
118 | diamond | 613 | * if the buffer is empty, function returns eax=1 |
1018 | diamond | 614 | * if the buffer is not empty: |
615 | * high 24 bits of eax contain button identifier (in particular, |
||
616 | ah contains low byte of the identifier; if all buttons have |
||
617 | the identifier less than 256, ah is enough to distinguish) |
||
618 | * al = 0 - the button was pressed with left mouse button |
||
619 | * al = bit corresponding to used mouse button otherwise |
||
114 | mikedld | 620 | Remarks: |
118 | diamond | 621 | * "Buffer" keeps only one button, at pressing the new button the |
622 | information about old is lost. |
||
623 | * The call of this function by an application with inactive window |
||
624 | will return answer "buffer is empty". |
||
1018 | diamond | 625 | * Returned value for al corresponds to the state of mouse buttons |
626 | as in subfunction 2 of function 37 at the beginning |
||
627 | of button press, excluding lower bit, which is cleared. |
||
114 | mikedld | 628 | |
629 | ====================================================================== |
||
2244 | mario79 | 630 | ===================== Function 18, subfunction 1 ===================== |
631 | ============= Make deactive the window of the given thread. ========== |
||
632 | ====================================================================== |
||
633 | Parameters: |
||
634 | * eax = 18 - function number |
||
635 | * ebx = 1 - subfunction number |
||
636 | * ecx = number of the thread slot |
||
637 | Returned value: |
||
638 | * function does not return value |
||
2409 | Serge | 639 | |
2244 | mario79 | 640 | ====================================================================== |
118 | diamond | 641 | = Function 18, subfunction 2 - terminate process/thread by the slot. = |
114 | mikedld | 642 | ====================================================================== |
643 | Parameters: |
||
118 | diamond | 644 | * eax = 18 - function number |
645 | * ebx = 2 - subfunction number |
||
114 | mikedld | 646 | * ecx = number of the slot of process/thread |
647 | Returned value: |
||
648 | * function does not return value |
||
649 | Remarks: |
||
118 | diamond | 650 | * It is impossible to terminate system thread OS/IDLE (with |
651 | number of the slot 1), |
||
652 | it is possible to terminate any normal process/thread. |
||
653 | * See also subfunction 18 - terminate |
||
654 | process/thread by the identifier. |
||
114 | mikedld | 655 | |
118 | diamond | 656 | ====================================================================== |
657 | ===================== Function 18, subfunction 3 ===================== |
||
658 | ============= Make active the window of the given thread. ============ |
||
659 | ====================================================================== |
||
114 | mikedld | 660 | Parameters: |
118 | diamond | 661 | * eax = 18 - function number |
662 | * ebx = 3 - subfunction number |
||
663 | * ecx = number of the thread slot |
||
114 | mikedld | 664 | Returned value: |
665 | * function does not return value |
||
666 | Remarks: |
||
118 | diamond | 667 | * If correct, but nonexistent slot is given, |
668 | some window is made active. |
||
669 | * To find out, which window is active, use subfunction 7. |
||
114 | mikedld | 670 | |
118 | diamond | 671 | ====================================================================== |
672 | ===================== Function 18, subfunction 4 ===================== |
||
673 | =========== Get counter of idle time units per one second. =========== |
||
674 | ====================================================================== |
||
675 | Idle time units are units, in which the processor stands idle |
||
676 | in waiting for interrupt (in the command 'hlt'). |
||
114 | mikedld | 677 | |
678 | Parameters: |
||
118 | diamond | 679 | * eax = 18 - function number |
680 | * ebx = 4 - subfunction number |
||
114 | mikedld | 681 | Returned value: |
118 | diamond | 682 | * eax = value of the counter of idle time units per one second |
114 | mikedld | 683 | |
684 | ====================================================================== |
||
118 | diamond | 685 | ========== Function 18, subfunction 5 - get CPU clock rate. ========== |
114 | mikedld | 686 | ====================================================================== |
687 | Parameters: |
||
118 | diamond | 688 | * eax = 18 - function number |
689 | * ebx = 5 - subfunction number |
||
114 | mikedld | 690 | Returned value: |
118 | diamond | 691 | * eax = clock rate (modulo 2^32 clock ticks = 4GHz) |
114 | mikedld | 692 | |
118 | diamond | 693 | ====================================================================== |
2409 | Serge | 694 | Function 18, subfunction 6 - save ramdisk to the file on hard drive. |
118 | diamond | 695 | ====================================================================== |
114 | mikedld | 696 | Parameters: |
118 | diamond | 697 | * eax = 18 - function number |
698 | * ebx = 6 - subfunction number |
||
341 | heavyiron | 699 | * ecx = pointer to the full path to file |
700 | (for example, "/hd0/1/kolibri/kolibri.img") |
||
114 | mikedld | 701 | Returned value: |
118 | diamond | 702 | * eax = 0 - success |
703 | * else eax = error code of the file system |
||
499 | diamond | 704 | Remarks: |
118 | diamond | 705 | * All folders in the given path must exist, otherwise function |
706 | returns value 5, "file not found". |
||
114 | mikedld | 707 | |
708 | ====================================================================== |
||
118 | diamond | 709 | =========== Function 18, subfunction 7 - get active window. ========== |
114 | mikedld | 710 | ====================================================================== |
711 | Parameters: |
||
118 | diamond | 712 | * eax = 18 - function number |
713 | * ebx = 7 - subfunction number |
||
114 | mikedld | 714 | Returned value: |
118 | diamond | 715 | * eax = number of the active window |
716 | (number of the slot of the thread with active window) |
||
114 | mikedld | 717 | Remarks: |
118 | diamond | 718 | * Active window is at the top of the window stack and receives |
719 | messages on all keyboard input. |
||
720 | * To make a window active, use subfunction 3. |
||
114 | mikedld | 721 | |
118 | diamond | 722 | ====================================================================== |
723 | == Function 18, subfunction 8 - disable/enable the internal speaker. = |
||
724 | ====================================================================== |
||
725 | If speaker sound is disabled, all calls to subfunction 55 of |
||
726 | function 55 are ignored. If speaker sound is enabled, |
||
727 | they are routed on builtin speaker. |
||
114 | mikedld | 728 | |
118 | diamond | 729 | ------------------- Subsubfunction 1 - get status. ------------------- |
114 | mikedld | 730 | Parameters: |
118 | diamond | 731 | * eax = 18 - function number |
732 | * ebx = 8 - subfunction number |
||
733 | * ecx = 1 - number of the subsubfunction |
||
114 | mikedld | 734 | Returned value: |
118 | diamond | 735 | * eax = 0 - speaker sound is enabled; 1 - disabled |
114 | mikedld | 736 | |
118 | diamond | 737 | ----------------- Subsubfunction 2 - toggle status. ------------------ |
738 | Toggles states of disable/enable. |
||
114 | mikedld | 739 | Parameters: |
118 | diamond | 740 | * eax = 18 - function number |
741 | * ebx = 8 - subfunction number |
||
742 | * ecx = 2 - number of the subsubfunction |
||
114 | mikedld | 743 | Returned value: |
744 | * function does not return value |
||
745 | |||
118 | diamond | 746 | ====================================================================== |
1018 | diamond | 747 | == Function 18, subfunction 9 - system shutdown with the parameter. == |
118 | diamond | 748 | ====================================================================== |
114 | mikedld | 749 | Parameters: |
118 | diamond | 750 | * eax = 18 - function number |
751 | * ebx = 9 - subfunction number |
||
114 | mikedld | 752 | * ecx = parameter: |
118 | diamond | 753 | * 2 = turn off computer |
754 | * 3 = reboot computer |
||
755 | * 4 = restart the kernel from the file 'kernel.mnt' on ramdisk |
||
114 | mikedld | 756 | Returned value: |
118 | diamond | 757 | * at incorrect ecx the registers do not change (i.e. eax=18) |
758 | * by correct call function always returns eax=0 |
||
759 | as the tag of success |
||
114 | mikedld | 760 | Remarks: |
118 | diamond | 761 | * Do not rely on returned value by incorrect call, it can be |
762 | changed in future versions of the kernel. |
||
1018 | diamond | 763 | |
118 | diamond | 764 | ====================================================================== |
765 | ===== Function 18, subfunction 10 - minimize application window. ===== |
||
766 | ====================================================================== |
||
767 | Minimizes the own window. |
||
114 | mikedld | 768 | Parameters: |
118 | diamond | 769 | * eax = 18 - function number |
770 | * ebx = 10 - subfunction number |
||
114 | mikedld | 771 | Returned value: |
772 | * function does not return value |
||
773 | Remarks: |
||
118 | diamond | 774 | * The minimized window from the point of view of function 9 |
775 | keeps position and sizes. |
||
2409 | Serge | 776 | * Restoring of an application window occurs at its activation by |
118 | diamond | 777 | subfunction 3. |
778 | * Usually there is no necessity to minimize/restire a window |
||
779 | obviously: minimization of a window is carried out by the system |
||
780 | at pressing the minimization button (for skinned windows |
||
781 | it is defined automatically by function 0, |
||
782 | for other windows it can be defined manually by function 8), |
||
783 | restore of a window is done by the application '@panel'. |
||
114 | mikedld | 784 | |
785 | ====================================================================== |
||
2409 | Serge | 786 | Function 18, subfunction 11 - get information on the disk subsystem. |
114 | mikedld | 787 | ====================================================================== |
788 | Parameters: |
||
118 | diamond | 789 | * eax = 18 - function number |
790 | * ebx = 11 - subfunction number |
||
114 | mikedld | 791 | * ecx = type of the table: |
792 | * 1 = short version, 10 bytes |
||
793 | * 2 = full version, 65536 bytes |
||
118 | diamond | 794 | * edx = pointer to the buffer (in the application) for the table |
114 | mikedld | 795 | Returned value: |
796 | * function does not return value |
||
118 | diamond | 797 | Format of the table: short version: |
798 | * +0: byte: information about FDD's (drives for floppies), |
||
799 | AAAABBBB, where AAAA gives type of the first drive, BBBB - |
||
800 | of the second regarding to the following list: |
||
114 | mikedld | 801 | * 0 = there is no drive |
802 | * 1 = 360Kb, 5.25'' |
||
803 | * 2 = 1.2Mb, 5.25'' |
||
804 | * 3 = 720Kb, 3.5'' |
||
805 | * 4 = 1.44Mb, 3.5'' |
||
118 | diamond | 806 | * 5 = 2.88Mb, 3.5'' (such drives are not used anymore) |
807 | For example, for the standard configuration from one 1.44-drive |
||
808 | here will be 40h, and for the case 1.2Mb on A: and 1.44Mb on B: |
||
809 | the value is 24h. |
||
810 | * +1: byte: information about hard disks and CD-drives, AABBCCDD, |
||
114 | mikedld | 811 | where AA corresponds to the controller IDE0, ..., DD - IDE3: |
812 | * 0 = device is absent |
||
118 | diamond | 813 | * 1 = hard drive |
814 | * 2 = CD-drive |
||
815 | For example, in the case HD on IDE0 and CD on IDE2 |
||
816 | this field contains 48h. |
||
817 | * +2: 4 db: number of the retrieved partitions on hard disks |
||
818 | at accordingly IDE0,...,IDE3. |
||
819 | If the hard disk on IDEx is absent, appropriate byte is zero, |
||
820 | otherwise it shows number of the recognized partitions, which |
||
821 | can be not presented (if the drive is not formatted or if |
||
822 | the file system is not supported). Current version of the kernel |
||
277 | diamond | 823 | supports only FAT16, FAT32 and NTFS for hard disks. |
114 | mikedld | 824 | * +6: 4 db: reserved |
118 | diamond | 825 | Format of the table: full version: |
826 | * +0: 10 db: same as for the short version |
||
114 | mikedld | 827 | * +10: 100 db: data for the first partition |
828 | * +110: 100 db: data for the second partition |
||
829 | * ... |
||
830 | * +10+100*(n-1): 100 db: data for the last partition |
||
118 | diamond | 831 | The partitions are located as follows: at first sequentially all |
832 | recoginzed partitions on HD on IDE0 (if present), |
||
833 | then on HD on IDE1 (if present) and so on up to IDE3. |
||
834 | Format of the information about partition |
||
835 | (at moment only FAT is supported): |
||
114 | mikedld | 836 | * +0: dword: first physical sector of the partition |
837 | * +4: dword: last physical sector of the partition |
||
118 | diamond | 838 | (belongs to the partition) |
277 | diamond | 839 | * +8: byte: file system type: |
840 | 16=FAT16, 32=FAT32, 1=NTFS |
||
841 | * other data are dependent on file system, are modified with |
||
842 | kernel modifications and therefore are not described |
||
114 | mikedld | 843 | Remarks: |
118 | diamond | 844 | * The short table can be used for obtaining the information about |
845 | available devices. |
||
114 | mikedld | 846 | |
847 | ====================================================================== |
||
118 | diamond | 848 | ========== Function 18, subfunction 13 - get kernel version. ========= |
114 | mikedld | 849 | ====================================================================== |
850 | Parameters: |
||
118 | diamond | 851 | * eax = 18 - function number |
852 | * ebx = 13 - subfunction number |
||
853 | * ecx = pointer to the buffer (not less than 16 bytes), where |
||
854 | the information will be placed |
||
114 | mikedld | 855 | Returned value: |
856 | * function does not return value |
||
857 | Structure of the buffer: |
||
858 | db a,b,c,d for version a.b.c.d |
||
1675 | Nasarus | 859 | db 0: reserved |
540 | victor | 860 | dd REV - kernel SVN revision number |
1675 | Nasarus | 861 | For Kolibri 0.7.7.0+ kernel: |
1662 | Nasarus | 862 | db 0,7,7,0 |
1675 | Nasarus | 863 | db 0 |
1676 | Nasarus | 864 | dd 1675 |
114 | mikedld | 865 | |
118 | diamond | 866 | ====================================================================== |
867 | ======= Function 18, subfunction 14 - wait for screen retrace. ======= |
||
868 | ====================================================================== |
||
869 | Waits for the beginning of retrace of the scanning ray of the screen |
||
870 | monitor. |
||
114 | mikedld | 871 | Parameters: |
118 | diamond | 872 | * eax = 18 - function number |
873 | * ebx = 14 - subfunction number |
||
114 | mikedld | 874 | Returned value: |
118 | diamond | 875 | * eax = 0 as the tag of success |
114 | mikedld | 876 | Remarks: |
118 | diamond | 877 | * Function is intended only for active high-efficiency graphics |
114 | mikedld | 878 | applications; is used for smooth output of a graphics. |
879 | |||
118 | diamond | 880 | ====================================================================== |
881 | == Function 18, subfunction 15 - center mouse cursor on the screen. == |
||
882 | ====================================================================== |
||
114 | mikedld | 883 | Parameters: |
118 | diamond | 884 | * eax = 18 - function number |
885 | * ebx = 15 - subfunction number |
||
114 | mikedld | 886 | Returned value: |
118 | diamond | 887 | * eax = 0 as the tag of success |
114 | mikedld | 888 | |
889 | ====================================================================== |
||
118 | diamond | 890 | ========= Function 18, subfunction 16 - get size of free RAM. ======== |
114 | mikedld | 891 | ====================================================================== |
892 | Parameters: |
||
118 | diamond | 893 | * eax = 18 - function number |
894 | * ebx = 16 - subfunction number |
||
114 | mikedld | 895 | Returned value: |
896 | * eax = size of free memory in kilobytes |
||
897 | |||
898 | ====================================================================== |
||
118 | diamond | 899 | ======== Function 18, subfunction 17 - get full amount of RAM. ======= |
114 | mikedld | 900 | ====================================================================== |
901 | Parameters: |
||
118 | diamond | 902 | * eax = 18 - function number |
903 | * ebx = 17 - subfunction number |
||
114 | mikedld | 904 | Returned value: |
118 | diamond | 905 | * eax = total size of existing memory in kilobytes |
114 | mikedld | 906 | |
907 | ====================================================================== |
||
118 | diamond | 908 | ===================== Function 18, subfunction 18 ==================== |
909 | ============= Terminate process/thread by the identifier. ============ |
||
114 | mikedld | 910 | ====================================================================== |
911 | Parameters: |
||
118 | diamond | 912 | * eax = 18 - function number |
913 | * ebx = 18 - subfunction number |
||
914 | * ecx = identifer of process/thread (PID/TID) |
||
114 | mikedld | 915 | Returned value: |
118 | diamond | 916 | * eax = 0 - success |
917 | * eax = -1 - error (process is not found or is system) |
||
114 | mikedld | 918 | Remarks: |
118 | diamond | 919 | * It is impossible to terminate system thread OS/IDLE (identifier |
920 | 1), it is possible to terminate any normal process/thread. |
||
921 | * See also subfunction 2 - terminate |
||
922 | process/thread by given slot. |
||
114 | mikedld | 923 | |
924 | ====================================================================== |
||
131 | diamond | 925 | ======== Function 18, subfunction 19 - get/set mouse features. ======= |
120 | mario79 | 926 | ====================================================================== |
131 | diamond | 927 | |
928 | ---------------- Subsubfunction 0 - get mouse speed. ----------------- |
||
120 | mario79 | 929 | Parameters: |
930 | * eax = 18 - function number |
||
931 | * ebx = 19 - subfunction number |
||
131 | diamond | 932 | * ecx = 0 - subsubfunction number |
933 | Returned value: |
||
934 | * eax = current mouse speed |
||
120 | mario79 | 935 | |
131 | diamond | 936 | ---------------- Subsubfunction 1 - set mouse speed. ----------------- |
937 | Parameters: |
||
938 | * eax = 18 - function number |
||
939 | * ebx = 19 - subfunction number |
||
940 | * ecx = 1 - subsubfunction number |
||
941 | * edx = new value for speed |
||
942 | Returned value: |
||
943 | * function does not return value |
||
120 | mario79 | 944 | |
131 | diamond | 945 | ---------------- Subsubfunction 2 - get mouse delay. ----------------- |
946 | Parameters: |
||
947 | * eax = 18 - function number |
||
948 | * ebx = 19 - subfunction number |
||
949 | * ecx = 2 - subsubfunction number |
||
950 | Returned value: |
||
951 | * eax = current mouse delay |
||
120 | mario79 | 952 | |
131 | diamond | 953 | ---------------- Subsubfunction 3 - set mouse delay. ----------------- |
954 | Parameters: |
||
955 | * eax = 18 - function number |
||
956 | * ebx = 19 - subfunction number |
||
957 | * ecx = 3 - subsubfunction number |
||
958 | * edx = new value for mouse delay |
||
959 | Returned value: |
||
960 | * function does not return value |
||
120 | mario79 | 961 | |
131 | diamond | 962 | ----------- Subsubfunction 4 - set mouse pointer position. ----------- |
963 | Parameters: |
||
964 | * eax = 18 - function number |
||
965 | * ebx = 19 - subfunction number |
||
966 | * ecx = 4 - subsubfunction number |
||
967 | * edx = [coordinate on axis x]*65536 + [coordinate on axis y] |
||
968 | Returned value: |
||
969 | * function does not return value |
||
621 | mario79 | 970 | |
641 | diamond | 971 | -------- Subsubfunction 5 - simulate state of mouse buttons. --------- |
621 | mario79 | 972 | Parameters: |
973 | * eax = 18 - function number |
||
974 | * ebx = 19 - subfunction number |
||
975 | * ecx = 5 - subsubfunction number |
||
641 | diamond | 976 | * edx = information about emulated state of mouse buttons: |
977 | (same as return value in subfunction 2 of function 37) |
||
621 | mario79 | 978 | * bit 0 is set = left button is pressed |
979 | * bit 1 is set = right button is pressed |
||
980 | * bit 2 is set = middle button is pressed |
||
981 | * bit 3 is set = 4th button is pressed |
||
982 | * bit 4 is set = 5th button is pressed |
||
983 | Returned value: |
||
984 | * function does not return value |
||
120 | mario79 | 985 | Remarks: |
131 | diamond | 986 | * It is recommended to set speed of the mouse (in subsubfunction 1) |
987 | from 1 up to 9. The installed value is not inspected by the kernel |
||
988 | code, so set it carefully, at incorrect value the cursor |
||
989 | can "freeze". Speed of the mouse can be regulated through the |
||
990 | application SETUP. |
||
991 | * Recommended delay of the mouse (in subsubfunction 3) = 10. Lower |
||
992 | value is not handled by COM mice. At the very large values the |
||
993 | movement of the mouse on 1 pixel is impossible and the cursor will |
||
994 | jump on the value of installed speed (subsubfunction 1). The |
||
995 | installed value is not inspected by the kernel code. |
||
133 | diamond | 996 | Mouse delay can be regulated through the application SETUP. |
131 | diamond | 997 | * The subsubfunction 4 does not check the passed value. Before |
998 | its call find out current screen resolution (with function 14) |
||
999 | and check that the value of position is inside the limits of the |
||
1000 | screen. |
||
120 | mario79 | 1001 | |
1002 | ====================================================================== |
||
193 | diamond | 1003 | ======== Function 18, subfunction 20 - get information on RAM. ======= |
1004 | ====================================================================== |
||
1005 | Parameters: |
||
1006 | * eax = 18 - function number |
||
1007 | * ebx = 20 - subfunction number |
||
1008 | * ecx = pointer to the buffer for information (36 bytes) |
||
1009 | Returned value: |
||
1010 | * eax = total size of existing RAM in pages |
||
1011 | or -1 if error has occured |
||
1012 | * buffer pointed to by ecx contains the following information: |
||
1013 | * +0: dword: total size of existing RAM in pages |
||
1014 | * +4: dword: size of free RAM in pages |
||
1015 | * +8: dword: number of page faults (exceptions #PF) |
||
1016 | in applications |
||
1017 | * +12: dword: size of kernel heap in bytes |
||
1018 | * +16: dword: free in kernel heap in bytes |
||
1019 | * +20: dword: total number of memory blocks in kernel heap |
||
1020 | * +24: dword: number of free memory blocks in kernel heap |
||
1021 | * +28: dword: size of maximum free block in kernel heap |
||
1022 | (reserved) |
||
1023 | * +32: dword: size of maximum allocated block in kernel heap |
||
1024 | (reserved) |
||
1025 | |||
1026 | ====================================================================== |
||
641 | diamond | 1027 | ===================== Function 18, subfunction 21 ==================== |
1028 | ======== Get slot number of process/thread by the identifier. ======== |
||
608 | alver | 1029 | ====================================================================== |
1030 | Parameters: |
||
1031 | * eax = 18 - function number |
||
1032 | * ebx = 21 - subfunction number |
||
641 | diamond | 1033 | * ecx = identifer of process/thread (PID/TID) |
608 | alver | 1034 | Returned value: |
641 | diamond | 1035 | * eax = 0 - error (invalid identifier) |
1036 | * otherwise eax = slot number |
||
608 | alver | 1037 | |
1038 | ====================================================================== |
||
641 | diamond | 1039 | ===================== Function 18, subfunction 22 ==================== |
1040 | ============== Operations with window of another thread. ============= |
||
608 | alver | 1041 | ====================================================================== |
1042 | Parameters: |
||
1043 | * eax = 18 - function number |
||
1044 | * ebx = 22 - subfunction number |
||
641 | diamond | 1045 | * ecx = operation type: |
1046 | * 0 = minimize window of the thread with given slot number |
||
1047 | * 1 = minimize window of the thread with given identifier |
||
1048 | * 2 = restore window of the thread with given slot number |
||
1049 | * 3 = restore window of the thread with given identifier |
||
1050 | * edx = parameter (slot number or PID/TID) |
||
608 | alver | 1051 | Returned value: |
641 | diamond | 1052 | * eax = 0 - success |
1053 | * eax = -1 - error (invalid identifier) |
||
1054 | Remarks: |
||
1055 | * The thread can minimize its window with subfunction 10. |
||
1056 | * One can restore and activate window simultaneously with |
||
1057 | subfunction 3 (which requires slot number). |
||
608 | alver | 1058 | |
1059 | ====================================================================== |
||
118 | diamond | 1060 | ==================== Function 20 - MIDI interface. =================== |
114 | mikedld | 1061 | ====================================================================== |
1062 | |||
118 | diamond | 1063 | ----------------------- Subfunction 1 - reset ------------------------ |
114 | mikedld | 1064 | Parameters: |
118 | diamond | 1065 | * eax = 20 - function number |
1066 | * ebx = 1 - subfunction number |
||
114 | mikedld | 1067 | |
1068 | -------------------- Subfunction 2 - output byte --------------------- |
||
1069 | Parameters: |
||
118 | diamond | 1070 | * eax = 20 - function number |
1071 | * ebx = 2 - subfunction number |
||
114 | mikedld | 1072 | * cl = byte for output |
118 | diamond | 1073 | Returned value (is the same for both subfunctions): |
1074 | * eax = 0 - success |
||
114 | mikedld | 1075 | * eax = 1 - base port is not defined |
1076 | Remarks: |
||
2409 | Serge | 1077 | * Previously the base port must be defined by |
118 | diamond | 1078 | subfunction 1 of function 21. |
114 | mikedld | 1079 | |
1080 | ====================================================================== |
||
118 | diamond | 1081 | ======== Function 21, subfunction 1 - set MPU MIDI base port. ======== |
114 | mikedld | 1082 | ====================================================================== |
1083 | Parameters: |
||
118 | diamond | 1084 | * eax = 21 - function number |
1085 | * ebx = 1 - subfunction number |
||
1086 | * ecx = number of base port |
||
1087 | Returned value |
||
1088 | * eax = 0 - success |
||
114 | mikedld | 1089 | * eax = -1 - erratic number of a port |
1090 | Remarks: |
||
118 | diamond | 1091 | * Number of a port must satisfy to conditions 0x100<=ecx<=0xFFFF. |
1092 | * The installation of base is necessary for function 20. |
||
1093 | * To get base port use subfunction 1 of function 26. |
||
114 | mikedld | 1094 | |
1095 | ====================================================================== |
||
118 | diamond | 1096 | ========== Function 21, subfunction 2 - set keyboard layout. ========= |
114 | mikedld | 1097 | ====================================================================== |
118 | diamond | 1098 | Keyboard layout is used to convert keyboard scancodes to ASCII-codes, |
1099 | which will be read by function 2. |
||
114 | mikedld | 1100 | Parameters: |
118 | diamond | 1101 | * eax = 21 - function number |
1102 | * ebx = 2 - subfunction number |
||
1103 | * ecx = which layout to set: |
||
114 | mikedld | 1104 | * 1 = normal layout |
1105 | * 2 = layout at pressed Shift |
||
1106 | * 3 = layout at pressed Alt |
||
118 | diamond | 1107 | * edx = pointer to layout - table of length 128 bytes |
114 | mikedld | 1108 | Or: |
1109 | * ecx = 9 |
||
118 | diamond | 1110 | * dx = country identifier (1=eng, 2=fi, 3=ger, 4=rus) |
114 | mikedld | 1111 | Returned value: |
118 | diamond | 1112 | * eax = 0 - success |
1113 | * eax = 1 - incorrect parameter |
||
114 | mikedld | 1114 | Remarks: |
118 | diamond | 1115 | * If Alt is pressed, the layout with Alt is used; |
1116 | if Alt is not pressed, but Shift is pressed, |
||
1117 | the layout with Shift is used; |
||
1118 | if Alt and Shift are not pressed, but Ctrl is pressed, the normal |
||
1119 | layout is used and then from the code is subtracted 0x60; |
||
1120 | if no control key is pressed, the normal layout is used. |
||
2409 | Serge | 1121 | * To get layout and country identifier use |
118 | diamond | 1122 | subfunction 2 of function 26. |
1123 | * Country identifier is global system variable, which is not used |
||
1124 | by the kernel itself; however the application '@panel' displays |
||
1125 | the corresponding icon. |
||
1126 | * The application @panel switches layouts on user request. |
||
114 | mikedld | 1127 | |
1128 | ====================================================================== |
||
118 | diamond | 1129 | ============== Function 21, subfunction 3 - set CD base. ============= |
114 | mikedld | 1130 | ====================================================================== |
1131 | Parameters: |
||
118 | diamond | 1132 | * eax = 21 - function number |
1133 | * ebx = 3 - subfunction number |
||
1134 | * ecx = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3 |
||
114 | mikedld | 1135 | Returned value: |
1136 | * eax = 0 |
||
1137 | Remarks: |
||
118 | diamond | 1138 | * CD base is used by function 24. |
1139 | * To get CD base use subfunction 3 of function 26. |
||
114 | mikedld | 1140 | |
1141 | ====================================================================== |
||
118 | diamond | 1142 | ========== Function 21, subfunction 5 - set system language. ========= |
114 | mikedld | 1143 | ====================================================================== |
1144 | Parameters: |
||
118 | diamond | 1145 | * eax = 21 - function number |
1146 | * ebx = 5 - subfunction number |
||
1147 | * ecx = system language (1=eng, 2=fi, 3=ger, 4=rus) |
||
114 | mikedld | 1148 | Returned value: |
1149 | * eax = 0 |
||
1150 | Remarks: |
||
118 | diamond | 1151 | * System language is global system variable and is not used |
1152 | by the kernel itself, however application @panel draws the |
||
1153 | appropriate icon. |
||
1154 | * Function does not check for correctness, as the kernel does not |
||
1155 | use this variable. |
||
1156 | * To get system language use subfunction 5 of function 26. |
||
114 | mikedld | 1157 | |
1158 | ====================================================================== |
||
118 | diamond | 1159 | ============== Function 21, subfunction 7 - set HD base. ============= |
114 | mikedld | 1160 | ====================================================================== |
118 | diamond | 1161 | The HD base defines hard disk to write with usage of obsolete |
346 | diamond | 1162 | syntax /HD in obsolete function 58; at usage of modern syntax |
1163 | /HD0,/HD1,/HD2,/HD3 base is set automatically. |
||
114 | mikedld | 1164 | Parameters: |
118 | diamond | 1165 | * eax = 21 - function number |
1166 | * ebx = 7 - subfunction number |
||
1167 | * ecx = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3 |
||
114 | mikedld | 1168 | Returned value: |
1169 | * eax = 0 |
||
1170 | Remarks: |
||
118 | diamond | 1171 | * Any application at any time can change the base. |
1172 | * Do not change base, when any application works with hard disk. |
||
1173 | If you do not want system bugs. |
||
1174 | * To get HD base use subfunction 7 of function 26. |
||
2409 | Serge | 1175 | * It is also necessary to define used partition of hard disk by |
118 | diamond | 1176 | subfunction 8. |
114 | mikedld | 1177 | |
1178 | ====================================================================== |
||
118 | diamond | 1179 | ========= Function 21, subfunction 8 - set used HD partition. ======== |
114 | mikedld | 1180 | ====================================================================== |
118 | diamond | 1181 | The HD partition defines partition of the hard disk to write with |
346 | diamond | 1182 | usage of obsolete syntax /HD and obsolete function 58; |
118 | diamond | 1183 | at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3 |
346 | diamond | 1184 | base and partition are set automatically. |
114 | mikedld | 1185 | Parameters: |
118 | diamond | 1186 | * eax = 21 - function number |
1187 | * ebx = 8 - subfunction number |
||
1188 | * ecx = HD partition (beginning from 1) |
||
1189 | Return value: |
||
114 | mikedld | 1190 | * eax = 0 |
1191 | Remarks: |
||
118 | diamond | 1192 | * Any application at any time can change partition. |
1193 | * Do not change partition when any application works with hard disk. |
||
1194 | If you do not want system bugs. |
||
1195 | * To get used partition use subfunction 8 of function 26. |
||
1196 | * There is no correctness checks. |
||
2409 | Serge | 1197 | * To get the number of partitions of a hard disk use |
118 | diamond | 1198 | subfunction 11 of function 18. |
1199 | * It is also necessary to define used HD base by subfunction 7. |
||
114 | mikedld | 1200 | |
1201 | ====================================================================== |
||
2409 | Serge | 1202 | Function 21, subfunction 11 - enable/disable low-level access to HD. |
114 | mikedld | 1203 | ====================================================================== |
1204 | Parameters: |
||
118 | diamond | 1205 | * eax = 21 - function number |
1206 | * ebx = 11 - subfunction number |
||
1207 | * ecx = 0/1 - disable/enable |
||
114 | mikedld | 1208 | Returned value: |
1209 | * eax = 0 |
||
1210 | Remarks: |
||
118 | diamond | 1211 | * Is used in LBA-read (subfunction 8 of function 58). |
1212 | * The current implementation uses only low bit of ecx. |
||
1213 | * To get current status use subfunction 11 of function 26. |
||
114 | mikedld | 1214 | |
1215 | ====================================================================== |
||
2409 | Serge | 1216 | Function 21, subfunction 12 - enable/disable low-level access to PCI. |
114 | mikedld | 1217 | ====================================================================== |
1218 | Parameters: |
||
118 | diamond | 1219 | * eax = 21 - function number |
1220 | * ebx = 12 - subfunction number |
||
1221 | * ecx = 0/1 - disable/enable |
||
114 | mikedld | 1222 | Returned value: |
1223 | * eax = 0 |
||
1224 | Remarks: |
||
118 | diamond | 1225 | * Is used in operations with PCI bus (function 62). |
1226 | * The current implementation uses only low bit of ecx. |
||
1227 | * To get current status use subfunction 12 of function 26. |
||
114 | mikedld | 1228 | |
1229 | ====================================================================== |
||
118 | diamond | 1230 | ============ Function 21, subfunction 13, subsubfunction 1 =========== |
1231 | ======== Initialize + get information on the driver vmode.mdr. ======= |
||
114 | mikedld | 1232 | ====================================================================== |
1233 | Parameters: |
||
118 | diamond | 1234 | * eax = 21 - function number |
1235 | * ebx = 13 - subfunction number |
||
1236 | * ecx = 1 - number of the driver function |
||
1237 | * edx = pointer to 512-bytes buffer |
||
114 | mikedld | 1238 | Returned value: |
118 | diamond | 1239 | * if driver is not loaded |
1240 | (never happens in the current implementation): |
||
114 | mikedld | 1241 | * eax = -1 |
118 | diamond | 1242 | * ebx, ecx destroyed |
1243 | * if driver is loaded: |
||
1244 | * eax = 'MDAZ' (in fasm style, that is 'M' - low byte, 'Z' - high) |
||
1245 | - signature |
||
1246 | * ebx = current frequency of the scanning (in Hz) |
||
1247 | * ecx destroyed |
||
1248 | * buffer pointed to by edx is filled |
||
114 | mikedld | 1249 | Format of the buffer: |
118 | diamond | 1250 | * +0: 32*byte: driver name, "Trans VideoDriver" |
1251 | (without quotes, supplemented by spaces) |
||
1252 | * +32 = +0x20: dword: driver version (version x.y is encoded as |
||
1253 | y*65536+x), for the current implementation is 1 (1.0) |
||
1254 | * +36 = +0x24: 7*dword: reserved (0 in the current implementation) |
||
1255 | * +64 = +0x40: 32*word: list of supported videomodes (each word |
||
1256 | is number of a videomode, after list itself there are zeroes) |
||
1257 | * +128 = +0x80: 32*(5*word): list of supported frequences of the |
||
1258 | scannings for videomodes: for each videomode listed in the |
||
1259 | previous field up to 5 supported frequences are given |
||
1260 | (unused positions contain zeroes) |
||
114 | mikedld | 1261 | Remarks: |
118 | diamond | 1262 | * Function initializes the driver (if it is not initialized yet) |
1263 | and must be called first, before others (otherwise they will do |
||
1264 | nothing and return -1). |
||
1265 | * The current implementation supports only one frequency |
||
1266 | of the scanning on videomode. |
||
114 | mikedld | 1267 | |
1268 | ====================================================================== |
||
118 | diamond | 1269 | ============ Function 21, subfunction 13, subsubfunction 2 =========== |
1270 | ================ Get information on current videomode. =============== |
||
114 | mikedld | 1271 | ====================================================================== |
1272 | Parameters: |
||
118 | diamond | 1273 | * eax = 21 - function number |
1274 | * ebx = 13 - subfunction number |
||
1275 | * ecx = 2 - number of the driver function |
||
114 | mikedld | 1276 | Returned value: |
118 | diamond | 1277 | * eax = -1 - driver is not loaded or not initialized; |
1278 | ebx,ecx are destroyed |
||
114 | mikedld | 1279 | * eax = [width]*65536 + [height] |
118 | diamond | 1280 | * ebx = frequency of the vertical scanning (in Hz) |
114 | mikedld | 1281 | * ecx = number of current videomode |
1282 | Remarks: |
||
2409 | Serge | 1283 | * Driver must be initialized by call to |
118 | diamond | 1284 | driver function 1. |
1285 | * If only screen sizes are required, it is more expedient to use |
||
1286 | function 14 taking into account that it |
||
1287 | returns sizes on 1 less. |
||
114 | mikedld | 1288 | |
1289 | ====================================================================== |
||
118 | diamond | 1290 | === Function 21, subfunction 13, subsubfunction 3 - set videomode. === |
114 | mikedld | 1291 | ====================================================================== |
1292 | Parameters: |
||
118 | diamond | 1293 | * eax = 21 - function number |
1294 | * ebx = 13 - subfunction number |
||
1295 | * ecx = 3 - number of the driver function |
||
1296 | * edx = [scanning frequency]*65536 + [videomode number] |
||
114 | mikedld | 1297 | Returned value: |
118 | diamond | 1298 | * eax = -1 - driver is not loaded, not initialized or |
1299 | an error has occured |
||
1300 | * eax = 0 - success |
||
1301 | * ebx, ecx destroyed |
||
114 | mikedld | 1302 | Remarks: |
118 | diamond | 1303 | * Driver must be initialized by driver function 1. |
1304 | * The videomode number and frequency must be in the table |
||
1305 | returned by driver function 1. |
||
114 | mikedld | 1306 | |
1307 | ====================================================================== |
||
118 | diamond | 1308 | ============ Function 21, subfunction 13, subsubfunction 4 =========== |
1309 | ================== Return to the initial videomode. ================== |
||
114 | mikedld | 1310 | ====================================================================== |
118 | diamond | 1311 | Returns the screen to the videomode set at system boot. |
114 | mikedld | 1312 | Parameters: |
118 | diamond | 1313 | * eax = 21 - function number |
1314 | * ebx = 13 - subfunction number |
||
1315 | * ecx = 4 - number of the driver function |
||
114 | mikedld | 1316 | Returned value: |
118 | diamond | 1317 | * eax = -1 - driver is not loaded or not initialized |
1318 | * eax = 0 - success |
||
1319 | * ebx, ecx destroyed |
||
114 | mikedld | 1320 | Remarks: |
118 | diamond | 1321 | * Driver must be initialized by call to driver function 1. |
114 | mikedld | 1322 | |
118 | diamond | 1323 | ====================================================================== |
1324 | ============ Function 21, subfunction 13, subsubfunction 5 =========== |
||
1325 | ===== Increase/decrease the size of the visible area of monitor. ===== |
||
1326 | ====================================================================== |
||
114 | mikedld | 1327 | Parameters: |
118 | diamond | 1328 | * eax = 21 - function number |
1329 | * ebx = 13 - subfunction number |
||
1330 | * ecx = 5 - number of the driver function |
||
1331 | * edx = 0/1 - decrease/increase horizontal size on 1 position |
||
1332 | * edx = 2/3 - is not supported in the current implementation; |
||
1333 | is planned as decrease/increase vertical size on 1 position |
||
114 | mikedld | 1334 | Returned value: |
118 | diamond | 1335 | * eax = -1 - driver is not loaded or not initialized |
1336 | * eax = 0 - success |
||
1337 | * ebx, ecx destroyed |
||
114 | mikedld | 1338 | Remarks: |
118 | diamond | 1339 | * Driver must be initialized by call to driver function 1. |
1340 | * Function influences only the physical size of the screen image; |
||
1341 | the logical size (number of pixels) does not change. |
||
114 | mikedld | 1342 | |
1343 | ====================================================================== |
||
118 | diamond | 1344 | ================= Function 22 - set system date/time. ================ |
114 | mikedld | 1345 | ====================================================================== |
1346 | Parameters: |
||
118 | diamond | 1347 | * eax = 22 - function number |
1348 | * ebx = 0 - set time |
||
1349 | * ecx = 0x00SSMMHH - time in the binary-decimal code (BCD): |
||
114 | mikedld | 1350 | * HH=hour 00..23 |
1351 | * MM=minute 00..59 |
||
1352 | * SS=second 00..59 |
||
118 | diamond | 1353 | * ebx = 1 - set date |
1354 | * ecx = 0x00DDMMYY - date in the binary-decimal code (BCD): |
||
114 | mikedld | 1355 | * DD=day 01..31 |
1356 | * MM=month 01..12 |
||
1357 | * YY=year 00..99 |
||
118 | diamond | 1358 | * ebx = 2 - set day of week |
114 | mikedld | 1359 | * ecx = 1 for Sunday, ..., 7 for Saturday |
118 | diamond | 1360 | * ebx = 3 - set alarm clock |
114 | mikedld | 1361 | * ecx = 0x00SSMMHH |
1362 | Returned value: |
||
118 | diamond | 1363 | * eax = 0 - success |
1364 | * eax = 1 - incorrect parameter |
||
114 | mikedld | 1365 | * eax = 2 - CMOS-battery was unloaded |
1366 | Remarks: |
||
118 | diamond | 1367 | * Value of installation of day of week seems to be doubtful, |
1368 | as it a little where is used |
||
1369 | (day of week can be calculated by date). |
||
1370 | * Alarm clock can be set on operation in the given time every day. |
||
1371 | But there is no existing system function to disable it. |
||
1372 | * Operation of alarm clock consists in generation IRQ8. |
||
1373 | * Generally CMOS supports for alarm clock set of value 0xFF |
||
1374 | as one of parameters and it means that the appropriate parameter |
||
1375 | is ignored. But current implementation does not allow this |
||
1376 | (will return 1). |
||
1377 | * Alarm clock is a global system resource; the set of |
||
1378 | an alarm clock cancels automatically the previous set. |
||
1379 | However, at moment no program uses it. |
||
114 | mikedld | 1380 | |
1381 | ====================================================================== |
||
118 | diamond | 1382 | ============= Function 23 - wait for event with timeout. ============= |
114 | mikedld | 1383 | ====================================================================== |
118 | diamond | 1384 | If the message queue is empty, waits for new message in the queue, |
1385 | but no more than given time. Then reads out a message from the queue. |
||
114 | mikedld | 1386 | |
1387 | Parameters: |
||
118 | diamond | 1388 | * eax = 23 - function number |
114 | mikedld | 1389 | * ebx = timeout (in 1/100 of second) |
1390 | Returned value: |
||
118 | diamond | 1391 | * eax = 0 - the message queue is empty |
1392 | * otherwise eax = event (see the list of events) |
||
114 | mikedld | 1393 | Remarks: |
118 | diamond | 1394 | * Only those events are taken into account, which enter into |
1395 | the mask set by function 40. By default it is |
||
1396 | redraw, key and button events. |
||
1397 | * To check for presence of a message in the queue use function 11. |
||
1398 | To wait without timeout use function 10. |
||
1399 | * Transmission ebx=0 results in immediate returning eax=0. |
||
1400 | * Current implementation returns immediately with eax=0, |
||
1401 | if the addition of ebx with the current value of time counter |
||
1402 | makes 32-bit overflow. |
||
114 | mikedld | 1403 | |
1404 | ====================================================================== |
||
118 | diamond | 1405 | ======== Function 24, subfunction 1 - begin to play CD-audio. ======== |
114 | mikedld | 1406 | ====================================================================== |
1407 | Parameters: |
||
118 | diamond | 1408 | * eax = 24 - function number |
1409 | * ebx = 1 - subfunction number |
||
114 | mikedld | 1410 | * ecx = 0x00FRSSMM, where |
118 | diamond | 1411 | * MM = starting minute |
1412 | * SS = starting second |
||
1413 | * FR = starting frame |
||
114 | mikedld | 1414 | Returned value: |
118 | diamond | 1415 | * eax = 0 - success |
1416 | * eax = 1 - CD base is not defined |
||
114 | mikedld | 1417 | Remarks: |
2409 | Serge | 1418 | * Previously CD base must be defined by the call to |
118 | diamond | 1419 | subfunction 3 of function 21. |
1420 | * One second includes 75 frames, one minute includes 60 seconds. |
||
1421 | * The function is asynchronous (returns control, when play begins). |
||
114 | mikedld | 1422 | |
1423 | ====================================================================== |
||
118 | diamond | 1424 | ======= Function 24, subfunction 2 - get information on tracks. ====== |
114 | mikedld | 1425 | ====================================================================== |
1426 | Parameters: |
||
118 | diamond | 1427 | * eax = 24 - function number |
1428 | * ebx = 2 - subfunction number |
||
1429 | * ecx = pointer to the buffer for the table |
||
1430 | (maximum 8*64h+4 bytes=100 tracks) |
||
114 | mikedld | 1431 | Returned value: |
118 | diamond | 1432 | * eax = 0 - success |
1433 | * eax = 1 - CD base is not defined |
||
114 | mikedld | 1434 | Remarks: |
118 | diamond | 1435 | * The format of the table with tracks information is the same as |
1436 | for ATAPI-CD command 43h (READ TOC), usual table (subcommand 00h). |
||
1437 | Function returns addresses in MSF. |
||
2409 | Serge | 1438 | * Previously CD base port must be set by call to |
118 | diamond | 1439 | subfunction 3 of function 21. |
1440 | * Function returns information only about no more than 100 |
||
1441 | first tracks. In most cases it is enough. |
||
114 | mikedld | 1442 | |
1443 | ====================================================================== |
||
118 | diamond | 1444 | ========== Function 24, subfunction 3 - stop play CD-audio. ========== |
114 | mikedld | 1445 | ====================================================================== |
1446 | Parameters: |
||
118 | diamond | 1447 | * eax = 24 - function number |
1448 | * ebx = 1 - subfunction number |
||
114 | mikedld | 1449 | Returned value: |
118 | diamond | 1450 | * eax = 0 - success |
1451 | * eax = 1 - CD base is not defined |
||
499 | diamond | 1452 | Remarks: |
2409 | Serge | 1453 | * Previously CD base port must be defined by call to |
118 | diamond | 1454 | subfunction 3 of function 21. |
114 | mikedld | 1455 | |
1456 | ====================================================================== |
||
641 | diamond | 1457 | ======= Function 24, subfunction 4 - eject tray of disk drive. ======= |
588 | diamond | 1458 | ====================================================================== |
1459 | Parameters: |
||
1460 | * eax = 24 - function number |
||
1461 | * ebx = 4 - subfunction number |
||
641 | diamond | 1462 | * ecx = position of CD/DVD-drive |
1463 | (from 0=Primary Master to 3=Secondary Slave) |
||
588 | diamond | 1464 | Returned value: |
641 | diamond | 1465 | * function does not return value |
588 | diamond | 1466 | Remarks: |
1467 | * The function is supported only for ATAPI devices (CD and DVD). |
||
641 | diamond | 1468 | * When the tray is being ejected, |
1469 | manual control of tray is unlocked. |
||
1470 | * When the tray is being ejected, the code clears the cache for |
||
1471 | corresponding device. |
||
588 | diamond | 1472 | * An example of usage of the function is the application CD_tray. |
1473 | |||
1474 | ====================================================================== |
||
641 | diamond | 1475 | ======== Function 24, subfunction 5 - load tray of disk drive. ======= |
588 | diamond | 1476 | ====================================================================== |
1477 | Parameters: |
||
1478 | * eax = 24 - function number |
||
1479 | * ebx = 5 - subfunction number |
||
641 | diamond | 1480 | * ecx = position of CD/DVD-drive |
1481 | (from 0=Primary Master to 3=Secondary Slave) |
||
588 | diamond | 1482 | Returned value: |
641 | diamond | 1483 | * function does not return value |
588 | diamond | 1484 | Remarks: |
1485 | * The function is supported only for ATAPI devices (CD and DVD). |
||
1486 | * An example of usage of the function is the application CD_tray. |
||
1487 | |||
1488 | ====================================================================== |
||
118 | diamond | 1489 | ======== Function 26, subfunction 1 - get MPU MIDI base port. ======== |
114 | mikedld | 1490 | ====================================================================== |
1491 | Parameters: |
||
118 | diamond | 1492 | * eax = 26 - function number |
1493 | * ebx = 1 - subfunction number |
||
114 | mikedld | 1494 | Returned value: |
118 | diamond | 1495 | * eax = port number |
1496 | Parameters: |
||
1497 | * To set base port use subfunction 1 of function 21. |
||
114 | mikedld | 1498 | |
1499 | ====================================================================== |
||
1500 | ========== Function 26, subfunction 2 - get keyboard layout. ========= |
||
1501 | ====================================================================== |
||
118 | diamond | 1502 | The keyboard layout is used to convert keyboard scancodes to |
1503 | ASCII-codes for function 2. |
||
114 | mikedld | 1504 | Parameters: |
118 | diamond | 1505 | * eax = 26 - function number |
1506 | * ebx = 2 - subfunction number |
||
114 | mikedld | 1507 | * ecx = what layout to get: |
1508 | * 1 = normal layout |
||
118 | diamond | 1509 | * 2 = layout with pressed Shift |
1510 | * 3 = layout with pressed Alt |
||
1511 | * edx = pointer to the 128-bytes buffer, where the layout will be |
||
1512 | copied |
||
114 | mikedld | 1513 | Returned value: |
1514 | * function does not return value |
||
118 | diamond | 1515 | Or: |
1516 | * eax = 26 - function number |
||
1517 | * ebx = 2 - subfunction number |
||
114 | mikedld | 1518 | * ecx = 9 |
1519 | Returned value: |
||
118 | diamond | 1520 | * eax = country identifier (1=eng, 2=fi, 3=ger, 4=rus) |
114 | mikedld | 1521 | Remarks: |
118 | diamond | 1522 | * If Alt is pressed, the layout with Alt is used; |
1523 | if Alt is not pressed, but Shift is pressed, |
||
1524 | the layout with Shift is used; |
||
1525 | if Alt and Shift are not pressed, but Ctrl is pressed, the normal |
||
1526 | layout is used and then from the code is subtracted 0x60; |
||
1527 | if no control key is pressed, the normal layout is used. |
||
2409 | Serge | 1528 | * To set layout and country identifier use |
118 | diamond | 1529 | subfunction 2 of function 21. |
1530 | * Country identifier is global system variable, which is not used |
||
1531 | by the kernel itself; however the application '@panel' displays |
||
1532 | the corresponding icon (using this function). |
||
1533 | * The application @panel switches layouts on user request. |
||
114 | mikedld | 1534 | |
1535 | ====================================================================== |
||
118 | diamond | 1536 | ============== Function 26, subfunction 3 - get CD base. ============= |
114 | mikedld | 1537 | ====================================================================== |
1538 | Parameters: |
||
118 | diamond | 1539 | * eax = 26 - function number |
1540 | * ebx = 3 - subfunction number |
||
114 | mikedld | 1541 | Returned value: |
118 | diamond | 1542 | * eax = CD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3 |
114 | mikedld | 1543 | Remarks: |
118 | diamond | 1544 | * CD base is used by function 24. |
1545 | * To set CD base use subfunction 3 of function 21. |
||
114 | mikedld | 1546 | |
1547 | ====================================================================== |
||
118 | diamond | 1548 | ========== Function 26, subfunction 5 - get system language. ========= |
114 | mikedld | 1549 | ====================================================================== |
1550 | Parameters: |
||
118 | diamond | 1551 | * eax = 26 - function number |
1552 | * ebx = 5 - subfunction number |
||
114 | mikedld | 1553 | Returned value: |
118 | diamond | 1554 | * eax = system language (1=eng, 2=fi, 3=ger, 4=rus) |
114 | mikedld | 1555 | Remarks: |
118 | diamond | 1556 | * System language is global system variable and is not used |
1557 | by the kernel itself, however application @panel draws the |
||
1558 | appropriate icon (using this function). |
||
1559 | * To set system language use subfunction 5 of function 21. |
||
114 | mikedld | 1560 | |
1561 | ====================================================================== |
||
118 | diamond | 1562 | ============== Function 26, subfunction 7 - get HD base. ============= |
114 | mikedld | 1563 | ====================================================================== |
118 | diamond | 1564 | The HD base defines hard disk to write with usage of obsolete |
346 | diamond | 1565 | syntax /HD in obsolete function 58; at usage of modern syntax |
1566 | /HD0,/HD1,/HD2,/HD3 base is set automatically. |
||
114 | mikedld | 1567 | Parameters: |
118 | diamond | 1568 | * eax = 26 - function number |
1569 | * ebx = 7 - subfunction number |
||
114 | mikedld | 1570 | Returned value: |
118 | diamond | 1571 | * eax = HD base: 1=IDE0, 2=IDE1, 3=IDE2, 4=IDE3 |
114 | mikedld | 1572 | Remarks: |
118 | diamond | 1573 | * Any application in any time can change HD base. |
1574 | * To set base use subfunction 7 of function 21. |
||
1575 | * To get used partition of hard disk use subfunction 8. |
||
114 | mikedld | 1576 | |
1577 | ====================================================================== |
||
118 | diamond | 1578 | ========= Function 26, subfunction 8 - get used HD partition. ======== |
114 | mikedld | 1579 | ====================================================================== |
118 | diamond | 1580 | The HD partition defines partition of the hard disk to write with |
346 | diamond | 1581 | usage of obsolete syntax /HD in obsolete function 58; |
118 | diamond | 1582 | at usage of functions 58 and 70 and modern syntax /HD0,/HD1,/HD2,/HD3 |
346 | diamond | 1583 | base and partition are set automatically. |
114 | mikedld | 1584 | Parameters: |
118 | diamond | 1585 | * eax = 26 - function number |
1586 | * ebx = 8 - subfunction number |
||
114 | mikedld | 1587 | Returned value: |
118 | diamond | 1588 | * eax = HD partition (beginning from 1) |
114 | mikedld | 1589 | Remarks: |
118 | diamond | 1590 | * Any application in any time can change partition. |
1591 | * To set partition use subfunction 8 of function 21. |
||
1592 | * To get number of partitions on a hard disk use |
||
1593 | subfunction 11 of function 18. |
||
1594 | * To get base of used hard disk, use subfunction 7. |
||
114 | mikedld | 1595 | |
1596 | ====================================================================== |
||
118 | diamond | 1597 | === Function 26, subfunction 9 - get the value of the time counter. == |
114 | mikedld | 1598 | ====================================================================== |
1599 | Parameters: |
||
118 | diamond | 1600 | * eax = 26 - function number |
1601 | * ebx = 9 - subfunction number |
||
114 | mikedld | 1602 | Returned value: |
118 | diamond | 1603 | * eax = number of 1/100s of second, past from the system boot time |
114 | mikedld | 1604 | Remarks: |
118 | diamond | 1605 | * Counter takes modulo 2^32, that correspond to a little more |
1606 | than 497 days. |
||
1607 | * To get system time use function 3. |
||
114 | mikedld | 1608 | |
1609 | ====================================================================== |
||
118 | diamond | 1610 | ===================== Function 26, subfunction 11 ==================== |
1611 | ========== Find out whether low-level HD access is enabled. ========== |
||
114 | mikedld | 1612 | ====================================================================== |
1613 | Parameters: |
||
118 | diamond | 1614 | * eax = 26 - function number |
1615 | * ebx = 11 - subfunction number |
||
114 | mikedld | 1616 | Returned value: |
118 | diamond | 1617 | * eax = 0/1 - disabled/enabled |
114 | mikedld | 1618 | Remarks: |
118 | diamond | 1619 | * Is used in LBA read (subfunction 8 of function 58). |
1620 | * To set current state use subfunction 11 of function 21. |
||
114 | mikedld | 1621 | |
1622 | ====================================================================== |
||
118 | diamond | 1623 | ===================== Function 26, subfunction 12 ==================== |
1624 | ========== Find out whether low-level PCI access is enabled. ========= |
||
114 | mikedld | 1625 | ====================================================================== |
1626 | Parameters: |
||
118 | diamond | 1627 | * eax = 26 - function number |
1628 | * ebx = 12 - subfunction number |
||
114 | mikedld | 1629 | Returned value: |
118 | diamond | 1630 | * eax = 0/1 - disabled/enabled |
114 | mikedld | 1631 | Remarks: |
118 | diamond | 1632 | * Is used by operations with PCI bus (function 62). |
1633 | * The current implementation uses only low bit of ecx. |
||
1634 | * To set the current state use subfunction 12 of function 21. |
||
114 | mikedld | 1635 | |
1636 | ====================================================================== |
||
118 | diamond | 1637 | =================== Function 29 - get system date. =================== |
114 | mikedld | 1638 | ====================================================================== |
1639 | Parameters: |
||
118 | diamond | 1640 | * eax = 29 - function number |
114 | mikedld | 1641 | Returned value: |
1642 | * eax = 0x00DDMMYY, where |
||
118 | diamond | 1643 | (binary-decimal coding, BCD, is used) |
1644 | * YY = two low digits of year (00..99) |
||
1645 | * MM = month (01..12) |
||
1646 | * DD = day (01..31) |
||
114 | mikedld | 1647 | Remarks: |
118 | diamond | 1648 | * To set system date use function 22. |
114 | mikedld | 1649 | |
1650 | ====================================================================== |
||
521 | diamond | 1651 | ============= Function 30 - work with the current folder. ============ |
1652 | ====================================================================== |
||
1653 | |||
1654 | --------- Subfunction 1 - set current folder for the thread. --------- |
||
1655 | Parameters: |
||
1656 | * eax = 30 - function number |
||
1657 | * ebx = 1 - subfunction number |
||
1658 | * ecx = pointer to ASCIIZ-string with the path to new current folder |
||
1659 | Returned value: |
||
1660 | * function does not return value |
||
1661 | |||
1662 | --------- Subfunction 2 - get current folder for the thread. --------- |
||
1663 | Parameters: |
||
1664 | * eax = 30 - function number |
||
1665 | * ebx = 2 - subfunction number |
||
1666 | * ecx = pointer to buffer |
||
1667 | * edx = size of buffer |
||
1668 | Returned value: |
||
1669 | * eax = size of the current folder's name (including terminating 0) |
||
1670 | Remarks: |
||
1671 | * If the buffer is too small to hold all data, only first (edx-1) |
||
1672 | bytes are copied and than terminating 0 is inserted. |
||
1662 | Nasarus | 1673 | * By default, current folder for the thread is "/rd/1". |
2409 | Serge | 1674 | * At process/thread creation the current folder will be inherited |
1662 | Nasarus | 1675 | from the parent. |
521 | diamond | 1676 | |
1677 | ====================================================================== |
||
118 | diamond | 1678 | ======= Function 35 - read the color of a pixel on the screen. ======= |
114 | mikedld | 1679 | ====================================================================== |
1680 | Parameters: |
||
1681 | * eax = 35 |
||
1682 | * ebx = y*xsize+x, where |
||
118 | diamond | 1683 | * (x,y) = coordinates of a pixel (beginning from 0) |
1684 | * xsize = horizontal screen size |
||
114 | mikedld | 1685 | Returned value: |
118 | diamond | 1686 | * eax = color 0x00RRGGBB |
114 | mikedld | 1687 | Remarks: |
118 | diamond | 1688 | * To get screen sizes use function 14. Pay attention, |
1689 | that it subtracts 1 from both sizes. |
||
1690 | * There is also direct access (without any system calls) |
||
1691 | to videomemory through the selector gs. To get parameters of |
||
1692 | the current videomode, use function 61. |
||
114 | mikedld | 1693 | |
1694 | ====================================================================== |
||
1018 | diamond | 1695 | =================== Function 36 - read screen area. ================== |
921 | mario79 | 1696 | ====================================================================== |
1697 | Paramters: |
||
1698 | * eax = 36 - function number |
||
1018 | diamond | 1699 | * ebx = pointer to the previously allocated memory area, |
1700 | where will be placed the image in the format BBGGRRBBGGRR... |
||
921 | mario79 | 1701 | * ecx = [size on axis x]*65536 + [size on axis y] |
1702 | * edx = [coordinate on axis x]*65536 + [coordinate on axis y] |
||
1703 | Returned value: |
||
1704 | * function does not return value |
||
1705 | Remarks: |
||
1706 | * Coordinates of the image are coordinates of the upper left corner |
||
923 | mario79 | 1707 | of the image relative to the screen. |
921 | mario79 | 1708 | * Size of the image in bytes is 3*xsize*ysize. |
1709 | |||
1710 | ====================================================================== |
||
277 | diamond | 1711 | =================== Function 37 - work with mouse. =================== |
114 | mikedld | 1712 | ====================================================================== |
1713 | |||
118 | diamond | 1714 | ---------- Subfunction 0 - screen coordinates of the mouse ----------- |
114 | mikedld | 1715 | Parameters: |
118 | diamond | 1716 | * eax = 37 - function number |
1717 | * ebx = 0 - subfunction number |
||
114 | mikedld | 1718 | Returned value: |
118 | diamond | 1719 | * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer |
1720 | (beginning from 0) |
||
114 | mikedld | 1721 | |
118 | diamond | 1722 | -- Subfunction 1 - coordinates of the mouse relative to the window --- |
114 | mikedld | 1723 | Parameters: |
118 | diamond | 1724 | * eax = 37 - function number |
1725 | * ebx = 1 - subfunction number |
||
114 | mikedld | 1726 | Returned value: |
118 | diamond | 1727 | * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer |
1728 | relative to the application window (beginning from 0) |
||
114 | mikedld | 1729 | Remarks: |
118 | diamond | 1730 | * The value is calculated by formula (x-xwnd)*65536 + (y-ywnd). |
1731 | If y>=ywnd, the low word is non-negative and contains |
||
1732 | relative y-coordinate, and the high word - relative x-coordinate |
||
1733 | (with correct sign). Otherwise the low word is negative and still |
||
1734 | contains relative y-coordinate, and to the high word |
||
1735 | 1 should be added. |
||
114 | mikedld | 1736 | |
118 | diamond | 1737 | ------------ Subfunction 2 - pressed buttons of the mouse ------------ |
114 | mikedld | 1738 | Parameters: |
118 | diamond | 1739 | * eax = 37 - function number |
1740 | * ebx = 2 - subfunction number |
||
114 | mikedld | 1741 | Returned value: |
118 | diamond | 1742 | * eax contains information on the pressed mouse buttons: |
1743 | * bit 0 is set = left button is pressed |
||
1744 | * bit 1 is set = right button is pressed |
||
486 | kastigar | 1745 | * bit 2 is set = middle button is pressed |
1746 | * bit 3 is set = 4th button is pressed |
||
1747 | * bit 4 is set = 5th button is pressed |
||
118 | diamond | 1748 | * other bits are cleared |
114 | mikedld | 1749 | |
277 | diamond | 1750 | -------------------- Subfunction 4 - load cursor --------------------- |
1751 | Parameters: |
||
1752 | * eax = 37 - function number |
||
1753 | * ebx = 4 - subfunction number |
||
1754 | * dx = data source: |
||
1755 | * dx = LOAD_FROM_FILE = 0 - data in a file |
||
1756 | * ecx = pointer to full path to the cursor file |
||
1757 | * the file must be in the format .cur, which is standard for |
||
1758 | MS Windows, at that of the size 32*32 pixels |
||
1759 | * dx = LOAD_FROM_MEM = 1 - data of file are already loaded in memory |
||
1760 | * ecx = pointer to data of the cursor file |
||
1761 | * the data format is the same as in the previous case |
||
1762 | * dx = LOAD_INDIRECT = 2 - data in memory |
||
1763 | * ecx = pointer to cursor image in the format ARGB 32*32 pixels |
||
1764 | * edx = 0xXXYY0002, where |
||
1765 | * XX = x-coordinate of cursor hotspot |
||
1766 | * YY = y-coordinate |
||
1767 | * 0 <= XX, YY <= 31 |
||
1768 | Returned value: |
||
1769 | * eax = 0 - failed |
||
1770 | * otherwise eax = cursor handle |
||
1771 | |||
1772 | --------------------- Subfunction 5 - set cursor --------------------- |
||
1773 | Sets new cursor for the window of the current thread. |
||
1774 | Parameters: |
||
1775 | * eax = 37 - function number |
||
1776 | * ebx = 5 - subfunction number |
||
1777 | * ecx = cursor handle |
||
1778 | Returned value: |
||
1779 | * eax = handle of previous cursor |
||
1780 | Remarks: |
||
1781 | * If the handle is incorrect, the function restores the default |
||
1782 | cursor (standard arrow). In particular, ecx=0 restores it. |
||
1783 | |||
1784 | ------------------- Subfunction 6 - delete cursor -------------------- |
||
1785 | Parameters: |
||
1786 | * eax = 37 - function number |
||
1787 | * ebx = 6 - subfunction number |
||
1788 | * ecx = cursor handle |
||
1789 | Returned value: |
||
1790 | * eax destroyed |
||
1791 | Remarks: |
||
1792 | * The cursor must be loaded previously by the current thread |
||
1793 | (with the call to subfunction 4). The function does not delete |
||
1794 | system cursors and cursors, loaded by another applications. |
||
1795 | * If the active cursor (set by subfunction 5) is deleted, |
||
1796 | the system restores the default cursor (standard arrow). |
||
1797 | |||
499 | diamond | 1798 | ------------------ Subfunction 7 - get scroll data ------------------- |
486 | kastigar | 1799 | Parameters: |
1800 | * eax = 37 - function number |
||
1801 | * ebx = 7 - subfunction number |
||
1802 | Returned value: |
||
499 | diamond | 1803 | * eax = [horizontal offset]*65536 + [vertical offset] |
486 | kastigar | 1804 | Remarks: |
499 | diamond | 1805 | * Scroll data is available for active window only. |
1806 | * Values are zeroed after reading. |
||
1807 | * Values are signed. |
||
486 | kastigar | 1808 | |
114 | mikedld | 1809 | ====================================================================== |
1810 | ====================== Function 38 - draw line. ====================== |
||
1811 | ====================================================================== |
||
1812 | Parameters: |
||
118 | diamond | 1813 | * eax = 38 - function number |
1814 | * ebx = [start coordinate on axis x]*65536 + |
||
1815 | [end coordinate on axis x] |
||
1816 | * ecx = [start coordinate on axis y]*65536 + |
||
1817 | [end coordinate on axis y] |
||
1818 | * edx = 0x00RRGGBB - color |
||
133 | diamond | 1819 | edx = 0x01xxxxxx - draw inversed line |
1820 | (low 24 bits are ignored) |
||
114 | mikedld | 1821 | Returned value: |
1822 | * function does not return value |
||
1823 | Remarks: |
||
118 | diamond | 1824 | * Coordinates are relative to the window. |
1825 | * End point is also drawn. |
||
114 | mikedld | 1826 | |
1827 | ====================================================================== |
||
118 | diamond | 1828 | == Function 39, subfunction 1 - get a size of the background image. == |
114 | mikedld | 1829 | ====================================================================== |
1830 | Parameters: |
||
118 | diamond | 1831 | * eax = 39 - function number |
1832 | * ebx = 1 - subfunction number |
||
114 | mikedld | 1833 | Returned value: |
1834 | * eax = [width]*65536 + [height] |
||
1835 | Remarks: |
||
118 | diamond | 1836 | * There is a pair function to set sizes of background image - |
1837 | subfunction 1 of function 15. After which it is necessary, |
||
1838 | of course, anew to define image. |
||
114 | mikedld | 1839 | |
1840 | ====================================================================== |
||
118 | diamond | 1841 | == Function 39, subfunction 2 - get pixel from the background image. = |
114 | mikedld | 1842 | ====================================================================== |
1843 | Parameters: |
||
118 | diamond | 1844 | * eax = 39 - function number |
1845 | * ebx = 2 - subfunction number |
||
114 | mikedld | 1846 | * ecx = offset |
1847 | Returned value: |
||
118 | diamond | 1848 | * eax = 0x00RRGGBB - pixel color, if offset is valid |
1849 | (less than 0x160000-16) |
||
1850 | * eax = 2 otherwise |
||
114 | mikedld | 1851 | Remarks: |
118 | diamond | 1852 | * Do not rely on returned value for invalid offsets, it may be |
1853 | changed in future kernel versions. |
||
1854 | * Offset for pixel with coordinates (x,y) |
||
1855 | is calculated as (x+y*xsize)*3. |
||
2409 | Serge | 1856 | * There is a pair function to set pixel on the background image - |
118 | diamond | 1857 | subfunction 2 of function 15. |
114 | mikedld | 1858 | |
1859 | ====================================================================== |
||
118 | diamond | 1860 | == Function 39, subfunction 4 - get drawing mode for the background. = |
114 | mikedld | 1861 | ====================================================================== |
1862 | Parameters: |
||
118 | diamond | 1863 | * eax = 39 - function number |
1864 | * ebx = 4 - subfunction number |
||
114 | mikedld | 1865 | Returned value: |
118 | diamond | 1866 | * eax = 1 - tile |
1867 | * eax = 2 - stretch |
||
114 | mikedld | 1868 | Remarks: |
2409 | Serge | 1869 | * There is a pair function to set drawing mode - |
118 | diamond | 1870 | subfunction 4 of function 15. |
114 | mikedld | 1871 | |
1872 | ====================================================================== |
||
118 | diamond | 1873 | =========== Function 40 - set the mask for expected events. ========== |
114 | mikedld | 1874 | ====================================================================== |
118 | diamond | 1875 | The mask for expected events affects function working with events |
1876 | 10, 11, 23 - they notify only about events allowed by this mask. |
||
114 | mikedld | 1877 | Parameters: |
118 | diamond | 1878 | * eax = 40 - function number |
114 | mikedld | 1879 | * ebx = mask: bit i corresponds to event i+1 (see list of events) |
118 | diamond | 1880 | (set bit permits notice on event) |
2414 | Serge | 1881 | bit 31: active/inactive filter |
1882 | bit 31 = 0 - inactive window receive mouse events |
||
1883 | bit 31 = 1 - inactive window does not receive mouse events |
||
1884 | bit 30: cursor position filter |
||
1885 | bit 30 = 0 = the window receive mouse events if cursor |
||
1886 | outside window |
||
1887 | bit 30 = 1 - the window does not receive mouse events if cursor |
||
1888 | outside window |
||
114 | mikedld | 1889 | Returned value: |
1153 | clevermous | 1890 | * eax = previous value of mask |
114 | mikedld | 1891 | Remarks: |
118 | diamond | 1892 | * Default mask (7=111b) enables nofices about redraw, |
1893 | keys and buttons. This is enough for many applications. |
||
1894 | * Events prohibited in the mask are saved anyway, when come; |
||
1895 | they are simply not informed with event functions. |
||
1896 | * Event functions take into account the mask on moment of |
||
1897 | function call, not on moment of event arrival. |
||
114 | mikedld | 1898 | |
1899 | |||
1900 | ====================================================================== |
||
118 | diamond | 1901 | ================ Function 43 - input/output to a port. =============== |
114 | mikedld | 1902 | ====================================================================== |
1903 | |||
118 | diamond | 1904 | ------------------------ Output data to port ------------------------- |
114 | mikedld | 1905 | Parameters: |
118 | diamond | 1906 | * eax = 43 - function number |
114 | mikedld | 1907 | * bl = byte for output |
118 | diamond | 1908 | * ecx = port number 0xnnnn (from 0 to 0xFFFF) |
114 | mikedld | 1909 | Returned value: |
118 | diamond | 1910 | * eax = 0 - success |
1911 | * eax = 1 - the thread has not reserved the selected port |
||
114 | mikedld | 1912 | |
118 | diamond | 1913 | ------------------------ Input data from port ------------------------ |
114 | mikedld | 1914 | Parameters: |
118 | diamond | 1915 | * eax = 43 - function number |
1916 | * ebx is ignored |
||
1917 | * ecx = 0x8000nnnn, where nnnn = port number (from 0 to 0xFFFF) |
||
114 | mikedld | 1918 | Returned value: |
118 | diamond | 1919 | * eax = 0 - success, thus ebx = entered byte |
1920 | * eax = 1 - the thread has not reserved the selected port |
||
114 | mikedld | 1921 | Remarks: |
118 | diamond | 1922 | * Previously the thread must reserve the selected port |
1923 | for itself by function 46. |
||
1924 | * Instead of call to this function it is better to use |
||
1925 | processor instructions in/out - this is much |
||
1926 | faster and a bit shorter and easier. |
||
114 | mikedld | 1927 | |
1928 | |||
1929 | ====================================================================== |
||
118 | diamond | 1930 | ====== Function 46 - reserve/free a group of input/output ports. ===== |
114 | mikedld | 1931 | ====================================================================== |
118 | diamond | 1932 | To work with reserved ports an application can access directly by |
1933 | commands in/out (recommended way) and can use function 43 |
||
1934 | (not recommended way). |
||
114 | mikedld | 1935 | Parameters: |
118 | diamond | 1936 | * eax = 46 - function number |
114 | mikedld | 1937 | * ebx = 0 - reserve, 1 - free |
118 | diamond | 1938 | * ecx = start port number |
1939 | * edx = end port number (inclusive) |
||
114 | mikedld | 1940 | Returned value: |
118 | diamond | 1941 | * eax = 0 - success |
114 | mikedld | 1942 | * eax = 1 - error |
1943 | Remarks: |
||
118 | diamond | 1944 | * For ports reservation: an error occurs if and only if |
1945 | one from the following condition satisfies: |
||
1946 | * start port is more than end port; |
||
1947 | * the selected range contains incorrect port number |
||
1948 | (correct are from 0 to 0xFFFF); |
||
1949 | * limit for the total number of reserved areas is exceeded |
||
1950 | (maximum 255 are allowed); |
||
1951 | * the selected range intersects with any of earlier reserved |
||
1952 | * For ports free: an error is an attempt to free range, |
||
1953 | that was not earlier reserved by this function |
||
1954 | (with same ecx,edx). |
||
1955 | * If an error occurs (for both cases) function performs no action. |
||
277 | diamond | 1956 | * At booting the system reserves for itself ports |
1957 | 0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (inclusively). |
||
118 | diamond | 1958 | * When a thread terminates, all reserved by it ports |
1959 | are freed automatically. |
||
114 | mikedld | 1960 | |
1961 | ====================================================================== |
||
118 | diamond | 1962 | ============= Function 47 - draw a number in the window. ============= |
114 | mikedld | 1963 | ====================================================================== |
1964 | Parameters: |
||
118 | diamond | 1965 | * eax = 47 - function number |
1966 | * ebx = parameters of conversion number to text: |
||
114 | mikedld | 1967 | * bl = 0 - ecx contains number |
665 | diamond | 1968 | * bl = 1 - ecx contains pointer to dword/qword-number |
118 | diamond | 1969 | * bh = 0 - display in decimal number system |
1970 | * bh = 1 - display in hexadecimal system |
||
1971 | * bh = 2 - display in binary system |
||
499 | diamond | 1972 | * bits 16-21 = how many digits to display |
655 | mario79 | 1973 | * bits 22-29 reserved and must be set to 0 |
665 | diamond | 1974 | * bit 30 set = display qword (64-bit) number (must be bl=1) |
1975 | * bit 31 set = do not display leading zeroes of the number |
||
118 | diamond | 1976 | * ecx = number (if bl=0) or pointer (if bl=1) |
114 | mikedld | 1977 | * edx = [coordinate on axis x]*65536 + [coordinate on axis y] |
139 | diamond | 1978 | * esi = 0xX0RRGGBB: |
1979 | * RR, GG, BB specify the color |
||
1980 | * X = ABnn (bits) |
||
1981 | * nn = font (0/1) |
||
1982 | * A is ignored |
||
1983 | * B=1 - fill background with the color edi |
||
114 | mikedld | 1984 | Returned value: |
1985 | * function does not return value |
||
1986 | Remarks: |
||
118 | diamond | 1987 | * The given length must not exceed 60. |
1988 | * The exactly given amount of digits is output. If number is small |
||
1989 | and can be written by smaller amount of digits, it is supplemented |
||
1990 | by leading zeroes; if the number is big and can not be written by |
||
1991 | given amount of digits, extra digits are not drawn. |
||
1992 | * Parameters of fonts are shown in the description of function 4 |
||
1993 | (text output). |
||
114 | mikedld | 1994 | |
1995 | ====================================================================== |
||
118 | diamond | 1996 | ========= Function 48, subfunction 0 - apply screen settings. ======== |
114 | mikedld | 1997 | ====================================================================== |
1998 | Parameters: |
||
118 | diamond | 1999 | * eax = 48 - function number |
2000 | * ebx = 0 - subfunction number |
||
114 | mikedld | 2001 | * ecx = 0 - reserved |
2002 | Returned value: |
||
2003 | * function does not return value |
||
2004 | Remarks: |
||
118 | diamond | 2005 | * Function redraws the screen after parameters change by |
114 | mikedld | 2006 | subfunctions 1 and 2. |
118 | diamond | 2007 | * Function call without prior call to one of indicated subfunctions |
2008 | is ignored. |
||
2009 | * Function call with nonzero ecx is ignored. |
||
114 | mikedld | 2010 | |
2011 | ====================================================================== |
||
118 | diamond | 2012 | =========== Function 48, subfunction 1 - set button style. =========== |
114 | mikedld | 2013 | ====================================================================== |
2014 | Parameters: |
||
118 | diamond | 2015 | * eax = 48 - function number |
2016 | * ebx = 1 - subfunction number |
||
2017 | * ecx = button style: |
||
2018 | * 0 = flat |
||
2019 | * 1 = 3d |
||
114 | mikedld | 2020 | Returned value: |
2021 | * function does not return value |
||
2022 | Remarks: |
||
118 | diamond | 2023 | * After call to this function one should redraw the screen by |
2024 | subfunction 0. |
||
2025 | * Button style influences only to their draw of function 8. |
||
114 | mikedld | 2026 | |
118 | diamond | 2027 | ====================================================================== |
2028 | ====== Function 48, subfunction 2 - set standard window colors. ====== |
||
2029 | ====================================================================== |
||
114 | mikedld | 2030 | Parameters: |
118 | diamond | 2031 | * eax = 48 - function number |
2032 | * ebx = 2 - subfunction number |
||
2033 | * ecx = pointer to the color table |
||
114 | mikedld | 2034 | * edx = size of the color table |
118 | diamond | 2035 | (must be 40 bytes for future compatibility) |
2036 | Format of the color table is shown in description of subfunction 3. |
||
114 | mikedld | 2037 | Returned value: |
2038 | * function does not return value |
||
2039 | Remarks: |
||
118 | diamond | 2040 | * After call to this function one should redraw the screen by |
2041 | subfunction 0. |
||
2042 | * Table of standard colors influences only to applications, |
||
2043 | which receive this table obviously (by subfunction 3) |
||
2044 | and use it (specifying colors from it to drawing functions). |
||
2045 | * Table of standard colors is included in skin and is installed |
||
2046 | anew with skin installation (by subfunction 8). |
||
2047 | * Color table can be viewed/changed interactively with |
||
2048 | the application 'desktop'. |
||
114 | mikedld | 2049 | |
2050 | ====================================================================== |
||
118 | diamond | 2051 | ====== Function 48, subfunction 3 - get standard window colors. ====== |
114 | mikedld | 2052 | ====================================================================== |
2053 | Parameters: |
||
118 | diamond | 2054 | * eax = 48 - function number |
2055 | * ebx = 3 - subfunction number |
||
2056 | * ecx = pointer to the buffer with size edx bytes, |
||
2057 | where table will be written |
||
2058 | * edx = size of color table |
||
2059 | (must be 40 bytes for future compatibility) |
||
114 | mikedld | 2060 | Returned value: |
2061 | * function does not return value |
||
118 | diamond | 2062 | Format of the color table: |
2063 | each item is dword-value for color 0x00RRGGBB |
||
2064 | * +0: dword: frames - color of frame |
||
2065 | * +4: dword: grab - color of header |
||
2066 | * +8: dword: grab_button - color of button on header bar |
||
2067 | * +12 = +0xC: dword: grab_button_text - color of text on button |
||
2068 | on header bar |
||
2069 | * +16 = +0x10: dword: grab_text - color of text on header |
||
2070 | * +20 = +0x14: dword: work - color of working area |
||
2071 | * +24 = +0x18: dword: work_button - color of button in working area |
||
2072 | * +28 = +0x1C: dword: work_button_text - color of text on button |
||
2073 | in working area |
||
2074 | * +32 = +0x20: dword: work_text - color of text in working area |
||
2075 | * +36 = +0x24: dword: work_graph - color of graphics in working area |
||
114 | mikedld | 2076 | Remarks: |
118 | diamond | 2077 | * Structure of the color table is described in the standard |
2078 | include file 'macros.inc' as 'system_colors'; for example, |
||
2079 | it is possible to write: |
||
1662 | Nasarus | 2080 | sc system_colors ; variable declaration |
2081 | ... ; somewhere one must call |
||
2082 | ; this function with ecx=sc |
||
2083 | mov ecx, [sc.work_button_text] ; read text color on |
||
2084 | ; buttin in working area |
||
118 | diamond | 2085 | * A program itself desides to use or not to use color table. |
2086 | For usage program must simply at calls to drawing functions select |
||
2087 | color taken from the table. |
||
2088 | * At change of the table of standard colors (by subfunction 2 with |
||
2089 | the subsequent application of changes by subfunction 0 or |
||
2090 | at skin set by subfunction 8) the system sends to all windows |
||
2091 | redraw message (the event with code 1). |
||
2092 | * Color table can be viewed/changed interactively with |
||
2093 | the application 'desktop'. |
||
114 | mikedld | 2094 | |
2095 | ====================================================================== |
||
118 | diamond | 2096 | ============ Function 48, subfunction 4 - get skin height. =========== |
114 | mikedld | 2097 | ====================================================================== |
2098 | Parameters: |
||
118 | diamond | 2099 | * eax = 48 - function number |
2100 | * ebx = 4 - subfunction number |
||
114 | mikedld | 2101 | Returned value: |
118 | diamond | 2102 | * eax = skin height |
114 | mikedld | 2103 | Remarks: |
118 | diamond | 2104 | * Skin height is defined as the height of a header |
2105 | of skinned windows. |
||
2106 | * See also general structure of window in the description |
||
2107 | of function 0. |
||
114 | mikedld | 2108 | |
2109 | ====================================================================== |
||
118 | diamond | 2110 | ======== Function 48, subfunction 5 - get screen working area. ======= |
114 | mikedld | 2111 | ====================================================================== |
2112 | Parameters: |
||
118 | diamond | 2113 | * eax = 48 - function number |
2114 | * ebx = 5 - subfunction number |
||
114 | mikedld | 2115 | Returned value: |
2116 | * eax = [left]*65536 + [right] |
||
2117 | * ebx = [top]*65536 + [bottom] |
||
2118 | Remarks: |
||
118 | diamond | 2119 | * The screen working area defines position and coordinates of |
2120 | a maximized window. |
||
2121 | * The screen working area in view of normal work is all screen |
||
2122 | without system panel (the application '@panel'). |
||
2123 | * (left,top) are coordinates of the left upper corner, |
||
2124 | (right,bottom) are coordinates of the right lower one. |
||
2125 | Thus the size of working area on x axis can be calculated by |
||
2126 | formula right-left+1, on y axis - by formula bottom-right+1. |
||
2127 | * See also function 14, |
||
2128 | to get sizes of all screen. |
||
2129 | * There is a pair function to set working area - subfunction 6. |
||
114 | mikedld | 2130 | |
2131 | ====================================================================== |
||
118 | diamond | 2132 | ======== Function 48, subfunction 6 - set screen working area. ======= |
114 | mikedld | 2133 | ====================================================================== |
2134 | Parameters: |
||
118 | diamond | 2135 | * eax = 48 - function number |
2136 | * ebx = 6 - subfunction number |
||
114 | mikedld | 2137 | * ecx = [left]*65536 + [right] |
2138 | * edx = [top]*65536 + [bottom] |
||
2139 | Returned value: |
||
2140 | * function does not return value |
||
2141 | Remarks: |
||
118 | diamond | 2142 | * The screen working area defines position and coordinates of |
2143 | a maximized window. |
||
2144 | * This function is used only by the application '@panel', |
||
2145 | which set working area to all screen without system panel. |
||
2146 | * (left,top) are coordinates of the left upper corner, |
||
2147 | (right,bottom) are coordinates of the right lower one. |
||
2148 | Thus the size of working area on x axis can be calculated by |
||
2149 | formula right-left+1, on y axis - by formula bottom-right+1. |
||
2150 | * If 'left'>='right', x-coordinate of working area is not changed. |
||
2151 | If 'left'<0, 'left' will not be set. If 'right' is greater than or |
||
2152 | equal to screen width, 'right' will not be set. |
||
2153 | Similarly on y axis. |
||
2154 | * See also function 14, |
||
2155 | to get sizes of all screen. |
||
2156 | * There is a pair function to get working area - subfunction 5. |
||
2157 | * This function redraws the screen automatically, |
||
2158 | updating coordinates and sizes of maximized windows. |
||
2159 | The system sends to all windows redraw message (the event 1). |
||
114 | mikedld | 2160 | |
2161 | ====================================================================== |
||
118 | diamond | 2162 | =========== Function 48, subfunction 7 - get skin margins. =========== |
114 | mikedld | 2163 | ====================================================================== |
118 | diamond | 2164 | Returns the area of a header of a skinned window, intended for |
2165 | a text of a header. |
||
114 | mikedld | 2166 | Parameters: |
118 | diamond | 2167 | * eax = 48 - function number |
2168 | * ebx = 7 - subfunction number |
||
114 | mikedld | 2169 | Returned value: |
2170 | * eax = [left]*65536 + [right] |
||
2171 | * ebx = [top]*65536 + [bottom] |
||
2172 | Remarks: |
||
118 | diamond | 2173 | * An application decides itself to use or not to use this function. |
2174 | * It is recommended to take into account returned value |
||
2175 | of this function for choice of a place for drawing header text |
||
2176 | (by function 4) or a substitute of header text |
||
2177 | (at the discretion of an application). |
||
114 | mikedld | 2178 | |
2179 | ====================================================================== |
||
118 | diamond | 2180 | ============= Function 48, subfunction 8 - set used skin. ============ |
114 | mikedld | 2181 | ====================================================================== |
2182 | Parameters: |
||
118 | diamond | 2183 | * eax = 48 - function number |
2184 | * ebx = 8 - subfunction number |
||
2185 | * ecx = pointer to a block for function 58, in |
||
2186 | which the fields of intermediate buffer and file name are filled |
||
114 | mikedld | 2187 | Returned value: |
118 | diamond | 2188 | * eax = 0 - success |
2189 | * otherwise eax = file system error code; if file does not |
||
2190 | contain valid skin, function returns error 3 |
||
2191 | (unknown file system). |
||
114 | mikedld | 2192 | Remarks: |
118 | diamond | 2193 | * After successful skin loading the system sends to all windows |
2194 | redraw message (the event 1). |
||
2195 | * At booting the system reads skin from file 'default.skn' |
||
2196 | on ramdisk. |
||
2197 | * User can change the skin statically by creating hisself |
||
2198 | 'default.skn' or dynamically with the application 'desktop'. |
||
114 | mikedld | 2199 | |
2200 | ====================================================================== |
||
118 | diamond | 2201 | =========== Function 49 - Advanced Power Management (APM). =========== |
114 | mikedld | 2202 | ====================================================================== |
2203 | Parameters: |
||
118 | diamond | 2204 | * eax = 49 - function number |
2205 | * dx = number of the APM function |
||
2206 | (analogue of ax in APM specification) |
||
2207 | * bx, cx = parameters of the APM function |
||
114 | mikedld | 2208 | Returned value: |
118 | diamond | 2209 | * 16-bit registers ax, bx, cx, dx, si, di and carry flag CF |
2210 | are set according to the APM specification |
||
2211 | * high halves of 32-bit registers eax, ebx, ecx, |
||
2212 | edx, esi, edi are destroyed |
||
114 | mikedld | 2213 | Remarks: |
118 | diamond | 2214 | * APM 1.2 specification is described in the document |
2215 | "Advanced Power Management (APM) BIOS Specification" |
||
2216 | (Revision 1.2), available at |
||
114 | mikedld | 2217 | http://www.microsoft.com/whdc/archive/amp_12.mspx; |
118 | diamond | 2218 | besides it is included in famous Interrupt List by Ralf Brown |
114 | mikedld | 2219 | (http://www.pobox.com/~ralf/files.html, |
2220 | ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/). |
||
2221 | |||
2222 | ====================================================================== |
||
118 | diamond | 2223 | =================== Function 50 - set window shape. ================== |
114 | mikedld | 2224 | ====================================================================== |
118 | diamond | 2225 | Normal windows have rectangular shape. This function can give to |
2226 | a window any shape. The shape is given by a set of points inside |
||
2227 | the base rectangle belonging to a window. Position and coordinates |
||
2228 | of the base rectangle are set by function 0 |
||
2229 | and changed by function 67. |
||
114 | mikedld | 2230 | |
118 | diamond | 2231 | --------------------------- Set shape data --------------------------- |
114 | mikedld | 2232 | Parameters: |
118 | diamond | 2233 | * eax = 50 - function number |
2234 | * ebx = 0 - subfunction number |
||
2235 | * ecx = pointer to shape data (array of bytes 0/1) |
||
114 | mikedld | 2236 | Returned value: |
2237 | * function does not return value |
||
2238 | |||
118 | diamond | 2239 | -------------------------- Set shape scale --------------------------- |
114 | mikedld | 2240 | Parameters: |
118 | diamond | 2241 | * eax = 50 - function number |
2242 | * ebx = 1 - subfunction number |
||
2243 | * ecx sets a scale: each byte of data defines |
||
2244 | (2^scale)*(2^scale) pixels |
||
114 | mikedld | 2245 | Returned value: |
2246 | * function does not return value |
||
2247 | Remarks: |
||
118 | diamond | 2248 | * Default scale is 0 (scale factor is 1). If in the shape data |
2249 | one byte corresponds to one pixel, there is no necessity |
||
2250 | to set scale. |
||
2251 | * Let's designate xsize = window width (in pixels), ysize = height; |
||
2252 | pay attention, that they are one pixel more than defined by |
||
114 | mikedld | 2253 | functions 0, 67. |
118 | diamond | 2254 | * On definition of scale xsize and ysize must be divisible |
2255 | on 2^scale. |
||
2256 | * Byte of data on offset 'a' must be 0/1 and defines belonging |
||
2257 | to a window of square with the side 2^scale (if scale=0, |
||
2258 | this is one pixel) and coordinates of the left upper corner |
||
114 | mikedld | 2259 | (a mod (xsize shr scale), a div (xsize shr scale)) |
118 | diamond | 2260 | * Data size: (xsize shr scale)*(ysize shr scale). |
2261 | * Data must be presented in the memory and not change |
||
2262 | after set of shape. |
||
2263 | * The system views the shape data at every window redraw by |
||
2264 | function 0. |
||
2265 | * The call of subfunction 0 with NULL pointer results in return |
||
2266 | to the rectangular shape. |
||
114 | mikedld | 2267 | |
2268 | ====================================================================== |
||
2269 | ==================== Function 51 - create thread. ==================== |
||
2270 | ====================================================================== |
||
2271 | Parameters: |
||
118 | diamond | 2272 | * eax = 51 - function number |
2273 | * ebx = 1 - unique subfunction |
||
2274 | * ecx = address of thread entry point (starting eip) |
||
2275 | * edx = pointer to thread stack (starting esp) |
||
114 | mikedld | 2276 | Returned value: |
118 | diamond | 2277 | * eax = -1 - error (there is too many threads) |
2278 | * otherwise eax = TID - thread identifier |
||
2409 | Serge | 2279 | |
114 | mikedld | 2280 | |
2281 | ====================================================================== |
||
118 | diamond | 2282 | === Function 52, subfunction 0 - get network driver configuration. === |
114 | mikedld | 2283 | ====================================================================== |
2284 | Parameters: |
||
118 | diamond | 2285 | * eax = 52 - function number |
2286 | * ebx = 0 - subfunction number |
||
114 | mikedld | 2287 | Returned value: |
118 | diamond | 2288 | * eax = configuration dword |
114 | mikedld | 2289 | Remarks: |
118 | diamond | 2290 | * Configuration dword can be set by subfunction 2. |
2291 | * The kernel does not use this variable. The value of this |
||
2292 | variable and working with it subfunctions 0 and 2 is represented |
||
2293 | doubtful. |
||
114 | mikedld | 2294 | |
2295 | ====================================================================== |
||
118 | diamond | 2296 | ========= Function 52, subfunction 1 - get local IP-address. ========= |
114 | mikedld | 2297 | ====================================================================== |
2298 | Parameters: |
||
118 | diamond | 2299 | * eax = 52 - function number |
2300 | * ebx = 1 - subfunction number |
||
114 | mikedld | 2301 | Returned value: |
2302 | * eax = IP-address (4 bytes) |
||
2303 | Remarks: |
||
118 | diamond | 2304 | * Local IP-address is set by subfunction 3. |
114 | mikedld | 2305 | |
2306 | ====================================================================== |
||
118 | diamond | 2307 | === Function 52, subfunction 2 - set network driver configuration. === |
114 | mikedld | 2308 | ====================================================================== |
2309 | Parameters: |
||
118 | diamond | 2310 | * eax = 52 - function number |
2311 | * ebx = 2 - subfunction number |
||
2312 | * ecx = configuration dword; if low 7 bits derivate the number 3, |
||
2313 | function [re-]initializes Ethernet-card, otherwise |
||
2314 | Ethernet turns off |
||
114 | mikedld | 2315 | Returned value: |
118 | diamond | 2316 | * if Ethernet-interface is not requested, function returns eax=2, |
2317 | but this can be changed in future kernel versions |
||
2318 | * if Ethernet-interface is requested, eax=0 means error |
||
2319 | (absence of Ethernet-card), and nonzero value - success |
||
114 | mikedld | 2320 | Remarks: |
118 | diamond | 2321 | * Configuration dword can be read by subfunction 0. |
2322 | * The kernel does not use this variable. The value of this |
||
2323 | variable, subfunction 0 and part of subfunction 2, which set it, |
||
114 | mikedld | 2324 | is represented doubtful. |
2325 | |||
2326 | ====================================================================== |
||
2327 | ========= Function 52, subfunction 3 - set local IP-address. ========= |
||
2328 | ====================================================================== |
||
2329 | Parameters: |
||
118 | diamond | 2330 | * eax = 52 - function number |
2331 | * ebx = 3 - subfunction number |
||
114 | mikedld | 2332 | * ecx = IP-address (4 bytes) |
2333 | Returned value: |
||
118 | diamond | 2334 | * the current implementation returns eax=3, but this can be changed |
2335 | in future versions |
||
114 | mikedld | 2336 | Remarks: |
118 | diamond | 2337 | * Local IP-address can be get by subfunction 1. |
114 | mikedld | 2338 | |
2339 | ====================================================================== |
||
118 | diamond | 2340 | = Function 52, subfunction 6 - add data to the stack of input queue. = |
114 | mikedld | 2341 | ====================================================================== |
2342 | Parameters: |
||
118 | diamond | 2343 | * eax = 52 - function number |
2344 | * ebx = 6 - subfunction number |
||
2345 | * edx = data size |
||
2346 | * esi = data pointer |
||
114 | mikedld | 2347 | Returned value: |
2348 | * eax = -1 - error |
||
118 | diamond | 2349 | * eax = 0 - success |
114 | mikedld | 2350 | Remarks: |
118 | diamond | 2351 | * This function is intended only for slow network drivers |
2352 | (PPP, SLIP). |
||
2353 | * Data size must not exceed 1500 bytes, though function |
||
2354 | performs no checks on correctness. |
||
114 | mikedld | 2355 | |
2356 | ====================================================================== |
||
2409 | Serge | 2357 | Function 52, subfunction 8 - read data from the network output queue. |
114 | mikedld | 2358 | ====================================================================== |
2359 | Parameters: |
||
118 | diamond | 2360 | * eax = 52 - function number |
2361 | * ebx = 8 - subfunction number |
||
2362 | * esi = pointer to 1500-byte buffer |
||
114 | mikedld | 2363 | Returned value: |
118 | diamond | 2364 | * eax = number of read bytes (in the current implementation |
2365 | either 0 = no data or 1500) |
||
2366 | * data was copied in buffer |
||
114 | mikedld | 2367 | Remarks: |
118 | diamond | 2368 | * This function is intended only for slow network drivers |
2369 | (PPP, SLIP). |
||
114 | mikedld | 2370 | |
2371 | ====================================================================== |
||
118 | diamond | 2372 | ============ Function 52, subfunction 9 - get gateway IP. ============ |
114 | mikedld | 2373 | ====================================================================== |
2374 | Parameters: |
||
118 | diamond | 2375 | * eax = 52 - function number |
2376 | * ebx = 9 - subfunction number |
||
114 | mikedld | 2377 | Returned value: |
2378 | * eax = gateway IP (4 bytes) |
||
2379 | |||
2380 | ====================================================================== |
||
118 | diamond | 2381 | =========== Function 52, subfunction 10 - get subnet mask. =========== |
114 | mikedld | 2382 | ====================================================================== |
2383 | Parameters: |
||
118 | diamond | 2384 | * eax = 52 - function number |
2385 | * ebx = 10 - subfunction number |
||
114 | mikedld | 2386 | Returned value: |
118 | diamond | 2387 | * eax = subnet mask |
114 | mikedld | 2388 | |
2389 | ====================================================================== |
||
118 | diamond | 2390 | ============ Function 52, subfunction 11 - set gateway IP. =========== |
114 | mikedld | 2391 | ====================================================================== |
2392 | Parameters: |
||
118 | diamond | 2393 | * eax = 52 - function number |
2394 | * ebx = 11 - subfunction number |
||
114 | mikedld | 2395 | * ecx = gateway IP (4 bytes) |
2396 | Returned value: |
||
118 | diamond | 2397 | * the current implementation returns eax=11, but this can be changed |
2398 | in future versions |
||
114 | mikedld | 2399 | |
2400 | ====================================================================== |
||
118 | diamond | 2401 | =========== Function 52, subfunction 12 - set subnet mask. =========== |
114 | mikedld | 2402 | ====================================================================== |
2403 | Parameters: |
||
118 | diamond | 2404 | * eax = 52 - function number |
2405 | * ebx = 12 - subfunction number |
||
2406 | * ecx = subnet mask |
||
114 | mikedld | 2407 | Returned value: |
118 | diamond | 2408 | * the current implementation returns eax=12, but this can be changed |
2409 | in future versions |
||
114 | mikedld | 2410 | |
2411 | ====================================================================== |
||
118 | diamond | 2412 | ============== Function 52, subfunction 13 - get DNS IP. ============= |
114 | mikedld | 2413 | ====================================================================== |
2414 | Parameters: |
||
118 | diamond | 2415 | * eax = 52 - function number |
2416 | * ebx = 13 - subfunction number |
||
114 | mikedld | 2417 | Returned value: |
2418 | * eax = DNS IP (4 bytes) |
||
2419 | |||
2420 | ====================================================================== |
||
118 | diamond | 2421 | ============== Function 52, subfunction 14 - set DNS IP. ============= |
114 | mikedld | 2422 | ====================================================================== |
2423 | Parameters: |
||
118 | diamond | 2424 | * eax = 52 - function number |
2425 | * ebx = 14 - subfunction number |
||
114 | mikedld | 2426 | * ecx = DNS IP (4 bytes) |
2427 | Returned value: |
||
118 | diamond | 2428 | * the current implementation returns eax=14, but this can be changed |
2429 | in future versions |
||
114 | mikedld | 2430 | |
2431 | ====================================================================== |
||
277 | diamond | 2432 | ======== Function 52, subfunction 15 - get local MAC address. ======== |
2433 | ====================================================================== |
||
2434 | Parameters: |
||
2435 | * eax = 52 - function number |
||
2436 | * ebx = 15 - subfunction number |
||
2437 | * ecx = 0 - read first 4 bytes, |
||
2438 | ecx = 4 - read last 2 bytes |
||
2439 | Returned value: |
||
2440 | * for ecx=0: eax = first 4 bytes of MAC address |
||
2441 | * for ecx=4: ax = last 2 bytes of MAC address, |
||
2442 | high half of eax is destroyed |
||
2443 | * for other ecx: eax = -1 indicates an error |
||
2444 | |||
2445 | ====================================================================== |
||
118 | diamond | 2446 | ============ Function 53, subfunction 0 - open UDP-socket. =========== |
114 | mikedld | 2447 | ====================================================================== |
2448 | Parameters: |
||
118 | diamond | 2449 | * eax = 53 - function number |
2450 | * ebx = 0 - subfunction number |
||
1154 | clevermous | 2451 | * ecx = local port (only low word is taken into account), |
2452 | ecx = 0 - let the system choose a port |
||
118 | diamond | 2453 | * edx = remote port (only low word is taken into account) |
114 | mikedld | 2454 | * esi = remote IP |
2455 | Returned value: |
||
118 | diamond | 2456 | * eax = -1 = 0xFFFFFFFF - error; ebx destroyed |
2457 | * eax = socket handle (some number which unambiguously identifies |
||
2458 | socket and have sense only for the system) - success; |
||
2459 | ebx destroyed |
||
114 | mikedld | 2460 | |
2461 | ====================================================================== |
||
118 | diamond | 2462 | =========== Function 53, subfunction 1 - close UDP-socket. =========== |
114 | mikedld | 2463 | ====================================================================== |
2464 | Parameters: |
||
118 | diamond | 2465 | * eax = 53 - function number |
2466 | * ebx = 1 - subfunction number |
||
2467 | * ecx = socket handle |
||
114 | mikedld | 2468 | Returned value: |
118 | diamond | 2469 | * eax = -1 - incorrect handle |
2470 | * eax = 0 - success |
||
2471 | * ebx destroyed |
||
114 | mikedld | 2472 | Remarks: |
118 | diamond | 2473 | * The current implementation does not close automatically all |
2474 | sockets of a thread at termination. In particular, one should not |
||
2475 | kill a thread with many opened sockets - there will be an outflow |
||
2476 | of resources. |
||
114 | mikedld | 2477 | |
2478 | ====================================================================== |
||
2479 | ============== Function 53, subfunction 2 - poll socket. ============= |
||
2480 | ====================================================================== |
||
2481 | Parameters: |
||
118 | diamond | 2482 | * eax = 53 - function number |
2483 | * ebx = 2 - subfunction number |
||
2484 | * ecx = socket handle |
||
114 | mikedld | 2485 | Returned value: |
1018 | diamond | 2486 | * eax = number of read bytes, 0 for incorrect handle |
118 | diamond | 2487 | * ebx destroyed |
114 | mikedld | 2488 | |
2489 | ====================================================================== |
||
118 | diamond | 2490 | ========= Function 53, subfunction 3 - read byte from socket. ======== |
114 | mikedld | 2491 | ====================================================================== |
2492 | Parameters: |
||
118 | diamond | 2493 | * eax = 53 - function number |
2494 | * ebx = 3 - subfunction number |
||
2495 | * ecx = socket handle |
||
114 | mikedld | 2496 | Returned value: |
1018 | diamond | 2497 | * if there is no read data or handle is incorrect: eax=0, bl=0, |
118 | diamond | 2498 | other bytes of ebx are destroyed |
2499 | * if there are read data: eax=number of rest bytes |
||
2500 | (possibly 0), bl=read byte, other bytes of ebx are destroyed |
||
114 | mikedld | 2501 | |
2502 | ====================================================================== |
||
118 | diamond | 2503 | ========== Function 53, subfunction 4 - write to UDP-socket. ========= |
114 | mikedld | 2504 | ====================================================================== |
2505 | Parameters: |
||
118 | diamond | 2506 | * eax = 53 - function number |
2507 | * ebx = 4 - subfunction number |
||
2508 | * ecx = socket handle |
||
2509 | * edx = number of bytes to write |
||
2510 | * esi = pointer to data to write |
||
114 | mikedld | 2511 | Returned value: |
1018 | diamond | 2512 | * eax = 0xffffffff - error (invalid handle or not enough memory) |
118 | diamond | 2513 | * eax = 0 - success |
2514 | * ebx destroyed |
||
114 | mikedld | 2515 | Remarks: |
118 | diamond | 2516 | * Number of bytes to write must not exceed 1500-28, though |
2517 | the appropriate check is not made. |
||
114 | mikedld | 2518 | |
2519 | ====================================================================== |
||
2520 | ============ Function 53, subfunction 5 - open TCP-socket. =========== |
||
2521 | ====================================================================== |
||
2522 | Parameters: |
||
118 | diamond | 2523 | * eax = 53 - function number |
2524 | * ebx = 5 - subfunction number |
||
1154 | clevermous | 2525 | * ecx = local port (only low word is taken into account), |
2526 | ecx = 0 - let the system choose a port |
||
118 | diamond | 2527 | * edx = remote port (only low word is taken into account) |
114 | mikedld | 2528 | * esi = remote IP |
118 | diamond | 2529 | * edi = open mode: SOCKET_PASSIVE=0 or SOCKET_ACTIVE=1 |
114 | mikedld | 2530 | Returned value: |
118 | diamond | 2531 | * eax = -1 = 0xFFFFFFFF - error; ebx destroys |
2532 | * eax = socket handle (some number which unambiguously identifies |
||
2533 | socket and have sense only for the system) - success; |
||
2534 | ebx destroyed |
||
114 | mikedld | 2535 | |
2536 | ====================================================================== |
||
118 | diamond | 2537 | ========= Function 53, subfunction 6 - get TCP-socket status. ======== |
114 | mikedld | 2538 | ====================================================================== |
2539 | Parameters: |
||
118 | diamond | 2540 | * eax = 53 - function number |
2541 | * ebx = 6 - subfunction number |
||
2542 | * ecx = socket handle |
||
114 | mikedld | 2543 | Returned value: |
1018 | diamond | 2544 | * eax = 0 for incorrect handle or socket status: one of |
114 | mikedld | 2545 | * TCB_LISTEN = 1 |
2546 | * TCB_SYN_SENT = 2 |
||
2547 | * TCB_SYN_RECEIVED = 3 |
||
2548 | * TCB_ESTABLISHED = 4 |
||
2549 | * TCB_FIN_WAIT_1 = 5 |
||
2550 | * TCB_FIN_WAIT_2 = 6 |
||
2551 | * TCB_CLOSE_WAIT = 7 |
||
2552 | * TCB_CLOSING = 8 |
||
2553 | * TCB_LAST_ASK = 9 |
||
2554 | * TCB_TIME_WAIT = 10 |
||
2555 | * TCB_CLOSED = 11 |
||
1018 | diamond | 2556 | * ebx destroyed |
114 | mikedld | 2557 | |
2558 | ====================================================================== |
||
118 | diamond | 2559 | ========== Function 53, subfunction 7 - write to TCP-socket. ========= |
114 | mikedld | 2560 | ====================================================================== |
2561 | Parameters: |
||
118 | diamond | 2562 | * eax = 53 - function number |
2563 | * ebx = 7 - subfunction number |
||
2564 | * ecx = socket handle |
||
2565 | * edx = number of bytes to write |
||
2566 | * esi = pointer to data to write |
||
114 | mikedld | 2567 | Returned value: |
1018 | diamond | 2568 | * eax = 0xffffffff - error (invalid handle or not enough memory) |
118 | diamond | 2569 | * eax = 0 - success |
2570 | * ebx destroyed |
||
114 | mikedld | 2571 | Remarks: |
118 | diamond | 2572 | * Number of bytes to write must not exceed 1500-40, though |
2573 | the appropriate check is not made. |
||
114 | mikedld | 2574 | |
2575 | ====================================================================== |
||
118 | diamond | 2576 | =========== Function 53, subfunction 8 - close TCP-socket. =========== |
114 | mikedld | 2577 | ====================================================================== |
2578 | Parameters: |
||
118 | diamond | 2579 | * eax = 53 - function number |
2580 | * ebx = 8 - subfunction number |
||
2581 | * ecx = socket handle |
||
114 | mikedld | 2582 | Returned value: |
1018 | diamond | 2583 | * eax = -1 - error (invalid handle or |
2584 | not enough memory for socket close packet) |
||
118 | diamond | 2585 | * eax = 0 - success |
2586 | * ebx destroyed |
||
114 | mikedld | 2587 | Remarks: |
118 | diamond | 2588 | * The current implementation does not close automatically all |
2589 | sockets of a thread at termination. In particular, one should not |
||
2590 | kill a thread with many opened sockets - there will be an outflow |
||
2591 | of resources. |
||
114 | mikedld | 2592 | |
2593 | ====================================================================== |
||
118 | diamond | 2594 | === Function 53, subfunction 9 - check whether local port is free. === |
114 | mikedld | 2595 | ====================================================================== |
2596 | Parameters: |
||
118 | diamond | 2597 | * eax = 53 - function number |
2598 | * ebx = 9 - subfunction number |
||
2599 | * ecx = local port number (low 16 bits are used only) |
||
114 | mikedld | 2600 | Returned value: |
2601 | * eax = 0 - port is used |
||
2602 | * eax = 1 - port is free |
||
118 | diamond | 2603 | * ebx destroyed |
114 | mikedld | 2604 | |
2605 | ====================================================================== |
||
314 | diamond | 2606 | ===== Function 53, subfunction 10 - query Ethernet cable status. ===== |
2607 | ====================================================================== |
||
2608 | Parameters: |
||
2609 | * eax = 53 - function number |
||
2610 | * ebx = 10 - subfunction number |
||
2611 | Returned value: |
||
2612 | * al = -1 - a network driver is not loaded or |
||
2613 | does not support this function |
||
2614 | * al = 0 - Ethernet cable is unplugged |
||
2615 | * al = 1 - Ethernet cable is plugged |
||
346 | diamond | 2616 | * ebx destroyed |
314 | diamond | 2617 | Remarks: |
2618 | * The current kernel implementation supports this function |
||
2619 | only for RTL8139 network cards. |
||
2620 | |||
2621 | ====================================================================== |
||
346 | diamond | 2622 | ======= Function 53, subfunction 11 - read network stack data. ======= |
340 | heavyiron | 2623 | ====================================================================== |
346 | diamond | 2624 | Paramters: |
2625 | * eax = 53 - function number |
||
2626 | * ebx = 11 - subfunction number |
||
2627 | * ecx = socket handle |
||
2628 | * edx = pointer to buffer |
||
2629 | * esi = number of bytes to read; |
||
2630 | * esi = 0 - read all data (maximum 4096 bytes) |
||
2631 | Returned value: |
||
1018 | diamond | 2632 | * eax = number of bytes read (0 for incorrect handle) |
346 | diamond | 2633 | * ebx destroyed |
340 | heavyiron | 2634 | |
2635 | ====================================================================== |
||
2409 | Serge | 2636 | = Function 53, subfunction 255 - debug information of network driver. |
114 | mikedld | 2637 | ====================================================================== |
2638 | Parameters: |
||
118 | diamond | 2639 | * eax = 53 - function number |
2640 | * ebx = 255 - subfunction number |
||
114 | mikedld | 2641 | * ecx = type of requested information (see below) |
2642 | Returned value: |
||
2643 | * eax = requested information |
||
118 | diamond | 2644 | * ebx destroyed |
2645 | Possible values for ecx: |
||
114 | mikedld | 2646 | * 100: length of queue 0 (empty queue) |
2647 | * 101: length of queue 1 (ip-out queue) |
||
2648 | * 102: length of queue 2 (ip-in queue) |
||
2649 | * 103: length of queue 3 (net1out queue) |
||
118 | diamond | 2650 | * 200: number of items in the ARP table |
2651 | * 201: size of the ARP table (in items) (20 for current version) |
||
2652 | * 202: read item at edx of the ARP table to the temporary buffer, |
||
2653 | whence 5 following types take information; |
||
114 | mikedld | 2654 | in this case eax is not defined |
118 | diamond | 2655 | * 203: IP-address saved by type 202 |
2656 | * 204: high dword of MAC-address saved by type 202 |
||
2657 | * 205: low word of MAC-address saved by type 202 |
||
2658 | * 206: status word saved by type 202 |
||
2659 | * 207: ttl word saved by type 202 |
||
2660 | * 2: total number of received IP-packets |
||
2661 | * 3: total number of transferred IP-packets |
||
2662 | * 4: total number of dumped received packets |
||
2663 | * 5: total number of received ARP-packets |
||
2664 | * 6: status of packet driver, 0=inactive, nonzero=active |
||
114 | mikedld | 2665 | |
2666 | ====================================================================== |
||
2409 | Serge | 2667 | Function 55, subfunction 55 - begin to play data on built-in speaker. |
114 | mikedld | 2668 | ====================================================================== |
2669 | Parameters: |
||
118 | diamond | 2670 | * eax = 55 - function number |
2671 | * ebx = 55 - subfunction number |
||
2672 | * esi = pointer to data |
||
114 | mikedld | 2673 | Returned value: |
118 | diamond | 2674 | * eax = 0 - success |
2675 | * eax = 55 - error (speaker is off or busy) |
||
2676 | Data is an array of items with variable length. |
||
2677 | Format of each item is defined by first byte: |
||
114 | mikedld | 2678 | * 0 = end of data |
118 | diamond | 2679 | * 1..0x80 = sets sound duration on 1/100 of second; sound note |
2680 | is defined by immediate value of frequency |
||
2681 | * following word (2 bytes) contains frequency divider; |
||
2682 | frequency is defined as 1193180/divider |
||
114 | mikedld | 2683 | * 0x81 = invalid |
118 | diamond | 2684 | * 0x82..0xFF = note is defined by octave and number: |
2685 | * duration in 1/100 of second = (first byte)-0x81 |
||
114 | mikedld | 2686 | * there is one more byte; |
118 | diamond | 2687 | * (second byte)=0xFF - delay |
2688 | * otherwise it looks like a*0x10+b, where b=number of the note in |
||
2689 | an octave from 1 to 12, a=number of octave (beginning from 0) |
||
114 | mikedld | 2690 | Remarks: |
118 | diamond | 2691 | * Speaker play can be disabled/enabled by |
2692 | subfunction 8 of function 18. |
||
2693 | * Function returns control, having informed the system |
||
2694 | an information on request. Play itself goes independently from |
||
2695 | the program. |
||
2696 | * The data must be kept in the memory at least up to the end |
||
2697 | of play. |
||
114 | mikedld | 2698 | |
2699 | ====================================================================== |
||
641 | diamond | 2700 | ======================= Function 57 - PCI BIOS. ====================== |
2701 | ====================================================================== |
||
2702 | Parameters: |
||
2703 | * eax = 57 - function number |
||
2704 | * ebp corresponds to al in PCI BIOS specification |
||
2705 | * other registers are set according to PCI BIOS specification |
||
2706 | Returned value: |
||
2707 | * CF is undefined |
||
2708 | * other registers are set according to PCI BIOS specification |
||
2709 | Remarks: |
||
2710 | * Many effects of this function can be also achieved with |
||
2711 | corresponding subfunctions of function 62. |
||
2712 | * The function calls PCI32 BIOS extension, documented e.g. in |
||
2713 | http://alpha1.dyns.net/files/PCI/bios21.pdf. |
||
2714 | * If BIOS does not support this extension, its behavior is emulated |
||
2715 | (through kernel-mode analogues of subfunctions of function 62). |
||
2716 | |||
2717 | ====================================================================== |
||
118 | diamond | 2718 | ================ Function 58 - work with file system. ================ |
114 | mikedld | 2719 | ====================================================================== |
2720 | Parameters: |
||
2721 | * eax = 58 |
||
118 | diamond | 2722 | * ebx = pointer to the information structure |
114 | mikedld | 2723 | Returned value: |
118 | diamond | 2724 | * eax = 0 - success; otherwise file system error code |
2725 | * some subfunctions return value in other registers too |
||
2726 | General format of the information structure: |
||
2727 | * +0: dword: subfunction number |
||
114 | mikedld | 2728 | * +4: dword: number of block |
2729 | * +8: dword: size |
||
118 | diamond | 2730 | * +12 = +0xC: dword: pointer to data |
2731 | * +16 = +0x10: dword: pointer to a memory for system operations |
||
114 | mikedld | 2732 | (4096 bytes) |
118 | diamond | 2733 | * +20 = +0x14: n db: ASCIIZ-string with the file name |
2734 | Specifications - in documentation on the appropriate subfunction. |
||
2735 | Filename is case-insensitive for latin letters, russian letters |
||
2736 | must be capital. |
||
2737 | Format of filename: |
||
114 | mikedld | 2738 | /base/number/dir1/dir2/.../dirn/file, |
118 | diamond | 2739 | where /base/number identifies device, on which file is located: |
114 | mikedld | 2740 | one of |
118 | diamond | 2741 | * /RD/1 = /RAMDISK/1 to access ramdisk |
2742 | * /FD/1 = /FLOPPYDISK/1 to access first floppy drive, |
||
2743 | /FD/2 = /FLOPPYDISK/2 to access second one |
||
2744 | * /HD/x = /HARDDISK/x - obsolete variant of access to hard disk |
||
2745 | (in this case base is defined by subfunction 7 of function 21), |
||
2746 | x - partition number (beginning from 1) |
||
2747 | * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices |
||
2748 | IDE0 (Primary Master), IDE1 (Primary Slave), |
||
114 | mikedld | 2749 | IDE2 (Secondary Master), IDE3 (Secondary Slave); |
118 | diamond | 2750 | x - partition number on the selected hard drive, varies from 1 |
2751 | to 255 (on each hard drive the indexing starts from 1) |
||
114 | mikedld | 2752 | Remarks: |
118 | diamond | 2753 | * In the first two cases it is also possible to use FIRST |
2754 | instead of 1, SECOND instead of 2, but it is not recommended |
||
2755 | for convenience of transition to the future extensions. |
||
2756 | * Limitation n<=39 is imposed. |
||
2757 | * Names of folders and file dir1,...,dirn,file must have the |
||
2758 | format 8.3: name no more than 8 characters, dot, extension no |
||
2759 | more than 3 characters. Trailing spaces are ignored, no other |
||
2760 | spaces is allowed. If name occupies equally 8 characters, |
||
2761 | dot may be omitted (though it is not recommended to use this |
||
2762 | feature for convenience of transition to the future extensions). |
||
2763 | * This function does not support folders on ramdisk. |
||
114 | mikedld | 2764 | Examples: |
2765 | * '/RAMDISK/FIRST/KERNEL.ASM',0 |
||
2766 | '/rd/1/kernel.asm',0 |
||
2767 | * '/HD0/1/kernel.asm',0 |
||
2768 | * '/hd0/1/menuet/pics/tanzania.bmp',0 |
||
118 | diamond | 2769 | Existing subfunctions: |
2770 | * subfunction 0 - read file/folder |
||
2771 | * subfunction 8 - LBA-read from device |
||
2772 | * subfunction 15 - get file system information |
||
114 | mikedld | 2773 | |
2774 | ====================================================================== |
||
118 | diamond | 2775 | =========== Function 58, subfunction 0 - read file/folder. =========== |
114 | mikedld | 2776 | ====================================================================== |
2777 | Parameters: |
||
2778 | * eax = 58 |
||
118 | diamond | 2779 | * ebx = pointer to the information structure |
2780 | Format of the information structure: |
||
2781 | * +0: dword: 0 = subfunction number |
||
2782 | * +4: dword: first block to read (beginning from 0) |
||
2783 | * +8: dword: amount of blocks to read |
||
2784 | * +12 = +0xC: dword: pointer to buffer for data |
||
2785 | * +16 = +0x10: dword: pointer to buffer for system operations |
||
114 | mikedld | 2786 | (4096 bytes) |
118 | diamond | 2787 | * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are |
2788 | given in the general description |
||
114 | mikedld | 2789 | Returned value: |
118 | diamond | 2790 | * eax = 0 - success, otherwise file system error code |
2791 | * ebx = file size (in bytes) or -1=0xffffffff, if file was not found |
||
114 | mikedld | 2792 | Remarks: |
118 | diamond | 2793 | * Block size is 512 bytes. |
114 | mikedld | 2794 | * This function is obsolete, for reading files use subfunction 0 |
118 | diamond | 2795 | of function 70, for reading folders - subfunction 1 of |
2796 | function 70. |
||
2797 | * Function can read contents of a folder. Only FAT file system is |
||
2798 | supported. The format of FAT-folder is described |
||
2799 | in any FAT documentation. |
||
2800 | * Size of a folder is determined by size of FAT clusters chain. |
||
2801 | * If file was ended before last requested block was read, |
||
2802 | the function will read as many as it can, and after that return |
||
2803 | eax=6 (EOF). |
||
2804 | * Function can read root folders /rd/1,/fd/x,/hd[n]/x, but |
||
2805 | in the first two cases the current implementation does not follow |
||
2806 | to the declared rules: |
||
114 | mikedld | 2807 | for /rd/1: |
118 | diamond | 2808 | * if one want to read 0 blocks, function considers, |
2809 | that he requested 1; |
||
2810 | * if one requests more than 14 blocks or starting block is |
||
2811 | not less than 14, function returns eax=5 (not found) и ebx=-1; |
||
2409 | Serge | 2812 | * size of ramdisk root folder is 14 blocks, |
118 | diamond | 2813 | 0x1C00=7168 байт; but function returns ebx=0 |
2814 | (except of the case of previous item); |
||
2815 | * strangely enough, it is possible to read 14th block (which |
||
2816 | generally contains a garbage - I remind, the indexing begins |
||
2817 | from 0); |
||
2818 | * if some block with the number not less than 14 was requested, |
||
2819 | function returns eax=6(EOF); otherwise eax=0. |
||
2820 | For /fd/x: |
||
2821 | * if the start block is not less than 14, function returns |
||
2822 | eax=5 (not found) and ebx=0; |
||
2823 | * note that format of FAT12 allows floppies with the root size |
||
2824 | more or less than 14 blocks; |
||
2825 | * check for length is not performed; |
||
2826 | * if data was successful read, function returns |
||
2827 | eax=0,ebx=0; otherwise eax=10 (access denied), ebx=-1. |
||
2828 | * The function handles reading of special folders /,/rd,/fd,/hd[n]; |
||
2829 | but the result does not correspond to expected (on operations with |
||
2830 | normal files/folders), does not follow the declared rules, |
||
2831 | may be changed in future versions of the kernel and consequently |
||
2832 | is not described. To obtain the information about the equipment |
||
2833 | use subfunction 11 of function 18 or |
||
2834 | read corresponding folder with subfunction 1 of function 70. |
||
114 | mikedld | 2835 | |
2836 | ====================================================================== |
||
118 | diamond | 2837 | ========= Function 58, subfunction 8 - LBA-read from device. ========= |
114 | mikedld | 2838 | ====================================================================== |
2839 | Parameters: |
||
118 | diamond | 2840 | * eax = 58 - function number |
2841 | * ebx = pointer to the information structure |
||
2842 | Format of the information structure: |
||
2843 | * +0: dword: 8 = subfunction number |
||
2844 | * +4: dword: number of block to read (beginning from 0) |
||
2845 | * +8: dword: ignored (set to 1) |
||
2846 | * +12 = +0xC: dword: pointer to buffer for data (512 bytes) |
||
2847 | * +16 = +0x10: dword: pointer to buffer for system operations |
||
114 | mikedld | 2848 | (4096 bytes) |
118 | diamond | 2849 | * +20 = +0x14: ASCIIZ-name of device: case-insensitive, one of |
2850 | /rd/1 = /RamDisk/1, /hd/n = /HardDisk/n, |
||
114 | mikedld | 2851 | 1<=n<=4 - number of device: 1=IDE0, ..., 4=IDE3. |
118 | diamond | 2852 | Instead of digits it is allowed, though not recommended for |
2853 | convenience of transition to future extensions, to use |
||
2854 | 'first','second','third','fourth'. |
||
114 | mikedld | 2855 | Returned value: |
118 | diamond | 2856 | * for device name /hd/xxx, where xxx is not in the list above: |
114 | mikedld | 2857 | * eax = ebx = 1 |
118 | diamond | 2858 | * for invalid device name (except for the previous case): |
114 | mikedld | 2859 | * eax = 5 |
118 | diamond | 2860 | * ebx does not change |
2861 | * if LBA-access is disabled by subfunction 11 of function 21: |
||
114 | mikedld | 2862 | * eax = 2 |
118 | diamond | 2863 | * ebx destroyed |
2864 | * for ramdisk: attempt to read block outside ramdisk |
||
2865 | (18*2*80 blocks) results in |
||
114 | mikedld | 2866 | * eax = 3 |
2867 | * ebx = 0 |
||
118 | diamond | 2868 | * for successful read: |
114 | mikedld | 2869 | * eax = ebx = 0 |
2870 | Remarks: |
||
118 | diamond | 2871 | * Block size is 512 bytes; function reads one block. |
2872 | * Do not depend on returned value, it can be changed |
||
2873 | in future versions. |
||
2409 | Serge | 2874 | * Function requires that LBA-access to devices is enabled by |
2875 | subfunction 11 of function 21. To check this one can use |
||
118 | diamond | 2876 | subfunction 11 of function 26. |
2877 | * LBA-read of floppy is not supported. |
||
2878 | * Function reads data on physical hard drive; if for any reason |
||
2879 | data of the concrete partition are required, application must |
||
2880 | define starting sector of this partition (either directly |
||
2881 | through MBR, or from the full structure returned by |
||
2882 | подфункцией 11 функции 18). |
||
2883 | * Function does not check error code of hard disk, so request of |
||
2884 | nonexisting sector reads something (most probably it will be |
||
2885 | zeroes, but this is defined by device) and this is considered |
||
2886 | as success (eax=0). |
||
114 | mikedld | 2887 | |
118 | diamond | 2888 | ====================================================================== |
2889 | ==== Function 58, subfunction 15 - get information on file system. === |
||
2890 | ====================================================================== |
||
114 | mikedld | 2891 | Parameters: |
118 | diamond | 2892 | * eax = 58 - function number |
2893 | * ebx = pointer to the information structure |
||
2894 | Format of the information structure: |
||
2895 | * +0: dword: 15 = subfunction number |
||
114 | mikedld | 2896 | * +4: dword: ignored |
2897 | * +8: dword: ignored |
||
2898 | * +12 = +0xC: dword: ignored |
||
2899 | * +16 = +0x10: dword: ignored |
||
118 | diamond | 2900 | * +20 = +0x14: (only second character is checked) |
114 | mikedld | 2901 | /rd=/RAMDISK or /hd=/HARDDISK |
2902 | Returned value: |
||
118 | diamond | 2903 | * if the second character does not belong to set {'r','R','h','H'}: |
114 | mikedld | 2904 | * eax = 3 |
2905 | * ebx = ecx = dword [fileinfo] = 0 |
||
2906 | * for ramdisk: |
||
2907 | * eax = 0 (success) |
||
2908 | * ebx = total number of clusters = 2847 |
||
2909 | * ecx = number of free clusters |
||
2910 | * dword [fileinfo] = cluster size = 512 |
||
118 | diamond | 2911 | * for hard disk: base and partition are defined by subfunctions |
2912 | 7 and 8 of function 21: |
||
114 | mikedld | 2913 | * eax = 0 (success) |
2914 | * ebx = total number of clusters |
||
2915 | * ecx = number of free clusters |
||
2916 | * dword [fileinfo] = cluster size (in bytes) |
||
2917 | Remarks: |
||
118 | diamond | 2918 | * Be not surprised to strange layout of 4th returned parameter |
2919 | - when this code was writing, at system calls application got |
||
2920 | only registers eax,ebx,ecx (from pushad-structure transmitted |
||
2921 | as argument to the system function). Now it is corrected, so, |
||
2922 | probably, it is meaningful to return cluster size in edx, while |
||
2923 | this function is not used yet. |
||
2924 | * There exists also subfunction 11 of function 18, |
||
2925 | which returns information on file system. From the full table |
||
2926 | of disk subsystem it is possible to deduce cluster size (there |
||
2927 | it is stored in sectors) and total number of clusters |
||
2928 | for hard disks. |
||
114 | mikedld | 2929 | |
2930 | ====================================================================== |
||
118 | diamond | 2931 | ========== Function 60 - Inter Process Communication (IPC). ========== |
114 | mikedld | 2932 | ====================================================================== |
118 | diamond | 2933 | IPC is used for message dispatching from one process/thread to |
2934 | another. Previously it is necessary to agree how to interpret |
||
114 | mikedld | 2935 | the concrete message. |
2936 | |||
118 | diamond | 2937 | ----------- Subfunction 1 - set the area for IPC receiving ----------- |
2938 | Is called by process-receiver. |
||
114 | mikedld | 2939 | Parameters: |
118 | diamond | 2940 | * eax = 60 - function number |
2941 | * ebx = 1 - subfunction number |
||
2942 | * ecx = pointer to the buffer |
||
2943 | * edx = size of the buffer |
||
114 | mikedld | 2944 | Returned value: |
118 | diamond | 2945 | * eax = 0 - always success |
2946 | Format of IPC-buffer: |
||
2947 | * +0: dword: if nonzero, buffer is considered locked; |
||
2948 | lock/unlock the buffer, when you work with it and need that |
||
2949 | buffer data are not changed from outside (no new messages) |
||
114 | mikedld | 2950 | * +4: dword: occupied place in the buffer (in bytes) |
2951 | * +8: first message |
||
2952 | * +8+n: second message |
||
2953 | * ... |
||
118 | diamond | 2954 | Format of a message: |
2955 | * +0: dword: PID of sender |
||
2956 | * +4: dword: message length (not including this header) |
||
2957 | * +8: n*byte: message data |
||
114 | mikedld | 2958 | |
118 | diamond | 2959 | ------------------ Subfunction 2 - send IPC message ------------------ |
2960 | Is called by process-sender. |
||
114 | mikedld | 2961 | Parameters: |
118 | diamond | 2962 | * eax = 60 - function number |
2963 | * ebx = 2 - subfunction number |
||
114 | mikedld | 2964 | * ecx = PID of receiver |
118 | diamond | 2965 | * edx = pointer to the message data |
2966 | * esi = message length (in bytes) |
||
114 | mikedld | 2967 | Returned value: |
118 | diamond | 2968 | * eax = 0 - success |
2969 | * eax = 1 - the receiver has not defined buffer for IPC messages |
||
2970 | (can be, still have no time, |
||
2971 | and can be, this is not right process) |
||
2972 | * eax = 2 - the receiver has blocked IPC-buffer; try to wait a bit |
||
2973 | * eax = 3 - overflow of IPC-buffer of the receiver |
||
114 | mikedld | 2974 | * eax = 4 - process/thread with such PID does not exist |
2975 | Remarks: |
||
118 | diamond | 2976 | * Immediately after writing of IPC-message to the buffer the system |
2977 | sends to the receiver the event with code 7 (see event codes). |
||
114 | mikedld | 2978 | |
2979 | ====================================================================== |
||
118 | diamond | 2980 | ==== Function 61 - get parameters for the direct graphics access. ==== |
114 | mikedld | 2981 | ====================================================================== |
118 | diamond | 2982 | The data of the graphics screen (the memory area which displays |
2983 | screen contents) are accessible to a program directly, without |
||
2984 | any system calls, through the selector gs: |
||
1662 | Nasarus | 2985 | mov eax, [gs:0] |
118 | diamond | 2986 | places in eax the first dword of the buffer, which contains |
2987 | information on color of the left upper point (and, possibly, colors |
||
2988 | of several following). |
||
1662 | Nasarus | 2989 | mov [gs:0], eax |
118 | diamond | 2990 | by work in VESA modes with LFB sets color of the left upper point |
2991 | (and, possibly, colors of several following). |
||
2992 | To interpret the data of graphics screen program needs to know |
||
2993 | some parameters, returning by this function. |
||
114 | mikedld | 2994 | Remarks: |
118 | diamond | 2995 | * Graphics parameters changes very seldom at work, |
2996 | namely, only in cases, when user works with the application VRR. |
||
2997 | * At videomode change the system redraws all windows (event |
||
2998 | with code 1) and redraws the background (event 5). |
||
2999 | Same events occur in other cases too, which meet much more often, |
||
3000 | than videomode change. |
||
3001 | * By operation in videomodes with LFB the selector gs points to |
||
3002 | LFB itself, so reading/writing on gs result directly in |
||
3003 | change of screen contents. By operation in videomodes without |
||
3004 | LFB gs points to some data area in the kernel, and all functions |
||
3005 | of screen output fulfil honesty double operation on writing |
||
3006 | directly to the screen and writing to this buffer. In result |
||
3007 | at reading contents of this buffer the results correspond to |
||
3008 | screen contents (with, generally speaking, large color |
||
3009 | resolution), and writing is ignored. |
||
3010 | One exception is the mode 320*200, for which main loop of the |
||
3011 | system thread updates the screen according to mouse movements. |
||
114 | mikedld | 3012 | |
3013 | ------------------------- Screen resolution -------------------------- |
||
3014 | Parameters: |
||
118 | diamond | 3015 | * eax = 61 - function number |
3016 | * ebx = 1 - subfunction number |
||
114 | mikedld | 3017 | Returned value: |
118 | diamond | 3018 | * eax = [resolution on x axis]*65536 + [resolution on y axis] |
114 | mikedld | 3019 | Remarks: |
118 | diamond | 3020 | * One can use function 14 paying attention that |
3021 | it returns sizes on 1 pixel less. It is fully equivalent way. |
||
114 | mikedld | 3022 | |
118 | diamond | 3023 | ---------------------- Number of bits per pixel ---------------------- |
114 | mikedld | 3024 | Parameters: |
118 | diamond | 3025 | * eax = 61 - function number |
3026 | * ebx = 2 - subfunction number |
||
114 | mikedld | 3027 | Returned value: |
118 | diamond | 3028 | * eax = number of bits per pixel (24 or 32) |
114 | mikedld | 3029 | |
118 | diamond | 3030 | -------------------- Number of bytes per scanline -------------------- |
114 | mikedld | 3031 | Parameters: |
118 | diamond | 3032 | * eax = 61 - function number |
3033 | * ebx = 3 - subfunction number |
||
114 | mikedld | 3034 | Returned value: |
118 | diamond | 3035 | * eax = number of bytes occupied by one scanline |
114 | mikedld | 3036 | (horizontal line on the screen) |
3037 | |||
3038 | ====================================================================== |
||
118 | diamond | 3039 | ===== Function 62, subfunction 0 - get version of PCI-interface. ===== |
114 | mikedld | 3040 | ====================================================================== |
3041 | Parameters: |
||
118 | diamond | 3042 | * eax = 62 - function number |
3043 | * bl = 0 - subfunction number |
||
114 | mikedld | 3044 | Returned value: |
118 | diamond | 3045 | * eax = -1 - PCI access is disabled; otherwise |
3046 | * ah.al = version of PCI-interface (ah=version, al=subversion) |
||
3047 | * high word of eax is zeroed |
||
114 | mikedld | 3048 | Remarks: |
118 | diamond | 3049 | * Previously low-level access to PCI for applications must be |
3050 | enabled by subfunction 12 of function 21. |
||
3051 | * If PCI BIOS is not supported, the value of ax is undefined. |
||
114 | mikedld | 3052 | |
3053 | ====================================================================== |
||
118 | diamond | 3054 | ==== Function 62, subfunction 1 - get number of the last PCI-bus. ==== |
114 | mikedld | 3055 | ====================================================================== |
3056 | Parameters: |
||
118 | diamond | 3057 | * eax = 62 - function number |
3058 | * bl = 1 - subfunction number |
||
114 | mikedld | 3059 | Returned value: |
118 | diamond | 3060 | * eax = -1 - access to PCI is disabled; otherwise |
3061 | * al = number of the last PCI-bus; other bytes of eax are destroyed |
||
114 | mikedld | 3062 | Remarks: |
118 | diamond | 3063 | * Previously low-level access to PCI for applications must be |
3064 | enabled by subfunction 12 of function 21. |
||
3065 | * If PCI BIOS is not supported, the value of ax is undefined. |
||
114 | mikedld | 3066 | |
3067 | ====================================================================== |
||
118 | diamond | 3068 | ===================== Function 62, subfunction 2 ===================== |
3069 | ===== Get mechanism of addressing to the PCI configuration space. ==== |
||
114 | mikedld | 3070 | ====================================================================== |
3071 | Parameters: |
||
118 | diamond | 3072 | * eax = 62 - function number |
3073 | * bl = 2 - subfunction number |
||
114 | mikedld | 3074 | Returned value: |
118 | diamond | 3075 | * eax = -1 - access to PCI is disabled; otherwise |
3076 | * al = mechanism (1 or 2); other bytes of eax are destroyed |
||
114 | mikedld | 3077 | Remarks: |
118 | diamond | 3078 | * Previously low-level access to PCI for applications must be |
3079 | enabled by subfunction 12 of function 21. |
||
3080 | * Addressing mechanism is selected depending on |
||
3081 | equipment characteristics. |
||
3082 | * Subfunctions of read and write work automatically |
||
3083 | with the selected mechanism. |
||
114 | mikedld | 3084 | |
3085 | ====================================================================== |
||
118 | diamond | 3086 | ======== Function 62, subfunctions 4,5,6 - read PCI-register. ======== |
114 | mikedld | 3087 | ====================================================================== |
3088 | Parameters: |
||
118 | diamond | 3089 | * eax = 62 - function number |
3090 | * bl = 4 - read byte |
||
3091 | * bl = 5 - read word |
||
3092 | * bl = 6 - read dword |
||
114 | mikedld | 3093 | * bh = number of PCI-bus |
118 | diamond | 3094 | * ch = dddddfff, where ddddd = number of the device on the bus, |
3095 | fff = function number of device |
||
3096 | * cl = number of register (must be even for bl=5, |
||
3097 | divisible by 4 for bl=6) |
||
114 | mikedld | 3098 | Returned value: |
118 | diamond | 3099 | * eax = -1 - error (access to PCI is disabled or parameters |
3100 | are not supported); otherwise |
||
3101 | * al/ax/eax (depending on requested size) contains the data; |
||
3102 | the other part of register eax is destroyed |
||
114 | mikedld | 3103 | Remarks: |
118 | diamond | 3104 | * Previously low-level access to PCI for applications must be |
3105 | enabled by subfunction 12 of function 21. |
||
3106 | * Access mechanism 2 supports only 16 devices on a bus and ignores |
||
3107 | function number. To get access mechanism use subfunction 2. |
||
3108 | * Some registers are standard and exist for all devices, some are |
||
3109 | defined by the concrete device. The list of registers of the |
||
3110 | first type can be found e.g. in famous |
||
114 | mikedld | 3111 | Interrupt List by Ralf Brown |
3112 | (http://www.pobox.com/~ralf/files.html, |
||
3113 | ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/); |
||
118 | diamond | 3114 | registers of the second type must be listed |
3115 | in the device documentation. |
||
114 | mikedld | 3116 | |
3117 | ====================================================================== |
||
118 | diamond | 3118 | ====== Function 62, subfunctions 8,9,10 - write to PCI-register. ===== |
114 | mikedld | 3119 | ====================================================================== |
3120 | Parameters: |
||
118 | diamond | 3121 | * eax = 62 - function number |
3122 | * bl = 8 - write byte |
||
3123 | * bl = 9 - write word |
||
3124 | * bl = 10 - write dword |
||
114 | mikedld | 3125 | * bh = number of PCI-bus |
118 | diamond | 3126 | * ch = dddddfff, where ddddd = number of the device on the bus, |
3127 | fff = function number of device |
||
3128 | * cl = number of register (must be even for bl=9, |
||
3129 | divisible by 4 for bl=10) |
||
3130 | * dl/dx/edx (depending on requested size) contatins |
||
3131 | the data to write |
||
114 | mikedld | 3132 | Returned value: |
118 | diamond | 3133 | * eax = -1 - error (access to PCI is disabled or parameters |
3134 | are not supported) |
||
3135 | * eax = 0 - success |
||
114 | mikedld | 3136 | Remarks: |
118 | diamond | 3137 | * Previously low-level access to PCI for applications must be |
3138 | enabled by subfunction 12 of function 21. |
||
3139 | * Access mechanism 2 supports only 16 devices on a bus and ignores |
||
3140 | function number. To get access mechanism use subfunction 2. |
||
3141 | * Some registers are standard and exist for all devices, some are |
||
3142 | defined by the concrete device. The list of registers of the |
||
3143 | first type can be found e.g. in famous Interrupt List by |
||
3144 | Ralf Brown; registers of the second type must be listed |
||
3145 | in the device documentation. |
||
114 | mikedld | 3146 | |
3147 | ====================================================================== |
||
118 | diamond | 3148 | ============== Function 63 - work with the debug board. ============== |
114 | mikedld | 3149 | ====================================================================== |
118 | diamond | 3150 | The debug board is the global system buffer (with the size |
499 | diamond | 3151 | 1024 bytes), to which any program can write (generally speaking, |
118 | diamond | 3152 | arbitrary) data and from which other program can read these data. |
3153 | By the agreement written data are text strings interpreted as |
||
3154 | debug messages on a course of program execution. The kernel in |
||
3155 | some situations also writes to the debug board information on |
||
3156 | execution of some functions; by the agreement kernel messages |
||
3157 | begins from the prefix "K : ". |
||
3158 | For view of the debug board the application 'board' was created, |
||
3159 | which reads data from the buffer and displays them in its window. |
||
3160 | 'board' interpretes the sequence of codes 13,10 as newline. |
||
3161 | A character with null code in an end of line is not necessary, |
||
114 | mikedld | 3162 | but also does not prevent. |
118 | diamond | 3163 | Because debugger has been written, the value of the debug board |
3164 | has decreased, as debugger allows to inspect completely a course of |
||
3165 | program execution without any efforts from the direction of program |
||
3166 | itself. Nevertheless in some cases the debug board is still useful. |
||
114 | mikedld | 3167 | |
118 | diamond | 3168 | ----------------------------- Write byte ----------------------------- |
114 | mikedld | 3169 | Parameters: |
118 | diamond | 3170 | * eax = 63 - function number |
3171 | * ebx = 1 - subfunction number |
||
3172 | * cl = data byte |
||
114 | mikedld | 3173 | Returned value: |
3174 | * function does not return value |
||
3175 | Remarks: |
||
118 | diamond | 3176 | * Byte is written to the buffer. Buffer size is 512 bytes. |
3177 | At buffer overflow all obtained data are lost. |
||
3178 | * For output to the debug board of more complicated objects |
||
3179 | (strings, numbers) it is enough to call this function in cycle. |
||
3180 | It is possible not to write the appropriate code manually and use |
||
3181 | file 'debug.inc', which is included into the distributive. |
||
114 | mikedld | 3182 | |
118 | diamond | 3183 | ----------------------------- Read byte ------------------------------ |
3184 | Takes away byte from the buffer. |
||
114 | mikedld | 3185 | Parameters: |
118 | diamond | 3186 | * eax = 63 - function number |
3187 | * ebx = 2 - subfunction number |
||
114 | mikedld | 3188 | Returned value: |
118 | diamond | 3189 | * eax = ebx = 0 - the buffer is empty |
3190 | * eax = byte, ebx = 1 - byte was successfully read |
||
114 | mikedld | 3191 | |
3192 | ====================================================================== |
||
118 | diamond | 3193 | ============== Function 64 - resize application memory. ============== |
114 | mikedld | 3194 | ====================================================================== |
3195 | Parameters: |
||
118 | diamond | 3196 | * eax = 64 - function number |
3197 | * ebx = 1 - unique subfunction |
||
3198 | * ecx = new memory size |
||
114 | mikedld | 3199 | Returned value: |
118 | diamond | 3200 | * eax = 0 - success |
3201 | * eax = 1 - not enough memory |
||
114 | mikedld | 3202 | Remarks: |
193 | diamond | 3203 | * There is another way to dynamically allocate/free memory - |
3204 | subfunctions 11, 12, 13 of function 68. |
||
3205 | * The function cannot be used together with 68.11, 68.12, 68.13. |
||
3206 | The function call will be ignored after creation of process heap |
||
3207 | with function 68.11. |
||
114 | mikedld | 3208 | |
3209 | ====================================================================== |
||
283 | diamond | 3210 | ======== Function 65 - draw image with palette in the window. ======== |
3211 | ====================================================================== |
||
3212 | Parameters: |
||
3213 | * eax = 65 - function number |
||
3214 | * ebx = pointer to the image |
||
3215 | * ecx = [size on axis x]*65536 + [size on axis y] |
||
3216 | * edx = [coordinate on axis x]*65536 + [coordinate on axis y] |
||
1018 | diamond | 3217 | * esi = number of bits per pixel, must be 1,2,4,8,15,16,24 or 32 |
3218 | * edi = pointer to palette (2 to the power esi colors 0x00RRGGBB); |
||
3219 | ignored when esi > 8 |
||
314 | diamond | 3220 | * ebp = offset of next row data relative to previous row data |
283 | diamond | 3221 | Returned value: |
3222 | * function does not return value |
||
3223 | Remarks: |
||
3224 | * Coordinates of the image are coordinates of the upper left corner |
||
3225 | of the image relative to the window. |
||
1018 | diamond | 3226 | * Format of image with 1 bit per pixel: each byte of image |
3227 | (possibly excluding last bytes in rows), contains information on |
||
3228 | the color of 8 pixels, MSB corresponds to first pixel. |
||
3229 | * Format of image with 2 bits per pixel: each byte of image |
||
3230 | (possibly excluding last bytes in rows), contains information on |
||
3231 | the color of 4 pixels, two MSBs correspond to first pixel. |
||
3232 | * Format of image with 4 bits per pixel: each byte of image |
||
3233 | excluding last bytes in rows (if width is odd) contains |
||
3234 | information on the color of 2 pixels, high-order tetrad |
||
3235 | corresponds to first pixel. |
||
3236 | * Format of image with 8 bits per pixel: each byte of image is |
||
3237 | index in the palette. |
||
3238 | * Format of image with 15 bits per pixel: the color of each pixel |
||
3239 | is coded as (bit representation) 0RRRRRGGGGGBBBBB - 5 bits per |
||
3240 | each color. |
||
3241 | * Format of image with 16 bits per pixel: the color of each pixel |
||
3242 | is coded as RRRRRGGGGGGBBBBB (5+6+5). |
||
3243 | * Format of image with 24 bits per pixel: the color of each pixel |
||
3244 | is coded as 3 bytes - sequentially blue, green, red components. |
||
3245 | * Format of image with 32 bits per pixel: similar to 24, but |
||
3246 | one additional ignored byte is present. |
||
314 | diamond | 3247 | * The call to function 7 is equivalent to call to this function |
3248 | with esi=24, ebp=0. |
||
283 | diamond | 3249 | |
3250 | ====================================================================== |
||
118 | diamond | 3251 | ================== Function 66 - work with keyboard. ================= |
114 | mikedld | 3252 | ====================================================================== |
118 | diamond | 3253 | The input mode influences results of reading keys by function 2. |
3254 | When a program loads, ASCII input mode is set for it. |
||
114 | mikedld | 3255 | |
118 | diamond | 3256 | -------------- Subfunction 1 - set keyboard input mode. -------------- |
114 | mikedld | 3257 | Parameters: |
118 | diamond | 3258 | * eax = 66 - function number |
3259 | * ebx = 1 - subfunction number |
||
114 | mikedld | 3260 | * ecx = mode: |
3261 | * 0 = normal (ASCII-characters) |
||
3262 | * 1 = scancodes |
||
3263 | Returned value: |
||
3264 | * function does not return value |
||
3265 | |||
118 | diamond | 3266 | -------------- Subfunction 2 - get keyboard input mode. -------------- |
114 | mikedld | 3267 | Parameters: |
118 | diamond | 3268 | * eax = 66 - function number |
3269 | * ebx = 2 - subfunction number |
||
114 | mikedld | 3270 | Returned value: |
3271 | * eax = current mode |
||
3272 | |||
118 | diamond | 3273 | ------------ Subfunction 3 - get status of control keys. ------------- |
114 | mikedld | 3274 | Parameters: |
118 | diamond | 3275 | * eax = 66 - function number |
3276 | * ebx = 3 - subfunction number |
||
114 | mikedld | 3277 | Returned value: |
3278 | * eax = bit mask: |
||
118 | diamond | 3279 | * bit 0 (mask 1): left Shift is pressed |
3280 | * bit 1 (mask 2): right Shift is pressed |
||
3281 | * bit 2 (mask 4): left Ctrl is pressed |
||
3282 | * bit 3 (mask 8): right Ctrl is pressed |
||
3283 | * bit 4 (mask 0x10): left Alt is pressed |
||
3284 | * bit 5 (mask 0x20): right Alt is pressed |
||
3285 | * bit 6 (mask 0x40): CapsLock is on |
||
3286 | * bit 7 (mask 0x80): NumLock is on |
||
3287 | * bit 8 (mask 0x100): ScrollLock is on |
||
3288 | * other bits are cleared |
||
114 | mikedld | 3289 | |
118 | diamond | 3290 | -------------- Subfunction 4 - set system-wide hotkey. --------------- |
3291 | When hotkey is pressed, the system notifies only those applications, |
||
3292 | which have installed it; the active application (which receives |
||
3293 | all normal input) does not receive such keys. |
||
3294 | The notification consists in sending event with the code 2. |
||
3295 | Reading hotkey is the same as reading normal key - by function 2. |
||
114 | mikedld | 3296 | Parameters: |
118 | diamond | 3297 | * eax = 66 - function number |
3298 | * ebx = 4 - subfunction number |
||
3299 | * cl determines key scancode; |
||
3300 | use cl=0 to give combinations such as Ctrl+Shift |
||
3301 | * edx = 0xXYZ determines possible states of control keys: |
||
3302 | * Z (low 4 bits) determines state of LShift and RShift: |
||
3303 | * 0 = no key must be pressed; |
||
3304 | * 1 = exactly one key must be pressed; |
||
3305 | * 2 = both keys must be pressed; |
||
3306 | * 3 = must be pressed LShift, but not RShift; |
||
3307 | * 4 = must be pressed RShift, but not LShift |
||
3308 | * Y - similar for LCtrl and RCtrl; |
||
3309 | * X - similar for LAlt and RAlt |
||
114 | mikedld | 3310 | Returned value: |
118 | diamond | 3311 | * eax=0 - success |
3312 | * eax=1 - too mant hotkeys (maximum 256 are allowed) |
||
114 | mikedld | 3313 | Remarks: |
118 | diamond | 3314 | * Hotkey can work either at pressing or at release. Release |
3315 | scancode of a key is more on 128 than pressing scancode |
||
3316 | (i.e. high bit is set). |
||
3317 | * Several applications can set the same combination; |
||
3318 | all such applications will be informed on pressing |
||
3319 | such combination. |
||
114 | mikedld | 3320 | |
118 | diamond | 3321 | -------------- Subfunction 5 - delete installed hotkey. -------------- |
114 | mikedld | 3322 | Parameters: |
118 | diamond | 3323 | * eax = 66 - function number |
3324 | * ebx = 5 - subfunction number |
||
3325 | * cl = scancode of key and edx = 0xXYZ the same as in subfunction 4 |
||
114 | mikedld | 3326 | Returned value: |
118 | diamond | 3327 | * eax = 0 - success |
114 | mikedld | 3328 | * eax = 1 - there is no such hotkey |
3329 | Remarks: |
||
118 | diamond | 3330 | * When a process/thread terminates, all hotkey installed by it are |
3331 | deleted. |
||
3332 | * The call to this subfunction does not affect other applications. |
||
3333 | If other application has defined the same combination, it will |
||
3334 | still receive notices. |
||
114 | mikedld | 3335 | |
3336 | ====================================================================== |
||
118 | diamond | 3337 | ========= Function 67 - change position/sizes of the window. ========= |
114 | mikedld | 3338 | ====================================================================== |
3339 | Parameters: |
||
118 | diamond | 3340 | * eax = 67 - function number |
114 | mikedld | 3341 | * ebx = new x-coordinate of the window |
3342 | * ecx = new y-coordinate of the window |
||
3343 | * edx = new x-size of the window |
||
3344 | * esi = new y-size of the window |
||
3345 | Returned value: |
||
3346 | * function does not return value |
||
3347 | Remarks: |
||
118 | diamond | 3348 | * The value -1 for a parameter means "do not change"; e.g. to move |
3349 | the window without resizing it is possible to specify edx=esi=-1. |
||
3350 | * Previously the window must be defined by function 0. |
||
114 | mikedld | 3351 | It sets initial coordinates and sizes of the window. |
118 | diamond | 3352 | * Sizes of the window are understood in sense of function 0, |
3353 | that is one pixel less than real sizes. |
||
3354 | * The function call for maximized windows is simply ignored. |
||
3355 | * For windows of appropriate styles position and/or sizes can be |
||
3356 | changed by user; current position and sizes can be obtained by |
||
3357 | call to function 9. |
||
3358 | * The function sends to the window redraw event (with the code 1). |
||
114 | mikedld | 3359 | |
3360 | ====================================================================== |
||
118 | diamond | 3361 | ====== Function 68, subfunction 0 - get the task switch counter. ===== |
114 | mikedld | 3362 | ====================================================================== |
3363 | Parameters: |
||
118 | diamond | 3364 | * eax = 68 - function number |
3365 | * ebx = 0 - subfunction number |
||
114 | mikedld | 3366 | Returned value: |
118 | diamond | 3367 | * eax = number of task switches from the system booting |
3368 | (modulo 2^32) |
||
114 | mikedld | 3369 | |
3370 | ====================================================================== |
||
118 | diamond | 3371 | ======= Function 68, subfunction 1 - switch to the next thread. ====== |
114 | mikedld | 3372 | ====================================================================== |
118 | diamond | 3373 | The function completes the current time slice allocated to the |
3374 | thread and switches to the next. (Which thread in which process |
||
3375 | will be next, is unpredictable). Later, when execution queue |
||
3376 | will reach the current thread, execution will be continued. |
||
114 | mikedld | 3377 | Parameters: |
118 | diamond | 3378 | * eax = 68 - function number |
3379 | * ebx = 1 - subfunction number |
||
114 | mikedld | 3380 | Returned value: |
3381 | * function does not return value |
||
3382 | |||
3383 | ====================================================================== |
||
118 | diamond | 3384 | ============= Function 68, subfunction 2 - cache + rdpmc. ============ |
114 | mikedld | 3385 | ====================================================================== |
3386 | Parameters: |
||
118 | diamond | 3387 | * eax = 68 - function number |
3388 | * ebx = 2 - subfunction number |
||
3389 | * ecx = required action: |
||
3390 | * ecx = 0 - enable instruction 'rdpmc' |
||
3391 | (ReaD Performance-Monitoring Counters) for applications |
||
3392 | * ecx = 1 - find out whether cache is disabled/enabled |
||
3393 | * ecx = 2 - enable cache |
||
3394 | * ecx = 3 - disable cache |
||
114 | mikedld | 3395 | Returned value: |
3396 | * for ecx=0: |
||
118 | diamond | 3397 | * eax = the value of cr4 |
114 | mikedld | 3398 | * for ecx=1: |
3399 | * eax = (cr0 and 0x60000000): |
||
118 | diamond | 3400 | * eax = 0 - cache is on |
3401 | * eax <> 0 - cache is off |
||
114 | mikedld | 3402 | * for ecx=2 and ecx=3: |
3403 | * function does not return value |
||
3404 | |||
3405 | ====================================================================== |
||
3406 | =========== Function 68, subfunction 3 - read MSR-register. ========== |
||
3407 | ====================================================================== |
||
118 | diamond | 3408 | MSR = Model Specific Register; the complete list of MSR-registers |
3409 | of a processor is included to the documentation on it (for example, |
||
3410 | IA-32 Intel Architecture Software Developer's Manual, |
||
3411 | Volume 3, Appendix B); each processor family has its own subset |
||
3412 | of the MSR-registers. |
||
114 | mikedld | 3413 | Parameters: |
118 | diamond | 3414 | * eax = 68 - function number |
3415 | * ebx = 3 - subfunction number |
||
3416 | * ecx is ignored |
||
3417 | * edx = MSR address |
||
114 | mikedld | 3418 | Returned value: |
118 | diamond | 3419 | * ebx:eax = high:low dword of the result |
114 | mikedld | 3420 | Remarks: |
118 | diamond | 3421 | * If ecx contains nonexistent or not implemented for this processor |
3422 | MSR, processor will generate an exception in the kernel, which |
||
3423 | will kill the thread. |
||
3424 | * Previously it is necessary to check, whether MSRs are supported |
||
3425 | as a whole, with the instruction 'cpuid'. Otherwise processor |
||
3426 | will generate other exception in the kernel, which will anyway |
||
3427 | kill the thread. |
||
114 | mikedld | 3428 | |
3429 | ====================================================================== |
||
118 | diamond | 3430 | ========= Function 68, subfunction 4 - write to MSR-register. ======== |
114 | mikedld | 3431 | ====================================================================== |
118 | diamond | 3432 | MSR = Model Specific Register; the complete list of MSR-registers |
3433 | of a processor is included to the documentation on it (for example, |
||
3434 | IA-32 Intel Architecture Software Developer's Manual, |
||
3435 | Volume 3, Appendix B); each processor family has its own subset |
||
3436 | of the MSR-registers. |
||
114 | mikedld | 3437 | Parameters: |
118 | diamond | 3438 | * eax = 68 - function number |
3439 | * ebx = 4 - subfunction number |
||
3440 | * ecx is ignored |
||
3441 | * edx = MSR address |
||
3442 | * esi:edi = high:low dword |
||
114 | mikedld | 3443 | Returned value: |
499 | diamond | 3444 | * function does not return value |
3445 | Remarks: |
||
118 | diamond | 3446 | * If ecx contains nonexistent or not implemented for this processor |
3447 | MSR, processor will generate an exception in the kernel, which |
||
3448 | will kill the thread. |
||
3449 | * Previously it is necessary to check, whether MSRs are supported |
||
3450 | as a whole, with the instruction 'cpuid'. Otherwise processor |
||
3451 | will generate other exception in the kernel, which will anyway |
||
3452 | kill the thread. |
||
114 | mikedld | 3453 | |
3454 | ====================================================================== |
||
193 | diamond | 3455 | ======= Function 68, subfunction 11 - initialize process heap. ======= |
114 | mikedld | 3456 | ====================================================================== |
3457 | Parameters: |
||
118 | diamond | 3458 | * eax = 68 - function number |
193 | diamond | 3459 | * ebx = 11 - subfunction number |
114 | mikedld | 3460 | Returned value: |
193 | diamond | 3461 | * eax = 0 - failed |
3462 | * otherwise size of created heap |
||
114 | mikedld | 3463 | Remarks: |
193 | diamond | 3464 | * The function call initializes heap, from which one can in future |
3465 | allocate and free memory blocks with subfunctions 12 and 13. |
||
3466 | Heap size is equal to total amount of free application memory. |
||
3467 | * The second function call from the same process results in |
||
3468 | returning the size of the existing heap. |
||
3469 | * After creation of the heap calls to function 64 will be ignored. |
||
114 | mikedld | 3470 | |
3471 | ====================================================================== |
||
193 | diamond | 3472 | ======== Function 68, subfunction 12 - allocate memory block. ======== |
114 | mikedld | 3473 | ====================================================================== |
3474 | Parameters: |
||
118 | diamond | 3475 | * eax = 68 - function number |
193 | diamond | 3476 | * ebx = 12 - subfunction number |
3477 | * ecx = required size in bytes |
||
114 | mikedld | 3478 | Returned value: |
193 | diamond | 3479 | * eax = pointer to the allocated block |
114 | mikedld | 3480 | Remarks: |
193 | diamond | 3481 | * Before this call one must initialize process heap by call to |
3482 | subfunction 11. |
||
3483 | * The function allocates an integer number of pages (4 Kb) in such |
||
3484 | way that the real size of allocated block is more than or equal to |
||
3485 | requested size. |
||
114 | mikedld | 3486 | |
3487 | ====================================================================== |
||
193 | diamond | 3488 | ========== Function 68, subfunction 13 - free memory block. ========== |
114 | mikedld | 3489 | ====================================================================== |
3490 | Parameters: |
||
118 | diamond | 3491 | * eax = 68 - function number |
193 | diamond | 3492 | * ebx = 13 - subfunction number |
3493 | * ecx = pointer to the memory block |
||
114 | mikedld | 3494 | Returned value: |
193 | diamond | 3495 | * eax = 1 - success |
3496 | * eax = 0 - failed |
||
114 | mikedld | 3497 | Remarks: |
448 | diamond | 3498 | * The memory block must have been allocated by subfunction 12 |
3499 | or subfunction 20. |
||
114 | mikedld | 3500 | |
3501 | ====================================================================== |
||
1074 | Galkov | 3502 | ===================== Function 68, subfunction 14 ==================== |
1662 | Nasarus | 3503 | ============ Wait for signal from another program/driver. ============ |
114 | mikedld | 3504 | ====================================================================== |
3505 | Parameters: |
||
118 | diamond | 3506 | * eax = 68 - function number |
193 | diamond | 3507 | * ebx = 14 - subfunction number |
1074 | Galkov | 3508 | * ecx = pointer to the buffer for information (24 bytes) |
114 | mikedld | 3509 | Returned value: |
193 | diamond | 3510 | * buffer pointed to by ecx contains the following information: |
1662 | Nasarus | 3511 | * +0: dword: identifier for following data of signal |
3512 | * +4: dword: data of signal (20 bytes), format of which is defined |
||
3513 | by the first dword |
||
114 | mikedld | 3514 | |
3515 | ====================================================================== |
||
193 | diamond | 3516 | ============= Function 68, subfunction 16 - load driver. ============= |
3517 | ====================================================================== |
||
3518 | Parameters: |
||
3519 | * eax = 68 - function number |
||
3520 | * ebx = 16 - subfunction number |
||
3521 | * ecx = pointer to ASCIIZ-string with driver name |
||
3522 | Returned value: |
||
3523 | * eax = 0 - failed |
||
3524 | * otherwise eax = driver handle |
||
3525 | Remarks: |
||
3526 | * If the driver was not loaded yet, it is loaded; |
||
3527 | if the driver was loaded yet, nothing happens. |
||
3528 | * Driver name is case-sensitive. |
||
3529 | Maximum length of the name is 16 characters, including |
||
3530 | terminating null character, the rest is ignored. |
||
346 | diamond | 3531 | * Driver ABC is loaded from file /rd/1/drivers/ABC.obj. |
193 | diamond | 3532 | |
3533 | ====================================================================== |
||
3534 | ============ Function 68, subfunction 17 - driver control. =========== |
||
3535 | ====================================================================== |
||
3536 | Parameters: |
||
3537 | * eax = 68 - function number |
||
3538 | * ebx = 17 - subfunction number |
||
3539 | * ecx = pointer to the control structure: |
||
3540 | * +0: dword: handle of driver |
||
3541 | * +4: dword: code of driver function |
||
3542 | * +8: dword: pointer to input data |
||
3543 | * +12 = +0xC: dword: size of input data |
||
3544 | * +16 = +0x10: dword: pointer to output data |
||
3545 | * +20 = +0x14: dword: size of output data |
||
3546 | Returned value: |
||
1662 | Nasarus | 3547 | * eax = determined by driver |
193 | diamond | 3548 | Remarks: |
3549 | * Function codes and the structure of input/output data |
||
3550 | are defined by driver. |
||
3551 | * Previously one must obtain driver handle by subfunction 16. |
||
3552 | |||
3553 | ====================================================================== |
||
277 | diamond | 3554 | =============== Function 68, subfunction 19 - load DLL. ============== |
3555 | ====================================================================== |
||
3556 | Parameters: |
||
3557 | * eax = 68 - function number |
||
3558 | * ebx = 19 - subfunction number |
||
3559 | * ecx = pointer to ASCIIZ-string with the full path to DLL |
||
3560 | Returned value: |
||
3561 | * eax = 0 - failed |
||
3562 | * otherwise eax = pointer to DLL export table |
||
3563 | Remarks: |
||
3564 | * Export table is an array of structures of 2 dword's, terminated |
||
3565 | by zero. The first dword in structure points to function name, |
||
3566 | the second dword contains address of function. |
||
3567 | |||
3568 | ====================================================================== |
||
448 | diamond | 3569 | ======= Function 68, subfunction 20 - reallocate memory block. ======= |
3570 | ====================================================================== |
||
3571 | Parameters: |
||
3572 | * eax = 68 - function number |
||
3573 | * ebx = 20 - subfunction number |
||
3574 | * ecx = new size in bytes |
||
3575 | * edx = pointer to already allocated block |
||
3576 | Returned value: |
||
3577 | * eax = pointer to the reallocated block, 0 = error |
||
3578 | Remarks: |
||
3579 | * Before this call one must initialize process heap by call to |
||
3580 | subfunction 11. |
||
3581 | * The function allocates an integer number of pages (4 Kb) in such |
||
3582 | way that the real size of allocated block is more than or equal to |
||
3583 | requested size. |
||
3584 | * If edx=0, the function call is equivalent to memory allocation |
||
3585 | with subfunction 12. Otherwise the block at edx |
||
3586 | must be allocated earlier with subfunction 12 or this subfunction. |
||
3587 | * If ecx=0, the function frees memory block at edx and returns 0. |
||
3588 | * The contents of the block are unchanged up to the shorter of |
||
3589 | the new and old sizes. |
||
3590 | |||
3591 | ====================================================================== |
||
1662 | Nasarus | 3592 | ======== Function 68, subfunction 22 - open named memory area. ======= |
1077 | Galkov | 3593 | ====================================================================== |
3594 | Parameters: |
||
3595 | * eax = 68 - function number |
||
1662 | Nasarus | 3596 | * ebx = 22 - subfunction number |
3597 | * ecx = area name. Maximum of 31 characters with terminating zero |
||
3598 | * edx = area size in bytes for SHM_CREATE and SHM_OPEN_ALWAYS |
||
3599 | * esi = flags for open and access: |
||
3600 | * SHM_OPEN = 0x00 - open existing memory area. If an area |
||
3601 | with such name does not exist, the function |
||
3602 | will return error code 5. |
||
3603 | * SHM_OPEN_ALWAYS = 0x04 - open existing or create new |
||
3604 | memory area. |
||
3605 | * SHM_CREATE = 0x08 - create new memory area. If an area |
||
3606 | with such name already exists, the function |
||
3607 | will return error code 10. |
||
3608 | * SHM_READ = 0x00 - only read access |
||
3609 | * SHM_WRITE = 0x01 - read and write access |
||
3610 | Returned value: |
||
3611 | * eax = pointer to memory area, 0 if error has occured |
||
3612 | * if new area is created (SHM_CREATE or SHM_OPEN_ALWAYS): |
||
3613 | edx = 0 - success, otherwise - error code |
||
3614 | * if existing area is opened (SHM_OPEN or SHM_OPEN_ALWAYS): |
||
3615 | edx = error code (if eax=0) or area size in bytes |
||
3616 | Error codes: |
||
3617 | * E_NOTFOUND = 5 |
||
3618 | * E_ACCESS = 10 |
||
3619 | * E_NOMEM = 30 |
||
3620 | * E_PARAM = 33 |
||
3621 | Remarks: |
||
3622 | * Before this call one must initialize process heap by call to |
||
3623 | subfunction 11. |
||
3624 | * If a new area is created, access flags set maximal rights |
||
3625 | for other processes. An attempt from other process to open |
||
3626 | with denied rights will fail with error code E_ACCESS. |
||
3627 | * The process which has created an area always has write access. |
||
3628 | |||
3629 | ====================================================================== |
||
3630 | ======= Function 68, subfunction 23 - close named memory area. ======= |
||
3631 | ====================================================================== |
||
3632 | Parameters: |
||
3633 | * eax = 68 - function number |
||
3634 | * ebx = 23 - subfunction number |
||
3635 | * ecx = area name. Maximum of 31 characters with terminating zero |
||
3636 | Returned value: |
||
3637 | * eax destroyed |
||
3638 | Remarks: |
||
3639 | * A memory area is physically freed (with deleting all data and |
||
3640 | freeing physical memory), when all threads which have opened |
||
3641 | this area will close it. |
||
3642 | * When thread is terminating, all opened by it areas are closed. |
||
3643 | |||
3644 | ====================================================================== |
||
3645 | ======== Function 68, subfunction 24 - set exception handler. ======== |
||
3646 | ====================================================================== |
||
3647 | Parameters: |
||
3648 | * eax = 68 - function number |
||
1077 | Galkov | 3649 | * ebx = 24 - subfunction number |
3650 | * ecx = address of the new exception handler |
||
1662 | Nasarus | 3651 | * edx = the mask of handled exceptions |
1077 | Galkov | 3652 | Returned value: |
3653 | * eax = address of the old exception handler (0, if it was not set) |
||
1662 | Nasarus | 3654 | * ebx = the old mask of handled exceptions |
1077 | Galkov | 3655 | Remarks: |
1662 | Nasarus | 3656 | * Bit number in mask of exceptions corresponds to exception number |
3657 | in CPU-specification (Intel-PC). For example, FPU exceptions have |
||
3658 | number 16 (#MF), and SSE exceptions - 19 (#XF). |
||
3659 | * The current implementation ignores the inquiry for hook of 7 |
||
3660 | exception - the system handles #NM by its own. |
||
3661 | * The exception handler is called with exception number as first |
||
3662 | (and only) stack parameter. So, correct exit from the handler is |
||
3663 | RET 4. It returns to the instruction, that caused the exception, |
||
3664 | for faults, and to the next instruction for traps (see |
||
3665 | classification of exceptions in CPU specification). |
||
3666 | * When user handler receives control, the corresponding bit in |
||
3667 | the exception mask is cleared. Raising this exception |
||
3668 | in consequence leads to default handling, that is, |
||
3669 | terminating the application in absence of debugger or |
||
3670 | suspend with notification of debugger otherwise. |
||
3671 | * After user handler completes critical operations, it can set |
||
3672 | the corresponding bit in the exception mask with subfunction 25. |
||
3673 | Also user handler is responsible for clearing exceptions flags in |
||
3674 | FPU and/or SSE. |
||
1077 | Galkov | 3675 | |
3676 | ====================================================================== |
||
1662 | Nasarus | 3677 | ====== Function 68, subfunction 25 - set FPU exception handler. ====== |
1077 | Galkov | 3678 | ====================================================================== |
3679 | Parameters: |
||
3680 | * eax = 68 - function number |
||
3681 | * ebx = 25 - subfunction number |
||
3682 | * ecx = signal number |
||
3683 | * edx = value of activity (0/1) |
||
3684 | Returned value: |
||
1662 | Nasarus | 3685 | * eax = -1 - invalid signal number |
3686 | * otherwise eax = old value of activity for this signal (0/1) |
||
1077 | Galkov | 3687 | Remarks: |
1662 | Nasarus | 3688 | * In current implementation only mask for user excepton handler, |
3689 | which has been previously set by subfunction 24, |
||
3690 | is changed. Signal number corresponds to exception number. |
||
1077 | Galkov | 3691 | |
3692 | ====================================================================== |
||
1662 | Nasarus | 3693 | ====================== Function 69 - debugging. ====================== |
114 | mikedld | 3694 | ====================================================================== |
118 | diamond | 3695 | A process can load other process as debugged by set of corresponding |
193 | diamond | 3696 | bit by call to subfunction 7 of function 70. |
118 | diamond | 3697 | A process can have only one debugger; one process can debug some |
3698 | others. The system notifies debugger on events occuring with |
||
3699 | debugged process. Messages are written to the buffer defined by |
||
114 | mikedld | 3700 | subfunction 0. |
118 | diamond | 3701 | Format of a message: |
3702 | * +0: dword: message code |
||
3703 | * +4: dword: PID of debugged process |
||
3704 | * +8: there can be additional data depending on message code |
||
3705 | Message codes: |
||
114 | mikedld | 3706 | * 1 = exception |
118 | diamond | 3707 | * in addition dword-number of the exception is given |
3708 | * process is suspended |
||
3709 | * 2 = process has terminated |
||
3710 | * comes at any termination: both through the system function -1, |
||
3711 | and at "murder" by any other process (including debugger itself) |
||
114 | mikedld | 3712 | * 3 = debug exception int 1 = #DB |
118 | diamond | 3713 | * in addition dword-image of the register DR6 is given: |
3714 | * bits 0-3: condition of the corresponding breakpoint (set by |
||
3715 | subfunction 9) is satisfied |
||
3716 | * бит 14: exception has occured because of the trace mode |
||
3717 | (flag TF is set TF) |
||
3718 | * process is suspended |
||
3719 | When debugger terminates, all debugged processes are killed. |
||
3720 | If debugger does not want this, it must previously detach by |
||
114 | mikedld | 3721 | subfunction 3. |
3722 | |||
1018 | diamond | 3723 | All subfunctions are applicable only to processes/threads started |
3724 | from the current by function 70 with set debugging flag. |
||
118 | diamond | 3725 | Debugging of multithreaded programs is not supported yet. |
3726 | The full list of subfunctions: |
||
3727 | * subfunction 0 - define data area for debug messages |
||
3728 | * subfunction 1 - get contents of registers of debugged thread |
||
3729 | * subfunction 2 - set contents of registers of debugged thread |
||
3730 | * subfunction 3 - detach from debugged process |
||
3731 | * subfunction 4 - suspend debugged thread |
||
3732 | * subfunction 5 - resume debugged thread |
||
3733 | * subfunction 6 - read from the memory of debugged process |
||
3734 | * subfunction 7 - write to the memory of debugged process |
||
3735 | * subfunction 8 - terminate debugged thread |
||
3736 | * subfunction 9 - set/clear hardware breakpoint |
||
114 | mikedld | 3737 | |
3738 | ====================================================================== |
||
118 | diamond | 3739 | = Function 69, subfunction 0 - define data area fror debug messages. = |
114 | mikedld | 3740 | ====================================================================== |
3741 | Parameters: |
||
118 | diamond | 3742 | * eax = 69 - function number |
3743 | * ebx = 0 - subfunction number |
||
114 | mikedld | 3744 | * ecx = pointer |
3745 | Format of data area: |
||
118 | diamond | 3746 | * +0: dword: N = buffer size (not including this header) |
3747 | * +4: dword: occupied place |
||
114 | mikedld | 3748 | * +8: N*byte: buffer |
3749 | Returned value: |
||
3750 | * function does not return value |
||
3751 | Remarks: |
||
118 | diamond | 3752 | * If the size field is negative, the buffer is considered locked |
3753 | and at arrival of new message the system will wait. |
||
3754 | For synchronization frame all work with the buffer by operations |
||
3755 | lock/unlock |
||
1662 | Nasarus | 3756 | neg [bufsize] |
118 | diamond | 3757 | * Data in the buffer are considered as array of items with variable |
3758 | length - messages. Format of a message is explained in |
||
3759 | general description. |
||
114 | mikedld | 3760 | |
3761 | ====================================================================== |
||
118 | diamond | 3762 | ===================== Function 69, subfunction 1 ===================== |
3763 | ============ Get contents of registers of debugged thread. =========== |
||
114 | mikedld | 3764 | ====================================================================== |
3765 | Parameters: |
||
118 | diamond | 3766 | * eax = 69 - function number |
3767 | * ebx = 1 - subfunction number |
||
114 | mikedld | 3768 | * ecx = thread identifier |
118 | diamond | 3769 | * edx = size of context structure, must be 0x28=40 bytes |
3770 | * esi = pointer to context structure |
||
114 | mikedld | 3771 | Returned value: |
3772 | * function does not return value |
||
118 | diamond | 3773 | Format of context structure: (FPU is not supported yet) |
114 | mikedld | 3774 | * +0: dword: eip |
3775 | * +4: dword: eflags |
||
3776 | * +8: dword: eax |
||
3777 | * +12 = +0xC: dword: ecx |
||
3778 | * +16 = +0x10: dword: edx |
||
3779 | * +20 = +0x14: dword: ebx |
||
3780 | * +24 = +0x18: dword: esp |
||
3781 | * +28 = +0x1C: dword: ebp |
||
3782 | * +32 = +0x20: dword: esi |
||
3783 | * +36 = +0x24: dword: edi |
||
3784 | Remarks: |
||
118 | diamond | 3785 | * If the thread executes code of ring-0, the function returns |
3786 | contents of registers of ring-3. |
||
3787 | * Process must be loaded for debugging (as is shown in |
||
3788 | general description). |
||
114 | mikedld | 3789 | |
3790 | ====================================================================== |
||
118 | diamond | 3791 | ===================== Function 69, subfunction 2 ===================== |
3792 | ============ Set contents of registers of debugged thread. =========== |
||
114 | mikedld | 3793 | ====================================================================== |
3794 | Parameters: |
||
118 | diamond | 3795 | * eax = 69 - function number |
3796 | * ebx = 2 - subfunction number |
||
114 | mikedld | 3797 | * ecx = thread identifier |
118 | diamond | 3798 | * edx = size of context structure, must be 0x28=40 bytes |
114 | mikedld | 3799 | Returned value: |
3800 | * function does not return value |
||
118 | diamond | 3801 | Format of context structure is shown in the description of |
3802 | subfunction 1. |
||
114 | mikedld | 3803 | Remarks: |
118 | diamond | 3804 | * If the thread executes code of ring-0, the function returns |
3805 | contents of registers of ring-3. |
||
3806 | * Process must be loaded for debugging (as is shown in |
||
3807 | general description). |
||
114 | mikedld | 3808 | |
3809 | ====================================================================== |
||
118 | diamond | 3810 | ===== Function 69, subfunction 3 - detach from debugged process. ===== |
114 | mikedld | 3811 | ====================================================================== |
3812 | Parameters: |
||
118 | diamond | 3813 | * eax = 69 - function number |
3814 | * ebx = 3 - subfunction number |
||
114 | mikedld | 3815 | * ecx = identifier |
3816 | Returned value: |
||
3817 | * function does not return value |
||
3818 | Remarks: |
||
118 | diamond | 3819 | * If the process was suspended, it resumes execution. |
114 | mikedld | 3820 | |
3821 | ====================================================================== |
||
1018 | diamond | 3822 | ======== Function 69, subfunction 4 - suspend debugged thread. ======= |
114 | mikedld | 3823 | ====================================================================== |
3824 | Parameters: |
||
118 | diamond | 3825 | * eax = 69 - function number |
3826 | * ebx = 4 - subfunction number |
||
3827 | * ecx = thread identifier |
||
114 | mikedld | 3828 | Returned value: |
3829 | * function does not return value |
||
1018 | diamond | 3830 | Remarks: |
3831 | * Process must be loaded for debugging (as is shown in |
||
3832 | general description). |
||
114 | mikedld | 3833 | |
3834 | ====================================================================== |
||
1018 | diamond | 3835 | ======== Function 69, subfunction 5 - resume debugged thread. ======== |
114 | mikedld | 3836 | ====================================================================== |
3837 | Parameters: |
||
118 | diamond | 3838 | * eax = 69 - function number |
3839 | * ebx = 5 - subfunction number |
||
3840 | * ecx = thread identifier |
||
114 | mikedld | 3841 | Returned value: |
3842 | * function does not return value |
||
1018 | diamond | 3843 | Remarks: |
3844 | * Process must be loaded for debugging (as is shown in |
||
3845 | general description). |
||
114 | mikedld | 3846 | |
3847 | ====================================================================== |
||
118 | diamond | 3848 | = Fucntion 69, subfunction 6 - read from memory of debugged process. = |
114 | mikedld | 3849 | ====================================================================== |
3850 | Parameters: |
||
118 | diamond | 3851 | * eax = 69 - function number |
3852 | * ebx = 6 - subfunction number |
||
114 | mikedld | 3853 | * ecx = identifier |
118 | diamond | 3854 | * edx = number of bytes to read |
3855 | * esi = address in the memory of debugged process |
||
3856 | * edi = pointer to buffer for data |
||
114 | mikedld | 3857 | Returned value: |
118 | diamond | 3858 | * eax = -1 at an error (invalid PID or buffer) |
3859 | * otherwise eax = number of read bytes (possibly, 0, |
||
3860 | if esi is too large) |
||
114 | mikedld | 3861 | Remarks: |
118 | diamond | 3862 | * Process must be loaded for debugging (as is shown in |
3863 | general description). |
||
114 | mikedld | 3864 | |
3865 | ====================================================================== |
||
118 | diamond | 3866 | == Function 69, subfunction 7 - write to memory of debugged process. = |
114 | mikedld | 3867 | ====================================================================== |
3868 | Parameters: |
||
118 | diamond | 3869 | * eax = 69 - function number |
3870 | * ebx = 7 - subfunction number |
||
114 | mikedld | 3871 | * ecx = identifier |
118 | diamond | 3872 | * edx = number of bytes to write |
3873 | * esi = address of memory in debugged process |
||
3874 | * edi = pointer to data |
||
114 | mikedld | 3875 | Returned value: |
118 | diamond | 3876 | * eax = -1 at an error (invalid PID or buffer) |
3877 | * otherwise eax = number of written bytes (possibly, 0, |
||
3878 | if esi is too large) |
||
114 | mikedld | 3879 | Remarks: |
118 | diamond | 3880 | * Process must be loaded for debugging (as is shown in |
3881 | general description). |
||
114 | mikedld | 3882 | |
3883 | ====================================================================== |
||
118 | diamond | 3884 | ======= Function 69, subfunction 8 - terminate debugged thread. ====== |
114 | mikedld | 3885 | ====================================================================== |
3886 | Parameters: |
||
118 | diamond | 3887 | * eax = 69 - function number |
3888 | * ebx = 8 - subfunction number |
||
114 | mikedld | 3889 | * ecx = identifier |
3890 | Returned value: |
||
3891 | * function does not return value |
||
3892 | Remarks: |
||
118 | diamond | 3893 | * Process must be loaded for debugging (as is shown in |
3894 | general description). |
||
3895 | * The function is similar to subfunction 2 of function 18 |
||
3896 | with two differences: it requires first remark and |
||
3897 | accepts PID rather than slot number. |
||
114 | mikedld | 3898 | |
3899 | ====================================================================== |
||
118 | diamond | 3900 | ===== Function 69, subfunction 9 - set/clear hardware breakpoint. ==== |
114 | mikedld | 3901 | ====================================================================== |
3902 | Parameters: |
||
118 | diamond | 3903 | * eax = 69 - function number |
3904 | * ebx = 9 - subfunction number |
||
114 | mikedld | 3905 | * ecx = thread identifier |
118 | diamond | 3906 | * dl = index of breakpoint, from 0 to 3 inclusively |
114 | mikedld | 3907 | * dh = flags: |
118 | diamond | 3908 | * if high bit is cleared - set breakpoint: |
114 | mikedld | 3909 | * bits 0-1 - condition: |
3910 | * 00 = breakpoint on execution |
||
118 | diamond | 3911 | * 01 = breakpoint on read |
3912 | * 11 = breakpoint on read/write |
||
3913 | * bits 2-3 - length; for breakpoints on exception it must be |
||
3914 | 00, otherwise one of |
||
3915 | * 00 = byte |
||
114 | mikedld | 3916 | * 01 = word |
118 | diamond | 3917 | * 11 = dword |
3918 | * esi = breakpoint address; must be aligned according to |
||
3919 | the length (i.e. must be even for word breakpoints, |
||
3920 | divisible by 4 for dword) |
||
3921 | * if high bit is set - clear breakpoint |
||
114 | mikedld | 3922 | Returned value: |
118 | diamond | 3923 | * eax = 0 - success |
114 | mikedld | 3924 | * eax = 1 - error in the input data |
118 | diamond | 3925 | * eax = 2 - (reserved, is never returned in the current |
3926 | implementation) a global breakpoint with that index is already set |
||
114 | mikedld | 3927 | Remarks: |
118 | diamond | 3928 | * Process must be loaded for debugging (as is shown in |
3929 | general description). |
||
3930 | * Hardware breakpoints are implemented through DRx-registers of |
||
3931 | the processor, all limitations results from this. |
||
3932 | * The function can reinstall the breakpoint, previously set |
||
3933 | by it (and it does not inform on this). |
||
3934 | Carry on the list of set breakpoints in the debugger. |
||
3935 | * Breakpoints generate debug exception #DB, on which the system |
||
3936 | notifies debugger. |
||
3937 | * Breakpoints on write and read/write act after |
||
3938 | execution of the caused it instruction. |
||
114 | mikedld | 3939 | |
3940 | ====================================================================== |
||
118 | diamond | 3941 | ==== Function 70 - work with file system with long names support. ==== |
114 | mikedld | 3942 | ====================================================================== |
3943 | Parameters: |
||
3944 | * eax = 70 |
||
118 | diamond | 3945 | * ebx = pointer to the information structure |
114 | mikedld | 3946 | Returned value: |
118 | diamond | 3947 | * eax = 0 - success; otherwise file system error code |
3948 | * some subfunctions return value in other registers too |
||
3949 | General format of the information structure: |
||
3950 | * +0: dword: subfunction number |
||
3951 | * +4: dword: file offset |
||
3952 | * +8: dword: high dword of offset (must be 0) or flags field |
||
114 | mikedld | 3953 | * +12 = +0xC: dword: size |
118 | diamond | 3954 | * +16 = +0x10: dword: pointer to data |
3955 | * +20 = +0x14: n db: ASCIIZ-string with the filename |
||
114 | mikedld | 3956 | or |
3957 | * +20 = +0x14: db 0 |
||
118 | diamond | 3958 | * +21 = +0x15: dd pointer to ASCIIZ-string with the filename |
3959 | Specifications - in documentation on the appropriate subfunction. |
||
3960 | Filename is case-insensitive. Russian letters must be written in |
||
3961 | the encoding cp866 (DOS). |
||
3962 | Format of filename: |
||
114 | mikedld | 3963 | /base/number/dir1/dir2/.../dirn/file, |
118 | diamond | 3964 | where /base/number identifies device, on which file is located: |
114 | mikedld | 3965 | one of |
118 | diamond | 3966 | * /RD/1 = /RAMDISK/1 to access ramdisk |
3967 | * /FD/1 = /FLOPPYDISK/1 to access first floppy drive, |
||
3968 | /FD/2 = /FLOPPYDISK/2 to access second one |
||
3969 | * /HD0/x, /HD1/x, /HD2/x, /HD3/x to access accordingly to devices |
||
3970 | IDE0 (Primary Master), IDE1 (Primary Slave), |
||
114 | mikedld | 3971 | IDE2 (Secondary Master), IDE3 (Secondary Slave); |
118 | diamond | 3972 | x - partition number on the selected hard drive, varies from 1 |
3973 | to 255 (on each hard drive the indexing starts from 1) |
||
3974 | * /CD0/1, /CD1/1, /CD2/1, /CD3/1 to access accordingly to |
||
3975 | CD on IDE0 (Primary Master), IDE1 (Primary Slave), |
||
3976 | IDE2 (Secondary Master), IDE3 (Secondary Slave) |
||
546 | diamond | 3977 | * /SYS means system folder; with the usual boot (from floppy) |
3978 | is equivalent to /RD/1 |
||
114 | mikedld | 3979 | Examples: |
3980 | * '/rd/1/kernel.asm',0 |
||
3981 | * '/HD0/1/kernel.asm',0 |
||
3982 | * '/hd0/2/menuet/pics/tanzania.bmp',0 |
||
3983 | * '/hd0/1/Program files/NameOfProgram/SomeFile.SomeExtension',0 |
||
546 | diamond | 3984 | * '/sys/MySuperApp.ini',0 |
1662 | Nasarus | 3985 | Also function supports relative names. If the path begins not |
3986 | with '/', it is considered relative to a current folder. To get or |
||
3987 | set a current folder, use the function 30. |
||
3988 | |||
118 | diamond | 3989 | Available subfunctions: |
114 | mikedld | 3990 | * subfunction 0 - read file |
3991 | * subfunction 1 - read folder |
||
3992 | * subfunction 2 - create/rewrite file |
||
131 | diamond | 3993 | * subfunction 3 - write to existing file |
133 | diamond | 3994 | * subfunction 4 - set file size |
118 | diamond | 3995 | * subfunction 5 - get attributes of file/folder |
3996 | * subfunction 6 - set attributes of file/folder |
||
114 | mikedld | 3997 | * subfunction 7 - start application |
193 | diamond | 3998 | * subfunction 8 - delete file/folder |
321 | diamond | 3999 | * subfunction 9 - create folder |
118 | diamond | 4000 | For CD-drives due to hardware limitations only subfunctions |
4001 | 0,1,5 and 7 are available, other subfunctions return error |
||
4002 | with code 2. |
||
641 | diamond | 4003 | At the first call of subfunctions 0,1,5,7 to ATAPI devices |
4004 | (CD and DVD) the manual control of tray is locked due to caching |
||
4005 | drive data. Unlocking is made when subfunction 4 of function 24 |
||
4006 | is called for corresponding device. |
||
114 | mikedld | 4007 | |
4008 | ====================================================================== |
||
118 | diamond | 4009 | === Function 70, subfunction 0 - read file with long names support. == |
114 | mikedld | 4010 | ====================================================================== |
4011 | Parameters: |
||
118 | diamond | 4012 | * eax = 70 - function number |
4013 | * ebx = pointer to the information structure |
||
4014 | Format of the information structure: |
||
4015 | * +0: dword: 0 = subfunction number |
||
4016 | * +4: dword: file offset (in bytes) |
||
4017 | * +8: dword: 0 (reserved for high dword of offset) |
||
4018 | * +12 = +0xC: dword: number of bytes to read |
||
4019 | * +16 = +0x10: dword: pointer to buffer for data |
||
4020 | * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are |
||
4021 | given in the general description |
||
114 | mikedld | 4022 | or |
4023 | * +20 = +0x14: db 0 |
||
118 | diamond | 4024 | * +21 = +0x15: dd pointer to ASCIIZ-string with file name |
114 | mikedld | 4025 | Returned value: |
118 | diamond | 4026 | * eax = 0 - success, otherwise file system error code |
4027 | * ebx = number of read bytes or -1=0xffffffff if file was not found |
||
114 | mikedld | 4028 | Remarks: |
118 | diamond | 4029 | * If file was ended before last requested block was read, |
4030 | the function will read as many as it can, and after that return |
||
4031 | eax=6 (EOF). |
||
4032 | * The function does not allow to read folder (returns eax=10, |
||
4033 | access denied). |
||
114 | mikedld | 4034 | |
118 | diamond | 4035 | ====================================================================== |
4036 | == Function 70, subfunction 1 - read folder with long names support. = |
||
4037 | ====================================================================== |
||
114 | mikedld | 4038 | Parameters: |
118 | diamond | 4039 | * eax = 70 - function number |
4040 | * ebx = pointer to the information structure |
||
4041 | Format of the information structure: |
||
4042 | * +0: dword: 1 = subfunction number |
||
4043 | * +4: dword: index of starting block (beginning from 0) |
||
4044 | * +8: dword: flags field: |
||
114 | mikedld | 4045 | * bit 0 (mask 1): in what format to return names, |
4046 | 0=ANSI, 1=UNICODE |
||
118 | diamond | 4047 | * other bits are reserved and must be set to 0 for the future |
4048 | compatibility |
||
4049 | * +12 = +0xC: dword: number of blocks to read |
||
4050 | * +16 = +0x10: dword: pointer to buffer for data, buffer size |
||
4051 | must be not less than 32 + [+12]*560 bytes |
||
4052 | * +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are |
||
4053 | given in the general description |
||
114 | mikedld | 4054 | or |
4055 | * +20 = +0x14: db 0 |
||
118 | diamond | 4056 | * +21 = +0x15: dd pointer to ASCIIZ-string with file name |
114 | mikedld | 4057 | Returned value: |
118 | diamond | 4058 | * eax = 0 - success, otherwise file system error code |
4059 | * ebx = number of files, information on which was written to |
||
4060 | the buffer, or -1=0xffffffff, if folder was not found |
||
114 | mikedld | 4061 | Structure of the buffer: |
4062 | * +0: 32*byte: header |
||
4063 | * +32 = +0x20: n1*byte: block with information on file 1 |
||
118 | diamond | 4064 | * +32+n1: n2*byte: block with information on file 2 |
114 | mikedld | 4065 | * ... |
4066 | Structure of header: |
||
118 | diamond | 4067 | * +0: dword: version of structure (current is 1) |
4068 | * +4: dword: number of placed blocks; is not greater than requested |
||
4069 | in the field +12 of information structure; can be less, if |
||
4070 | there are no more files in folder (the same as in ebx) |
||
4071 | * +8: dword: total number of files in folder |
||
4072 | * +12 = +0xC: 20*byte: reserved (zeroed) |
||
4073 | Structure of block of data for folder entry (BDFE): |
||
4074 | * +0: dword: attributes of file: |
||
4075 | * bit 0 (mask 1): file is read-only |
||
4076 | * bit 1 (mask 2): file is hidden |
||
4077 | * bit 2 (mask 4): file is system |
||
4078 | * bit 3 (mask 8): this is not a file but volume label |
||
4079 | (for one partition meets no more than once and |
||
4080 | only in root folder) |
||
4081 | * bit 4 (mask 0x10): this is a folder |
||
4082 | * bit 5 (mask 0x20): file was not archived - many archivation |
||
4083 | programs have an option to archive only files with this bit set, |
||
4084 | and after archiving this bit is cleared - it can be useful |
||
4085 | for automatically creating of backup-archives as at writing |
||
4086 | this bit is usually set |
||
4087 | * +4: byte: type of name data: |
||
4088 | (coincides with bit 0 of flags in the information structure) |
||
4089 | * 0 = ASCII = 1-byte representation of each character |
||
4090 | * 1 = UNICODE = 2-byte representation of each character |
||
114 | mikedld | 4091 | * +5: 3*byte: reserved (zero) |
118 | diamond | 4092 | * +8: 4*byte: time of file creation |
4093 | * +12 = +0xC: 4*byte: date of file creation |
||
4094 | * +16 = +0x10: 4*byte: time of last access (read or write) |
||
114 | mikedld | 4095 | * +20 = +0x14: 4*byte: date of last access |
118 | diamond | 4096 | * +24 = +0x18: 4*byte: time of last modification |
4097 | * +28 = +0x1C: 4*byte: date of last modification |
||
4098 | * +32 = +0x20: qword: file size in bytes (up to 16777216 Tb) |
||
114 | mikedld | 4099 | * +40 = +0x28: name |
118 | diamond | 4100 | * for ASCII format: maximum length is 263 characters |
4101 | (263 bytes), byte after the name has value 0 |
||
321 | diamond | 4102 | * for UNICODE format: maximum length is 259 characters |
118 | diamond | 4103 | (518 bytes), 2 bytes after the name have value 0 |
4104 | Time format: |
||
114 | mikedld | 4105 | * +0: byte: seconds |
4106 | * +1: byte: minutes |
||
4107 | * +2: byte: hours |
||
4108 | * +3: byte: reserved (0) |
||
118 | diamond | 4109 | * for example, 23.59.59 is written as (in hex) 3B 3B 17 00 |
4110 | Date format: |
||
4111 | * +0: byte: day |
||
4112 | * +1: byte: month |
||
4113 | * +2: word: year |
||
4114 | * for example, 25.11.1979 is written as (in hex) 19 0B BB 07 |
||
114 | mikedld | 4115 | Remarks: |
118 | diamond | 4116 | * If BDFE contains ASCII name, the length of BDFE is 304 bytes, |
4117 | if UNICODE name - 560 bytes. Value of length is aligned |
||
4118 | on 16-byte bound (to accelerate processing in CPU cache). |
||
4119 | * First character after a name is zero (ASCIIZ-string). The further |
||
4120 | data contain garbage. |
||
4121 | * If files in folder were ended before requested number was read, |
||
4122 | the function will read as many as it can, and after that return |
||
4123 | eax=6 (EOF). |
||
114 | mikedld | 4124 | * Any folder on the disk, except for root, contains two special |
118 | diamond | 4125 | entries "." and "..", identifying accordingly the folder itself |
4126 | and the parent folder. |
||
4127 | * The function allows also to read virtual folders "/", "/rd", |
||
4128 | "/fd", "/hd[n]", thus attributes of subfolders are set to 0x10, |
||
4129 | and times and dates are zeroed. An alternative way to get the |
||
4130 | equipment information - subfunction 11 of function 18. |
||
114 | mikedld | 4131 | |
4132 | ====================================================================== |
||
118 | diamond | 4133 | ===================== Function 70, subfunction 2 ===================== |
4134 | ============ Create/rewrite file with long names support. ============ |
||
114 | mikedld | 4135 | ====================================================================== |
4136 | Parameters: |
||
118 | diamond | 4137 | * eax = 70 - function number |
4138 | * ebx = pointer to the information structure |
||
4139 | Format of the information structure: |
||
4140 | * +0: dword: 2 = subfunction number |
||
114 | mikedld | 4141 | * +4: dword: 0 (reserved) |
4142 | * +8: dword: 0 (reserved) |
||
118 | diamond | 4143 | * +12 = +0xC: dword: number of bytes to read |
4144 | * +16 = +0x10: dword: pointer to data |
||
4145 | * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are |
||
4146 | given in the general description |
||
114 | mikedld | 4147 | or |
4148 | * +20 = +0x14: db 0 |
||
118 | diamond | 4149 | * +21 = +0x15: dd pointer to ASCIIZ-string with file name |
114 | mikedld | 4150 | Returned value: |
118 | diamond | 4151 | * eax = 0 - success, otherwise file system error code |
4152 | * ebx = number of written bytes (possibly 0) |
||
114 | mikedld | 4153 | Remarks: |
118 | diamond | 4154 | * If a file with given name did not exist, it is created; |
4155 | if it existed, it is rewritten. |
||
4156 | * If there is not enough free space on disk, the function will |
||
4157 | write as many as can and then return error code 8. |
||
4158 | * The function is not supported for CD (returns error code 2). |
||
114 | mikedld | 4159 | |
4160 | ====================================================================== |
||
131 | diamond | 4161 | ===================== Function 70, subfunction 3 ===================== |
4162 | =========== Write to existing file with long names support. ========== |
||
4163 | ====================================================================== |
||
4164 | Parameters: |
||
4165 | * eax = 70 - function number |
||
4166 | * ebx = pointer to the information structure |
||
4167 | Format of the information structure: |
||
4168 | * +0: dword: 3 = subfunction number |
||
4169 | * +4: dword: file offset (in bytes) |
||
4170 | * +8: dword: high dword of offset (must be 0 for FAT) |
||
4171 | * +12 = +0xC: dword: number of bytes to write |
||
4172 | * +16 = +0x10: dword: pointer to data |
||
4173 | * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are |
||
4174 | given in the general description |
||
4175 | or |
||
4176 | * +20 = +0x14: db 0 |
||
4177 | * +21 = +0x15: dd pointer to ASCIIZ-string with file name |
||
4178 | Returned value: |
||
4179 | * eax = 0 - success, otherwise file system error code |
||
4180 | * ebx = number of written bytes (possibly 0) |
||
4181 | Remarks: |
||
4182 | * The file must already exist, otherwise function returns eax=5. |
||
4183 | * The only result of write 0 bytes is update in the file attributes |
||
4184 | date/time of modification and access to the current date/time. |
||
4185 | * If beginning and/or ending position is greater than file size |
||
4186 | (except for the previous case), the file is expanded to needed |
||
4187 | size with zero characters. |
||
133 | diamond | 4188 | * The function is not supported for CD (returns error code 2). |
131 | diamond | 4189 | |
4190 | ====================================================================== |
||
133 | diamond | 4191 | ============ Function 70, subfunction 4 - set end of file. =========== |
4192 | ====================================================================== |
||
4193 | Parameters: |
||
4194 | * eax = 70 - function number |
||
4195 | * ebx = pointer to the information structure |
||
4196 | Format of the information structure: |
||
4197 | * +0: dword: 4 = subfunction number |
||
4198 | * +4: dword: low dword of new file size |
||
4199 | * +8: dword: high dword of new file size (must be 0 for FAT) |
||
4200 | * +12 = +0xC: dword: 0 (reserved) |
||
4201 | * +16 = +0x10: dword: 0 (reserved) |
||
4202 | * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are |
||
4203 | given in the general description |
||
4204 | or |
||
4205 | * +20 = +0x14: db 0 |
||
4206 | * +21 = +0x15: dd pointer to ASCIIZ-string with file name |
||
4207 | Returned value: |
||
4208 | * eax = 0 - success, otherwise file system error code |
||
4209 | * ebx destroyed |
||
4210 | Remarks: |
||
4211 | * If the new file size is less than old one, file is truncated. |
||
4212 | If the new size is greater than old one, file is expanded with |
||
4213 | characters with code 0. If the new size is equal to old one, |
||
4214 | the only result of call is set date/time of modification and |
||
4215 | access to the current date/time. |
||
4216 | * If there is not enough free space on disk for expansion, the |
||
4217 | function will expand to maximum possible size and then return |
||
4218 | error code 8. |
||
4219 | * The function is not supported for CD (returns error code 2). |
||
4220 | |||
4221 | ====================================================================== |
||
118 | diamond | 4222 | ==== Function 70, subfunction 5 - get information on file/folder. ==== |
114 | mikedld | 4223 | ====================================================================== |
4224 | Parameters: |
||
118 | diamond | 4225 | * eax = 70 - function number |
4226 | * ebx = pointer to the information structure |
||
4227 | Format of the information structure: |
||
4228 | * +0: dword: 5 = subfunction number |
||
114 | mikedld | 4229 | * +4: dword: 0 (reserved) |
4230 | * +8: dword: 0 (reserved) |
||
4231 | * +12 = +0xC: dword: 0 (reserved) |
||
118 | diamond | 4232 | * +16 = +0x10: dword: pointer to buffer for data (40 bytes) |
4233 | * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are |
||
4234 | given in the general description |
||
114 | mikedld | 4235 | or |
4236 | * +20 = +0x14: db 0 |
||
118 | diamond | 4237 | * +21 = +0x15: dd pointer to ASCIIZ-string with file name |
114 | mikedld | 4238 | Returned value: |
118 | diamond | 4239 | * eax = 0 - success, otherwise file system error code |
4240 | * ebx destroyed |
||
4241 | Information on file is returned in the BDFE format (block of data |
||
4242 | for folder entry), explained in the description of |
||
4243 | subfunction 1, but without filename |
||
4244 | (i.e. only first 40 = 0x28 bytes). |
||
114 | mikedld | 4245 | Remarks: |
118 | diamond | 4246 | * The function does not support virtual folders such as /, /rd and |
4247 | root folders like /rd/1. |
||
114 | mikedld | 4248 | |
4249 | ====================================================================== |
||
118 | diamond | 4250 | ===== Function 70, subfunction 6 - set attributes of file/folder. ==== |
114 | mikedld | 4251 | ====================================================================== |
4252 | Parameters: |
||
118 | diamond | 4253 | * eax = 70 - function number |
4254 | * ebx = pointer to the information structure |
||
4255 | Format of the information structure: |
||
4256 | * +0: dword: 6 = subfunction number |
||
114 | mikedld | 4257 | * +4: dword: 0 (reserved) |
4258 | * +8: dword: 0 (reserved) |
||
4259 | * +12 = +0xC: dword: 0 (reserved) |
||
118 | diamond | 4260 | * +16 = +0x10: dword: pointer to buffer with attributes (32 bytes) |
4261 | * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are |
||
4262 | given in the general description |
||
114 | mikedld | 4263 | or |
4264 | * +20 = +0x14: db 0 |
||
118 | diamond | 4265 | * +21 = +0x15: dd pointer to ASCIIZ-string with file name |
114 | mikedld | 4266 | Returned value: |
118 | diamond | 4267 | * eax = 0 - success, otherwise file system error code |
4268 | * ebx destroyed |
||
4269 | File attributes are first 32 bytes in BDFE (block of data |
||
4270 | for folder entry), explained in the description of subfunction 1 |
||
4271 | (that is, without name and size of file). Attribute |
||
4272 | file/folder/volume label (bits 3,4 in dword +0) is not changed. |
||
4273 | Byte +4 (name format) is ignored. |
||
114 | mikedld | 4274 | Remarks: |
118 | diamond | 4275 | * The function does not support virtual folders such as /, /rd and |
4276 | root folders like /rd/1. |
||
4277 | * The function is not supported for CD (returns error code 2). |
||
114 | mikedld | 4278 | |
4279 | ====================================================================== |
||
118 | diamond | 4280 | =========== Function 70, subfunction 7 - start application. ========== |
114 | mikedld | 4281 | ====================================================================== |
4282 | Parameters: |
||
118 | diamond | 4283 | * eax = 70 - function number |
4284 | * ebx = pointer to the information structure |
||
4285 | Format of the information structure: |
||
4286 | * +0: dword: 7 = subfunction number |
||
4287 | * +4: dword: flags field: |
||
4288 | * бит 0: start process as debugged |
||
4289 | * other bits are reserved and must be set to 0 |
||
4290 | * +8: dword: 0 or pointer to ASCIIZ-string with parameters |
||
114 | mikedld | 4291 | * +12 = +0xC: dword: 0 (reserved) |
4292 | * +16 = +0x10: dword: 0 (reserved) |
||
118 | diamond | 4293 | * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are |
4294 | given in the general description |
||
114 | mikedld | 4295 | or |
4296 | * +20 = +0x14: db 0 |
||
118 | diamond | 4297 | * +21 = +0x15: dd pointer to ASCIIZ-string with file name |
114 | mikedld | 4298 | Returned value: |
4299 | * eax > 0 - program is loaded, eax contains PID |
||
118 | diamond | 4300 | * eax < 0 - an error has occured, -eax contains |
4301 | file system error code |
||
4302 | * ebx destroyed |
||
114 | mikedld | 4303 | Remarks: |
118 | diamond | 4304 | * Command line must be terminated by the character with the code 0 |
4305 | (ASCIIZ-string); function takes into account either all characters |
||
4306 | up to terminating zero inclusively or first 256 character |
||
4307 | regarding what is less. |
||
4308 | * If the process is started as debugged, it is created in |
||
4309 | the suspended state; to run use subfunction 5 of function 69. |
||
114 | mikedld | 4310 | |
4311 | ====================================================================== |
||
193 | diamond | 4312 | ========== Function 70, subfunction 8 - delete file/folder. ========== |
4313 | ====================================================================== |
||
4314 | Parameters: |
||
4315 | * eax = 70 - function number |
||
4316 | * ebx = pointer to the information structure |
||
4317 | Format of the information structure: |
||
4318 | * +0: dword: 8 = subfunction number |
||
4319 | * +4: dword: 0 (reserved) |
||
4320 | * +8: dword: 0 (reserved) |
||
4321 | * +12 = +0xC: dword: 0 (reserved) |
||
4322 | * +16 = +0x10: dword: 0 (reserved) |
||
4323 | * +20 = +0x14: ASCIIZ-name of file, the rules of names forming are |
||
4324 | given in the general description |
||
4325 | or |
||
4326 | * +20 = +0x14: db 0 |
||
4327 | * +21 = +0x15: dd pointer to ASCIIZ-string with file name |
||
4328 | Returned value: |
||
4329 | * eax = 0 - success, otherwise file system error code |
||
4330 | * ebx destroyed |
||
4331 | Remarks: |
||
4332 | * The function is not supported for CD (returns error code 2). |
||
4333 | * The function can delete only empty folders (attempt to delete |
||
4334 | nonempty folder results in error with code 10, "access denied"). |
||
4335 | |||
4336 | ====================================================================== |
||
321 | diamond | 4337 | ============= Function 70, subfunction 9 - create folder. ============ |
4338 | ====================================================================== |
||
4339 | Parameters: |
||
4340 | * eax = 70 - function number |
||
4341 | * ebx = pointer to the information structure |
||
4342 | Format of the information structure: |
||
4343 | * +0: dword: 9 = subfunction number |
||
4344 | * +4: dword: 0 (reserved) |
||
4345 | * +8: dword: 0 (reserved) |
||
4346 | * +12 = +0xC: dword: 0 (reserved) |
||
4347 | * +16 = +0x10: dword: 0 (reserved) |
||
4348 | * +20 = +0x14: ASCIIZ-name of folder, the rules of names forming are |
||
4349 | given in the general description |
||
4350 | or |
||
4351 | * +20 = +0x14: db 0 |
||
4352 | * +21 = +0x15: dd pointer to ASCIIZ-string with folder name |
||
4353 | Returned value: |
||
4354 | * eax = 0 - success, otherwise file system error code |
||
4355 | * ebx destroyed |
||
4356 | Remarks: |
||
4357 | * The function is not supported for CD (returns error code 2). |
||
4358 | * The parent folder must already exist. |
||
4359 | * If target folder already exists, function returns success (eax=0). |
||
4360 | |||
4361 | ====================================================================== |
||
118 | diamond | 4362 | ========== Function 71, subfunction 1 - set window caption. ========== |
114 | mikedld | 4363 | ====================================================================== |
4364 | Parameters: |
||
4365 | * eax = 71 - function number |
||
4366 | * ebx = 1 - subfunction number |
||
118 | diamond | 4367 | * ecx = pointer to caption string |
114 | mikedld | 4368 | Returned value: |
118 | diamond | 4369 | * function does not return value |
114 | mikedld | 4370 | Remarks: |
118 | diamond | 4371 | * String must be in the ASCIIZ-format. Disregarding real string |
4372 | length, no more than 255 characters are drawn. |
||
4373 | * Pass NULL in ecx to remove caption. |
||
114 | mikedld | 4374 | |
4375 | ====================================================================== |
||
665 | diamond | 4376 | =============== Function 72 - send message to a window. ============== |
4377 | ====================================================================== |
||
4378 | |||
4379 | - Subfunction 1 - send message with parameter to the active window. -- |
||
4380 | Parameters: |
||
4381 | * eax = 72 - function number |
||
4382 | * ebx = 1 - subfunction number |
||
4383 | * ecx = event code: 2 or 3 |
||
4384 | * edx = parameter: key code for ecx=2, button identifier for ecx=3 |
||
4385 | Returned value: |
||
4386 | * eax = 0 - success |
||
4387 | * eax = 1 - buffer is full |
||
4388 | |||
4389 | ====================================================================== |
||
118 | diamond | 4390 | =============== Function -1 - terminate thread/process =============== |
114 | mikedld | 4391 | ====================================================================== |
4392 | Parameters: |
||
118 | diamond | 4393 | * eax = -1 - function number |
114 | mikedld | 4394 | Returned value: |
118 | diamond | 4395 | * function does not return neither value nor control |
114 | mikedld | 4396 | Remarks: |
118 | diamond | 4397 | * If the process did not create threads obviously, it has only |
4398 | one thread, which termination results in process termination. |
||
4399 | * If the current thread is last in the process, its termination |
||
4400 | also results in process terminates. |
||
4401 | * This function terminates the current thread. Other thread can be |
||
4402 | killed by call to subfunction 2 of function 18. |
||
114 | mikedld | 4403 | |
4404 | ====================================================================== |
||
4405 | =========================== List of events =========================== |
||
4406 | ====================================================================== |
||
118 | diamond | 4407 | Next event can be retrieved by the call of one from functions 10 |
4408 | (to wait for event), 11 (to check without waiting), 23 |
||
4409 | (to wait during the given time). |
||
4410 | These functions return only those events, which enter into a mask set |
||
4411 | by function 40. By default it is first three, |
||
4412 | there is enough for most applications. |
||
114 | mikedld | 4413 | Codes of events: |
118 | diamond | 4414 | * 1 = redraw event (is reset by call to function 0) |
4415 | * 2 = key on keyboard is pressed (acts, only when the window is |
||
4416 | active) or hotkey is pressed; is reset, when all keys from |
||
4417 | the buffer are read out by function 2 |
||
4418 | * 3 = button is pressed, defined earlier by function 8 |
||
4419 | (or close button, created implicitly by function 0; |
||
4420 | minimize button is handled by the system and sends no message; |
||
4421 | acts, only when the window is active; |
||
4422 | is reset when all buttons from the buffer |
||
4423 | are read out by function 17) |
||
4424 | * 4 = reserved (in current implementation never comes even after |
||
4425 | unmasking by function 40) |
||
4426 | * 5 = the desktop background is redrawed (is reset automatically |
||
4427 | after redraw, so if in redraw time program does not wait and |
||
4428 | does not check events, it will not remark this event) |
||
4429 | * 6 = mouse event (something happened - button pressing or moving; |
||
4430 | is reset at reading) |
||
4431 | * 7 = IPC event (see function 60 - |
||
4432 | Inter Process Communication; is reset at reading) |
||
4433 | * 8 = network event (is reset at reading) |
||
4434 | * 9 = debug event (is reset at reading; see |
||
4435 | debug subsystem) |
||
4436 | * 16..31 = event with appropriate IRQ |
||
4437 | (16=IRQ0, 31=IRQ15) (is reset after reading all IRQ data) |
||
114 | mikedld | 4438 | |
4439 | ====================================================================== |
||
118 | diamond | 4440 | =================== Error codes of the file system =================== |
114 | mikedld | 4441 | ====================================================================== |
118 | diamond | 4442 | * 0 = success |
4443 | * 1 = base and/or partition of a hard disk is not defined |
||
4444 | (by subfunctions 7, 8 of function 21) |
||
4445 | * 2 = function is not supported for the given file system |
||
4446 | * 3 = unknown file system |
||
448 | diamond | 4447 | * 4 = reserved, is never returned in the current implementation |
118 | diamond | 4448 | * 5 = file not found |
4449 | * 6 = end of file, EOF |
||
4450 | * 7 = pointer lies outside of application memory |
||
4451 | * 8 = disk is full |
||
4452 | * 9 = FAT table is destroyed |
||
114 | mikedld | 4453 | * 10 = access denied |
118 | diamond | 4454 | * 11 = device error |
4455 | Application start functions can return also following errors: |
||
4456 | * 30 = 0x1E = not enough memory |
||
4457 | * 31 = 0x1F = file is not executable |
||
4458 | * 32 = 0x20 = too many processes>>=4>=n<=4>=39>0,>=>=>=0xFFFF. |