Subversion Repositories Kolibri OS

Rev

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