Documentation of kernel API

This commit is contained in:
Kyle J Cardoza 2024-07-08 23:54:43 -04:00
parent 72b426f0a7
commit 499a1e4e3e
1 changed files with 12 additions and 12 deletions

View File

@ -12,7 +12,7 @@ The system API is based loosely on, but not compatible with, that of
CP/M-3 and MSX-DOS 2. CP/M-3 and MSX-DOS 2.
Most calls return a status code in C. This code has one value, `STATUS_OK`, Most calls return a status code in C. This code has one value, `STATUS_OK`,
(equal to `0x0000`) which applies to all such calls; this value indicates (equal to `0x0000`) which applies to all sxuch calls; this value indicates
that the call was successful. Any other value will indicate some specific that the call was successful. Any other value will indicate some specific
error. error.
@ -243,7 +243,7 @@ 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 Handle ## `0x0E`: Close File Handle
@ -271,7 +271,7 @@ Return Values:
This call attempts to duplicate the provided file handle. The new file handle This call attempts to duplicate the provided file handle. The new file handle
will be exactly identical to the provided one, and either may be used at any time. will be exactly identical to the provided one, and either may be used at any time.
On success, the C accumulator will contain a status code of `STATUS_OK`, and the X 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.
@ -298,8 +298,8 @@ Argument 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 ## `0x11`: Write to File
@ -325,8 +325,8 @@ Argument 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 ## `0x12`: Seek in File
@ -346,8 +346,8 @@ Return value:
This call moves the internal file pointer, the position in the specified file from 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 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 `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. value indicating the specific error, and the new file position in `X` and `Y`.
## `0x13`: Device I/O Control ## `0x13`: Device I/O Control
@ -364,8 +364,8 @@ Return Values:
- `C`: Status code - `C`: Status code
This call attempts to delete the file indicated by the given `NULL`-terminated string, This call attempts to delete the file indicated by the given `NULL`-terminated string,
which must contain a fully-qualified pathname. On success, this C will contain which must contain a fully-qualified pathname. On success, this `C` will contain
`STATUS_OK`. On failure, C will contain a negative number indicating the specific `STATUS_OK`. On failure, `C` will contain a negative number indicating the specific
error. error.
## `0x15`: Move File ## `0x15`: Move File
@ -388,5 +388,5 @@ Argument Structure:
``` ```
This call attempts to move or rename the specified `source` file to `dest`. On success, This call attempts to move or rename the specified `source` file to `dest`. On success,
C will contain `STATUS_OK`. On error, C will contain a negative value indicating the `C` will contain `STATUS_OK`. On error, `C` will contain a negative value indicating the
specific error. specific error.