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