diff --git a/doc/syscalls.md b/doc/syscalls.md index 4088f22..57636fe 100644 --- a/doc/syscalls.md +++ b/doc/syscalls.md @@ -181,7 +181,7 @@ Arguments: Y: Address of buffer Return Values: - C: Status code + C: Status code Argument Structure: @@ -222,17 +222,17 @@ Arguments: Return Values: C: Status code - X: File handle + X: File handle 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 `[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 -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. -## 0x0E: Close File +## 0x0E: Close File Handle Arguments: 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 contain a negative value, indicating an error has occured. -## 0x10: Read from File Handle +## 0x10: Read from File Arguments: C: 0x10 X: Bank of argument block - Y: Address of argument block + Y: Address of argument block Return Values: - C: Status code - X: Number of bytes actually read + C: Status code + X: Number of bytes actually read 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 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 register will contain the number of bytes actually read. -## 0x11: Write to File Handle +## 0x11: Write to File Arguments: C: 0x11 X: Bank of argument block - Y: Address of argument block + Y: Address of argument block Return Values: - C: Status code - X: Number of bytes actually written + C: Status code + X: Number of bytes actually written 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 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 -register will contain the number of bytes actually written. \ No newline at end of file +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. \ No newline at end of file