Improved description of tape format in source code comment.
authorAaron Taylor <ataylor@subgeniuskitty.com>
Mon, 28 Dec 2020 06:59:39 +0000 (22:59 -0800)
committerAaron Taylor <ataylor@subgeniuskitty.com>
Mon, 28 Dec 2020 06:59:39 +0000 (22:59 -0800)
bin2load.c

index 5764c9f..baf98a2 100644 (file)
@@ -65,21 +65,30 @@ main( int argc, char ** argv)
     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;