printf("Paper tape will load at address 0%o.\n", address);
/*
- * Paper tape format(bytes, not words):
- * 01
- * 00
- * Low byte of packet length (binary length + 6 for header)
- * High byte of packet length
- * Low byte of address to load binary data at
- * High byte of address
- * DataBegin
- * |
- * |
- * DataEnd
- * Checksum
+ * SIMH Binary Loader Format
*
- * I am unsure of the checksum format and need to check the SIMH source.
- * In the meantime a zero checksum still functions, albeit with a warning.
+ * Loader format consists of blocks, optionally preceded, separated, and
+ * followed by zeroes. Each block consists of the following entries. Note
+ * that all entries are one byte.
+ *
+ * 0001
+ * 0000
+ * Low byte of block length (data byte count + 6 for header, excludes checksum)
+ * High byte of block length
+ * Low byte of load address
+ * High byte of load address
+ * Data byte 0
+ * ...
+ * Data byte N
+ * Checksum
+ *
+ * The 8-bit checksum for a block is the twos-complement of the lower eight
+ * sum bits for all six header bytes and all data bytes.
+ *
+ * If the block length is exactly six bytes (i.e. only header, no data),
+ * then the block marks the end-of-tape. The checksum should be zero. If
+ * the load address of this final block is not 000001, then it is used as
+ * the starting PC.
*/
uint16_t size = 6;