MenuetOS 64 bit v1.51.40 system calls - 64bit and 32bit ======================================================= 64 bit system calls ------------------- rax : function number int 0x60 : system call syscall : Optional faster system call. Modifies rcx,r11,r14. Replace int 0x60/rcx/r11 with syscall/rbp/r15. Index: 0 - Define and draw window 1 - Putpixel 2 - Get key 3 - Get/set date and time 4 - Display text 5 - Delay 7 - Display image 8 - Define and draw button 9 - Get process info 10 - Wait for event 11 - Check for event 12 - Window draw state 13 - Display filled/outlined rectangle 15 - Define and draw background 16 - Floppy interface 17 - Get pressed button info 21 - Device addresses 23 - Wait for event with timeout 26 - Get general system info 35 - Get pixel of screen 37 - Mouse data 38 - Draw Line 40 - Set bitfield for wanted events 42 - Read data from IRQ 44 - Define ports to read at IRQ 45 - Reserve/Free IRQ for data read 46 - Reserve/Free port for direct read and write 47 - Display number 49 - PC speaker 50 - Define freeform and transparent window 51 - Threads 52 - Network interface 53 - Network interface 58 - Filesystem 60 - Inter process communication 61 - Direct screen access 63 - System debug board 64 - Memory manager 66 - Keyboard settings 67 - Window move and resize 68 - Screensaver 105 - Delay (ms) 110 - Get data from running process 111 - Who am I 112 - Get configuration parameter 113 - Vertical and horizontal scroll bars 114 - CD audio 115 - PCI 116 - Driver state access 117 - Audio 118 - MIDI 119 - Draw Circle 120 - Window Skinning 121 - Drag'n drop 122 - 3D API 123 - Wait for event with timeout (ms) 124 - Window hide, show, activate 125 - Window transparency 126 - Switch process to 32bit or 64bit mode 127 - USB 2.0 device information 128 - USB 2.0 webcam interface 129 - USB 2.0 printer interface 130 - USB 2.0 tuner interface 131 - USB 1.X device information 132 - USB 1.1 midi device interface 140 - Multi-Processor interface 141 - System font 142 - Copy/paste 143 - Gzip 144 - Graphics driver 145 - Window menu control 150 - Audio and signal processing (FFT,resampling,equalizer) 151 - Mathlib 152 - CM lossless data codec 205 - Delay (microsecons) 223 - Wait for event with timeout (microseconds) 240 - Time-critical processes 241 - Scheduler frequency 256 - Start process 257 - Start process from memory 258 - Start process from memory II 400 - Set page type (driver only) 500 - System 512 - Terminate process - 0 - Define and draw window In : rbx - X start shl 32 & x size rcx - Y start shl 32 & y size rdx - Bits 00-23 Window content area color (rrggbb) Bits 32-40 Window type (0/1=draw window/reserve area) Bit 57 Draw origo at window top-left/body (0/1) When set, window size defines window body size. When set, enables more skinning options (sc.120/11&15) Bit 58 Window move also from content area (0/1=no/yes) Bit 59 Draw content area (0/1=yes/no) Bit 60 Source text (0/1=extended ascii/utf8) Bit 61 Open to bottom of window stack (0/1=no/yes) Bit 62 Window resize (0/1=enable/disable) Bit 63 Window move (0/1=enable/disable) r8 - Extended flags (set as 1) r9 - Zero or pointer to window label (mainmem,ascii/utf8,0) r10 - Zero or pointer to menu struct (mainmem,ascii/utf8,255) Out: - 1 - Putpixel In : rbx - X rcx - Y rdx - Color (0xrrggbb) bit 63 - 0/1 - yes/no transparency update Out: - 2 - Get key Out: rax - 0 Success, key in buffer rbx - Bit 0 - Keypress (0/1=down/up) Bit 1 - Key type (0/1=value/extended) Bit 2 - Value type (0/1=ascii/unicode) rcx - Key (ascii,unicode,extended) rax - 1 Fail, no key in buffer 3 - Get/set date and time In : rbx = 1 - Get time 2 - Get date Out: rax - Time 0x00SSMMHH - Date 0xDWDDMMYY In : rbx = 11 - Set time 12 - Set date rax - Time 0x00SSMMHH - Date 0x00DDMMYY Out: rax - 0/1 = Success/fail 4 - Display text In : rbx - Pointer to string (ascii/utf8,0) rcx - X position rdx - Y position r9 - Bits 00-31 Font 1-2 Fixed size (5x9,7x9) 3-6 Variable size (r10=height) Bit 60 Source text (0/1=extended ascii/utf8) rsi - Color (0xrrggbb) bit 63 - 0/1 - yes/no transparency update Out: - 5 - Delay In : rbx - Delay 1/100s Out: - See also system calls 105 and 205 7 - Display image In : rbx - X start shl 32 & x size rcx - Y start shl 32 & y size rdx - Pointer to first pixel (rrggbb) to display r8 - Scanline difference (0 for continuous picture data) r9 - Transparency color (0x1000000 for no transparency) r10 - Pixel alignment (3 for RRggbbRRggbb) Out: - 8 - Define and draw button In : rbx - X start shl 32 & x size rcx - Y start shl 32 & y size rdx - Button ID r8 - Bit 63 Button image (0/1=enable/disable) Bit 62 Generate button down event with ID+bit63 (0/1=disable/enable) Bit 61 Draw frames during press (0/1=enable/disable) Bit 60 Source text (0/1=extended ascii/utf8) Bit 59 When set, removes button with matching ID from the button list. Does not remove the button image. Bit 58 Generate button up event (0/1=enable/disable) r9 - Zero or pointer to button label (ascii/utf8,0) Out: - 9 - Get process info In : rbx - 1/2 - Get process info table by process slot/PID rcx - Process slot (1+) or PID rdx - Pointer to table data return area r8 - Bytes to return Out: Returns data to [rdx+], see table 9-1 In : rbx - 11/12 - Get process info parameter by process slot/PID rcx - Process slot (1+) or PID rdx - Parameter position (in bytes) in table 9-1 Out: rax - Parameter 10 - Wait for event In : - Out: rax - Bitfield of event(s) 0 .. 0 0 0 0 0 1 1 1 | | | | | | | | | | | | | | | | | --- 00 Window redraw | | | | | | | ----- 01 Key press | | | | | | ------- 02 Button press | | | | | --------- 03 [undefined] | | | | ----------- 04 Background change | | | ------------- 05 Mouse event | | --------------- 06 IPC event | ----------------- 07 Network data event | 08-31 [undefined] ---------------------- 32-48 IRQ events 11 - Check for event In : - Out: rax - Bitfield of event(s) 12 - Window draw state In : rbx - 1 Start of draw rbx - 2 End of draw Out: - In : rbx - 3 End of draw. Returns window draw limits, screen relative. Out: rax - X start shl 32 + X end rbx - Y start shl 32 + Y end 13 - Display filled/outlined rectangle In : rbx - X start shl 32 & x size rcx - Y start shl 32 & y size rdx - Color (bit 63-0/1=filled/outlined) Out: - 15 - Define and draw background In : rbx - 1 Draw background Out: - In: rbx - 2 Give background data rcx - Pointer to background image (RRGGBB) rdx - Destination r8 - Amount of bytes to copy Out: - In: rbx - 3 Give background size rcx - X size rdx - Y size Out: - In: rbx - 12 Get background data rcx - Source address rdx - Amount of bytes to copy r8 - Pointer to application return area Out: - In: rbx - 13 Give background size Out: rax - X shl 32 + Y 16 - Floppy interface In : rbx - 1 - Copy cache to diskette Out: rax - 0 In : rbx - 2 - Copy modified cache to diskette Out: rax - 0 In : rbx - 3 - Set setup parameter rax - Setup parameter Out: rax - 0 In : rbx - 4 - Get setup parameter Out: rax - Setup parameter 17 - Get pressed button info In : - Out: rax - 0 Request success rbx - Button ID rax - 1 No button in buffer for requestor 21 - Device addresses In : rbx - 1 - Get CD address Out: rax - 0-5 - Disabled,Pr.master,Pr.slave,Sec.master, Sec.slave, Bootup autoconf In : rbx - 2 - Get HD address Out: rax - 0-4 - Disabled,Pr.master,Pr.slave,Sec.master,Sec.slave In : rbx - 11 - Set CD address rcx - 0-4 - Disabled,Pr.master,Pr.slave, Sec.master,Sec.slave Out: - In : rbx - 12 - Set HD address rcx - 0-4 - Disabled,Pr.master,Pr.slave, Sec.master,Sec.slave Out: - 23 - Wait for event with timeout In : rbx - Delay in 1/100s Out: rax - Bitfield of event(s) See also system calls 123 and 223 26 - Get general system info In : rbx 1 - General data 2 - Window stack 3 - Boot info base 4 - Paging table use 5 - BIOS/UEFI memory map rcx - Pointer to table return area rdx - Bytes to return Out: Returns table data to [rcx+], see sysdata app In : rbx 11 - General data 12 - Window stack 13 - Boot info base 14 - Paging table use 15 - BIOS/UEFI memory map rcx - Parameter position (in bytes) in table Out: rax - Parameter, see sysdata app 35 - Get pixel of screen In : rbx - 1 Get screen related pixel rcx - X rdx - Y Out: rax - Pixel In : rbx - 2 Get screen pixel owner rcx - X rdx - Y Out: rax - Owner PID 37 - Mouse data In : rbx - 0 Mouse coordinates, screen relative Out: rax - X shl 32 + Y In : rbx - 1 Mouse coordinates, window draw area relative Out: rax - X shl 32 + Y In : rbx - 2 Mouse buttons state Out: rax - State In : rbx - 3 Scroll wheel change Out: rax - Change In : rbx - 10 Get mouse movement speed Out: rax - Movement speed In : rbx - 11 Set mouse movement speed rcx - Speed (1-19) Out: rax - 0/1 = Success/Fail 38 - Draw Line In : rbx - X start rcx - Y start rdx - X end r8 - Y end r9 - Color (0xrrggbb) bit 63 - 0/1 - yes/no transparency update Out: - 40 - Set bitfield for wanted events In : rbx - Bitfield of events Reported by default: 0 .. 0 0 0 0 0 1 1 1 | | | | | | | | | | | | | | | | | --- 00 Window redraw | | | | | | | ----- 01 Key press | | | | | | ------- 02 Button press | | | | | --------- 03 [undefined] | | | | ----------- 04 Background change | | | ------------- 05 Mouse event | | --------------- 06 IPC event | ----------------- 07 Network data event | 08-31 [undefined] ---------------------- 32-48 IRQ events Out: - 42 - Read data from IRQ In : rbx - IRQ to read data from Out: rax - 0 successful, 1 no data rbx - bl data rcx - Data count after read 44 - Define ports to read at IRQ In : rbx - IRQ rcx - Pointer to port list Out: rax - 0 successful, 1 IRQ already in use 45 - Reserve/Free IRQ for data read In : rbx - 0 Reserve rcx - IRQ Out: rax - 0 Successful, 1 IRQ already in use 46 - Reserve/Free port for direct read and write Not implemenet yet, but required for application for future compatibility. In : rbx - 0 Reserve rcx - Port Out: rax - 0 Successful, 1 Port already in use 47 - Display number In : rbx - bits 00-07 - 0 - rcx is number - 1 - rcx is pointer bits 08-15 - 0 - display decimal - 1 - display hexadecimal - 2 - display binary bits 16-31 - number of digits to display bits 32-63 - not used rcx - Number or pointer rdx - X shl 32 + Y rsi - Color Out: - 49 - PC speaker In : rbx - 1 - Data for PC speaker rcx - Middle A in Hz (default 440) for tuning notes (400-500) rdx - Pointer to data area (max 2048*6 bytes) Data stream arranged in multiple of three words, X*6 bytes w0=0 stream end, w1=ignored, w2=ign. w0=1 divider, w1=duration (ms), w2=1193182 divider w0=2 frequency, w1=duration (ms), w2=frequency w0=3 note, w1=duration (ms), w2=midinote (60=middle C) w0=4 pause, w1=duration (ms), w2=ign. Example: dw 3,500,60, 3,500,64, 3,500,67 ,0 ; C-chord Out: rax - 0/other - success/fail In : rbx - 2 - Turn off speaker Out: rax - 0/other - success/fail In : rbx - 3 - Get play position in buffer Out: rax - 0-2047 In : rbx - 4 - Start PWM play (pulse width modulated) Process needs to set the scheduler interval to 16000 before calling this function (sysc.241) Out: rax - 0/1=success/fail In : rbx - 5 - Give data to PWM play rcx - 0/1 = Buffer rdx - Pointer to 1024 audio samples, signed 8bit pcm at 16khz Out: rax - 0/1=success/fail 50 - Define freeform and transparent window In : rbx - 0 Define reference area rcx - Pointer to freeform and transparent area (mainmem) Area size: ( window_size_x * window_size_y ) bytes Entries in area: 0 - Pixel not used by application - 100% transparency 1 - Pixel used by application - 0% transparency 2 - Transparent pixel - 25/50/75% transp. With entry 2, colours 0xffffff and 0x000000 are shown without transparency. Out: - In : rbx - 1 Freeform area scale rcx - 0-15 - Scale (2^rcx), default 0 Out: - 51 - Threads In : rbx - 1 Start thread rcx - Thread entry (mainmem) rdx - Stack value (mainmem) Out: rax - 0 Success rbx - Thread PID rax - 1 Fail 52 - Network interface (configuration) - See also Stack.txt In : rbx - 0 - Get Stack Configuration Out: rax - Configuration Bit(s) 00-03 Interface 07 Server assigned IPs 08-11 ComIrq 16-28 ComPort In : rbx - 1 - Get Local IP Address Out: rax - Local IP In : rbx - 2 - Set Stack Configuration rcx - Configuration Out: - In : rbx - 3 - Set Local IP Address rcx - Local IP Out: - In : rbx - 9 - Get Gateway IP Address Out: rax - Gateway IP In : rbx - 10 - Get Subnet IP Mask Out: rax - Subnet IP mask In : rbx - 11 - Set Gateway IP Address rcx - Gateway IP Out: - In : rbx - 12 - Set Subnet IP Mask rcx - Subnet IP Out: - In : rbx - 13 - Get DNS IP Address Out: rax - DNS IP In : rbx - 14 - Set DNS IP Address rcx - DNS IP Out: - 53 - Network interface - See also Stack.txt TCP In : rbx - 5 - Open a TCP socket rcx - local port rdx - remote port rsi - remote ip address (in internet byte order) rdi - 0/1 = passive/active Out: rax - Socket number or 0xffffffff for error In : rbx - 7 - Write to a TCP socket rcx - socket number rdx - number of bytes to write (max 1280) rsi - pointer to data Five second timeout, which closes the socket. Out: rax - 0/other = success/errorcode In : rbx - 17 - Write to a TCP socket rcx - socket number rdx - number of bytes to write (max 1280) rsi - pointer to data Returns immediately. No socket state change. Out: rax - 0/other = success/queue unavailable In : rbx - 8 - Close a TCP socket rcx - socket number Out: rax - 0 = success or 0xffffffff = error In : rbx - 6 - Return TCP socket status rcx - socket number Out: rax - 0 = Closed 1-3 = Opening 4 = Connection established 5-11 = Closing/Closed See below 'TCP and UDP' for more functions UDP In : rbx - 0 - Open a UDP socket rcx - local port rdx - remote port rsi - remote ip address (in internet byte order) Out: rax - Socket number or 0xffffffff for error In : rbx - 4 - Write to UDP socket rcx - socket number rdx - number of bytes to write (max 1280) rsi - pointer to data Out: rax - 0 = success or 0xffffffff = error In : rbx - 1 - Close a UDP socket rcx - socket number Out: rax - 0 = success or 0xffffffff = error See below 'TCP and UDP' for more functions TCP and UDP In : rbx - 2 - Poll socket rcx - socket number Out: rax - Number of bytes in receive buffer In : rbx - 3 - Read socket data (byte) rcx - socket number Out: rax - Number of bytes remaining in receive buffer bl - Data byte In : rbx - 13 - Read socket data block rcx - socket number rdx - pointer to 64k buffer Out: rax - Number of bytes received rbx - 0 In : rbx - 9 - Check local port use rcx - port number Out: rax - 0/1 = in use/free In : rbx - 21 - Read socket info rcx - socket number rdx - 1 Out: eax - Remote IP 58 - Filesystem In : rbx - 0 Read file rcx - First block to read rdx - Blocks to read r8 - Return pointer r9 - Filename pointer (asciiz) Out: rax - 0/Error - Successful/see below rbx - File size In: rbx - 1 Write file rcx - Ignored rdx - Bytes to save r8 - Pointer to data r9 - Filename pointer (asciiz) Out: rax - 0/Error - Successful/see below, rbx=0 In: rbx - 2 Delete file rcx - Ignored rdx - Ignored r8 - Ignored r9 - Filename pointer (asciiz) Out: rax - 0/Error - Successful/see below, rbx=0 In: rbx - 3 Read directory entries rcx - First wanted name 0+ rdx - Set as 1 r8 - Return pointer r9 - Path pointer (asciiz) Out: rax - 0/Error - Successful/see below, rbx=0 [r8+0] Reserved,[r8+8] Filename,[r8+8+256] Size [r8+8+256+8] Date, r8+8+256+16] Time,[r8+8+256+24] Attributes In: rbx - 4 Append to file rcx - Ignored rdx - Bytes to save r8 - Pointer to data r9 - Filename pointer (asciiz) Note: target files size needs to be divisible by 512 Out: rax - 0/error - Successful/see below, rbx=0 Errorcodes: 5-6 Path/file not found 9 Read past directory end 10 Unable to access device 11 Directory full 12 Read-only disk 14 Target file is a directory 16 Delete: file not found Save: file already exists 18 Disk full 20 Incorrect file size at target file 21 Error in filesystem 60 - Inter process communication In : rbx 1 - Define ipc memory rcx = Pointer to memory rdx = Memory size Out : rax 0 Successful rbx 2 - Send message rcx = Receiver PID rdx = Pointer to data r8 = Message size Out: rax 0 Successful 1 Receiver not found 2 No ipc memory defined at receiver 3 Receiver memory locked 4 Receiver memory full 61 - Direct screen access In : rbx - 1 Get resolution Out: rax - X shl 32 + Y In : rbx - 2 Get bits / pixel Out: rax - Bits / pixel In : rbx - 3 Get bytes / scanline Out: rax - Bytes / scanline In : rbx - 4 Get LFB mapped memory address Out: rax - Mapped LFB address ( eg mov [rax],dword 0xffffff ) Direct access also with gs selector: eg mov [gs:0],dword 0xffffff 63 - System debug board In : rbx - 1 Write character rcx - Character (7 bit ascii) Out: rax = 0, rbx = 0 In : rbx - 2 Read character Out: rax - 0 Success rbx - Character rax - 1 Fail 64 - Memory manager In : rbx - 1 - Set new application main memory size rcx - New amount of main memory Unavailable if memory has been allocated with syscall 64/2. Out: rax - 0 - Success rax - 1 - Out of memory In : rbx - 2 - Allocate memory (malloc) rcx - Amount of memory to allocate Out: rax <= 255 - Fail >= 256 - Pointer to allocated memory In : rbx - 3 - Free allocated memory area rcx - Pointer to allocated memory Out: rax - 0 - Success Other - Fail In : rbx - 4 - Get list of allocated memory locations rcx - Index (0+) Index: 0 - Allocation count 1 - empty 2 - Start of first allocation 3 - Size of first allocation, .. Out: rax - Index entry In : rbx - 5 - Get amount of free memory Out: rax - Amount of free memory In : rbx - 6 - Get size of largest memory block Out: rax - Size of largest memory block 66 - Keyboard settings In : rbx - 1 set mode rcx - 0 - Keymap rcx - 1 - Scancodes (32 bit process) Out: - In : rbx - 2 get mode Out: rax = Mode In : rbx - 3 Shift Ctrl Alt Menu key states Out: rax = bitmap In : rbx - 51 Define key rcx - bits 00-16 - 2 byte PS/2 sequence bits 32-63 - Unicode for Key+AltGr rdx - bits 00-31 - Unicode for Plain Key bits 32-63 - Unicode for Key+Shift Out: rax = 0/1 = success/fail In : rbx - 101 Send key to process rcx - PID rdx - CU bits r8 - Key Out: rax = 0 67 - Window move and resize In : rbx = new x start rcx = new y start rdx = new x size, If bit 57 at rdx is set at window draw, r8 = new y size, rdx and r8 specify window body area size. Out: rax = 0 success - 1 fail Specifying any parameters as -1 will leave value unchanged. eg specify rbx = -1 and rcx = -1 to simply resize the window, but not move it 68 - Screensaver In : rbx - 1 Get screensaver startdelay Out: rax = 0, rcx - startdelay in minutes In : rbx - 2 Set screensaver startdelay rcx - startdelay in minutes, 0 = disabled Out: rax = 0 In : rbx - 3 Get screensaver application rcx - pointer to 256 byte return area Out: rax = 0, [rcx+] - screensaver application In : rbx - 4 Set screensaver application rcx - pointer to max 256 byte asciiz application name Out: rax = 0 In : rbx - 5 Start screensaver without delay Out: rax = 0 105 - Delay (ms) In : rbx - Delay in 1/1000s Out: - 110 - Get data from running process In : rbx - 1 Return window label rcx - Process PID rdx - Pointer to return data r8 - Amount of bytes to return rbx - 2 Return icon data ( not implemented yet ) Out: Data returned to [rdx] 111 - Who am I In : rbx = 1 Return PID Out: rax = PID In : rbx = 2 Window active/inactive Out: rax = 0 active - 1 inactive 112 - Get configuration parameter In : rbx - 1 Get parameter (outdated) rcx - Pointer to parameter string ( 16 characters ) rdx - Number of characters to return r8 - Pointer to return area of string Out: rax - 0 Parameter is a numeric value rbx - Value rax - 1 Parameter is a string rbx - String ( asciiz ) returned to [r8 ] In : rbx - 2 Get parameter rcx - Pointer to parameter string ( asciiz ) rdx - Number of characters to return r8 - Pointer to return area of string Out: rax - 0 Parameter is a numeric value rbx - Value rax - 1 Parameter is a string rbx - String ( asciiz ) returned to [r8 ] In : rbx - 3 Config.mnt reload Config.mnt has been saved by application and needs to be updated for syscall 112/2 to be up to date. Out: rax = 0 - rbx = 0 In : rbx - 11 Get last saved document rcx - Pointer to position in string Out: rax = string at [rcx], rbx = savetime in 1/1000hz 113 - Vertical and horizontal scroll bars In : rbx - 1 Vertical rcx - Value start rdx - Value size r8 - Current value r9 - X start in pixels r10 - Y start in pixels r11 - Y size in pixels Out: - In : rbx - 2 Horizontal rcx - Value start rdx - Value size r8 - Current value r9 - Y start in pixels r10 - X start in pixels r11 - X size in pixels Out: - In : rbx - 3 Remove scroll rcx - Value start Removes scroll with matching start value from the scroll list. Does not remove the scroll image. Out: - 114 - CD audio In : rbx - 1 Start Play rcx - Start Minute rdx - Start Second r8 - Start Frame r9 - End Minute r10 - End Second r11 - End Frame Out: - In : rbx - 2 Read TOC - type 2 rcx - Pointer to 4096 byte buffer Out: - In : rbx - 3 Pause Play Out: - In : rbx - 4 Open Tray Out: - 115 - PCI In : rbx - 1 Read dword rcx - Position Out: rax - Value 116 - Driver state access In : rbx - 1 - Read Device type rcx - Slot number ( 0+ ) rdx - Return pointer r8 - Bytes to return Out: rax - 0 Success - string returned to [rdx+] 1 Failed In : rbx - 2 - Read Manufacturer rcx - Slot number ( 0+ ) rdx - Return pointer r8 - Bytes to return Out: rax - 0 Success - string returned to [rdx+] 1 Failed In : rbx - 3 - Read Received bytes rcx - Slot number ( 0+ ) Out: rax - 0 Success - Received bytes returned in rbx 1 Failed In : rbx - 4 - Read Sent bytes rcx - Slot number ( 0+ ) Out: rax - 0 Success - Sent bytes returned in rbx 1 Failed In : rbx - 5 - Read Driver state rcx - Slot number ( 0+ ) Out: rax - 0 Success - State returned in rbx 1 Failed In : rbx - 101 - Load Device Driver rcx - Pointer to filename rdx - State ( 0 - Disable : 1 - Enable ) Out: rax - 0 Success 1 Failed 117 - Audio Audio out: In : rbx - 1 Reserve audio out Out: rax - 0 Success - 1 Fail In : rbx - 2 Give buffer data rcx - Pointer to data rdx - Buffer ( 0 or 1 ) Out: rax - 0 Success - 1 Fail In : rbx - 3 Start play Out: rax - 0 Success - 1 Fail In : rbx - 4 Get current play buffer Out: rbx - Buffer ( 0 or 1 ) rax - 0 Success - 1 Fail In : rbx - 5 Stop play Out: rax - 0 Success - 1 Fail In : rbx - 6 Mixer access - Available without reserving audio rcx - 0 Set main volume - rdx - (L 0-255) shl 8 + (R 0-255) rcx - 1 Set CD volume - rdx - (L 0-255) shl 8 + (R 0-255) rcx - 2 Set wave volume - rdx - (L 0-255) shl 8 + (R 0-255) rcx - 3 Set mic volume - rdx - (L 0-255) shl 8 + (R 0-255) Out: rax - 0 Success - 1 Fail rcx - 0x1000 Get main volume rcx - 0x1001 Get CD volume rcx - 0x1002 Get wave volume rcx - 0x1003 Get mic volume Out: rbx - (L 0-255) shl 8 + (R 0-255) rax - 0 Success - 1 Fail In : rbx - 7 Get list of supported wave out formats rcx - Index 0+ Index zero is reserved for 48khz, 16bit, stereo, signed little endian with 16384 byte buffer size. Drivers/applications must support atleast index zero. Use linear interpolation for internal frequences. Out: rcx - reserved rbx - bits 00-23 = Output frequency bits 24-31 = Bits per channel bits 32-39 = Channels bits 40-43 = 0 - non signed - lsB,..,msB 1 - signed - lsB,..,msB 2 - non signed - msB,..,lsB 3 - signed - msB,..,lsB bits 44-47 = Buffer count 0,1,2,..,15 -> 2,4,8,..,65536 bits 48-63 = Buffer size in bytes rbx = 0x400001021000BB80 for index zero Indexes one and above may be defined at audio card driver according to other audio card properties. rax - 0 Success - 1 Fail ( read past last index or audio disabled ) In : rbx - 8 Set wave buffer format (fn117/2) rcx - Index 0+ Out: rax - 0 Success - 1 Fail In : rbx - 255 Free device Out: rax - 0 Success - 1 Fail Audio in: In : rbx - 1001 Reserve audio in Out: rax - 0 Success - 1 Fail In : rbx - 1002 Get buffer data rcx - Pointer to data area rdx - Buffer ( 0 or 1 ) Out: rax - 0 Success - 1 Fail In : rbx - 1003 Start recording Out: rax - 0 Success - 1 Fail In : rbx - 1004 Get current record buffer Out: rbx - Buffer ( 0 or 1 ) rax - 0 Success - 1 Fail In : rbx - 1005 Stop recording Out: rax - 0 Success - 1 Fail In : rbx - 1006 Mixer access - Available without reserving audio rcx - 0 Set microphone volume - rdx - (L 0-255) shl 8+(R 0-255) Out: rax - 0 Success - 1 Fail rcx - 1 Set microphone boost state - rdx=0/1-disable/enable Out: rax - 0 Success - 1 Fail rcx - 0x1000 Get microphone volume Out: rbx - (L 0-255) shl 8 + (R 0-255) rax - 0 Success - 1 Fail rcx - 0x1001 Get microphone boost state Out: rbx - 0/1 Disabled/enabled rax - 0 Success - 1 Fail In : rbx - 1007 Get list of supported wave in formats rcx - Index 0+ Index zero is reserved for 48khz, 16bit, stereo, signed little endian with 16384 byte buffer size. Drivers/applications must support atleast index zero. Use linear interpolation for internal frequences. Out: rcx - reserved rbx - bits 00-23 = Input frequency bits 24-31 = Bits per channel bits 32-39 = Channels bits 40-43 = 0 - non signed - lsB,..,msB 1 - signed - lsB,..,msB 2 - non signed - msB,..,lsB 3 - signed - msB,..,lsB bits 44-47 = Buffer count 0,1,2,..,15 -> 2,4,8,..,65536 bits 48-63 = Buffer size in bytes rbx = 0x400001021000BB80 for index zero Indexes one and above may be defined at audio card driver according to other audio card properties. rax - 0 Success - 1 Fail ( read past last index or audio disabled ) In : rbx - 1008 Set wave buffer format (fn117/1002) rcx - Index 0+ Out: rax - 0 Success - 1 Fail In : rbx - 1255 Free device Out: rax - 0 Success - 1 Fail 118 - MIDI In : rbx - 1 Reserve midi device Out: rax - 0 Success - 1 Fail In : rbx - 2 Send data cl - Byte Out: rax - 0 Success - 1 Fail In : rbx - 3 Get data Out: rax - 0 Success -> bl - byte - 1 Fail In : rbx - 255 Free midi device Out: rax - 0 Success - 1 Fail 119 - Draw Circle In : rbx - X start rcx - Y start r8 - Radius (bit 63=0/1=no/yes filled circle) rsi - Color (0xrrggbb,bit 63-0/1-yes/no transparency update) Out: - 120 - Window Skinning In : rbx - 1 - Load skin type 1 (96x80x24bpp) rcx - Pointer to filename Skinfile: Active window 96x38 - Window frame 96x01 - Not used 39pix - Window scroll: body, buttons, background 48pix - Not used 04pix - Drop down menu border colors: Left, Right, Bottom, Separator 05pix Main menu text color Dropdown menu text color Window label color Menu background color Menu select background color Passive window 96x38 - Window frame 96x01 - Not used 26pix - Window scroll: body, buttons 65pix - Not used 05pix - Main menu text color Not used Window label color Not used Not used Out: rax - 0 Success 1 Failed In : rbx - 2 - Disable/Enable skinning rcx - 0 - Disable : 1 - Enable Out: rax - 0 Success 1 Failed In : rbx - 3 - Redraw desktop windows Out: rax - 0 Success 1 Failed In : rbx - 11 - Set x,y difference for all drawed objects rcx - X difference rdx - Y difference Out: rax - 0 Success 1 Failed In : rbx - 12 - Set skin 2 parameters rcx - Grab area height rdx - Menu area height r8 - Skin width at left and right r9 - Skin height at bottom r10 - Round corners at up/up&down (1/2) Out: rax - 0 Success 1 Failed In : rbx - 13 - Set skin 2 parameters rcx - Close button (x shl 32 + y) rdx - Max button (x shl 32 + y) r8 - Min button (x shl 32 + y) Bit 63 = 0/1 - relative to left/right window corner Out: rax - 0 Success 1 Failed In : rbx - 14 - Load skin type 2 (384x284x24bpp) rcx - Pointer to filename or zero to disable skin type 2 Out: rax - 0 Success 1 Failed In : rbx - 15 - Get window body area size Out: rax - Body area X shl 32 + Y In : rbx - 16 - Load user font for skin type 2 (1024x24x24bpp) rcx - Pointer to filename or zero to disable font Out: rax - 0 Success 1 Failed 121 - Drag'n drop In : rbx - 1 - Define Drag'n drop area rcx - Pointer to area (mainmem) rdx - Size of area Out: rax - 0 Success 1 Failed In : rbx - 2 - Give Drag'n drop data rcx - Pointer to asciiz (';' separates filenames, mainmem) Out: rax - 0 Success 1 Failed 122 - 3D API See 3D.ASM for details In : rbx - 1 - Init rcx - Field address Out: rax - 0 Success 1 Failed In : rbx - 2 - Set pixel in field rcx - Field address rdx - X r8 - Y r9 - Z r10 - Color/mirror/transparent 0x01RRGGBB = Color 0x020000DD = Transparent ( DD = dimming strength ) 0x030000DD = Mirror ( X axis, DD = dimming strength ) 0x040000DD = Mirror ( Y axis, DD = dimming strength ) 0x050000DD = Mirror ( Z axis, DD = dimming strength ) Out: rax - 0 Success 1 Failed In : rbx - 3 - Get pixel in field rcx - Field address rdx - X r8 - Y r9 - Z Out: rax - 0 Success 1 Failed rbx - Color/mirror/transparent In : rbx - 4 - Preprocess field rcx - Field address Out: rax = 0 - rbx = number of pixels left of 256*256*256 to process In : rbx - 5 - Calculate 2D picture from 3D area rcx - Field address rdx - 0xXXDDDD, XX = camera X position, D.. = fraction r8 - 0xYYDDDD, YY = camera Y position, D.. = fraction r9 - 0xZZDDDD, ZZ = camera Z position, D.. = fraction r10 - Horizontal angle (0-3600) r11 - bits 00-15 - 2D pictures X size bits 16-63 - Reserved r12 - bits 00-15 - 2D pictures Y size bits 16-31 - Reserved bits 32-47 - End line for calculations (smp) bits 48-63 - Start line for calculations (smp) If bits 32-63 are set to zero, then all lines are calculated. r13 - Pointer to target picture memory Out: rax - Status (0/1=Success/fail) [r13+] - Target 2D picture, size r11w x r12w (4 byte aligned) In : rbx - 6 - Get Sin/Cos rcx - 0-3600 Out: rax & rbx - Sin/Cos 123 - Wait for event with timeout (ms) In : rbx - Delay in 1/1000s Out: rax - Bitfield of event(s) 124 - Window hide, show, activate In : rbx - 1 - Hide window rcx - PID Out: rax - 0 Success 1 Failed In : rbx - 2 - Show window rcx - PID Out: rax - 0 Success 1 Failed In : rbx - 3 - Activate window rcx - PID Out: rax - 0 Success 1 Failed In : rbx - 4 - Enable window activate by mouse rcx - 0/1 - enabled/disabled 2 - Open as modal dialog window - keep current processes window above starter processes window Out: rax - 0 Success 1 Failed 125 - Window transparency In : rbx - 1 - Get update interval Out: rax - Update interval (ms) In : rbx - 2 - Set update interval rcx - Interval (ms) Out: rax - 0 Success 1 Failed In : rbx - 3 - Get transparency state Out: rax - 0 - Disabled 1 - Enabled for window title and frames 2 - Enabled for window title, menu and frames In : rbx - 4 - Get window pixel rcx - PID rdx - X r8 - Y Out: rax - Pixel In : rbx - 5 - Get opacity value Out: rax - 0-8 In : rbx - 6 - Set opacity value rcx - 0-8 Out: rax - 0 Success 1 Failed In : rbx - 7 - Get window move type Out: rax - 0/1 = frames or content In : rbx - 8 - Set window move type rcx - 0/1 = frames or content Out: rax - 0 Success 1 Failed In : rbx - 9 - Get window move interval Out: rax - times/second In : rbx - 10 - Set window move interval rcx - times/second Out: rax - 0 Success 1 Failed In : rbx - 11 - Force frame move for process window rcx - 0/1 = disabled/enabled Out: rax - 0 Success 1 Failed In : rbx - 12 - Get transparency background filter Out: rax - 0-7 In : rbx - 13 - Set transparency background filter rcx - 0-7 Out: rax - 0 Success 1 Failed In : rbx - 14 - Force processes window preview update rcx - PID Out: rax - 0 Success 1 Failed In : rbx - 15 - Get scaled preview image rcx - PID rdx - Memory location r8 - X size r9 - Y size r10 - Pixel alignment Out: rax - 0 Success, scaled image at [rdx+] 1 Failed In : rbx - 16 - Set transparency state rcx - 1 - Enabled for window title and frames 2 - Enabled for window title, menu and frames Out: rax - 0 Success 1 Failed In : rbx - 17 - Get window corner state Out: rax - 0 Round 1 Sharp In : rbx - 18 - Set window corner state rcx - 0 Round 1 Sharp Out: rax - 0 Success 1 Failed 126 - Switch process to 32bit or 64bit mode In : rbx - 1 - Switch process to 32bit mode Called from 64bit mode Out: eax - 0 - Success 1 - Fail In : ebx - 2 - Switch process to 64bit mode Called from 32bit mode Out: rax - 0 - Success 1 - Fail After system call, execution continues from the following (32 or 64 bit) instruction. 127 - USB 2.0 device information In : rbx - 1 - Return USB state Out: rax - 0 - Disabled 1 - Enabled 2+ - Error code In : rbx - 2 - Information by local port rcx - Port Out: rax - 0 - No device 1 - 1.x device, port disabled 2 - 2.0 device In : rbx - 3 - USB 2.0 manufacturer string rcx - Device address (equals port for 1-16) rdx - Data area r8 - Number of bytes to return Out: [rdx+] - Manufacturer string (asciiz) In : rbx - 4 - USB 2.0 device string rcx - Device address (equals port for 1-16) rdx - Data area r8 - Number of bytes to return Out: [rdx+] - Device string (asciiz) In : rbx - 5 - USB 2.0 device path rcx - Device address (equals port for 1-16) rdx - Data area r8 - Number of bytes to return Out: [rdx+] - Path string (asciiz) In : rbx - 6 - USB 2.0 device descriptor rcx - Device address (equals port for 1-16) rdx - 1 - device descriptor r8 - Position in descriptor Out: rax - (0/1=success/fail) shl 8 + (descriptor byte) In : rbx - 20 - Write cache sector to /USB/1/ rcx - Sector 0 - (80*2*18-1) Out: rax - 0 = Success, other = fail In : rbx - 21 - Read sector from /USB/1/ rcx - Sector rdx - Pointer to return area (512 bytes, mainmem) Out: rax - 0 = Success, other = fail 128 - USB 2.0 webcam interface In : rbx - 1 - Return used webcam slots Out: rbx:rax - Bitfield of used webcam device addresses In : rbx - 2 - Get webcam configurations rcx - Device address (1+) rdx - Configuration (1+) Out: rax - 0 = No device, Other = Last configuration rbx - X shl 32 + Y shl 16 + Z X = 1 - YUV422 Y = bitfield of supported resolutions 3 - MJPEG bit 0 - 160x120 (4:3) bit 1 - 320x240 (4:3) bit 2 - 640x480 (4:3) Z = Packet size bit 3 - 960x544 (16:9) bit 4 - 1280x720 (16:9) bit 5 - 1600x900 (16:9) bit 6 - 1920x1080 (16:9) In : rbx - 3 - Set webcam configuration (reserve/free) rcx - Device address (1+) rdx - Configuration (1+) or zero to release device Out: rax - 0 = Success, Other = Fail, rbx = 0 In : rbx - 4 - Turn camera on/off rcx - Device address (1+) rdx - On/off (1/0) Out: rax - 0 = Success, Other = Fail In : rbx - 5 - Get webcam picture data stream rcx - Device address (1+) rdx - Data return area (mainmem) r8 - Data size return area (mainmem) r9 - Buffercount shl 32 + Datacount (8*packet size) If buffercount>0 and [r8-8]='REPEAT' then function advances to next buffers, which are written after previous buffers. Current readbuffer is written to byte [r8-1]. Out: rax = 0 , rbx = 0 [rdx+] - Data from device at packetsize intervals [r8+] - Packet size and status at qword intervals bits 00-11 - Amount of data from device bit 12 - Transaction error, bit 13 - Babble detected bit 14 - Data buffer error, bit 15 - Active buffer 129 - USB 2.0 printer interface In : rbx - 1 - Return connected printers Out: rbx:rax - Bitfield of connected printers In : rbx - 2 - Get printer configuration rcx - Device address (1+) Out: rax - 0xAABBCCDDEEFFGGHH AA,BB,CC,DD = Margins in cm (top,left,right,bottom) EE = 1 - 75 dpi : 2 - 150 dpi : 3 - 300 dpi : 4 - 600 dpi FF = 1 - A4 GG = 01 - ASCII HH = 0 USB 2.0 - No device 2 - B4 30 - PCL3 1 USB 2.0 - Connected 3 - Letter 55 - PCL5c 2 Network printer 4 - Legal 102 - Postscript2 rbx - 0xAAAAAAAAEEEEGGHH AA = Network printer IP EE = Network printer port GG = Data sent to: 0 = USB 2.0 - 1 = Network HH = Data sent in prosentages In : rbx - 3 - Set printer configuration rcx - Device address (1+) rdx - 0xAABBCCDDEEFFGG00 r8 - 0xIIIIIIIIJJJJKK00 AA,BB,CC,DD = Margins in cm (top,left,right,bottom) FF = 1 - A4 GG = 01 - ASCII EE = 1 - 75 dpi 2 - B4 30 - PCL3 2 - 150 dpi 3 - Letter 55 - PCL5c 3 - 300 dpi 4 - Legal 102 - Postscript2 4 - 600 dpi II = Network printer IP JJ = Network printer port KK = Send data to: 0 = USB 2.0 - 1 = Network Out: rax - 0 = Success, Other = Fail, rbx = 0 In : rbx - 4 - Return maximum print area in pixels rcx - Device address (1+) Out: rax - 0 = Success, Other = Fail rbx - Maximum print size in pixels - X shl 32 + Y In : rbx - 5 - Send image to printer rcx - Device address (1+) rdx - Size : X shl 32 + Y r8 - Pointer to data (RRGGBB,..) (mainmem) Out: rax - 0 = Success, Other = Fail, rbx = 0 In : rbx - 6 - Send ascii text to printer rcx - Device address (1+) rdx - Amount of data to send in bytes r8 - Pointer to text data (mainmem) Out: rax - 0 = Success, Other = Fail, rbx = 0 In : rbx - 7 - Get data for network printer rcx - Device address (1+) rdx - Data return address (mainmem) r8 - Current printing status (4=fine, other=fail) Out: rax - 0 = Success, rbx = data size (max 64), [rdx+] = data Other = Fail, rbx = 0 130 - USB 2.0 tuner interface In : rbx - 1 - Return used tuner slots Out: rbx:rax - Bitfield of used tuner device addresses In : rbx - 2 - Reserve device rcx - Dev num (1+) Out: rax - 0 = Success, Other = Fail, rbx = 0 Following functions require reservation and are for device 1. In : rbx - 3 - Free device rcx - Dev num (1+) Out: rax - 0 = Success, Other = Fail, rbx = 0 In : rbx - 5 - Get USB ID Out: rax - 0 = success, rbx - 0xYYYYZZZZ Device/Manufacturer In : rbx - 10 - Bulk out rsi - Pointer to data (mainmem) rcx - Data length rdx - Endpoint r8 - Endpoint size Out: rax - 0 = Success, 1 = Fail, rbx = 0 In : rbx - 11 - Bulk in rdi - Pointer to data receive area (mainmem) rcx - Data length rdx - Endpoint r8 - Endpoint size Out: rax - 0 = Success, 1 = Fail, rbx = qtd bits, [rdi+] - Data In : rbx - 12 - Bulk in repeat rdi - Pointer to data receive area (mainmem) rcx - Data read size rdx - Endpoint r8 - Endpoint size r9 - Repeat num Out: rax - 0 = Success, 1 = Fail, rbx = 0, [rdi+] - Data Note: After all packets are received and [rdi] contains 'REPEAT'-string, the syscall is re-executed before returning to application. In : rbx - 15 - Control message rsi - Value (word) rcx - Index (word) rdi - Direction (0=out,1=in) r9 - Tx/rx data position r8 - Tx/rx length rdx - Endpoint r10 - Packet second byte r11 - Packet first byte Out: rax - 0 = Success, 1 = Fail, rbx = 0, [r9+] - Data In : rbx - 20 - Clear endpoint rcx - Direction (0=out,1=in) rdx - 0x00 ; receiver endpoint r8 - 0x01 ; usb_req_clear_feature r9 - 0x02 ; usb recip type = endpoint r10 - 0x00 ; usb_endpoint_halt r11 - endpoint to clear Out: rax = 0, rbx = 0 131 - USB 1.X device information In : rbx - 1 - Get USB 1.X status (ohci) Out: rax - 0/1/2+ = Disabled/Enabled/Fail rbx - 0 or controller count In : rbx - 2 - Get USB 1.X status (uhci) Out: rax - 0/1/2+ = Disabled/Enabled/Fail rbx - 0 or controller count In : rbx - 11 - Get Mouse/Keyboard status Out: rax - bit 00 - 0/1 - Mouse disconnected/connected bits 08-15 - controller num. bits 16-24 - controller port rbx - bit 00 - 0/1 - Keyboard disconnected/connected bits 08-15 - controller num. bits 16-24 - controller port In : rbx - 12 - Get controller port status rcx - Controller num. rdx - Controller port Out: rax - 0/1 - Device disconnected/connected rbx - 0 132 - USB 1.1 midi device interface In : rbx - 1 - Return used midi device slots Out: rbx:rax - Bitfield of used midi device addresses In : rbx - 2 - Reserve device rcx - Dev num (1+) Out: rax - 0 = Success, Other = Fail In : rbx - 3 - Send mididata to device (5.5 second timeout) rcx - Dev num (1+) rdx,r8-r14 - Max 64 bytes of midi-data. Unused data needs to be set to zero. f.ex. E-major = rdx=0x4040900940449009 and r8=0x40479009 with r9-r14 set to zero. See usb midi protocol for packet details. It might take a few packets for device synchronization. Note: Use with int 0x60 -system call only. Out: rax - 0 = success, Other = fail In : rbx - 4 - Read mididata from device (5.5 second timeout) rcx - Dev num (1+) Out: rax - 0 = success, Other = fail rdx,r8-14 - Max 64 bytes of midi-data. In : rbx - 5 - Free device rcx - Dev num (1+) Out: rax - 0 = Success, Other = Fail 140 - Multi-Processor interface In : rbx - 1 - Get SMP status Out: rax - 0 rbx - SMP status In : rbx - 2 - Get CPU count Out: rax - 0 rbx - CPU count (1+) In : rbx - 3 - Create SMP thread rcx - Pointer to thread start (mainmem) rdx - Stack position (mainmem) rdi - Target CPU (0+) If SMP is not enabled, this will create a reqular thread. If target CPU is above available CPU count, target CPU will wrap around from zero. Out: rax - 0 - Success rbx - Thread PID rax - 1 - Fail In : rbx - 4 - Move current process/thread to wanted CPU rcx - Target CPU (0+) Out: rax - 0 rbx - 0 141 - System font In : rbx - 1 - Enable system font rcx - Font num (low 32bits) rdx - Font size limit x: 5 shl 32 + 5 (fixed for now) r8 - Font size limit y: 9 shl 32 + 12 (fixed for now) Out: rax - 0 Success - 1 Fail In : rbx - 2 - Set system font size rcx - [x] shl 32 + [y] - x = 5 : y = 9-12 Out: rax - 0 Success - 1 Fail In : rbx - 3 - Get system font size for application Out: rax - [x] shl 32 + [y] 142 - Copy/paste In : rbx - 1 - Write data to copy/paste area rcx - Type - 0=no data:1=ascii text:2=image:3-255=reserv. rdx - text length or image x size r8 - text (ignored) or image y size r9 - Pointer to data start at copy/paste area r10 - Pointer to data at application memory Ascii text or 3-byte aligned RGB image r11 - Amount of data to write Out: rax = 0/1 - success/fail - rbx=0 - rcx=0 In: rbx - 2 - Read data from copy/paste rcx - Pointer to data start at copy/paste area rdx - Pointer to data at application memory r8 - Amount of data to read Out: rax - type : rbx - text length or image x size rcx - text (ignored) or image y size In: rbx - 3 - Clear copy/paste area Out: rax = 0 - rbx = 0 - rcx = 0 143 - Gzip In : rbx - 1 - Uncompress Gzip rcx - Pointer to gzip data rdx - Size of gzip data r8 - Pointer to work area (16384 bytes) r9 - Pointer to return area Out: rax = 0/1 - success/fail - rbx = return data size 144 - Graphics driver In : rbx - 1 - Get driver info Out: rax - 0/1 - disabled/enabled rbx - - bitfield of supported functions In : rbx - 3 - Get available display modes rcx - Entry num (0+) Out: rax - 0/1 - present/not found rbx - 0 - parameter format rcx - - x resolution rdx - - y resolution r8 - - frequency (in 0.01 hz's) r9 - - lfb start r10 - - scanline in bytes r11 - - bytes per pixel (3/4) In : rbx - 4 - Set display mode rcx - x resolution rdx - y resolution r8 - frequency (in 0.01 hz's) r9 - lfb start r10 - scanline in bytes r11 - bytes per pixel (3/4) Out: rax - 0/1 - success/fail rbx - 0 - parameter format rcx - - x resolution rdx - - y resolution r8 - - frequency (in 0.01 hz's) r9 - - lfb start r10 - - scanline in bytes r11 - - bytes per pixel (3/4) In : rbx - 5 - Get current display mode Out: rax - 0/1 - success/fail rbx - 0 - parameter format rcx - - x resolution rdx - - y resolution r8 - - frequency (in 0.01 hz's) r9 - - lfb start r10 - - scanline in bytes r11 - - bytes per pixel (3/4) 145 - Window menu control In : rbx - 1 - Get window menu state Out: rax - 0/1/2 - closed/open/close request In : rbx - 2 - Set window menu close request Out: rax - 0 150 - Audio and signal processing (FFT,resampling,equalizer) In : rbx - 01 - Define work area for processing rcx - Pointer to work memory area or zero to disable, one for each process thread. rdx - Work memory size (256k+) Out: rax - 0/other - success/fail [rcx+] - Initialized work memory area (dq num.entries,0,start,size,start,size,..) NOTE: Calls 11-14 are superseded by calls 16 & 17 In: rbx - 11 - Create FFT4 table rcx - n (max length 2^n) Out: rax - *table or zero In: rbx - 12 - Destroy FFT4 table rcx - *table Out: rax - In: rbx - 13 - Complex to complex in-place forward FFT (Radix-4 decimation in time) rcx - n (length 2^n) rdx - *RI (interleaved real & imaginary array, double) r8 - *fft4 table r9 - *aux buffer (16-byte aligned length (2^n)*16 ) or zero Out: rax - NOTE: RI must be aligned on a 16-byte boundary elements of RI must be divided by 2^n before calling inverse FFT USED: xmm0-xmm15 In: rbx - 14 - Complex to complex in-place inverse FFT (Radix-4 decimation in time) rcx - n (length 2^n) rdx - *RI (interleaved real & imaginary array, double) r8 - *fft4 table r9 - *aux buffer (16-byte aligned length (2^n)*16 ) or zero Out: rax - NOTE: RI must be aligned on a 16-byte boundary USED: xmm0-xmm15 In: rbx - 16 - Complex to complex in-place forward FFT (split-radix DIF) rcx - n (length n) rdx - *RI (interleaved real & imaginary array, double) Out: rax - In: rbx - 17 - Complex to complex in-place inverse FFT (split-radix DIF) rcx - n (length n) rdx - *RI (interleaved real & imaginary array, double) Out: rax - In: rbx - 21 - Sample converter init rcx - *sciface [out] rdx - (max number of samples * max number of input channels) or zero r8 - (max number of samples * max number of output channels) or zero Out: rax - sc_lasterror NOTE: every successful call to sc_init involves a call to sc_deinit In: rbx - 22 - Sample converter deinit rcx - sciface Out: rax - SC_ERR_OK In: rbx - 23 - Convert samples to internal format (32-bit float) rcx - sciface rdx - *in r8 - *out or zero r9 - number of samples or zero r10 - in format Out: rax - number of bytes read from "in" In: rbx - 24 - Reassign channels rcx - sciface rdx - *in or zero r8 - *out or zero r9 - number of samples or zero r10 - in format << 32 + out format r11 - *channel reassignment list or zero Out: rax - SC_ERR_OK In: rbx - 25 - Convert samples from internal format rcx - sciface rdx - *in or zero r8 - *out r9 - number of samples or zero r10 - out format Out: rax - number of bytes written to "out" In: rbx - 26 - Change sample precision rcx - sciface rdx - *inout or zero r8 - number of samples or zero r9 - in format << 32 + out format Out: rax - SC_ERR_OK In: rbx - 27 - Get internal buffers rcx - sciface rdx - *in buffer [out] r8 - *out buffer [out] Out: rax - SC_ERR_OK In: rbx - 31 - FFT convolution init rcx - *fftcviface rdx - max length Out: rax - fftcv_lasterror NOTE: every successful call to fftcv_init involves a call to fftcv_deinit In: rbx - 32 - FFT convolution deinit rcx - fftcviface Out: rax - FFTCV_ERR_OK In: rbx - 33 - FFT convolution calculate coefficients rcx - fftcviface rdx - n (fft length 2^n) << 32 + numbands r8 - *bandindices r9 - *bandgains r10 - *phasetab Out: rax - FFTCV_ERR_OK In: rbx - 41 - FFT convolution init multi-channel rcx - *fmchiface [out] rdx - max length r8 - in sc format << 32 + out sc format Out: rax - fftcv_lasterror NOTE: every successful call to fftcv_init_mch involves a call to fftcv_deinit_mch In: rbx - 42 - FFT convolution deinit multi-channel rcx - fmchiface Out: rax - FFTCV_ERR_OK In: rbx - 43 - FFT convolution process multi-channel rcx - fmchiface rdx - *in r8 - *out r9 - number of samples or -1/-2 for trailing delay / delay length Out: rax - number of samples processed In: rbx - 44 - FFT convolution set coefficients multi-channel rcx - fmchiface rdx - *list of fftcvifaces Out: rax - fftcv_lasterror In: rbx - 45 - FFT convolution flush buffers multi-channel rcx - fmchiface Out: rax - FFTCV_ERR_OK In: rbx - 46 - FFT convolution set state multi-channel rcx - fmchiface rdx - statemask << 32 + state Out: rax - FFTCV_ERR_OK In: rbx - 47 - FFT convolution stream get info rcx - stream type rdx - stream param 1 r8 - stream param 2 r9 - wfcinfo [out] Out: rax - FFTCV_ERR_OK or a valid errorcode In: rbx - 48 - FFT convolution stream process rcx - max length shl 32 + stream type rdx - stream param 1 r8 - stream param 2 r9 - in sc format shl 32 + out sc format r10 - *list of fftcvifaces r11 - *output [out] Out: rax - FFTCV_ERR_OK or a valid errorcode In: rbx - 51 - Create SINC filter table rcx - sinc table name rdx - *sinc table [out] r8 - *table size or zero [out] Out: rax - sinc_lasterror In: rbx - 52 - Destroy SINC filter table rcx - sinc table Out: rax - SINC_ERR_OK In: rbx - 61 - SINC init multi-channel rcx - *smchiface [out] rdx - sinc table r8 - in sc format << 32 + out sc format xmm0 - max downsampling ratio (double) xmm1 - max upsampling ratio (double) Out: rax - sinc_lasterror NOTE: every successful call to sinc_init_mch involves a call to sinc_deinit_mch In: rbx - 62 - SINC deinit multi-channel rcx - smchiface Out: rax - SINC_ERR_OK In: rbx - 63 - SINC process multi-channel rcx - smchiface rdx - *in r8 - *out r9 - number of samples or -1/-2 for trailing delay / delay length xmm0 - input rate (double) xmm1 - output rate (double) Out: rax - number of samples processed In: rbx - 64 - SINC flush buffers multi-channel rcx - smchiface Out: rax - SINC_ERR_OK In: rbx - 65 - Sinc resampling stream get info rcx - stream type rdx - stream param 1 r8 - stream param 2 r9 - wfcinfo [out] Out: rax - SINC_ERR_OK or a valid errorcode In: rbx - 66 - Sinc resampling stream process rcx - sinctable name shl 32 + stream type rdx - stream param 1 r8 - stream param 2 r9 - in sc format shl 32 + out sc format r10 - input rate shl 32 + output rate r11 - *output [out] Out: rax - SINC_ERR_OK or a valid errorcode In: rbx - 71 - Wave format converter init rcx - stream type rdx - stream param 1 r8 - stream param 2 r9 - *wfciface [out] r10 - *wfcinfo [out] Out: rax - wfc_lasterror NOTE: every successful call to wfc_init involves a call to wfc_deinit In: rbx - 72 - Wave format converter deinit rcx - wfciface Out: rax - WFC_ERR_OK In: rbx - 73 - Wave format converter read rcx - wfciface rdx - *out r8 - number of samples to read Out: rax - number of samples read 151 - Mathlib NOTE: Volatile registers for every math function: rax,rbx and xmm0-xmm5 Packed double In : rbx - 00 - cosine packed double xmm0 - x Out: xmm0 - cos(x) In : rbx - 01 - sine packed double xmm0 - x Out: xmm0 - sin(x) In : rbx - 02 - sincos packed double xmm0 - x Out: xmm0 - sin(x) xmm1 - cos(x) In : rbx - 03 - tangent packed double xmm0 - x Out: xmm0 - tan(x) In : rbx - 04 - arc tangent packed double xmm0 - x Out: xmm0 - atan(x) In : rbx - 05 - arc tangent of y/x packed double xmm0 - y xmm1 - x Out: xmm0 - atan2(y,x) In : rbx - 06 - arc cosine packed double xmm0 - x Out: xmm0 - acos(x) In : rbx - 07 - arc sine packed double xmm0 - x Out: xmm0 - asin(x) In : rbx - 08 - power packed double xmm0 - x xmm1 - y Out: xmm0 - pow(x,y) In : rbx - 09 - cube root packed double xmm0 - x Out: xmm0 - cbrt(x) In : rbx - 10 - exponent base e packed double xmm0 - x Out: xmm0 - exp(x) In : rbx - 11 - exponent base 2 packed double xmm0 - x Out: xmm0 - exp2(x) In : rbx - 12 - exponent base 10 packed double xmm0 - x Out: xmm0 - exp10(x) In : rbx - 13 - logarithm base e packed double xmm0 - x Out: xmm0 - log(x) In : rbx - 14 - logarithm base 2 packed double xmm0 - x Out: xmm0 - log2(x) In : rbx - 15 - logarithm base 10 packed double xmm0 - x Out: xmm0 - log10(x) In : rbx - 16 - exponent base e minus 1 packed double xmm0 - x Out: xmm0 - exp(x)-1 NOTE: exp(x)-1 is not truly implemented In : rbx - 17 - logarithm base e x plus 1 packed double xmm0 - x Out: xmm0 - log(1+x) NOTE: log(1+x) is not truly implemented In : rbx - 18 - ldexp packed double xmm0 - x xmm1 - q Out: xmm0 - x * 2^q NOTE: q is a packed dword integer In : rbx - 19 - ilogb (extract exponent) packed double xmm0 - x Out: xmm0 - (int)logb(x) NOTE: return value is a packed dword integer Scalar double In : rbx - 20 - cosine scalar double xmm0 - x Out: xmm0 - cos(x) In : rbx - 21 - sine scalar double xmm0 - x Out: xmm0 - sin(x) In : rbx - 22 - sincos scalar double xmm0 - x Out: xmm0 - sin(x) xmm1 - cos(x) In : rbx - 23 - tangent scalar double xmm0 - x Out: xmm0 - tan(x) In : rbx - 24 - arc tangent scalar double xmm0 - x Out: xmm0 - atan(x) In : rbx - 25 - arc tangent of y/x scalar double xmm0 - y xmm1 - x Out: xmm0 - atan2(y,x) In : rbx - 26 - arc cosine scalar double xmm0 - x Out: xmm0 - acos(x) In : rbx - 27 - arc sine scalar double xmm0 - x Out: xmm0 - asin(x) In : rbx - 28 - power scalar double xmm0 - x xmm1 - y Out: xmm0 - pow(x,y) In : rbx - 29 - cube root scalar double xmm0 - x Out: xmm0 - cbrt(x) In : rbx - 30 - exponent base e scalar double xmm0 - x Out: xmm0 - exp(x) In : rbx - 31 - exponent base 2 scalar double xmm0 - x Out: xmm0 - exp2(x) In : rbx - 32 - exponent base 10 scalar double xmm0 - x Out: xmm0 - exp10(x) In : rbx - 33 - logarithm base e scalar double xmm0 - x Out: xmm0 - log(x) In : rbx - 34 - logarithm base 2 scalar double xmm0 - x Out: xmm0 - log2(x) In : rbx - 35 - logarithm base 10 scalar double xmm0 - x Out: xmm0 - log10(x) In : rbx - 36 - exponent base e minus 1 scalar double xmm0 - x Out: xmm0 - exp(x)-1 NOTE: exp(x)-1 is not truly implemented In : rbx - 37 - logarithm base e x plus 1 scalar double xmm0 - x Out: xmm0 - log(1+x) NOTE: log(1+x) is not truly implemented In : rbx - 38 - ldexp scalar double xmm0 - x xmm1 - q Out: xmm0 - x * 2^q NOTE: q is a scalar dword integer In : rbx - 39 - ilogb (extract exponent) scalar double xmm0 - x Out: xmm0 - (int)logb(x) NOTE: return value is a scalar dword integer Packed single In : rbx - 40 - cosine packed single xmm0 - x Out: xmm0 - cos(x) In : rbx - 41 - sine packed single xmm0 - x Out: xmm0 - sin(x) In : rbx - 42 - sincos packed single xmm0 - x Out: xmm0 - sin(x) xmm1 - cos(x) In : rbx - 43 - tangent packed single xmm0 - x Out: xmm0 - tan(x) In : rbx - 44 - arc tangent packed single xmm0 - x Out: xmm0 - atan(x) In : rbx - 45 - arc tangent of y/x packed single xmm0 - y xmm1 - x Out: xmm0 - atan2(y,x) In : rbx - 46 - arc cosine packed single xmm0 - x Out: xmm0 - acos(x) In : rbx - 47 - arc sine packed single xmm0 - x Out: xmm0 - asin(x) In : rbx - 48 - power packed single xmm0 - x xmm1 - y Out: xmm0 - pow(x,y) In : rbx - 49 - cube root packed single xmm0 - x Out: xmm0 - cbrt(x) In : rbx - 50 - exponent base e packed single xmm0 - x Out: xmm0 - exp(x) In : rbx - 51 - exponent base 2 packed single xmm0 - x Out: xmm0 - exp2(x) In : rbx - 52 - exponent base 10 packed single xmm0 - x Out: xmm0 - exp10(x) In : rbx - 53 - logarithm base e packed single xmm0 - x Out: xmm0 - log(x) In : rbx - 54 - logarithm base 2 packed single xmm0 - x Out: xmm0 - log2(x) In : rbx - 55 - logarithm base 10 packed single xmm0 - x Out: xmm0 - log10(x) In : rbx - 56 - exponent base e minus 1 packed single xmm0 - x Out: xmm0 - exp(x)-1 NOTE: exp(x)-1 is not truly implemented In : rbx - 57 - logarithm base e x plus 1 packed single xmm0 - x Out: xmm0 - log(1+x) NOTE: log(1+x) is not truly implemented In : rbx - 58 - ldexp packed single xmm0 - x xmm1 - q Out: xmm0 - x * 2^q NOTE: q is a packed dword integer In : rbx - 59 - ilogb (extract exponent) packed single xmm0 - x Out: xmm0 - (int)logb(x) NOTE: return value is a packed dword integer Scalar single In : rbx - 60 - cosine scalar single xmm0 - x Out: xmm0 - cos(x) In : rbx - 61 - sine scalar single xmm0 - x Out: xmm0 - sin(x) In : rbx - 62 - sincos scalar single xmm0 - x Out: xmm0 - sin(x) xmm1 - cos(x) In : rbx - 63 - tangent scalar single xmm0 - x Out: xmm0 - tan(x) In : rbx - 64 - arc tangent scalar single xmm0 - x Out: xmm0 - atan(x) In : rbx - 65 - arc tangent of y/x scalar single xmm0 - y xmm1 - x Out: xmm0 - atan2(y,x) In : rbx - 66 - arc cosine scalar single xmm0 - x Out: xmm0 - acos(x) In : rbx - 67 - arc sine scalar single xmm0 - x Out: xmm0 - asin(x) In : rbx - 68 - power scalar single xmm0 - x xmm1 - y Out: xmm0 - pow(x,y) In : rbx - 69 - cube root scalar single xmm0 - x Out: xmm0 - cbrt(x) In : rbx - 70 - exponent base e scalar single xmm0 - x Out: xmm0 - exp(x) In : rbx - 71 - exponent base 2 scalar single xmm0 - x Out: xmm0 - exp2(x) In : rbx - 72 - exponent base 10 scalar single xmm0 - x Out: xmm0 - exp10(x) In : rbx - 73 - logarithm base e scalar single xmm0 - x Out: xmm0 - log(x) In : rbx - 74 - logarithm base 2 scalar single xmm0 - x Out: xmm0 - log2(x) In : rbx - 75 - logarithm base 10 scalar single xmm0 - x Out: xmm0 - log10(x) In : rbx - 76 - exponent base e minus 1 scalar single xmm0 - x Out: xmm0 - exp(x)-1 NOTE: exp(x)-1 is not truly implemented In : rbx - 77 - logarithm base e x plus 1 scalar single xmm0 - x Out: xmm0 - log(1+x) NOTE: log(1+x) is not truly implemented In : rbx - 78 - ldexp scalar single xmm0 - x xmm1 - q Out: xmm0 - x * 2^q NOTE: q is a scalar dword integer In : rbx - 79 - ilogb (extract exponent) scalar single xmm0 - x Out: xmm0 - (int)logb(x) NOTE: return value is a scalar dword integer 152 - CM lossless data codec NOTE: users should rely on the second layer (rbx - 10-14) This is a context mixing lossless data codec tuned primarily for executables. The codec works well for general data as well. Currently it lacks filters (an x86 code-filter can reduce the size of executables). The codec is based on Matt Mahoney's 'Data Compression Explained' book http://mattmahoney.net/dc/dce.html Source is available at http://board.flatassembler.net/topic.php?t=18812 For the second layer, the codec needs a dword parameter for encoding/decoding. This parameter can be obtained thru (rbx - 11), or can be set manually. When manually set, it needs to be validated thru (rbx - 12) For both encoding and decoding, the input/output addresses need to be aligned on a 16-byte boundary. Also memory manager needs to be initialized with system call 150/1. In: rbx - 00 - create interface rcx - Out: rax - *IF or zero In: rbx - 01 - destroy interface rcx - *IF Out: rax - In: rbx - 02 - returns the amount of memory used by the codec rcx - *IF rdx - n (1< eax Out: eax - Return value 29 - Get date Out: eax - 0xYYDDMM year,date,month 32 - Delete file from floppy In : ebx - Pointer to filename (11 char) Out: eax - 0 33 - Save file to floppy In : ebx - Pointer to filename (11 char) ecx - Data pointer edx - Bytes to write Out: eax - 0 35 - Get screen pixel In : ebx - Count from top left of screen Out: eax - Pixel 37 - Read mouse data In : ebx - 0 Screen relative ebx - 1 Window relative ebx - 2 Buttons pressed Out: eax - data 38 - Display line In : ebx - [x start] shl 16 + [x end] ecx - [y start] shl 16 + [y end] edx - 0x00RRGGBB Color Out: - 39 - Get background data In : ebx 1 - Get background size Out: eax=[x size] shl 16 + [y size] ebx 2 - Get background pixel ecx - Position at background memory map Out: eax = value ebx 4 - Get background type Out: eax=2 stretched 40 - Set bitfield for wanted events In : ebx - bitfield of wanted events default: ebx = 00000000 00000000 00000000 00000111b Events: I Window draw I Key in buffer I Button in buffer I I Desktop background draw I Mouse I IPC Out: - 47 - Display number In : ebx - Print type, bl=0 - ecx=value bl=1 - ecx=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 - Value or pointer edx - x shl 16 + y esi - Color Out: - 48 - Define general window properties In : ebx - 3 - Get defined window colors ecx - Pointer to return area edx - Bytes to return Out: - In : ebx - 4 - Get skin height Out: eax - Skin height 50 - Free form window shape and scale In : 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 Out: - 51 - Create thread In : ebx = 1 Create ecx Thread entry point edx Thread stack position Out: eax = PID or 0xfffffff0+ for error 52 - Stack driver status - See sys64 calls 53 - Socket interface - See sys64 calls 58 - File system In : ebx - Pointer to fileinfo block Fileinfo: dd 0 Read dd 0x0 First 512 byte block to read (0+) dd 0x1 Number of 512 byte blocks to read dd 0x20000 Return data pointer dd 0x10000 Work area for os - 16384 bytes db PATH asciiz dir & filename Out: eax - 0 Success or error code ebx - Size of file or Fileinfo: dd 1 Write dd 0x0 Ignored dd 10000 Bytes to write dd 0x20000 Source data pointer dd 0x10000 Work area for os - 16384 bytes db PATH ASCIIZ dir & filename Out: eax = 0 Success or error code or Fileinfo: dd 16 Start application dd 0x0 Ignored dd param 0 or parameter area (asciiz) Receiving application must reserve a 256 byte area dd 0x0 Ignored dd 0x10000 Work area for os - 16384 bytes db PATH asciiz dir & filename Out: eax = pid or 0xfffffff0+ for error 60 - Inter process communication In : ebx - 1 Define IPC memory ecx = Pointer to IPC memory area (ipcmem) ipcmem: dd 0 ; IPC area reserve (0/1) dd 8 ; Relative pointer to message area from ipcmem When a message is received: - bytes 0-3 = sender PID - bytes 4-7 = size of message - bytes 8- = message Out: eax - status In : ebx - 2 Send message ecx = receiver pid edx = pointer to message esi = message length Out: - 63 - Debug board In : ebx - 1 Write byte (cl=byte) Out: - In : ebx - 2 Read byte Out: ebx = 0 -> empty buffer (eax=0) ebx = 1 -> byte in al 64 - Application memory resize In : ebx - 1 Set amount of memory ecx New amount of memory Out: eax - 0 Success eax - 1 Out of memory 66 - Keyboard data mode In : ebx - 1 Set mode ecx - 0 Keymap ecx - 1 Scancodes ebx - 2 Get mode - return in eax ebx - 3 Get ctrl alt shift state - return in eax Out: eax 67 - Application window move / resize In : ebx - New x start ecx - New y start edx - New x size esi - New y size Out: - Specifying any parameter as -1 will leave the parameter unchanged. 113- Vertical/Horizontal Scroll Vertical scroll (1) In : ebx - 1 shl 16 + X start ecx - Y start shl 16+ Y size edx - Scroll value start esi - Scroll value size edi - Current scroll value Out: - Horizontal scroll (2) In : ebx - 2 shl 16 + Y start ecx - X start shl 16+ X size edx - Scroll value start esi - Scroll value size edi - Current scroll value Out: - 126 - Switch process to 32bit or 64bit mode In : rbx - 1 - Switch process to 32bit mode Called from 64bit mode Out: eax - 0 - Success 1 - Fail In : ebx - 2 - Switch process to 64bit mode Called from 32bit mode Out: rax - 0 - Success 1 - Fail After system call, execution continues from the following (32 or 64 bit) instruction. -1 - End application In : - Out: -