Documentation of kernel API

This commit is contained in:
Kyle J Cardoza 2024-07-08 23:14:59 -04:00
parent a4a72f6d16
commit 3d981098bb
1 changed files with 35 additions and 15 deletions

View File

@ -181,7 +181,7 @@ Arguments:
Y: Address of buffer Y: Address of buffer
Return Values: Return Values:
C: Status code C: Status code
Argument Structure: Argument Structure:
@ -222,17 +222,17 @@ Arguments:
Return Values: Return Values:
C: Status code C: Status code
X: File handle X: File handle
This call attempts to open the file referred to by the provided NULL-terminated This call attempts to open the file referred to by the provided NULL-terminated
string, which must contain a fully-qualified pathname -- something of the form string, which must contain a fully-qualified pathname -- something of the form
`[drive]:/[dir]/[dir2]/filename.ext`, such as `sd0:/games/kaboom/readme.ansi`. `[drive]:/[dir]/[dir2]/filename.ext`, such as `sd0:/games/kaboom/readme.ansi`.
If the file is successfully opened, the C accumulator will contain STATUS_OK, and If the file is successfully opened, the C accumulator will contain STATUS_OK, and
the X register will contain the file handle. On error, the C accumulator will contain the X register will contain the file handle. On error, the C accumulator will contain
a negative value indicating which error has occured. a negative value indicating which error has occured.
## 0x0E: Close File ## 0x0E: Close File Handle
Arguments: Arguments:
C: 0x0E C: 0x0E
@ -261,16 +261,16 @@ On success, the C accumulator will contain a status code of STATUS_OK, and the X
register will contain the duplicate file handle. On error, the C accumulator will register will contain the duplicate file handle. On error, the C accumulator will
contain a negative value, indicating an error has occured. contain a negative value, indicating an error has occured.
## 0x10: Read from File Handle ## 0x10: Read from File
Arguments: Arguments:
C: 0x10 C: 0x10
X: Bank of argument block X: Bank of argument block
Y: Address of argument block Y: Address of argument block
Return Values: Return Values:
C: Status code C: Status code
X: Number of bytes actually read X: Number of bytes actually read
Argument block structure: Argument block structure:
@ -283,20 +283,20 @@ Argument block structure:
This call attempts to read up to `length` bytes from the file handle `file`, into This call attempts to read up to `length` bytes from the file handle `file`, into
the buffer pointed to by `dest`. On success, the C accumulator will contain STATUS_OK, the buffer pointed to by `dest`. On success, the C accumulator will contain STATUS_OK,
and the X register will contain the number of bytes actually read. On error, the C and the X register will contain the number of bytes actually read. On error, the C
accumulator will contain a negative value indicating the specific error, and the X accumulator will contain a negative value indicating the specific error, and the X
register will contain the number of bytes actually read. register will contain the number of bytes actually read.
## 0x11: Write to File Handle ## 0x11: Write to File
Arguments: Arguments:
C: 0x11 C: 0x11
X: Bank of argument block X: Bank of argument block
Y: Address of argument block Y: Address of argument block
Return Values: Return Values:
C: Status code C: Status code
X: Number of bytes actually written X: Number of bytes actually written
Argument block structure: Argument block structure:
@ -309,6 +309,26 @@ Argument block structure:
This call attempts to write up to `length` bytes to the file handle `file`, from This call attempts to write up to `length` bytes to the file handle `file`, from
the buffer pointed to by `src`. On success, the C accumulator will contain STATUS_OK, the buffer pointed to by `src`. On success, the C accumulator will contain STATUS_OK,
and the X register will contain the number of bytes actually written. On error, the C and the X register will contain the number of bytes actually written. On error, the C
accumulator will contain a negative value indicating the specific error, and the X accumulator will contain a negative value indicating the specific error, and the X
register will contain the number of bytes actually written. register will contain the number of bytes actually written.
## 0x12: Seek in File
Arguments:
C: 0x12
X: Seek value
Y: Seek origin
0x00: Seek relative to the beginning of the file
0x01: Seek relative to the current position in the file
0x02: Seek relative to the end of the file
Return value:
C: Status code
X: New file position (31:16)
Y: New file position (15:0)
This call moves the internal file pointer, the position in the specified file from
which data can be read or to which data can be written. On success, this call returns
STATUS_OK in C, and the new file position in X and Y. On error, C will contain a negative
value indicating the specific error, and the new file position in X and Y.