Heath8080A — Product Design : Tape I/O

Page last updated

home   release   support   design   resources   legal   site map



On this page


Related links

system architecture
i/o package
serial i/o

Tape I/O

The Tape I/O processes were built early in the project. Some of the ideas of how to efficiently handle character pacing to and from high-performance devices were developed here and improved later in the project. Logically, this should be part of the Serial I/O package, but it was already written when Serial I/O was conceived so I let it be.

All H8 I/O must flow through the I/O package, which maintains minimal 8251 USART emulation. These routines provide the "glue" between the I/O package and the Macintosh disk system; this is all Macintosh code with nothing of the H8 system emulated here.

Tape File Format

Tape files contain all characters output by PAM/8 when it dumps a tape, with no other formatting or compression. The file format is binary. The contents, as written by PAM/8, are as follows:

  • 32 sync characters (026q) (the PAM/8 Load routine requires at least 10 sync characters to be present);
  • one STX character (002q);
  • a constant 201q followed by 001q (according to the PAM/8 listing, this is a "first and last block" indicator);
  • the length in bytes of the program text — This is a 16-bit number recorded high-order byte first, reversing the normal order of 16-bit values on an 8080A;
  • the entry point address to be loaded into (PC) after the load completes — This is a 16-bit number recorded high-order byte first, reversing the normal order of 16-bit values on an 8080A;
  • the load start address — This is a 16-bit number recorded high-order byte first, reversing the normal order of 16-bit values on an 8080A;
  • the text of the program, continuing for "length" bytes;
  • the 16-bit calculated checksum;
  • the 16-bit calculated checksum again.

The checksum was repeated as a convenient way to "flush" the 8251's output buffer before stopping the tape, thus making sure that the checksum had been recorded before stopping the tape. (In most other applications, a "pad" character — 377q — is used for this purpose, but rewriting the checksum took less PAM/8 code space.)

go to top

Tape Implementation

The emulator maps PAM/8 tapes to Macintosh disk files, using a creator of 'h8h8' and a type of 'h8tp'. The user must open an input or output file for the emulator before using the PAM/8 load (8) or dump (9) keys. The user must close an open file before opening another one.

Output tape files can be appended to until they are closed (it's possible, though probably silly, to have multiple dumps contained in a single disk file). All tape files are closed when the emulator is quit.

Any tape file opened using the Finder will be opened for input. If there was a file already open for input, that file is closed and the new file opened.

After successfully opening a Tape file, the Tape I/O package notifies the I/O package so that it can return the appropriate status bit(s) when PAM/8 reads the 8251 status register. When a Load file is open, the I/O package will return the receiver ready (RXR) status bit (0x02) on any IN to the tape control port, address 371q. When a Dump file is open, the I/O package will return the transmitter ready (TXR) status bit (0x01) on any IN to the port. These bits can be held high constantly while the file is open; since reading from / writing to buffer memory is nearly instantaneous, there was nothing to be gained by emulating the 8251 chip any more closely than that.

When an input file is open, any IN to the tape data port (370q) will return the next sequential byte from the open file. Once all bytes have been transferred, or if there is no file open, 000q is returned.

When an Output file is open, any OUTput to the tape data port will put the output byte in the next sequential position of the output buffer. If no file is open, the byte is ignored. The buffer is flushed when full and when the file is closed.

go to top

Operating Instructions

Dump — To dump memory to "tape," follow these steps:

  1. Put the dump start address into locations 040.000a and 040.001a, low-order byte of the address first (example: to start dumping at 040.100a, enter the command "mem 0 4 0 0 0 0 alter 1 0 0 0 4 0 alter").

  2. Put the starting program counter (PC) address into PC.

  3. Display the last memory byte of the program (example: if the last byte of the program is at 052.230a, enter "mem 0 5 2 2 3 0").

  4. Open an output file, giving it any valid Macintosh file name.

  5. Press the Dump (9) key.

  6. Close the output file.

Load — To load a dumped "tape," follow these steps:

  1. Open a previously-dumped input "tape" file.

  2. Press the Load (8) key.

  3. Close the input file.

This is the "neatest" way to dump and load. However, PAM will wait patiently for ready status from port 371q for either operation, so it is possible to open the dump or load file after pressing the dump or load key and the results will be the same.

go to top

home   release   support   design   resources   legal   site map