From c77d96da221b59c602ca8b8f4a99d53e22049301 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Sun, 12 May 2019 11:45:08 -0400 Subject: [PATCH] blockdev: clarify routines specs --- parts/z80/blockdev.asm | 30 ++++++++++++++++++++++++++++++ parts/z80/fs.asm | 2 +- 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/parts/z80/blockdev.asm b/parts/z80/blockdev.asm index 07ffa33..0afbe5d 100644 --- a/parts/z80/blockdev.asm +++ b/parts/z80/blockdev.asm @@ -8,6 +8,36 @@ ; ; This part exposes a new "bsel" command to select the currently active block ; device. +; +; *** Blockdev routines *** +; +; There are 4 blockdev routines that can be defined by would-be block devices +; and they follow these specifications: +; +; GetC: +; Reads one character from selected device and returns its value in A. +; Sets Z according to whether read was successful: Set if successful, unset +; if not. +; +; A successful GetC should advance the "pointer" of the device (if there is one) +; by one byte so that a subsequent GetC will read the next char. Unsuccessful +; reads generally mean that we reached EOF. +; +; +; PutC: +; Writes character in A in current position in the selected device. Sets Z +; according to whether the operation was successful. +; +; A successful PutC should advance the "pointer" of the device (if there is one) +; by one byte so that the next PutC places the next char next to this one. +; Unsuccessful writes generally mean that we reached EOF. +; +; Seek: +; Place device "pointer" at position dictated by HL. +; +; Tell: +; Return the position of the "pointer" in HL + ; *** DEFINES *** ; BLOCKDEV_COUNT: The number of devices we manage. diff --git a/parts/z80/fs.asm b/parts/z80/fs.asm index a567966..639cf3e 100644 --- a/parts/z80/fs.asm +++ b/parts/z80/fs.asm @@ -25,7 +25,7 @@ ; error out if there's no metadata: we create a new CFS fs with an empty block. ; ; The can only be one "mounted" fs at once. Selecting another blockdev through -; "bsel" foesn't affect the currently mounted fs, which can still be interacted +; "bsel" doesn't affect the currently mounted fs, which can still be interacted ; with (which is important if we want to move data around). ; ; *** Block metadata