Subversion Repositories Kolibri OS

Rev

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

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