Updates to client bindings

This commit is contained in:
Peter Weingartner 2024-09-11 16:41:51 -04:00
parent d526615245
commit 0b0124d883
6 changed files with 315 additions and 285 deletions

View file

@ -17,84 +17,71 @@
#include "sys_macros.h" #include "sys_macros.h"
#include "sys_types.h" #include "sys_types.h"
/* /**
* Quit the current user process * Quit the current user process
* *
* NOTE: at the moment, this relaunches the CLI. In the future, this * NOTE: at the moment, this relaunches the CLI. In the future, this
* may cause execution to return to the program that started * may cause execution to return to the program that started
* the user process. * the user process.
* *
* Inputs: * @param result the code to return to the kernel
* result = the code to return to the kernel
*/ */
extern SYSTEMCALL void sys_exit(short result); extern SYSTEMCALL void sys_exit(short result);
/* /**
* Enable all interrupts * Enable all interrupts
*
* NOTE: this is actually provided in the low level assembly
*/ */
extern SYSTEMCALL void sys_int_enable_all(); extern SYSTEMCALL void sys_int_enable_all();
/* /**
* Disable all interrupts * Disable all interrupts
*
* NOTE: this is actually provided in the low level assembly
*/ */
extern SYSTEMCALL void sys_int_disable_all(); extern SYSTEMCALL void sys_int_disable_all();
/* /**
* Disable an interrupt by masking it * Disable an interrupt by masking it
* *
* Inputs: * @param n the number of the interrupt: n[7..4] = group number, n[3..0] = individual number.
* n = the number of the interrupt: n[7..4] = group number, n[3..0] = individual number.
*/ */
extern SYSTEMCALL void sys_int_disable(unsigned short n); extern SYSTEMCALL void sys_int_disable(unsigned short n);
/* /**
* Enable an interrupt * Enable an interrupt
* *
* Inputs: * @param n the number of the interrupt
* n = the number of the interrupt
*/ */
extern SYSTEMCALL void sys_int_enable(unsigned short n); extern SYSTEMCALL void sys_int_enable(unsigned short n);
/* /**
* Register a handler for a given interrupt. * Register a handler for a given interrupt.
* *
* Inputs: * @param n the number of the interrupt
* n = the number of the interrupt * @param handler pointer to the interrupt handler to register
* handler = pointer to the interrupt handler to register
* *
* Returns: * @return the pointer to the previous interrupt handler
* the pointer to the previous interrupt handler
*/ */
extern SYSTEMCALL p_int_handler sys_int_register(unsigned short n, p_int_handler handler); extern SYSTEMCALL p_int_handler sys_int_register(unsigned short n, p_int_handler handler);
/* /**
* Return true (non-zero) if an interrupt is pending for the given interrupt * Return true (non-zero) if an interrupt is pending for the given interrupt
* *
* Inputs: * @param n the number of the interrupt: n[7..4] = group number, n[3..0] = individual number.
* n = the number of the interrupt: n[7..4] = group number, n[3..0] = individual number.
* *
* Returns: * @return non-zero if interrupt n is pending, 0 if not
* non-zero if interrupt n is pending, 0 if not
*/ */
extern SYSTEMCALL short sys_int_pending(unsigned short n); extern SYSTEMCALL short sys_int_pending(unsigned short n);
/* /**
* Fill out a s_sys_info structure with the information about the current system * Fill out a s_sys_info structure with the information about the current system
* *
* Inputs: * @param info pointer to a s_sys_info structure to fill out
* info = pointer to a s_sys_info structure to fill out
*/ */
extern SYSTEMCALL void sys_get_info(p_sys_info info); extern SYSTEMCALL void sys_get_info(p_sys_info info);
/* /**
* Acknowledge an interrupt (clear out its pending flag) * Acknowledge an interrupt (clear out its pending flag)
* *
* Inputs: * @param n the number of the interrupt: n[7..4] = group number, n[3..0] = individual number.
* n = the number of the interrupt: n[7..4] = group number, n[3..0] = individual number.
*/ */
extern SYSTEMCALL void sys_int_clear(unsigned short n); extern SYSTEMCALL void sys_int_clear(unsigned short n);
@ -102,137 +89,115 @@ extern SYSTEMCALL void sys_int_clear(unsigned short n);
*** Channel system calls *** Channel system calls
***/ ***/
/* /**
* Read a single byte from the channel * Read a single byte from the channel
* *
* Inputs: * @param channel the number of the channel
* channel = the number of the channel
* *
* Returns: * @return the value read (if negative, error)
* the value read (if negative, error)
*/ */
extern SYSTEMCALL short sys_chan_read_b(short channel); extern SYSTEMCALL short sys_chan_read_b(short channel);
/* /**
* Read bytes from the channel * Read bytes from the channel
* *
* Inputs: * @param channel the number of the channel
* channel = the number of the channel * @param buffer the buffer into which to copy the channel data
* buffer = the buffer into which to copy the channel data * @param size the size of the buffer.
* size = the size of the buffer.
* *
* Returns: * @return number of bytes read, any negative number is an error code
* number of bytes read, any negative number is an error code
*/ */
extern SYSTEMCALL short sys_chan_read(short channel, unsigned char * buffer, short size); extern SYSTEMCALL short sys_chan_read(short channel, unsigned char * buffer, short size);
/* /**
* Read a line of text from the channel * Read a line of text from the channel
* *
* Inputs: * @param channel the number of the channel
* channel = the number of the channel * @param buffer the buffer into which to copy the channel data
* buffer = the buffer into which to copy the channel data * @param size the size of the buffer
* size = the size of the buffer
* *
* Returns: * @return number of bytes read, any negative number is an error code
* number of bytes read, any negative number is an error code
*/ */
extern SYSTEMCALL short sys_chan_readline(short channel, unsigned char * buffer, short size); extern SYSTEMCALL short sys_chan_readline(short channel, unsigned char * buffer, short size);
/* /**
* Write a single byte to the device * Write a single byte to the device
* *
* Inputs: * @param channel the number of the channel
* channel = the number of the channel * @param b the byte to write
* b = the byte to write
* *
* Returns: * @return 0 on success, a negative value on error
* 0 on success, a negative value on error
*/ */
extern SYSTEMCALL short sys_chan_write_b(short channel, uint8_t b); extern SYSTEMCALL short sys_chan_write_b(short channel, uint8_t b);
/* /**
* Write a byte to the channel * Write a byte to the channel
* *
* Inputs: * @param channel the number of the channel
* channel = the number of the channel * @param b the byte to write
* b = the byte to write
* *
* Returns: * @return number of bytes written, any negative number is an error code
* number of bytes written, any negative number is an error code
*/ */
extern SYSTEMCALL short sys_chan_write(short channel, const uint8_t * buffer, short size); extern SYSTEMCALL short sys_chan_write(short channel, const uint8_t * buffer, short size);
/* /**
* Return the status of the channel device * Return the status of the channel device
* *
* Inputs: * @param channel the number of the channel
* channel = the number of the channel
* *
* Returns: * @return the status of the device
* the status of the device
*/ */
extern SYSTEMCALL short sys_chan_status(short channel); extern SYSTEMCALL short sys_chan_status(short channel);
/* /**
* Ensure that any pending writes to teh device have been completed * Ensure that any pending writes to teh device have been completed
* *
* Inputs: * @param channel the number of the channel
* channel = the number of the channel
* *
* Returns: * @return 0 on success, any negative number is an error code
* 0 on success, any negative number is an error code
*/ */
extern SYSTEMCALL short sys_chan_flush(short channel); extern SYSTEMCALL short sys_chan_flush(short channel);
/* /**
* Attempt to set the position of the channel cursor (if supported) * Attempt to set the position of the channel cursor (if supported)
* *
* Inputs: * @param channel the number of the channel
* channel = the number of the channel * @param position the position of the cursor
* position = the position of the cursor * @param base whether the position is absolute or relative to the current position
* base = whether the position is absolute or relative to the current position
* *
* Returns: * @return 0 = success, a negative number is an error.
* 0 = success, a negative number is an error.
*/ */
extern SYSTEMCALL short sys_chan_seek(short channel, long position, short base); extern SYSTEMCALL short sys_chan_seek(short channel, long position, short base);
/* /**
* Issue a control command to the device * Issue a control command to the device
* *
* Inputs: * @param channel the number of the channel
* channel = the number of the channel * @param command the number of the command to send
* command = the number of the command to send * @param buffer pointer to bytes of additional data for the command
* buffer = pointer to bytes of additional data for the command * @param size the size of the buffer
* size = the size of the buffer
* *
* Returns: * @return 0 on success, any negative number is an error code
* 0 on success, any negative number is an error code
*/ */
extern SYSTEMCALL short sys_chan_ioctrl(short channel, short command, uint8_t * buffer, short size); extern SYSTEMCALL short sys_chan_ioctrl(short channel, short command, uint8_t * buffer, short size);
/* /**
* Open a channel * Open a channel
* *
* Inputs: * @param dev the device number to have a channel opened
* dev = the device number to have a channel opened * @param path a "path" describing how the device is to be open
* path = a "path" describing how the device is to be open * @param mode s the device to be read, written, both? (0x01 = READ flag, 0x02 = WRITE flag, 0x03 = READ and WRITE)
* mode = is the device to be read, written, both? (0x01 = READ flag, 0x02 = WRITE flag, 0x03 = READ and WRITE)
* *
* Returns: * @return the number of the channel opened, negative number on error
* the number of the channel opened, negative number on error
*/ */
extern SYSTEMCALL short sys_chan_open(short dev, const char * path, short mode); extern SYSTEMCALL short sys_chan_open(short dev, const char * path, short mode);
/* /**
* Close a channel * Close a channel
* *
* Inputs: * @param chan the number of the channel to close
* chan = the number of the channel to close
* *
* Returns: * @return nothing useful
* nothing useful
*/ */
extern SYSTEMCALL short sys_chan_close(short chan); extern SYSTEMCALL short sys_chan_close(short chan);
@ -256,12 +221,11 @@ extern SYSTEMCALL short sys_chan_swap(short channel1, short channel2);
*/ */
extern SYSTEMCALL short sys_chan_device(short channel); extern SYSTEMCALL short sys_chan_device(short channel);
/* /**
* Compute the size information for the text screen based on the current settings in VICKY * Compute the size information for the text screen based on the current settings in VICKY
* These settings are needed to correctly position text on the screen. * These settings are needed to correctly position text on the screen.
* *
* Inputs: * @param screen the screen number 0 for channel A, 1 for channel B
* screen = the screen number 0 for channel A, 1 for channel B
*/ */
extern SYSTEMCALL void sys_text_setsizes(short chan); extern SYSTEMCALL void sys_text_setsizes(short chan);
@ -269,76 +233,63 @@ extern SYSTEMCALL void sys_text_setsizes(short chan);
*** Block device system calls *** Block device system calls
***/ ***/
// /**
// Register a block device driver * Register a block device driver
// *
* @param device pointer to the description of the device to register
* @return 0 on succes, negative number on error
*/
extern SYSTEMCALL short sys_bdev_register(p_dev_block device); extern SYSTEMCALL short sys_bdev_register(p_dev_block device);
// /**
// Read a block from the device * Read a block from the device
// *
// Inputs: * @param dev the number of the device
// dev = the number of the device * @param lba the logical block address of the block to read
// lba = the logical block address of the block to read * @param buffer the buffer into which to copy the block data
// buffer = the buffer into which to copy the block data * @param size the size of the buffer.
// size = the size of the buffer. * @return number of bytes read, any negative number is an error code
// */
// Returns:
// number of bytes read, any negative number is an error code
//
extern SYSTEMCALL short sys_bdev_read(short dev, long lba, uint8_t * buffer, short size); extern SYSTEMCALL short sys_bdev_read(short dev, long lba, uint8_t * buffer, short size);
// /**
// Write a block from the device * Write a block to the device
// *
// Inputs: * @param dev the number of the device
// dev = the number of the device * @param lba the logical block address of the block to write
// lba = the logical block address of the block to write * @param buffer the buffer containing the data to write
// buffer = the buffer containing the data to write * @param size the size of the buffer.
// size = the size of the buffer. * @return number of bytes written, any negative number is an error code
// */
// Returns:
// number of bytes written, any negative number is an error code
//
extern SYSTEMCALL short sys_bdev_write(short dev, long lba, const uint8_t * buffer, short size); extern SYSTEMCALL short sys_bdev_write(short dev, long lba, const uint8_t * buffer, short size);
// /**
// Return the status of the block device * Return the status of the block device
// *
// Inputs: * @param dev the number of the device
// dev = the number of the device * @return the status of the device
// */
// Returns:
// the status of the device
//
extern SYSTEMCALL short sys_bdev_status(short dev); extern SYSTEMCALL short sys_bdev_status(short dev);
// /**
// Ensure that any pending writes to teh device have been completed * Ensure that any pending writes to the device have been completed
// *
// Inputs: * @param dev the number of the device
// dev = the number of the device * @return 0 on success, any negative number is an error code
// */
// Returns:
// 0 on success, any negative number is an error code
//
extern SYSTEMCALL short sys_bdev_flush(short dev); extern SYSTEMCALL short sys_bdev_flush(short dev);
// /**
// Issue a control command to the device * Issue a control command to the device
// *
// Inputs: * @param dev the number of the device
// dev = the number of the device * @param command the number of the command to send
// command = the number of the command to send * @param buffer pointer to bytes of additional data for the command
// buffer = pointer to bytes of additional data for the command * @param size the size of the buffer
// size = the size of the buffer * @return 0 on success, any negative number is an error code
// */
// Returns:
// 0 on success, any negative number is an error code
//
extern SYSTEMCALL short sys_bdev_ioctrl(short dev, short command, uint8_t * buffer, short size); extern SYSTEMCALL short sys_bdev_ioctrl(short dev, short command, uint8_t * buffer, short size);
/* /*
* File System Calls * File System Calls
*/ */
@ -346,212 +297,180 @@ extern SYSTEMCALL short sys_bdev_ioctrl(short dev, short command, uint8_t * buff
/** /**
* Attempt to open a file given the path to the file and the mode. * Attempt to open a file given the path to the file and the mode.
* *
* Inputs: * @param path the ASCIIZ string containing the path to the file.
* path = the ASCIIZ string containing the path to the file. * @param mode the mode (e.g. r/w/create)
* mode = the mode (e.g. r/w/create)
* *
* Returns: *@return the channel ID for the open file (negative if error)
* the channel ID for the open file (negative if error)
*/ */
extern SYSTEMCALL short sys_fsys_open(const char * path, short mode); extern SYSTEMCALL short sys_fsys_open(const char * path, short mode);
/** /**
* Close access to a previously open file. * Close access to a previously open file.
* *
* Inputs: * @param fd the channel ID for the file
* fd = the channel ID for the file
* *
* Returns: * @return 0 on success, negative number on failure
* 0 on success, negative number on failure
*/ */
extern SYSTEMCALL short sys_fsys_close(short fd); extern SYSTEMCALL short sys_fsys_close(short fd);
/** /**
* Attempt to open a directory for scanning * Attempt to open a directory for scanning
* *
* Inputs: * @param path the path to the directory to open
* path = the path to the directory to open
* *
* Returns: * @return the handle to the directory if >= 0. An error if < 0
* the handle to the directory if >= 0. An error if < 0
*/ */
extern SYSTEMCALL short sys_fsys_opendir(const char * path); extern SYSTEMCALL short sys_fsys_opendir(const char * path);
/** /**
* Close access to a previously open file. * Close access to a previously open file.
* *
* Inputs: * @param fd the channel ID for the file
* fd = the channel ID for the file
* *
* Returns: * @return 0 on success, negative number on failure
* 0 on success, negative number on failure
*/ */
extern SYSTEMCALL short sys_fsys_close(short fd); extern SYSTEMCALL short sys_fsys_close(short fd);
/** /**
* Attempt to open a directory for scanning * Attempt to open a directory for scanning
* *
* Inputs: * @param path the path to the directory to open
* path = the path to the directory to open
* *
* Returns: * @return the handle to the directory if >= 0. An error if < 0
* the handle to the directory if >= 0. An error if < 0
*/ */
extern SYSTEMCALL short sys_fsys_opendir(const char * path); extern SYSTEMCALL short sys_fsys_opendir(const char * path);
/** /**
* Close a previously open directory * Close a previously open directory
* *
* Inputs: * @param dir the directory handle to close
* dir = the directory handle to close
* *
* Returns: * @return 0 on success, negative number on error
* 0 on success, negative number on error
*/ */
extern SYSTEMCALL short sys_fsys_closedir(short dir); extern SYSTEMCALL short sys_fsys_closedir(short dir);
/** /**
* Attempt to read an entry from an open directory * Attempt to read an entry from an open directory
* *
* Inputs: * @param dir the handle of the open directory
* dir = the handle of the open directory * @param file pointer to the t_file_info structure to fill out.
* file = pointer to the t_file_info structure to fill out.
* *
* Returns: * @return 0 on success, negative number on failure
* 0 on success, negative number on failure
*/ */
extern SYSTEMCALL short sys_fsys_readdir(short dir, p_file_info file); extern SYSTEMCALL short sys_fsys_readdir(short dir, p_file_info file);
/** /**
* Open a directory given the path and search for the first file matching the pattern. * Open a directory given the path and search for the first file matching the pattern.
* *
* Inputs: * @param path the path to the directory to search
* path = the path to the directory to search * @param pattern the file name pattern to search for
* pattern = the file name pattern to search for * @param file pointer to the t_file_info structure to fill out
* file = pointer to the t_file_info structure to fill out
* *
* Returns: * @return the directory handle to use for subsequent calls if >= 0, error if negative
* the directory handle to use for subsequent calls if >= 0, error if negative
*/ */
extern SYSTEMCALL short sys_fsys_findfirst(const char * path, const char * pattern, p_file_info file); extern SYSTEMCALL short sys_fsys_findfirst(const char * path, const char * pattern, p_file_info file);
/** /**
* Open a directory given the path and search for the first file matching the pattern. * Open a directory given the path and search for the first file matching the pattern.
* *
* Inputs: * @param dir the handle to the directory (returned by fsys_findfirst) to search
* dir = the handle to the directory (returned by fsys_findfirst) to search * @param file pointer to the t_file_info structure to fill out
* file = pointer to the t_file_info structure to fill out
* *
* Returns: * @return 0 on success, error if negative
* 0 on success, error if negative
*/ */
extern SYSTEMCALL short sys_fsys_findnext(short dir, p_file_info file); extern SYSTEMCALL short sys_fsys_findnext(short dir, p_file_info file);
/* /**
* Get the label for the drive holding the path * Get the label for the drive holding the path
* *
* Inputs: * @param path path to the drive
* path = path to the drive * @param label buffer that will hold the label... should be at least 35 bytes
* label = buffer that will hold the label... should be at least 35 bytes * @return 0 on success, error if negative
*/ */
extern SYSTEMCALL short sys_fsys_get_label(const char * path, char * label); extern SYSTEMCALL short sys_fsys_get_label(const char * path, char * label);
/* /**
* Set the label for the drive holding the path * Set the label for the drive holding the path
* *
* Inputs: * @param drive drive number
* drive = drive number * @param label buffer that holds the label
* label = buffer that holds the label * @return 0 on success, error if negative
*/ */
extern SYSTEMCALL short sys_fsys_set_label(short drive, const char * label); extern SYSTEMCALL short sys_fsys_set_label(short drive, const char * label);
/** /**
* Create a directory * Create a directory
* *
* Inputs: * @param path the path of the directory to create.
* path = the path of the directory to create.
* *
* Returns: * @return 0 on success, negative number on failure.
* 0 on success, negative number on failure.
*/ */
extern SYSTEMCALL short sys_fsys_mkdir(const char * path); extern SYSTEMCALL short sys_fsys_mkdir(const char * path);
/** /**
* Delete a file or directory * Delete a file or directory
* *
* Inputs: * @param path the path of the file or directory to delete.
* path = the path of the file or directory to delete.
* *
* Returns: * @return 0 on success, negative number on failure.
* 0 on success, negative number on failure.
*/ */
extern SYSTEMCALL short sys_fsys_delete(const char * path); extern SYSTEMCALL short sys_fsys_delete(const char * path);
/** /**
* Rename a file or directory * Rename a file or directory
* *
* Inputs: * @param old_path he current path to the file
* old_path = the current path to the file * @param new_path the new path for the file
* new_path = the new path for the file
* *
* Returns: * @return 0 on success, negative number on failure.
* 0 on success, negative number on failure.
*/ */
extern SYSTEMCALL short sys_fsys_rename(const char * old_path, const char * new_path); extern SYSTEMCALL short sys_fsys_rename(const char * old_path, const char * new_path);
/** /**
* Change the current working directory (and drive) * Change the current working directory (and drive)
* *
* Inputs: * @param path the path that should be the new current
* path = the path that should be the new current
* *
* Returns: * @return 0 on success, negative number on failure.
* 0 on success, negative number on failure.
*/ */
extern SYSTEMCALL short sys_fsys_set_cwd(const char * path); extern SYSTEMCALL short sys_fsys_set_cwd(const char * path);
/** /**
* Get the current working drive and directory * Get the current working drive and directory
* *
* Inputs: * @param path the buffer in which to store the directory
* path = the buffer in which to store the directory * @param size the size of the buffer in bytes
* size = the size of the buffer in bytes
* *
* Returns: * @return 0 on success, negative number on failure.
* 0 on success, negative number on failure.
*/ */
extern SYSTEMCALL short sys_fsys_get_cwd(char * path, short size); extern SYSTEMCALL short sys_fsys_get_cwd(char * path, short size);
/* /**
* Load a file into memory at the designated destination address. * Load a file into memory at the designated destination address.
* *
* If destination = 0, the file must be in a recognized binary format * If destination = 0, the file must be in a recognized binary format
* that specifies its own loading address. * that specifies its own loading address.
* *
* Inputs: * @param path the path to the file to load
* path = the path to the file to load * @param destination the destination address (0 for use file's address)
* destination = the destination address (0 for use file's address) * @param start pointer to the long variable to fill with the starting address
* start = pointer to the long variable to fill with the starting address
* (0 if not an executable, any other number if file is executable * (0 if not an executable, any other number if file is executable
* with a known starting address) * with a known starting address)
* *
* Returns: * @return 0 on success, negative number on error
* 0 on success, negative number on error
*/ */
extern SYSTEMCALL short sys_fsys_load(const char * path, uint32_t destination, uint32_t * start); extern SYSTEMCALL short sys_fsys_load(const char * path, uint32_t destination, uint32_t * start);
/* /**
* Register a file loading routine * Register a file loading routine
* *
* A file loader, takes a channel number to load from and returns a * A file loader, takes a channel number to load from and returns a
* short that is the status of the load. * short that is the status of the load.
* *
* Inputs: * @param extension the file extension to map to
* extension = the file extension to map to * @param loader pointer to the file load routine to add
* loader = pointer to the file load routine to add
* *
* Returns: * @return 0 on success, negative number on error
* 0 on success, negative number on error
*/ */
extern SYSTEMCALL short sys_fsys_register_loader(const char * extension, p_file_loader loader); extern SYSTEMCALL short sys_fsys_register_loader(const char * extension, p_file_loader loader);
@ -590,45 +509,47 @@ extern SYSTEMCALL uint32_t sys_mem_reserve(uint32_t bytes);
* Miscellaneous * Miscellaneous
*/ */
/* /**
* Get the number of jiffies since the system last booted. * Get the number of jiffies since the system last booted.
* *
* NOTE: a jiffie is 1/60 of a second. This timer will not be * NOTE: a jiffie is 1/60 of a second. This timer will not be
* 100% precise, so it should be used for timeout purposes * 100% precise, so it should be used for timeout purposes
* where precision is not critical. * where precision is not critical.
* *
* Returns: * @return the number of jiffies since the last reset
* the number of jiffies since the last reset
*/ */
extern SYSTEMCALL uint32_t sys_time_jiffies(); extern SYSTEMCALL uint32_t sys_time_jiffies();
/* /**
* Set the time on the RTC * Set the time on the RTC
* *
* Inputs: * @param time pointer to a t_time record containing the correct time
* time = pointer to a t_time record containing the correct time
*/ */
extern SYSTEMCALL void sys_rtc_set_time(p_time time); extern SYSTEMCALL void sys_rtc_set_time(p_time time);
/* /**
* Get the time on the RTC * Get the time on the RTC
* *
* Inputs: * @param time pointer to a t_time record in which to put the current time
* time = pointer to a t_time record in which to put the current time
*/ */
extern SYSTEMCALL void sys_rtc_get_time(p_time time); extern SYSTEMCALL void sys_rtc_get_time(p_time time);
/* /**
* Return the next scan code from the keyboard... 0 if nothing pending * Check for any keypress and return the scancode for the key
*
* @return the next scan code from the keyboard... 0 if nothing pending
*/ */
extern SYSTEMCALL uint16_t sys_kbd_scancode(); extern SYSTEMCALL uint16_t sys_kbd_scancode();
/* /**
* Return an error message given an error number * Return an error message given an error number
*
* @param err_number the error number
* @return pointer to a string describing the error
*/ */
extern SYSTEMCALL const char * sys_err_message(short err_number); extern SYSTEMCALL const char * sys_err_message(short err_number);
/* /**
* Set the keyboard translation tables * Set the keyboard translation tables
* *
* The translation tables provided to the keyboard consist of eight * The translation tables provided to the keyboard consist of eight
@ -646,8 +567,9 @@ extern SYSTEMCALL const char * sys_err_message(short err_number);
* - ALT-SHIFT: Used when ALT is pressed and either CAPSLOCK is down * - ALT-SHIFT: Used when ALT is pressed and either CAPSLOCK is down
* or SHIFT is pressed (but not both) * or SHIFT is pressed (but not both)
* *
* Inputs: * @param tables pointer to the keyboard translation tables
* tables = pointer to the keyboard translation tables * @return 0 on success, negative number on error
*
*/ */
extern SYSTEMCALL short sys_kbd_layout(const char * tables); extern SYSTEMCALL short sys_kbd_layout(const char * tables);

View file

@ -1,4 +1,12 @@
.public sys_proc_exit .public sys_proc_exit
.public sys_int_enable_all
.public sys_int_disable_all
.public sys_int_disable
.public sys_int_enable
.public sys_int_register
.public sys_int_pending
.public sys_get_info
.public sys_int_clear
.public sys_chan_read_b .public sys_chan_read_b
.public sys_chan_read .public sys_chan_read
.public sys_chan_readline .public sys_chan_readline
@ -12,6 +20,7 @@
.public sys_chan_close .public sys_chan_close
.public sys_chan_swap .public sys_chan_swap
.public sys_chan_device .public sys_chan_device
.public sys_chan_register
.public sys_bdev_register .public sys_bdev_register
.public sys_bdev_read .public sys_bdev_read
.public sys_bdev_write .public sys_bdev_write
@ -25,6 +34,8 @@
.public sys_fsys_readdir .public sys_fsys_readdir
.public sys_fsys_findfirst .public sys_fsys_findfirst
.public sys_fsys_findnext .public sys_fsys_findnext
.public sys_fsys_get_label
.public sys_fsys_set_label
.public sys_fsys_mkdir .public sys_fsys_mkdir
.public sys_fsys_delete .public sys_fsys_delete
.public sys_fsys_rename .public sys_fsys_rename
@ -35,7 +46,12 @@
.public sys_fsys_stat .public sys_fsys_stat
.public sys_mem_get_ramtop .public sys_mem_get_ramtop
.public sys_mem_reserve .public sys_mem_reserve
.public sys_time_jiffies
.public sys_rtc_set_time
.public sys_rtc_get_time
.public sys_kbd_scancode
.public sys_err_message .public sys_err_message
.public sys_kbd_layout
.public sys_proc_run .public sys_proc_run
.public sys_txt_get_capabilities .public sys_txt_get_capabilities
.public sys_txt_set_mode .public sys_txt_set_mode
@ -55,6 +71,14 @@
.public sys_txt_print .public sys_txt_print
.extern proc_exit .extern proc_exit
.extern int_enable_all
.extern int_disable_all
.extern int_disable
.extern int_enable
.extern int_register
.extern int_pending
.extern sys_get_information
.extern int_clear
.extern chan_read_b .extern chan_read_b
.extern chan_read .extern chan_read
.extern chan_readline .extern chan_readline
@ -68,6 +92,7 @@
.extern chan_close .extern chan_close
.extern chan_swap .extern chan_swap
.extern chan_device .extern chan_device
.extern cdev_register
.extern bdev_register .extern bdev_register
.extern bdev_read .extern bdev_read
.extern bdev_write .extern bdev_write
@ -81,6 +106,8 @@
.extern fsys_readdir .extern fsys_readdir
.extern fsys_findfirst .extern fsys_findfirst
.extern fsys_findnext .extern fsys_findnext
.extern fsys_get_label
.extern fsys_set_label
.extern fsys_mkdir .extern fsys_mkdir
.extern fsys_delete .extern fsys_delete
.extern fsys_rename .extern fsys_rename
@ -91,7 +118,12 @@
.extern fsys_stat .extern fsys_stat
.extern mem_get_ramtop .extern mem_get_ramtop
.extern mem_reserve .extern mem_reserve
.extern timers_jiffies
.extern rtc_set_time
.extern rtc_get_time
.extern kbd_get_scancode
.extern err_message .extern err_message
.extern kbd_layout
.extern proc_run .extern proc_run
.extern txt_get_capabilities .extern txt_get_capabilities
.extern txt_set_mode .extern txt_set_mode
@ -113,6 +145,14 @@
.section jumptable .section jumptable
sys_proc_exit: jmp long:proc_exit sys_proc_exit: jmp long:proc_exit
sys_int_enable_all: jmp long:int_enable_all
sys_int_disable_all: jmp long:int_disable_all
sys_int_disable: jmp long:int_disable
sys_int_enable: jmp long:int_enable
sys_int_register: jmp long:int_register
sys_int_pending: jmp long:int_pending
sys_get_info: jmp long:sys_get_information
sys_int_clear: jmp long:int_clear
sys_chan_read_b: jmp long:chan_read_b sys_chan_read_b: jmp long:chan_read_b
sys_chan_read: jmp long:chan_read sys_chan_read: jmp long:chan_read
sys_chan_readline: jmp long:chan_readline sys_chan_readline: jmp long:chan_readline
@ -126,6 +166,7 @@ sys_chan_open: jmp long:chan_open
sys_chan_close: jmp long:chan_close sys_chan_close: jmp long:chan_close
sys_chan_swap: jmp long:chan_swap sys_chan_swap: jmp long:chan_swap
sys_chan_device: jmp long:chan_device sys_chan_device: jmp long:chan_device
sys_chan_register: jmp long:cdev_register
sys_bdev_register: jmp long:bdev_register sys_bdev_register: jmp long:bdev_register
sys_bdev_read: jmp long:bdev_read sys_bdev_read: jmp long:bdev_read
sys_bdev_write: jmp long:bdev_write sys_bdev_write: jmp long:bdev_write
@ -139,6 +180,8 @@ sys_fsys_closedir: jmp long:fsys_closedir
sys_fsys_readdir: jmp long:fsys_readdir sys_fsys_readdir: jmp long:fsys_readdir
sys_fsys_findfirst: jmp long:fsys_findfirst sys_fsys_findfirst: jmp long:fsys_findfirst
sys_fsys_findnext: jmp long:fsys_findnext sys_fsys_findnext: jmp long:fsys_findnext
sys_fsys_get_label: jmp long:fsys_get_label
sys_fsys_set_label: jmp long:fsys_set_label
sys_fsys_mkdir: jmp long:fsys_mkdir sys_fsys_mkdir: jmp long:fsys_mkdir
sys_fsys_delete: jmp long:fsys_delete sys_fsys_delete: jmp long:fsys_delete
sys_fsys_rename: jmp long:fsys_rename sys_fsys_rename: jmp long:fsys_rename
@ -149,7 +192,12 @@ sys_fsys_register_loader: jmp long:fsys_register_loader
sys_fsys_stat: jmp long:fsys_stat sys_fsys_stat: jmp long:fsys_stat
sys_mem_get_ramtop: jmp long:mem_get_ramtop sys_mem_get_ramtop: jmp long:mem_get_ramtop
sys_mem_reserve: jmp long:mem_reserve sys_mem_reserve: jmp long:mem_reserve
sys_time_jiffies: jmp long:timers_jiffies
sys_rtc_set_time: jmp long:rtc_set_time
sys_rtc_get_time: jmp long:rtc_get_time
sys_kbd_scancode: jmp long:kbd_get_scancode
sys_err_message: jmp long:err_message sys_err_message: jmp long:err_message
sys_kbd_layout: jmp long:kbd_layout
sys_proc_run: jmp long:proc_run sys_proc_run: jmp long:proc_run
sys_txt_get_capabilities: jmp long:txt_get_capabilities sys_txt_get_capabilities: jmp long:txt_get_capabilities
sys_txt_set_mode: jmp long:txt_set_mode sys_txt_set_mode: jmp long:txt_set_mode

View file

@ -1,14 +1,14 @@
# A list of system calls to be used to autogenerate the various jump tables and sys calls stubs\ # A list of system calls to be used to autogenerate the various jump tables and sys calls stubs\
proc_exit proc_exit
# int_enable_all int_enable_all
# int_disable_all int_disable_all
# int_disable int_disable
# int_enable int_enable
# int_register int_register
# int_pending int_pending
# get_info get_info
# int_clear int_clear
chan_read_b chan_read_b
chan_read chan_read
@ -23,7 +23,7 @@ chan_open
chan_close chan_close
chan_swap chan_swap
chan_device chan_device
# chan_register chan_register
bdev_register bdev_register
bdev_read bdev_read
@ -39,8 +39,8 @@ fsys_closedir
fsys_readdir fsys_readdir
fsys_findfirst fsys_findfirst
fsys_findnext fsys_findnext
# fsys_get_label fsys_get_label
# fsys_set_label fsys_set_label
fsys_mkdir fsys_mkdir
fsys_delete fsys_delete
fsys_rename fsys_rename
@ -52,15 +52,13 @@ fsys_stat
mem_get_ramtop mem_get_ramtop
mem_reserve mem_reserve
# time_jiffies time_jiffies
# rtc_set_time rtc_set_time
# rtc_get_time rtc_get_time
# kbd_scancode kbd_scancode
err_message err_message
# kbd_layout kbd_layout
proc_run proc_run
# var_set
# var_get
txt_get_capabilities txt_get_capabilities
txt_set_mode txt_set_mode

View file

@ -848,7 +848,7 @@ short fsys_mount(short bdev) {
* path = path to the drive * path = path to the drive
* label = buffer that will hold the label... should be at least 35 bytes * label = buffer that will hold the label... should be at least 35 bytes
*/ */
short fsys_getlabel(char * path, char * label) { SYSTEMCALL short fsys_get_label(char * path, char * label) {
TRACE("fsys_getlabel"); TRACE("fsys_getlabel");
// If the drive being queried is the floppy drive, make sure the FDC status // If the drive being queried is the floppy drive, make sure the FDC status
@ -870,7 +870,7 @@ short fsys_getlabel(char * path, char * label) {
* drive = drive number * drive = drive number
* label = buffer that holds the label * label = buffer that holds the label
*/ */
short fsys_setlabel(short drive, const char * label) { SYSTEMCALL short fsys_set_label(short drive, const char * label) {
FRESULT fres; FRESULT fres;
char buffer[80]; char buffer[80];
@ -899,7 +899,7 @@ unsigned char workspace[FF_MAX_SS * 4];
* drive = drive number * drive = drive number
* label = the label to apply to the drive * label = the label to apply to the drive
*/ */
short fsys_mkfs(short drive, char * label) { SYSTEMCALL short fsys_mkfs(short drive, char * label) {
char buffer[80]; char buffer[80];
FRESULT fres; FRESULT fres;
@ -1404,7 +1404,7 @@ static short fsys_load_ext(const char * path, const char * extension, long desti
* Returns: * Returns:
* 0 on success, negative number on error * 0 on success, negative number on error
*/ */
short fsys_load(const char * path, long destination, long * start) { SYSTEMCALL short fsys_load(const char * path, long destination, long * start) {
int i; int i;
char extension[MAX_EXT]; char extension[MAX_EXT];
char spath[MAX_PATH_LEN]; char spath[MAX_PATH_LEN];
@ -1476,7 +1476,7 @@ short fsys_load(const char * path, long destination, long * start) {
* Returns: * Returns:
* 0 on success, negative number on error * 0 on success, negative number on error
*/ */
short fsys_register_loader(const char * extension, p_file_loader loader) { SYSTEMCALL short fsys_register_loader(const char * extension, p_file_loader loader) {
int i, j; int i, j;
for (i = 0; i < MAX_LOADERS; i++) { for (i = 0; i < MAX_LOADERS; i++) {

View file

@ -125,7 +125,7 @@ extern SYSTEMCALL short fsys_stat(const char * path, p_file_info file);
* path = path to the drive * path = path to the drive
* label = buffer that will hold the label... should be at least 35 bytes * label = buffer that will hold the label... should be at least 35 bytes
*/ */
extern SYSTEMCALL short fsys_getlabel(char * path, char * label); extern SYSTEMCALL short fsys_get_label(char * path, char * label);
/* /*
* Set the label for the drive holding the path * Set the label for the drive holding the path
@ -134,7 +134,7 @@ extern SYSTEMCALL short fsys_getlabel(char * path, char * label);
* drive = drive number * drive = drive number
* label = buffer that holds the label * label = buffer that holds the label
*/ */
extern SYSTEMCALL short fsys_setlabel(short drive, const char * label); extern SYSTEMCALL short fsys_set_label(short drive, const char * label);
/* /*
* Format a drive * Format a drive

62
utils/genparams.py Normal file
View file

@ -0,0 +1,62 @@
#
# Create the 64tass parameters structures for the Toolbox functions
#
import re
class FunctionParameter:
def __init__(self):
self._name = "UNKNOWN"
self._position = 0
self._type = ""
self._description = ""
def set_name(self, name):
self._name = name
def set_position(self, position):
self._position = position
def set_type(self, type):
self._type = type
def set_description(self, description):
self._description = description
class Function:
def __init__(self):
self._name = "UNKNOWN"
self._brief = ""
self._description = ""
self._type = "void"
self._parameters = []
self._address = 0
def set_name(self, name):
self._name = name
def set_brief(self, brief):
self._brief = brief
def set_description(self, description):
self._description = description
def set_type(self, type):
self._type = type
with open("toolbox.h", "r") as input:
for line in input.readlines():
m = re.match("extern\s+SYSTEMCALL\s+(\w+)\s+(\w+)\((.*)\)", line)
if m:
func_type = m.group(1)
func_name = m.group(2)
func_parameters = str.split(m.group(3), ",")
print("Type: {0}, Name: {1}".format(func_type, func_name))
for param in func_parameters:
m2 = re.match("^\s*(.*)\s(\S+)\s*$", param)
if m2:
param_type = m2.group(1).strip()
param_name = m2.group(2).strip()
print("\tName: {0}, Type: {1}".format(param_name, param_type))