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