today marked the successful testing of the RECV (serial receive) command for the 8-bit project. the format of the command is
with the square brackets indicating that the address argument is optional.
this isn’t the first command that’s been tested, but it is the first since i’ve started this blog, so it gains the distinction of the first success that i report here. i do intend to go back and cover the already-tested commands as well though. also, there will be an overview post going over the entire command set as currently planned.
the serial data is received in the following format:
- the 2-byte address at which the data should be stored (if the address argument is included, the received address is replaced by the argument), LSB first.
- the 2-byte length of the data to be received, LSB first.
- the data itself, in 256-byte blocks. before each block, an ACK (0xAA) is sent to inform the sender that the software is ready to receive. after receipt of the last block (which may be less than 256 bytes) a final ACK is sent to inform the sender that receipt is complete.
the address argument must be exactly four hex characters long. so e.g. if you wanted to receive the data at decimal address 768, you would need to enter the address argument as A$0300; A$300 would be rejected as an error. while not perfectly ideal, i’m concentrating at this point on getting everything to just work. assuming i ever get to the point of completing this project to the point where it’s fully working on native hardware, then i may go back and add ‘niceties’ such as allowing a 3-character hex address to be interpreted properly.
to keep the user updated on the progress of the transfer, the command outputs several pieces of information:
- the command starts by outputting an ‘I’ to indicate it has initialized and is ready to begin receiving data
- after receipt of the address and length arguments, an ‘R’ is output
- after receipt of each 256-byte block (and the last less-than-256 byte block if needed), an additional ‘R’ is output
- after data receipt is complete, a status message is output on a new line: “File received at $xxxx:yyyy bytes”, where xxxx is the address the data was stored at and yyyy is the length of the data received. both are in hex, and both are exactly 4 hex characters long.
testing was performed both with and without the address argument, as well as with an invalid address argument to ensure the testing of that code.
the next command to be worked on is SHOW, for displaying the contents of memory. in fact, after completing testing of RECV this morning, i wrote the code for SHOW and am ready to upload and test that. i may do that tomorrow…