work on interrupts
This commit is contained in:
parent
2bbfecfea8
commit
67ae905a17
371
src/interrupts.s
371
src/interrupts.s
|
@ -153,25 +153,42 @@ cop_handler_native:
|
|||
jmp (.kbank cop_jump_table,x)
|
||||
|
||||
cop_jump_table:
|
||||
.word .word0 cop_exit
|
||||
.word .word0 cop_reset
|
||||
.word .word0 cop_get_version
|
||||
.word .word0 cop_console_input
|
||||
.word .word0 cop_console_output
|
||||
.word .word0 cop_console_print_string
|
||||
.word .word0 cop_console_read_line
|
||||
.word .word0 cop_console_status
|
||||
.word .word0 cop_volume_select
|
||||
.word .word0 cop_volume_query
|
||||
.word .word0 cop_volume_current
|
||||
.word .word0 cop_get_date
|
||||
.word .word0 cop_set_date
|
||||
.word .word0 cop_get_time
|
||||
.word .word0 cop_set_time
|
||||
.word .word0 cop_filesystem_status
|
||||
.word .word0 cop_get_date_time
|
||||
.word .word0 cop_set_date_time
|
||||
.word .word0 cop_sector_read
|
||||
.word .word0 cop_sector_write
|
||||
.word .word0 cop_file_open
|
||||
.word .word0 cop_file_create
|
||||
.word .word0 cop_file_close
|
||||
.word .word0 cop_file_read
|
||||
.word .word0 cop_file_write
|
||||
.word .word0 cop_file_seek
|
||||
.word .word0 cop_file_delete
|
||||
.word .word0 cop_file_move
|
||||
.word .word0 cop_file_get_attributes
|
||||
.word .word0 cop_file_set_attributes
|
||||
.word .word0 cop_file_get_timestamp
|
||||
.word .word0 cop_file_set_timestamp
|
||||
.word .word0 cop_get_working_directory
|
||||
.word .word0 cop_set_working_directory
|
||||
.word .word0 cop_exec
|
||||
.word .word0 cop_exit
|
||||
.word .word0 cop_volume_initialize
|
||||
.word .word0 cop_volume_format
|
||||
.word .word0 cop_get_environment_value
|
||||
.word .word0 cop_set_environment_value
|
||||
.word .word0 cop_ioctl
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 0: Exit
|
||||
; Function 0: Soft Reset
|
||||
;
|
||||
; Exit the calling program, effectively soft-rebooting the system.
|
||||
;
|
||||
|
@ -179,7 +196,7 @@ cop_jump_table:
|
|||
; Return value: None
|
||||
|
||||
.extern __program_start
|
||||
cop_exit:
|
||||
cop_reset:
|
||||
jmp long:__program_start
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
|
@ -269,48 +286,26 @@ cop_console_status:
|
|||
cop_rti
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 7: Select Volume
|
||||
; Function 7: Query Filesystem Status
|
||||
;
|
||||
; Sets the selected volume to the one whose logical number is in A.
|
||||
;
|
||||
; Arguments:
|
||||
; A: Logical number to select as the selected volume.
|
||||
; Return Value:
|
||||
; A: Zero on success. Error code on failure.
|
||||
|
||||
cop_volume_select:
|
||||
cop_rti
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 8: Query Volumes
|
||||
;
|
||||
; Returns a bitmap of the active (available) volume numbers in C.
|
||||
; Bit 0 refers to logical volume 0, bit 1 to logical volume 1, etc.
|
||||
; Determine if there is an SD card inserted which contains a valid filesystem.
|
||||
;
|
||||
; Arguments: None
|
||||
; Return Value:
|
||||
; C: Bitmap of active logical volumes.
|
||||
; A: Zero if a valid filesystem is present, nonzero otherwise.
|
||||
|
||||
cop_volume_query:
|
||||
cop_filesystem_status:
|
||||
cop_rti
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 9: Get Current Volume
|
||||
;
|
||||
; Returns the logical volume ID of the currently selected volume.
|
||||
;
|
||||
; Arguments: None
|
||||
; Return Value:
|
||||
; A: Logical volume ID of the current volume.
|
||||
|
||||
cop_volume_current:
|
||||
cop_rti
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 10: Get Date
|
||||
; Function 8: Get Date and Time
|
||||
;
|
||||
; Gets the current date into a structure with the following format:
|
||||
; struct date_s {
|
||||
; uint8_t millisecond;
|
||||
; uint8_t second;
|
||||
; uint8_t minute;
|
||||
; uint8_t hour;
|
||||
; uint16_t year;
|
||||
; uint8_t month;
|
||||
; uint8_t day;
|
||||
|
@ -325,14 +320,18 @@ cop_volume_current:
|
|||
; Y: Argument address
|
||||
; Return Value: None
|
||||
|
||||
cop_get_date:
|
||||
cop_get_date_time:
|
||||
cop_rti
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 11: Set Date
|
||||
; Function 9: Set Date and Time
|
||||
;
|
||||
; Sets the current date from a structure with the following format:
|
||||
; struct date_s {
|
||||
; uint8_t millisecond;
|
||||
; uint8_t second;
|
||||
; uint8_t minute;
|
||||
; uint8_t hour;
|
||||
; uint16_t year;
|
||||
; uint8_t month;
|
||||
; uint8_t day;
|
||||
|
@ -347,70 +346,23 @@ cop_get_date:
|
|||
; Y: Argument address
|
||||
; Return Value: None
|
||||
|
||||
cop_set_date:
|
||||
cop_set_date_time:
|
||||
cop_rti
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 12: Get Time
|
||||
; Function 10: Read Sectors
|
||||
;
|
||||
; Gets the current time into a structure with the following format:
|
||||
; struct time_s {
|
||||
; uint8_t millisecond;
|
||||
; uint8_t second;
|
||||
; uint8_t minute;
|
||||
; uint8_t hour;
|
||||
; };
|
||||
; Read a number of sectors from the SD card into a memory buffer provided by the
|
||||
; caller. Arguments are provided in a structure with the following format:
|
||||
;
|
||||
; If a compatible realtime clock is installed, it will be used as the source
|
||||
; for the time; otherwise, internal kernel variables will be used, updated by
|
||||
; the system timer.
|
||||
;
|
||||
; Arguments:
|
||||
; A: Bank of argument address
|
||||
; Y: Argument address
|
||||
; Return Value: None
|
||||
|
||||
cop_get_time:
|
||||
cop_rti
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 13: Set Time
|
||||
;
|
||||
; Gets the current time into a structure with the following format:
|
||||
; struct time_s {
|
||||
; uint8_t millisecond;
|
||||
; uint8_t second;
|
||||
; uint8_t minute;
|
||||
; uint8_t hour;
|
||||
; };
|
||||
;
|
||||
; If a compatible realtime clock is installed, it will be used as the destination
|
||||
; for the date; otherwise, internal kernel variables will be used, updated by
|
||||
; the system timer.
|
||||
;
|
||||
; Arguments:
|
||||
; A: Bank of argument address
|
||||
; Y: Argument address
|
||||
; Return Value: None
|
||||
|
||||
cop_set_time:
|
||||
cop_rti
|
||||
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 14: Read Sectors
|
||||
;
|
||||
; Read a number of sectors from the specified physical device. Arguments are
|
||||
; provided in a structure with the following format:
|
||||
; struct sector_read_s {
|
||||
; uint8_t device;
|
||||
; uint32_t first_sector;
|
||||
; uint8_t length;
|
||||
; void *dest;
|
||||
; far void *dest;
|
||||
; };
|
||||
;
|
||||
; Arguments:
|
||||
; C: Bank of argument address
|
||||
; A: Bank of argument address
|
||||
; Y: Argument address
|
||||
; Return Value: Error code
|
||||
|
||||
|
@ -419,21 +371,236 @@ cop_sector_read:
|
|||
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 15: Write Sectors
|
||||
; Function 11: Write Sectors
|
||||
;
|
||||
; Write a number of sectors to the SD card from a buffer provided by the caller.
|
||||
; Arguments are provided in a structure with the following format:
|
||||
;
|
||||
; Write a number of sectors to the specified physical device. Arguments are
|
||||
; provided in a structure with the following format:
|
||||
; struct sector_write_s {
|
||||
; uint8_t device;
|
||||
; uint32_t first_sector;
|
||||
; uint8_t length;
|
||||
; void *src;
|
||||
; far void *src;
|
||||
; };
|
||||
;
|
||||
; Arguments:
|
||||
; C: Bank of argument address
|
||||
; A: Bank of argument address
|
||||
; Y: Argument address
|
||||
; Return Value: Error code
|
||||
|
||||
cop_sector_write:
|
||||
cop_rti
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 12: Open File
|
||||
;
|
||||
; Given a pointer to a NULL-terminated string representing the full path to a
|
||||
; file, create a new file handle representing that file, open the file, and
|
||||
; return the file handle.
|
||||
;
|
||||
; struct sector_write_s {
|
||||
; char *path;
|
||||
; uint8_t mode;
|
||||
; };
|
||||
;
|
||||
; The mode is a bit-flag composed of the binary OR of any of the following
|
||||
; options:
|
||||
; MODE_READ
|
||||
; Specifies read access to the file.
|
||||
; Combine with MODE_WRITE for read-write access.
|
||||
; MODE_WRITE
|
||||
; Specifies write access to the file.
|
||||
; Combine with MODE_READ for read-write access.
|
||||
; MODE_OPEN_EXISTING
|
||||
; Opens a file. The function fails if the file does not exist.
|
||||
; MODE_CREATE_NEW
|
||||
; Creates a new file. The function fails if the file already exists.
|
||||
; MODE_CREATE_ALWAYS
|
||||
; Creates a new file. If the file exists, it will be overwritten.
|
||||
; MODE_OPEN_ALWAYS
|
||||
; Create the file if it does not exist.
|
||||
; MODE_OPEN_APPEND
|
||||
; Same as MODE_OPEN_ALWAYS except the index pointer is set to the
|
||||
; end of the file.
|
||||
;
|
||||
; Arguments:
|
||||
; A: Bank of argument address
|
||||
; Y: Argument address
|
||||
; Return Value:
|
||||
; A: Error code
|
||||
; Y: File handle
|
||||
|
||||
cop_file_open:
|
||||
cop_rti
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 13: Create File
|
||||
;
|
||||
; Given a pointer to a NULL-terminated string representing the full path to a
|
||||
; file, create a new file handle representing that file, create the file, and
|
||||
; return an open file handle.
|
||||
;
|
||||
; Arguments:
|
||||
; A: Bank of string address
|
||||
; Y: String address
|
||||
; Return Value:
|
||||
; A: Error code
|
||||
; Y: File handle
|
||||
|
||||
cop_file_create:
|
||||
cop_rti
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 14: Close File
|
||||
;
|
||||
; Given a file handle, close it and invalidate the file handle.
|
||||
;
|
||||
; Arguments:
|
||||
; C: File handle
|
||||
; Return Value:
|
||||
; C: Error code
|
||||
|
||||
cop_file_close:
|
||||
cop_rti
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 15: Read File
|
||||
;
|
||||
; Given an open file handle and a buffer into which to place data, read data
|
||||
; from the file into the buffer. Arguments are supplied in a structure with the
|
||||
; following format:
|
||||
;
|
||||
; struct file_read_args {
|
||||
; uint16_t file_handle;
|
||||
; uint16_t length;
|
||||
; far void *dest;
|
||||
; };
|
||||
;
|
||||
; Arguments:
|
||||
; A: Bank of argument address
|
||||
; Y: Argument address
|
||||
; Return Value:
|
||||
; A: Error code
|
||||
; Y: Number of bytes actually read
|
||||
|
||||
cop_file_read:
|
||||
cop_rti
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 16: Write File
|
||||
;
|
||||
; Given an open file handle and a buffer from which to source data, write data
|
||||
; into the file from the buffer. Arguments are supplied in a structure with the
|
||||
; following format:
|
||||
;
|
||||
; struct file_write_args {
|
||||
; uint16_t file_handle;
|
||||
; uint16_t length;
|
||||
; far void *src;
|
||||
; };
|
||||
;
|
||||
; Arguments:
|
||||
; A: Bank of argument address
|
||||
; Y: Argument address
|
||||
; Return Value:
|
||||
; A: Error code
|
||||
; Y: Number of bytes actually written
|
||||
|
||||
cop_file_write:
|
||||
cop_rti
|
||||
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 17: Seek in File
|
||||
;
|
||||
; Given an open file handle and an offset, reposition the file's index.
|
||||
; Arguments are supplied in a structure with the following format:
|
||||
;
|
||||
; struct file_seek_args {
|
||||
; uint16_t file_handle;
|
||||
; uint16_t offset;
|
||||
; bool relative;
|
||||
; };
|
||||
;
|
||||
; Arguments:
|
||||
; A: Bank of argument address
|
||||
; Y: Argument address
|
||||
; Return Value:
|
||||
; A: Error code
|
||||
; Y: Current index position relative to file beginning
|
||||
|
||||
cop_file_seek:
|
||||
cop_rti
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 14: Close File
|
||||
;
|
||||
; Given a file handle, delete the represented file from the filesyste, and close
|
||||
; and invalidate the file handle.
|
||||
;
|
||||
; Arguments:
|
||||
; C: File handle
|
||||
; Return Value:
|
||||
; C: Error code
|
||||
|
||||
cop_file_delete:
|
||||
cop_rti
|
||||
|
||||
; -----------------------------------------------------------------------------
|
||||
; Function 14: Move File
|
||||
;
|
||||
; Given an open file handle and a fully qualified path string, move the represented
|
||||
; file to the new path. Arguments are passed in a structure with the following
|
||||
; format:
|
||||
;
|
||||
; struct move_file_args {
|
||||
; uint16_t file_handle;
|
||||
; char *path;
|
||||
; };
|
||||
;
|
||||
; Arguments:
|
||||
; A: Bank of argument address
|
||||
; Y: Argument address
|
||||
; Return Value:
|
||||
; A: Error code
|
||||
|
||||
cop_file_move:
|
||||
cop_rti
|
||||
|
||||
cop_file_get_attributes:
|
||||
cop_rti
|
||||
|
||||
cop_file_set_attributes:
|
||||
cop_rti
|
||||
|
||||
cop_file_get_timestamp:
|
||||
cop_rti
|
||||
|
||||
cop_file_set_timestamp:
|
||||
cop_rti
|
||||
|
||||
cop_get_working_directory:
|
||||
cop_rti
|
||||
|
||||
cop_set_working_directory:
|
||||
cop_rti
|
||||
|
||||
cop_exec:
|
||||
cop_rti
|
||||
|
||||
cop_exit:
|
||||
cop_rti
|
||||
|
||||
cop_volume_initialize:
|
||||
cop_rti
|
||||
|
||||
cop_volume_format:
|
||||
cop_rti
|
||||
|
||||
cop_get_environment_value:
|
||||
cop_rti
|
||||
|
||||
cop_set_environment_value:
|
||||
cop_rti
|
||||
|
||||
cop_ioctl:
|
||||
cop_rti
|
||||
|
|
Loading…
Reference in New Issue