Subversion Repositories Kolibri OS

Rev

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

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