diff --git a/doc/blockdev.md b/doc/blockdev.md index 084e23e..d48e1a0 100644 --- a/doc/blockdev.md +++ b/doc/blockdev.md @@ -38,13 +38,13 @@ they should try to adhere to the convention, that is: ## Shell usage -`blockdev.asm` supplies 2 shell commands that you can graft to your shell thus: +`blockdev.asm` supplies 4 shell commands that you can graft to your shell thus: [...] - SHELL_EXTRA_CMD_COUNT .equ 2 + SHELL_EXTRA_CMD_COUNT .equ 4 #include "shell.asm" ; extra commands - .dw blkBselCmd, blkSeekCmd + .dw blkBselCmd, blkSeekCmd, blkLoadCmd, blkSaveCmd [...] ### bsel @@ -62,6 +62,18 @@ The device position is device-specific: if you seek on a device, then switch to another device and seek again, your previous position isn't lost. You will still be on the same position when you come back. +### load + +`load` works a bit like `poke` except that it reads its data from the currently +active blockdev at its current position. If it hits the end of the blockdev +before it could load its specified number of bytes, it stops. It only raises an +error if it couldn't load any byte. + +### save + +`save` is the opposite of `load`. It writes the specified number of bytes from +memory to the active blockdev at its current position. + ### Example Let's try an example: You glue yourself a Collapse OS with ACIA as its first @@ -70,7 +82,7 @@ could do to copy memory around: > mptr d000 D000 - > load 4 [device 0 is selected initially] + > poke 4 [enter "abcd"] > peek 4 61626364 @@ -83,7 +95,7 @@ could do to copy memory around: [returns immediately] > peek 4 61626364 - > seek 0002 + > seek 00 0002 > load 2 > peek 4 63646364 diff --git a/doc/shell.md b/doc/shell.md index 656e3a2..9a81ed0 100644 --- a/doc/shell.md +++ b/doc/shell.md @@ -19,7 +19,7 @@ smaller than `0x10`. Example calls: mptr 01ff peek 4 - load 1f + poke 1f call 00 0123 All numbers printed by the shell are in hexadecimals form. @@ -56,20 +56,16 @@ bytes we want to read. Example: > peek 2 ED56 -## load +## poke Puts the serial console in input mode and waits for a specific number of characters to be typed (that number being specified by a byte argument). These characters will be literally placed in memory, one after the other, starting at `memptr`. -This command is, for now, of limited use because it's tied to the active -console, but a method for selecting I/O sources is planned and this command will -become much more useful. - Example: - > load 5 + > poke 5 Hello > peek 5 48656C6C6F