Menuet 64 v0.46 system calls rax : function number int 0x60 : system call Index: 0 - Define and draw window 1 - Putpixel 2 - Get key 3 - Get 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 rectangle 15 - Define and draw background 17 - Get pressed button info 23 - Wait for event with timeout 26 - Get general system info 35 - Get pixel of screen 37 - Get 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 50 - Define a freeform window 51 - Threads 52 - Network interface 53 - Network interface 58 - Filesystem 60 - Inter process communication 61 - Direct screen access 63 - System debug info 64 - Application memory resize 66 - Keyboard data mode 67 - Window move and resize 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 256 - Start process 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 - Type shl 32 & border color rex - Draw buttons - close,full,minimize rfx - 0 or pointer to window label ( asciiz ) rgx - 0 or pointer to menu struct Out: - 1 - Putpixel In : rbx - X rcx - Y rdx - Color Out: - 2 - Get key In : - Out: rax - 0 Request success rbx - CU bits U = 0 - key down 1 - key up C = 0 - ascii ( utf8 ) 1 - extended key rcx - Key, ascii ( utf8 ) or extended rax - 1 No key in buffer for requestor 3 - Get date and time In : rax = 1 - Get time 2 - Get date Out: rax - Time 0x0000000000SSMMHH - Date 0x00000000DWDDMMYY 4 - Display text In : rbx - Pointer to string ( asciiz ) rcx - X position rdx - Y position rfx - Font rsi - Color Out: - 5 - Delay In : rbx - Delay 1/100s Out: - 7 - Display image In : rbx - X start & size rcx - Y start & size rdx - Pointer to first pixel ( rrggbb ) to display rex - Scanline difference ( 0 for continuous picture data ) rfx - Transparency color ( 0x1000000 for no transparency ) rgx - Pixel alignment ( 3 for RRggbbRRggbb ) Out: - 8 - Define and draw button In : rbx - X start & size rcx - Y start & size rdx - Button ID rex - Flags & Color(ignored) - bit 63 = do not draw the image - bit 62 = report button down rfx - Pointer to button label ( asciiz ) or Zero Out: - 9 - Get process info In : rbx 1 - By process slot rcx - Process slot rdx - Pointer to return area rex - Bytes to return Out: Data returned to [rdx] See table 9-1 In : rbx 2 - By process PID rcx - Process PID rdx - Pointer to return area rex - Bytes to return Out: Data returned to [rdx] See table 9-1 10 - Wait for event In : - Out: rax - Bitfield of event(s) 0 .. 0 0 0 1 1 1 | | | | | | | | | | | | | ---- 00 Window redraw | | | | | ------ 01 Key press | | | | -------- 02 Button press | | | ---------- 03 [unused] | | ------------ 04 Background change | -------------- 05 Mouse event | 06+ [unused] ------------------- 32+ IRQ events 11 - Check for event In : - Out: rax - Bitfield of event(s) 12 - Window draw state In : rbx - 1 Start rbx - 2 End Out: - 13 - Display filled rectangle In : rbx - X start & size rcx - Y start & size rdx - Color Out: - 15 - Define and draw background In : rbx - 1 Draw background rbx - 2 Give background data rcx - Pointer to background image (RRGGBB) rdx - Destination rex - Amount of bytes to copy rbx - 3 Give background size rcx - X size rdx - Y size Out: - 17 - Get pressed button info In : - Out: rax - 0 Request success rbx - Button ID rax - 1 No button in buffer for requestor 23 - Wait for event with timeout In : rbx - Delay in 1/100s Out: rax - Bitfield of event(s) 26 - Get general system info In : rbx 1 - General data 2 - Window stack 3 - Boot info base 4 - Paging table use rcx - Pointer to return area rdx - Bytes to return Out: Returns data to [rcx] 35 - Get pixel of screen In : rbx - 1 screen related rcx - Y rdx - X Out: rax - pixel 37 - Get mouse data In : rbx - 0 Mouse coordinates, screen relative Out: rax - X shl 32 + Y In : rbx - 1 Mouse coordinates, window 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 38 - Draw Line In : rbx - X start rcx - Y start rdx - X end rex - Y end rfx - Color Out: - 40 - Set bitfield for wanted events In : rbx - Bitfield of events Reported by default: 0 .. 0 0 0 1 1 1 | | | | | | | | | | | | | ---- 00 Window redraw | | | | | ------ 01 Key press | | | | -------- 02 Button press | | | ---------- 03 [unused] | | ------------ 04 Background change | -------------- 05 Mouse event | 06+ [unused] ------------------- 32+ 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: - 50 - Define a freeform window In : rbx - 0 Define reference area rcx - Pointer to freeform area Out: - 51 - Threads In : rbx - 1 Start thread rcx - Thread entry rdx - Stack value Out: rax - 0 Success rbx - Thread PID rax - 1 Fail 52 - Network interface See Stack.txt 53 - Network interface See Stack.txt 58 - Filesystem In : rbx - 0 Read rcx - First block to read rdx - Blocks to read rex - Return pointer rfx - Name pointer rbx - 1 Write rcx - Ignored rdx - Bytes to save rex - Pointer to data rfx - Filename pointer rbx - 2 Delete rcx - Ignored rdx - Ignored rex - Ignored rfx - Pointer to filename rbx - 3 Read directory entries rcx - First wanted name 0+ rdx - Set as 1 rex - Return pointer rfx - Path pointer Out: rax - 0 - Successful 5 - Attempt to read past end 6 - File not found rbx - File size 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 = Received PID rdx = Pointer to data rex = Message size Out: rax 0 Successful (not yet fully implemented) 1 Receiver not found 2 No ipc memory define at receiver 3 Receiver has memory locked (not yet implemented) 4 Receiver has memory full (not yet implemented) 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 info In : rbx - 2 Read data Out: rax - 0 Success rbx - Byte rcx - bytes left rax - 1 Fail 64 - Application memory resize In : rbx - 1 Set new application memory size rcx - New amount of memory Out: rax - 0 Success rax - 1 Out of memory 66 - Keyboard data mode In : rbx - 1 set mode rcx - 0 - Keymap rcx - 1 - Scancodes ( implemented for 32 bit app ) Out: - In : rbx - 2 get mode Out: rax = Mode In : rbx - 3 Shift Ctrl Alt Menu key states Out: rax = bitmap 67 - Window move and resize In : rbx = new x start rcx = new y start rdx = new x size rex = new y 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 110 - Get data from running process In : rbx - 1 Return window label rcx - Process PID rdx - Pointer to return data rex - 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 112 - Get configuration parameter In : rbx - 1 Get parameter rcx - Pointer to parameter string ( asciiz ) rdx - Number of characters to return rex - Pointer to return area of string Out: rax - 0 Parameter is one of numeric value rbx - Value rax - 1 Parameter is a string rbx - String ( asciiz ) returned to [rex] 113 - Vertical and horizontal scroll bars In : rbx - 1 Vertical rcx - Value start rdx - Value size rex - Current value rfx - X start in pixels rgx - Y start in pixels rhx - Y size in pixels Out: - In : rbx - 2 Horizontal rcx - Value start rdx - Value size rex - Current value rfx - Y start in pixels rgx - X start in pixels rhx - X size in pixels Out: - 114 - CD audio In : rbx - 1 Start Play rcx - Start Minute rdx - Start Second rex - Start Frame rfx - End Minute rgx - End Second rhx - End Frame 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 rex - 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 rex - 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 In : rbx - 1 Reserve audio 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+ Out: rcx - reserved rbx - bits 00-23 = Output frequency bits 24-31 = Bytes per channel bits 32-39 = Channels bits 40-47 = 0 - non signed - lsb,..,msb 1 - sign extended - lsb,..,msb 2 - non signed - msb,..,lsb 3 - sign extended - msb,..,lsb bits 48-63 = Buffer size in bytes rax - 0 Success - 1 Fail ( read past last index or audio disabled ) In : rbx - 8 Set wave out format rcx - Index 0+ Out: rax - 0 Success - 1 Fail In : rbx - 255 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 rex - Radius rsi - Color Out: - 120 - Window Skinning In : rbx - 1 - Load skin type 1 ( 96 x 40 x 24bpp ) rcx - Pointer to filename 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 121 - Drag'n drop In : rbx - 1 - Define Drag'n drop area rcx - Pointer to area rdx - Size of area Out: rax - 0 Success 1 Failed In : rbx - 2 - Give Drag'n drop data rcx - Pointer to asciiz ( ';' separates filenames ) Out: rax - 0 Success 1 Failed 256 - Start process In : rbx = Pointer to filename rcx = 0 or pointer to startup parameter ( asciiz ) Out: rax - 0 Success rbx - PID of started process rax - 1 File not found 500 - System In : rbx - 1 Reboot Out: - 512 - Terminate process Table 9-1 00 qword window start x 08 qword window start y 16 qword window size x 24 qword window size y 72 qword current rax 80 qword current rbx 88 qword current rcx 96 qword current rdx 104 qword current rex 112 qword current rfx 120 qword current rgx 128 qword current rhx 136 qword current rix 144 qword current rjx 152 qword current rkx 160 qword current rlx 168 qword current rsi 176 qword current rdi 184 qword current rbp 192 qword current rsp 248 qword 32 for 32 bit process, 64 for 64 bit process 256 qword process start at physical memory 264 qword process ID 288 qword process state: 0 running - 4 terminate - 5 terminated 296 qword process memory usage 408 256 B start path and application ( asciiz ) 1040 qword 0/1 = parent/child process