OS Menuet
 Новости
 Описание
 Текущая версия
 История
 Скриншоты

Скачать
 OS Menuet
 Дистрибутивы
 Загрузчики
 Программы

Документация
 Статьи
 FAQ
 Hardware List
 Рассылки

О нашем сайте
 Наша команда
 Публикация
 Конкурс
 Форум

Ссылки
 О Menuet
 Другие OS
 Программисту

Официальный сайт/Official site MenuetOS>>
С И С Т Е М Н Ы Е    Ф У Н К Ц И И    M E N U E T    V 0.69

     Чтобы вызывать из приложения одну из системных функций, нужно поместить ее номер в регистр eax. Затем, надо сделать системный вызов - int 0x40. Параметры функции передаются через другие регистры.

MENUET 0.69 SYSTEM CALLS FOR APPLICATIONS
   
eax      = function number
int 0x40 = sys call
   
   
00 = DEFINE AND DRAW WINDOW
   
     ebx [x start]*65536 + [x size]
     ecx [y start]*65536 + [y size]
     edx body color     0xXYRRGGBB  if X=8 -> color glide
                                    if Y=0 -> window type  I
                                    if Y=1 -> reserve area, no draw
                                    if Y=2 -> window type  II
                                    if Y=3 -> skinned window,
                                       closebutton id=1 autoadded
     esi grab bar color 0xX0RRGGBB  if X=8 -> negative color glide
                                    if X=4 -> positive color glide
     edi frame color    0x00RRGGBB
     ret: nothing changed
   
   
01 = PUTPIXEL
   
     ebx [x]
     ecx [y]
     edx pixel color 0x0XRRGGBB
                        ^ 0 normal put, 1 negative
     ret: nothing changed
   
   
02 = GET KEY
   
     ret: al 0 successful -> ah = key
          al 1 no key in buffer
   
   
03 = GET SYSTEM CLOCK
   
     ret: eax 0x00SSMMHH sec,min,hour
   
   
04 = WRITE TEXT TO WINDOW
   
     ebx [x start]*65536 + [y start]
     ecx text color 0x00RRGGBB
     edx pointer to text beginning
     esi text length
     ret: nothing changed
   
   
05 = DELAY X/100 SECS
   
     ebx delay in 1/100 secs
     ret: nothing changed
   
   
06 = OPEN FILE FROM FLOPPY
   
     ebx pointer to filename -> 11 capital letters
     ecx set 0x00000000 - reserved
     edx set 0xffffffff - reserved
     esi read to mem position
     ret: nothing changed
   
   
07 = PUTIMAGE
   
     ebx pointer to image in memory - RRGGBBRRGGBB..
     ecx image size [x]*65536+[y]
     edx image position in window [x]*65536+[y]
     ret: eax 0 succesful, 1 overlapped
   
   
08 = DEFINE BUTTON
   
     ebx [x start]*65536 + [x size]
     ecx [y start]*65536 + [y size]
     edx button id number
     esi button color 0x 00 RR GG BB
     ret: nothing changed
   
   
09 = PROCESS INFO
   
     ebx pointer to 1024 bytes table
     ecx process number or -1 = who am I
     ret: eax number of processes
          table :  +00  dword   cpu usage
                   +04   word   processes position in windowing stack
                   +06   word   window stack value at ecx
                   +10  12 db   name of the process
                   +22  dword   start of processes memory
                   +26  dword   memory used by process
                   +30  dword   PID of the process
   
   
10 = WAIT FOR EVENT
   
     ret: eax event type, 1 window redraw, 2 key in buffer, 3 button pressed
   
   
11 = CHECK FOR EVENT, NO WAIT
   
     ret: eax 0 no event, 1 window redraw, 2 key in buffer, 3 button pressed
   
   
12 = WINDOW REDRAW STATUS
   
     ebx  1 start of redraw, 2 end of redraw
     ret: nothing changed
   
   
13 = DRAW BAR
   
     ebx [x start]*65536 + [x size]
     ecx [y start]*65536 + [y size]
     edx color 0x00RRGGBB
     ret: nothing changed
   
   
14 = GET SCREEN MAX
   
     ret: eax [screen x max]*65536 + [screen y max]
   
   
15 = BACKGROUND
   
     ebx 1 : set background size
             ecx x size
             edx y size
     ebx 2 : write to background memory - max (0x100000-16)
             ecx position in memory in bytes
             edx color 0x00RRGGBB
     ebx 3 : draw background
     ebx 4 : type of background draw
             ecx 1 - tile
             ecx 2 - stretch
     ebx 5 : blockmove image to os bgr memory
             ecx - from
             edx - to where in os bgr memory
             esi - count of bytes to move
   
   
16 = [ not ready - write cache to diskette ]
   
   
17 = GET PRESSED BUTTON ID
   
     ret: al 0 successful -> ah = id number
          al 1 no key in buffer
   
   
18 = SYSTEM SERVICE
   
     ebx 1 - system boot
     ebx 2 - force terminate , ecx process no
     ebx 4 - idle clock cycles / second
     ebx 5 - time stamp counter / second - cpu speed
   
   
19 = START PROGRAM
   
     ebx point to 11 char filename
     ecx 0, or point to ASCIIZ start parameters - max 256 bytes
     ret: eax 0      successful
          eax other  error code
   
   
20 = MIDI INTERFACE - MPU401
   
     ebx  1 - reset device
     ebx  2 - cl midi data to output
   
   
21 = SETUP FOR DEVICES
   
     ebx 1=roland mpu midi base , base io address
     ebx 2=keyboard 1 base keymap  2 shift keymap (ecx pointer to keymap)
                    9 country 1eng 2fi 3ger 4rus
     ebx 3=cd base  1 pri.master  2 pri slave,
                    3 sec master  4 sec slave
     ebx 4=sb16 base, base io address
     ebx 5=system language, 1eng 2fi 3ger 4rus
     ebx 6=wss base, base io address
     ebx 7=hd base, 1 pri.master  2 pri slave
                    3 sec master  4 sec slave
     ebx 8=fat32 partition in hd
     ebx 10=sound dma channel in ecx
   
   
22 = NOT USED
   
   
23 = WAIT FOR EVENT WITH TIMEOUT
   
     ebx time to delay in hs
     ret: eax event type: 0 no event, 1 window redraw,
                          2 key in buffer, 3 button
   
   
24 = CD AUDIO
   
     ebx 1 - play from ecx 00 FR SS MM
     ebx 2 - get playlist size of ecx to [edx]
     ebx 3 - stop/pause play
   
   
25 = SB16 - mixer I
   
     ebx 1 - set main volume cl [L]*16+[R]
     ebx 2 - set cd   volume cl [L]*16+[R]
   
   
26 = GET SETUP FOR DEVICES
   
     ebx 1=roland mpu midi base , base io address
     ebx 2=keyboard 1 base keymap  2 shift keymap
                    9 country 1eng 2fi 3ger 4rus
     ebx 3=cd base  1 pri.master  2 pri slave,
                    3 sec master  4 sec slave
     ebx 4=sb16 base, base io address
     ebx 5=system language, 1eng 2fi 3ger 4rus
     ebx 6=wss base, base io address
     ebx 7=hd base, 1 pri.master  2 pri slave
                    3 sec master  4 sec slave
     ebx 8=fat32 partition in hd
     ebx 9=1/100 timer tics from stard -> eax
     return value in eax
   
   
27 = WINDOWS SOUND SYSTEM
   
     ebx 1 - set main volume to cl 0-255
     ebx 2 - set cd   volume to cl 0-255
   
   
28 = SB16 - mixer II
   
     ebx 1 - set main volume to cl 0-255
     ebx 2 - set cd   volume to cl 0-255
   
   
29 = GET DATE
   
     ret: eax 0x00YYDDMM year date month
   
   
30 = READ HD
   
     ebx  pointer to file
     ecx  file lenght
     edx  block to read, starts from 1, blocksize = 512 bytes
     esi  reserved, set as 1
     edi  pointer to return/work area (atleast 20 000 bytes)
   
     return: work_area+1024 <- requested block of 512 bytes
   
   
31 = START APP FROM HD
   
     ebx  pointer to file
     ecx  file lenght
     edx  pointer to return/work area (atleast 20 000 bytes)
     ret  eax=0 successful, eax<>0 errorcode
   
   
32 = DELETE FILE FROM FLOPPY IMAGE IN MEMORY
   
     ebx  pointer to filename
   
   
33 = SAVE FILE TO FLOPPY IMAGE IN MEMORY
   
     ebx  pointer to file name
     ecx  pointer to data
     edx  count to write in bytes
     esi  0 create new , ( 1 append - not implemented yet )
   
     ret: eax = 0 save successful, eax = 1 ramdisk full
   
   
34 = READ DIRECTORY FROM FLOPPY
   
     ebx  reserved : set as zero
     ecx  reserved : set as zero
     edx  start 512 block to read
     esi  reserved : set as 1
     edi  pointer to return area
   
   
35 = READ SCREEN PIXEL
   
     ebx = pixel count from top left of the screen
   
     return : eax = 0x00RRGGBB
   
   
36 = READ STRING (not finished)
   
   
37 = READ MOUSE POSITION
     ebx=0 screen relative
     ebx=1 window relative
     ebx=2 buttons pressed
     return in eax
   
   
38 = DRAW LINE
   
     ebx  [x start] shl 16 + [x end]
     ecx  [y start] shl 16 + [y end]
     edx  colour 0x00RRGGBB
   
     return : nothing changed
   
   
39 = GET BACKGROUND
   
     ebx=1 -> eax=[bgr x size] shl 16 + [bgr y size]
     ebx=2
       ecx= postition of backgrounds memorymap to return in eax
     ebx=4 -> eax=1 tiled, eax=2 stretched
   
   
40 = SET BITFIELD FOR WANTED EVENTS
   
     as default:
     ebx = 00000000 00000000 00000000 00000111b  events:
                                             I   window draw
                                            I    key in buffer
                                           I     button in buffer
                                          I      (end request)
                                         I       desktop background draw
                                        I        (mouse change)
                                       I         IPC event
           I---------------I                     get irqs data
   
   
41 = GET IRQ OWNER
   
     ebx = irq
   
     return : PID of the process
   
   
42 = GET DATA READ BY IRQ
   
     ebx  IRQ number
     return :  eax  number of bytes in buffer
                bl  data
               ecx  0 = successful data read
                    1 = no data in buffer
                    2 = incorrect IRQ owner
   
   
43 = SEND DATA TO DEVICE
   
     bx  : port
     cl  : data
     return : eax = if 0 successful, other = error
   
   
44 = PROGRAM IRQ's
   
     ebx  pointer to table
     ecx  irq number
   
   
45 = RESERVE/FREE IRQ
   
     ebx  0 reserve  1 free
     ecx  IRQ number
     ret  eax 0 successful,  1 error
   
   
46 = RESERVE/FREE PORT AREA
   
     ebx  0 reserve  1 free
     ecx  port area start
     edx  port area end
     ret  eax 0 successful,  1 error
   
   
47 = DISPLAY NUMBER TO WINDOW
   
     ebx = print type, bl=0 -> ecx is number
                       bl=1 -> ecx is pointer
                       bh=0 -> display decimal
                       bh=1 -> display hexadecimal
                       bh=2 -> display binary
           bits 16-21 = number of digits to display (0-32)
           bits 22-31 = reserved
     ecx = number or pointer
     edx = x shl 16 + y
     esi = color
   
   
48 = DEFINE GENERAL WINDOW PROPERTIES
   
     ebx = 0      apply/redraw
        ecx = 0 , apply/redraw desktop
     ebx = 1      define button style
        ecx = 0 , set flat buttons
        ecx = 1 , set 3d buttons
     ebx = 2      define window colors
        ecx = pointer to table
        edx = number of bytes defined
     ebx = 3      get define window colors
        ecx = pointer to table
        edx = number of bytes to get
   
   
49 = DEFINE APPLICATIONS INTERNAL INTERRUPTS
   
     ebx = 0
      ecx  point to dword x 256 table of interrupt entries
           inside the application
   
     return : nothing changed
   
   
50 = FREE FORM WINDOW SHAPE AND SCALE
   
     ebx = 0 ; shape reference area
       ecx = pointer to reference area
             byte per pixel, 0 not used, 1=used, other = reserved
     ebx = 1 ; scale of reference area (default 1:1)
       ecx : scale is set to 2^ecx
   
     return: nothing changed
   
   
51 = CREATE THREAD
   
     ebx = 1  ; create
       ecx    ; = thread entry point
       edx    ; = thread stack position
   
     return : nothing changed
   
   
52 = STACK DRIVER STATUS
   
     - not ready yet
   
   
53 = SOCKET INTERFACE
   
     - not ready yet
   
   
54 = USER EVENTS
   
     - not ready yet
   
   
55 = SOUND INTERFACE
   
     ebx = 0     ; load 44 khz 8 bit mono sound block
       ecx       ; = pointer to 65536 byte soundblock
   
     ebx = 1     ; play 44 khz 8 bit mono sound block
   
   
56 = WRITE FILE TO HD
   
     ebx  pointer to 12 char filename
     ecx  bytes to write
     edx  pointer to data to write
     esi  pointer to path
          path db 0
   
   
57 = DELETE FILE FROM HD
   
     ebx   pointer to filename : 11 capital letters
     edx   pointer to path : path db 0
   
   
58 = SYSTEM TREE ACCESS
   
     ebx    pointer to fileinfo block
   
     path examples:
   
     '/RAMDISK/FIRST/KERNEL.ASM',0
     '/RD/1/KERNEL.ASM',0
   
     '/HARDDISK/FIRST/KERNEL.ASM',0
     '/HD/1/KERNEL.ASM',0
     '/HARDDISK/FIRST/MENUET/PICS/TANZANIA.BMP',0
   
     fileinfo:
   
     dd   0                    ; 0=READ    (delete/append)
     dd   0x0                  ; 512 block to read 0+
     dd   0x1                  ; blocks to read (/bytes to write/append)
     dd   0x20000              ; return data pointer
     dd   0x10000              ; work area for os - 16384 bytes
     db   '/RAMDISK/FIRST/KERNEL.ASM',0  ; ASCIIZ dir & filename
   
     or
   
     fileinfo:
   
     dd   1                    ; 1=WRITE
     dd   0x0                  ; not used
     dd   10000                ; bytes to write
     dd   0x20000              ; source data pointer
     dd   0x10000              ; work area for os - 16384 bytes
     db   '/RAMDISK/FIRST/KERNEL.ASM',0  ; ASCIIZ dir & filename
   
     or
   
     ; LBA
   
     fileinfo:
   
     dd   8                    ; 8=LBA read (/9=LBA write)
     dd   0x0                  ; 512 block to read (write)
     dd   0x1                  ; set to 1
     dd   0x20000              ; return data pointer
     dd   0x10000              ; work area for os (16384 bytes)
     dd   '/HARDDISK/SECOND',0 ; physical device ; ASCIIZ
   
     NOTE: The asciiz in this context refers to the physical device and
           not to logical one.
           For hd: first=pri.master, second=pri.slave
                   third=sec.master, fourth=sec.slave
   
     or
   
     fileinfo:
   
     dd   16                   ; 16=START APPLICATION
     dd   0x0                  ; nop
     dd   0x0                  ; nop
     dd   0x0                  ; nop
     dd   0x10000              ; work area for os - 16384 bytes
     db   '/HD/1/MENUET/APPS/FIRE',0  ; ASCIIZ dir & filename
   
   
   
   
59 = TRACE FOR SYSTEM CALLS FROM PROCESSES
   
     ebx = 0   ; get system events
       ecx     ; pointer to table  -> ; 64 bytes/system call descriptor
                                      ; +00 PID
                                      ; +32 EDI
                                      ; +36 ESI
                                      ; +40 EBP
                                      ; +44 ESP
                                      ; +48 EBX
                                      ; +52 EDX
                                      ; +56 ECX
                                      ; +60 EAX
   
       edx     ; number of bytes to return to table (currently max 16*64)
   
     return:  eax = number of system calls from start
                     latest call is saved to (eax mod 16)*64 in table
               ebx = 0 : above format
   
   
-1 = END OF APPLICATION
   
   
   
   
   
Наверх / Up mailto:Webmaster
Hosted by uCoz