51 lines
1.2 KiB
Plaintext
51 lines
1.2 KiB
Plaintext
|
|
// Write to a file descriptor using the SYS_write syscall
|
|
// args: [buff_size, buff_ptr, fd]
|
|
// @arg buff_size: Int - number of bytes to write
|
|
// @arg buff_ptr: Ptr - pointer to the buffer to write
|
|
// @arg fd: Int - file descriptor
|
|
// @ret Int
|
|
macro write
|
|
SYS_write syscall3
|
|
end
|
|
|
|
// Write to a file descriptor using the SYS_write syscall
|
|
// args: [buff_size, buff_ptr, fd]
|
|
// @arg buff_size: Int - number of bytes to write
|
|
// @arg buff_ptr: Ptr - pointer to the buffer to write
|
|
// @arg fd: Int - file descriptor
|
|
// @ret Int
|
|
macro read
|
|
SYS_read syscall3
|
|
end
|
|
|
|
|
|
// Print a string to STDOUT
|
|
// args: [str_size, str_ptr]
|
|
// @arg buff_size: Int - number of bytes to write
|
|
// @arg buff_ptr: Ptr - pointer to the buffer to write
|
|
// @ret NULL
|
|
macro puts
|
|
STDOUT write drop
|
|
end
|
|
|
|
// Print a string to STDERR
|
|
// args: [str_size, str_ptr]
|
|
// @arg buff_size: Int - number of bytes to write
|
|
// @arg buff_ptr: Ptr - pointer to the buffer to write
|
|
// @ret NULL
|
|
macro eputs
|
|
STDOUT write drop
|
|
end
|
|
|
|
// TODO: make putc and eputc after we make local mem
|
|
|
|
// Exit the program with exit_code
|
|
// args: [exit_code]
|
|
// @arg exit_code: Int
|
|
// @ret NULL/NEVER
|
|
macro exit
|
|
SYS_exit syscall1 drop
|
|
end
|
|
|