Subversion Repositories Kolibri OS

Rev

Rev 8088 | Rev 8246 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2455 mario79 1
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;;                                                              ;;
6272 pathoswith 3
;; Copyright (C) KolibriOS team 2004-2016. All rights reserved. ;;
2455 mario79 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:
118 diamond 28
      * Y=1 - only define window area, draw nothing
131 diamond 29
      * Y=3 - skinned window
641 diamond 30
      * Y=4 - skinned fixed-size window
6473 pathoswith 31
      * Y=0,2 window types are outdated and should not be used anymore,
6171 leency 32
        they are retained for compatibility with old programs.
33
      * other possible values (from 5 to 15) are reserved,
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)
6168 leency 38
      * A = 1 - window has caption
118 diamond 39
      * B = 1 - coordinates of all graphics primitives are relative to
40
                  window client area
303 mikedld 41
      * C = 1 - don't fill working area on window draw
118 diamond 42
      * D = 0 - normal filling of the working area, 1 - gradient
43
    The following parameters are intended for windows
44
    of a type I and II, and ignored for styles Y=1,3:
45
  * esi = 0xXYRRGGBB - color of the header
46
    * RR, GG, BB define color
4051 heavyiron 47
    * Y=0 - usual window, Y=1 - unmovable window (works for all window styles)
6168 leency 48
    * X not used, other values of Y are reserved
49
  * edi = caption string for styles Y=3,4 (also can be set by func 71.1)
114 mikedld 50
Returned value:
51
  * function does not return value
52
Remarks:
118 diamond 53
  * Position and sizes of the window are installed by the first
54
    call of this function and are ignored at subsequent; to change
55
    position and/or sizes of already created window use function 67.
641 diamond 56
  * For windows with styles Y=3,4 and caption (A=1) caption string
57
    is set by the first call of this function and is ignored
58
    at subsequent (strictly speaking, is ignored after a call to
59
    subfunction 2 of function 12 - end redraw); to change caption of
60
    already created window use subfunction 1 of function 71.
118 diamond 61
  * If the window has appropriate styles, position and/or sizes can be
62
    changed by user. Current position and sizes can be obtained
63
    by function 9.
64
  * The window must fit on the screen. If the transferred
65
    coordinates and sizes do not satisfy to this condition,
66
    appropriate coordinate (or, probably, both) is considered as zero,
131 diamond 67
    and if it does not help too, the appropriate size
118 diamond 68
    (or, probably, both) is installed in a size of the screen.
2409 Serge 69
 
131 diamond 70
    Further let us designate xpos,ypos,xsize,ysize - values passed
71
    in ebx,ecx. The coordinates are resulted concerning
118 diamond 72
    the left upper corner of the window, which, thus, is set as (0,0),
73
    coordinates of the right lower corner essence (xsize,ysize).
7722 dunkaist 74
  * The sizes of the window are understood in sense of coordinates
118 diamond 75
    of the right lower corner. This concerns all other functions too.
76
    It means, that the real sizes are on 1 pixel more.
77
  * The window of style Y=1 looks as follows:
114 mikedld 78
    * completely defined by the application
6168 leency 79
  * The skinned window Y=3,4 looks as follows:
114 mikedld 80
    * draw external frame of width 1 pixel
118 diamond 81
      with color 'outer' from the skin
82
    * draw intermediate frame of width 3 pixel
83
      with color 'frame' from the skin
84
    * draw internal frame of width 1 pixel
85
      with color 'inner' from the skin
86
    * draw header (on bitmaps from the skin) in a rectangle
114 mikedld 87
      (0,0) - (xsize,_skinh-1)
118 diamond 88
    * if ysize>=26, fill the working area of the window -
89
      rectangle with the left upper corner (5,_skinh) and right lower
90
      (xsize-5,ysize-5) with color indicated in edx
91
      (taking a gradient into account)
133 diamond 92
    * define two standard buttons: close and minimize
114 mikedld 93
      (see function 8)
118 diamond 94
    * if A=1 and edi contains (nonzero) pointer to caption string,
95
      it is drawn in place in header defined in the skin
96
    * value _skinh is accessible as the result of call
97
      subfunction 4 of function 48
114 mikedld 98
 
6057 IgorA 99
---------------------- Constants for registers: ----------------------
100
  eax - SF_CREATE_WINDOW (0)
114 mikedld 101
======================================================================
118 diamond 102
================ Function 1 - put pixel in the window. ===============
114 mikedld 103
======================================================================
104
Parameters:
118 diamond 105
  * eax = 1 - function number
106
  * ebx = x-coordinate (relative to the window)
107
  * ecx = y-coordinate (relative to the window)
108
  * edx = 0x00RRGGBB - color of a pixel
109
    edx = 0x01xxxxxx - invert color of a pixel
110
          (low 24 bits are ignored)
114 mikedld 111
Returned value:
112
  * function does not return value
113
 
6057 IgorA 114
---------------------- Constants for registers: ----------------------
115
  eax - SF_PUT_PIXEL (1)
114 mikedld 116
======================================================================
118 diamond 117
============ Function 2 - get the code of the pressed key. ===========
114 mikedld 118
======================================================================
119
Takes away the code of the pressed key from the buffer.
120
Parameters:
118 diamond 121
  * eax = 2 - function number
114 mikedld 122
Returned value:
118 diamond 123
  * if the buffer is empty, function returns eax=1
124
  * if the buffer is not empty, function returns al=0,
4588 mario79 125
    ah=code of the pressed key,
4612 mario79 126
    bits 16-23 = contain scancode for pressed key in ASCII mode,
127
                 in the scancodes mode this bits cleared.
4588 mario79 128
    bits 23-31 = zero
118 diamond 129
  * if there is "hotkey", function returns al=2,
130
    ah=scancode of the pressed key (0 for control keys),
131
    high word of eax contains a status of control keys at the moment
132
    of pressing a hotkey
114 mikedld 133
Remarks:
118 diamond 134
  * There is a common system buffer of the pressed keys
135
    by a size of 120 bytes, organized as queue.
136
  * There is one more common system buffer on 120 "hotkeys".
137
  * If the application with the inactive window calls this function,
138
    the buffer of the pressed keys is considered to be empty.
139
  * By default this function returns ASCII-codes; to switch
140
    to the scancodes mode (and back) use function 66.
141
    However, hotkeys are always notificated as scancodes.
142
  * To find out, what keys correspond to what codes, start
143
    the application keyascii and scancode.
144
  * Scancodes come directly from keyboard and are fixed;
145
    ASCII-codes turn out with usage of the conversion tables,
146
    which can be set by subfunction 2 of function 21
147
    and get by subfunction 2 of function 26.
148
  * As a consequence, ASCII-codes take into account current
149
    keyboard layout (rus/en) as opposed to scancodes.
150
  * This function notifies only about those hotkeys, which were
151
    defined by this thread by subfunction 4 of function 66.
114 mikedld 152
 
6057 IgorA 153
---------------------- Constants for registers: ----------------------
154
  eax - SF_GET_KEY (2)
114 mikedld 155
======================================================================
118 diamond 156
==================== Function 3 - get system time. ===================
114 mikedld 157
======================================================================
158
Parameters:
118 diamond 159
  * eax = 3 - function number
114 mikedld 160
Returned value:
161
  * eax = 0x00SSMMHH, where HH:MM:SS = Hours:Minutes:Seconds
118 diamond 162
  * each item is BCD-number, for example,
163
    for time 23:59:59 function returns 0x00595923
114 mikedld 164
Remarks:
118 diamond 165
  * See also subfunction 9 of function 26 - get time from
166
    the moment of start of the system; it is more convenient, because
167
    returns simply DWORD-value of the time counter.
168
  * System time can be set by function 22.
114 mikedld 169
 
6057 IgorA 170
---------------------- Constants for registers: ----------------------
171
  eax - SF_GET_SYS_TIME (3)
114 mikedld 172
======================================================================
5848 pathoswith 173
=================== Function 4 - draw text string. ===================
114 mikedld 174
======================================================================
175
Parameters:
118 diamond 176
  * eax = 4 - function number
5848 pathoswith 177
  * ebx = X*65536+Y, coordinates in the window or buffer
178
  * ecx = 0xXXRRGGBB, where
118 diamond 179
    * RR, GG, BB specify text color
5848 pathoswith 180
    * XX = ABFFCSSS (bits):
5682 leency 181
      * A=1 - output zero terminated string
5848 pathoswith 182
      * B=1 - fill background (color = edi)
5682 leency 183
      * FF specifies the font and encoding:
184
 
5867 pathoswith 185
        1 = 8x16 cp866
5682 leency 186
        2 = 8x16 UTF-16LE
187
        3 = 8x16 UTF-8
5848 pathoswith 188
      * C=0 - draw to the window,
189
        C=1 - draw to the user buffer (edi)
190
      * SSS = (size multiplier)-1, so 0 = x1, 7 = x8
118 diamond 191
  * edx = pointer to the beginning of the string
5682 leency 192
  * esi = for A=0 length of the string, for A=1 is ignored
193
  * edi = for B=1 color to fill background,
5848 pathoswith 194
          for C=1 pointer to user buffer
3780 Serge 195
 
114 mikedld 196
Returned value:
197
  * function does not return value
198
Remarks:
5682 leency 199
  * You can not use B=1 and C=1 at the same time, since both use edi.
5848 pathoswith 200
  * When SSS=0, font may be smoothed, depending on system setting.
201
  * User buffer structure:
202
Xsize       dd
203
Ysize       dd
204
picture     rb  Xsize*Ysize*4  ; 32 bpp
114 mikedld 205
 
6057 IgorA 206
---------------------- Constants for registers: ----------------------
207
  eax - SF_DRAW_TEXT (4)
114 mikedld 208
======================================================================
118 diamond 209
========================= Function 5 - delay. ========================
114 mikedld 210
======================================================================
211
Delays execution of the program on the given time.
212
Parameters:
118 diamond 213
  * eax = 5 - function number
114 mikedld 214
  * ebx = time in the 1/100 of second
215
Returned value:
216
  * function does not return value
217
Remarks:
118 diamond 218
  * Passing ebx=0 does not transfer control to the next process
219
    and does not make any operations at all. If it is really required
220
    to transfer control to the next process (to complete a current
221
    time slice), use subfunction 1 of function 68.
114 mikedld 222
 
6057 IgorA 223
---------------------- Constants for registers: ----------------------
224
  eax - SF_SLEEP (5)
114 mikedld 225
======================================================================
226
=============== Function 7 - draw image in the window. ===============
227
======================================================================
118 diamond 228
Paramters:
229
  * eax = 7 - function number
230
  * ebx = pointer to the image in the format BBGGRRBBGGRR...
114 mikedld 231
  * ecx = [size on axis x]*65536 + [size on axis y]
232
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
233
Returned value:
234
  * function does not return value
235
Remarks:
118 diamond 236
  * Coordinates of the image are coordinates of the upper left corner
237
    of the image relative to the window.
114 mikedld 238
  * Size of the image in bytes is 3*xsize*ysize.
239
 
6057 IgorA 240
---------------------- Constants for registers: ----------------------
241
  eax - SF_PUT_IMAGE (7)
114 mikedld 242
======================================================================
243
=============== Function 8 - define/delete the button. ===============
244
======================================================================
118 diamond 245
Parameters for button definition:
246
  * eax = 8 - function number
114 mikedld 247
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
248
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
249
  * edx = 0xXYnnnnnn, where:
250
    * nnnnnn = identifier of the button
118 diamond 251
    * high (31st) bit of edx is cleared
252
    * if 30th bit of edx is set - do not draw the button
253
    * if 29th bit of edx is set - do not draw a frame
114 mikedld 254
      at pressing the button
118 diamond 255
  * esi = 0x00RRGGBB - color of the button
256
Parameters for button deleting:
257
  * eax = 8 - function number
114 mikedld 258
  * edx = 0x80nnnnnn, where nnnnnn - identifier of the button
259
Returned value:
260
  * function does not return value
261
Remarks:
118 diamond 262
  * Sizes of the button must be more than 0 and less than 0x8000.
131 diamond 263
  * For skinned windows definition of the window
118 diamond 264
    (call of 0th function) creates two standard buttons -
265
    for close of the window with identifier 1 and
266
    for minimize of the window with identifier 0xffff.
267
  * The creation of two buttons with same identifiers is admitted.
268
  * The button with the identifier 0xffff at pressing is interpreted
269
    by the system as the button of minimization, the system handles
270
    such pressing independently, not accessing to the application.
271
    In rest it is usual button.
272
  * Total number of buttons for all applications is limited to 4095.
114 mikedld 273
 
6057 IgorA 274
---------------------- Constants for registers: ----------------------
275
  eax - SF_DEFINE_BUTTON (8)
114 mikedld 276
======================================================================
118 diamond 277
============ Function 9 - information on execution thread. ===========
114 mikedld 278
======================================================================
279
Parameters:
118 diamond 280
  * eax = 9 - function number
281
  * ebx = pointer to 1-Kb buffer
282
  * ecx = number of the slot of the thread
283
    ecx = -1 - get information on the current thread
114 mikedld 284
Returned value:
118 diamond 285
  * eax = maximum number of the slot of a thread
286
  * buffer pointed to by ebx contains the following information:
287
    * +0: dword: usage of the processor (how many time units
288
      per second leaves on execution of this thread)
114 mikedld 289
    * +4: word: position of the window of thread in the window stack
118 diamond 290
    * +6: word: (has no relation to the specified thread)
291
      number of the thread slot, which window has in the window stack
292
      position ecx
114 mikedld 293
    * +8: word: reserved
294
    * +10 = +0xA: 11 bytes: name of the process
2625 mario79 295
      (name of the started file - executable file without extension)
142 diamond 296
    * +21 = +0x15: byte: reserved, this byte is not changed
114 mikedld 297
    * +22 = +0x16: dword: address of the process in memory
298
    * +26 = +0x1A: dword: size of used memory - 1
299
    * +30 = +0x1E: dword: identifier (PID/TID)
118 diamond 300
    * +34 = +0x22: dword: coordinate of the thread window on axis x
301
    * +38 = +0x26: dword: coordinate of the thread window on axis y
302
    * +42 = +0x2A: dword: size of the thread window on axis x
303
    * +46 = +0x2E: dword: size of the thread window on axis y
304
    * +50 = +0x32: word: status of the thread slot:
305
      * 0 = thread is running
306
      * 1 = thread is suspended
307
      * 2 = thread is suspended while waiting for event
308
      * 3 = thread is terminating as a result of call to function -1
309
        or under duress as a result of call to subfunction 2
310
        of function 18 or termination of the system
311
      * 4 = thread is terminating as a result of exception
312
      * 5 = thread waits for event
313
      * 9 = requested slot is free, all other information on the slot
314
        is not meaningful
142 diamond 315
    * +52 = +0x34: word: reserved, this word is not changed
316
    * +54 = +0x36: dword: coordinate of the client area on axis x
317
    * +58 = +0x3A: dword: coordinate of the client area on axis y
318
    * +62 = +0x3E: dword: width of the client area
319
    * +66 = +0x42: dword: height of the client area
320
    * +70 = +0x46: byte: state of the window - bitfield
321
      * bit 0 (mask 1): window is maximized
322
      * bit 1 (mask 2): window is minimized to panel
323
      * bit 2 (mask 4): window is rolled up
1663 Nasarus 324
    * +71 = +0x47: dword: event mask
4264 0CodErr 325
    * +75 = +0x4B: byte: keyboard mode(ASCII = 0; SCAN = 1)
114 mikedld 326
Remarks:
118 diamond 327
  * Slots are numbered starting from 1.
328
  * Returned value is not a total number of threads, because there
329
    can be free slots.
330
  * When process is starting, system automatically creates
331
    execution thread.
332
  * Function gives information on the thread. Each process has
333
    at least one thread. One process can create many threads,
334
    in this case each thread has its own slot and the fields
335
    +10, +22, +26 in these slots coincide.
336
    Applications have no common way to define whether two threads
114 mikedld 337
    belong to one process.
118 diamond 338
  * The active window - window on top of the window stack -
339
    receives the messages on a keyboard input. For such window
340
    the position in the window stack coincides with returned value.
341
  * Slot 1 corresponds to special system thread, for which:
342
    * the window is in the bottom of the window stack, the fields
343
      +4 and +6 contain value 1
344
    * name of the process - "OS/IDLE" (supplemented by spaces)
345
    * address of the process in memory is 0, size of used memory is
114 mikedld 346
      16 Mb (0x1000000)
347
    * PID=1
142 diamond 348
    * coordinates and sizes of the window and the client area are by
349
      convention set to 0
118 diamond 350
    * status of the slot is always 0 (running)
351
    * the execution time adds of time leaving on operations itself
352
      and idle time in waiting for interrupt (which can be got by call
353
      to subfunction 4 of function 18).
354
  * Beginning from slot 2, the normal applications are placed.
1662 Nasarus 355
  * The normal applications are placed in memory at the address
356
 
118 diamond 357
    There is no intersection, as each process has its own page table.
358
  * At creation of the thread it is assigned the slot
359
    in the system table and identifier (Process/Thread IDentifier =
360
    PID/TID), which do not vary with time for given thread.
361
    After completion of the thread its slot can be anew used
362
    for another thread. The thread identifier can not be assigned
363
    to other thread even after completion of this thread.
364
    Identifiers, assigned to new threads, grow monotonously.
365
  * If the thread has not yet defined the window by call to
366
    function 0, the position and the sizes
367
    of its window are considered to be zero.
142 diamond 368
  * Coordinates of the client area are relative to the window.
118 diamond 369
  * At the moment only the part of the buffer by a size
4264 0CodErr 370
    76 = 0x4C bytes is used. Nevertheless it is recommended to use
118 diamond 371
    1-Kb buffer for the future compatibility, in the future
372
    some fields can be added.
114 mikedld 373
 
6057 IgorA 374
---------------------- Constants for registers: ----------------------
375
  eax - SF_THREAD_INFO (9)
114 mikedld 376
======================================================================
118 diamond 377
==================== Function 10 - wait for event. ===================
114 mikedld 378
======================================================================
118 diamond 379
If the message queue is empty, waits for appearance of the message
380
in queue. In this state thread does not consume CPU time.
114 mikedld 381
Then reads out the message from queue.
382
 
383
Parameters:
118 diamond 384
  * eax = 10 - function number
114 mikedld 385
Returned value:
118 diamond 386
  * eax = event (see the list of events)
114 mikedld 387
Remarks:
118 diamond 388
  * Those events are taken into account only which enter into
389
    a mask set by function 40. By default it is
390
    redraw, key and button events.
391
  * To check, whether there is a message in queue, use function 11.
392
    To wait for no more than given time, use function 23.
114 mikedld 393
 
6057 IgorA 394
---------------------- Constants for registers: ----------------------
395
  eax - SF_WAIT_EVENT (10)
118 diamond 396
======================================================================
397
=============== Function 11 - check for event, no wait. ==============
398
======================================================================
399
If the message queue contains event, function reads out
400
and return it. If the queue is empty, function returns 0.
114 mikedld 401
Parameters:
118 diamond 402
  * eax = 11 - function number
114 mikedld 403
Returned value:
404
  * eax = 0 - message queue is empty
118 diamond 405
  * else eax = event (see the list of events)
114 mikedld 406
Remarks:
118 diamond 407
  * Those events are taken into account only, which enter into
408
    a mask set by function 40. By default it is
409
    redraw, key and button events.
410
  * To wait for event, use function 10.
411
    To wait for no more than given time, use function 23.
114 mikedld 412
 
6057 IgorA 413
---------------------- Constants for registers: ----------------------
414
  eax - SF_CHECK_EVENT (11)
114 mikedld 415
======================================================================
118 diamond 416
=============== Function 12 - begin/end window redraw. ===============
114 mikedld 417
======================================================================
418
 
139 diamond 419
---------------- Subfunction 1 - begin window redraw. ----------------
114 mikedld 420
Parameters:
118 diamond 421
  * eax = 12 - function number
422
  * ebx = 1 - subfunction number
114 mikedld 423
Returned value:
424
  * function does not return value
425
 
139 diamond 426
----------------- Subfunction 2 - end window redraw. -----------------
114 mikedld 427
Parameters:
118 diamond 428
  * eax = 12 - function number
429
  * ebx = 2 - subfunction number
114 mikedld 430
Returned value:
431
  * function does not return value
432
Remarks:
118 diamond 433
  * Subfunction 1 deletes all buttons defined with
434
    function 8, they must be defined again.
114 mikedld 435
 
6057 IgorA 436
---------------------- Constants for registers: ----------------------
437
  eax - SF_REDRAW (12)
438
  ebx - SSF_BEGIN_DRAW (1), SSF_END_DRAW (2)
114 mikedld 439
======================================================================
440
============ Function 13 - draw a rectangle in the window. ===========
441
======================================================================
442
Parameters:
118 diamond 443
  * eax = 13 - function number
114 mikedld 444
  * ebx = [coordinate on axis x]*65536 + [size on axis x]
445
  * ecx = [coordinate on axis y]*65536 + [size on axis y]
118 diamond 446
  * edx = color 0xRRGGBB or 0x80RRGGBB for gradient fill
114 mikedld 447
Returned value:
448
  * function does not return value
449
Remarks:
450
  * Coordinates are understood as coordinates of the left upper corner
118 diamond 451
    of a rectangle relative to the window.
114 mikedld 452
 
6057 IgorA 453
---------------------- Constants for registers: ----------------------
454
  eax - SF_DRAW_RECT (13)
114 mikedld 455
======================================================================
118 diamond 456
=================== Function 14 - get screen size. ===================
114 mikedld 457
======================================================================
458
Parameters:
118 diamond 459
  * eax = 14 - function number
114 mikedld 460
Returned value:
461
  * eax = [xsize]*65536 + [ysize], where
462
  * xsize = x-coordinate of the right lower corner of the screen =
118 diamond 463
            horizontal size - 1
114 mikedld 464
  * ysize = y-coordinate of the right lower corner of the screen =
118 diamond 465
            vertical size - 1
114 mikedld 466
Remarks:
118 diamond 467
  * See also subfunction 5 of function 48 - get sizes of
468
    working area of the screen.
114 mikedld 469
 
6057 IgorA 470
---------------------- Constants for registers: ----------------------
471
  eax - SF_GET_SCREEN_SIZE (14)
118 diamond 472
======================================================================
473
== Function 15, subfunction 1 - set a size of the background image. ==
474
======================================================================
114 mikedld 475
Parameters:
118 diamond 476
  * eax = 15 - function number
477
  * ebx = 1 - subfunction number
114 mikedld 478
  * ecx = width of the image
479
  * edx = height of the image
480
Returned value:
481
  * function does not return value
482
Remarks:
499 diamond 483
  * Before calling subfunctions 2 and 5 you should call this function
485 heavyiron 484
    to set image size!
118 diamond 485
  * For update of the screen (after completion of a series of commands
486
    working with a background) call subfunction 3.
487
  * There is a pair function for get size of the background image -
488
    subfunction 1 of function 39.
114 mikedld 489
 
6057 IgorA 490
---------------------- Constants for registers: ----------------------
491
  eax - SF_BACKGROUND_SET (15)
492
  ebx - SSF_SIZE_BG (1)
114 mikedld 493
======================================================================
118 diamond 494
=== Function 15, subfunction 2 - put pixel on the background image. ==
114 mikedld 495
======================================================================
496
Parameters:
118 diamond 497
  * eax = 15 - function number
498
  * ebx = 2 - subfunction number
114 mikedld 499
  * ecx = offset
118 diamond 500
  * edx = color of a pixel 0xRRGGBB
114 mikedld 501
Returned value:
502
  * function does not return value
503
Remarks:
118 diamond 504
  * Offset for a pixel with coordinates (x,y) is calculated as
114 mikedld 505
    (x+y*xsize)*3.
499 diamond 506
  * If the given offset exceeds size set by subfunction 1,
118 diamond 507
    the call is ignored.
508
  * For update of the screen (after completion of a series of commands
509
    working with a background) call subfunction 3.
510
  * There is a pair function for get pixel on the background image -
511
    subfunction 2 of function 39.
114 mikedld 512
 
6057 IgorA 513
---------------------- Constants for registers: ----------------------
514
  eax - SF_BACKGROUND_SET (15)
515
  ebx - SSF_PIXEL_BG (2)
114 mikedld 516
======================================================================
517
=========== Function 15, subfunction 3 - redraw background. ==========
518
======================================================================
519
Parameters:
118 diamond 520
  * eax = 15 - function number
521
  * ebx = 3 - subfunction number
114 mikedld 522
Returned value:
523
  * function does not return value
524
 
6057 IgorA 525
---------------------- Constants for registers: ----------------------
526
  eax - SF_BACKGROUND_SET (15)
527
  ebx - SSF_REDRAW_BG (3)
118 diamond 528
======================================================================
529
== Function 15, subfunction 4 - set drawing mode for the background. =
530
======================================================================
114 mikedld 531
Parameters:
118 diamond 532
  * eax = 15 - function number
533
  * ebx = 4 - subfunction number
534
  * ecx = drawing mode:
114 mikedld 535
    * 1 = tile
536
    * 2 = stretch
537
Returned value:
538
  * function does not return value
539
Remarks:
118 diamond 540
  * For update of the screen (after completion of a series of commands
541
    working with a background) call subfunction 3.
542
  * There is a pair function for get drawing mode of the background -
543
    subfunction 4 of function 39.
114 mikedld 544
 
6057 IgorA 545
---------------------- Constants for registers: ----------------------
546
  eax - SF_BACKGROUND_SET (15)
547
  ebx - SSF_MODE_BG (4)
118 diamond 548
======================================================================
549
===================== Function 15, subfunction 5 =====================
550
============ Put block of pixels on the background image. ============
551
======================================================================
114 mikedld 552
Parameters:
118 diamond 553
  * eax = 15 - function number
554
  * ebx = 5 - subfunction number
555
  * ecx = pointer to the data in the format BBGGRRBBGGRR...
114 mikedld 556
  * edx = offset in data of the background image
118 diamond 557
  * esi = size of data in bytes = 3 * number of pixels
114 mikedld 558
Returned value:
559
  * function does not return value
560
Remarks:
499 diamond 561
  * Offset and size are not checked for correctness.
118 diamond 562
  * Color of each pixel is stored as 3-bytes value BBGGRR.
563
  * Pixels of the background image are written sequentially
564
    from left to right, from up to down.
565
  * Offset of pixel with coordinates (x,y) is (x+y*xsize)*3.
566
  * For update of the screen (after completion of a series of commands
567
    working with a background) call subfunction 3.
114 mikedld 568
 
6057 IgorA 569
---------------------- Constants for registers: ----------------------
570
  eax - SF_BACKGROUND_SET (15)
571
  ebx - SSF_IMAGE_BG (5)
114 mikedld 572
======================================================================
546 diamond 573
===================== Function 15, subfunction 6 =====================
574
======== Map background data to the address space of process. ========
575
======================================================================
576
Parameters:
577
  * eax = 15 - function number
578
  * ebx = 6 - subfunction number
579
Returned value:
580
  * eax = pointer to background data, 0 if error
581
Remarks:
582
  * Mapped data are available for read and write.
583
  * Size of background data is 3*xsize*ysize. The system blocks
584
    changes of background sizes while process works with mapped data.
585
  * Color of each pixel is stored as 3-bytes value BBGGRR.
586
  * Pixels of the background image are written sequentially
587
    from left to right, from up to down.
588
 
6057 IgorA 589
---------------------- Constants for registers: ----------------------
590
  eax - SF_BACKGROUND_SET (15)
591
  ebx - SSF_MAP_BG (6)
546 diamond 592
======================================================================
593
===== Function 15, subfunction 7 - close mapped background data. =====
594
======================================================================
595
Parameters:
596
  * eax = 15 - function number
597
  * ebx = 7 - subfunction number
598
  * ecx = pointer to mapped data
599
Returned value:
600
  * eax = 1 - success, 0 - error
601
 
6057 IgorA 602
---------------------- Constants for registers: ----------------------
603
  eax - SF_BACKGROUND_SET (15)
604
  ebx - SSF_UNMAP_BG (7)
546 diamond 605
======================================================================
2515 mario79 606
===================== Function 15, subfunction 8 =====================
607
============= Get coordinates of last draw the background ============
608
======================================================================
609
Parameters:
610
  * eax = 15 - function number
611
  * ebx = 8 - subfunction number
612
Returned value:
613
  * eax = [left]*65536 + [right]
614
  * ebx = [top]*65536 + [bottom]
615
Remarks:
616
  * (left,top) are coordinates of the left upper corner,
617
    (right,bottom) are coordinates of the right lower one.
618
  * For receiving more reliable information, call the function
619
    immediately after the event:
620
             5 = kernel finished redrawing of the desktop background
621
 
6057 IgorA 622
---------------------- Constants for registers: ----------------------
623
  eax - SF_BACKGROUND_SET (15)
624
  ebx - SSF_LAST_DRAW (8)
2515 mario79 625
======================================================================
2547 mario79 626
===================== Function 15, subfunction 9 =====================
627
============= Redraws a rectangular part of the background ===========
628
======================================================================
629
Parameters:
630
  * eax = 15 - function number
631
  * ebx = 9 - subfunction number
632
  * ecx = [left]*65536 + [right]
633
  * edx = [top]*65536 + [bottom]
634
Returned value:
635
  * function does not return value
636
Remarks:
637
  * (left,top) are coordinates of the left upper corner,
638
    (right,bottom) are coordinates of the right lower one.
639
  * If parameters are set incorrectly then background is not redrawn.
640
 
6057 IgorA 641
---------------------- Constants for registers: ----------------------
642
  eax - SF_BACKGROUND_SET (15)
643
  ebx - SSF_REDRAW_RECT (9)
2547 mario79 644
======================================================================
118 diamond 645
=============== Function 16 - save ramdisk on a floppy. ==============
114 mikedld 646
======================================================================
647
Parameters:
118 diamond 648
  * eax = 16 - function number
649
  * ebx = 1 or ebx = 2 - on which floppy save
114 mikedld 650
Returned value:
118 diamond 651
  * eax = 0 - success
114 mikedld 652
  * eax = 1 - error
653
 
6057 IgorA 654
---------------------- Constants for registers: ----------------------
655
  eax - SF_RD_TO_FLOPPY (16)
114 mikedld 656
======================================================================
118 diamond 657
======= Function 17 - get the identifier of the pressed button. ======
114 mikedld 658
======================================================================
659
Takes away the code of the pressed button from the buffer.
660
Parameters:
118 diamond 661
  * eax = 17 - function number
114 mikedld 662
Returned value:
118 diamond 663
  * if the buffer is empty, function returns eax=1
1018 diamond 664
  * if the buffer is not empty:
665
    * high 24 bits of eax contain button identifier (in particular,
666
      ah contains low byte of the identifier; if all buttons have
667
      the identifier less than 256, ah is enough to distinguish)
668
    * al = 0 - the button was pressed with left mouse button
669
    * al = bit corresponding to used mouse button otherwise
114 mikedld 670
Remarks:
118 diamond 671
  * "Buffer" keeps only one button, at pressing the new button the
672
    information about old is lost.
673
  * The call of this function by an application with inactive window
674
    will return answer "buffer is empty".
1018 diamond 675
  * Returned value for al corresponds to the state of mouse buttons
676
    as in subfunction 2 of function 37 at the beginning
677
    of button press, excluding lower bit, which is cleared.
114 mikedld 678
 
6057 IgorA 679
---------------------- Constants for registers: ----------------------
680
  eax - SF_GET_BUTTON (17)
114 mikedld 681
======================================================================
2244 mario79 682
===================== Function 18, subfunction 1 =====================
683
============= Make deactive the window of the given thread. ==========
684
======================================================================
685
Parameters:
686
  * eax = 18 - function number
687
  * ebx = 1 - subfunction number
688
  * ecx = number of the thread slot
689
Returned value:
690
  * function does not return value
2409 Serge 691
 
6057 IgorA 692
---------------------- Constants for registers: ----------------------
693
  eax - SF_SYSTEM (18)
694
  ebx - SSF_UNFOCUS_WINDOW (1)
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
 
6057 IgorA 711
---------------------- Constants for registers: ----------------------
712
  eax - SF_SYSTEM (18)
713
  ebx - SSF_TERMINATE_THREAD (2)
118 diamond 714
======================================================================
715
===================== Function 18, subfunction 3 =====================
716
============= Make active the window of the given thread. ============
717
======================================================================
114 mikedld 718
Parameters:
118 diamond 719
  * eax = 18 - function number
720
  * ebx = 3 - subfunction number
721
  * ecx = number of the thread slot
114 mikedld 722
Returned value:
723
  * function does not return value
724
Remarks:
118 diamond 725
  * If correct, but nonexistent slot is given,
726
    some window is made active.
727
  * To find out, which window is active, use subfunction 7.
114 mikedld 728
 
6057 IgorA 729
---------------------- Constants for registers: ----------------------
730
  eax - SF_SYSTEM (18)
731
  ebx - SSF_FOCUS_WINDOW (3)
118 diamond 732
======================================================================
733
===================== Function 18, subfunction 4 =====================
734
=========== Get counter of idle time units per one second. ===========
735
======================================================================
736
Idle time units are units, in which the processor stands idle
737
in waiting for interrupt (in the command 'hlt').
114 mikedld 738
 
739
Parameters:
118 diamond 740
  * eax = 18 - function number
741
  * ebx = 4 - subfunction number
114 mikedld 742
Returned value:
118 diamond 743
  * eax = value of the counter of idle time units per one second
114 mikedld 744
 
6057 IgorA 745
---------------------- Constants for registers: ----------------------
746
  eax - SF_SYSTEM (18)
747
  ebx - SSF_GET_IDLE_COUNT (4)
114 mikedld 748
======================================================================
118 diamond 749
========== Function 18, subfunction 5 - get CPU clock rate. ==========
114 mikedld 750
======================================================================
751
Parameters:
118 diamond 752
  * eax = 18 - function number
753
  * ebx = 5 - subfunction number
114 mikedld 754
Returned value:
118 diamond 755
  * eax = clock rate (modulo 2^32 clock ticks = 4GHz)
114 mikedld 756
 
6057 IgorA 757
---------------------- Constants for registers: ----------------------
758
  eax - SF_SYSTEM (18)
6683 leency 759
  ebx - SSF_GET_CPU_FREQUENCY (5)
118 diamond 760
======================================================================
2409 Serge 761
 Function 18, subfunction 6 - save ramdisk to the file on hard drive.
118 diamond 762
======================================================================
114 mikedld 763
Parameters:
118 diamond 764
  * eax = 18 - function number
765
  * ebx = 6 - subfunction number
341 heavyiron 766
  * ecx = pointer to the full path to file
767
    (for example, "/hd0/1/kolibri/kolibri.img")
114 mikedld 768
Returned value:
118 diamond 769
  * eax = 0 - success
770
  * else eax = error code of the file system
499 diamond 771
Remarks:
118 diamond 772
  * All folders in the given path must exist, otherwise function
773
    returns value 5, "file not found".
114 mikedld 774
 
6057 IgorA 775
---------------------- Constants for registers: ----------------------
776
  eax - SF_SYSTEM (18)
777
  ebx - SSF_RD_TO_HDD (6)
114 mikedld 778
======================================================================
118 diamond 779
=========== Function 18, subfunction 7 - get active window. ==========
114 mikedld 780
======================================================================
781
Parameters:
118 diamond 782
  * eax = 18 - function number
783
  * ebx = 7 - subfunction number
114 mikedld 784
Returned value:
118 diamond 785
  * eax = number of the active window
786
    (number of the slot of the thread with active window)
114 mikedld 787
Remarks:
118 diamond 788
  * Active window is at the top of the window stack and receives
789
    messages on all keyboard input.
790
  * To make a window active, use subfunction 3.
114 mikedld 791
 
6057 IgorA 792
---------------------- Constants for registers: ----------------------
793
  eax - SF_SYSTEM (18)
794
  ebx - SSF_GET_ACTIVE_WINDOW (7)
118 diamond 795
======================================================================
796
== Function 18, subfunction 8 - disable/enable the internal speaker. =
797
======================================================================
798
If speaker sound is disabled, all calls to subfunction 55 of
799
function 55 are ignored. If speaker sound is enabled,
800
they are routed on builtin speaker.
114 mikedld 801
 
118 diamond 802
------------------- Subsubfunction 1 - get status. -------------------
114 mikedld 803
Parameters:
118 diamond 804
  * eax = 18 - function number
805
  * ebx = 8 - subfunction number
806
  * ecx = 1 - number of the subsubfunction
114 mikedld 807
Returned value:
118 diamond 808
  * eax = 0 - speaker sound is enabled; 1 - disabled
114 mikedld 809
 
118 diamond 810
----------------- Subsubfunction 2 - toggle status. ------------------
811
Toggles states of disable/enable.
114 mikedld 812
Parameters:
118 diamond 813
  * eax = 18 - function number
814
  * ebx = 8 - subfunction number
815
  * ecx = 2 - number of the subsubfunction
114 mikedld 816
Returned value:
817
  * function does not return value
818
 
6057 IgorA 819
---------------------- Constants for registers: ----------------------
820
  eax - SF_SYSTEM (18)
821
  ebx - SSF_SPEAKER (8)
822
  ecx - SSSF_GET_STATE (1), SSSF_TOGGLE (2)
118 diamond 823
======================================================================
1018 diamond 824
== Function 18, subfunction 9 - system shutdown with the parameter. ==
118 diamond 825
======================================================================
114 mikedld 826
Parameters:
118 diamond 827
  * eax = 18 - function number
828
  * ebx = 9 - subfunction number
114 mikedld 829
  * ecx = parameter:
118 diamond 830
    * 2 = turn off computer
831
    * 3 = reboot computer
832
    * 4 = restart the kernel from the file 'kernel.mnt' on ramdisk
114 mikedld 833
Returned value:
118 diamond 834
  * at incorrect ecx the registers do not change (i.e. eax=18)
835
  * by correct call function always returns eax=0
836
    as the tag of success
114 mikedld 837
Remarks:
118 diamond 838
  * Do not rely on returned value by incorrect call, it can be
839
    changed in future versions of the kernel.
1018 diamond 840
 
6057 IgorA 841
---------------------- Constants for registers: ----------------------
842
  eax - SF_SYSTEM (18)
843
  ebx - SSF_SHUTDOWN (9)
118 diamond 844
======================================================================
4573 clevermous 845
======= Function 18, subfunction 10 - minimize topmost window. =======
118 diamond 846
======================================================================
4573 clevermous 847
Minimizes the topmost (active) window.
114 mikedld 848
Parameters:
118 diamond 849
  * eax = 18 - function number
850
  * ebx = 10 - subfunction number
114 mikedld 851
Returned value:
852
  * function does not return value
853
Remarks:
118 diamond 854
  * The minimized window from the point of view of function 9
855
    keeps position and sizes.
2409 Serge 856
  * Restoring of an application window occurs at its activation by
118 diamond 857
    subfunction 3.
4573 clevermous 858
  * Usually there is no necessity to minimize/restore a window
859
    explicitly: minimization of a window is carried out by the system
118 diamond 860
    at pressing the minimization button (for skinned windows
861
    it is defined automatically by function 0,
862
    for other windows it can be defined manually by function 8),
5452 leency 863
    restore of a window is done by the application '@taskbar'.
114 mikedld 864
 
6057 IgorA 865
---------------------- Constants for registers: ----------------------
866
  eax - SF_SYSTEM (18)
867
  ebx - SSF_MINIMIZE_WINDOW (10)
114 mikedld 868
======================================================================
2409 Serge 869
 Function 18, subfunction 11 - get information on the disk subsystem.
114 mikedld 870
======================================================================
871
Parameters:
118 diamond 872
  * eax = 18 - function number
873
  * ebx = 11 - subfunction number
114 mikedld 874
  * ecx = type of the table:
4700 mario79 875
    * 1 = short version, 16 bytes
118 diamond 876
  * edx = pointer to the buffer (in the application) for the table
114 mikedld 877
Returned value:
878
  * function does not return value
118 diamond 879
Format of the table: short version:
880
  * +0: byte: information about FDD's (drives for floppies),
881
    AAAABBBB, where AAAA gives type of the first drive, BBBB -
882
    of the second regarding to the following list:
114 mikedld 883
    * 0 = there is no drive
884
    * 1 = 360Kb, 5.25''
885
    * 2 = 1.2Mb, 5.25''
886
    * 3 = 720Kb, 3.5''
887
    * 4 = 1.44Mb, 3.5''
118 diamond 888
    * 5 = 2.88Mb, 3.5'' (such drives are not used anymore)
889
    For example, for the standard configuration from one 1.44-drive
890
    here will be 40h, and for the case 1.2Mb on A: and 1.44Mb on B:
5452 leency 891
    the value is 24h.
6079 serge 892
 
4700 mario79 893
  First IDE controller:
118 diamond 894
  * +1: byte: information about hard disks and CD-drives, AABBCCDD,
114 mikedld 895
    where AA corresponds to the controller IDE0, ..., DD - IDE3:
4700 mario79 896
    * 0 = device not found
118 diamond 897
    * 1 = hard drive
898
    * 2 = CD-drive
899
    For example, in the case HD on IDE0 and CD on IDE2
900
    this field contains 48h.
901
  * +2: 4 db: number of the retrieved partitions on hard disks
5452 leency 902
    at accordingly IDE0,...,IDE3.
6079 serge 903
 
5452 leency 904
  Second IDE controller:
905
  * +6: byte: information about hard disks and CD-drives, AABBCCDD,
906
    where AA corresponds to the controller IDE4, ..., DD - IDE7:
907
    * 0 = device not found
908
    * 1 = hard drive
909
    * 2 = CD-drive
910
    For example, in the case HD on IDE4 and CD on IDE6
911
    this field contains 48h.
912
  * +7: 4 db: number of the retrieved partitions on hard disks
913
    at accordingly IDE4,...,IDE7.
914
 
915
  Third IDE controller:
916
  * +11: byte: information about hard disks and CD-drives, AABBCCDD,
917
    where AA corresponds to the controller IDE8, ..., DD - IDE11:
918
    * 0 = device not found
919
    * 1 = hard drive
920
    * 2 = CD-drive
921
    For example, in the case HD on IDE8 and CD on IDE10
922
    this field contains 48h.
923
  * +12: 4 db: number of the retrieved partitions on hard disks
6079 serge 924
    at accordingly IDE8,...,IDE11.
925
 
118 diamond 926
    If the hard disk on IDEx is absent, appropriate byte is zero,
927
    otherwise it shows number of the recognized partitions, which
928
    can be not presented (if the drive is not formatted or if
929
    the file system is not supported). Current version of the kernel
4700 mario79 930
    supports only FAT12/16/32, NTFS, ext2/3/4 and XFS for hard disks.
4641 mario79 931
 
114 mikedld 932
Remarks:
4700 mario79 933
  * The table can be used for obtaining the information about
118 diamond 934
    available devices.
114 mikedld 935
 
6057 IgorA 936
---------------------- Constants for registers: ----------------------
937
  eax - SF_SYSTEM (18)
938
  ebx - SSF_INFO_DISC_SYS (11)
114 mikedld 939
======================================================================
118 diamond 940
========== Function 18, subfunction 13 - get kernel version. =========
114 mikedld 941
======================================================================
942
Parameters:
118 diamond 943
  * eax = 18 - function number
944
  * ebx = 13 - subfunction number
945
  * ecx = pointer to the buffer (not less than 16 bytes), where
946
    the information will be placed
114 mikedld 947
Returned value:
948
  * function does not return value
949
Structure of the buffer:
950
db a,b,c,d for version a.b.c.d
1675 Nasarus 951
db 0: reserved
540 victor 952
dd REV - kernel SVN revision number
1675 Nasarus 953
For Kolibri 0.7.7.0+ kernel:
1662 Nasarus 954
db 0,7,7,0
1675 Nasarus 955
db 0
1676 Nasarus 956
dd 1675
114 mikedld 957
 
6057 IgorA 958
---------------------- Constants for registers: ----------------------
959
  eax - SF_SYSTEM (18)
960
  ebx - SSF_KERNEL_VERSION (13)
118 diamond 961
======================================================================
962
======= Function 18, subfunction 14 - wait for screen retrace. =======
963
======================================================================
964
Waits for the beginning of retrace of the scanning ray of the screen
965
monitor.
114 mikedld 966
Parameters:
118 diamond 967
  * eax = 18 - function number
968
  * ebx = 14 - subfunction number
114 mikedld 969
Returned value:
118 diamond 970
  * eax = 0 as the tag of success
114 mikedld 971
Remarks:
118 diamond 972
  * Function is intended only for active high-efficiency graphics
114 mikedld 973
    applications; is used for smooth output of a graphics.
974
 
6057 IgorA 975
---------------------- Constants for registers: ----------------------
976
  eax - SF_SYSTEM (18)
977
  ebx - SSF_WAIT_RETRACE (14)
118 diamond 978
======================================================================
979
== Function 18, subfunction 15 - center mouse cursor on the screen. ==
980
======================================================================
114 mikedld 981
Parameters:
118 diamond 982
  * eax = 18 - function number
983
  * ebx = 15 - subfunction number
114 mikedld 984
Returned value:
118 diamond 985
  * eax = 0 as the tag of success
114 mikedld 986
 
6057 IgorA 987
---------------------- Constants for registers: ----------------------
988
  eax - SF_SYSTEM (18)
989
  ebx - SSF_CURSOR_CENTER (15)
114 mikedld 990
======================================================================
118 diamond 991
========= Function 18, subfunction 16 - get size of free RAM. ========
114 mikedld 992
======================================================================
993
Parameters:
118 diamond 994
  * eax = 18 - function number
995
  * ebx = 16 - subfunction number
114 mikedld 996
Returned value:
997
  * eax = size of free memory in kilobytes
998
 
6057 IgorA 999
---------------------- Constants for registers: ----------------------
1000
  eax - SF_SYSTEM (18)
1001
  ebx - SSF_GET_FREE_RAM (16)
114 mikedld 1002
======================================================================
118 diamond 1003
======== Function 18, subfunction 17 - get full amount of RAM. =======
114 mikedld 1004
======================================================================
1005
Parameters:
118 diamond 1006
  * eax = 18 - function number
1007
  * ebx = 17 - subfunction number
114 mikedld 1008
Returned value:
118 diamond 1009
  * eax = total size of existing memory in kilobytes
114 mikedld 1010
 
6057 IgorA 1011
---------------------- Constants for registers: ----------------------
1012
  eax - SF_SYSTEM (18)
1013
  ebx - SSF_GET_TOTAL_RAM (17)
114 mikedld 1014
======================================================================
118 diamond 1015
===================== Function 18, subfunction 18 ====================
1016
============= Terminate process/thread by the identifier. ============
114 mikedld 1017
======================================================================
1018
Parameters:
118 diamond 1019
  * eax = 18 - function number
1020
  * ebx = 18 - subfunction number
7722 dunkaist 1021
  * ecx = identifier of process/thread (PID/TID)
114 mikedld 1022
Returned value:
118 diamond 1023
  * eax = 0 - success
1024
  * eax = -1 - error (process is not found or is system)
114 mikedld 1025
Remarks:
118 diamond 1026
  * It is impossible to terminate system thread OS/IDLE (identifier
1027
    1), it is possible to terminate any normal process/thread.
1028
  * See also subfunction 2 - terminate
1029
    process/thread by given slot.
114 mikedld 1030
 
6057 IgorA 1031
---------------------- Constants for registers: ----------------------
1032
  eax - SF_SYSTEM (18)
1033
  ebx - SSF_TERMINATE_THREAD_ID (18)
114 mikedld 1034
======================================================================
131 diamond 1035
======== Function 18, subfunction 19 - get/set mouse features. =======
120 mario79 1036
======================================================================
131 diamond 1037
 
1038
---------------- Subsubfunction 0 - get mouse speed. -----------------
120 mario79 1039
Parameters:
1040
  * eax = 18 - function number
1041
  * ebx = 19 - subfunction number
131 diamond 1042
  * ecx = 0 - subsubfunction number
1043
Returned value:
6235 pathoswith 1044
  * eax = current speed divider
120 mario79 1045
 
131 diamond 1046
---------------- Subsubfunction 1 - set mouse speed. -----------------
1047
Parameters:
1048
  * eax = 18 - function number
1049
  * ebx = 19 - subfunction number
1050
  * ecx = 1 - subsubfunction number
6235 pathoswith 1051
  * edx = new value for speed divider
131 diamond 1052
Returned value:
1053
  * function does not return value
120 mario79 1054
 
6235 pathoswith 1055
Remark: recommended speed divider = 4
5956 pathoswith 1056
 
6235 pathoswith 1057
-------------- Subsubfunction 2 - get mouse sensitivity --------------
131 diamond 1058
Parameters:
1059
  * eax = 18 - function number
1060
  * ebx = 19 - subfunction number
1061
  * ecx = 2 - subsubfunction number
1062
Returned value:
6235 pathoswith 1063
  * eax = current sensitivity
120 mario79 1064
 
6235 pathoswith 1065
-------------- Subsubfunction 3 - set mouse sensitivity --------------
131 diamond 1066
Parameters:
1067
  * eax = 18 - function number
1068
  * ebx = 19 - subfunction number
1069
  * ecx = 3 - subsubfunction number
6235 pathoswith 1070
  * edx = new value for sensitivity
131 diamond 1071
Returned value:
1072
  * function does not return value
120 mario79 1073
 
6235 pathoswith 1074
Remark: recommended sensitivity = 3
1075
 
131 diamond 1076
----------- Subsubfunction 4 - set mouse pointer position. -----------
1077
Parameters:
1078
  * eax = 18 - function number
1079
  * ebx = 19 - subfunction number
1080
  * ecx = 4 - subsubfunction number
1081
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
1082
Returned value:
1083
  * function does not return value
621 mario79 1084
 
641 diamond 1085
-------- Subsubfunction 5 - simulate state of mouse buttons. ---------
621 mario79 1086
Parameters:
1087
  * eax = 18 - function number
1088
  * ebx = 19 - subfunction number
1089
  * ecx = 5 - subsubfunction number
641 diamond 1090
  * edx = information about emulated state of mouse buttons:
1091
    (same as return value in subfunction 2 of function 37)
621 mario79 1092
    * bit 0 is set = left button is pressed
1093
    * bit 1 is set = right button is pressed
1094
    * bit 2 is set = middle button is pressed
1095
    * bit 3 is set = 4th button is pressed
1096
    * bit 4 is set = 5th button is pressed
1097
Returned value:
1098
  * function does not return value
5851 pathoswith 1099
 
1100
-------------- Subsubfunction 6 - get doubleclick delay. -------------
1101
Parameters:
1102
  * eax = 18 - function number
1103
  * ebx = 19 - subfunction number
1104
  * ecx = 6 - subsubfunction number
1105
Returned value:
1106
  * eax = current doubleclick delay (100 = 1 second)
1107
 
1108
-------------- Subsubfunction 7 - set doubleclick delay. -------------
1109
Parameters:
1110
  * eax = 18 - function number
1111
  * ebx = 19 - subfunction number
1112
  * ecx = 7 - subsubfunction number
1113
  * dl  = new value for doubleclick delay (100 = 1 second)
1114
Returned value:
1115
  * function does not return value
1116
 
5956 pathoswith 1117
Remark: mouse settings can be modified in the application mouse_cfg.
120 mario79 1118
 
6057 IgorA 1119
---------------------- Constants for registers: ----------------------
1120
  eax - SF_SYSTEM (18)
1121
  ebx - SSF_MOUSE_SETTINGS (19)
1122
  ecx - SSSF_GET_SPEED (0), SSSF_SET_SPEED (1), SSSF_GET_SPEEDUP (2),
1123
    SSSF_SET_SPEEDUP (3), SSSF_SET_POS (4), SSSF_SET_BUTTON (5),
1124
    SSSF_GET_DOUBLE_CLICK_DELAY (6), SSSF_SET_DOUBLE_CLICK_DELAY (7)
120 mario79 1125
======================================================================
193 diamond 1126
======== Function 18, subfunction 20 - get information on RAM. =======
1127
======================================================================
1128
Parameters:
1129
  * eax = 18 - function number
1130
  * ebx = 20 - subfunction number
1131
  * ecx = pointer to the buffer for information (36 bytes)
1132
Returned value:
1133
  * eax = total size of existing RAM in pages
7722 dunkaist 1134
    or -1 if error has occurred
193 diamond 1135
  * buffer pointed to by ecx contains the following information:
1136
    * +0:  dword: total size of existing RAM in pages
1137
    * +4:  dword: size of free RAM in pages
1138
    * +8:  dword: number of page faults (exceptions #PF)
1139
                 in applications
1140
    * +12: dword: size of kernel heap in bytes
1141
    * +16: dword: free in kernel heap in bytes
1142
    * +20: dword: total number of memory blocks in kernel heap
1143
    * +24: dword: number of free memory blocks in kernel heap
1144
    * +28: dword: size of maximum free block in kernel heap
1145
                 (reserved)
1146
    * +32: dword: size of maximum allocated block in kernel heap
1147
                 (reserved)
1148
 
6057 IgorA 1149
---------------------- Constants for registers: ----------------------
1150
  eax - SF_SYSTEM (18)
1151
  ebx - SSF_GET_RAM_INFO (20)
193 diamond 1152
======================================================================
641 diamond 1153
===================== Function 18, subfunction 21 ====================
1154
======== Get slot number of process/thread by the identifier. ========
608 alver 1155
======================================================================
1156
Parameters:
1157
  * eax = 18 - function number
1158
  * ebx = 21 - subfunction number
7722 dunkaist 1159
  * ecx = identifier of process/thread (PID/TID)
608 alver 1160
Returned value:
641 diamond 1161
  * eax = 0 - error (invalid identifier)
1162
  * otherwise eax = slot number
608 alver 1163
 
6057 IgorA 1164
---------------------- Constants for registers: ----------------------
1165
  eax - SF_SYSTEM (18)
1166
  ebx - SSF_GET_THREAD_SLOT (21)
608 alver 1167
======================================================================
641 diamond 1168
===================== Function 18, subfunction 22 ====================
1169
============== Operations with window of another thread. =============
608 alver 1170
======================================================================
1171
Parameters:
1172
  * eax = 18 - function number
1173
  * ebx = 22 - subfunction number
641 diamond 1174
  * ecx = operation type:
1175
    * 0 = minimize window of the thread with given slot number
1176
    * 1 = minimize window of the thread with given identifier
1177
    * 2 = restore window of the thread with given slot number
1178
    * 3 = restore window of the thread with given identifier
1179
  * edx = parameter (slot number or PID/TID)
608 alver 1180
Returned value:
641 diamond 1181
  * eax = 0 - success
1182
  * eax = -1 - error (invalid identifier)
1183
Remarks:
1184
  * The thread can minimize its window with subfunction 10.
1185
  * One can restore and activate window simultaneously with
1186
    subfunction 3 (which requires slot number).
608 alver 1187
 
6057 IgorA 1188
---------------------- Constants for registers: ----------------------
1189
  eax - SF_SYSTEM (18)
1190
  ebx - SSF_FOREIGN_WINDOW (22)
1191
  ecx - SSSF_MINIMIZE (0), SSSF_MINIMIZE_ID (1), SSSF_RESTORE (2),
1192
    SSSF_RESTORE_ID (3)
608 alver 1193
======================================================================
2648 mario79 1194
======== Function 18, subfunction 23 - minimize all windows. ==========
1195
======================================================================
1196
Parameters:
1197
  * eax = 18 - function number
1198
  * ebx = 23 - subfunction number
1199
Returned value:
1200
  * eax = 0 - all windows have been minimized before a function call
1201
  * eax = N - number of windows minimized from function
1202
Remarks:
1203
  * Window of special thread (name begin to symbol @) is not minimize.
2654 mario79 1204
 
6057 IgorA 1205
---------------------- Constants for registers: ----------------------
1206
  eax - SF_SYSTEM (18)
1207
  ebx - SSF_MINIMIZE_ALL (23)
2648 mario79 1208
======================================================================
2654 mario79 1209
======= Function 18, subfunction 24 - set limits of screen. ==========
1210
======================================================================
1211
Parameters:
1212
  * eax = 18 - function number
1213
  * ebx = 24 - subfunction number
1214
  * ecx = new X size
1215
  * edx = new Y size
1216
Returned value:
1217
  * function does not return value
1218
Remarks:
1219
  * The function does not change the physical size of the video mode.
1220
    It is designed for non-standard displays which display the image
1221
    partially.
1222
  * The sizes specified in the function should not exceed the sizes
1223
    of the current video mode, otherwise the function will not change
1224
    anything.
1225
 
6057 IgorA 1226
---------------------- Constants for registers: ----------------------
1227
  eax - SF_SYSTEM (18)
1228
  ebx - SSF_SET_SCREEN_LIMITS (24)
2654 mario79 1229
======================================================================
5836 GerdtR 1230
===================== Function 18, subfunction 25 ====================
1231
===== Control position of the window relative to other windows. ======
1232
======================================================================
1233
 
1234
------------- Subsubfunction 1 - get position  -----------------------
1235
Parameters:
1236
  * eax = 18 - function number
1237
  * ebx = 25 - subfunction number
1238
  * ecx = 1 - subsubfunction number
1239
  * edx = -1(for current window) or PID application
1240
Returned value:
1241
  * eax = one of the constants window position
1242
 
1243
------------- Subsubfunction 2 - set position  -----------------------
1244
Parameters:
1245
  * eax = 18 - function number
1246
  * ebx = 25 - subfunction number
1247
  * ecx = 2 - subsubfunction number
1248
  * edx = -1(for current window) or PID application
1249
  * esi = new window position (one of the constants below)
1250
Returned value:
1251
  * eax = 0 - error
1252
  * eax = 1 - success
1253
 
1254
Constant position of the window relative to other windows:
5865 GerdtR 1255
 ZPOS_DESKTOP     = -2 - on the background
1256
 ZPOS_ALWAYS_BACK = -1 - behind all the windows
1257
 ZPOS_NORMAL      = 0  - normal
1258
 ZPOS_ALWAYS_TOP  = 1  - on top of all windows
5836 GerdtR 1259
 
6057 IgorA 1260
---------------------- Constants for registers: ----------------------
1261
  eax - SF_SYSTEM (18)
1262
  ebx - SSF_WINDOW_BEHAVIOR (25)
1263
  ecx - SSSF_GET_WB (1), SSSF_SET_WB (2)
5836 GerdtR 1264
======================================================================
118 diamond 1265
==================== Function 20 - MIDI interface. ===================
114 mikedld 1266
======================================================================
1267
 
118 diamond 1268
----------------------- Subfunction 1 - reset ------------------------
114 mikedld 1269
Parameters:
118 diamond 1270
  * eax = 20 - function number
1271
  * ebx = 1 - subfunction number
114 mikedld 1272
 
1273
-------------------- Subfunction 2 - output byte ---------------------
1274
Parameters:
118 diamond 1275
  * eax = 20 - function number
1276
  * ebx = 2 - subfunction number
114 mikedld 1277
  * cl = byte for output
118 diamond 1278
Returned value (is the same for both subfunctions):
1279
  * eax = 0 - success
114 mikedld 1280
  * eax = 1 - base port is not defined
1281
Remarks:
2409 Serge 1282
  * Previously the base port must be defined by
118 diamond 1283
    subfunction 1 of function 21.
114 mikedld 1284
 
6057 IgorA 1285
---------------------- Constants for registers: ----------------------
1286
  eax - SF_MIDI (20)
1287
  ebx - SSF_RESET (1), SSF_OUTPUT (2)
114 mikedld 1288
======================================================================
118 diamond 1289
======== Function 21, subfunction 1 - set MPU MIDI base port. ========
114 mikedld 1290
======================================================================
1291
Parameters:
118 diamond 1292
  * eax = 21 - function number
1293
  * ebx = 1 - subfunction number
1294
  * ecx = number of base port
1295
Returned value
1296
  * eax = 0 - success
114 mikedld 1297
  * eax = -1 - erratic number of a port
1298
Remarks:
118 diamond 1299
  * Number of a port must satisfy to conditions 0x100<=ecx<=0xFFFF.
1300
  * The installation of base is necessary for function 20.
1301
  * To get base port use subfunction 1 of function 26.
114 mikedld 1302
 
6057 IgorA 1303
---------------------- Constants for registers: ----------------------
1304
  eax - SF_SYSTEM_SET (21)
1305
  ebx - SSF_MPU_MIDI_BASE (1)
114 mikedld 1306
======================================================================
118 diamond 1307
========== Function 21, subfunction 2 - set keyboard layout. =========
114 mikedld 1308
======================================================================
118 diamond 1309
Keyboard layout is used to convert keyboard scancodes to ASCII-codes,
1310
which will be read by function 2.
114 mikedld 1311
Parameters:
118 diamond 1312
  * eax = 21 - function number
1313
  * ebx = 2 - subfunction number
1314
  * ecx = which layout to set:
114 mikedld 1315
    * 1 = normal layout
1316
    * 2 = layout at pressed Shift
1317
    * 3 = layout at pressed Alt
118 diamond 1318
  * edx = pointer to layout - table of length 128 bytes
114 mikedld 1319
Or:
1320
  * ecx = 9
118 diamond 1321
  * dx = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
114 mikedld 1322
Returned value:
118 diamond 1323
  * eax = 0 - success
1324
  * eax = 1 - incorrect parameter
114 mikedld 1325
Remarks:
118 diamond 1326
  * If Alt is pressed, the layout with Alt is used;
1327
    if Alt is not pressed, but Shift is pressed,
1328
    the layout with Shift is used;
1329
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1330
    layout is used and then from the code is subtracted 0x60;
1331
    if no control key is pressed, the normal layout is used.
2409 Serge 1332
  * To get layout and country identifier use
118 diamond 1333
    subfunction 2 of function 26.
1334
  * Country identifier is global system variable, which is not used
5452 leency 1335
    by the kernel itself; however the application '@taskbar' displays
118 diamond 1336
    the corresponding icon.
5452 leency 1337
  * The application @taskbar switches layouts on user request.
114 mikedld 1338
 
6057 IgorA 1339
---------------------- Constants for registers: ----------------------
1340
  eax - SF_SYSTEM_SET (21)
1341
  ebx - SSF_KEYBOARD_LAYOUT (2)
114 mikedld 1342
======================================================================
118 diamond 1343
========== Function 21, subfunction 5 - set system language. =========
114 mikedld 1344
======================================================================
1345
Parameters:
118 diamond 1346
  * eax = 21 - function number
1347
  * ebx = 5 - subfunction number
1348
  * ecx = system language (1=eng, 2=fi, 3=ger, 4=rus)
114 mikedld 1349
Returned value:
1350
  * eax = 0
1351
Remarks:
118 diamond 1352
  * System language is global system variable and is not used
5452 leency 1353
    by the kernel itself, however application @taskbar draws the
118 diamond 1354
    appropriate icon.
1355
  * Function does not check for correctness, as the kernel does not
1356
    use this variable.
1357
  * To get system language use subfunction 5 of function 26.
114 mikedld 1358
 
6057 IgorA 1359
---------------------- Constants for registers: ----------------------
1360
  eax - SF_SYSTEM_SET (21)
1361
  ebx - SSF_SYS_LANG (5)
114 mikedld 1362
======================================================================
2409 Serge 1363
 Function 21, subfunction 11 - enable/disable low-level access to HD.
114 mikedld 1364
======================================================================
1365
Parameters:
118 diamond 1366
  * eax = 21 - function number
1367
  * ebx = 11 - subfunction number
1368
  * ecx = 0/1 - disable/enable
114 mikedld 1369
Returned value:
1370
  * eax = 0
1371
Remarks:
118 diamond 1372
  * Is used in LBA-read (subfunction 8 of function 58).
1373
  * The current implementation uses only low bit of ecx.
1374
  * To get current status use subfunction 11 of function 26.
114 mikedld 1375
 
6057 IgorA 1376
---------------------- Constants for registers: ----------------------
1377
  eax - SF_SYSTEM_SET (21)
1378
  ebx - SSF_ACCESS_HD_LBA (11)
114 mikedld 1379
======================================================================
2409 Serge 1380
 Function 21, subfunction 12 - enable/disable low-level access to PCI.
114 mikedld 1381
======================================================================
1382
Parameters:
118 diamond 1383
  * eax = 21 - function number
1384
  * ebx = 12 - subfunction number
1385
  * ecx = 0/1 - disable/enable
114 mikedld 1386
Returned value:
1387
  * eax = 0
1388
Remarks:
118 diamond 1389
  * Is used in operations with PCI bus (function 62).
1390
  * The current implementation uses only low bit of ecx.
1391
  * To get current status use subfunction 12 of function 26.
114 mikedld 1392
 
6057 IgorA 1393
---------------------- Constants for registers: ----------------------
1394
  eax - SF_SYSTEM_SET (21)
1395
  ebx - SSF_ACCESS_PCI (12)
114 mikedld 1396
======================================================================
118 diamond 1397
================= Function 22 - set system date/time. ================
114 mikedld 1398
======================================================================
1399
Parameters:
118 diamond 1400
  * eax = 22 - function number
1401
  * ebx = 0 - set time
1402
    * ecx = 0x00SSMMHH - time in the binary-decimal code (BCD):
114 mikedld 1403
    * HH=hour 00..23
1404
    * MM=minute 00..59
1405
    * SS=second 00..59
118 diamond 1406
  * ebx = 1 - set date
1407
    * ecx = 0x00DDMMYY - date in the binary-decimal code (BCD):
114 mikedld 1408
    * DD=day 01..31
1409
    * MM=month 01..12
1410
    * YY=year 00..99
118 diamond 1411
  * ebx = 2 - set day of week
114 mikedld 1412
    * ecx = 1 for Sunday, ..., 7 for Saturday
118 diamond 1413
  * ebx = 3 - set alarm clock
114 mikedld 1414
    * ecx = 0x00SSMMHH
1415
Returned value:
118 diamond 1416
  * eax = 0 - success
1417
  * eax = 1 - incorrect parameter
114 mikedld 1418
  * eax = 2 - CMOS-battery was unloaded
1419
Remarks:
118 diamond 1420
  * Value of installation of day of week seems to be doubtful,
1421
    as it a little where is used
1422
    (day of week can be calculated by date).
1423
  * Alarm clock can be set on operation in the given time every day.
1424
    But there is no existing system function to disable it.
1425
  * Operation of alarm clock consists in generation IRQ8.
1426
  * Generally CMOS supports for alarm clock set of value 0xFF
1427
    as one of parameters and it means that the appropriate parameter
1428
    is ignored. But current implementation does not allow this
1429
    (will return 1).
1430
  * Alarm clock is a global system resource; the set of
1431
    an alarm clock cancels automatically the previous set.
1432
    However, at moment no program uses it.
114 mikedld 1433
 
6057 IgorA 1434
---------------------- Constants for registers: ----------------------
1435
  eax - SF_SET_TIME_DATE (22)
114 mikedld 1436
======================================================================
118 diamond 1437
============= Function 23 - wait for event with timeout. =============
114 mikedld 1438
======================================================================
118 diamond 1439
If the message queue is empty, waits for new message in the queue,
1440
but no more than given time. Then reads out a message from the queue.
114 mikedld 1441
 
1442
Parameters:
118 diamond 1443
  * eax = 23 - function number
114 mikedld 1444
  * ebx = timeout (in 1/100 of second)
1445
Returned value:
118 diamond 1446
  * eax = 0 - the message queue is empty
1447
  * otherwise eax = event (see the list of events)
114 mikedld 1448
Remarks:
118 diamond 1449
  * Only those events are taken into account, which enter into
1450
    the mask set by function 40. By default it is
1451
    redraw, key and button events.
1452
  * To check for presence of a message in the queue use function 11.
1453
    To wait without timeout use function 10.
1454
  * Transmission ebx=0 results in immediate returning eax=0.
1455
  * Current implementation returns immediately with eax=0,
1456
    if the addition of ebx with the current value of time counter
1457
    makes 32-bit overflow.
114 mikedld 1458
 
6057 IgorA 1459
---------------------- Constants for registers: ----------------------
1460
  eax - SF_WAIT_EVENT_TIMEOUT (23)
114 mikedld 1461
======================================================================
641 diamond 1462
======= Function 24, subfunction 4 - eject tray of disk drive. =======
588 diamond 1463
======================================================================
1464
Parameters:
1465
  * eax = 24 - function number
1466
  * ebx = 4 - subfunction number
641 diamond 1467
  * ecx = position of CD/DVD-drive
4711 mario79 1468
    from 0=Primary Master to 3=Secondary Slave for first IDE contr.
1469
    from 4=Primary Master to 7=Secondary Slave for second IDE contr.
1470
    from 8=Primary Master to 11=Secondary Slave for third IDE contr.
588 diamond 1471
Returned value:
641 diamond 1472
  * function does not return value
588 diamond 1473
Remarks:
1474
  * The function is supported only for ATAPI devices (CD and DVD).
641 diamond 1475
  * When the tray is being ejected,
1476
    manual control of tray is unlocked.
1477
  * When the tray is being ejected, the code clears the cache for
1478
    corresponding device.
588 diamond 1479
  * An example of usage of the function is the application CD_tray.
1480
 
6057 IgorA 1481
---------------------- Constants for registers: ----------------------
1482
  eax - SF_CD (24)
1483
  ebx - SSF_EJECT_TRAY (4), SSF_INSERT_TRAY (5)
588 diamond 1484
======================================================================
641 diamond 1485
======== Function 24, subfunction 5 - load tray of disk drive. =======
588 diamond 1486
======================================================================
1487
Parameters:
1488
  * eax = 24 - function number
1489
  * ebx = 5 - subfunction number
641 diamond 1490
  * ecx = position of CD/DVD-drive
4711 mario79 1491
    from 0=Primary Master to 3=Secondary Slave for first IDE contr.
1492
    from 4=Primary Master to 7=Secondary Slave for second IDE contr.
1493
    from 8=Primary Master to 11=Secondary Slave for third IDE contr.
588 diamond 1494
Returned value:
641 diamond 1495
  * function does not return value
588 diamond 1496
Remarks:
1497
  * The function is supported only for ATAPI devices (CD and DVD).
1498
  * An example of usage of the function is the application CD_tray.
1499
 
6057 IgorA 1500
---------------------- Constants for registers: ----------------------
1501
  eax - SF_CD (24)
1502
  ebx - SSF_EJECT_TRAY (4), SSF_INSERT_TRAY (5)
588 diamond 1503
======================================================================
4066 shikhin 1504
======= Function 25 - put image area on the background layer. ========
1505
======================================================================
7722 dunkaist 1506
Parameters:
4066 shikhin 1507
  * eax = 25 - function number
1508
  * ebx = pointer to the previously allocated memory area,
1509
        where placed the source images in a format BBGGRRTTBBGGRRTT...
1510
  * ecx = [size on axis x]*65536 + [size on axis y]
1511
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
1512
Returned value:
1513
  * function does not return value
1514
Remarks:
1515
  * Coordinates of the image are coordinates of the upper left corner
1516
    of the image relative to the screen.
1517
  * Size of the image in bytes is 4*xsize*ysize
1518
  * TT - byte pointer of transparency, at current version:
1519
         1 to FF - opaque, 0 - transparent.
1520
  * The function places the image directly to LFB. It is not for
1521
    background image f.15. Options f.15 to f.25 does not make sense.
1522
 
6057 IgorA 1523
---------------------- Constants for registers: ----------------------
1524
  eax - SF_SCREEN_PUT_IMAGE (25)
4066 shikhin 1525
======================================================================
118 diamond 1526
======== Function 26, subfunction 1 - get MPU MIDI base port. ========
114 mikedld 1527
======================================================================
1528
Parameters:
118 diamond 1529
  * eax = 26 - function number
1530
  * ebx = 1 - subfunction number
114 mikedld 1531
Returned value:
118 diamond 1532
  * eax = port number
1533
Parameters:
1534
  * To set base port use subfunction 1 of function 21.
114 mikedld 1535
 
6057 IgorA 1536
---------------------- Constants for registers: ----------------------
1537
  eax - SF_SYSTEM_GET (26)
1538
  ebx - SSF_MPU_MIDI_BASE (1)
114 mikedld 1539
======================================================================
1540
========== Function 26, subfunction 2 - get keyboard layout. =========
1541
======================================================================
118 diamond 1542
The keyboard layout is used to convert keyboard scancodes to
1543
ASCII-codes for function 2.
114 mikedld 1544
Parameters:
118 diamond 1545
  * eax = 26 - function number
1546
  * ebx = 2 - subfunction number
114 mikedld 1547
  * ecx = what layout to get:
1548
    * 1 = normal layout
118 diamond 1549
    * 2 = layout with pressed Shift
1550
    * 3 = layout with pressed Alt
1551
  * edx = pointer to the 128-bytes buffer, where the layout will be
1552
    copied
114 mikedld 1553
Returned value:
1554
  * function does not return value
8161 rgimad 1555
    but if pointer in edx is illegal, for example,
1556
    [edx, edx + 128) region intersects with kernel memory,
1557
    then function returns -1
118 diamond 1558
Or:
1559
  * eax = 26 - function number
1560
  * ebx = 2 - subfunction number
114 mikedld 1561
  * ecx = 9
1562
Returned value:
118 diamond 1563
  * eax = country identifier (1=eng, 2=fi, 3=ger, 4=rus)
114 mikedld 1564
Remarks:
118 diamond 1565
  * If Alt is pressed, the layout with Alt is used;
1566
    if Alt is not pressed, but Shift is pressed,
1567
    the layout with Shift is used;
1568
    if Alt and Shift are not pressed, but Ctrl is pressed, the normal
1569
    layout is used and then from the code is subtracted 0x60;
1570
    if no control key is pressed, the normal layout is used.
2409 Serge 1571
  * To set layout and country identifier use
118 diamond 1572
    subfunction 2 of function 21.
1573
  * Country identifier is global system variable, which is not used
5452 leency 1574
    by the kernel itself; however the application '@taskbar' displays
118 diamond 1575
    the corresponding icon (using this function).
5452 leency 1576
  * The application @taskbar switches layouts on user request.
114 mikedld 1577
 
6057 IgorA 1578
---------------------- Constants for registers: ----------------------
1579
  eax - SF_SYSTEM_GET (26)
1580
  ebx - SSF_KEYBOARD_LAYOUT (2)
114 mikedld 1581
======================================================================
118 diamond 1582
========== Function 26, subfunction 5 - get system language. =========
114 mikedld 1583
======================================================================
1584
Parameters:
118 diamond 1585
  * eax = 26 - function number
1586
  * ebx = 5 - subfunction number
114 mikedld 1587
Returned value:
118 diamond 1588
  * eax = system language (1=eng, 2=fi, 3=ger, 4=rus)
114 mikedld 1589
Remarks:
118 diamond 1590
  * System language is global system variable and is not used
5452 leency 1591
    by the kernel itself, however application @taskbar draws the
118 diamond 1592
    appropriate icon (using this function).
1593
  * To set system language use subfunction 5 of function 21.
114 mikedld 1594
 
6057 IgorA 1595
---------------------- Constants for registers: ----------------------
1596
  eax - SF_SYSTEM_GET (26)
1597
  ebx - SSF_SYS_LANG (5)
114 mikedld 1598
======================================================================
118 diamond 1599
=== Function 26, subfunction 9 - get the value of the time counter. ==
114 mikedld 1600
======================================================================
1601
Parameters:
118 diamond 1602
  * eax = 26 - function number
1603
  * ebx = 9 - subfunction number
114 mikedld 1604
Returned value:
118 diamond 1605
  * eax = number of 1/100s of second, past from the system boot time
114 mikedld 1606
Remarks:
118 diamond 1607
  * Counter takes modulo 2^32, that correspond to a little more
1608
    than 497 days.
6079 serge 1609
  * To get system time use function 3.
6057 IgorA 1610
 
1611
---------------------- Constants for registers: ----------------------
1612
  eax - SF_SYSTEM_GET (26)
1613
  ebx - SSF_TIME_COUNT (9)
5810 hidnplayr 1614
======================================================================
1615
===================== Function 26, subfunction 10 ====================
1616
========== Get the value of the high precision time counter. =========
1617
======================================================================
1618
Parameters:
1619
  * eax = 26 - function number
1620
  * ebx = 10 - subfunction number
1621
Returned value:
1622
  * eax = number of nanoseconds since system boot time (lower DWORD)
6079 serge 1623
  * edx = number of nanoseconds since system boot time (high DWORD)
5810 hidnplayr 1624
Remarks:
1625
  * The counter is based on HPET, if HPET is not available, resolution
1626
    will be reduced to 10 000 000 nanoseconds.
114 mikedld 1627
 
6057 IgorA 1628
---------------------- Constants for registers: ----------------------
1629
  eax - SF_SYSTEM_GET (26)
1630
  ebx - SSF_TIME_COUNT_PRO (10)
114 mikedld 1631
======================================================================
118 diamond 1632
===================== Function 26, subfunction 11 ====================
1633
========== Find out whether low-level HD access is enabled. ==========
114 mikedld 1634
======================================================================
1635
Parameters:
118 diamond 1636
  * eax = 26 - function number
1637
  * ebx = 11 - subfunction number
114 mikedld 1638
Returned value:
118 diamond 1639
  * eax = 0/1 - disabled/enabled
114 mikedld 1640
Remarks:
118 diamond 1641
  * Is used in LBA read (subfunction 8 of function 58).
1642
  * To set current state use subfunction 11 of function 21.
114 mikedld 1643
 
6057 IgorA 1644
---------------------- Constants for registers: ----------------------
1645
  eax - SF_SYSTEM_GET (26)
1646
  ebx - SSF_ACCESS_HD_LBA (11)
114 mikedld 1647
======================================================================
118 diamond 1648
===================== Function 26, subfunction 12 ====================
1649
========== Find out whether low-level PCI access is enabled. =========
114 mikedld 1650
======================================================================
1651
Parameters:
118 diamond 1652
  * eax = 26 - function number
1653
  * ebx = 12 - subfunction number
114 mikedld 1654
Returned value:
118 diamond 1655
  * eax = 0/1 - disabled/enabled
114 mikedld 1656
Remarks:
118 diamond 1657
  * Is used by operations with PCI bus (function 62).
1658
  * The current implementation uses only low bit of ecx.
1659
  * To set the current state use subfunction 12 of function 21.
114 mikedld 1660
 
6057 IgorA 1661
---------------------- Constants for registers: ----------------------
1662
  eax - SF_SYSTEM_GET (26)
1663
  ebx - SSF_ACCESS_PCI (12)
114 mikedld 1664
======================================================================
118 diamond 1665
=================== Function 29 - get system date. ===================
114 mikedld 1666
======================================================================
1667
Parameters:
118 diamond 1668
  * eax = 29 - function number
114 mikedld 1669
Returned value:
1670
  * eax = 0x00DDMMYY, where
118 diamond 1671
    (binary-decimal coding, BCD, is used)
1672
  * YY = two low digits of year (00..99)
1673
  * MM = month (01..12)
1674
  * DD = day (01..31)
114 mikedld 1675
Remarks:
118 diamond 1676
  * To set system date use function 22.
114 mikedld 1677
 
6057 IgorA 1678
---------------------- Constants for registers: ----------------------
1679
  eax - SF_GET_SYS_DATE (29)
114 mikedld 1680
======================================================================
521 diamond 1681
============= Function 30 - work with the current folder. ============
1682
======================================================================
1683
--------- Subfunction 1 - set current folder for the thread. ---------
1684
Parameters:
1685
  * eax = 30 - function number
1686
  * ebx = 1 - subfunction number
6473 pathoswith 1687
  * ecx = pointer to string with the path to new current folder,
1688
    rules of path forming can be found in function 70 description.
521 diamond 1689
Returned value:
1690
  * function does not return value
6798 pathoswith 1691
----------------------------------------------------------------------
521 diamond 1692
--------- Subfunction 2 - get current folder for the thread. ---------
1693
Parameters:
1694
  * eax = 30 - function number
1695
  * ebx = 2 - subfunction number
1696
  * ecx = pointer to buffer
1697
  * edx = size of buffer
1698
Returned value:
6798 pathoswith 1699
  * eax = size of the string (including terminating 0)
521 diamond 1700
Remarks:
6798 pathoswith 1701
  * If the buffer is too small to hold all path, only part of the string
1702
    will be copied and terminated with 0.
8088 dunkaist 1703
  * By default, current folder for the thread is "/sys".
2409 Serge 1704
  * At process/thread creation the current folder will be inherited
1662 Nasarus 1705
    from the parent.
6798 pathoswith 1706
----------------------------------------------------------------------
3663 mario79 1707
--- Subfunction 3 - install the add.system directory for the kernel --
1708
Parameters:
1709
  * eax = 30 - function number
1710
  * ebx = 3 - subfunction number
1711
  * ecx = pointer to a block of data:
6473 pathoswith 1712
key     rb  64
1713
path    rb  64
1714
    Example:
1715
align 64
1716
key     db  'kolibrios',0   ; key must be in lower case
1717
align 64
1718
path    db  'HD0/1',0
1719
 
3663 mario79 1720
Returned value:
1721
  * function does not return value
1722
Remarks:
1723
  * The function can be called only 1 time for 1 session of the OS.
6798 pathoswith 1724
  * On input the symbolic key is not changing by encoding.
1725
----------------------------------------------------------------------
1726
---- Subfunction 4 - set current folder, specifying the encoding. ----
6473 pathoswith 1727
Parameters:
1728
  * eax = 30 - function number
1729
  * ebx = 4 - subfunction number
6798 pathoswith 1730
  * ecx = pointer to string with the path to new current folder
1731
  * edx = string encoding, details can be found in function 80 description.
1732
Returned value:
1733
  * function does not return value
1734
----------------------------------------------------------------------
1735
---- Subfunction 5 - get current folder, specifying the encoding. ----
1736
Parameters:
1737
  * eax = 30 - function number
1738
  * ebx = 5 - subfunction number
6473 pathoswith 1739
  * ecx = pointer to buffer
1740
  * edx = size of buffer
6798 pathoswith 1741
  * esi = string encoding
6473 pathoswith 1742
Returned value:
6798 pathoswith 1743
  * eax = size of the string in bytes (including terminating 0)
6473 pathoswith 1744
Remarks:
6798 pathoswith 1745
  * If the buffer is too small to hold all path, only part of the string
1746
    will be copied and terminated with 0.
8088 dunkaist 1747
  * By default, current folder for the thread is "/sys".
6473 pathoswith 1748
  * At process/thread creation the current folder will be inherited
1749
    from the parent.
1750
 
6057 IgorA 1751
---------------------- Constants for registers: ----------------------
1752
  eax - SF_CURRENT_FOLDER (30)
1753
  ebx - SSF_SET_CF (1), SSF_GET_CF (2), SSF_ADD_SYS_FOLDER (3)
521 diamond 1754
======================================================================
2511 mario79 1755
========= Function 34 - who owner the pixel on the screen. ===========
1756
======================================================================
1757
Parameters:
1758
  * eax = 34 - function number
1759
  * ebx = x-coordinate (relative to the display)
1760
  * ecx = y-coordinate (relative to the display)
1761
 
1762
Returned value:
1763
  * eax = 0x000000XX - owner of pixel the slot window N
1764
    If incorrect values ebx and ecx then function returns 0
1765
  * The function takes the value from the area [_WinMapAddress]
3780 Serge 1766
 
6057 IgorA 1767
---------------------- Constants for registers: ----------------------
1768
  eax - SF_GET_PIXEL_OWNER (34)
2511 mario79 1769
======================================================================
118 diamond 1770
======= Function 35 - read the color of a pixel on the screen. =======
114 mikedld 1771
======================================================================
1772
Parameters:
1773
  * eax = 35
1774
  * ebx = y*xsize+x, where
118 diamond 1775
  * (x,y) = coordinates of a pixel (beginning from 0)
1776
  * xsize = horizontal screen size
114 mikedld 1777
Returned value:
118 diamond 1778
  * eax = color 0x00RRGGBB
114 mikedld 1779
Remarks:
118 diamond 1780
  * To get screen sizes use function 14. Pay attention,
1781
    that it subtracts 1 from both sizes.
1782
  * There is also direct access (without any system calls)
1783
    to videomemory through the selector gs. To get parameters of
1784
    the current videomode, use function 61.
114 mikedld 1785
 
6057 IgorA 1786
---------------------- Constants for registers: ----------------------
1787
  eax - SF_GET_PIXEL (35)
114 mikedld 1788
======================================================================
1018 diamond 1789
=================== Function 36 - read screen area. ==================
921 mario79 1790
======================================================================
1791
Paramters:
1792
  * eax = 36 - function number
1018 diamond 1793
  * ebx = pointer to the previously allocated memory area,
1794
        where will be placed the image in the format BBGGRRBBGGRR...
921 mario79 1795
  * ecx = [size on axis x]*65536 + [size on axis y]
1796
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
1797
Returned value:
1798
  * function does not return value
1799
Remarks:
1800
  * Coordinates of the image are coordinates of the upper left corner
923 mario79 1801
    of the image relative to the screen.
921 mario79 1802
  * Size of the image in bytes is 3*xsize*ysize.
1803
 
6057 IgorA 1804
---------------------- Constants for registers: ----------------------
1805
  eax - SF_GET_IMAGE (36)
921 mario79 1806
======================================================================
277 diamond 1807
=================== Function 37 - work with mouse. ===================
114 mikedld 1808
======================================================================
1809
 
118 diamond 1810
---------- Subfunction 0 - screen coordinates of the mouse -----------
114 mikedld 1811
Parameters:
118 diamond 1812
  * eax = 37 - function number
1813
  * ebx = 0 - subfunction number
114 mikedld 1814
Returned value:
118 diamond 1815
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1816
    (beginning from 0)
114 mikedld 1817
 
118 diamond 1818
-- Subfunction 1 - coordinates of the mouse relative to the window ---
114 mikedld 1819
Parameters:
118 diamond 1820
  * eax = 37 - function number
1821
  * ebx = 1 - subfunction number
114 mikedld 1822
Returned value:
118 diamond 1823
  * eax = x*65536 + y, (x,y)=coordinates of the mouse pointer
1824
    relative to the application window (beginning from 0)
114 mikedld 1825
Remarks:
118 diamond 1826
  * The value is calculated by formula (x-xwnd)*65536 + (y-ywnd).
1827
    If y>=ywnd, the low word is non-negative and contains
1828
    relative y-coordinate, and the high word - relative x-coordinate
1829
    (with correct sign). Otherwise the low word is negative and still
1830
    contains relative y-coordinate, and to the high word
1831
    1 should be added.
114 mikedld 1832
 
5851 pathoswith 1833
------------- Subfunction 2 - states of the mouse buttons ------------
114 mikedld 1834
Parameters:
118 diamond 1835
  * eax = 37 - function number
1836
  * ebx = 2 - subfunction number
114 mikedld 1837
Returned value:
5851 pathoswith 1838
  * eax = bits 0-4 equal to subfunction 3
114 mikedld 1839
 
5851 pathoswith 1840
------- Subfunction 3 - states and events of the mouse buttons -------
1841
Parameters:
1842
  * eax = 37 - function number
1843
  * ebx = 3 - subfunction number
1844
Returned value:
1845
  * eax contains next information:
1846
 
1847
states:
1848
  * bit 0 is set = left button is held
1849
  * bit 1 is set = right button is held
1850
  * bit 2 is set = middle button is held
1851
  * bit 3 is set = 4th button is held
1852
  * bit 4 is set = 5th button is held
1853
 
1854
events:
1855
  * bit 8 is set = left button is pressed
1856
  * bit 9 is set = right button is pressed
1857
  * bit 10 is set = middle button is pressed
1858
 
1859
  * bit 15 is set = vertical scroll is used
1860
 
1861
  * bit 16 is set = left button is released
1862
  * bit 17 is set = right button is released
1863
  * bit 18 is set = middle button is released
1864
 
7722 dunkaist 1865
  * bit 23 is set = horizontal scroll is used
5851 pathoswith 1866
 
1867
  * bit 24 is set = doubleclick by left button
1868
 
277 diamond 1869
-------------------- Subfunction 4 - load cursor ---------------------
1870
Parameters:
1871
  * eax = 37 - function number
1872
  * ebx = 4 - subfunction number
1873
  * dx = data source:
1874
  * dx = LOAD_FROM_FILE = 0 - data in a file
1875
    * ecx = pointer to full path to the cursor file
1876
    * the file must be in the format .cur, which is standard for
1877
      MS Windows, at that of the size 32*32 pixels
1878
  * dx = LOAD_FROM_MEM = 1 - data of file are already loaded in memory
1879
    * ecx = pointer to data of the cursor file
1880
    * the data format is the same as in the previous case
1881
  * dx = LOAD_INDIRECT = 2 - data in memory
1882
    * ecx = pointer to cursor image in the format ARGB 32*32 pixels
1883
    * edx = 0xXXYY0002, where
1884
      * XX = x-coordinate of cursor hotspot
1885
      * YY = y-coordinate
1886
      * 0 <= XX, YY <= 31
1887
Returned value:
1888
  * eax = 0 - failed
1889
  * otherwise eax = cursor handle
1890
 
1891
--------------------- Subfunction 5 - set cursor ---------------------
1892
Sets new cursor for the window of the current thread.
1893
Parameters:
1894
  * eax = 37 - function number
1895
  * ebx = 5 - subfunction number
1896
  * ecx = cursor handle
1897
Returned value:
1898
  * eax = handle of previous cursor
1899
Remarks:
1900
  * If the handle is incorrect, the function restores the default
1901
    cursor (standard arrow). In particular, ecx=0 restores it.
1902
 
1903
------------------- Subfunction 6 - delete cursor --------------------
1904
Parameters:
1905
  * eax = 37 - function number
1906
  * ebx = 6 - subfunction number
1907
  * ecx = cursor handle
1908
Returned value:
1909
  * eax destroyed
1910
Remarks:
1911
  * The cursor must be loaded previously by the current thread
1912
    (with the call to subfunction 4). The function does not delete
1913
    system cursors and cursors, loaded by another applications.
1914
  * If the active cursor (set by subfunction 5) is deleted,
1915
    the system restores the default cursor (standard arrow).
1916
 
499 diamond 1917
------------------ Subfunction 7 - get scroll data -------------------
486 kastigar 1918
Parameters:
1919
  * eax = 37 - function number
1920
  * ebx = 7 - subfunction number
1921
Returned value:
499 diamond 1922
  * eax = [horizontal offset]*65536 + [vertical offset]
486 kastigar 1923
Remarks:
499 diamond 1924
  * Scroll data is available for active window only.
1925
  * Values are zeroed after reading.
1926
  * Values are signed.
486 kastigar 1927
 
6800 pathoswith 1928
-------- Subfunction 8 - load cursor, specifying the encoding --------
1929
Parameters:
1930
  * eax = 37 - function number
1931
  * ebx = 8 - subfunction number
1932
  * ecx = pointer to the cursor file path string
1933
  * edx = string encoding, details can be found in function 80 description.
1934
Returned value:
1935
  * eax = cursor handle, 0 - failed
1936
 
6057 IgorA 1937
---------------------- Constants for registers: ----------------------
1938
  eax - SF_MOUSE_GET (37)
1939
  ebx - SSF_SCREEN_POSITION (0), SSF_WINDOW_POSITION (1),
1940
    SSF_BUTTON (2), SSF_BUTTON_EXT (3), SSF_LOAD_CURSOR (4),
1941
    SSF_SET_CURSOR (5), SSF_DEL_CURSOR (6), SSF_SCROLL_DATA (7)
114 mikedld 1942
======================================================================
1943
====================== Function 38 - draw line. ======================
1944
======================================================================
1945
Parameters:
118 diamond 1946
  * eax = 38 - function number
1947
  * ebx = [start coordinate on axis x]*65536 +
1948
              [end coordinate on axis x]
1949
  * ecx = [start coordinate on axis y]*65536 +
1950
              [end coordinate on axis y]
1951
  * edx = 0x00RRGGBB - color
133 diamond 1952
    edx = 0x01xxxxxx - draw inversed line
1953
          (low 24 bits are ignored)
114 mikedld 1954
Returned value:
1955
  * function does not return value
1956
Remarks:
118 diamond 1957
  * Coordinates are relative to the window.
1958
  * End point is also drawn.
114 mikedld 1959
 
6057 IgorA 1960
---------------------- Constants for registers: ----------------------
1961
  eax - SF_DRAW_LINE (38)
114 mikedld 1962
======================================================================
118 diamond 1963
== Function 39, subfunction 1 - get a size of the background image. ==
114 mikedld 1964
======================================================================
1965
Parameters:
118 diamond 1966
  * eax = 39 - function number
1967
  * ebx = 1 - subfunction number
114 mikedld 1968
Returned value:
1969
  * eax = [width]*65536 + [height]
1970
Remarks:
118 diamond 1971
  * There is a pair function to set sizes of background image -
1972
    subfunction 1 of function 15. After which it is necessary,
1973
    of course, anew to define image.
114 mikedld 1974
 
6057 IgorA 1975
---------------------- Constants for registers: ----------------------
1976
  eax - SF_BACKGROUND_GET (39)
114 mikedld 1977
======================================================================
118 diamond 1978
== Function 39, subfunction 2 - get pixel from the background image. =
114 mikedld 1979
======================================================================
1980
Parameters:
118 diamond 1981
  * eax = 39 - function number
1982
  * ebx = 2 - subfunction number
114 mikedld 1983
  * ecx = offset
1984
Returned value:
118 diamond 1985
  * eax = 0x00RRGGBB - pixel color, if offset is valid
1986
    (less than 0x160000-16)
1987
  * eax = 2 otherwise
114 mikedld 1988
Remarks:
118 diamond 1989
  * Do not rely on returned value for invalid offsets, it may be
1990
    changed in future kernel versions.
1991
  * Offset for pixel with coordinates (x,y)
1992
    is calculated as (x+y*xsize)*3.
2409 Serge 1993
  * There is a pair function to set pixel on the background image -
118 diamond 1994
    subfunction 2 of function 15.
114 mikedld 1995
 
6057 IgorA 1996
---------------------- Constants for registers: ----------------------
1997
  eax - SF_BACKGROUND_GET (39)
114 mikedld 1998
======================================================================
118 diamond 1999
== Function 39, subfunction 4 - get drawing mode for the background. =
114 mikedld 2000
======================================================================
2001
Parameters:
118 diamond 2002
  * eax = 39 - function number
2003
  * ebx = 4 - subfunction number
114 mikedld 2004
Returned value:
118 diamond 2005
  * eax = 1 - tile
2006
  * eax = 2 - stretch
114 mikedld 2007
Remarks:
2409 Serge 2008
  * There is a pair function to set drawing mode -
118 diamond 2009
    subfunction 4 of function 15.
114 mikedld 2010
 
6057 IgorA 2011
---------------------- Constants for registers: ----------------------
2012
  eax - SF_BACKGROUND_GET (39)
114 mikedld 2013
======================================================================
118 diamond 2014
=========== Function 40 - set the mask for expected events. ==========
114 mikedld 2015
======================================================================
118 diamond 2016
The mask for expected events affects function working with events
2017
10, 11, 23 - they notify only about events allowed by this mask.
114 mikedld 2018
Parameters:
118 diamond 2019
  * eax = 40 - function number
114 mikedld 2020
  * ebx = mask: bit i corresponds to event i+1 (see list of events)
118 diamond 2021
    (set bit permits notice on event)
3940 mario79 2022
    bit 31: mouse active/inactive filter
2414 Serge 2023
    bit 31 = 0 - inactive window receive mouse events
2024
    bit 31 = 1 - inactive window does not receive mouse events
2025
    bit 30: cursor position filter
2026
    bit 30 = 0 = the window receive mouse events if cursor
2027
                 outside window
2028
    bit 30 = 1 - the window does not receive mouse events if cursor
2029
                 outside window
114 mikedld 2030
Returned value:
1153 clevermous 2031
  * eax = previous value of mask
114 mikedld 2032
Remarks:
7722 dunkaist 2033
  * Default mask (7=111b) enables notices about redraw,
118 diamond 2034
    keys and buttons. This is enough for many applications.
2035
  * Events prohibited in the mask are saved anyway, when come;
2036
    they are simply not informed with event functions.
2037
  * Event functions take into account the mask on moment of
2038
    function call, not on moment of event arrival.
114 mikedld 2039
 
6057 IgorA 2040
---------------------- Constants for registers: ----------------------
2041
  eax - SF_SET_EVENTS_MASK (40)
114 mikedld 2042
======================================================================
118 diamond 2043
================ Function 43 - input/output to a port. ===============
114 mikedld 2044
======================================================================
2045
 
118 diamond 2046
------------------------ Output data to port -------------------------
114 mikedld 2047
Parameters:
118 diamond 2048
  * eax = 43 - function number
114 mikedld 2049
  * bl = byte for output
118 diamond 2050
  * ecx = port number 0xnnnn (from 0 to 0xFFFF)
114 mikedld 2051
Returned value:
118 diamond 2052
  * eax = 0 - success
2053
  * eax = 1 - the thread has not reserved the selected port
114 mikedld 2054
 
118 diamond 2055
------------------------ Input data from port ------------------------
114 mikedld 2056
Parameters:
118 diamond 2057
  * eax = 43 - function number
2058
  * ebx is ignored
2059
  * ecx = 0x8000nnnn, where nnnn = port number (from 0 to 0xFFFF)
114 mikedld 2060
Returned value:
118 diamond 2061
  * eax = 0 - success, thus ebx = entered byte
2062
  * eax = 1 - the thread has not reserved the selected port
114 mikedld 2063
Remarks:
118 diamond 2064
  * Previously the thread must reserve the selected port
2065
    for itself by function 46.
2066
  * Instead of call to this function it is better to use
2067
    processor instructions in/out - this is much
2068
    faster and a bit shorter and easier.
114 mikedld 2069
 
6057 IgorA 2070
---------------------- Constants for registers: ----------------------
2071
  eax - SF_PORT_IN_OUT (43)
114 mikedld 2072
======================================================================
118 diamond 2073
====== Function 46 - reserve/free a group of input/output ports. =====
114 mikedld 2074
======================================================================
118 diamond 2075
To work with reserved ports an application can access directly by
2076
commands in/out (recommended way) and can use function 43
2077
(not recommended way).
114 mikedld 2078
Parameters:
118 diamond 2079
  * eax = 46 - function number
114 mikedld 2080
  * ebx = 0 - reserve, 1 - free
118 diamond 2081
  * ecx = start port number
2082
  * edx = end port number (inclusive)
114 mikedld 2083
Returned value:
118 diamond 2084
  * eax = 0 - success
114 mikedld 2085
  * eax = 1 - error
2086
Remarks:
118 diamond 2087
  * For ports reservation: an error occurs if and only if
2088
    one from the following condition satisfies:
2089
    * start port is more than end port;
2090
    * the selected range contains incorrect port number
2091
      (correct are from 0 to 0xFFFF);
2092
    * limit for the total number of reserved areas is exceeded
2093
      (maximum 255 are allowed);
2094
    * the selected range intersects with any of earlier reserved
2095
  * For ports free: an error is an attempt to free range,
2096
    that was not earlier reserved by this function
2097
    (with same ecx,edx).
2098
  * If an error occurs (for both cases) function performs no action.
277 diamond 2099
  * At booting the system reserves for itself ports
2100
    0..0x2d, 0x30..0x4d, 0x50..0xdf, 0xe5..0xff (inclusively).
118 diamond 2101
  * When a thread terminates, all reserved by it ports
2102
    are freed automatically.
114 mikedld 2103
 
6057 IgorA 2104
---------------------- Constants for registers: ----------------------
2105
  eax - SF_SET_PORTS (46)
114 mikedld 2106
======================================================================
118 diamond 2107
============= Function 47 - draw a number in the window. =============
114 mikedld 2108
======================================================================
2109
Parameters:
118 diamond 2110
  * eax = 47 - function number
2111
  * ebx = parameters of conversion number to text:
114 mikedld 2112
    * bl = 0 - ecx contains number
665 diamond 2113
    * bl = 1 - ecx contains pointer to dword/qword-number
118 diamond 2114
    * bh = 0 - display in decimal number system
2115
    * bh = 1 - display in hexadecimal system
2116
    * bh = 2 - display in binary system
499 diamond 2117
    * bits 16-21 = how many digits to display
655 mario79 2118
    * bits 22-29 reserved and must be set to 0
665 diamond 2119
    * bit 30 set = display qword (64-bit) number (must be bl=1)
2120
    * bit 31 set = do not display leading zeroes of the number
118 diamond 2121
  * ecx = number (if bl=0) or pointer (if bl=1)
114 mikedld 2122
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
6272 pathoswith 2123
  * esi = 0xXXRRGGBB, where
2124
    * RR, GG, BB specify text color
2125
    * XX = 0B0FCSSS (bits):
2126
      * B=1 - fill background (color = edi)
2127
      * F specifies the font:
2128
 
2129
        1 = 8x16
2130
      * C=0 - draw to the window,
2131
        C=1 - draw to the user buffer (edi)
2132
      * SSS = (size multiplier)-1, so 0 = x1, 7 = x8
114 mikedld 2133
Returned value:
2134
  * function does not return value
2135
Remarks:
118 diamond 2136
  * The given length must not exceed 60.
2137
  * The exactly given amount of digits is output. If number is small
2138
    and can be written by smaller amount of digits, it is supplemented
2139
    by leading zeroes; if the number is big and can not be written by
2140
    given amount of digits, extra digits are not drawn.
114 mikedld 2141
 
6057 IgorA 2142
---------------------- Constants for registers: ----------------------
2143
  eax - SF_DRAW_NUMBER (47)
114 mikedld 2144
======================================================================
118 diamond 2145
========= Function 48, subfunction 0 - apply screen settings. ========
114 mikedld 2146
======================================================================
2147
Parameters:
118 diamond 2148
  * eax = 48 - function number
2149
  * ebx = 0 - subfunction number
114 mikedld 2150
  * ecx = 0 - reserved
2151
Returned value:
2152
  * function does not return value
2153
Remarks:
118 diamond 2154
  * Function redraws the screen after parameters change by
114 mikedld 2155
    subfunctions 1 and 2.
118 diamond 2156
  * Function call without prior call to one of indicated subfunctions
2157
    is ignored.
2158
  * Function call with nonzero ecx is ignored.
114 mikedld 2159
 
6057 IgorA 2160
---------------------- Constants for registers: ----------------------
2161
  eax - SF_STYLE_SETTINGS (48)
2162
  ebx - SSF_APPLY (0)
114 mikedld 2163
======================================================================
118 diamond 2164
=========== Function 48, subfunction 1 - set button style. ===========
114 mikedld 2165
======================================================================
2166
Parameters:
118 diamond 2167
  * eax = 48 - function number
2168
  * ebx = 1 - subfunction number
2169
  * ecx = button style:
2170
    * 0 = flat
2171
    * 1 = 3d
114 mikedld 2172
Returned value:
2173
  * function does not return value
2174
Remarks:
118 diamond 2175
  * After call to this function one should redraw the screen by
2176
    subfunction 0.
2177
  * Button style influences only to their draw of function 8.
114 mikedld 2178
 
6057 IgorA 2179
---------------------- Constants for registers: ----------------------
2180
  eax - SF_STYLE_SETTINGS (48)
2181
  ebx - SSF_SET_BUTTON_STYLE (1)
118 diamond 2182
======================================================================
2183
====== Function 48, subfunction 2 - set standard window colors. ======
2184
======================================================================
114 mikedld 2185
Parameters:
118 diamond 2186
  * eax = 48 - function number
2187
  * ebx = 2 - subfunction number
2188
  * ecx = pointer to the color table
114 mikedld 2189
  * edx = size of the color table
118 diamond 2190
    (must be 40 bytes for future compatibility)
2191
Format of the color table is shown in description of subfunction 3.
114 mikedld 2192
Returned value:
2193
  * function does not return value
2194
Remarks:
118 diamond 2195
  * After call to this function one should redraw the screen by
2196
    subfunction 0.
2197
  * Table of standard colors influences only to applications,
2198
    which receive this table obviously (by subfunction 3)
2199
    and use it (specifying colors from it to drawing functions).
2200
  * Table of standard colors is included in skin and is installed
2201
    anew with skin installation (by subfunction 8).
2202
  * Color table can be viewed/changed interactively with
2203
    the application 'desktop'.
114 mikedld 2204
 
6057 IgorA 2205
---------------------- Constants for registers: ----------------------
2206
  eax - SF_STYLE_SETTINGS (48)
2207
  ebx - SSF_SET_COLORS (2)
114 mikedld 2208
======================================================================
118 diamond 2209
====== Function 48, subfunction 3 - get standard window colors. ======
114 mikedld 2210
======================================================================
2211
Parameters:
118 diamond 2212
  * eax = 48 - function number
2213
  * ebx = 3 - subfunction number
2214
  * ecx = pointer to the buffer with size edx bytes,
2215
    where table will be written
2216
  * edx = size of color table
2217
    (must be 40 bytes for future compatibility)
114 mikedld 2218
Returned value:
2219
  * function does not return value
118 diamond 2220
Format of the color table:
2221
each item is dword-value for color 0x00RRGGBB
2222
  * +0: dword: frames - color of frame
2223
  * +4: dword: grab - color of header
2224
  * +8: dword: grab_button - color of button on header bar
2225
  * +12 = +0xC: dword: grab_button_text - color of text on button
2226
    on header bar
2227
  * +16 = +0x10: dword: grab_text - color of text on header
2228
  * +20 = +0x14: dword: work - color of working area
2229
  * +24 = +0x18: dword: work_button - color of button in working area
2230
  * +28 = +0x1C: dword: work_button_text - color of text on button
2231
    in working area
2232
  * +32 = +0x20: dword: work_text - color of text in working area
2233
  * +36 = +0x24: dword: work_graph - color of graphics in working area
114 mikedld 2234
Remarks:
118 diamond 2235
  * Structure of the color table is described in the standard
2236
    include file 'macros.inc' as 'system_colors'; for example,
2237
    it is possible to write:
5871 hidnplayr 2238
        sc      system_colors           ; variable declaration
2239
        ...                             ; somewhere one must call
2240
                                        ; this function with ecx=sc
2241
        mov     ecx, [sc.work_button_text]      ; read text color on
7722 dunkaist 2242
                                        ; button in working area
2243
  * A program itself decides to use or not to use color table.
118 diamond 2244
    For usage program must simply at calls to drawing functions select
2245
    color taken from the table.
2246
  * At change of the table of standard colors (by subfunction 2 with
2247
    the subsequent application of changes by subfunction 0 or
2248
    at skin set by subfunction 8) the system sends to all windows
2249
    redraw message (the event with code 1).
2250
  * Color table can be viewed/changed interactively with
2251
    the application 'desktop'.
114 mikedld 2252
 
6057 IgorA 2253
---------------------- Constants for registers: ----------------------
2254
  eax - SF_STYLE_SETTINGS (48)
2255
  ebx - SSF_GET_COLORS (3)
114 mikedld 2256
======================================================================
118 diamond 2257
============ Function 48, subfunction 4 - get skin height. ===========
114 mikedld 2258
======================================================================
2259
Parameters:
118 diamond 2260
  * eax = 48 - function number
2261
  * ebx = 4 - subfunction number
114 mikedld 2262
Returned value:
118 diamond 2263
  * eax = skin height
114 mikedld 2264
Remarks:
118 diamond 2265
  * Skin height is defined as the height of a header
2266
    of skinned windows.
2267
  * See also general structure of window in the description
2268
    of function 0.
114 mikedld 2269
 
6057 IgorA 2270
---------------------- Constants for registers: ----------------------
2271
  eax - SF_STYLE_SETTINGS (48)
2272
  ebx - SSF_GET_SKIN_HEIGHT (4)
114 mikedld 2273
======================================================================
118 diamond 2274
======== Function 48, subfunction 5 - get screen working area. =======
114 mikedld 2275
======================================================================
2276
Parameters:
118 diamond 2277
  * eax = 48 - function number
2278
  * ebx = 5 - subfunction number
114 mikedld 2279
Returned value:
2280
  * eax = [left]*65536 + [right]
2281
  * ebx = [top]*65536 + [bottom]
2282
Remarks:
118 diamond 2283
  * The screen working area defines position and coordinates of
2284
    a maximized window.
2285
  * The screen working area in view of normal work is all screen
5452 leency 2286
    without taskbar ('@taskbar' application).
118 diamond 2287
  * (left,top) are coordinates of the left upper corner,
2288
    (right,bottom) are coordinates of the right lower one.
2289
    Thus the size of working area on x axis can be calculated by
2290
    formula right-left+1, on y axis - by formula bottom-right+1.
2291
  * See also function 14,
2292
    to get sizes of all screen.
2293
  * There is a pair function to set working area - subfunction 6.
114 mikedld 2294
 
6057 IgorA 2295
---------------------- Constants for registers: ----------------------
2296
  eax - SF_STYLE_SETTINGS (48)
2297
  ebx - SSF_GET_SCREEN_AREA (5)
114 mikedld 2298
======================================================================
118 diamond 2299
======== Function 48, subfunction 6 - set screen working area. =======
114 mikedld 2300
======================================================================
2301
Parameters:
118 diamond 2302
  * eax = 48 - function number
2303
  * ebx = 6 - subfunction number
114 mikedld 2304
  * ecx = [left]*65536 + [right]
2305
  * edx = [top]*65536 + [bottom]
2306
Returned value:
2307
  * function does not return value
2308
Remarks:
118 diamond 2309
  * The screen working area defines position and coordinates of
2310
    a maximized window.
5452 leency 2311
  * This function is used only by the application '@taskbar',
2312
    which set working area to all screen without taskbar.
118 diamond 2313
  * (left,top) are coordinates of the left upper corner,
2314
    (right,bottom) are coordinates of the right lower one.
2315
    Thus the size of working area on x axis can be calculated by
2316
    formula right-left+1, on y axis - by formula bottom-right+1.
2317
  * If 'left'>='right', x-coordinate of working area is not changed.
2318
    If 'left'<0, 'left' will not be set. If 'right' is greater than or
2319
    equal to screen width, 'right' will not be set.
2320
    Similarly on y axis.
2321
  * See also function 14,
2322
    to get sizes of all screen.
2323
  * There is a pair function to get working area - subfunction 5.
2324
  * This function redraws the screen automatically,
2325
    updating coordinates and sizes of maximized windows.
2326
    The system sends to all windows redraw message (the event 1).
114 mikedld 2327
 
6057 IgorA 2328
---------------------- Constants for registers: ----------------------
2329
  eax - SF_STYLE_SETTINGS (48)
2330
  ebx - SSF_SET_SCREEN_AREA (6)
114 mikedld 2331
======================================================================
118 diamond 2332
=========== Function 48, subfunction 7 - get skin margins. ===========
114 mikedld 2333
======================================================================
118 diamond 2334
Returns the area of a header of a skinned window, intended for
2335
a text of a header.
114 mikedld 2336
Parameters:
118 diamond 2337
  * eax = 48 - function number
2338
  * ebx = 7 - subfunction number
114 mikedld 2339
Returned value:
2340
  * eax = [left]*65536 + [right]
2341
  * ebx = [top]*65536 + [bottom]
2342
Remarks:
118 diamond 2343
  * An application decides itself to use or not to use this function.
2344
  * It is recommended to take into account returned value
2345
    of this function for choice of a place for drawing header text
2346
    (by function 4) or a substitute of header text
2347
    (at the discretion of an application).
114 mikedld 2348
 
6057 IgorA 2349
---------------------- Constants for registers: ----------------------
2350
  eax - SF_STYLE_SETTINGS (48)
2351
  ebx - SSF_GET_SKIN_MARGINS (7)
114 mikedld 2352
======================================================================
118 diamond 2353
============= Function 48, subfunction 8 - set used skin. ============
114 mikedld 2354
======================================================================
2355
Parameters:
118 diamond 2356
  * eax = 48 - function number
2357
  * ebx = 8 - subfunction number
4573 clevermous 2358
  * ecx = pointer to filename of the skin
114 mikedld 2359
Returned value:
118 diamond 2360
  * eax = 0 - success
2361
  * otherwise eax = file system error code; if file does not
2362
    contain valid skin, function returns error 3
2363
    (unknown file system).
114 mikedld 2364
Remarks:
118 diamond 2365
  * After successful skin loading the system sends to all windows
2366
    redraw message (the event 1).
2367
  * At booting the system reads skin from file 'default.skn'
2368
    on ramdisk.
2369
  * User can change the skin statically by creating hisself
2370
    'default.skn' or dynamically with the application 'desktop'.
114 mikedld 2371
 
6057 IgorA 2372
---------------------- Constants for registers: ----------------------
2373
  eax - SF_STYLE_SETTINGS (48)
2374
  ebx - SSF_SET_SKIN (8)
114 mikedld 2375
======================================================================
5848 pathoswith 2376
====== Function 48, subfunction 9 - get font smoothing setting. ======
5682 leency 2377
======================================================================
2378
Parameters:
2379
  * eax = 48 - function number
2380
  * ebx = 9 - subfunction number
5848 pathoswith 2381
Returned value:
2382
  * eax = 2 - subpixel, 1 - anti-aliasing, 0 - off
5682 leency 2383
 
6057 IgorA 2384
---------------------- Constants for registers: ----------------------
2385
  eax - SF_STYLE_SETTINGS (48)
2386
  ebx - SSF_GET_FONT_SMOOTH (9)
5682 leency 2387
======================================================================
5848 pathoswith 2388
========== Function 48, subfunction 10 - set font smoothing. =========
2389
======================================================================
2390
Parameters:
2391
  * eax = 48 - function number
2392
  * ebx = 10 - subfunction number
2393
  * cl  = 2 - subpixel, 1 - anti-aliasing, 0 - off
2394
 
6057 IgorA 2395
---------------------- Constants for registers: ----------------------
2396
  eax - SF_STYLE_SETTINGS (48)
2397
  ebx - SSF_SET_FONT_SMOOTH (10)
5848 pathoswith 2398
======================================================================
5867 pathoswith 2399
============ Function 48, subfunction 11 - get font size. ============
2400
======================================================================
2401
Parameters:
2402
  * eax = 48 - function number
7722 dunkaist 2403
  * ebx = 11 - subfunction number
5867 pathoswith 2404
Returned value:
2405
  * eax = current font height in pixels
2406
 
6057 IgorA 2407
---------------------- Constants for registers: ----------------------
2408
  eax - SF_STYLE_SETTINGS (48)
2409
  ebx - SSF_GET_FONT_SIZE (11)
5867 pathoswith 2410
======================================================================
2411
============ Function 48, subfunction 12 - set font size. ============
2412
======================================================================
2413
Parameters:
2414
  * eax = 48 - function number
7722 dunkaist 2415
  * ebx = 12 - subfunction number
5867 pathoswith 2416
  * cl  = new font height in pixels
2417
 
6057 IgorA 2418
---------------------- Constants for registers: ----------------------
2419
  eax - SF_STYLE_SETTINGS (48)
2420
  ebx - SSF_SET_FONT_SIZE (12)
5867 pathoswith 2421
======================================================================
6800 pathoswith 2422
== Function 48, subfunction 13 - set skin, specifying the encoding. ==
2423
======================================================================
2424
Parameters:
2425
  * eax = 48 - function number
2426
  * ebx = 13 - subfunction number
2427
  * ecx = pointer to the skin file path string
2428
  * edx = string encoding, details can be found in function 80 description.
2429
Returned value:
2430
  * eax = 0 - success
2431
  * otherwise eax = file system error code; if file does not
2432
    contain valid skin, function returns error 3
2433
    (unknown file system).
2434
Remarks:
2435
  * After successful skin loading the system sends to all windows
2436
    redraw message (the event 1).
2437
  * At booting the system reads skin from file 'default.skn'
2438
    on ramdisk.
2439
  * User can change the skin statically by creating hisself
2440
    'default.skn' or dynamically with the application 'desktop'.
2441
 
2442
======================================================================
118 diamond 2443
=========== Function 49 - Advanced Power Management (APM). ===========
114 mikedld 2444
======================================================================
2445
Parameters:
118 diamond 2446
  * eax = 49 - function number
2447
  * dx = number of the APM function
2448
    (analogue of ax in APM specification)
2449
  * bx, cx = parameters of the APM function
114 mikedld 2450
Returned value:
118 diamond 2451
  * 16-bit registers ax, bx, cx, dx, si, di and carry flag CF
2452
    are set according to the APM specification
2453
  * high halves of 32-bit registers eax, ebx, ecx,
2454
    edx, esi, edi are destroyed
114 mikedld 2455
Remarks:
118 diamond 2456
  * APM 1.2 specification is described in the document
2457
    "Advanced Power Management (APM) BIOS Specification"
2458
    (Revision 1.2), available at
114 mikedld 2459
    http://www.microsoft.com/whdc/archive/amp_12.mspx;
118 diamond 2460
    besides it is included in famous Interrupt List by Ralf Brown
114 mikedld 2461
    (http://www.pobox.com/~ralf/files.html,
2462
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/).
2463
 
6057 IgorA 2464
---------------------- Constants for registers: ----------------------
2465
  eax - SF_APM (49)
114 mikedld 2466
======================================================================
118 diamond 2467
=================== Function 50 - set window shape. ==================
114 mikedld 2468
======================================================================
118 diamond 2469
Normal windows have rectangular shape. This function can give to
2470
a window any shape. The shape is given by a set of points inside
2471
the base rectangle belonging to a window. Position and coordinates
2472
of the base rectangle are set by function 0
2473
and changed by function 67.
114 mikedld 2474
 
118 diamond 2475
--------------------------- Set shape data ---------------------------
114 mikedld 2476
Parameters:
118 diamond 2477
  * eax = 50 - function number
2478
  * ebx = 0 - subfunction number
2479
  * ecx = pointer to shape data (array of bytes 0/1)
114 mikedld 2480
Returned value:
2481
  * function does not return value
2482
 
118 diamond 2483
-------------------------- Set shape scale ---------------------------
114 mikedld 2484
Parameters:
118 diamond 2485
  * eax = 50 - function number
2486
  * ebx = 1 - subfunction number
2487
  * ecx sets a scale: each byte of data defines
2488
    (2^scale)*(2^scale) pixels
114 mikedld 2489
Returned value:
2490
  * function does not return value
2491
Remarks:
118 diamond 2492
  * Default scale is 0 (scale factor is 1). If in the shape data
2493
    one byte corresponds to one pixel, there is no necessity
2494
    to set scale.
2495
  * Let's designate xsize = window width (in pixels), ysize = height;
2496
    pay attention, that they are one pixel more than defined by
114 mikedld 2497
    functions 0, 67.
118 diamond 2498
  * On definition of scale xsize and ysize must be divisible
2499
    on 2^scale.
2500
  * Byte of data on offset 'a' must be 0/1 and defines belonging
2501
    to a window of square with the side 2^scale (if scale=0,
2502
    this is one pixel) and coordinates of the left upper corner
114 mikedld 2503
    (a mod (xsize shr scale), a div (xsize shr scale))
118 diamond 2504
  * Data size: (xsize shr scale)*(ysize shr scale).
2505
  * Data must be presented in the memory and not change
2506
    after set of shape.
2507
  * The system views the shape data at every window redraw by
2508
    function 0.
2509
  * The call of subfunction 0 with NULL pointer results in return
2510
    to the rectangular shape.
114 mikedld 2511
 
6057 IgorA 2512
---------------------- Constants for registers: ----------------------
2513
  eax - SF_SET_WINDOW_SHAPE (50)
114 mikedld 2514
======================================================================
2515
==================== Function 51 - create thread. ====================
2516
======================================================================
2517
Parameters:
118 diamond 2518
  * eax = 51 - function number
2519
  * ebx = 1 - unique subfunction
2520
  * ecx = address of thread entry point (starting eip)
2521
  * edx = pointer to thread stack (starting esp)
114 mikedld 2522
Returned value:
118 diamond 2523
  * eax = -1 - error (there is too many threads)
2524
  * otherwise eax = TID - thread identifier
114 mikedld 2525
 
6057 IgorA 2526
---------------------- Constants for registers: ----------------------
2527
  eax - SF_CREATE_THREAD (51)
114 mikedld 2528
======================================================================
4199 mario79 2529
==================== Function 54, subfunction 0 ======================
2530
============== Get the number of slots in the clipboard. =============
2531
======================================================================
2532
Parameters:
2533
  * eax = 54 - function number
2534
  * ebx = 0 - subfunction number
2535
Returned value:
2536
  * eax = slots in the clipboard
2537
  * eax = -1 - main list area not found
2538
 
6057 IgorA 2539
---------------------- Constants for registers: ----------------------
2540
  eax - SF_CLIPBOARD (54)
2541
  ebx - SSF_GET_SLOT_COUNT (0)
4199 mario79 2542
======================================================================
2543
==================== Function 54, subfunction 1 ======================
2544
================= Read the data from the clipboard. ==================
2545
======================================================================
2546
Parameters:
2547
  * eax = 54 - function number
2548
  * ebx = 1 - subfunction number
2549
  * eсx = slot number
2550
Returned value:
2551
  * eax = if successful - pointer to a memory with data
2552
  * eax = 1 - error
2553
  * eax = -1 - main list area not found
6974 0CodErr 2554
Remarks:
2555
  * The function must be used in conjunction with 68.11. The
2556
    application must pre-initialize the local heap by calling 68.11.
6079 serge 2557
 
6057 IgorA 2558
---------------------- Constants for registers: ----------------------
2559
  eax - SF_CLIPBOARD (54)
2560
  ebx - SSF_READ_CB (1)
4199 mario79 2561
======================================================================
2562
==================== Function 54, subfunction 2 ======================
2563
================= Write the data to the clipboard. ===================
2564
======================================================================
2565
Parameters:
2566
  * eax = 54 - function number
2567
  * ebx = 2 - subfunction number
2568
  * eсx = the number of bytes to be copied
2569
  * edx = a pointer to a buffer for data to be copied
2570
Returned value:
2571
  * eax = 0 - success
2572
  * eax = 1 - error
2573
  * eax = -1 - main list area not found
6057 IgorA 2574
 
2575
---------------------- Constants for registers: ----------------------
2576
  eax - SF_CLIPBOARD (54)
2577
  ebx - SSF_WRITE_CB (2)
4199 mario79 2578
======================================================================
2579
===================== Function 54, subfunction 3 =====================
2580
================ Delete the last slot in the clipboard ===============
2581
======================================================================
2582
Parameters:
2583
  * eax = 54 - function number
2584
  * ebx = 3 - subfunction number
2585
Returned value:
2586
  * eax = 0 - success
2587
  * eax = 1 - error
2588
  * eax = -1 - main list area not found
6057 IgorA 2589
 
2590
---------------------- Constants for registers: ----------------------
2591
  eax - SF_CLIPBOARD (54)
2592
  ebx - SSF_DEL_SLOT (3)
4199 mario79 2593
======================================================================
2594
===================== Function 54, subfunction 4 =====================
2595
===================== Alarm reset the lock buffer ====================
2596
======================================================================
2597
Parameters:
2598
  * eax = 54 - function number
2599
  * ebx = 4 - subfunction number
2600
Returned value:
2601
  * eax = 0 - success
2602
  * eax = -1 - main list area not found or no blocking
2603
Remarks:
2604
  * Used in exceptional cases, where no responsible or killed
2605
    application blocked the clipboard operations.
2606
 
6057 IgorA 2607
---------------------- Constants for registers: ----------------------
2608
  eax - SF_CLIPBOARD (54)
2609
  ebx - SSF_UNLOCK_BUFFER (4)
4199 mario79 2610
======================================================================
2409 Serge 2611
 Function 55, subfunction 55 - begin to play data on built-in speaker.
114 mikedld 2612
======================================================================
2613
Parameters:
118 diamond 2614
  * eax = 55 - function number
2615
  * ebx = 55 - subfunction number
2616
  * esi = pointer to data
114 mikedld 2617
Returned value:
118 diamond 2618
  * eax = 0 - success
2619
  * eax = 55 - error (speaker is off or busy)
2620
Data is an array of items with variable length.
2621
Format of each item is defined by first byte:
114 mikedld 2622
  * 0 = end of data
118 diamond 2623
  * 1..0x80 = sets sound duration on 1/100 of second; sound note
2624
    is defined by immediate value of frequency
2625
    * following word (2 bytes) contains frequency divider;
2626
      frequency is defined as 1193180/divider
114 mikedld 2627
  * 0x81 = invalid
118 diamond 2628
  * 0x82..0xFF = note is defined by octave and number:
2629
    * duration in 1/100 of second = (first byte)-0x81
114 mikedld 2630
    * there is one more byte;
118 diamond 2631
    * (second byte)=0xFF - delay
2632
    * otherwise it looks like a*0x10+b, where b=number of the note in
2633
      an octave from 1 to 12, a=number of octave (beginning from 0)
114 mikedld 2634
Remarks:
118 diamond 2635
  * Speaker play can be disabled/enabled by
2636
    subfunction 8 of function 18.
2637
  * Function returns control, having informed the system
2638
    an information on request. Play itself goes independently from
2639
    the program.
2640
  * The data must be kept in the memory at least up to the end
2641
    of play.
114 mikedld 2642
 
6057 IgorA 2643
---------------------- Constants for registers: ----------------------
2644
  eax - SF_SPEAKER_PLAY (55)
114 mikedld 2645
======================================================================
641 diamond 2646
======================= Function 57 - PCI BIOS. ======================
2647
======================================================================
2648
Parameters:
2649
  * eax = 57 - function number
2650
  * ebp corresponds to al in PCI BIOS specification
2651
  * other registers are set according to PCI BIOS specification
2652
Returned value:
2653
  * CF is undefined
2654
  * other registers are set according to PCI BIOS specification
2655
Remarks:
2656
  * Many effects of this function can be also achieved with
2657
    corresponding subfunctions of function 62.
2658
  * The function calls PCI32 BIOS extension, documented e.g. in
2659
    http://alpha1.dyns.net/files/PCI/bios21.pdf.
2660
  * If BIOS does not support this extension, its behavior is emulated
2661
    (through kernel-mode analogues of subfunctions of function 62).
2662
 
6057 IgorA 2663
---------------------- Constants for registers: ----------------------
2664
  eax - SF_PCI_BIOS (57)
641 diamond 2665
======================================================================
118 diamond 2666
========== Function 60 - Inter Process Communication (IPC). ==========
114 mikedld 2667
======================================================================
118 diamond 2668
IPC is used for message dispatching from one process/thread to
2669
another. Previously it is necessary to agree how to interpret
114 mikedld 2670
the concrete message.
2671
 
118 diamond 2672
----------- Subfunction 1 - set the area for IPC receiving -----------
2673
Is called by process-receiver.
114 mikedld 2674
Parameters:
118 diamond 2675
  * eax = 60 - function number
2676
  * ebx = 1 - subfunction number
2677
  * ecx = pointer to the buffer
2678
  * edx = size of the buffer
114 mikedld 2679
Returned value:
118 diamond 2680
  * eax = 0 - always success
2681
Format of IPC-buffer:
2682
  * +0: dword: if nonzero, buffer is considered locked;
2683
    lock/unlock the buffer, when you work with it and need that
2684
    buffer data are not changed from outside (no new messages)
114 mikedld 2685
  * +4: dword: occupied place in the buffer (in bytes)
2686
  * +8: first message
2687
  * +8+n: second message
2688
  * ...
118 diamond 2689
Format of a message:
2690
  * +0: dword: PID of sender
2691
  * +4: dword: message length (not including this header)
2692
  * +8: n*byte: message data
114 mikedld 2693
 
118 diamond 2694
------------------ Subfunction 2 - send IPC message ------------------
2695
Is called by process-sender.
114 mikedld 2696
Parameters:
118 diamond 2697
  * eax = 60 - function number
2698
  * ebx = 2 - subfunction number
114 mikedld 2699
  * ecx = PID of receiver
118 diamond 2700
  * edx = pointer to the message data
2701
  * esi = message length (in bytes)
114 mikedld 2702
Returned value:
118 diamond 2703
  * eax = 0 - success
2704
  * eax = 1 - the receiver has not defined buffer for IPC messages
2705
    (can be, still have no time,
2706
    and can be, this is not right process)
2707
  * eax = 2 - the receiver has blocked IPC-buffer; try to wait a bit
2708
  * eax = 3 - overflow of IPC-buffer of the receiver
114 mikedld 2709
  * eax = 4 - process/thread with such PID does not exist
2710
Remarks:
118 diamond 2711
  * Immediately after writing of IPC-message to the buffer the system
2712
    sends to the receiver the event with code 7 (see event codes).
114 mikedld 2713
 
6057 IgorA 2714
---------------------- Constants for registers: ----------------------
2715
  eax - SF_IPC (60)
2716
  ebx - SSF_SET_AREA (1), SSF_SEND_MESSAGE (2)
114 mikedld 2717
======================================================================
118 diamond 2718
==== Function 61 - get parameters for the direct graphics access. ====
114 mikedld 2719
======================================================================
118 diamond 2720
The data of the graphics screen (the memory area which displays
2721
screen contents) are accessible to a program directly, without
2722
any system calls, through the selector gs:
5871 hidnplayr 2723
        mov     eax, [gs:0]
118 diamond 2724
places in eax the first dword of the buffer, which contains
2725
information on color of the left upper point (and, possibly, colors
2726
of several following).
5871 hidnplayr 2727
        mov     [gs:0], eax
118 diamond 2728
by work in VESA modes with LFB sets color of the left upper point
2729
(and, possibly, colors of several following).
2730
To interpret the data of graphics screen program needs to know
2731
some parameters, returning by this function.
114 mikedld 2732
Remarks:
7121 dunkaist 2733
  * Graphics parameters changes very seldom at work.
118 diamond 2734
  * At videomode change the system redraws all windows (event
2735
    with code 1) and redraws the background (event 5).
2736
    Same events occur in other cases too, which meet much more often,
2737
    than videomode change.
2738
  * By operation in videomodes with LFB the selector gs points to
2739
    LFB itself, so reading/writing on gs result directly in
2740
    change of screen contents. By operation in videomodes without
2741
    LFB gs points to some data area in the kernel, and all functions
2742
    of screen output fulfil honesty double operation on writing
2743
    directly to the screen and writing to this buffer. In result
2744
    at reading contents of this buffer the results correspond to
2745
    screen contents (with, generally speaking, large color
2746
    resolution), and writing is ignored.
2747
    One exception is the mode 320*200, for which main loop of the
2748
    system thread updates the screen according to mouse movements.
114 mikedld 2749
 
2750
------------------------- Screen resolution --------------------------
2751
Parameters:
118 diamond 2752
  * eax = 61 - function number
2753
  * ebx = 1 - subfunction number
114 mikedld 2754
Returned value:
118 diamond 2755
  * eax = [resolution on x axis]*65536 + [resolution on y axis]
114 mikedld 2756
Remarks:
118 diamond 2757
  * One can use function 14 paying attention that
2758
    it returns sizes on 1 pixel less. It is fully equivalent way.
114 mikedld 2759
 
118 diamond 2760
---------------------- Number of bits per pixel ----------------------
114 mikedld 2761
Parameters:
118 diamond 2762
  * eax = 61 - function number
2763
  * ebx = 2 - subfunction number
114 mikedld 2764
Returned value:
118 diamond 2765
  * eax = number of bits per pixel (24 or 32)
114 mikedld 2766
 
118 diamond 2767
-------------------- Number of bytes per scanline --------------------
114 mikedld 2768
Parameters:
118 diamond 2769
  * eax = 61 - function number
2770
  * ebx = 3 - subfunction number
114 mikedld 2771
Returned value:
118 diamond 2772
  * eax = number of bytes occupied by one scanline
114 mikedld 2773
    (horizontal line on the screen)
2774
 
6057 IgorA 2775
---------------------- Constants for registers: ----------------------
2776
  eax - SF_GET_GRAPHICAL_PARAMS (61)
2777
  ebx - SSF_SCREEN_SIZE (1), SSF_BITS_PER_PIXEL (2),
2778
    SSF_BYTES_PER_LINE (3)
114 mikedld 2779
======================================================================
118 diamond 2780
===== Function 62, subfunction 0 - get version of PCI-interface. =====
114 mikedld 2781
======================================================================
2782
Parameters:
118 diamond 2783
  * eax = 62 - function number
2784
  * bl = 0 - subfunction number
114 mikedld 2785
Returned value:
118 diamond 2786
  * eax = -1 - PCI access is disabled; otherwise
2787
  * ah.al = version of PCI-interface (ah=version, al=subversion)
2788
  * high word of eax is zeroed
114 mikedld 2789
Remarks:
118 diamond 2790
  * Previously low-level access to PCI for applications must be
2791
    enabled by subfunction 12 of function 21.
2792
  * If PCI BIOS is not supported, the value of ax is undefined.
114 mikedld 2793
 
6057 IgorA 2794
---------------------- Constants for registers: ----------------------
2795
  eax - SF_PCI (62)
2796
  ebx - SSF_GET_VERSION (0)
114 mikedld 2797
======================================================================
118 diamond 2798
==== Function 62, subfunction 1 - get number of the last PCI-bus. ====
114 mikedld 2799
======================================================================
2800
Parameters:
118 diamond 2801
  * eax = 62 - function number
2802
  * bl = 1 - subfunction number
114 mikedld 2803
Returned value:
118 diamond 2804
  * eax = -1 - access to PCI is disabled; otherwise
2805
  * al = number of the last PCI-bus; other bytes of eax are destroyed
114 mikedld 2806
Remarks:
118 diamond 2807
  * Previously low-level access to PCI for applications must be
2808
    enabled by subfunction 12 of function 21.
2809
  * If PCI BIOS is not supported, the value of ax is undefined.
114 mikedld 2810
 
6057 IgorA 2811
---------------------- Constants for registers: ----------------------
2812
  eax - SF_PCI (62)
2813
  ebx - SSF_GET_LAST_BUS (1)
114 mikedld 2814
======================================================================
118 diamond 2815
===================== Function 62, subfunction 2 =====================
2816
===== Get mechanism of addressing to the PCI configuration space. ====
114 mikedld 2817
======================================================================
2818
Parameters:
118 diamond 2819
  * eax = 62 - function number
2820
  * bl = 2 - subfunction number
114 mikedld 2821
Returned value:
118 diamond 2822
  * eax = -1 - access to PCI is disabled; otherwise
2823
  * al = mechanism (1 or 2); other bytes of eax are destroyed
114 mikedld 2824
Remarks:
118 diamond 2825
  * Previously low-level access to PCI for applications must be
2826
    enabled by subfunction 12 of function 21.
2827
  * Addressing mechanism is selected depending on
2828
    equipment characteristics.
2829
  * Subfunctions of read and write work automatically
2830
    with the selected mechanism.
114 mikedld 2831
 
6057 IgorA 2832
---------------------- Constants for registers: ----------------------
2833
  eax - SF_PCI (62)
2834
  ebx - SSF_GET_ADRR_MODE (2)
114 mikedld 2835
======================================================================
118 diamond 2836
======== Function 62, subfunctions 4,5,6 - read PCI-register. ========
114 mikedld 2837
======================================================================
2838
Parameters:
118 diamond 2839
  * eax = 62 - function number
2840
  * bl = 4 - read byte
2841
  * bl = 5 - read word
2842
  * bl = 6 - read dword
114 mikedld 2843
  * bh = number of PCI-bus
118 diamond 2844
  * ch = dddddfff, where ddddd = number of the device on the bus,
2845
    fff = function number of device
2846
  * cl = number of register (must be even for bl=5,
2847
    divisible by 4 for bl=6)
114 mikedld 2848
Returned value:
118 diamond 2849
  * eax = -1 - error (access to PCI is disabled or parameters
2850
    are not supported); otherwise
2851
  * al/ax/eax (depending on requested size) contains the data;
2852
    the other part of register eax is destroyed
114 mikedld 2853
Remarks:
118 diamond 2854
  * Previously low-level access to PCI for applications must be
2855
    enabled by subfunction 12 of function 21.
2856
  * Access mechanism 2 supports only 16 devices on a bus and ignores
2857
    function number. To get access mechanism use subfunction 2.
2858
  * Some registers are standard and exist for all devices, some are
2859
    defined by the concrete device. The list of registers of the
2860
    first type can be found e.g. in famous
114 mikedld 2861
    Interrupt List by Ralf Brown
2862
    (http://www.pobox.com/~ralf/files.html,
2863
    ftp://ftp.cs.cmu.edu/afs/cs/user/ralf/pub/);
118 diamond 2864
    registers of the second type must be listed
2865
    in the device documentation.
114 mikedld 2866
 
6057 IgorA 2867
---------------------- Constants for registers: ----------------------
2868
  eax - SF_PCI (62)
2869
  ebx - SSF_READ_BYTE (4), SSF_READ_WORD (5), SSF_READ_DWORD (6)
114 mikedld 2870
======================================================================
118 diamond 2871
====== Function 62, subfunctions 8,9,10 - write to PCI-register. =====
114 mikedld 2872
======================================================================
2873
Parameters:
118 diamond 2874
  * eax = 62 - function number
2875
  * bl = 8 - write byte
2876
  * bl = 9 - write word
2877
  * bl = 10 - write dword
114 mikedld 2878
  * bh = number of PCI-bus
118 diamond 2879
  * ch = dddddfff, where ddddd = number of the device on the bus,
2880
    fff = function number of device
2881
  * cl = number of register (must be even for bl=9,
2882
    divisible by 4 for bl=10)
7722 dunkaist 2883
  * dl/dx/edx (depending on requested size) contains
118 diamond 2884
    the data to write
114 mikedld 2885
Returned value:
118 diamond 2886
  * eax = -1 - error (access to PCI is disabled or parameters
2887
    are not supported)
2888
  * eax = 0 - success
114 mikedld 2889
Remarks:
118 diamond 2890
  * Previously low-level access to PCI for applications must be
2891
    enabled by subfunction 12 of function 21.
2892
  * Access mechanism 2 supports only 16 devices on a bus and ignores
2893
    function number. To get access mechanism use subfunction 2.
2894
  * Some registers are standard and exist for all devices, some are
2895
    defined by the concrete device. The list of registers of the
2896
    first type can be found e.g. in famous Interrupt List by
2897
    Ralf Brown; registers of the second type must be listed
2898
    in the device documentation.
114 mikedld 2899
 
6057 IgorA 2900
---------------------- Constants for registers: ----------------------
2901
  eax - SF_PCI (62)
2902
  ebx - SSF_WRITE_BYTE (8), SSF_WRITE_WORD (9), SSF_WRITE_DWORD (10)
114 mikedld 2903
======================================================================
118 diamond 2904
============== Function 63 - work with the debug board. ==============
114 mikedld 2905
======================================================================
118 diamond 2906
The debug board is the global system buffer (with the size
499 diamond 2907
1024 bytes), to which any program can write (generally speaking,
118 diamond 2908
arbitrary) data and from which other program can read these data.
2909
By the agreement written data are text strings interpreted as
2910
debug messages on a course of program execution. The kernel in
2911
some situations also writes to the debug board information on
2912
execution of some functions; by the agreement kernel messages
2913
begins from the prefix "K : ".
2914
For view of the debug board the application 'board' was created,
2915
which reads data from the buffer and displays them in its window.
2916
'board' interpretes the sequence of codes 13,10 as newline.
2917
A character with null code in an end of line is not necessary,
114 mikedld 2918
but also does not prevent.
118 diamond 2919
Because debugger has been written, the value of the debug board
2920
has decreased, as debugger allows to inspect completely a course of
2921
program execution without any efforts from the direction of program
2922
itself. Nevertheless in some cases the debug board is still useful.
114 mikedld 2923
 
118 diamond 2924
----------------------------- Write byte -----------------------------
114 mikedld 2925
Parameters:
118 diamond 2926
  * eax = 63 - function number
2927
  * ebx = 1 - subfunction number
2928
  * cl = data byte
114 mikedld 2929
Returned value:
2930
  * function does not return value
2931
Remarks:
118 diamond 2932
  * Byte is written to the buffer. Buffer size is 512 bytes.
2933
    At buffer overflow all obtained data are lost.
2934
  * For output to the debug board of more complicated objects
2935
    (strings, numbers) it is enough to call this function in cycle.
2936
    It is possible not to write the appropriate code manually and use
2937
    file 'debug.inc', which is included into the distributive.
114 mikedld 2938
 
118 diamond 2939
----------------------------- Read byte ------------------------------
2940
Takes away byte from the buffer.
114 mikedld 2941
Parameters:
118 diamond 2942
  * eax = 63 - function number
2943
  * ebx = 2 - subfunction number
114 mikedld 2944
Returned value:
118 diamond 2945
  * eax = ebx = 0 - the buffer is empty
2946
  * eax = byte, ebx = 1 - byte was successfully read
114 mikedld 2947
 
6057 IgorA 2948
---------------------- Constants for registers: ----------------------
2949
  eax - SF_BOARD (63)
2950
  ebx - SSF_DEBUG_WRITE (1), SSF_DEBUG_READ (2)
114 mikedld 2951
======================================================================
118 diamond 2952
============== Function 64 - resize application memory. ==============
114 mikedld 2953
======================================================================
2954
Parameters:
118 diamond 2955
  * eax = 64 - function number
2956
  * ebx = 1 - unique subfunction
2957
  * ecx = new memory size
114 mikedld 2958
Returned value:
118 diamond 2959
  * eax = 0 - success
2960
  * eax = 1 - not enough memory
114 mikedld 2961
Remarks:
193 diamond 2962
  * There is another way to dynamically allocate/free memory -
6893 pathoswith 2963
    subfunctions 12, 13 and 20 of function 68, but after creation
2964
    of the process heap 64 function call will be ignored.
6974 0CodErr 2965
  * The function cannot be used together with 68.11, 68.12, 68.13.
2966
    The function call will be ignored after creation of process heap
2967
    with function 68.11.
2968
 
6057 IgorA 2969
---------------------- Constants for registers: ----------------------
2970
  eax - SF_MEMORY_RESIZE (64)
114 mikedld 2971
======================================================================
283 diamond 2972
======== Function 65 - draw image with palette in the window. ========
2973
======================================================================
2974
Parameters:
2975
  * eax = 65 - function number
2976
  * ebx = pointer to the image
2977
  * ecx = [size on axis x]*65536 + [size on axis y]
2978
  * edx = [coordinate on axis x]*65536 + [coordinate on axis y]
2730 dunkaist 2979
  * esi = number of bits per pixel, must be 1,2,4,8,9,15,16,24 or 32;
1018 diamond 2980
  * edi = pointer to palette (2 to the power esi colors 0x00RRGGBB);
2981
          ignored when esi > 8
314 diamond 2982
  * ebp = offset of next row data relative to previous row data
283 diamond 2983
Returned value:
2984
  * function does not return value
2985
Remarks:
2986
  * Coordinates of the image are coordinates of the upper left corner
2987
    of the image relative to the window.
1018 diamond 2988
  * Format of image with 1 bit per pixel: each byte of image
2989
    (possibly excluding last bytes in rows), contains information on
2990
    the color of 8 pixels, MSB corresponds to first pixel.
2991
  * Format of image with 2 bits per pixel: each byte of image
2992
    (possibly excluding last bytes in rows), contains information on
2993
    the color of 4 pixels, two MSBs correspond to first pixel.
2994
  * Format of image with 4 bits per pixel: each byte of image
2995
    excluding last bytes in rows (if width is odd) contains
2996
    information on the color of 2 pixels, high-order tetrad
2997
    corresponds to first pixel.
2998
  * Format of image with 8 bits per pixel: each byte of image is
2999
    index in the palette.
2730 dunkaist 3000
  * Format of image with 9 bits per pixel: array of one byte values;
3001
    each byte (8 bit) represents the intensity of gray for one pixel;
3002
    this format is equal to 8bpp without palette.
1018 diamond 3003
  * Format of image with 15 bits per pixel: the color of each pixel
3004
    is coded as (bit representation) 0RRRRRGGGGGBBBBB - 5 bits per
3005
    each color.
3006
  * Format of image with 16 bits per pixel: the color of each pixel
3007
    is coded as RRRRRGGGGGGBBBBB (5+6+5).
3008
  * Format of image with 24 bits per pixel: the color of each pixel
3009
    is coded as 3 bytes - sequentially blue, green, red components.
3010
  * Format of image with 32 bits per pixel: similar to 24, but
6402 ashmew2 3011
    one additional ignored byte is present. It's format is BGRX,
3012
    where X is the ignored byte.
314 diamond 3013
  * The call to function 7 is equivalent to call to this function
3014
    with esi=24, ebp=0.
283 diamond 3015
 
6057 IgorA 3016
---------------------- Constants for registers: ----------------------
3017
  eax - SF_PUT_IMAGE_EXT (65)
283 diamond 3018
======================================================================
118 diamond 3019
================== Function 66 - work with keyboard. =================
114 mikedld 3020
======================================================================
118 diamond 3021
The input mode influences results of reading keys by function 2.
3022
When a program loads, ASCII input mode is set for it.
114 mikedld 3023
 
118 diamond 3024
-------------- Subfunction 1 - set keyboard input mode. --------------
114 mikedld 3025
Parameters:
118 diamond 3026
  * eax = 66 - function number
3027
  * ebx = 1 - subfunction number
114 mikedld 3028
  * ecx = mode:
3029
    * 0 = normal (ASCII-characters)
3030
    * 1 = scancodes
3031
Returned value:
3032
  * function does not return value
3033
 
118 diamond 3034
-------------- Subfunction 2 - get keyboard input mode. --------------
114 mikedld 3035
Parameters:
118 diamond 3036
  * eax = 66 - function number
3037
  * ebx = 2 - subfunction number
114 mikedld 3038
Returned value:
3039
  * eax = current mode
3040
 
118 diamond 3041
------------ Subfunction 3 - get status of control keys. -------------
114 mikedld 3042
Parameters:
118 diamond 3043
  * eax = 66 - function number
3044
  * ebx = 3 - subfunction number
114 mikedld 3045
Returned value:
3046
  * eax = bit mask:
3355 mario79 3047
  * bit 0  (mask 1): left Shift is pressed
3048
  * bit 1  (mask 2): right Shift is pressed
3049
  * bit 2  (mask 4): left Ctrl is pressed
3050
  * bit 3  (mask 8): right Ctrl is pressed
3051
  * bit 4  (mask 0x10): left Alt is pressed
3052
  * bit 5  (mask 0x20): right Alt is pressed
3053
  * bit 6  (mask 0x40): CapsLock is on
3054
  * bit 7  (mask 0x80): NumLock is on
3055
  * bit 8  (mask 0x100): ScrollLock is on
3056
  * bit 9  (mask 0x200): left Win is pressed
3057
  * bit 10 (mask 0x400): right Win is pressed
118 diamond 3058
  * other bits are cleared
114 mikedld 3059
 
118 diamond 3060
-------------- Subfunction 4 - set system-wide hotkey. ---------------
3061
When hotkey is pressed, the system notifies only those applications,
3062
which have installed it; the active application (which receives
3063
all normal input) does not receive such keys.
3064
The notification consists in sending event with the code 2.
3065
Reading hotkey is the same as reading normal key - by function 2.
114 mikedld 3066
Parameters:
118 diamond 3067
  * eax = 66 - function number
3068
  * ebx = 4 - subfunction number
3069
  * cl determines key scancode;
3070
    use cl=0 to give combinations such as Ctrl+Shift
3071
  * edx = 0xXYZ determines possible states of control keys:
3072
    * Z (low 4 bits) determines state of LShift and RShift:
3073
      * 0 = no key must be pressed;
3074
      * 1 = exactly one key must be pressed;
3075
      * 2 = both keys must be pressed;
3076
      * 3 = must be pressed LShift, but not RShift;
3077
      * 4 = must be pressed RShift, but not LShift
3078
    * Y - similar for LCtrl and RCtrl;
3079
    * X - similar for LAlt and RAlt
114 mikedld 3080
Returned value:
118 diamond 3081
  * eax=0 - success
7722 dunkaist 3082
  * eax=1 - too many hotkeys (maximum 256 are allowed)
114 mikedld 3083
Remarks:
118 diamond 3084
  * Hotkey can work either at pressing or at release. Release
3085
    scancode of a key is more on 128 than pressing scancode
3086
    (i.e. high bit is set).
3087
  * Several applications can set the same combination;
3088
    all such applications will be informed on pressing
3089
    such combination.
114 mikedld 3090
 
118 diamond 3091
-------------- Subfunction 5 - delete installed hotkey. --------------
114 mikedld 3092
Parameters:
118 diamond 3093
  * eax = 66 - function number
3094
  * ebx = 5 - subfunction number
3095
  * cl = scancode of key and edx = 0xXYZ the same as in subfunction 4
114 mikedld 3096
Returned value:
118 diamond 3097
  * eax = 0 - success
114 mikedld 3098
  * eax = 1 - there is no such hotkey
3099
Remarks:
118 diamond 3100
  * When a process/thread terminates, all hotkey installed by it are
3101
    deleted.
3102
  * The call to this subfunction does not affect other applications.
3103
    If other application has defined the same combination, it will
3104
    still receive notices.
114 mikedld 3105
 
2709 mario79 3106
--------------- Subfunction 6 - block the normal input. --------------
3107
Parameters:
3108
  * eax = 66 - function number
3109
  * ebx = 6 - subfunction number
3110
Returned value:
3111
  * function does not return value
3112
Remarks:
3113
  * Blocking the normal keyboard input for installed hotkeys
3114
  * To emulate a mouse via the keyboard, the application MOUSEMUL
3115
 
3116
------------ Subfunction 7 - unlock the normal input. ----------------
3117
Parameters:
3118
  * eax = 66 - function number
3119
  * ebx = 7 - subfunction number
3120
Returned value:
3121
  * function does not return value
3122
Remarks:
3123
  * Unlocking the results of the f. 66.6
3124
  * To emulate a mouse via the keyboard, the application MOUSEMUL
3125
 
6057 IgorA 3126
---------------------- Constants for registers: ----------------------
3127
  eax - SF_KEYBOARD (66)
3128
  ebx - SSF_SET_INPUT_MODE (1), SSF_GET_INPUT_MODE (2),
3129
    SSF_GET_CONTROL_KEYS (3), SSF_SET_SYS_HOTKEY (4),
3130
    SSF_DEL_SYS_HOTKEY (5),  SSF_LOCK_INPUT (6), SSF_UNLOCK_INPUT (7)
114 mikedld 3131
======================================================================
118 diamond 3132
========= Function 67 - change position/sizes of the window. =========
114 mikedld 3133
======================================================================
3134
Parameters:
118 diamond 3135
  * eax = 67 - function number
114 mikedld 3136
  * ebx = new x-coordinate of the window
3137
  * ecx = new y-coordinate of the window
3138
  * edx = new x-size of the window
3139
  * esi = new y-size of the window
3140
Returned value:
3141
  * function does not return value
3142
Remarks:
118 diamond 3143
  * The value -1 for a parameter means "do not change"; e.g. to move
3144
    the window without resizing it is possible to specify edx=esi=-1.
3145
  * Previously the window must be defined by function 0.
114 mikedld 3146
    It sets initial coordinates and sizes of the window.
118 diamond 3147
  * Sizes of the window are understood in sense of function 0,
3148
    that is one pixel less than real sizes.
3149
  * The function call for maximized windows is simply ignored.
3150
  * For windows of appropriate styles position and/or sizes can be
3151
    changed by user; current position and sizes can be obtained by
3152
    call to function 9.
3153
  * The function sends to the window redraw event (with the code 1).
114 mikedld 3154
 
6057 IgorA 3155
---------------------- Constants for registers: ----------------------
3156
  eax - SF_CHANGE_WINDOW (67)
114 mikedld 3157
======================================================================
118 diamond 3158
====== Function 68, subfunction 0 - get the task switch counter. =====
114 mikedld 3159
======================================================================
3160
Parameters:
118 diamond 3161
  * eax = 68 - function number
3162
  * ebx = 0 - subfunction number
114 mikedld 3163
Returned value:
118 diamond 3164
  * eax = number of task switches from the system booting
3165
    (modulo 2^32)
114 mikedld 3166
 
6057 IgorA 3167
---------------------- Constants for registers: ----------------------
3168
  eax - SF_SYS_MISC (68)
3169
  ebx - SSF_GET_TASK_SWITCH_COUNT (0)
114 mikedld 3170
======================================================================
118 diamond 3171
======= Function 68, subfunction 1 - switch to the next thread. ======
114 mikedld 3172
======================================================================
118 diamond 3173
The function completes the current time slice allocated to the
3174
thread and switches to the next. (Which thread in which process
3175
will be next, is unpredictable). Later, when execution queue
3176
will reach the current thread, execution will be continued.
114 mikedld 3177
Parameters:
118 diamond 3178
  * eax = 68 - function number
3179
  * ebx = 1 - subfunction number
114 mikedld 3180
Returned value:
3181
  * function does not return value
3182
 
6057 IgorA 3183
---------------------- Constants for registers: ----------------------
3184
  eax - SF_SYS_MISC (68)
3185
  ebx - SSF_SWITCH_TASK (1)
114 mikedld 3186
======================================================================
118 diamond 3187
============= Function 68, subfunction 2 - cache + rdpmc. ============
114 mikedld 3188
======================================================================
3189
Parameters:
118 diamond 3190
  * eax = 68 - function number
3191
  * ebx = 2 - subfunction number
3192
  * ecx = required action:
3193
    * ecx = 0 - enable instruction 'rdpmc'
3194
      (ReaD Performance-Monitoring Counters) for applications
3195
    * ecx = 1 - find out whether cache is disabled/enabled
3196
    * ecx = 2 - enable cache
3197
    * ecx = 3 - disable cache
114 mikedld 3198
Returned value:
3199
  * for ecx=0:
118 diamond 3200
    * eax = the value of cr4
114 mikedld 3201
  * for ecx=1:
3202
    * eax = (cr0 and 0x60000000):
118 diamond 3203
    * eax = 0 - cache is on
3204
    * eax <> 0 - cache is off
114 mikedld 3205
  * for ecx=2 and ecx=3:
3206
    * function does not return value
3207
 
6057 IgorA 3208
---------------------- Constants for registers: ----------------------
3209
  eax - SF_SYS_MISC (68)
3210
  ebx - SSF_PERFORMANCE (2)
3211
  ecx - SSSF_ALLOW_RDPMC (0), SSSF_CACHE_STATUS (1),
3212
    SSSF_CACHE_ON (2), SSSF_CACHE_OFF (3)
114 mikedld 3213
======================================================================
3214
=========== Function 68, subfunction 3 - read MSR-register. ==========
3215
======================================================================
118 diamond 3216
MSR = Model Specific Register; the complete list of MSR-registers
3217
of a processor is included to the documentation on it (for example,
3218
IA-32 Intel Architecture Software Developer's Manual,
3219
Volume 3, Appendix B); each processor family has its own subset
3220
of the MSR-registers.
114 mikedld 3221
Parameters:
118 diamond 3222
  * eax = 68 - function number
3223
  * ebx = 3 - subfunction number
3224
  * ecx is ignored
3225
  * edx = MSR address
114 mikedld 3226
Returned value:
118 diamond 3227
  * ebx:eax = high:low dword of the result
114 mikedld 3228
Remarks:
118 diamond 3229
  * If ecx contains nonexistent or not implemented for this processor
3230
    MSR, processor will generate an exception in the kernel, which
3231
    will kill the thread.
3232
  * Previously it is necessary to check, whether MSRs are supported
3233
    as a whole, with the instruction 'cpuid'. Otherwise processor
3234
    will generate other exception in the kernel, which will anyway
3235
    kill the thread.
114 mikedld 3236
 
6057 IgorA 3237
---------------------- Constants for registers: ----------------------
3238
  eax - SF_SYS_MISC (68)
3239
  ebx - SSF_READ_MSR (3)
114 mikedld 3240
======================================================================
118 diamond 3241
========= Function 68, subfunction 4 - write to MSR-register. ========
114 mikedld 3242
======================================================================
118 diamond 3243
MSR = Model Specific Register; the complete list of MSR-registers
3244
of a processor is included to the documentation on it (for example,
3245
IA-32 Intel Architecture Software Developer's Manual,
3246
Volume 3, Appendix B); each processor family has its own subset
3247
of the MSR-registers.
114 mikedld 3248
Parameters:
118 diamond 3249
  * eax = 68 - function number
3250
  * ebx = 4 - subfunction number
3251
  * ecx is ignored
3252
  * edx = MSR address
3253
  * esi:edi = high:low dword
114 mikedld 3254
Returned value:
499 diamond 3255
  * function does not return value
3256
Remarks:
118 diamond 3257
  * If ecx contains nonexistent or not implemented for this processor
3258
    MSR, processor will generate an exception in the kernel, which
3259
    will kill the thread.
3260
  * Previously it is necessary to check, whether MSRs are supported
3261
    as a whole, with the instruction 'cpuid'. Otherwise processor
3262
    will generate other exception in the kernel, which will anyway
3263
    kill the thread.
114 mikedld 3264
 
6057 IgorA 3265
---------------------- Constants for registers: ----------------------
3266
  eax - SF_SYS_MISC (68)
3267
  ebx - SSF_WRITE_MSR (4)
114 mikedld 3268
======================================================================
6974 0CodErr 3269
=== Function 68, subfunction 11 - initialize process heap ============
114 mikedld 3270
======================================================================
3271
Parameters:
118 diamond 3272
  * eax = 68 - function number
193 diamond 3273
  * ebx = 11 - subfunction number
114 mikedld 3274
Returned value:
193 diamond 3275
  * eax = 0 - failed
3276
  * otherwise size of created heap
114 mikedld 3277
Remarks:
6893 pathoswith 3278
  * The function call initializes heap for subfunctions 12, 13 and 20.
3279
  * If the process heap is already created, this function will return
3280
    the size of the existing heap.
193 diamond 3281
    Heap size is equal to total amount of free application memory.
3282
  * After creation of the heap calls to function 64 will be ignored.
114 mikedld 3283
 
6057 IgorA 3284
---------------------- Constants for registers: ----------------------
3285
  eax - SF_SYS_MISC (68)
3286
  ebx - SSF_HEAP_INIT (11)
114 mikedld 3287
======================================================================
193 diamond 3288
======== Function 68, subfunction 12 - allocate memory block. ========
114 mikedld 3289
======================================================================
3290
Parameters:
118 diamond 3291
  * eax = 68 - function number
193 diamond 3292
  * ebx = 12 - subfunction number
3293
  * ecx = required size in bytes
114 mikedld 3294
Returned value:
193 diamond 3295
  * eax = pointer to the allocated block
114 mikedld 3296
Remarks:
193 diamond 3297
  * The function allocates an integer number of pages (4 Kb) in such
3298
    way that the real size of allocated block is more than or equal to
3299
    requested size.
114 mikedld 3300
 
6057 IgorA 3301
---------------------- Constants for registers: ----------------------
3302
  eax - SF_SYS_MISC (68)
3303
  ebx - SSF_MEM_ALLOC (12)
114 mikedld 3304
======================================================================
193 diamond 3305
========== Function 68, subfunction 13 - free memory block. ==========
114 mikedld 3306
======================================================================
3307
Parameters:
118 diamond 3308
  * eax = 68 - function number
193 diamond 3309
  * ebx = 13 - subfunction number
3310
  * ecx = pointer to the memory block
114 mikedld 3311
Returned value:
193 diamond 3312
  * eax = 1 - success
3313
  * eax = 0 - failed
114 mikedld 3314
Remarks:
448 diamond 3315
  * The memory block must have been allocated by subfunction 12
3316
    or subfunction 20.
114 mikedld 3317
 
6057 IgorA 3318
---------------------- Constants for registers: ----------------------
3319
  eax - SF_SYS_MISC (68)
3320
  ebx - SSF_MEM_FREE (13)
114 mikedld 3321
======================================================================
1074 Galkov 3322
===================== Function 68, subfunction 14 ====================
1662 Nasarus 3323
============ Wait for signal from another program/driver. ============
114 mikedld 3324
======================================================================
3325
Parameters:
118 diamond 3326
  * eax = 68 - function number
193 diamond 3327
  * ebx = 14 - subfunction number
1074 Galkov 3328
  * ecx = pointer to the buffer for information (24 bytes)
114 mikedld 3329
Returned value:
193 diamond 3330
  * buffer pointed to by ecx contains the following information:
1662 Nasarus 3331
    * +0: dword: identifier for following data of signal
3332
    * +4: dword: data of signal (20 bytes), format of which is defined
3333
          by the first dword
114 mikedld 3334
 
6057 IgorA 3335
---------------------- Constants for registers: ----------------------
3336
  eax - SF_SYS_MISC (68)
3337
  ebx - SSF_WAIT_SIGNAL (14)
114 mikedld 3338
======================================================================
193 diamond 3339
============= Function 68, subfunction 16 - load driver. =============
3340
======================================================================
3341
Parameters:
3342
  * eax = 68 - function number
3343
  * ebx = 16 - subfunction number
3344
  * ecx = pointer to ASCIIZ-string with driver name
3345
Returned value:
3346
  * eax = 0 - failed
3347
  * otherwise eax = driver handle
3348
Remarks:
3349
  * If the driver was not loaded yet, it is loaded;
3350
    if the driver was loaded yet, nothing happens.
3351
  * Driver name is case-sensitive.
3352
    Maximum length of the name is 16 characters, including
3353
    terminating null character, the rest is ignored.
8088 dunkaist 3354
  * Driver ABC is loaded from file /sys/drivers/ABC.sys.
193 diamond 3355
 
6057 IgorA 3356
---------------------- Constants for registers: ----------------------
3357
  eax - SF_SYS_MISC (68)
3358
  ebx - SSF_LOAD_DRIVER (16)
193 diamond 3359
======================================================================
3360
============ Function 68, subfunction 17 - driver control. ===========
3361
======================================================================
3362
Parameters:
3363
  * eax = 68 - function number
3364
  * ebx = 17 - subfunction number
3365
  * ecx = pointer to the control structure:
3366
    * +0: dword: handle of driver
3367
    * +4: dword: code of driver function
3368
    * +8: dword: pointer to input data
3369
    * +12 = +0xC: dword: size of input data
3370
    * +16 = +0x10: dword: pointer to output data
3371
    * +20 = +0x14: dword: size of output data
3372
Returned value:
1662 Nasarus 3373
  * eax = determined by driver
193 diamond 3374
Remarks:
3375
  * Function codes and the structure of input/output data
3376
    are defined by driver.
3377
  * Previously one must obtain driver handle by subfunction 16.
3378
 
6057 IgorA 3379
---------------------- Constants for registers: ----------------------
3380
  eax - SF_SYS_MISC (68)
3381
  ebx - SSF_CONTROL_DRIVER (17)
193 diamond 3382
======================================================================
6798 pathoswith 3383
== Function 68, subfunction 18 - load DLL, specifying the encoding. ==
277 diamond 3384
======================================================================
3385
Parameters:
3386
  * eax = 68 - function number
6798 pathoswith 3387
  * ebx = 18 - subfunction number
3388
  * ecx = pointer to the string with path to DLL
3389
  * edx = string encoding, details can be found in function 80 description.
277 diamond 3390
Returned value:
3391
  * eax = 0 - failed
3392
  * otherwise eax = pointer to DLL export table
3393
Remarks:
3394
  * Export table is an array of structures of 2 dword's, terminated
3395
    by zero. The first dword in structure points to function name,
3396
    the second dword contains address of function.
3397
 
6798 pathoswith 3398
======================================================================
3399
=============== Function 68, subfunction 19 - load DLL. ==============
3400
======================================================================
3401
Parameters:
3402
  * eax = 68 - function number
3403
  * ebx = 19 - subfunction number
3404
  * ecx = pointer to the string with path to DLL,
3405
    rules of path forming can be found in function 70 description.
3406
Returned value:
3407
  * eax = 0 - failed
3408
  * otherwise eax = pointer to DLL export table
3409
 
6057 IgorA 3410
---------------------- Constants for registers: ----------------------
3411
  eax - SF_SYS_MISC (68)
3412
  ebx - SSF_LOAD_DLL (19)
277 diamond 3413
======================================================================
448 diamond 3414
======= Function 68, subfunction 20 - reallocate memory block. =======
3415
======================================================================
3416
Parameters:
3417
  * eax = 68 - function number
3418
  * ebx = 20 - subfunction number
3419
  * ecx = new size in bytes
3420
  * edx = pointer to already allocated block
3421
Returned value:
3422
  * eax = pointer to the reallocated block, 0 = error
3423
Remarks:
6974 0CodErr 3424
  * Before this call one must initialize process heap by call to
3425
    subfunction 11.
448 diamond 3426
  * The function allocates an integer number of pages (4 Kb) in such
3427
    way that the real size of allocated block is more than or equal to
3428
    requested size.
3429
  * If edx=0, the function call is equivalent to memory allocation
3430
    with subfunction 12. Otherwise the block at edx
3431
    must be allocated earlier with subfunction 12 or this subfunction.
3432
  * If ecx=0, the function frees memory block at edx and returns 0.
3433
  * The contents of the block are unchanged up to the shorter of
3434
    the new and old sizes.
3435
 
6057 IgorA 3436
---------------------- Constants for registers: ----------------------
3437
  eax - SF_SYS_MISC (68)
3438
  ebx - SSF_MEM_REALLOC (20)
448 diamond 3439
======================================================================
2646 mario79 3440
=========== Function 68, subfunction 21 - load driver PE. ============
3441
======================================================================
3442
Parameters:
3443
  * eax = 68 - function number
3444
  * ebx = 21 - subfunction number
3445
  * ecx = pointer to ASCIIZ-string with driver name
2647 mario79 3446
  * edx = pointer to command line
2646 mario79 3447
Returned value:
3448
  * eax = 0 - failed
3449
  * otherwise eax = driver handle
3450
Remarks:
3451
  * If the driver was not loaded yet, it is loaded;
3452
    if the driver was loaded yet, nothing happens.
3453
 
6057 IgorA 3454
---------------------- Constants for registers: ----------------------
3455
  eax - SF_SYS_MISC (68)
3456
  ebx - SSF_LOAD_DRIVER_PE (21)
2646 mario79 3457
======================================================================
1662 Nasarus 3458
======== Function 68, subfunction 22 - open named memory area. =======
1077 Galkov 3459
======================================================================
3460
Parameters:
3461
  * eax = 68 - function number
1662 Nasarus 3462
  * ebx = 22 - subfunction number
3463
  * ecx = area name. Maximum of 31 characters with terminating zero
3464
  * edx = area size in bytes for SHM_CREATE and SHM_OPEN_ALWAYS
3465
  * esi = flags for open and access:
3466
    * SHM_OPEN        = 0x00 - open existing memory area. If an area
3467
                          with such name does not exist, the function
3468
                          will return error code 5.
3469
    * SHM_OPEN_ALWAYS = 0x04 - open existing or create new
3470
                          memory area.
3471
    * SHM_CREATE      = 0x08 - create new memory area. If an area
3472
                          with such name already exists, the function
3473
                          will return error code 10.
3474
    * SHM_READ        = 0x00 - only read access
3475
    * SHM_WRITE       = 0x01 - read and write access
3476
Returned value:
7722 dunkaist 3477
  * eax = pointer to memory area, 0 if error has occurred
1662 Nasarus 3478
  * if new area is created (SHM_CREATE or SHM_OPEN_ALWAYS):
3479
    edx = 0 - success, otherwise - error code
3480
  * if existing area is opened (SHM_OPEN or SHM_OPEN_ALWAYS):
3481
    edx = error code (if eax=0) or area size in bytes
3482
Error codes:
3483
  * E_NOTFOUND = 5
3484
  * E_ACCESS = 10
3485
  * E_NOMEM = 30
3486
  * E_PARAM = 33
3487
Remarks:
6974 0CodErr 3488
  * Before this call one must initialize process heap by call to
3489
    subfunction 11.
1662 Nasarus 3490
  * If a new area is created, access flags set maximal rights
3491
    for other processes. An attempt from other process to open
3492
    with denied rights will fail with error code E_ACCESS.
3493
  * The process which has created an area always has write access.
3494
 
6057 IgorA 3495
---------------------- Constants for registers: ----------------------
3496
  eax - SF_SYS_MISC (68)
3497
  ebx - SSF_MEM_OPEN (22)
1662 Nasarus 3498
======================================================================
3499
======= Function 68, subfunction 23 - close named memory area. =======
3500
======================================================================
3501
Parameters:
3502
  * eax = 68 - function number
3503
  * ebx = 23 - subfunction number
3504
  * ecx = area name. Maximum of 31 characters with terminating zero
3505
Returned value:
3506
  * eax destroyed
3507
Remarks:
3508
  * A memory area is physically freed (with deleting all data and
3509
    freeing physical memory), when all threads which have opened
3510
    this area will close it.
3511
  * When thread is terminating, all opened by it areas are closed.
3512
 
6057 IgorA 3513
---------------------- Constants for registers: ----------------------
3514
  eax - SF_SYS_MISC (68)
3515
  ebx - SSF_MEM_CLOSE (23)
1662 Nasarus 3516
======================================================================
3517
======== Function 68, subfunction 24 - set exception handler. ========
3518
======================================================================
3519
Parameters:
3520
  * eax = 68 - function number
1077 Galkov 3521
  * ebx = 24 - subfunction number
3522
  * ecx = address of the new exception handler
1662 Nasarus 3523
  * edx = the mask of handled exceptions
1077 Galkov 3524
Returned value:
3525
  * eax = address of the old exception handler (0, if it was not set)
1662 Nasarus 3526
  * ebx = the old mask of handled exceptions
1077 Galkov 3527
Remarks:
1662 Nasarus 3528
  * Bit number in mask of exceptions corresponds to exception number
3529
    in CPU-specification (Intel-PC). For example, FPU exceptions have
3530
    number 16 (#MF), and SSE exceptions - 19 (#XF).
3531
  * The current implementation ignores the inquiry for hook of 7
3532
    exception - the system handles #NM by its own.
3533
  * The exception handler is called with exception number as first
3534
    (and only) stack parameter. So, correct exit from the handler is
3535
    RET 4. It returns to the instruction, that caused the exception,
3536
    for faults, and to the next instruction for traps (see
3537
    classification of exceptions in CPU specification).
3538
  * When user handler receives control, the corresponding bit in
3539
    the exception mask is cleared. Raising this exception
3540
    in consequence leads to default handling, that is,
3541
    terminating the application in absence of debugger or
3542
    suspend with notification of debugger otherwise.
3543
  * After user handler completes critical operations, it can set
3544
    the corresponding bit in the exception mask with subfunction 25.
3545
    Also user handler is responsible for clearing exceptions flags in
3546
    FPU and/or SSE.
1077 Galkov 3547
 
6057 IgorA 3548
---------------------- Constants for registers: ----------------------
3549
  eax - SF_SYS_MISC (68)
3550
  ebx - SSF_SET_EXCEPTION_HANDLER (24)
1077 Galkov 3551
======================================================================
5983 pathoswith 3552
======== Function 68, subfunction 25 - set exception activity ========
1077 Galkov 3553
======================================================================
3554
Parameters:
3555
  * eax = 68 - function number
3556
  * ebx = 25 - subfunction number
3557
  * ecx = signal number
3558
  * edx = value of activity (0/1)
3559
Returned value:
1662 Nasarus 3560
  * eax = -1 - invalid signal number
3561
  * otherwise eax = old value of activity for this signal (0/1)
1077 Galkov 3562
Remarks:
7722 dunkaist 3563
  * In current implementation only mask for user exception handler,
1662 Nasarus 3564
    which has been previously set by subfunction 24,
3565
    is changed. Signal number corresponds to exception number.
1077 Galkov 3566
 
6057 IgorA 3567
---------------------- Constants for registers: ----------------------
3568
  eax - SF_SYS_MISC (68)
3569
  ebx - SSF_SET_EXCEPTION_STATE (25)
1077 Galkov 3570
======================================================================
3787 Serge 3571
====== Function 68, subfunction 26 - release memory pages ============
3572
======================================================================
3573
Parameters:
3574
  * eax = 68 - function number
3575
  * ebx = 26 - subfunction number
3576
  * ecx = pointer to the memory block, allocated by subfunction 12
3577
  * edx = offset from the block beginnings
3578
  * esi = the size of the region of memory to release, in bytes
3579
Remarks:
3580
  * function release range of pages from ecx+edx to ecx+edx+esi
3581
    and set virtual memory into reserved state.
3582
 
6057 IgorA 3583
---------------------- Constants for registers: ----------------------
3584
  eax - SF_SYS_MISC (68)
3585
  ebx - SSF_MEM_FREE_EXT (26)
3787 Serge 3586
======================================================================
3587
========== Function 68, subfunction 27 - load file ===================
3588
======================================================================
3589
Parameters:
3590
  * eax = 68 - function number
3591
  * ebx = 27 - subfunction number
6511 pathoswith 3592
  * ecx = pointer to the string with path to file,
3593
    rules of path forming can be found in function 70 description.
3787 Serge 3594
Returned value:
3595
  * eax = pointer to the loaded file, or zero
3596
  * edx = size of the loaded file, or zero
3597
Remarks:
3598
  * function loads file and unpacks, if necessary
6974 0CodErr 3599
  * Before this call one must initialize process heap by call to
3600
    subfunction 11.
3787 Serge 3601
 
6057 IgorA 3602
---------------------- Constants for registers: ----------------------
3603
  eax - SF_SYS_MISC (68)
3604
  ebx - SSF_LOAD_FILE (27)
3787 Serge 3605
======================================================================
6798 pathoswith 3606
== Function 68, subfunction 28 - load file, specifying the encoding ==
3607
======================================================================
3608
Parameters:
3609
  * eax = 68 - function number
3610
  * ebx = 28 - subfunction number
3611
  * ecx = pointer to the string with path to file
3612
  * edx = string encoding, details can be found in function 80 description.
3613
Returned value:
3614
  * eax = pointer to the loaded file, or zero
3615
  * edx = size of the loaded file, or zero
3616
Remarks:
3617
  * function loads file and unpacks, if necessary
7967 hidnplayr 3618
======================================================================
3619
======== Function 68, subfunction 29 - allocate ring memory. =========
3620
======================================================================
3621
Parameters:
3622
  * eax = 68 - function number
3623
  * ebx = 29 - subfunction number
3624
  * ecx = required size in bytes
3625
Returned value:
3626
  * eax = 0 - failed
3627
  * eax = pointer to the allocated ring
3628
Remarks:
3629
  * The requested size must be an exact multiple of pagesize (4 Kb)
3630
  * The function allocates memory in such a way that you can read and
3631
    write beyond the size of the allocated memory and will reach the
3632
    beginning of the buffer again.
6798 pathoswith 3633
 
7967 hidnplayr 3634
---------------------- Constants for registers: ----------------------
3635
  eax - SF_SYS_MISC (68)
3636
  ebx - SSF_MEM_ALLOC_RING (29)
3637
 
6798 pathoswith 3638
======================================================================
1662 Nasarus 3639
====================== Function 69 - debugging. ======================
114 mikedld 3640
======================================================================
118 diamond 3641
A process can load other process as debugged by set of corresponding
193 diamond 3642
bit by call to subfunction 7 of function 70.
118 diamond 3643
A process can have only one debugger; one process can debug some
7722 dunkaist 3644
others. The system notifies debugger on events occurring with
118 diamond 3645
debugged process. Messages are written to the buffer defined by
114 mikedld 3646
subfunction 0.
118 diamond 3647
Format of a message:
3648
  * +0: dword: message code
3649
  * +4: dword: PID of debugged process
3650
  * +8: there can be additional data depending on message code
3651
Message codes:
114 mikedld 3652
  * 1 = exception
118 diamond 3653
    * in addition dword-number of the exception is given
3654
    * process is suspended
3655
  * 2 = process has terminated
3656
    * comes at any termination: both through the system function -1,
3657
      and at "murder" by any other process (including debugger itself)
114 mikedld 3658
  * 3 = debug exception int 1 = #DB
118 diamond 3659
    * in addition dword-image of the register DR6 is given:
3660
      * bits 0-3: condition of the corresponding breakpoint (set by
3661
        subfunction 9) is satisfied
7722 dunkaist 3662
      * bit 14: exception has occurred because of the trace mode
118 diamond 3663
        (flag TF is set TF)
3664
    * process is suspended
3665
When debugger terminates, all debugged processes are killed.
3666
If debugger does not want this, it must previously detach by
114 mikedld 3667
subfunction 3.
3668
 
1018 diamond 3669
All subfunctions are applicable only to processes/threads started
3670
from the current by function 70 with set debugging flag.
118 diamond 3671
Debugging of multithreaded programs is not supported yet.
3672
The full list of subfunctions:
3673
  * subfunction 0 - define data area for debug messages
3674
  * subfunction 1 - get contents of registers of debugged thread
3675
  * subfunction 2 - set contents of registers of debugged thread
3676
  * subfunction 3 - detach from debugged process
3677
  * subfunction 4 - suspend debugged thread
3678
  * subfunction 5 - resume debugged thread
3679
  * subfunction 6 - read from the memory of debugged process
3680
  * subfunction 7 - write to the memory of debugged process
3681
  * subfunction 8 - terminate debugged thread
3682
  * subfunction 9 - set/clear hardware breakpoint
114 mikedld 3683
 
6057 IgorA 3684
---------------------- Constants for registers: ----------------------
3685
  eax - SF_DEBUG (69)
3686
  ebx - SSF_SET_MESSAGE_AREA (0), SSF_GET_REGISTERS (1),
3687
    SSF_SET_REGISTERS (2), SSF_DETACH (3), SSF_SUSPEND (4),
3688
    SSF_RESUME (5), SSF_READ_MEMORY (6), SSF_WRITE_MEMORY (7),
3689
    SSF_TERMINATE (8), SSF_DEFINE_BREAKPOINT (9)
114 mikedld 3690
======================================================================
118 diamond 3691
= Function 69, subfunction 0 - define data area fror debug messages. =
114 mikedld 3692
======================================================================
3693
Parameters:
118 diamond 3694
  * eax = 69 - function number
3695
  * ebx = 0 - subfunction number
114 mikedld 3696
  * ecx = pointer
3697
Format of data area:
118 diamond 3698
  * +0: dword: N = buffer size (not including this header)
3699
  * +4: dword: occupied place
114 mikedld 3700
  * +8: N*byte: buffer
3701
Returned value:
3702
  * function does not return value
3703
Remarks:
118 diamond 3704
  * If the size field is negative, the buffer is considered locked
3705
    and at arrival of new message the system will wait.
3706
    For synchronization frame all work with the buffer by operations
3707
    lock/unlock
5871 hidnplayr 3708
        neg     [bufsize]
118 diamond 3709
  * Data in the buffer are considered as array of items with variable
3710
    length - messages. Format of a message is explained in
3711
    general description.
114 mikedld 3712
 
6057 IgorA 3713
---------------------- Constants for registers: ----------------------
3714
  eax - SF_DEBUG (69)
3715
  ebx - SSF_SET_MESSAGE_AREA (0)
114 mikedld 3716
======================================================================
118 diamond 3717
===================== Function 69, subfunction 1 =====================
3718
============ Get contents of registers of debugged thread. ===========
114 mikedld 3719
======================================================================
3720
Parameters:
118 diamond 3721
  * eax = 69 - function number
3722
  * ebx = 1 - subfunction number
114 mikedld 3723
  * ecx = thread identifier
118 diamond 3724
  * edx = size of context structure, must be 0x28=40 bytes
3725
  * esi = pointer to context structure
114 mikedld 3726
Returned value:
3727
  * function does not return value
118 diamond 3728
Format of context structure: (FPU is not supported yet)
114 mikedld 3729
  * +0: dword: eip
3730
  * +4: dword: eflags
3731
  * +8: dword: eax
3732
  * +12 = +0xC: dword: ecx
3733
  * +16 = +0x10: dword: edx
3734
  * +20 = +0x14: dword: ebx
3735
  * +24 = +0x18: dword: esp
3736
  * +28 = +0x1C: dword: ebp
3737
  * +32 = +0x20: dword: esi
3738
  * +36 = +0x24: dword: edi
3739
Remarks:
118 diamond 3740
  * If the thread executes code of ring-0, the function returns
3741
    contents of registers of ring-3.
3742
  * Process must be loaded for debugging (as is shown in
3743
    general description).
114 mikedld 3744
 
6057 IgorA 3745
---------------------- Constants for registers: ----------------------
3746
  eax - SF_DEBUG (69)
3747
  ebx - SSF_GET_REGISTERS (1)
114 mikedld 3748
======================================================================
118 diamond 3749
===================== Function 69, subfunction 2 =====================
3750
============ Set contents of registers of debugged thread. ===========
114 mikedld 3751
======================================================================
3752
Parameters:
118 diamond 3753
  * eax = 69 - function number
3754
  * ebx = 2 - subfunction number
114 mikedld 3755
  * ecx = thread identifier
118 diamond 3756
  * edx = size of context structure, must be 0x28=40 bytes
6758 pathoswith 3757
  * esi -> context structure
114 mikedld 3758
Returned value:
3759
  * function does not return value
118 diamond 3760
Format of context structure is shown in the description of
3761
subfunction 1.
114 mikedld 3762
Remarks:
118 diamond 3763
  * If the thread executes code of ring-0, the function returns
3764
    contents of registers of ring-3.
3765
  * Process must be loaded for debugging (as is shown in
3766
    general description).
114 mikedld 3767
 
6057 IgorA 3768
---------------------- Constants for registers: ----------------------
3769
  eax - SF_DEBUG (69)
3770
  ebx - SSF_SET_REGISTERS (2)
114 mikedld 3771
======================================================================
118 diamond 3772
===== Function 69, subfunction 3 - detach from debugged process. =====
114 mikedld 3773
======================================================================
3774
Parameters:
118 diamond 3775
  * eax = 69 - function number
3776
  * ebx = 3 - subfunction number
114 mikedld 3777
  * ecx = identifier
3778
Returned value:
3779
  * function does not return value
3780
Remarks:
118 diamond 3781
  * If the process was suspended, it resumes execution.
114 mikedld 3782
 
6057 IgorA 3783
---------------------- Constants for registers: ----------------------
3784
  eax - SF_DEBUG (69)
3785
  ebx - SSF_DETACH (3)
114 mikedld 3786
======================================================================
1018 diamond 3787
======== Function 69, subfunction 4 - suspend debugged thread. =======
114 mikedld 3788
======================================================================
3789
Parameters:
118 diamond 3790
  * eax = 69 - function number
3791
  * ebx = 4 - subfunction number
3792
  * ecx = thread identifier
114 mikedld 3793
Returned value:
3794
  * function does not return value
1018 diamond 3795
Remarks:
3796
  * Process must be loaded for debugging (as is shown in
3797
    general description).
114 mikedld 3798
 
6057 IgorA 3799
---------------------- Constants for registers: ----------------------
3800
  eax - SF_DEBUG (69)
3801
  ebx - SSF_SUSPEND (4)
114 mikedld 3802
======================================================================
1018 diamond 3803
======== Function 69, subfunction 5 - resume debugged thread. ========
114 mikedld 3804
======================================================================
3805
Parameters:
118 diamond 3806
  * eax = 69 - function number
3807
  * ebx = 5 - subfunction number
3808
  * ecx = thread identifier
114 mikedld 3809
Returned value:
3810
  * function does not return value
1018 diamond 3811
Remarks:
3812
  * Process must be loaded for debugging (as is shown in
3813
    general description).
114 mikedld 3814
 
6057 IgorA 3815
---------------------- Constants for registers: ----------------------
3816
  eax - SF_DEBUG (69)
3817
  ebx - SSF_RESUME (5)
114 mikedld 3818
======================================================================
118 diamond 3819
= Fucntion 69, subfunction 6 - read from memory of debugged process. =
114 mikedld 3820
======================================================================
3821
Parameters:
118 diamond 3822
  * eax = 69 - function number
3823
  * ebx = 6 - subfunction number
114 mikedld 3824
  * ecx = identifier
118 diamond 3825
  * edx = number of bytes to read
3826
  * esi = address in the memory of debugged process
3827
  * edi = pointer to buffer for data
114 mikedld 3828
Returned value:
118 diamond 3829
  * eax = -1 at an error (invalid PID or buffer)
3830
  * otherwise eax = number of read bytes (possibly, 0,
3831
    if esi is too large)
114 mikedld 3832
Remarks:
118 diamond 3833
  * Process must be loaded for debugging (as is shown in
3834
    general description).
114 mikedld 3835
 
6057 IgorA 3836
---------------------- Constants for registers: ----------------------
3837
  eax - SF_DEBUG (69)
3838
  ebx - SSF_READ_MEMORY (6)
114 mikedld 3839
======================================================================
118 diamond 3840
== Function 69, subfunction 7 - write to memory of debugged process. =
114 mikedld 3841
======================================================================
3842
Parameters:
118 diamond 3843
  * eax = 69 - function number
3844
  * ebx = 7 - subfunction number
114 mikedld 3845
  * ecx = identifier
118 diamond 3846
  * edx = number of bytes to write
3847
  * esi = address of memory in debugged process
3848
  * edi = pointer to data
114 mikedld 3849
Returned value:
118 diamond 3850
  * eax = -1 at an error (invalid PID or buffer)
3851
  * otherwise eax = number of written bytes (possibly, 0,
3852
    if esi is too large)
114 mikedld 3853
Remarks:
118 diamond 3854
  * Process must be loaded for debugging (as is shown in
3855
    general description).
114 mikedld 3856
 
6057 IgorA 3857
---------------------- Constants for registers: ----------------------
3858
  eax - SF_DEBUG (69)
3859
  ebx - SSF_WRITE_MEMORY (7)
114 mikedld 3860
======================================================================
118 diamond 3861
======= Function 69, subfunction 8 - terminate debugged thread. ======
114 mikedld 3862
======================================================================
3863
Parameters:
118 diamond 3864
  * eax = 69 - function number
3865
  * ebx = 8 - subfunction number
114 mikedld 3866
  * ecx = identifier
3867
Returned value:
3868
  * function does not return value
3869
Remarks:
118 diamond 3870
  * Process must be loaded for debugging (as is shown in
3871
    general description).
3872
  * The function is similar to subfunction 2 of function 18
3873
    with two differences: it requires first remark and
3874
    accepts PID rather than slot number.
114 mikedld 3875
 
6057 IgorA 3876
---------------------- Constants for registers: ----------------------
3877
  eax - SF_DEBUG (69)
3878
  ebx - SSF_TERMINATE (8)
114 mikedld 3879
======================================================================
118 diamond 3880
===== Function 69, subfunction 9 - set/clear hardware breakpoint. ====
114 mikedld 3881
======================================================================
3882
Parameters:
118 diamond 3883
  * eax = 69 - function number
3884
  * ebx = 9 - subfunction number
114 mikedld 3885
  * ecx = thread identifier
118 diamond 3886
  * dl = index of breakpoint, from 0 to 3 inclusively
114 mikedld 3887
  * dh = flags:
118 diamond 3888
    * if high bit is cleared - set breakpoint:
114 mikedld 3889
      * bits 0-1 - condition:
3890
        * 00 = breakpoint on execution
118 diamond 3891
        * 01 = breakpoint on read
3892
        * 11 = breakpoint on read/write
3893
      * bits 2-3 - length; for breakpoints on exception it must be
3894
        00, otherwise one of
3895
        * 00 = byte
114 mikedld 3896
        * 01 = word
118 diamond 3897
        * 11 = dword
3898
      * esi = breakpoint address; must be aligned according to
3899
        the length (i.e. must be even for word breakpoints,
3900
        divisible by 4 for dword)
3901
    * if high bit is set - clear breakpoint
114 mikedld 3902
Returned value:
118 diamond 3903
  * eax = 0 - success
114 mikedld 3904
  * eax = 1 - error in the input data
118 diamond 3905
  * eax = 2 - (reserved, is never returned in the current
3906
    implementation) a global breakpoint with that index is already set
114 mikedld 3907
Remarks:
118 diamond 3908
  * Process must be loaded for debugging (as is shown in
3909
    general description).
3910
  * Hardware breakpoints are implemented through DRx-registers of
3911
    the processor, all limitations results from this.
3912
  * The function can reinstall the breakpoint, previously set
3913
    by it (and it does not inform on this).
3914
    Carry on the list of set breakpoints in the debugger.
3915
  * Breakpoints generate debug exception #DB, on which the system
3916
    notifies debugger.
3917
  * Breakpoints on write and read/write act after
3918
    execution of the caused it instruction.
114 mikedld 3919
 
6057 IgorA 3920
---------------------- Constants for registers: ----------------------
3921
  eax - SF_DEBUG (69)
3922
  ebx - SSF_DEFINE_BREAKPOINT (9)
114 mikedld 3923
======================================================================
118 diamond 3924
==== Function 70 - work with file system with long names support. ====
114 mikedld 3925
======================================================================
3926
Parameters:
3927
  * eax = 70
118 diamond 3928
  * ebx = pointer to the information structure
114 mikedld 3929
Returned value:
118 diamond 3930
  * eax = 0 - success; otherwise file system error code
3931
  * some subfunctions return value in other registers too
3932
General format of the information structure:
3933
  * +0: dword: subfunction number
6798 pathoswith 3934
  * +4: dword: offset in file or folder
3935
  * +8: dword: higher part of offset or flags
3936
  * +12 = +0xC: dword: size of data
118 diamond 3937
  * +16 = +0x10: dword: pointer to data
6473 pathoswith 3938
  * +20 = +0x14: ?: path - zero terminated string
6502 pathoswith 3939
  or
6473 pathoswith 3940
  * +20 = +0x14: byte: 0
3941
  * +21 = +0x15: dword: pointer to string
6502 pathoswith 3942
Case sensitivity depends on filesystem.
6758 pathoswith 3943
If a path not begins with '/', it is considered a relative.
6798 pathoswith 3944
To get or set the current folder, use the sysfunction 30.
3945
'../' in the path means a lift by one folder relatively current folder.
6502 pathoswith 3946
To set the encoding, put at the start of the string a byte with next values:
3947
  * 1 = cp866
3948
  * 2 = UTF-16LE
3949
  * 3 = UTF-8
6758 pathoswith 3950
  otherwise will be used cp866. In an absolute path
3951
  you may put this byte after the '/' or put an additional '/' before it.
6798 pathoswith 3952
  Also, you may use the sysfunction 80.
6758 pathoswith 3953
Format of an absolute path:
6473 pathoswith 3954
  /base/number/dir1/dir2/.../dirn/file,
3955
where base/number identifies device, on which file is located:
3956
  * RD/1 = ramdisk
3957
  * FD/1 = first floppy drive,
3958
    FD/2 = second floppy drive
3959
  * HD0/x, HD1/x, HD2/x, HD3/x = hard drives accordingly on
118 diamond 3960
    IDE0 (Primary Master), IDE1 (Primary Slave),
114 mikedld 3961
    IDE2 (Secondary Master), IDE3 (Secondary Slave);
6473 pathoswith 3962
    x - partition number on the selected hard drive, starts from 1
3963
  * CD0/1, CD1/1, CD2/1, CD3/1 = same for cd
3964
  * SYS = system folder (encoding inaffected key),
3965
    second key may be set by sysfunction 30.3.
114 mikedld 3966
Examples:
6473 pathoswith 3967
  * '/sys/example.asm',0
3968
  * '/rd/1/example.asm',0
3969
  * '/HD0/1/folder/file.txt',0
3970
  * '/hd2/2/pics/tanzania.bmp',0
3971
  * 2,'/',0,'sys','/',0,'F',0,'I',0,'L',0,'E',0,0,0
1662 Nasarus 3972
 
118 diamond 3973
Available subfunctions:
114 mikedld 3974
  * subfunction 0 - read file
3975
  * subfunction 1 - read folder
3976
  * subfunction 2 - create/rewrite file
131 diamond 3977
  * subfunction 3 - write to existing file
133 diamond 3978
  * subfunction 4 - set file size
118 diamond 3979
  * subfunction 5 - get attributes of file/folder
3980
  * subfunction 6 - set attributes of file/folder
114 mikedld 3981
  * subfunction 7 - start application
193 diamond 3982
  * subfunction 8 - delete file/folder
321 diamond 3983
  * subfunction 9 - create folder
118 diamond 3984
For CD-drives due to hardware limitations only subfunctions
3985
0,1,5 and 7 are available, other subfunctions return error
3986
with code 2.
641 diamond 3987
At the first call of subfunctions 0,1,5,7 to ATAPI devices
3988
(CD and DVD) the manual control of tray is locked due to caching
3989
drive data. Unlocking is made when subfunction 4 of function 24
3990
is called for corresponding device.
114 mikedld 3991
 
6057 IgorA 3992
---------------------- Constants for registers: ----------------------
3993
  eax - SF_FILE (70)
3994
 [ebx] - SSF_READ_FILE (0), SSF_READ_FOLDER (1), SSF_CREATE_FILE (2),
3995
    SSF_WRITE_FILE (3), SSF_SET_END (4), SSF_GET_INFO (5),
3996
    SSF_SET_INFO (6), SSF_START_APP (7), SSF_DELETE (8),
3997
    SSF_CREATE_FOLDER (9)
114 mikedld 3998
======================================================================
118 diamond 3999
=== Function 70, subfunction 0 - read file with long names support. ==
114 mikedld 4000
======================================================================
4001
Parameters:
118 diamond 4002
  * eax = 70 - function number
4003
  * ebx = pointer to the information structure
4004
Format of the information structure:
4005
  * +0: dword: 0 = subfunction number
4006
  * +4: dword: file offset (in bytes)
4007
  * +8: dword: 0 (reserved for high dword of offset)
4008
  * +12 = +0xC: dword: number of bytes to read
4009
  * +16 = +0x10: dword: pointer to buffer for data
6473 pathoswith 4010
  * +20 = +0x14: path, general rules of names forming
114 mikedld 4011
Returned value:
118 diamond 4012
  * eax = 0 - success, otherwise file system error code
6880 pathoswith 4013
  * ebx = number of bytes read
114 mikedld 4014
Remarks:
118 diamond 4015
  * If file was ended before last requested block was read,
4016
    the function will read as many as it can, and after that return
4017
    eax=6 (EOF).
4018
  * The function does not allow to read folder (returns eax=10,
4019
    access denied).
114 mikedld 4020
 
6057 IgorA 4021
---------------------- Constants for registers: ----------------------
4022
  eax - SF_FILE (70)
4023
 [ebx] - SSF_READ_FILE (0)
118 diamond 4024
======================================================================
4025
== Function 70, subfunction 1 - read folder with long names support. =
4026
======================================================================
114 mikedld 4027
Parameters:
118 diamond 4028
  * eax = 70 - function number
4029
  * ebx = pointer to the information structure
4030
Format of the information structure:
4031
  * +0: dword: 1 = subfunction number
4032
  * +4: dword: index of starting block (beginning from 0)
6798 pathoswith 4033
  * +8: dword: names encoding:
4034
 
4035
    1 = cp866
4036
    2 = UTF-16LE
4037
    3 = UTF-8
118 diamond 4038
  * +12 = +0xC: dword: number of blocks to read
6798 pathoswith 4039
  * +16 = +0x10: dword: pointer to buffer for data
6473 pathoswith 4040
  * +20 = +0x14: path, general rules of names forming
114 mikedld 4041
Returned value:
118 diamond 4042
  * eax = 0 - success, otherwise file system error code
6880 pathoswith 4043
  * ebx = number of file information blocks, written to the buffer
114 mikedld 4044
Structure of the buffer:
6473 pathoswith 4045
  * header (32 bytes)
4046
  * block with information on file 1
4047
  * block with information on file 2
114 mikedld 4048
  * ...
4049
Structure of header:
118 diamond 4050
  * +0: dword: version of structure (current is 1)
4051
  * +4: dword: number of placed blocks; is not greater than requested
4052
    in the field +12 of information structure; can be less, if
4053
    there are no more files in folder (the same as in ebx)
4054
  * +8: dword: total number of files in folder
4055
  * +12 = +0xC: 20*byte: reserved (zeroed)
4056
Structure of block of data for folder entry (BDFE):
4057
  * +0: dword: attributes of file:
4058
    * bit 0 (mask 1): file is read-only
4059
    * bit 1 (mask 2): file is hidden
4060
    * bit 2 (mask 4): file is system
6901 pathoswith 4061
    * bit 3 (mask 8): this is the volume label (using by subfunction 5)
118 diamond 4062
    * bit 4 (mask 0x10): this is a folder
4063
    * bit 5 (mask 0x20): file was not archived - many archivation
4064
      programs have an option to archive only files with this bit set,
4065
      and after archiving this bit is cleared - it can be useful
4066
      for automatically creating of backup-archives as at writing
4067
      this bit is usually set
6798 pathoswith 4068
  * +4: dword: encoding, equals to field +8 in the information structure
118 diamond 4069
  * +8: 4*byte: time of file creation
4070
  * +12 = +0xC: 4*byte: date of file creation
4071
  * +16 = +0x10: 4*byte: time of last access (read or write)
114 mikedld 4072
  * +20 = +0x14: 4*byte: date of last access
118 diamond 4073
  * +24 = +0x18: 4*byte: time of last modification
4074
  * +28 = +0x1C: 4*byte: date of last modification
4075
  * +32 = +0x20: qword: file size in bytes (up to 16777216 Tb)
6798 pathoswith 4076
  * +40 = +0x28: name, 264 bytes in cp866, otherwise - 520 bytes.
118 diamond 4077
Time format:
114 mikedld 4078
  * +0: byte: seconds
4079
  * +1: byte: minutes
4080
  * +2: byte: hours
4081
  * +3: byte: reserved (0)
118 diamond 4082
  * for example, 23.59.59 is written as (in hex) 3B 3B 17 00
4083
Date format:
4084
  * +0: byte: day
4085
  * +1: byte: month
4086
  * +2: word: year
4087
  * for example, 25.11.1979 is written as (in hex) 19 0B BB 07
114 mikedld 4088
Remarks:
6473 pathoswith 4089
  * If BDFE contains cp866 name, the length of BDFE is 304 bytes,
6798 pathoswith 4090
    otherwise - 560 bytes.
6473 pathoswith 4091
  * Name string is zero terminated, further data contain garbage.
118 diamond 4092
  * If files in folder were ended before requested number was read,
4093
    the function will read as many as it can, and after that return
4094
    eax=6 (EOF).
114 mikedld 4095
  * Any folder on the disk, except for root, contains two special
118 diamond 4096
    entries "." and "..", identifying accordingly the folder itself
4097
    and the parent folder.
4098
  * The function allows also to read virtual folders "/", "/rd",
4099
    "/fd", "/hd[n]", thus attributes of subfolders are set to 0x10,
4100
    and times and dates are zeroed. An alternative way to get the
4101
    equipment information - subfunction 11 of function 18.
114 mikedld 4102
 
6057 IgorA 4103
---------------------- Constants for registers: ----------------------
4104
  eax - SF_FILE (70)
4105
 [ebx] - SSF_READ_FOLDER (1)
114 mikedld 4106
======================================================================
118 diamond 4107
===================== Function 70, subfunction 2 =====================
4108
============ Create/rewrite file with long names support. ============
114 mikedld 4109
======================================================================
4110
Parameters:
118 diamond 4111
  * eax = 70 - function number
4112
  * ebx = pointer to the information structure
4113
Format of the information structure:
4114
  * +0: dword: 2 = subfunction number
114 mikedld 4115
  * +4: dword: 0 (reserved)
4116
  * +8: dword: 0 (reserved)
4066 shikhin 4117
  * +12 = +0xC: dword: number of bytes to write
118 diamond 4118
  * +16 = +0x10: dword: pointer to data
6473 pathoswith 4119
  * +20 = +0x14: path, general rules of names forming
114 mikedld 4120
Returned value:
118 diamond 4121
  * eax = 0 - success, otherwise file system error code
4122
  * ebx = number of written bytes (possibly 0)
114 mikedld 4123
Remarks:
118 diamond 4124
  * If a file with given name did not exist, it is created;
4125
    if it existed, it is rewritten.
4126
  * If there is not enough free space on disk, the function will
4127
    write as many as can and then return error code 8.
4128
  * The function is not supported for CD (returns error code 2).
114 mikedld 4129
 
6057 IgorA 4130
---------------------- Constants for registers: ----------------------
4131
  eax - SF_FILE (70)
4132
 [ebx] - SSF_CREATE_FILE (2)
114 mikedld 4133
======================================================================
131 diamond 4134
===================== Function 70, subfunction 3 =====================
4135
=========== Write to existing file with long names support. ==========
4136
======================================================================
4137
Parameters:
4138
  * eax = 70 - function number
4139
  * ebx = pointer to the information structure
4140
Format of the information structure:
4141
  * +0: dword: 3 = subfunction number
4142
  * +4: dword: file offset (in bytes)
4143
  * +8: dword: high dword of offset (must be 0 for FAT)
4144
  * +12 = +0xC: dword: number of bytes to write
4145
  * +16 = +0x10: dword: pointer to data
6473 pathoswith 4146
  * +20 = +0x14: path, general rules of names forming
131 diamond 4147
Returned value:
4148
  * eax = 0 - success, otherwise file system error code
4149
  * ebx = number of written bytes (possibly 0)
4150
Remarks:
4151
  * The file must already exist, otherwise function returns eax=5.
4152
  * The only result of write 0 bytes is update in the file attributes
4153
    date/time of modification and access to the current date/time.
4154
  * If beginning and/or ending position is greater than file size
4155
    (except for the previous case), the file is expanded to needed
4156
    size with zero characters.
133 diamond 4157
  * The function is not supported for CD (returns error code 2).
131 diamond 4158
 
6057 IgorA 4159
---------------------- Constants for registers: ----------------------
4160
  eax - SF_FILE (70)
4161
 [ebx] - SSF_WRITE_FILE (3)
131 diamond 4162
======================================================================
133 diamond 4163
============ Function 70, subfunction 4 - set end of file. ===========
4164
======================================================================
4165
Parameters:
4166
  * eax = 70 - function number
4167
  * ebx = pointer to the information structure
4168
Format of the information structure:
4169
  * +0: dword: 4 = subfunction number
4170
  * +4: dword: low dword of new file size
4171
  * +8: dword: high dword of new file size (must be 0 for FAT)
4172
  * +12 = +0xC: dword: 0 (reserved)
4173
  * +16 = +0x10: dword: 0 (reserved)
6473 pathoswith 4174
  * +20 = +0x14: path, general rules of names forming
133 diamond 4175
Returned value:
4176
  * eax = 0 - success, otherwise file system error code
4177
  * ebx destroyed
4178
Remarks:
6758 pathoswith 4179
  * If new file size is less than old one, file will be truncated.
4180
    If new size is greater than old one, file will be expanded, and if
4181
    size difference is up to 16 MB, new space will be cleared with 0.
133 diamond 4182
  * If there is not enough free space on disk for expansion, the
4183
    function will expand to maximum possible size and then return
4184
    error code 8.
4185
  * The function is not supported for CD (returns error code 2).
4186
 
6057 IgorA 4187
---------------------- Constants for registers: ----------------------
4188
  eax - SF_FILE (70)
4189
 [ebx] - SSF_SET_END (4)
133 diamond 4190
======================================================================
118 diamond 4191
==== Function 70, subfunction 5 - get information on file/folder. ====
114 mikedld 4192
======================================================================
4193
Parameters:
118 diamond 4194
  * eax = 70 - function number
4195
  * ebx = pointer to the information structure
4196
Format of the information structure:
4197
  * +0: dword: 5 = subfunction number
114 mikedld 4198
  * +4: dword: 0 (reserved)
6427 pathoswith 4199
  * +8: dword: 0 or flags (for the root folder)
114 mikedld 4200
  * +12 = +0xC: dword: 0 (reserved)
118 diamond 4201
  * +16 = +0x10: dword: pointer to buffer for data (40 bytes)
6473 pathoswith 4202
  * +20 = +0x14: path, general rules of names forming
114 mikedld 4203
Returned value:
118 diamond 4204
  * eax = 0 - success, otherwise file system error code
4205
  * ebx destroyed
4206
Information on file is returned in the BDFE format (block of data
6427 pathoswith 4207
for folder entry), explained in the description of subfunction 1,
4208
but without filename, except the root folder.
114 mikedld 4209
Remarks:
6876 pathoswith 4210
  * For the root folder returns the partition size,
4211
    and if encoding byte is non-zero, the volume label.
6875 pathoswith 4212
  * For the device returns only the size.
114 mikedld 4213
 
6057 IgorA 4214
---------------------- Constants for registers: ----------------------
4215
  eax - SF_FILE (70)
4216
 [ebx] - SSF_GET_INFO (5)
114 mikedld 4217
======================================================================
118 diamond 4218
===== Function 70, subfunction 6 - set attributes of file/folder. ====
114 mikedld 4219
======================================================================
4220
Parameters:
118 diamond 4221
  * eax = 70 - function number
4222
  * ebx = pointer to the information structure
4223
Format of the information structure:
4224
  * +0: dword: 6 = subfunction number
114 mikedld 4225
  * +4: dword: 0 (reserved)
4226
  * +8: dword: 0 (reserved)
4227
  * +12 = +0xC: dword: 0 (reserved)
118 diamond 4228
  * +16 = +0x10: dword: pointer to buffer with attributes (32 bytes)
6473 pathoswith 4229
  * +20 = +0x14: path, general rules of names forming
114 mikedld 4230
Returned value:
118 diamond 4231
  * eax = 0 - success, otherwise file system error code
4232
  * ebx destroyed
4233
File attributes are first 32 bytes in BDFE (block of data
4234
for folder entry), explained in the description of subfunction 1
4235
(that is, without name and size of file). Attribute
4236
file/folder/volume label (bits 3,4 in dword +0) is not changed.
4237
Byte +4 (name format) is ignored.
114 mikedld 4238
Remarks:
118 diamond 4239
  * The function does not support virtual folders such as /, /rd and
4240
    root folders like /rd/1.
4241
  * The function is not supported for CD (returns error code 2).
114 mikedld 4242
 
6057 IgorA 4243
---------------------- Constants for registers: ----------------------
4244
  eax - SF_FILE (70)
4245
 [ebx] - SSF_SET_INFO (6)
114 mikedld 4246
======================================================================
118 diamond 4247
=========== Function 70, subfunction 7 - start application. ==========
114 mikedld 4248
======================================================================
4249
Parameters:
118 diamond 4250
  * eax = 70 - function number
4251
  * ebx = pointer to the information structure
4252
Format of the information structure:
4253
  * +0: dword: 7 = subfunction number
4254
  * +4: dword: flags field:
3539 clevermous 4255
    * bit 0: start process as debugged
118 diamond 4256
    * other bits are reserved and must be set to 0
4257
  * +8: dword: 0 or pointer to ASCIIZ-string with parameters
114 mikedld 4258
  * +12 = +0xC: dword: 0 (reserved)
4259
  * +16 = +0x10: dword: 0 (reserved)
6473 pathoswith 4260
  * +20 = +0x14: path, general rules of names forming
114 mikedld 4261
Returned value:
4262
  * eax > 0 - program is loaded, eax contains PID
7722 dunkaist 4263
  * eax < 0 - an error has occurred, -eax contains
118 diamond 4264
    file system error code
4265
  * ebx destroyed
114 mikedld 4266
Remarks:
118 diamond 4267
  * Command line must be terminated by the character with the code 0
4268
    (ASCIIZ-string); function takes into account either all characters
4269
    up to terminating zero inclusively or first 256 character
4270
    regarding what is less.
4271
  * If the process is started as debugged, it is created in
4272
    the suspended state; to run use subfunction 5 of function 69.
114 mikedld 4273
 
6057 IgorA 4274
---------------------- Constants for registers: ----------------------
4275
  eax - SF_FILE (70)
4276
 [ebx] - SSF_START_APP (7)
114 mikedld 4277
======================================================================
193 diamond 4278
========== Function 70, subfunction 8 - delete file/folder. ==========
4279
======================================================================
4280
Parameters:
4281
  * eax = 70 - function number
4282
  * ebx = pointer to the information structure
4283
Format of the information structure:
4284
  * +0: dword: 8 = subfunction number
4285
  * +4: dword: 0 (reserved)
4286
  * +8: dword: 0 (reserved)
4287
  * +12 = +0xC: dword: 0 (reserved)
4288
  * +16 = +0x10: dword: 0 (reserved)
6473 pathoswith 4289
  * +20 = +0x14: path, general rules of names forming
193 diamond 4290
Returned value:
4291
  * eax = 0 - success, otherwise file system error code
4292
  * ebx destroyed
4293
Remarks:
4294
  * The function is not supported for CD (returns error code 2).
4295
  * The function can delete only empty folders (attempt to delete
4296
    nonempty folder results in error with code 10, "access denied").
4297
 
6057 IgorA 4298
---------------------- Constants for registers: ----------------------
4299
  eax - SF_FILE (70)
4300
 [ebx] - SSF_DELETE (8)
193 diamond 4301
======================================================================
321 diamond 4302
============= Function 70, subfunction 9 - create folder. ============
4303
======================================================================
4304
Parameters:
4305
  * eax = 70 - function number
4306
  * ebx = pointer to the information structure
4307
Format of the information structure:
4308
  * +0: dword: 9 = subfunction number
4309
  * +4: dword: 0 (reserved)
4310
  * +8: dword: 0 (reserved)
4311
  * +12 = +0xC: dword: 0 (reserved)
4312
  * +16 = +0x10: dword: 0 (reserved)
6473 pathoswith 4313
  * +20 = +0x14: path, general rules of names forming
321 diamond 4314
Returned value:
4315
  * eax = 0 - success, otherwise file system error code
4316
  * ebx destroyed
4317
Remarks:
4318
  * The function is not supported for CD (returns error code 2).
4319
  * The parent folder must already exist.
4320
  * If target folder already exists, function returns success (eax=0).
4321
 
6057 IgorA 4322
---------------------- Constants for registers: ----------------------
4323
  eax - SF_FILE (70)
4324
 [ebx] - SSF_CREATE_FOLDER (9)
321 diamond 4325
======================================================================
6917 pathoswith 4326
============= Function 70, subfunction 10 - rename/move. =============
4327
======================================================================
4328
Parameters:
4329
  * eax = 70 - function number
4330
  * ebx = pointer to the information structure
4331
Format of the information structure:
4332
  * +0: dword: 10 = subfunction number
4333
  * +4: dword: 0 (reserved)
4334
  * +8: dword: 0 (reserved)
4335
  * +12 = +0xC: dword: 0 (reserved)
4336
  * +16 = +0x10: dword: pointer to the new name/path string
4337
  * +20 = +0x14: path, general rules of names forming
4338
Returned value:
4339
  * eax = 0 - success, otherwise file system error code
4340
  * ebx destroyed
4341
Remarks:
4342
  * New path forming differs from general rules:
4343
    relative path relates to the target's parent folder,
4344
    absolute path relates to the partition's root folder.
4345
======================================================================
6802 pathoswith 4346
================== Function 71 - set window caption ==================
114 mikedld 4347
======================================================================
4348
Parameters:
4349
  * eax = 71 - function number
6802 pathoswith 4350
  * ebx = 1
4351
  * ecx = pointer to zero terminated string,
4352
    the string may start with an encoding byte:
4353
    1 = cp866
4354
    2 = UTF-16LE
4355
    3 = UTF-8
4356
  or:
4357
  * ebx = 2
5926 pathoswith 4358
  * ecx = pointer to zero terminated string
6802 pathoswith 4359
  * dl  = string encoding
114 mikedld 4360
Returned value:
118 diamond 4361
  * function does not return value
114 mikedld 4362
Remarks:
118 diamond 4363
  * Pass NULL in ecx to remove caption.
114 mikedld 4364
 
6057 IgorA 4365
---------------------- Constants for registers: ----------------------
4366
  eax - SF_SET_CAPTION (71)
114 mikedld 4367
======================================================================
665 diamond 4368
=============== Function 72 - send message to a window. ==============
4369
======================================================================
4370
 
4371
- Subfunction 1 - send message with parameter to the active window. --
4372
Parameters:
4373
  * eax = 72 - function number
4374
  * ebx = 1 - subfunction number
4375
  * ecx = event code: 2 or 3
4376
  * edx = parameter: key code for ecx=2, button identifier for ecx=3
4377
Returned value:
4378
  * eax = 0 - success
4379
  * eax = 1 - buffer is full
4380
 
6057 IgorA 4381
---------------------- Constants for registers: ----------------------
4382
  eax - SF_SEND_MESSAGE (72)
665 diamond 4383
======================================================================
3315 mario79 4384
===================== Function 73 - blit bitmap  =====================
4385
======================================================================
4386
 
4387
Parameters:
4388
  * eax = 73 - function number
4389
 
4390
  * ebx = ROP and optional flags
6790 0CodErr 4391
     31      30 29 28       6 5  4 3   0
4392
     [reserved][CR][reserved][T][B][ROP]
3315 mario79 4393
     ROP - raster operation code
4394
        0: Copy
4395
     1-15: reserved
4396
     B   - blit into the background surface
4397
     T   - transparent blit
6790 0CodErr 4398
     CR  - blit client relative
3315 mario79 4399
 
4400
  * ecx = pointer to the function parameters
4401
        destination offset and clipping
4402
     +0 signed dword: destination rectangle X offset from the window
4403
                      top-left corner
4404
     +4 signed dword: destination rectangle Y offset from the window
4405
                      top-left corner
4406
     +8 dword:        destination rectangle width
4407
    +12 dword:        destination rectangle height
4408
 
4409
        source offset and clipping
4410
    +16 signed dword: source rectangle X offset from the bitmap
4411
                      top-left corner
4412
    +20 signed dword: source rectangle Y offset from the bitmap
4413
                      top-left corner
4414
    +24 dword:        source rectangle width
4415
    +28 dword:        source rectangle height
4416
 
3338 mario79 4417
    +32: dword: bitmap data - must be 32bpp
4418
    +36: dword: size of the bitmap row in bytes
3315 mario79 4419
 
4420
Returned value:
4421
  * function does not return value
4422
 
6057 IgorA 4423
---------------------- Constants for registers: ----------------------
4424
  eax - SF_BLITTER (73)
3315 mario79 4425
======================================================================
5871 hidnplayr 4426
= Function 74, Subfunction 255, Get number of active network devices. =
3571 hidnplayr 4427
======================================================================
4428
Parameters:
4429
  * eax = 74 - function number
5871 hidnplayr 4430
  * bl = 255 - subfunction number
3571 hidnplayr 4431
Returned value:
4432
  * eax = number of active network devices
4433
 
6057 IgorA 4434
---------------------- Constants for registers: ----------------------
4435
  eax - SF_NETWORK_GET (74)
4436
   bl - SSF_DEVICE_COUNT (255)
3571 hidnplayr 4437
======================================================================
4438
======== Function 74, Subfunction 0, Get network device type. ========
4439
======================================================================
4440
Parameters:
4441
  * eax = 74 - function number
4442
  * bl = 0 - subfunction number
4443
  * bh = device number
4444
Returned value:
7915 dunkaist 4445
  * eax = device type number, -1 on error
3571 hidnplayr 4446
 
6057 IgorA 4447
---------------------- Constants for registers: ----------------------
4448
  eax - SF_NETWORK_GET (74)
4449
   bl - SSF_DEVICE_TYPE (0)
3571 hidnplayr 4450
======================================================================
4451
======== Function 74, Subfunction 1, Get network device name. ========
4452
======================================================================
4453
Parameters:
4454
  * eax = 74 - function number
4455
  * bl = 1 - subfunction number
4456
  * bh = device number
4457
  * ecx = pointer to 64 byte buffer
4458
Returned value:
4459
  * eax = -1 on error
4460
  * The network device name is written into the buffer, on success
4461
 
6057 IgorA 4462
---------------------- Constants for registers: ----------------------
4463
  eax - SF_NETWORK_GET (74)
4464
   bl - SSF_DEVICE_NAME (1)
3571 hidnplayr 4465
======================================================================
4466
========= Function 74, Subfunction 2, Reset network device. ==========
4467
======================================================================
4468
Parameters:
4469
  * eax = 74 - function number
4470
  * bl = 2 - subfunction number
4471
  * bh = device number
4472
Returned value:
4473
  * eax = -1 on error
4474
 
6057 IgorA 4475
---------------------- Constants for registers: ----------------------
4476
  eax - SF_NETWORK_GET (74)
4477
   bl - SSF_RESET_DEVICE (2)
3571 hidnplayr 4478
======================================================================
4479
========== Function 74, Subfunction 3, Stop network device. ==========
4480
======================================================================
4481
Parameters:
4482
  * eax = 74 - function number
4483
  * bl = 3 - subfunction number
4484
  * bh = device number
4485
Returned value:
4486
  * eax = -1 on error
5983 pathoswith 4487
 
6057 IgorA 4488
---------------------- Constants for registers: ----------------------
4489
  eax - SF_NETWORK_GET (74)
4490
   bl - SSF_STOP_DEVICE (3)
5871 hidnplayr 4491
======================================================================
4492
=========== Function 74, Subfunction 4, Get device pointer. ==========
4493
======================================================================
4494
Parameters:
4495
  * eax = 74 - function number
4496
  * bl = 4 - subfunction number
4497
  * bh = device number
4498
Returned value:
5983 pathoswith 4499
  * eax = device pointer, -1 on error
4500
 
6057 IgorA 4501
---------------------- Constants for registers: ----------------------
4502
  eax - SF_NETWORK_GET (74)
7722 dunkaist 4503
   bl - SSF_DEVICE_POINTER (4)
5871 hidnplayr 4504
======================================================================
4505
========= Function 74, Subfunction 6, Get packet TX counter. =========
4506
======================================================================
4507
Parameters:
4508
  * eax = 74 - function number
4509
  * bl = 6 - subfunction number
4510
  * bh = device number
4511
Returned value:
4512
  * eax = Number of packets sent since device start, -1 on error
5983 pathoswith 4513
 
6057 IgorA 4514
---------------------- Constants for registers: ----------------------
4515
  eax - SF_NETWORK_GET (74)
4516
   bl - SSF_TX_PACKET_COUNT (6)
5871 hidnplayr 4517
======================================================================
4518
========= Function 74, Subfunction 7, Get packet RX counter. =========
4519
======================================================================
4520
Parameters:
4521
  * eax = 74 - function number
4522
  * bl = 7 - subfunction number
4523
  * bh = device number
4524
Returned value:
4525
  * eax = Number of packets received since device start, -1 on error
5983 pathoswith 4526
 
6057 IgorA 4527
---------------------- Constants for registers: ----------------------
4528
  eax - SF_NETWORK_GET (74)
4529
   bl - SSF_RX_PACKET_COUNT (7)
5871 hidnplayr 4530
======================================================================
4531
========== Function 74, Subfunction 8, Get TX byte counter. ==========
4532
======================================================================
4533
Parameters:
4534
  * eax = 74 - function number
4535
  * bl = 8 - subfunction number
4536
  * bh = device number
4537
Returned value:
4538
  * eax = Number of bytes sent since device start (lower dword)
7915 dunkaist 4539
          -1 on error
5871 hidnplayr 4540
  * ebx = Number of bytes sent since device start (higher dword)
3571 hidnplayr 4541
 
6057 IgorA 4542
---------------------- Constants for registers: ----------------------
4543
  eax - SF_NETWORK_GET (74)
4544
   bl - SSF_TX_BYTE_COUNT (8)
3571 hidnplayr 4545
======================================================================
5871 hidnplayr 4546
========== Function 74, Subfunction 9, Get RX byte counter. ==========
4547
======================================================================
4548
Parameters:
4549
  * eax = 74 - function number
4550
  * bl = 9 - subfunction number
4551
  * bh = device number
4552
Returned value:
4553
  * eax = Number of bytes received since device start (lower dword)
7915 dunkaist 4554
          -1 on error
5871 hidnplayr 4555
  * ebx = Number of bytes received since device start (higher dword)
5983 pathoswith 4556
 
6057 IgorA 4557
---------------------- Constants for registers: ----------------------
4558
  eax - SF_NETWORK_GET (74)
4559
   bl - SSF_RX_BYTE_COUNT (9)
5871 hidnplayr 4560
======================================================================
4561
========== Function 74, Subfunction 10, Get link status. =============
4562
======================================================================
4563
Parameters:
4564
  * eax = 74 - function number
4565
  * bl = 10 - subfunction number
4566
  * bh = device number
4567
Returned value:
4568
  * eax = link status, -1 on error
5983 pathoswith 4569
 
5871 hidnplayr 4570
  Link status:
4571
    ETH_LINK_DOWN   =    0b         ; Link is down
4572
    ETH_LINK_UNKNOWN=    1b         ; There could be an active link
4573
    ETH_LINK_FD     =   10b         ; full duplex flag
4574
    ETH_LINK_10M    =  100b         ; 10 mbit
4575
    ETH_LINK_100M   = 1000b         ; 100 mbit
5983 pathoswith 4576
    ETH_LINK_1G     = 1100b         ; gigabit
4577
 
6057 IgorA 4578
---------------------- Constants for registers: ----------------------
4579
  eax - SF_NETWORK_GET (74)
4580
   bl - SSF_LINK_STATUS (10)
5871 hidnplayr 4581
======================================================================
3571 hidnplayr 4582
============== Function 75, Subfunction 0, Open socket. ==============
4583
======================================================================
4584
Parameters:
4585
  * eax = 75 - function number
4586
  * bl = 0 - subfunction number
4587
  * ecx = domain
4588
  * edx = type
4589
  * esi = protocol
4590
Returned value:
4591
  * eax = socket number, -1 on error
3867 hidnplayr 4592
  * ebx = errorcode
3571 hidnplayr 4593
 
6057 IgorA 4594
---------------------- Constants for registers: ----------------------
4595
  eax - SF_NETWORK_SOCKET (75)
4596
   bl - SSF_OPEN (0)
3571 hidnplayr 4597
======================================================================
4598
============= Function 75, Subfunction 1, Close socket. ==============
4599
======================================================================
4600
Parameters:
4601
  * eax = 75 - function number
4602
  * bl = 1 - subfunction number
4603
  * ecx = socket number
4604
Returned value:
4605
  * eax = -1 on error
3867 hidnplayr 4606
  * ebx = errorcode
3571 hidnplayr 4607
 
6057 IgorA 4608
---------------------- Constants for registers: ----------------------
4609
  eax - SF_NETWORK_SOCKET (75)
4610
   bl - SSF_CLOSE (1)
3571 hidnplayr 4611
======================================================================
4612
================== Function 75, Subfunction 2, Bind. =================
4613
======================================================================
4614
Parameters:
4615
  * eax = 75 - function number
4616
  * bl = 2 - subfunction number
4617
  * ecx = socket number
4618
  * edx = pointer to sockaddr structure
4619
  * esi = length of sockaddr structure
6712 0CodErr 4620
Format of SockAddr structure:
4621
  * +0: Word: Family
4622
  * +2: 14*Byte: Data
3571 hidnplayr 4623
Returned value:
4624
  * eax = -1 on error
3867 hidnplayr 4625
  * ebx = errorcode
3571 hidnplayr 4626
 
6057 IgorA 4627
---------------------- Constants for registers: ----------------------
4628
  eax - SF_NETWORK_SOCKET (75)
4629
   bl - SSF_BIND (2)
3571 hidnplayr 4630
======================================================================
4631
================= Function 75, Subfunction 3, Listen. ================
4632
======================================================================
4633
Parameters:
4634
  * eax = 75 - function number
4635
  * bl = 3 - subfunction number
4636
  * ecx = socket number
4637
  * edx = backlog
4638
Returned value:
4639
  * eax = -1 on error
3867 hidnplayr 4640
  * ebx = errorcode
3571 hidnplayr 4641
 
6057 IgorA 4642
---------------------- Constants for registers: ----------------------
4643
  eax - SF_NETWORK_SOCKET (75)
4644
   bl - SSF_LISTEN (3)
3571 hidnplayr 4645
======================================================================
4646
================ Function 75, Subfunction 4, Connect. ================
4647
======================================================================
4648
Parameters:
4649
  * eax = 75 - function number
4650
  * bl = 4 - subfunction number
4651
  * ecx = socket number
4652
  * edx = pointer to sockaddr structure
4653
  * esi = length of sockaddr structure
6712 0CodErr 4654
Format of SockAddr structure:
4655
  * +0: Word: Family
6758 pathoswith 4656
  * +2: 14*Byte: Data
3571 hidnplayr 4657
Returned value:
4658
  * eax = -1 on error
3867 hidnplayr 4659
  * ebx = errorcode
3571 hidnplayr 4660
 
6057 IgorA 4661
---------------------- Constants for registers: ----------------------
4662
  eax - SF_NETWORK_SOCKET (75)
4663
   bl - SSF_CONNECT (4)
3571 hidnplayr 4664
======================================================================
4665
================= Function 75, Subfunction 5, Accept. ================
4666
======================================================================
4667
Parameters:
4668
  * eax = 75 - function number
4669
  * bl = 5 - subfunction number
4670
  * ecx = socket number
4671
  * edx = pointer to sockaddr structure
4672
  * esi = length of sockaddr structure
6712 0CodErr 4673
Format of SockAddr structure:
4674
  * +0: Word: Family
6758 pathoswith 4675
  * +2: 14*Byte: Data
3571 hidnplayr 4676
Returned value:
3867 hidnplayr 4677
  * eax = socket number of accepted socket, -1 on error
4678
  * ebx = errorcode
3571 hidnplayr 4679
 
6057 IgorA 4680
---------------------- Constants for registers: ----------------------
4681
  eax - SF_NETWORK_SOCKET (75)
4682
   bl - SSF_ACCEPT (5)
3571 hidnplayr 4683
======================================================================
4684
================== Function 75, Subfunction 6, Send. =================
4685
======================================================================
4686
Parameters:
4687
  * eax = 75 - function number
4688
  * bl = 6 - subfunction number
4689
  * ecx = socket number
4690
  * edx = pointer to buffer
4691
  * esi = length of buffer
3867 hidnplayr 4692
  * edi = flags
3571 hidnplayr 4693
Returned value:
4694
  * eax = number of bytes copied, -1 on error
3867 hidnplayr 4695
  * ebx = errorcode
3571 hidnplayr 4696
 
6057 IgorA 4697
---------------------- Constants for registers: ----------------------
4698
  eax - SF_NETWORK_SOCKET (75)
4699
   bl - SSF_SEND (6)
3571 hidnplayr 4700
======================================================================
4701
================ Function 75, Subfunction 7, Receive. ================
4702
======================================================================
4703
Parameters:
4704
  * eax = 75 - function number
4705
  * bl = 7 - subfunction number
4706
  * ecx = socket number
4707
  * edx = pointer to buffer
4708
  * esi = length of buffer
4709
  * edi = flags
4710
Returned value:
4711
  * eax = number of bytes copied, -1 on error
3867 hidnplayr 4712
  * ebx = errorcode
3571 hidnplayr 4713
 
6057 IgorA 4714
---------------------- Constants for registers: ----------------------
4715
  eax - SF_NETWORK_SOCKET (75)
4716
   bl - SSF_RECEIVE (7)
3571 hidnplayr 4717
======================================================================
4718
=========== Function 75, Subfunction 8, Set socket options. ==========
4719
======================================================================
4720
Parameters:
4721
  * eax = 75 - function number
4722
  * bl = 8 - subfunction number
4723
  * ecx = socket number
4724
  * edx = pointer to optstruct
4725
Returned value:
4726
  * eax = -1 on error
3867 hidnplayr 4727
  * ebx = errorcode
3571 hidnplayr 4728
Remarks:
4729
 
6079 serge 4730
  Optstruct:
5871 hidnplayr 4731
    dd level
4732
    dd optionname
4733
    dd optlength
4734
    db options...
3571 hidnplayr 4735
 
6057 IgorA 4736
---------------------- Constants for registers: ----------------------
4737
  eax - SF_NETWORK_SOCKET (75)
4738
   bl - SSF_SET_OPTIONS (8)
3571 hidnplayr 4739
======================================================================
4740
=========== Function 75, Subfunction 9, Get socket options. ==========
4741
======================================================================
4742
Parameters:
4743
  * eax = 75 - function number
4744
  * bl = 9 - subfunction number
4745
  * ecx = socket number
4746
  * edx = pointer to optstruct
4747
Returned value:
4748
  * eax = -1 on error
3867 hidnplayr 4749
  * ebx = errorcode
3571 hidnplayr 4750
Remarks:
4751
 
6079 serge 4752
  Optstruct:
5871 hidnplayr 4753
    dd level
4754
    dd optionname
4755
    dd optlength
4756
    db options...
3571 hidnplayr 4757
 
6057 IgorA 4758
---------------------- Constants for registers: ----------------------
4759
  eax - SF_NETWORK_SOCKET (75)
4760
   bl - SSF_GET_OPTIONS (9)
3571 hidnplayr 4761
======================================================================
6235 pathoswith 4762
============ Function 75, Subfunction 10, Get socketpair. ============
3571 hidnplayr 4763
======================================================================
4764
Parameters:
4765
  * eax = 75 - function number
4766
  * bl = 10 - subfunction number
4767
Returned value:
4768
  * eax = socketnum1, -1 on error
3867 hidnplayr 4769
  * ebx = socketnum2, errorcode on error
6057 IgorA 4770
 
4771
---------------------- Constants for registers: ----------------------
4772
  eax - SF_NETWORK_SOCKET (75)
4773
   bl - SSF_GET_PAIR (10)
5871 hidnplayr 4774
======================================================================
4775
============ Function 76, Network options and statistics. ============
4776
======================================================================
4777
Parameters:
4778
  * eax = 76 - function number
4779
  * high half of ebx = protocol number
4780
  * bh = device number
4781
  * bl = subfunction number
3571 hidnplayr 4782
 
6634 hidnplayr 4783
======================================================================
4784
==== Function 76, Protocol 0 - Ethernet, Subfunction 0, Read MAC. ====
4785
======================================================================
4786
Parameters:
4787
  * eax = 76 - function number
4788
  * high half of ebx = 0 (Ethernet)
4789
  * bh = device number
4790
  * bl = 0 (Read MAC)
4791
Returned value:
4792
  * eax = -1 on error, otherwise lower bits of MAC
4793
  * bx = upper bits of MAC
6758 pathoswith 4794
 
6634 hidnplayr 4795
======================================================================
4796
= Function 76, Protocol 1 - IPv4, Subfunction 0, Read # Packets sent =
4797
======================================================================
4798
Parameters:
4799
  * eax = 76 - function number
4800
  * high half of ebx = 1 (IPv4)
4801
  * bh = device number
4802
  * bl = 0 (Read # packets sent)
4803
Returned value:
4804
  * eax = number of packets sent (-1 on error)
6758 pathoswith 4805
 
6634 hidnplayr 4806
======================================================================
4807
= Function 76, Protocol 1 - IPv4, Subfunction 1, Read # Packets rcvd =
4808
======================================================================
4809
Parameters:
4810
  * eax = 76 - function number
4811
  * high half of ebx = 1 (IPv4)
4812
  * bh = device number
4813
  * bl = 1 (Read # packets received)
4814
Returned value:
4815
  * eax = number of packets received (-1 on error)
6758 pathoswith 4816
 
6634 hidnplayr 4817
======================================================================
4818
=== Function 76, Protocol 1 - IPv4, Subfunction 2, Read IP address ===
4819
======================================================================
4820
Parameters:
4821
  * eax = 76 - function number
4822
  * high half of ebx = 1 (IPv4)
4823
  * bh = device number
4824
  * bl = 2 (Read IP address)
4825
Returned value:
4826
  * eax = IP address (-1 on error)
6758 pathoswith 4827
 
6634 hidnplayr 4828
======================================================================
4829
=== Function 76, Protocol 1 - IPv4, Subfunction 3, Set IP address ====
4830
======================================================================
4831
Parameters:
4832
  * eax = 76 - function number
4833
  * high half of ebx = 1 (IPv4)
4834
  * bh = device number
4835
  * bl = 3 (Set IP address)
4836
  * ecx = IP address
4837
Returned value:
4838
  * eax = -1 on error
6235 pathoswith 4839
 
6634 hidnplayr 4840
======================================================================
4841
== Function 76, Protocol 1 - IPv4, Subfunction 4, Read DNS address ===
4842
======================================================================
4843
Parameters:
4844
  * eax = 76 - function number
4845
  * high half of ebx = 1 (IPv4)
4846
  * bh = device number
4847
  * bl = 4 (Read DNS server IP address)
4848
Returned value:
4849
  * eax = DNS server IP address (-1 on error)
6758 pathoswith 4850
 
6634 hidnplayr 4851
======================================================================
4852
=== Function 76, Protocol 1 - IPv4, Subfunction 5, Set DNS address ===
4853
======================================================================
4854
Parameters:
4855
  * eax = 76 - function number
4856
  * high half of ebx = 1 (IPv4)
4857
  * bh = device number
4858
  * bl = 5 (Set DNS address)
4859
  * ecx = DNS server IP address
4860
Returned value:
4861
  * eax = -1 on error
6079 serge 4862
 
6634 hidnplayr 4863
======================================================================
4864
== Function 76, Protocol 1 - IPv4, Subfunction 6, Read subnet mask ===
4865
======================================================================
4866
Parameters:
4867
  * eax = 76 - function number
4868
  * high half of ebx = 1 (IPv4)
4869
  * bh = device number
4870
  * bl = 6 (Read subnet mask)
4871
Returned value:
4872
  * eax = subnet mask (-1 on error)
6758 pathoswith 4873
 
6634 hidnplayr 4874
======================================================================
4875
=== Function 76, Protocol 1 - IPv4, Subfunction 7, Set subnet mask ===
4876
======================================================================
4877
Parameters:
4878
  * eax = 76 - function number
4879
  * high half of ebx = 1 (IPv4)
4880
  * bh = device number
7915 dunkaist 4881
  * bl = 7 (Set subnet mask)
6634 hidnplayr 4882
  * ecx = subnet mask
4883
Returned value:
4884
  * eax = -1 on error
6758 pathoswith 4885
 
6634 hidnplayr 4886
======================================================================
4887
===== Function 76, Protocol 1 - IPv4, Subfunction 8, Read gateway ====
4888
======================================================================
4889
Parameters:
4890
  * eax = 76 - function number
4891
  * high half of ebx = 1 (IPv4)
4892
  * bh = device number
4893
  * bl = 8 (Read gateway IP address)
4894
Returned value:
4895
  * eax = gateway IP address (-1 on error)
6758 pathoswith 4896
 
6634 hidnplayr 4897
======================================================================
4898
===== Function 76, Protocol 1 - IPv4, Subfunction 9, Set gateway =====
4899
======================================================================
4900
Parameters:
4901
  * eax = 76 - function number
4902
  * high half of ebx = 1 (IPv4)
4903
  * bh = device number
4904
  * bl = 9 (Set getway address)
4905
  * ecx = gateway IP address
4906
Returned value:
4907
  * eax = -1 on error
6758 pathoswith 4908
 
6634 hidnplayr 4909
======================================================================
4910
= Function 76, Protocol 2 - ICMP, Subfunction 0, Read # Packets sent =
4911
======================================================================
4912
Parameters:
4913
  * eax = 76 - function number
4914
  * high half of ebx = 2 (ICMP)
4915
  * bh = device number
4916
  * bl = 0 (Read # packets sent)
4917
Returned value:
4918
  * eax = number of packets sent (-1 on error)
6758 pathoswith 4919
 
6634 hidnplayr 4920
======================================================================
4921
= Function 76, Protocol 2 - ICMP, Subfunction 1, Read # Packets rcvd =
4922
======================================================================
4923
Parameters:
4924
  * eax = 76 - function number
4925
  * high half of ebx = 2 (ICMP)
4926
  * bh = device number
4927
  * bl = 1 (Read # packets received)
4928
Returned value:
4929
  * eax = number of packets received (-1 on error)
6758 pathoswith 4930
 
6634 hidnplayr 4931
======================================================================
4932
= Function 76, Protocol 3 - UDP, Subfunction 0, Read # Packets sent ==
4933
======================================================================
4934
Parameters:
4935
  * eax = 76 - function number
4936
  * high half of ebx = 3 (UDP)
4937
  * bh = device number
4938
  * bl = 0 (Read # packets sent)
4939
Returned value:
4940
  * eax = number of packets sent (-1 on error)
6758 pathoswith 4941
 
6634 hidnplayr 4942
======================================================================
4943
= Function 76, Protocol 3 - UDP, Subfunction 1, Read # Packets rcvd ==
4944
======================================================================
4945
Parameters:
4946
  * eax = 76 - function number
4947
  * high half of ebx = 3 (UDP)
4948
  * bh = device number
4949
  * bl = 1 (Read # packets received)
4950
Returned value:
4951
  * eax = number of packets received (-1 on error)
6758 pathoswith 4952
 
6634 hidnplayr 4953
======================================================================
4954
= Function 76, Protocol 4 - TCP, Subfunction 0, Read # Packets sent ==
4955
======================================================================
4956
Parameters:
4957
  * eax = 76 - function number
4958
  * high half of ebx = 4 (TCP)
4959
  * bh = device number
4960
  * bl = 0 (Read # packets sent)
4961
Returned value:
4962
  * eax = number of packets sent (-1 on error)
6758 pathoswith 4963
 
6634 hidnplayr 4964
======================================================================
4965
= Function 76, Protocol 4 - TCP, Subfunction 1, Read # Packets rcvd ==
4966
======================================================================
4967
Parameters:
4968
  * eax = 76 - function number
4969
  * high half of ebx = 4 (TCP)
4970
  * bh = device number
4971
  * bl = 1 (Read # packets received)
4972
Returned value:
4973
  * eax = number of packets received (-1 on error)
6758 pathoswith 4974
 
6634 hidnplayr 4975
======================================================================
4976
= Function 76, Protocol 5 - ARP, Subfunction 0, Read # Packets sent ==
4977
======================================================================
4978
Parameters:
4979
  * eax = 76 - function number
4980
  * high half of ebx = 5 (ARP)
4981
  * bh = device number
4982
  * bl = 0 (Read # packets sent)
4983
Returned value:
4984
  * eax = number of packets sent (-1 on error)
6758 pathoswith 4985
 
6634 hidnplayr 4986
======================================================================
4987
= Function 76, Protocol 5 - ARP, Subfunction 1, Read # Packets rcvd ==
4988
======================================================================
4989
Parameters:
4990
  * eax = 76 - function number
4991
  * high half of ebx = 5 (ARP)
4992
  * bh = device number
4993
  * bl = 1 (Read # packets received)
4994
Returned value:
4995
  * eax = number of packets received (-1 on error)
6758 pathoswith 4996
 
6634 hidnplayr 4997
======================================================================
4998
== Function 76, Protocol 5 - ARP, Subfunction 2, Read # ARP entries ==
4999
======================================================================
5000
Parameters:
5001
  * eax = 76 - function number
5002
  * high half of ebx = 5 (ARP)
5003
  * bh = device number
5004
  * bl = 2 (Read # current entries in the ARP table)
5005
Returned value:
5006
  * eax = number of entries (-1 on error)
6079 serge 5007
 
6634 hidnplayr 5008
======================================================================
5009
==== Function 76, Protocol 5 - ARP, Subfunction 3, Read ARP entry ====
5010
======================================================================
5011
Parameters:
5012
  * eax = 76 - function number
5013
  * high half of ebx = 5 (ARP)
5014
  * bh = device number
5015
  * bl = 3 (Read ARP entry)
5016
  * ecx = ARP entry number (0 based)
5017
  * edi = ptr to buffer where ARP entry will be written
5018
Returned value:
5019
  * eax = -1 on error
6758 pathoswith 5020
Remarks:
7915 dunkaist 5021
  * ARP_entry struct is defined in ARP.inc in kernel and currently
5022
    looks like this:
6634 hidnplayr 5023
struct  ARP_entry
5024
        IP              dd ?
5025
        MAC             dp ?
5026
        Status          dw ?
5027
        TTL             dw ?
6758 pathoswith 5028
ends
5871 hidnplayr 5029
 
6634 hidnplayr 5030
======================================================================
7915 dunkaist 5031
===== Function 76, Protocol 5 - ARP, Subfunction 4, Add ARP entry ====
6634 hidnplayr 5032
======================================================================
5033
Parameters:
5034
  * eax = 76 - function number
5035
  * high half of ebx = 5 (ARP)
5036
  * bh = device number
5037
  * bl = 4 (Add ARP entry)
5038
  * esi = ptr to buffer holding ARP entry
5039
Returned value:
5040
  * eax = -1 on error
6758 pathoswith 5041
Remarks:
7915 dunkaist 5042
  * See previous function for details on ARP entry.
6758 pathoswith 5043
 
6634 hidnplayr 5044
======================================================================
7915 dunkaist 5045
=== Function 76, Protocol 5 - ARP, Subfunction 5, Remove ARP entry ===
6634 hidnplayr 5046
======================================================================
5047
Parameters:
5048
  * eax = 76 - function number
5049
  * high half of ebx = 5 (ARP)
5050
  * bh = device number
7915 dunkaist 5051
  * bl = 5 (Remove ARP entry)
6634 hidnplayr 5052
  * ecx = ARP entry number (0 based), use -1 to clear whole ARP table.
5053
Returned value:
5054
  * eax = -1 on error
5055
 
5056
======================================================================
5057
=== Function 76, Protocol 5 - ARP, Subfunction 6, Send ARP announce ==
5058
======================================================================
5059
Parameters:
5060
  * eax = 76 - function number
5061
  * high half of ebx = 5 (ARP)
5062
  * bh = device number
5063
  * bl = 6 (Send ARP announce)
5064
Returned value:
5065
  * eax = -1 on error
6758 pathoswith 5066
 
6634 hidnplayr 5067
======================================================================
5068
=== Function 76, Protocol 5 - ARP, Subfunction 7, Read # conflicts ===
5069
======================================================================
5070
Parameters:
5071
  * eax = 76 - function number
5072
  * high half of ebx = 5 (ARP)
5073
  * bh = device number
5074
  * bl = 7 (Read # IP address conflicts that have occured)
5075
Returned value:
5076
  * eax = # IP address conflicts (-1 on error)
5871 hidnplayr 5077
 
6057 IgorA 5078
---------------------- Constants for registers: ----------------------
5079
  eax - SF_NETWORK_PROTOCOL (76)
3571 hidnplayr 5080
======================================================================
6079 serge 5081
========== Function 77, Subfunction 0, Create futex object ===========
5082
======================================================================
5083
Parameters:
5084
  * eax = 77 - function number
5085
  * ebx = 0 - subfunction number
5086
  * ecx = pointer to futex dword
5087
Returned value:
5088
  * eax = futex handle, 0 on error
5089
Remarks:
5090
  * Use subfunction 1 to destroy the futex.
5091
    The kernel destroys the futexes automatically when the process
5092
    terminates.
6235 pathoswith 5093
 
5094
---------------------- Constants for registers: ----------------------
5095
  eax - SF_FUTEX (77)
5096
  ebx - SSF_CREATE (0)
6079 serge 5097
======================================================================
5098
========= Function 77, Subfunction 1, Destroy futex object ===========
5099
======================================================================
5100
Parameters:
5101
  * eax = 77 - function number
5102
  * ebx = 1 - subfunction number
5103
  * ecx = futex handle
5104
Returned value:
5105
  * eax = 0 - successfull, -1 on error
5106
Remarks:
5107
  * The futex handle must have been created by subfunction 0
5108
 
6235 pathoswith 5109
---------------------- Constants for registers: ----------------------
5110
  eax - SF_FUTEX (77)
5111
  ebx - SSF_DESTROY (1)
6079 serge 5112
======================================================================
5113
=============== Function 77, Subfunction 2, Futex wait ===============
5114
======================================================================
5115
Parameters:
5116
  * eax = 77 - function number
5117
  * ebx = 2 - subfunction number
5118
  * ecx = futex handle
5119
  * edx = control value
5120
  * esi = timeout in system ticks or 0 for infinity
5121
Returned value:
6089 serge 5122
  * eax = 0 - successfull
5123
	 -1 - timeout
5124
	 -2 - futex dword does not have the same value as edx
6079 serge 5125
Remarks:
5126
  * This functionn tests that the value at the futex dword still
5127
    contains the expected control value, and if so, then sleeps
5128
    waiting for a wake operation on the futex.
5129
  * The futex handle must have been created by subfunction 0
5130
 
6235 pathoswith 5131
---------------------- Constants for registers: ----------------------
5132
  eax - SF_FUTEX (77)
5133
  ebx - SSF_WAIT (2)
6079 serge 5134
======================================================================
5135
=============== Function 77, Subfunction 3, Futex wake ===============
5136
======================================================================
5137
Parameters:
5138
  * eax = 77 - function number
5139
  * ebx = 3 - subfunction number
5140
  * ecx = futex handle
5141
  * edx = number of waiters to wake
5142
Returned value:
5143
  * eax = number of waiters that were woken up
5144
 
5145
Remarks:
5146
  * This function wakes at most edx of the waiters that are
5147
    waiting (e.g., inside futex wait) on the futex dword
5148
  * The futex handle must have been created by subfunction 0
5149
 
6235 pathoswith 5150
---------------------- Constants for registers: ----------------------
5151
  eax - SF_FUTEX (77)
5152
  ebx - SSF_WAKE (3)
6079 serge 5153
======================================================================
6798 pathoswith 5154
=== Function 80 - file system interface with parameter of encoding ===
5155
======================================================================
5156
Parameters:
5157
  * eax = 80
5158
  * ebx = pointer to the information structure
5159
Returned value:
5160
  * eax = 0 - success; otherwise file system error code
5161
  * some subfunctions return value in other registers too
5162
General format of the information structure:
5163
  * +0: dword: subfunction number
5164
  * +4: dword: offset in file or folder
5165
  * +8: dword: higher part of offset or flags
5166
  * +12 = +0xC: dword: size of data
5167
  * +16 = +0x10: dword: pointer to data
5168
  * +20 = +0x14: dword: string encoding:
5169
    1 = cp866
5170
    2 = UTF-16LE
5171
    3 = UTF-8
5172
 
5173
  * +24 = +0x18: dword: pointer to zero terminated string with path
5174
 
5175
The rest is similar to sysfunction 70.
5176
 
5177
======================================================================
118 diamond 5178
=============== Function -1 - terminate thread/process ===============
114 mikedld 5179
======================================================================
5180
Parameters:
118 diamond 5181
  * eax = -1 - function number
114 mikedld 5182
Returned value:
118 diamond 5183
  * function does not return neither value nor control
114 mikedld 5184
Remarks:
118 diamond 5185
  * If the process did not create threads obviously, it has only
5186
    one thread, which termination results in process termination.
5187
  * If the current thread is last in the process, its termination
5188
    also results in process terminates.
5189
  * This function terminates the current thread. Other thread can be
5190
    killed by call to subfunction 2 of function 18.
114 mikedld 5191
 
6235 pathoswith 5192
---------------------- Constants for registers: ----------------------
5193
  eax - SF_TERMINATE_PROCESS (-1)
114 mikedld 5194
======================================================================
5195
=========================== List of events ===========================
5196
======================================================================
118 diamond 5197
Next event can be retrieved by the call of one from functions 10
5198
(to wait for event), 11 (to check without waiting), 23
5199
(to wait during the given time).
5200
These functions return only those events, which enter into a mask set
5201
by function 40. By default it is first three,
5202
there is enough for most applications.
114 mikedld 5203
Codes of events:
118 diamond 5204
  * 1 = redraw event (is reset by call to function 0)
5205
  * 2 = key on keyboard is pressed (acts, only when the window is
5206
    active) or hotkey is pressed; is reset, when all keys from
5207
    the buffer are read out by function 2
5208
  * 3 = button is pressed, defined earlier by function 8
5209
    (or close button, created implicitly by function 0;
5210
    minimize button is handled by the system and sends no message;
5211
    acts, only when the window is active;
5212
    is reset when all buttons from the buffer
5213
    are read out by function 17)
5214
  * 4 = reserved (in current implementation never comes even after
5215
    unmasking by function 40)
2513 mario79 5216
  * 5 = kernel finished redrawing of the desktop background
118 diamond 5217
  * 6 = mouse event (something happened - button pressing or moving;
5218
    is reset at reading)
5219
  * 7 = IPC event (see function 60 -
5220
    Inter Process Communication; is reset at reading)
5221
  * 8 = network event (is reset at reading)
5222
  * 9 = debug event (is reset at reading; see
5223
    debug subsystem)
5224
  * 16..31 = event with appropriate IRQ
5225
    (16=IRQ0, 31=IRQ15) (is reset after reading all IRQ data)
114 mikedld 5226
 
5227
======================================================================
118 diamond 5228
=================== Error codes of the file system ===================
114 mikedld 5229
======================================================================
118 diamond 5230
  * 0 = success
5231
  * 2 = function is not supported for the given file system
5232
  * 3 = unknown file system
5233
  * 5 = file not found
5234
  * 6 = end of file, EOF
5235
  * 7 = pointer lies outside of application memory
5236
  * 8 = disk is full
6235 pathoswith 5237
  * 9 = file system error
114 mikedld 5238
  * 10 = access denied
118 diamond 5239
  * 11 = device error
6235 pathoswith 5240
  * 12 = file system requires more memory
5241
 
118 diamond 5242
Application start functions can return also following errors:
5243
  * 30 = 0x1E = not enough memory
5244
  * 31 = 0x1F = file is not executable
5245
  * 32 = 0x20 = too many processes